Created
March 25, 2018 02:03
-
-
Save jennyonjourney/918922445d222040c790e2d7b9278b76 to your computer and use it in GitHub Desktop.
Python - exam 수우미양가 매기기
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#평균이 90점이상인 경우에만 '수' | |
#모든 과목이 90점이상이라면 수 옆에 초우등생 | |
name = "샛별" | |
kor = 91 | |
eng = 81 | |
mat = 95 | |
sum = kor+eng+mat | |
avg = sum/3 | |
result = '수' if avg >= 90 else '우' \ | |
if avg >= 80 else '미' if avg >= 70 else '양' \ | |
if avg >= 60 else '가' | |
result2 = '초우등생' if kor>=90 and eng>=90 and mat>=80 else '' | |
print("결과:", avg, result, result2) | |
# 선생님의 답안 | |
if avg>=90: | |
res2="수" | |
if kor>=90 and eng>=90 and mat>=90: | |
res2+='(초우등생)' | |
elif avg>=80: | |
res2="우" | |
elif avg>=70: | |
res2="미" | |
elif avg>=60: | |
res2="양" | |
else: | |
res2="가" | |
print("등급(선생님코드):", res2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment