2019年11月3日 星期日

輸入五次成績

輸入五次成績 且大於100, 小於0 則重新輸入
score_list=[0]*5
for i in range(0,5):
    score=int(input("請輸入你的成績"))
    check=True
    while check:
        if (score>100 or score<0):
            print("請重新輸入你的成績")
            score=int(input("請輸入你的成績"))
        else:
            check=False
    score_list[i]=score
print("你的五次成績分數是{}".format(score_list))

沒有留言:

張貼留言