Notice
Recent Posts
Recent Comments
Link
«   2025/02   »
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
Archives
Today
Total
관리 메뉴

RUBY

다자택일 조건문 본문

프로그래밍 언어/Python

다자택일 조건문

ruby-jieun 2023. 1. 5. 17:39

 

 

다자택일 조건문

 


 

 

 

  • 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