#if문
'''
if 조건:
    조건이 참일 때 실행할 코드
'''
weather = '비'

if weather == '비':
    print('우산을 쓴다')

#if-else문
'''
if 조건:
    조건이 참일 때 실행할 코드
else:
    조건이 거짓일 때 실행할 코드
'''
score = 50

if score >= 60:
    print('합격입니다')
else:
    print('불합격입니다')

#홀짝 판별기
num = int(input('숫자를 입력하세요'))

if num % 2 == 0:
    print('짝수입니다')
else:
    print('홀수입니다')

#나이 계산
age = int(input())
if age >= 8:
    print('학교에 다닙니다')
    if age >= 20:
        print('성인입니다')
else:
    print('학교에 안다닙니다')


#문장을 입력하면 거꾸로 출력해주는 프로그램
#'가나다라' -> '라다나가'
text = input()
print(text[::-1])

#성적을 평균을 내서 등급 판별
kor = int(input("국어 점수: "))
math = int(input("수학 점수: "))
eng = int(input("영어 점수: "))

avg = (kor + math + eng) / 3

print('평균:',avg)

if avg >= 90:
    grade = "A"
else: #age < 90
    if avg >= 80:
        grade = "B"
    else: #age < 80
        if avg >= 70:
            grade = "C"

print("등급:", grade)

#if-elif-else문
'''
if 조건1:
    명령1
elif 조건2:
    명령2
elif 조건3:
    명령3
else:
    명령 N
'''
score = 60
if score >= 90:
    print('A')
elif score >= 80:
    print('B')
elif score >= 70:
    print('C')
else:
    print('F')













    


















Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: