코딩 스쿨에 오신것을 환영합니다~~

Q128. 리스트에 저장된 성적에 대해 성적 등급에 따라 해당 인원을 세는 프로그램을 작성하시오. (600점)

s = [64, 89, 100, 85, 77, 58, 79, 67, 96, 87,
         87, 36, 82, 98, 84, 76, 63, 69, 53, 22]

count_su = 0            # 90점 ~ 100점
count_woo = 0           # 80점 ~ 89점
count_mi = 0            # 70점 ~ 79점
count_yang = 0          # 60점 ~ 69점
count_ga = 0            # 0점  ~ 59점

i = 0
while i < ___________ :
    if s[i] >= 90 and s[i] <=100 :
        count_su = count_su + 1
        
    if s[i] >= 80 and s[i] <= 89 :
        count_woo = count_woo + 1

    if s[i] >= 70 and s[i] <= 79 :
        count_mi = count_mi + 1

    if s[i] >= 60 and s[i] <= 69 :
        count_yang = count_yang + 1

    if s[i] >= 0 and s[i] <= 59 :
        count_ga = count_ga + 1

    i = _____________
    
print("수 : %d명" % count_su)
print("우 : %d명" % count_woo)
print("미 : %d명" % count_mi)
print("양 : %d명" % count_yang)
print("가 : %d명" % count_ga)

- 난이도(1~10) : 6

- 힌트 : 없음

  • - 실행 결과
  • 수 : 3명
    우 : 6명
    미 : 3명
    양 : 4명
    가 : 4명
정답보기 목록보기 완료/포인트얻기

s = [64, 89, 100, 85, 77, 58, 79, 67, 96, 87,
         87, 36, 82, 98, 84, 76, 63, 69, 53, 22]

count_su = 0            # 90점 ~ 100점
count_woo = 0           # 80점 ~ 89점
count_mi = 0            # 70점 ~ 79점
count_yang = 0          # 60점 ~ 69점
count_ga = 0            # 0점  ~ 59점

i = 0
while i < len(s) :
    if s[i] >= 90 and s[i] <=100 :
        count_su = count_su + 1
        
    if s[i] >= 80 and s[i] <= 89 :
        count_woo = count_woo + 1

    if s[i] >= 70 and s[i] <= 79 :
        count_mi = count_mi + 1

    if s[i] >= 60 and s[i] <= 69 :
        count_yang = count_yang + 1

    if s[i] >= 0 and s[i] <= 59 :
        count_ga = count_ga + 1

    i = i + 1
    
print("수 : %d명" % count_su)
print("우 : %d명" % count_woo)
print("미 : %d명" % count_mi)
print("양 : %d명" % count_yang)
print("가 : %d명" % count_ga)