Skip to content
← Back to Community
does anyone know how to fix this?
Profile icon

question i am having trouble finding out how to do this can anyone help?

Profile icon
Profile icon


your code is wrong in some places;

on line 4, you wrote input for (sa) = (yes) but that isn't a proper code structure, you're combining the for keyword and the input keyword together which is wrong.

If you want an input, do something like this:

variable = input("Something") # what the user will write will be stored in the variable

Then on line 7, you wrote input or (ha) = (no) which is wrong as you can't assign the keyword input to the operator or. Maybe what you want is to check if what the user wrote is equal to 'ha' or 'no'? In that case, here is a rewritten version of your code based on what I think you want to try and achieve:

name = input('what is your name?\n') # this part asks for the user's name and stores it in a variable print("hi, %s." % name) # this outputs the variable name with the string 'hi' # input for (sa) = (yes) # sa = ('yes') want_drink = input('would you like a drink, %s.' % 'yes or no') # asks user if they want a drink, stores what they say in a variable # conditionals if want_drink == 'yes': # if what the user equals 'yes' print('here you go') elif want_drink == 'no': # if the user wrote 'no' print('ok')

Possible output:

what is your name? bob hi, bob. would you like a drink, yes or ok

Another output:

what is your name? bob hi, bob. would you like a drink, yes or no.yes here you go

Is this what you wanted? Lemme know if I was unclear or if you need more help! :)

Profile icon

Ok, so your error is the input. Follow this code:

ha_input = input("ha")

Make that input like that. That should work