Sep-19-2017, 12:10 PM
3. Factorials.
Write a program factorials.py that prints the factorials of the odd numbers between 1 and 10. Your
program should contain a function factorial(n) that returns the factorial of an integer n.
Hint. Write and test the factorial(n) function before you use it in the loop.
I don't even know what Factorials are so help please?
Thanks to the internet I got this for now but I don't understand a line off it:
Write a program factorials.py that prints the factorials of the odd numbers between 1 and 10. Your
program should contain a function factorial(n) that returns the factorial of an integer n.
Hint. Write and test the factorial(n) function before you use it in the loop.
I don't even know what Factorials are so help please?
Thanks to the internet I got this for now but I don't understand a line off it:
import sys n = int(sys.argv[1]) def factorial(n): if n == 0: return 1 else: return n* factorial(n-1) for i in range(1,11): factorial(n)Thank you in advance!
