-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex17.py
78 lines (62 loc) · 1.62 KB
/
ex17.py
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
# Conditons
# region = input("What region are you in? ")
# tax = 0
# if region == "Accra":
# tax = 0.05
# elif region == "Central":
# tax = 0.05
# elif region == "Volta":
# tax = 0.07
# else:
# tax = 0.15
# print(tax)
# # Using or
# if region == "Accra" or region == "Central":
# tax = 0.05
# elif region == "Volta":
# tax = 0.07
# else:
# tax = 0.15
# print(tax)
# # Using in
# if region in ("Accra", "Central"):
# tax = 0.05
# elif region == "Volta":
# tax = 0.07
# else:
# tax = 0.15
# print(tax)
# # Nested if statement
# country = input("What country are yo from? ")
# tax = 0
# if country.lower() == "ghana":
# region = input("What region are you in? ")
# if region in ("Accra", "Central"):
# tax = 0.05
# elif region == "Volta":
# tax = 0.07
# else:
# tax = 0.15
# else:
# tax = 0
# print(tax)
# # Complex conditions
# gpa = float(input("Input your grade point average: "))
# lowest_grade = float(input("Input your lowest grade: "))
# if gpa > .89:
# if lowest_grade >= .70:
# print("You made the honor roll")
# # Complex conditions using and
# gpa = float(input("Input your grade point average: "))
# lowest_grade = float(input("Input your lowest grade: "))
# if gpa > .89 and lowest_grade >= .70:
# print("You made the honor roll")
# Complex conditions using and boolean values
gpa = float(input("Input your grade point average: "))
lowest_grade = float(input("Input your lowest grade: "))
if gpa > .89 and lowest_grade >= .70:
honor_roll = True
else:
honor_roll = False
if honor_roll:
print("You made the honor roll")