Python 7 Levels, L2, Unit 12, Priority of Operators

Powered By EmbedPress

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.")

dahan1999

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts