I've tried to copy this example from the Tutorial into the Python Idle, but it doesn't seem to recognize it.
4.1. if <https://docs.python.org/3/reference/compound_stmts.html#if> Statements¶ <https://docs.python.org/3/tutorial/controlflow.html#if-statements> Perhaps the most well-known statement type is the if <https://docs.python.org/3/reference/compound_stmts.html#if> statement. For example: >>> >>> x = int(input("Please enter an integer: "))Please enter an integer: 42>>> >>> if x < 0:... x = 0... print('Negative changed to zero')... elif x >>> == 0:... print('Zero')... elif x == 1:... print('Single')... >>> else:... print('More')...More This is what it looks like when I try to get it to work. >>> x = int(input("Please enter an integer: ")) Please enter an integer: 42 >>> if x < 0: x = 0 print('Negative changed to zero') elif x == 0: SyntaxError: invalid syntax >>> if x < 0: x = 0 print('Negative changed to zero') elif x == 0:
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor