[파이썬] if문과 반복문을 이용해서 점수 확인
조회수 2241회
kor = int(input("국어 점수를 입력하세요"))
eng = int(input("영어 점수를 입력하세요"))
math = int(input("수학 점수를 입력하세요"))
# if kor+eng+math/3 < 70:
total = kor+eng+math
s = [{kor: "국어"}, {eng: "영어"}, {math: "수학"}]
if total>=180:
if kor<40 or math <40 or eng<40:
# print(s[1])
# print(s)
for i in enumerate(s):
print(total,"점수이지만",s[i],"과락")
else:
print(total,"합격")
else:
print(total,"불합격")
점수데이터를 확인해서 점수별로 40점미만이면 과락이 되게 하려는데 자꾸 에러가 발생합니다. 어떻게 해야할 까요...
-
(•́ ✖ •̀)
알 수 없는 사용자
1 답변
-
kor = int(input("국어 점수를 입력하세요")) eng = int(input("영어 점수를 입력하세요")) math = int(input("수학 점수를 입력하세요")) # if kor+eng+math/3 < 70: total = kor+eng+math s = {kor: "국어", eng: "영어", math: "수학"} if total>=180: if not (kor > 40 and eng > 40 and math >40) : for score, sub in s.items(): if score < 40: print(total, '점수이지만', sub, '과락') else: print(total,"합격") else: print(total,"불합격")
댓글 입력