why is the yess and noo not working?
Hey guys! its you boy, someone bad at python. its been a while so i dont really now why this is working.I was asked to make a piecee of code that would simulate a bot makeing a cup of tea so i tried. in my code, i tried to optimise for yes/no questions by makeing a variable containing most of the different varieties of yes and no but when i imput anything, the code just ends, do you know why? thanks!
Lines 6 and 7 you included a list containing different kinds of yes and no. However, on line 8 in the
if statement, you did
if yesorno == yess:
but you probably want to do:
if yesorno in yess: # this checks if the input of the user is in the list
same thing on line 17, change it from
if yesorno == noo: to:
if yesorno in noo: # checks if user input is in the noo list
Lemme know if you need anymore help or if I was unclear! :)
wdym by "the def thing"?
def is for functions, so you can keep everything in one file if you want. Looks like you did the function on line 33 correctly but you forgot the
() after the function name. Correct version:
def loadingbar(): #print('makeing') toolbar_width = 50 etc.
Does this solve the problem? ;)
At the line when you work with
yesorno, 2 lists and the ifs,
if yesorno == yess: # Other code here, I will not show it
Just replace the
in, like this:
if yesorno in yess: # Other code
It should work.