xiaofan1228 发表于 2020-3-3 00:18:27

X = [,
    ,
    ]

Y = [,
    ,
    ]

a, b, c = X
a1, b1, c1 = Y
a2 = []
b2 = []
c2 = []

for i in range(3):
    a2.append(a + a1)
    b2.append(b + b1)
    c2.append(c + c1)

print(a2)
print(b2)
print(c2)

杜若左 发表于 2020-3-6 09:45:20

谢谢

杜若左 发表于 2020-3-6 09:57:41

a = [,,]
b = [,,]
for i in range(0,3):
    for j in range(0,3):
      a=a+b
print(a)

杜若左 发表于 2020-3-6 10:20:26

受楼上大哥们的启发又写了一个
a = [,,]
b = [,,]
c = []
for i in range(len(a)):
    a1=a
    b1=b
    for j,k in zip(a1,b1):
      c.append((j+k))
print(c)

DZG16 发表于 2020-3-26 20:54:34

学习

holiday_python 发表于 2020-3-29 11:41:27

d

土二奇 发表于 2020-4-22 18:54:15

zip(x,y)可以么

尔东方 发表于 2020-4-28 22:30:04

本帖最后由 尔东方 于 2020-4-28 22:34 编辑

List=[]
L1=
L2=
L3=
List1=
print(List1)
L4=
L5=
L6=
List2=
print(List2)

for i in range(0,3):
    List3 = []
    for j in range(0,3):
      x=List1+List2
      List3.append(x)
    List.append(List3)
for i in range(3):
    print(List)

killonon 发表于 2020-4-28 22:32:06

..

san1412 发表于 2020-5-12 09:31:18

X = [,
    ,
    ]

Y = [,
    ,
    ]

Z = []

for i in range(3):
    N = "list%s"%i#循环创建多个列表
    N = []
    for j in range(3):
      N.append(X + Y)#嵌套列表
    Z.append(N)
print(Z)

ForPorsche 发表于 2020-5-23 23:47:01

X = [, , ]
Y = [, , ]
list = []
for i in range(len(X)):
    list.append([])
    for j in range(len(X)):
      s = X + Y
      list.append(s)
print(list)

19971023 发表于 2020-5-25 10:25:45

1

dengyk 发表于 2020-5-25 13:55:25

x = [ , , ]
y = [ , , ]

list1 = []
list2 = []
list3 = []
list4 = []

for i in range(3):
    for m in range(3):
      if i == 1:
            list1.append(x + y)
      elif i == 2:
            list2.append(x + y)
      else:
            list3.append(x + y)
            
list4.append(list3)
list4.append(list1)
list4.append(list2)

print(list4)
      
   

nononoyes 发表于 2020-5-30 20:04:31

X = [,
   ,
   ,]

Y = [,
   ,
   ]
temp = []
Z = []

for i in range(0,len(X)):
    temp = []
    for j in range(0,len(X)):
      temp.append(X+Y)
    Z.append(temp)

print(Z)

素手就琴 发表于 2020-6-6 09:21:42

好题目

今天的我更强了 发表于 2020-6-24 09:41:54

X = [,
    ,
    ]

Y = [,
    ,
    ]
z=[]
a=[]
b=[]
c=[]
for i in range(3):
    for j in range(3):
      n=X+Y
      if i==0:
            a.append(n)
      elif i==1:
            b.append(n)
      else:
            c.append(n)
z=
print(z)

z2x2c8 发表于 2020-9-7 01:03:38

看看

goalht 发表于 2020-9-7 11:51:37

好好学习,天天向上

谢啾啾 发表于 2020-10-30 19:28:01

X = [,
   ,
   ]
x = []

Y = [,
   ,
   ]
y = []

nums = []
result = [[],
          [],
          []]

for each in X:
    for i in each:
      x.append(i)

for each in Y:
    for i in each:
      y.append(i)

length1 = len(x)
length2 = len(y)

for i in range(0, length1):
    for j in range(0, length2):
      if i == j:
            num = x + y
            nums.append(num)

for i in range(0, 3):
    result.append(nums)

for i in range(3, 6):
    result.append(nums)

for i in range(3, 6):
    result.append(nums)

for i in range(0, 3):
    print(result,'\n')

写的有些累赘{:10_247:}

魔鬼勇士 发表于 2020-11-19 11:41:01

支持楼主!!!
页: 1 2 3 4 5 6 [7] 8
查看完整版本: Python:每日一题 11