Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can u make sure to separate the function and the main file. Also, can u please make sure to use loops (in the function). As

Can u make sure to separate the function and the main file. Also, can u please make sure to use loops (in the function). As well, can u use the .format (from python 3). Lastly, can u make sure to only use one return statement in the function (at the end of the function). Thank you for your time.

image text in transcribed
Q3: In mathematics, the notation nl represents the factorial of a nonnegative integer n. The factorial of n is the product of all the nonnegative integers from 1 to n. Forexample, ?!=1>=5,l]40 and 4!:1x2x3x4=24 Write a function called factorial that takes a nonnegative integer num as a parameter then uses a for loop to calculate and return the factorial of that number. If the user enters a negative number, the function returns the integer 1. Save the function in a PyDev library module named 36_funct ions . py {same as other questions) Write a main program named q3.py that tests the function by asking the user to enter a number and displaying the output. \"Sample run for qS.pi,Ir Enter a positive integer: 7 TI". = 5040 CP 104 Fall 2019 \"Sample run for q3.py Enter a positive integer: -7 You did not enter a positive integer - Test your program with 2 different values for numthat are different than the example. One of those must cause the program to display the error message. 0 The input and output both are performed in the q3.py - Copy the results to testing. txt. I Assume: user will enter only integer values, positive or negative

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions

Question

Tor (int height; cout

Answered: 1 week ago