Question: IN PYTHON: Create a main() function that will call other functions to practice adding and subtracting. The code in main() will ask the user if

IN PYTHON: Create a main() function that will call other functions to practice adding and subtracting. The code in main() will ask the user if they want to practice addition or subtraction by entering S for subtractin or A for Addition. It will then use these values to determine if the function DetermineSum() is called or DetermineDifference() is called. Both DetermineSum() and DetermineDifference() have been already created for you. The output will be the sum or the difference.

The input statement that needs to be contained in main needs to read: Enter S for Subtraction or A for Addition:

For the letter A, the output will be: The sum of 7 and 9 is: 16

For the letter S, the output will be: The difference between 13 and 6 is: 7

These output statements are contained within the functions DetermineSum() and DetermineDifference(). You do not need to write any additional print statements within main().

main() will be called.

This is my answer, and some of what is wrong with my code is:

My first 8 lines are wrong. I don't know how to call multiple defs. Also, I am probably calling main() incorrectly as well. Please assume that my DetermineSum() and DetermineDifference() will work.

Please note any indentation errors that I have, and I am open to any advice on how to do this, in general. Thank you so much.

This is my code so far:

def main(): rawinput = input("Enter S for Subtraction or A for Addition: ") if rawinput == "A": DetermineSum() elif rawinput == "S": DetermineDifference()

def DetermineSum(): num1 = int() num2 = int() sum_num = int() num1 = 7 num2 = 9 sum_num = num1 + num2 print ("The sum of 7 and 9 is:",sum_num) def DetermineDifference(): num1 = int() num2 = int() difference = int() num1 = 13 num2 = 6 difference = num1 - num2 print ("The difference between 13 and 6 is:",difference)

main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!