How can I write orders with loop, dictionary and if statement by python If I want the output result from dictionary list and for the others input print a sentence Here is my program could someone find what is the solution for the mistakes
def phone_guide():
guide_number = input("Enter a number:")
numbers = {"Amal": 1111111111, "Mohammed": 2222222222, "Khadijah": 3333333333, "Abdullah": 4444444444}
While guide_number == 1111111111: print("Amal")
elif guide_number == 2222222222: print("Mohammed")
elif guide_number == 3333333333: print("khadijah")
elif guide_number == 4444444444: print("Abdullah")
elif guide_number != numbers: print("Sorry, the number is not found")
This mean the number has to be from the dictionary list
else: print("This is invalid number")
This mean if the number less or more than 10 number or different value or string phone_guide()
Aucun commentaire:
Enregistrer un commentaire