Skip to content

Commit a2cfe39

Browse files
authored
Add files via upload
1 parent cc06ba2 commit a2cfe39

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# -*- coding: utf-8 -*-
2+
"""Hackerrank day 9 / 30daysOfCode.ipynb
3+
4+
Automatically generated by Colaboratory.
5+
6+
Original file is located at
7+
https://colab.research.google.com/drive/1ObhYmKdvJJpwV11pYEK3ln1pyZIYR24F
8+
"""
9+
10+
#!/bin/python3
11+
12+
import math
13+
import os
14+
import random
15+
import re
16+
import sys
17+
18+
# Complete the factorial function below.
19+
def factorial(n):
20+
if n == 1:
21+
return 1
22+
else:
23+
n = n * factorial(n-1)
24+
return(n)
25+
26+
27+
28+
if __name__ == '__main__':
29+
fptr = open(os.environ['OUTPUT_PATH'], 'w')
30+
31+
n = int(input())
32+
33+
result = factorial(n)
34+
35+
fptr.write(str(result) + '\n')
36+
37+
fptr.close()

0 commit comments

Comments
 (0)