Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This programming project will be a simple, working program, using Python languag

ID: 3556075 • Letter: T

Question

This programming project will be a simple, working program, using Python language, which utilizes a good design process and includes:

Sequential, selection, and repetitive programming statements as well as,

At least one function call.

Pls design (based on the pseudo code in Project 1), create, debug and execute the program.

Pls use the Pseudo code below

Show Menu : ask to Enter choice

Enter num1

?if not a number

Ask to Re-enter until a number

?Enter num2

?if not inte

Ask to Re-enter until a number

?Compute the operation

Display Result

?If choice was not "Quit"

Start again from beginning

choice = 0
num1Check = "No"
num2Check = "No"

while choice != "6":
print ("Menu :")
print ("1. Addition")
print ("2. Subtraction")
print ("3. Multiplication")
print ("4. Division")
print ("5. Display both numbers.")
print ("6. Exit")
choice=input("Enter your choice : ")

if choice !="6":
num1 = input("Enter first number : ");
while num1Check!="Ok":
if (num1.isnumeric()):
num1Check="Ok"
num1=float(num1)
else:
num1 = input("ERROR !!! Enter a number : ");

num2 = input("Enter second number : ");
while num2Check != "Ok":
if (num2.isnumeric()):
num2Check = "Ok"
num2=float(num2)
else:
num2 = input("ERROR !!! Enter a number : ");

if choice == "1":
answer = num1+num2
print ("sum of two numbers is : ")
print (answer)
elif choice == "2":
answer = num1 - num2
print ("sum of two numbers is : ")
print (answer)
elif choice == "3":
answer = num1 * num2
print ("sum of two numbers is : ")
print (answer)
elif choice == "4":
answer = num1 / num2
print ("sum of two numbers is : ")
print (answer)
elif choice == "5":
print ("First number is ")
print (num1)
print ("Second number is "+num2)
print (num2)
elif choice == "6":

print ("Good Bye !")

The docmentation within the program should include:

Name - L Gates

Course - CMST 290

Program Name

Due Date - May 4, 2014

Programming Language Used -

List any requirements/steps to run the program:

< >

The program must be submitted as an executable file.

as Python(.py) file.

Explanation / Answer

in Python indentations is very important and that is lost here. Check out http://pastebin.com/6QgqWyHH for code with indendation.

Here is the output when i ran. DO RAte if satisfied. if any problems ask

========================================

Menu :
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Display both numbers.
6. Exit
Enter your choice : 1
Enter First number: w3
Error in input
Enter First number: d3
Error in input
Enter First number: 2.3
Enter Second number: 3.4543
Sum of two numbers is :
5.7543
Menu :
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Display both numbers.
6. Exit
Enter your choice : 6
Good Bye !

===============================

def readNumber(msg):
exitloop = False;
while not exitloop:
try:
string = raw_input(msg);
if "." or "e" in string:
number = float(string);
else:
number = int(string);
exitloop = True;
except:
print "Error in input";
return number;

def main():
choice = 0
while choice != "6":
print ("Menu :")
print ("1. Addition")
print ("2. Subtraction")
print ("3. Multiplication")
print ("4. Division")
print ("5. Display both numbers.")
print ("6. Exit")
choice=raw_input("Enter your choice : ")
  
if choice !="6":
num1 = readNumber("Enter First number: ");
num2 = readNumber("Enter Second number: ");
  
if choice == "1":
answer = num1+num2
print ("Sum of two numbers is : ")
print (answer)
elif choice == "2":
answer = num1 - num2
print ("Difference of two numbers is : ")
print (answer)
elif choice == "3":
answer = num1 * num2
print ("Product of two numbers is : ")
print (answer)
elif choice == "4":
answer = num1 / num2
print ("Division of two numbers is : ")
print (answer)
elif choice == "5":
print ("First number is ", num1)
print ("Second number is ", num2)
elif choice == "6":
print ("Good Bye !")
exit();

if __name__ == "__main__":
main()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote