0% found this document useful (0 votes)
1 views

Day 3 Python Session - Colaboratory

Uploaded by

Jesica D'cruz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Day 3 Python Session - Colaboratory

Uploaded by

Jesica D'cruz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

4/21/23, 12:50 PM Day 3 Python Session - Colaboratory

# Program to calculate the BMI and specify whether they are Undeweight(<=20) ,Normal(21-25),Overweight(26-30) and Obsese(>30
height=float(input("Enter your height in meters"))
weight=float(input("Enter your weight in kg"))
bmi=weight/height**2
if bmi<=20:
status="Underweight"
elif (bmi>=21 and bmi<=25):
status="Normal"
elif (bmi>=26 and bmi<=30):
status="Overweight"
else:
status="Obese"
print(f'Hello, Your BMI is {round(bmi,2)}')
print(f" You are {status}!!!")

Enter your height in meters1.55


Enter your weight in kg72
Hello, Your BMI is 29.97
You are Overweight!!!

# Program to display fibonacci series till 50 like 1,1,2,3,5,8,...


a,b=0,1
while b<50:
print(b)
a,b=b,a+b

1
1
2
3
5
8
13
21
34

# program to find factorial of a number, fact(n)=1*2*3...*n fact(3)=1*2*3=6


num=int(input("Enter a number"))
f=1
for i in range(1,num+1):
f*=i
print(f"Factorial of {num} is {f}")

Enter a number5
Factorial of 5 is 120

a,b,c=10,20,30
a,b=b,a+b
print(a,b)

20 30

# program to swap two variables


a=10
b=30
a,b=b,a
print(a,b)

30 10
https://colab.research.google.com/drive/1ivNDRSaOHSk4Up5HHw3HGYyZYMU1Mjw4#scrollTo=_UNbzVqynK1c&printMode=true 1/2
4/21/23, 12:50 PM Day 3 Python Session - Colaboratory

Colab paid products - Cancel contracts here

check 6s completed at 12:47 PM

https://colab.research.google.com/drive/1ivNDRSaOHSk4Up5HHw3HGYyZYMU1Mjw4#scrollTo=_UNbzVqynK1c&printMode=true 2/2

You might also like