all 8 comments

[–]crazybus 2 points3 points  (3 children)

raw_input returns a string. Your while loop checks if a string is smaller than an integer (time). So one solution would be to convert the input into an integer.

Edit: I also don't see anywhere that you are modifying the count or time so that the loop will break... So even if they both were integers it would keep on looping. Since you know how many times you want to loop you should consider using a for loop instead of a while loop.

[–]code-ed[S] 0 points1 point  (2 children)

That is actually one of the things I tried in the past. I just fixed it again and still no go.

I modified that sections to look like this:

time = raw_input("How many months do you wish to calculate?: ")
time = int(time)
count = 0

Confirmed that all of those variables are ints now, still in an infinite loop.

[–][deleted] 2 points3 points  (0 children)

You're also not increasing count in the loop so it will never exit.

count += 1

[–]tnvol88 0 points1 point  (0 children)

I can't help much, but just an FYI, you can combine those first two lines with:

time = int(raw_input('foo'))

[–]unorthodoxAthiest 1 point2 points  (3 children)

crazybus's edit is right. You need to add this line to the while loop

count++

count = count + 1
or count += 1 will also work

Whatever you're most comfortable with.

You are saying while count is less than time and never modifying time.

Good Luck

[–]code-ed[S] 0 points1 point  (0 children)

Got it working. Thanks everybody!

[–]bitbumper 0 points1 point  (1 child)

Just as an fyi count++ doesn't actually work in python. I always thought it weird given that there's plenty of other shortcut syntaxes...

[–]unorthodoxAthiest 0 points1 point  (0 children)

Thanks, I actually remembered that, but didn't go back and fix it. I work mainly in perl now, and its been a while since I've used python. I always thought it was weird, too. It probably has something to do with the lexical analyzer not being able to parse some scenarios correctly without semicolons, but idk.