Q. Write a Python program to input 'n' classes and names of their class teachers to store them in a dictionary and display the same. Also accept a particular class from the user and display the name of the class teacher of that class.
Answer =
dic = {} while True : clas = int(input("Enter class :-")) teach = input("Enter class teacher name :-") dic[clas]= teach a = input("Do you want to enter more records enter (Yes/ No)") if a == "No" or a == "no": break clas = int(input("Enter class which you want to search")) print("class teacher name",dic[clas])
please using for loop
ReplyDeleteWe can not use for loop for infinite times.
DeleteThanks 👍 very much 🙏
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )