Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions evenoroddchecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,12 @@ def check_even_odd(num):
print(f"{num} is even")
else:
print(num , " is odd")
"""
Function to check if a number is even or odd.
Args:
num (int): The number to check.

Returns:
None
"""
try:
# Check if the number is even
if num % 2 == 0:
print(f"{num} is even")
# If not even, then it's odd
else:
print(f"{num} is odd")
except TypeError:
# Handle the exception if input is not an integer
print("Please enter a valid integer.")

if num % 2 ==0:
print(f"{num} is even")
else:
print(f"{num} + is odd")
if num % 2 == 0:
print(f"{num} is even")
else:
print("is odd")
return None

check_even_odd(7)
check_even_odd(-4)