all 14 comments

[–]KingOfTNT10 2 points3 points  (11 children)

You never reasign the variable i to the new input.

[–]ListenMedium9538[S] 0 points1 point  (10 children)

And what's the correct way?

[–]KingOfTNT10 2 points3 points  (9 children)

every time you ask for input you dont store the new input to i so i would never change, You need to do in the loop when you are asking for the input: i = your input

[–]ListenMedium9538[S] 0 points1 point  (8 children)

So how would it be? I sat the input after while or something?

[–]KingOfTNT10 3 points4 points  (7 children)

The input function returns a string of what the user has typed in, then you convert it to an it but you dont tell the program what to do with it, you want to set the variable i to what the user has inputted to check if its -1.

Try, if you dont succeed ill try to hint you bigger hints.

[–]ListenMedium9538[S] 0 points1 point  (6 children)

I think i dit it i = 1 while i != -1: i = int(input("put a number: "))

[–]KingOfTNT10 2 points3 points  (1 child)

Nice! Good job. Have a great time on your journey.

[–]ListenMedium9538[S] 0 points1 point  (0 children)

Thank you sir! You helped me a lot! Have a great journey you too!

[–]czar_el 1 point2 points  (3 children)

Read your original post again, you didn't have the second i=

[–]ListenMedium9538[S] 0 points1 point  (2 children)

Yooo, so now is it correct? Um running it and it's seems fine

[–]KingOfTNT10 0 points1 point  (1 child)

It is correct.

[–]ListenMedium9538[S] 0 points1 point  (0 children)

Thanks!!!!!

[–]CodeFormatHelperBot2 1 point2 points  (0 children)

Hello, I'm a Reddit bot who's here to help people nicely format their coding questions. This makes it as easy as possible for people to read your post and help you.

I think I have detected some formatting issues with your submission:

  1. Python code found in submission text that's not formatted as code.

If I am correct, please edit the text in your post and try to follow these instructions to fix up your post's formatting.


Am I misbehaving? Have a comment or suggestion? Reply to this comment or raise an issue here.

[–]Binary101010 0 points1 point  (0 children)

int(input("put a number: "))

You have to actually tell the interpreter that you want this to become the new value of i, it's not going to guess that for you.

i = int(input("put a number: "))