python解题
2025-09-14 10:15:34
发布于:广东
0阅读
0回复
0点赞
apple_high1 = input()#获取各个苹果高度
yy_high = int(input())#获取陶陶高度
apple_high2 = apple_high1.split()#分开各苹果高度
apple = 0 #初始化+定义
for x in apple_high2: #遍历循环
if yy_high + 30 >= int(x): #判断
apple += 1 #添加摘到的苹果数量
print(apple) #输出
这题有一个重点:
碰到就掉下来!!!
所有要用>=不能用>
还有split()不写参数默认空格分割
这里空空如也
有帮助,赞一个