empty_lst = []
string_lst = ['a', 'b', 'c']
integer_lst = [1, 2, 3, 4]
lst_of_lists = [[1,2,3], ['a', 'b', 'c']]
lst_of_tuples = [(1, 'a'), (2, 'b'), (3, 'c')]
print(empty_lst)
print(string_lst)
print(integer_lst)
print(lst_of_lists)
print(lst_of_tuples)
[]
['a', 'b', 'c']
[1, 2, 3, 4]
[[1, 2, 3], ['a', 'b', 'c']]
[(1, 'a'), (2, 'b'), (3, 'c')]
1
가
['b', 3, '가']
[1, 'a', 2, 'b', 3, '가']
[1, 2, 3, 4, 5, 6]
[1, 2, 3, 4, 5, 6, 'a', 'b', 'c']
[1, 2, 3, 4, 5, 10, 9]
[1, 2, 3, 4, 10, 9]
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
print(letters)
letters[2:5] = ['C', 'D', 'E']
print(letters)
letters[2:5] = []
print(letters)
letters[:] = []
print(letters)
['a', 'b', 'c', 'd', 'e', 'f', 'g']
['a', 'b', 'C', 'D', 'E', 'f', 'g']
['a', 'b', 'f', 'g']
[]
[1, 2, 3, 4, 10, 9, 64, '공정', (5, '정의')]
[1, 2, 4, 5, 9]
[9, 5, 4, 2, 1]
lst = ['first', 'second', 'third']
for str in lst:
print('this entry is %s' % str)
set = [('사과', 'apple'), ('바나나', 'banana') ]
for korean, english in set:
print('한국어 %s는 영어로 %s입니다.' % (korean, english))
this entry is first
this entry is second
this entry is third
한국어 사과는 영어로 apple입니다.
한국어 바나나는 영어로 banana입니다.
댓글남기기