a = [1, 2]
a.append(1)
a.append(5)
print(a)
a.insert(1, 3) 
print(a)
a.remove(1)
print(a)
a.sort()
print(a)

str1 = "once"
print(str1[1])
print(str1[0:2])
print(str1[:]) #str1 전체 출력
print(str1[:3]) #처음부터 3이전까지 출력
print(str1[2:]) #2번째부터 끝까지
print(str1[-1]) 

print('o' in str1) 
print('f' in str1) 

print(len(str1))

str2 = 'twice'
print(str1 + str2)
print(str1 * 3)

num = int(input())
list = ['딸기', '수박', '토마토']
if '딸기' in list:
    list.remove('딸기')
else:
    print('수박' * num)

Embed on website

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