Experiment 2
Experiment 2
ID No: 2200030757
Sub: Python Lab
Experiment-02
1. Factorial of a Number
print("Enter a number to find factorial")
n=int(input())
fact=1
for i in range(1,n+1,1):
fact=fact*i
print(fact)
Output
2. First 7 multiples of 7
n=7
for i in range(1,8,1):
print(f"{n}*{i}=",n*i)
Output
1
Name: K Mahesh
ID No: 2200030757
Sub: Python Lab
3. Pythagorean Theorem
a=int(input())
b=int(input())
c=int(input())
if c*c==(b*b + a*a):
print("Triangle is Right angled triangle")
else:
print("Triangle is not Right angled triangle")
Output
2
Name: K Mahesh
ID No: 2200030757
Sub: Python Lab
Output
3
Name: K Mahesh
ID No: 2200030757
Sub: Python Lab
Output