Hey guys,
I was wondering if someone could help me out....I'm looking to write a simple code where the user is asked to enter a colour, if they enter green, blue or red it stores their answer and then moves on.... however I also want it to loop so that it will keep asking the same question until the user has entered one of those three colours...
Is there anyone that could please help me out with this? I would be so grateful!!
So far I have....
Could any one help with this please, even if the code you give is completely different to this!
I was wondering if someone could help me out....I'm looking to write a simple code where the user is asked to enter a colour, if they enter green, blue or red it stores their answer and then moves on.... however I also want it to loop so that it will keep asking the same question until the user has entered one of those three colours...
Is there anyone that could please help me out with this? I would be so grateful!!
So far I have....
colour = " " colour = input ("Enter a colour from green, blue or yellow") while colour != "blue" or "yellow" or "green" print ("Enter a colour from the list")The code above seemed to work when I only had one option for them to choose from, as soon as I use the 'or' it just loops no matter what input I give...
Could any one help with this please, even if the code you give is completely different to this!
buran write Mar-20-2021, 12:36 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.