The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 305 Weeks Ago, 1 Day Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
I need help editing my python code so that it completes everything on this assignment.Â
Â
"Design the loop logic for a program that outputs every number from 1 through 20 along with its value doubled and tripled. Accepting a user input and have the program output every number from 1 through the user’s number along with its value doubled and tripled. When finished, the program will ask the user to enter another number or enter a zero to quit."
Â
Thanks in advance!
#num = user input of a number
#addNumber = working variable for user input of a number
#Programmer: Eric H
Â
def getNumber():
   global num1
   global addNumber
   addNumber=1
   print("")
   num1=int(input("Enter a number or a 0 to quit: "))
Â
while True:
   try:
       print("")
       print("*** FUN WITH SUMS***")
       getNumber()
       print("")
       print("Your number was:",num1)
   except ValueError:
       print("Incorrect entry please enter a number")
       continue
   if num1!=0:
       while addNumber<=num1:
           print("Loop",addNumber,">>>",num1,"+",addNumber,"=",addNumber+num1)
           addNumber=addNumber+1
           continue
   else:
       print("Goodbye")
       break
  Â
Â
Â
Â
Â
Â
Â
Â
Â
  Â
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly