1num = 7
2
3factorial = 1
4# check if the number is negative, positive or zero
5if num < 0:
6 print("sorry, factorial does not exist for negative numbers")
7 elif num == 0:
8 print("the factorial of 0 is 1")
9 else:
10 limit = num-1
11 for i in range(1, limit):
12 factorial = factorial*i
13 print("the factorial of",num,"is",factorial)
1for x in range(1,6):
2 for y in range(1,6-x+1):
3 print(" ",end=" ")
4 for z in range(x):
5 print(x,end=" ")
6 print(" ")