Question: Hey! Python Code is done, just needed help with the IPO Chart, Data dictionary, and Hierarchy chart, Thank you in advance! - ps I got
Hey! Python Code is done, just needed help with the IPO Chart, Data dictionary, and Hierarchy chart, Thank you in advance! - ps I got you with the 5 star rating!!
Here is the Python Code:
# This function displays menu def displayMenu(): print("A - Add any number of values together S - Subtract one value from another " "M - Multiply any number of values together D - Divide one value by another " "E - Raise one value to a power R - Find the square root of a number " "Q - Quit")
def addNumbers(): numbers=int(input('How many number you want to add? ')) # Ask user how many numbers to add addResult=0 # Varibale to hold addResult print("Enter ",numbers," numbers : ") for i in range(numbers): inputNum=int(input()) addResult+=inputNum # Add entered numbers to addResult print("Addition of numbers : ",addResult) # Print result
def subtractNumber(): num1=int(input('Enter first number: ')) # Enter num1 num2 = int(input('Enter second number: ')) # Enter num2 subResult=num2-num1; # Subtract one num from another print("Subtraction of ",num2," by ",num1," is ", subResult) # Print subResult
def multiplyNumber(): numbers=int(input('How many number you want to multiply? ')) # Ask user how many numbers to multiply mulResult=1 # Varibale to hold mulResult print("Enter ",numbers," numbers : ") for i in range(numbers): inputNum=int(input()) mulResult*=inputNum print("Multiplication of numbers : ",mulResult) # Print mulResult
def divideNumber(): num1=int(input('Enter first number: ')) # Enter num1 num2 = int(input('Enter second number: ')) # Enter num2 while(num2==0): # While num2 is 0, ask user to enter, else divideByZero error will occur print("Denominator cannot be zero") num2 = int(input('Enter second number again: ')) divResult=num1um2; # Divide num1 by num2 print("Division of ",num1, " by ",num2 ," is ", divResult) # Print divResult
def raisePower(): num1=int(input('Enter first number: ')) # Enter num1 num2 = int(input('Enter second number: ')) # Enter num2 raiseResult=pow(num1,num2); print("Raising ",num1," to a power ",num2," is ", raiseResult) # Print raiseResult
def squareRoot(): num1=int(input('Enter number: ')) # Enter num1 sqrtResult=num1**0.5 # Calculate square root print("Square root of ",num1 ," is ", sqrtResult) # Print sqrtResult
if __name__=="__main__": # Initially pressedEnter is "" pressedEnter="" # Varibale to check if user has pressed enter (means no value) while True: # Iterate loop till user enter 'q' or 'Q'
while pressedEnter!="": # Take input till user presses enter pressedEnter=input() displayMenu() #Display menu
choice = input('Enter your menu choice : ') # Enter choice choice = choice.upper() #Covert to upper case to make case-insensitive
# CAall method according to selection if choice=='A': addNumbers() elif choice=='S': subtractNumber() elif choice=='M': multiplyNumber() elif choice == 'D': divideNumber() elif choice == 'E': raisePower() elif choice=='R': squareRoot() elif choice == 'Q': break; else: print ("Invalid choice !!") pressedEnter=input() # Wait for user to press enter

Calculator Write a Python program, using finctions, that displays the following menu and prompt the user to enter their menu choice Your-name CalculatorEs A Add any number of values together S Subtract one value from another M- Multiple any number of values together D Divide one value by another E-Raise one value to a power R- Find the square root of a number Q-Quit Enter your menu choice: Until the user enters a.q, or'Q.your program should call a function that will perform the option the user has entered. The results hold be displayed on the screen, with the appropriate labels, until the user presses
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
