Question: TASK 4 ( OF 4 ) Write a Python script which computes the factorial of a number using a loop ( do not use math.factorial

TASK 4(OF 4)
Write a Python script which computes the factorial of a number using a loop (do not use math.factorial). Your program should prompt the user for a non-negative integer, n. Recall that the factorial of a number, n, is defined as:
nn**(n-1)**(n-2)**dots.**2**1
Recall also that 01, and that we cannot calculate the factorial of a negative number or a float (decimal number).
Ensure your number is not a decimal by using the int() function in your input line.
Use a loop to ensure that your input is not negative. If the user enters a negative value, your program should repeatedly ask the user for a non-negative integer until the user enters a non-negative integer.
Your program should output (using print0) a mathematical expression showing the numeric input from the user and its factorial. For example, if the user enters 5, the output should look
ENED1100- W13D2 ACTIVITIES AND HOMEWORK
PythON: REPETITION FLOW
something like this: 5120
TASK 4 ( OF 4 ) Write a Python script which

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 Accounting Questions!