I'm trying to make a simple program in python that shows me the numbers 1.0, 1.1 up to 2. This is the code
test = 1.0
while True:
print(test)
test += 0.1
if test > 2.1:
break
Output:
1.0
1.1
1.2000000000000002
1.3000000000000003
1.4000000000000004
1.5000000000000004
1.6000000000000005
1.7000000000000006
1.8000000000000007
1.9000000000000008
2.000000000000001
Expected output:
1.0
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9
2.0