Exercise 1:
i = 3
if not i > 5 and 1 + i*3 == 10 or i%2 == 0:
print("Test passed")
print("Test")
Exercise 2:
c = int(input("Please input French score:"))
m = int(input("Please input Math score:"))
e = int(input("Please input English score:"))
s = int(input("Please input Gym score:"))
if ((c + m + e) >= 280) or ((c + m + e) >= 260 and s >= 90):
print("Excellent!")
print("Please go to Admin Office for gift.")
print("Achievement Test")
Homework:
print("Test leap year tool.")
year = int(input("Please input a year:"))
if (year%4 == 0 and year%100 != 0) or (year % 400 == 0):
print(year," is a leap year.")
print("Leap year test.")
[…] data type and relational operators| |____Unit 10 if statement| |____Unit 11 Logical Operators| |____Unit 12 Priority of Operators| |____Unit 13 if else statement| |____Unit 14 Multiple if Statements| |____Unit 15 Nested if […]