Basics - Control Statement - Exercises Solutions

Control Statement Exercise 01: Odd or Even Checker

# Write a Python program that reads an integer from the user and prints whether it's "Even" or "Odd".

user_number = int(input('Enter a number: '))
result = ''

if user_number % 2 == 0:
    result = 'even'
else:
    result = 'odd'

print(f'Output: {result}')

Leave a Reply

Your email address will not be published. Required fields are marked *