You want:
answer = str(raw_input("Is the information correct? Enter Y for yes or N for no"))
if answer == "y" or answer == "Y":
print("this will do the calculation")
else:
exit()
Or
answer = str(raw_input("Is the information correct? Enter Y for yes or N for no"))
if answer in ["y","Y"]:
print("this will do the calculation")
else:
exit()
Note:
- It's "if", not "If". Python is case sensitive.
- Indentation is important.
- There is no colon or semi-colon at the end of python commands.
- You want raw_input not input;
input
evals the input.
- "or" gives you the first result if it evaluates to true, and the second result otherwise. So
"a" or "b"
evaluates to "a"
, whereas 0 or "b"
evaluates to "b"
. See The Peculiar Nature of and and or.