-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDAY_3.py
More file actions
110 lines (64 loc) · 1.76 KB
/
Copy pathDAY_3.py
File metadata and controls
110 lines (64 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/env python
# coding: utf-8
# This day is about working with the conditionals.
# In[14]:
# if-else statements
water_level = 50
if water_level > 80:
print("Drain water")
else:
print("Continue")
# In[ ]:
# Nested Conditionals - execute multiple conditons
# # Buy a Ticket
# In[17]:
# There are some prerequisites for someone to buy a ticket to ride the roller coster
height = int(input("Your height in cm: "))
age = int(input("What's your age? "))
if height >= 120:
print("Go ahead")
if age < 12:
print("Please pay $5.")
elif age <= 18 and age >= 12:
print("Please pay $7.")
else:
print("Please pay $12.")
else:
print("You can't ride the roller coster")
# # Odd or Even
# In[18]:
number = int(input("Enter a number: "))
if number %2 == 0:
print("The number is Even")
else:
print("The number is Odd")
# # BMI Calculator 2.0
# In[34]:
# BMI - Body Mass Index
weight = float(input("Enter your weight in kg: "))
height = float(input("Enter your height in m: "))
bmi = round(weight / (height*height))
if bmi < 18.5:
print(f"Your BMI is {bmi} and You're Underweight")
elif bmi < 25:
print(f"Your BMI is {bmi} and You have a normal weight")
elif bmi < 30:
print(f"Your BMI is {bmi} and You're slightly overweight")
elif bmi < 35:
print(f"Your BMI is {bmi} and You're obese")
else :
print(f"Your BMI is {bmi} and You're clinically obese!!")
# # Leap Year
# In[39]:
year = int(input("Which year do you want to check? "))
if year %4 == 0:
if (year %100 != 0):
if year %400 == 0:
print("Leap year")
else:
print("Not Leap year")
else:
print("Leap year")
else:
print("Not Leap year")
# In[ ]: