RUBY
다자택일 조건문 본문
다자택일 조건문
- if~elif문 : 여러 가지 조건식 결과에 따라 실행문이 결정됨.
exampleScore = int(input('성적 : '))
grades = ''
if exampleScore >= 90:
grades = 'A'
elif exampleScore >= 80:
grades = 'B'
elif exampleScore >= 70:
grades = 'C'
elif exampleScore >= 60:
grades = 'D'
else :
grades = 'F'
print('성적 : {} \t 학점 : {}' .format(exampleScore, grades))
'프로그래밍 언어 > Python' 카테고리의 다른 글
중첩 조건문 (0) | 2023.01.05 |
---|---|
다자택일 조건문 사용 시 주의할 점 (0) | 2023.01.05 |
if~else문과 조건식 (0) | 2023.01.05 |
양자택일 조건문(if~else문) (0) | 2023.01.05 |
조건문(if문) (0) | 2023.01.04 |
Comments