728x90
풀이
첫째 줄에 시험 점수를 입력한다.
S = int(input())
90 - 100은 A
80 - 89는 B
70 - 79는 C
60 - 69는 D
나머지는 F
내가 좋아하는 if문으로 풀면 매우 간단하다.
A 는 if, B~D는 elif, F는 그외 모든 경우이므로 else 로 구하면 된다.
코드
S = int(input())
if 90 <= S <= 100 :
print('A')
elif 80 <= S <= 89 :
print('B')
elif 70 <= S <= 79 :
print('C')
elif 60 <= S <= 69 :
print('D')
else:
print('F')
728x90
'🥧 Python > ⚙️ 코딩테스트' 카테고리의 다른 글
[백준-Python] 1789번: 수들의 합 (0) | 2023.02.15 |
---|---|
[백준-Python] 11653번: 소인수분해 (0) | 2023.02.15 |
[백준-Python] 2935번: 소음 (0) | 2023.02.15 |
[백준-Python] 2675번: 문자열 반복 (0) | 2023.02.15 |
[백준-Python] 5355번: 화성 수학 (0) | 2023.02.15 |