## Introduction: Factorial Number Code for Python

Factorial numbers are clever

Factorial numbers look like this 5!

The exclamation mark means to multiply the number before it with all the numbers after it. For example... 5!=5x4x3x2x1 the answer is 120

With Python I managed to program the function from scratch

## Step 1: Before You Start

This program can come in use in mathematics because most calculator can't calculate bigger numbers because of its computing power.

Before you begin you need to install Python 3.4.3 from the Python website

(But for the attached file you need to use 2.7.3)

## Step 2: The Code

while True:

number1=int(input("Enter number "))

number2=number1+1

multipliers=list()

for i in range(number1,0,-1):

multipliers.append(i)

#print(i)

import operator

import functools

result = functools.reduce(operator.mul,multipliers, 1)

print(result)

## Step 3: Files

Factorial Number.py is the program, so if you don't want to code it yourself then download it, open python and then open the file and run[f5].

100000! is a extremely big factorial number if you want to have a look at what this program can do.

## Step 4: Final Thing

One last thing this program take a long time to calculate large numbers so I wouldn't recommend inputting ridiculously large numbers.

Have Fun!

InventoYoda

Sorry, but wouldn't it be easier just to have:

def factorial(number):

total = 1

for i in range(1, number + 1):

total *= i

return total

I am not trying to be a jerk but there is a far easier

and more eloquent way to do what your doing and without using an infinite

loop or reading a ton of data into memory. In Python’s built in math module there is a function called “factorial” to

do the exact same thing..

https://docs.python.org/3.4/library/math.html

import math

num = int(input("Enter a Number>>> "))

print math.factorial(num)

Don't worry

I did realise that python had a pre built function but I challenged myself to create the code from scratch

I love building my own functions! Number sequesaces are awesome. I remember doing a program that revolved around the fibinacci sequence. So great!