2020-08-17 17:41:00 -0600 | received badge | ● Popular Question (source) |

2018-07-11 09:23:50 -0600 | received badge | ● Student (source) |

2018-07-11 09:23:03 -0600 | received badge | ● Self-Learner (source) |

2018-07-11 09:23:03 -0600 | received badge | ● Teacher (source) |

2018-06-29 11:35:09 -0600 | commented question | How to sum numbers on a list? I think I found a way to do it: LSC_20 = [sum(LC_20[:i+1]) for i in range(len(LC_20))] Note: LC_20 is the name I put to the first list. I'm closing this post since the problem is now solved. Sorry for bothering you, guys. |

2018-06-29 10:59:05 -0600 | commented question | How to sum numbers on a list? I tried to use sum() function, but it didn't work. I could use a for loop, but all the code has to be in this: LSC_20 = |

2018-06-29 10:43:56 -0600 | asked a question | How to sum numbers on a list? Hi, I'm stuck at this problem:
I know that if I want to do a list with the squares of the 20 first positive integers I have to do this: [(x+1)^2 for x in range(20)] And I'll get this: [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400] But I don't know how to do it with the sums: Basically, what I want to get is this: [5,14,30,55,...] Do you know how to do it? Thanks in advance. P.S. Sorry for my English. |

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.