0
Sum list with mumber
It's possible in python sum the only element of list with a single number in this mode: list=list+k? Thanks
7 ответов
+ 2
What's the expected output?
+ 2
#do you want this:
list = [10, 15, 30]
k = 5
result += sum(list) + k
print(result) #60
#or this:
list = [10, 15, 30]
k = 5
list.append(k)
print(list) #[10, 15, 30, 5]
or sth else?
+ 1
intlist = [4, 7, 9, 1]
k = 8
for i in range(len(intlist)):
intlist[i] += k
print(intlist)
Output:
[12, 15, 17, 9]
0
List=[10, 15,30]
K=5
List+=K
It's possible this trick?
0
Sum number at only element of list?
0
Ok thanks