- 博客(2)
- 收藏
- 关注
原创 2022.5.17 python 列表知识小结
学习时间:2022.5.17 列表 ` 练习题: 练习1:用scores保存所有学生的成绩 1)统计不及格学生的人数 2)计算学生平均分数 count = 0 scores = [90, 78, 54, 67, 88, 30, 59] for x in scores: if x < 60: count += 1 print(count) total = 0 scores = [90, 78, 54, 67, 88, 30, 59] for x in scores:
2022-05-17 23:59:26 369 2
原创 5.17 for 和while的使用练习题
学习时间:2022.5.17 homework: 1.输入年份,如果输入的年是闰年打印“闰年”,否则打印“平年”. #方法1,for循环 year=2023 if (year % 400 == 0) or (year % 4 ==0 and year % 100 != 0): print('闰年') else: print('平年') #方法2,while循环 number = 3 while number <= 100: # 打印等差数列 print(number)
2022-05-17 12:16:26 241
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人