+ 1
How do i simply choose either of the two names
Understanding syntax/functions of python name1 = 'Jeremy' name2 = 'Monchito' pickname = '' while pickname != name1 or name2: pickname = input('People you know:') print('they are your co workers') It's not working when i pick either
3 Antworten
+ 6
networkblue ,
best way would be what Ipang mentioned.
independent from this, the conditional statement in your code was not quite correct. you can do it like this:
...
while not (pickname == name1 or pickname == name2):
pickname = input('People you know:')
...
+ 5
It could be simplified by adding the co-workers' names into a `list` or a `tuple`. We can then use the `in` operator to see whether or not <pickname> exist in the `list` or `tuple`
+ 2
Thnks fellow masters 🙂