Tuesday 26 June 2018

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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...