수업소개
조건에 따라사 다른 코드가 실행되도록 하는 조건문을 알려주는 수업입니다.
강의1
소스코드
4_1_1_if_basic.py
# 012
print(0)
if True:
print(1)
print(2)
print('---')
# 02
print(0)
if False:
print(1)
print(2)
4_1_2_if_app.py
input_id = input('id : ')
id = 'egoing'
if input_id == id:
print('Welcome')
강의2
소스코드
4_2_1_if_else.py
# 013
print(0)
if True:
print(1)
else:
print(2)
print(3)
print('---')
# 013
print(0)
if False:
print(1)
else:
print(2)
print(3)
4_2_2_if_app.py
input_id = input('id : ')
id = 'egoing'
if input_id == id:
print('Welcome')
else:
print('Who?')
강의3
소스코드
4_3_1_if_elif.py
# 014
print(0)
if True:
print(1)
elif True:
print(2)
else:
print(3)
print(4)
print('---')
# 024
print(0)
if False:
print(1)
elif True:
print(2)
else:
print(3)
print(4)
print('---')
# 034
print(0)
if False:
print(1)
elif False:
print(2)
else:
print(3)
print(4)
4_3_2_if_app.py
input_id = input('id : ')
id1 = 'egoing'
id2 = 'basta'
if input_id == id1:
print('Welcome')
elif input_id == id2:
print('Welcome')
else:
print('Who?')
강의4
소스코드
4_4_if_app.py
input_id = input('id:')
id = 'egoing'
input_password = input('password:')
password = '111111'
if input_id == id:
if input_password == password:
print('Welcome')
else:
print('Wrong password')
else:
print('Wrong id')

