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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值