In: Computer Science
In Python
Find the errors, debug the program, and then execute to show the output.
def main():
Calories1 = input( "How many calories are in the
first food?")
Calories2 = input( "How many calories are in the
first food?")
showCalories(calories1, calories2)
def showCalories():
print('The total calories you ate today',
format(calories1 + calories2,'.2f'))
Program:
#definition of main()
def main():
calories1 = float(input("How many calories are in the first food?
"))
calories2 = float(input("How many calories are in the second food?
"))
#calling showCalories() with 2 arguments
showCalories(calories1, calories2)
def showCalories(calories1, calories2):
#printing the total calories
print("The total calories you ate today: %.2f"
%(calories1+calories2))
#calling main()
main()
Program screenshot:
Output: