用python语言循环结构程序编写一个学生成绩转换程序用户输入百分制的学生成绩:90~100时输出为A80~89时输出为B70~79时输出为C60~69时输出为D0~59时输出为E。输入数据超过100时输出data error!。用户可反复输入成绩进行转换输入负数时输出end并结束程序。输入格式每次输入一个整数代表百分制成绩;反复输入输入负数结束程序输出格式根据每一次的输入值分别输出A、B、C、D
while True: score = int(input()) if score < 0: print("end") break elif score > 100: print("data error!") elif score >= 90: print("A") elif score >= 80: print("B") elif score >= 70: print("C") elif score >= 60: print("D") else: print("E")
原文地址: https://www.cveoy.top/t/topic/hm4s 著作权归作者所有。请勿转载和采集!