We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc06ba2 commit a2cfe39Copy full SHA for a2cfe39
hackerRank/day30daychallange/hackerrank_day_9_30daysofcode.py
@@ -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