+ 1
Can each list value divided by some number ?
Want to add 3rd section in table with factor by 2nd section of data value https://code.sololearn.com/cWFxhezLD1w1/?ref=app
12 Réponses
+ 2
ғᴜɴ 3x
Yes there is a way.
original = [1,2,3,4,5]
newlst = []
for i in original:
newlst.append(i/2) #i/anything
print(newlst)
another, shorter way.
a = [1,2,3,4,5]
c = [i/2 for i in a]
print(c)
+ 6
Additionally we have the map function.
c = list(map(lambda x:x/2), a)
+ 6
can u tell us more about the program?
+ 5
maf not clear for me too.
+ 2
strength = [i/22.5 for i in load]
Did u encounter a problem?
+ 1
maf
It works but i shuffle that list so result is mixed up
https://ibb.co/v11t4nb
I want strenth by dividing value of load by 22.5
+ 1
Oma Falk help him bro i can't solve the problem :D
Idk why the answer is different, sorry
+ 1
Thank you both solved <3
I want another section for average the 3 values in strenth
+ 1
ғᴜɴ 3x np.
This wouldn't be a list so,
avg = sum(strength) / len(strength)
+ 1
maf letme try this
+ 1
Oma Falk
I want to make a report card for personal use
Which have random values in each
0
+--------+------+--------------------+
| weight | load | strenth |
+--------+------+--------------------+
| 8.99 | 545 | 21.24444 |
| 8.66 | 485 | 21.288888 |
| 8.88 | 491 | 21.333332 |
+--------+------+--------------------+
Here i want 545/22.5 = strenth
24.22 not random amswer