[PYTHON] Code works in Codecademy but not in IDLE


#1

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

#2

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


#3

My IDLE runs the version 3.6.3


#4

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


#5

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”.


#6

So what would be a good next step?


#7

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


#8

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


#9

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.


#10

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?


#11

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 ; )


#12

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