python_work4

1.

a = int(input("input score of our team is:"))
b = int(input("input score of 1 team is:"))
c = int(input("input score of 2 team is:"))
d = int(input("input score of 3 team is:"))

avsb = (a > b) * 3 + (a == b)
avsc = (a > c) * 3 + (a == c)
avsd = (a > d) * 3 + (a == d)

score = avsb + avsc + avsd

print("Group stage teams are available:%d"%(score))

运行得:

input score of our team is:20
input score of 1 team is:12
input score of 2 team is:23
input score of 3 team is:16
Group stage teams are available:6

Process finished with exit code 0

2.

a1 = int(input("input the score of math:"))
a2 = int(input("input the score of chinese:"))
a3 = int(input("input the score of english:"))

as1 = (a1 > 90) * 2 + ((a1 >= 60) & (a1 <= 90))
as2 = (a2 > 90) * 2 + ((a2 >= 60) & (a2 <= 90))
as3 = (a3 > 90) * 2 + ((a3 >= 60) & (a3 <= 90))

score = as1 + as2 + as3

print("the total points is: %d" % score)

运行得:

input the score of math:90
input the score of chinese:98
input the score of english:99
the total points is: 5

Process finished with exit code 0

你可能感兴趣的:(python,java,前端)