Find error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Find error

rooms = {1: 'Foyer',2:'Conference room'} room = input("enter the room number :") if not room in rooms: print("Room does not exist") else: print("the room name is " + rooms[room])

28th May 2020, 6:28 AM
Sai Rajveer Kondeti
Sai Rajveer Kondeti - avatar
2 Answers
+ 1
You mapped integers to Foyer2 and confrence classroom, make it rooms = {'1': 'Foyer', '2': 'Confrence room'} Its good practice NOT to map integers to others things though. it gets confusing
28th May 2020, 6:32 AM
Slick
Slick - avatar
+ 1
room = int(input("enter the room number :"))
28th May 2020, 6:33 AM
Sousou
Sousou - avatar