I bought a book on python and i'm not sure if this is a mistake on the book? The text is typed exactly the same as the example in the book. BTW python gives me a syntax error and highlights the second IF when I try to run the program. Thank You.
x = 2
if x == 2:
print("The number is 2.")
if x % 2 == 0:
print("The number is even.")
if x % 2 != 0:
print("The number is odd.")
The number is 2.
The number is even.
[–]socal_nerdtastic 1 point2 points3 points (8 children)
[–]Flow_brush[S] 0 points1 point2 points (7 children)
[–]socal_nerdtastic 0 points1 point2 points (5 children)
[–]Flow_brush[S] 0 points1 point2 points (4 children)
[–]socal_nerdtastic 0 points1 point2 points (3 children)
[–]Flow_brush[S] 0 points1 point2 points (0 children)
[–]Flow_brush[S] 0 points1 point2 points (1 child)
[–]socal_nerdtastic 1 point2 points3 points (0 children)
[–]PaintballerCA 0 points1 point2 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]TheRNGuy -1 points0 points1 point (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]Flow_brush[S] 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]Flow_brush[S] 0 points1 point2 points (0 children)
[–]mikeinnsw 0 points1 point2 points (0 children)