Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Utilize loops and functions and write a Python program that asks the user for an integer (number) greater than 1. Once the user enters an integer, it should then allow the user to choose between the...

1 answer below »

Utilize loops and functions and write a Python program that asks the user for an integer (number) greater than 1. Once the user enters an integer, it should then allow the user to choose between the following two options:

  • If 1 is entered, a countdown from that number to zero is printed.
  • If 2 is entered, the factorial of the number is printed.

If the user inputs a number less than 1, your program should display a message informing the user that the program only accepts numbers greater than 1.

(Note: As a programmer, you should always consider telling the user what type of data the program is expecting before they attempt to enter that data.)

Once you have completed the program, take a screen shot of the completed functionality (including the input and the output) and save it in a Word document, along with the script.

Describe process in developing the program.

Please provide a paragraphdescriptionof the process too.
Answered 2 days After Mar 14, 2021

Solution

Neha answered on Mar 14 2021
150 Votes
77670 - pythn code/__pycache__/code.cpython-39.pyc
77670 - pythn code/code.py
def printCountdown(number):
while (number > 0):
print(number)
number = number - 1
if number == 0:

eak
def printFactorial(number):
fact = 1
while(number > 1):
fact *= number
number -= 1
print(fact)
while(True):
number = int(input('Please enter a number greater than 1: '))
if(number > 1):
print('Enter 1 to print countdown')
print('Enter 2 to print factorial')
choice = int(input('Please select one of the option (1 or 2): '))
if(choice == 1):
print('Countdown is: ')
printCountdown(number)
elif(choice == 2):
print('The factorial is: ')
printFactorial(number)
else:
print('Please enter a valid number')
choice = input('Do you want to continue...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here