No products in the cart.

Write a python program to input …

CBSE, JEE, NEET, CUET

CBSE, JEE, NEET, CUET

Question Bank, Mock Tests, Exam Papers

NCERT Solutions, Sample Papers, Notes, Videos

Write a python program to input 'n' classes and names of their class teachers to store them in a dictionary and display the name . Also accept a particular class from the user and display the name of the class teacher of that class
  • 1 answers

Preeti Dabral 2 years, 11 months ago

schooldict ={}

no_of_class=int(input('Enter the number of classes:'))

for x in range(1,no_of_class+1):

schooldict[x] = input('Enter the teacher names:')

print("Display:")

print(schooldict)
 

classId=int(input('Enter class Id:'))

if classId in schooldict:

print ("teacher name: " + str(schooldict[classId]) + "\n")

http://mycbseguide.com/examin8/

Related Questions

What are called tokens
  • 2 answers

myCBSEguide App

myCBSEguide

Trusted by 1 Crore+ Students

Test Generator

Test Generator

Create papers online. It's FREE.

CUET Mock Tests

CUET Mock Tests

75,000+ questions to practice only on myCBSEguide app

Download myCBSEguide App