In [1]:
def fact(n):
   if n == 1:
       return n
   else:
       return n*fact(n-1)

n= 8 #int(input("Enter the number : "))

for i in range(1,n+1):
    x=list(map(str,list(range(1,i+1))))
    print(i,"! = "," x ".join(x)," = ",fact(i),sep="")


1! = 1 = 1
2! = 1 x 2 = 2
3! = 1 x 2 x 3 = 6
4! = 1 x 2 x 3 x 4 = 24
5! = 1 x 2 x 3 x 4 x 5 = 120
6! = 1 x 2 x 3 x 4 x 5 x 6 = 720
7! = 1 x 2 x 3 x 4 x 5 x 6 x 7 = 5040
8! = 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 = 40320

In [2]:
def fact(n):
   if n == 1:
       return n
   else:
       return n*fact(n-1)

n= int(input("Enter the number : "))

for i in range(1,n+1):
    x=list(map(str,list(range(1,i+1))))
    print(i,"! = "," x ".join(x)," = ",fact(i),sep="")


Enter the number : 3
1! = 1 = 1
2! = 1 x 2 = 2
3! = 1 x 2 x 3 = 6

In [ ]:
import matplotlib.pyplot as plt
import numpy as np

a = arange(0,1,0.01)
y = np.cos(2*np.pi*a)
plt.plot()