Change number to odd
Define a function make_number_odd
that receives a number, adds 1 to that
number if it is even, and returns the number.
If the original number passed is odd, just return it.
Hint: Use the % operator to determine if even or odd
Examples:
>>> make_number_odd(2)
3
>>> make_number_odd(5)
5
Solution 1
def make_number_odd(number):
if number % 2 == 0:
number += 1
return number