square = [ ]
n = int(input())
for i in range(0,n+1):
    square.append(i)
print(square)
square2=[i**2 for i in range(0, n+1)]
print(f'리스트 컴프리헨션: square2=[i**2 for i in range(0, n+1)] -->{square2}')
print('기본형 : 원소 for 원소 in range(범위)')
square3=[]
square3 =[abs(i) for i in range(-5,1)]
print(square3)



s4 = [i for i in range(0,n+1) if i % 2==0]
print(s4)
letter='abcdef'
s5 = [i*2 for i in letter if i!='c']
print(s5)

Embed on website

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