-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCondition.py
More file actions
61 lines (49 loc) · 1.35 KB
/
Copy pathCondition.py
File metadata and controls
61 lines (49 loc) · 1.35 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
#1
height = float(input("Enter height in meters: "))
weight = float(input("Enter weight in kilograms: "))
bmi = weight / (height ** 2)
if bmi >= 30:
print("Obesity")
elif bmi >= 25 and bmi < 30:
print("Overweight")
elif bmi >= 18.5 and bmi < 25:
print("Normal")
else:
print("Underweight")
#2
Australia = ["Sydney", "Melbourne", "Brisbane", "Perth"]
UAE = ["Dubai", "Abu Dhabi", "Sharjah", "Ajman"]
India = ["Mumbai", "Bangalore", "Chennai", "Delhi"]
city=input("Enter a city name:")
if city in Australia:
print(city,"is in Australia")
elif city in UAE:
print(city,"is in UAE")
elif city in India:
print(city,"is in India")
else:
print("City not found in the list")
#3
city1 = input("Enter the first city: ")
city2 = input("Enter the second city: ")
country1 = None
country2 = None
if city1 in Australia:
country1 = "Australia"
elif city1 in UAE:
country1 = "UAE"
elif city1 in India:
country1 = "India"
if city2 in Australia:
country2 = "Australia"
elif city2 in UAE:
country2 = "UAE"
elif city2 in India:
country2 = "India"
if country1 and country2:
if country1 == country2:
print(f"Both cities are in {country1}")
else:
print("They don't belong to the same country")
else:
print("One or both cities are not in the list")