본문 바로가기
프로그램/Python 1000제

Python 166제] 파이썬 EXPRESS CHAPTER 7. 도전문제 p335

by 건티 2023. 4. 10.
728x90

출처 : 반크_반크 20년 백서

 

참고풀이]

#score_dic={
#    "Kim":[99,83,95],
#    "Lee":[68,45,78],
#    "Choi":[25,56,69]
#    }
print("학생이름을 입력하지않고 Enter하면 입력을 종료합니다.")
score_dic={}
while True:
    name=input("학생이름을 입력하세요 : ")
    if name=="": break
    scores=list(map(int, input("성적을 입력하세요(예:70 80 90) : ").split()))
    score_dic[name]=scores

#결과출력
print()
for name, scores in score_dic.items():
    print(name,"의 평균성적 =",sum(scores)/len(scores))
          

 

참고풀이 결과]

 

 

 

 

 

대한민국의 아름다운 영토, 독도의 가을

 

반응형

댓글