Python Day 9 : Recursion 3 | HackerRank 30 Days of Code Solutions


Code:

#!/bin/python3


import math
import os
import random
import re
import sys

# Complete the factorial function below.
def factorial(n):

    for i in range (1, n):
        nn*i
    return n

if __name__ == '__main__':
    fptr = open(os.environ['OUTPUT_PATH'], 'w')

    n = int(input())

    result = factorial(n)

    fptr.write(str(result) + '\n')

    fptr.close()

AJ Blogs

Hello everyone, My name Arth and I like to write about what I learn. Follow My Website - https://sites.google.com/view/aj-blogs/home

Post a Comment

Previous Post Next Post
Best Programming Books

Facebook

AJ Facebook
Checkout Our Facebook Page
AJ Blogs
Checkout Our Instagram Page