有谁懂
发表于 2020-5-12 21:07:26
大佬们的代码我都看不懂{:10_266:}
ls1 = list(input("输入数字列表,用英文逗号隔开:"))
ls = []
lt = []
n = 1
for i in ls1:
if i not in ls:
ls.append(i)
ls.remove(',')
ls = list(map(int,ls))
for each in range(len(ls)):
ls2 = ls[:]
ls2.pop(each)
for m in ls2:
n *= m
lt.append(n)
n = 1
print(ls,'\n',lt)
ForPorsche
发表于 2020-5-20 11:47:19
num = input('请输入一个数字列表,用英文逗号隔开:')
Is = list(map(int, num.split(',')))
print(Is)
It = []
s = 1
for i in range(len(Is)):
a = Is[:]
a.pop(i)
for j in a:
s *= j
It.append(s)
s = 1
print(It)
小小任
发表于 2020-11-24 19:53:00
学习
aironeng
发表于 2020-11-25 09:03:16
学习一下
sun8061
发表于 2020-12-8 13:13:46
学习,看作案。
xianoxin
发表于 2020-12-8 16:56:58
沙发
小小怪士兵
发表于 2020-12-8 20:02:44
看一眼
leijunke
发表于 2020-12-8 20:25:21
我来学习学习
kevinmintnick
发表于 2020-12-8 20:45:05
dd
altf11
发表于 2020-12-8 23:04:32
from functools import reduce
from operator import mul
ls =
lt = list(map(lambda x: reduce(mul, ls)//x, ls))
print(ls)
print(lt)
ljr13900
发表于 2020-12-8 23:24:37
题目都没看懂{:5_96:}
Latulipe
发表于 2021-5-20 09:21:19
n=int(input())
lt=list()
for i in range(len(ls)):
t=1
for j in range (len(ls)):
if :
else:
t=t*ls
print(ls)
print(lt)
luoxiaozl
发表于 2021-5-20 09:50:35
每日一题
huangyu007
发表于 2021-5-25 18:25:30
参考答案
maxwangw
发表于 2021-5-25 20:09:11
好好学习,天天向上!!
疾风魔狼剑
发表于 2021-5-25 21:05:15
n=input('请输入一个数字列表,用英文逗号隔开:')
l=n.split(',')
ls=[]
for i in l:
ls.append(int(i))
print(ls)
ji=1
for i in ls:
ji*=i
lt=[]
for i in ls:
lt.append(ji//i)
print(lt)
啊鱼是啊鱼吖
发表于 2021-5-25 22:17:58
新人来了,学习学习哈哈哈
灰灰不是姑娘
发表于 2021-5-26 00:03:38
1
winerly2010
发表于 2021-5-26 13:43:34
学习一下
剑廿三
发表于 2021-5-30 19:41:08
ls = []
lt = []
numbers = input('请输入n(n>1)个数字,且用逗号隔开')
for i in numbers:
ls.append(i)
mul = 1
for i in range(len(ls)):
for x in ls:
mul *= x
lt.append(mul/ls)
print(ls)
print(lt)