[PYTHON] Code works in Codecademy but not in IDLE

this is the code, which works in codecademy, but when it is run in IDLE, nothing shows up, other than >>>

c = 0
b = input("b? ")
a = input("a? ")
while a >= b:
    a -= b
    c += 1
    if not a >= b:
      print ("This is c: ",c)
      print ("This is a: ",a)
      break

what python version does your IDLE run? Different might have different python versions, you can’t just copy paste and assume it works, never a good idea in programming

2 Likes

My IDLE runs the version 3.6.3

Which raises the question, is that the same version as codecademy uses?

2 Likes

Obviously not, since it doesn’t work :smiley: and also because the version on codeacademy doesn’t require brackets around the text when you use “print”.

So what would be a good next step?

2 Likes

I’ve already done some research, with no good results, so I thought, I might ask the experts.

What have you researched? What do you think you need to research? We can help you, but you have to get to the solution with our help, this will teach you the most

2 Likes

I’ve researched, why IDLE wont print or why the if statement doesn’t work. Apparently, nobody else has ever had this problem, other than me.

Not the right approach. You moved to a different version of python, so you need to verify everything works the same. You only use a single built-in function (input()), does this work the same in both python versions? If not, how are they different? How does this affect the rest of my program?

2 Likes

I finally got it. The inputs were stored as strings, instead of integers. It now works fine.
By the way, the input() function works the same ; )

no, your IDLE input() works very different from codecademy input() due to the different python version. You still haven’t figured out what python version codecademy is using

being able to ask the right question and do the right research is very important

2 Likes