print('----비교연산과 논리연산----')
#논리형bool - True참, False거짓
#비교연산 : 두 자료를 비교할 때
'''
비교연산자
> 크다
< 작다
>= 크거나 같다(이상)
<= 작거나 같다(이하)
== 같다
!= 같지 않다
'''
print(5 > 3)
print(2 < 1)
print(5 != 5)

x = 10 #변수 x에 10을 저장한다
print(x == 10) #x가 10이랑 같다

print('----문제1----')
a = 10
b = 3
#print(a ? b) #True
#print(a ? b) #False

#논리연산 : 두 논리를 연결할 때
'''
논리연산자
and : 둘 다 참일 때 참
or : 하나라도 참이면 참
not : 값을 반대로
'''
c = 7
d = 15
print((c < 10) and (d > 10)) #True
print(c == 8 or d < 12)
print(not(c < 10))

print('----조건문----')
#if문
'''
if  조건:
    실행할 코드
'''
weather = '비'

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

#if-else문
'''
if 조건:
    조건이 맞을 때 실행할 코드
else:
    조건이 틀렸을 때 실행할 코드
'''
num = 182

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

print('----문제2----')
score = 50

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

#if-elif-else문
'''
if 조건1:
    명령1
elif 조건2:
    명령2
else:
    명령N
'''
score = 60

if score >= 90:
    print('A')
elif score >= 80:
    print('B')
elif score >= 70:
    print('C')
else:
    print('재시험')



Embed on website

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