Conditional statements

Unit 3

Most programs that you will write will require control structures to modify the behavior of the program based on specific conditions, conditional statements. You will find comprehensive yet concise lecture material to master boolean expressions, logical operators, conditional execution, and several other tricks in the online course Python for Everybody (PY4E) on Conditional execution.

#03-01: If-Else Statements

Write a Python program that asks the user to input a number. The program should check whether the number is even or odd. If the number is even print out The number is even, otherwise print The number is odd.

number = input("Enter an integer number: ")
number = int(number)

if number%2 == 0:
  print("The number is even")
else:
  print("The number is odd")