Recent Posts
Recent Comments
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Today
Total
관리 메뉴

100세까지 코딩

[백준] 9498번 시험 성적 (파이썬) 본문

코딩테스트/파이썬

[백준] 9498번 시험 성적 (파이썬)

100세까지 코딩 2024. 1. 5. 17:02
문제

나의 생각
  • 조건문을 사용할 줄 아는지에 대한 문제
  • 파이썬은 다른 언어와 다르게 조건문 안에 수학의 부등식을 그대로 사용할 수 있다.
나의 풀이 (파이썬만 가능한 형태)
score = int(input())
if 90 <= score <= 100:
    print('A')
elif 80 <= score <= 89:
    print('B')
elif 70 <= score <= 79:
    print('C')
elif 60 <= score <= 69:
    print('D')
else:
    print('F')
나의 풀이 2 (비교 연산자 사이 and,or 등 연산자 들어간 형태)
score = int(input())
if 90 <= score and  score<= 100:
    print('A')
elif 80 <= score and  score<= 89:
    print('B')
elif 70 <= score and  score<= 79:
    print('C')
elif 60 <= score and  score<= 69:
    print('D')
else:
    print('F')
파이썬은 신이야!