Friday, 24 March 2017

If statement for strings in python?

I am a total beginner and have been looking at http://en.wikibooks.org/wiki/Python_Programming/Conditional_Statements but I can not understand the problem here. It is pretty simple, if the user enters y it should print this will do the calculation although I get a syntax error on IF answer=="y"



answer = str(input("Is the information correct? Enter Y for yes or N for no"))
proceed="y" or "Y"

If answer==proceed:
print("this will do the calculation"):
else:
exit()

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...