Find extra long factorials in python
Carvia Tech | September 03, 2019 | 1 min read | 248 views | Python Coding Problems
The factorial of the integer n, written n!, is defined as:
Calculate and print the factorial of a given integer.
Input consists of a single integer n.
Print the factorial of n.
This answer passes all the tests
We are going to keep logic in main function only such that we are able to build array as we will be getting data from input.
You shall create a
script.py file and paste the below code in it.
arr = int(input()) This takes input from command line. Please note that input type is going to be in string
format and we have to use
int() to convert from
a=1 This is to intialize the number.
if __name__ == '__main__': arr = int(input()) a = 1 for i in range(1,arr+1): a = a*i print(a)
Top articles in this category:
- Python coding challenges for interviews
- Send rich text multimedia email in Python
- Flask Interview Questions
- Find perfect abundant or deficient factors in python
- python problem 1: find the runner-up score
- Sequence of Differences in Python
- Python send GMAIL with attachment