0

so Im taking a course intro to python and one of the labs has me stuck.

I have to take 2 inputs and divide them 3 times

ex input is 2000 2

ex output is 1000 500 250

so the input 1 is divided by input 2 then that answer is divided by output 2 again and again then print

the problem is that my output keeps putting a .0 at the end ex 1000.0 500.0 250.0

and that is wrong when I submit it

heres what i got

    user_num1 = input()
    user_num2 = input()
    a = (int(user_num1) / int(user_num2))
    b = (int(a) / int(user_num2))
    c = (int(b) / int(user_num2))
    print (a, b, c)
Mitchell
  • 15
  • 5

1 Answers1

0

Your problem is caused because when you divide two integers, the result is a float

# In your last line you can do    
print (int(a), int(b), int(c))

# Or
a = int(user_num1 / user_num2)
b = int(a / user_num2)
c = int(b / user_num2)
print (a, b, c)
Y.P
  • 355
  • 2
  • 12
  • 1
    ah i tried print int(a, b, c) and it gave me an error. i see i need int infront of each one lol thank you – Mitchell Dec 22 '20 at 17:57