Reputation: 1
I write this simple bit of code (Python 3.2 on Win32):
def main():
decision = input('¿Send mail? (y/n): ')
if decision == "y":
sender()
print("Mail sent.")
else:
print("Cancelled.")
input()
def sender():
print("In sender ... ")
pass
main()
and it works as expected in IDLE, but in the Windows console it surprisingly says 'cancelled' when you choose 'y'.
Now this makes no sense to me, Can you please help me see what's wrong?
Upvotes: 0
Views: 143
Reputation: 86754
I suggest you read the definition of input()
. It is not recommended for general user input as it expects syntactically valid Python code and eval()
s it.
Upvotes: 1