0
print("enter the names of guest")
guest= []#empty list
name = " " #empty string
while name != "done" or "DONE" #while loop to continue asking the user for names that are not equal to done or DONE.
 name= (input ('enter the names of guest (enter done or DONE if there are no more names): ')#taking the the names from the user.
 if name.lower() != 'done' or name.upper() != 'DONE'# escape adding the done or DONE to the list.
 guest.append(name)# adding the list from the user to the empty list..

guest.sort()# put the list in an ordered manner print(guest)

ayhan
  • 70,170
  • 20
  • 182
  • 203
  • `while name != "done" or "DONE" ` This won't work. Check the duplicate for the correct usage. – ayhan Jan 05 '18 at 22:01
  • 2
    That's not what `or` does. `while name != "done" or "DONE"` gets evaluated as `while (name != "done") or ("DONE")` which doesn't make a whole lot of sense and always evaluates to an infinite loop. – Beefster Jan 05 '18 at 22:01
  • within an if statement of while condition "DONE" always evaluates to True, the empty string "" evaluates to False. – ShpielMeister Jan 05 '18 at 22:14

0 Answers0