So I am trying to create a function for odd integers. I would like to have the user input any number and then have the program test if it is evenly divisible by 2. If so, I would like it to return False and if it is not true I would like to return True. Here is what I have so far:
print("PRACTICE 2.")
number = input("Enter a number, please: ")
def is_odd(number):
if number % 2 == 0:
return False
else:
return True
is_odd(number)
Output:
Enter a number, please: 5 (entered by me to test)
Traceback (most recent call last):
File "python", line 13, in <module>
File "python", line 9, in is_odd
TypeError: not all arguments converted during string formatting
print("PRACTICE 2.")
number = input("Enter a number, please: ")
def is_odd(number):
if number % 2 == 0:
return False
else:
return True
is_odd(number)
Output:
Enter a number, please: 5 (entered by me to test)
Traceback (most recent call last):
File "python", line 13, in <module>
File "python", line 9, in is_odd
TypeError: not all arguments converted during string formatting