首页后端开发Pythonpython输入若干个0–100的成绩

python输入若干个0–100的成绩

时间2023-06-03 14:23:01发布访客分类Python浏览314
导读:python输入若干个0–100的成绩?平均分的编码是:numbers=[]while True:x=input('请输入一个整数:' try:numbers.append(int(x except:print('不是整数' while...

python输入若干个0–100的成绩?

平均分的编码是:

numbers=[]

while True:

x=input('请输入一个整数:')

try:

numbers.append(int(x))

except:

print('不是整数')

while True:

flag=input('继续输入吗?(yes/no)')

if flag.lower()not in('yes','no'):

print('只能输入yes或no')

else:

breakif flag.lower()=='no':

break

print(sum(numbers)/len(numbers))

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: python输入若干个0–100的成绩
本文地址: https://pptw.com/jishu/59758.html
怎么查看python内置函数 python面向什么

游客 回复需填写必要信息