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
23 changes: 0 additions & 23 deletions evenoroddchecker.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
def check_even_odd(num):
if num % 2 == 0:
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:
Expand All @@ -21,16 +9,5 @@ def check_even_odd(num):
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)