#python #anaconda #jupyter-notebook #visual-code #html #css #javascript #http

제목list in list 로 구구단 만들기2019-04-10 19:35
작성자

구구단 만들기에서 list in list로 만든다는 게 단순히 결과가 list안에 있으면 되는 건가요? 구현했는데 다 비슷비슷해보이기도 하고 잘 하고 있는 건지 모르겠어요.

[1]

gugudan=[]

number=int(input('decide the number: '))

for n in[1,2,3,4,5,6,7,8,9]:

    gugudan.append(number*n)

print (gugudan)


[2]

gugudan=[]

dan=[]

for x in [1,2,3,4,5,6,7,8,9]:

    dan=[]

    for y in [1,2,3,4,5,6,7,8,9]:

        dan.append(x*y)

    gugudan+=[dan]

print (gugudan)


[3]

x=1

dan=[]

while(x<10):

    dan=[]

    for y in [1,2,3,4,5,6,7,8,9]:

        dan.append(x*y)

    print (dan)

    x+=1

댓글