I am super new to Python and programming and am trying to digest some basics I’ve learned.
I am stuck on a running a question in python and returning differing statements depending on the reply – yes/no.
Here’s my code;
answer = input('Would you go on strike') if answer == 'yes': print ('You are\'t a strikebreaker') else: print ('You are a strikebreaker')
Whatever I answer, python prints the ‘else’ response. I have checked a few examples and tutorials and that appears to be the simple code.
I followed a few tutorials and expected to get different print statements correlating to the input response.
Strange, what you’re doing should work, I just tried it out myself.
Be aware that string comparisson is case sensetive.
What version of python are you running? Make sure you are using python 3.x.
If you use python 2.x you will have to use raw_input() instead of input()
Hope this helps