Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

python code help!!?

function that adds up positive integers in order starting from 1 until the sum is greater than 100 and then displays how many integers we needed to add to get a sum greater than 100 doesn't quite work..

Here is my code:

def howmanyint():

sum = 0

i = 0

while sum <= 100:

sum = sum + i

i + 1

return i

1 Answer

Relevance
  • Chris
    Lv 7
    5 years ago
    Favorite Answer

    Did you actually call this function? Because by itself, it's not going to do anything.

    http://ideone.com/O17ypR

Still have questions? Get your answers by asking now.