생활코딩) Python 제어문 공부
2022. 6. 27. 14:04ㆍ코딩/Python
728x90
반응형
# 012
print(0)
if True:
print(1)
print(2)
print('---')
#02
print(0)
if False:
print(1)
print(2)
input_ID = input('ID: ')
ID = 'egoing'
if input_ID == ID:
print('Welcome')
#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)
input_ID = input('ID: ')
ID = 'egoing'
if input_ID == ID:
print('Welcome')
else:
print('who?')
#023
print(0)
if True:
print(1)
elif True:
print(2)
else:
print(3)
print(4)
print('---')
#024
print(0)
if False:
print(1)
elif False:
print(2)
else:
print(3)
print(4)
input_ID = input('ID: ')
ID1 = 'egoing'
ID2 = 'basta'
if input_ID == ID1:
print('Welcome')
elif input_ID == ID2:
print('Welcome')
else:
print('who?')
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')
persons = [
['egoing', 'Seoul', 'Web'],
['basta', 'Seoul', 'IOT'],
['blckdew', 'Tongyeong', 'ML']
]
print(persons[0][0])
for person in persons:
print(person[0]+','+person[1]+','+person[2])
name, address, interest = ['egoing', 'Seoul', 'Web']
print(name, address, interest)
for name, address, interest in persons:
print(name+','+address+','+interest)
person = {'name':'egoing', 'address':'Seoul', 'interest':'Web'}
print(person['name'])
for key in person:
print(key, person[key])
persons = [
{'name':'egoing', 'address':'Seoul', 'interest':'Web'},
{'name':'basta', 'address':'Seoul', 'interest':'IOT'},
{'name':'blackdew', 'address':'Tongyeong', 'interest':'ML'}
]
print('==== persons ====')
for person in persons:
for key in person:
print(key, ':', person[key])
print('---------------')
728x90
반응형
'코딩 > Python' 카테고리의 다른 글
Python) 당첨자 프로그램 만들기 (0) | 2022.06.29 |
---|---|
Python) 규칙 이용해서 비밀번호 생성하기 (0) | 2022.06.29 |
생활코딩) Python 입문과정 1-16 (0) | 2022.06.27 |
[Python] Factorial 기능 구현해보기 (0) | 2022.06.24 |
6/21 제어문 (0) | 2022.06.21 |