$ ./guess_the_languageProblem Solving — fix the bug
Problem Solving — fix the bug · medium · #106

What is the correct fix?

for i in range(0, 1, 0.1):
    print(i)
  1. Scale to ints: range(0, 10) then divide
  2. Scale to ints: range(0, 10, 0.1) then divide
  3. Change range to enumerate in the loop
  4. Cast the step with int(0.1) beforehand
range only accepts integers; iterate whole numbers and divide inside the loop.
Play Problem Solving ▸