I am taking my first programming course, so my apologies if this is a dumb question/possibly classified by the wrong category on this site. One of the exercise problems I am working on is the following:
Define a function print_total_inches, with parameters num_feet and num_inches, that prints the total number of inches. Note: There are 12 inches in a foot. Ex:
print_total_inches(5, 8) prints:
Total inches: 68
The photo attached is the code that I did along with the error that I received. Any help/resources are greatly appreciated. Thanks!
Your code fails at formatting the input (along with missing the calculations needed).
def print_total_inches (num_feet, num_inches):
print('Total inches:', num_feet * 12 + num_inches)
print_total_inches(5, 8)
or
def total_inches (num_feet, num_inches):
return num_feet * 12 + num_inches
print('Total inches:', total_inches(5, 8))
should do - and no need for return
when there's nothing to return.