+ 6
Can anyone help me?
I don't know why this appends and if it is a error that I can fix, please, help https://code.sololearn.com/cfEll7jI59e6/?ref=app
11 Réponses
+ 9
Some Guy Whit A Computer ,
if you need a higher precision as float or double can give, you can use the "Decimal" datatype. to do so, you need to import the decimal module in python. you can find more about it in the documentation:
https://docs.python.org/3.9/library/decimal.html
+ 3
s = 1
for i in range(int(input())):
print("0."+"3"*s)
s += 1
+ 2
Unfortunately, most decimal fractions cannot be represented exactly as binary fractions. One consequence of this is that, in general, values entered as decimal floating point values can only be approximated by the binary floating point values that are actually stored by the computer.
+ 2
Thanks you all
+ 2
Did you try to start with the smallest one (r += 0.000003) , and end with the biggest (r += 0.3) ?
+ 2
Günes no, but the code that I need to write needs do be the biggest one summed whit the smallest one
+ 2
Some Guy Whit A Computer,
That is good to know, cause reverse order would working fine.
+ 2
Some Guy Whit A Computer
r = 0
k = 0
for i in range(int(input())):
r += 3*(10**k)
print(r/(10**(k+1)))
k += 1
+ 1
ing that is a good idea, but because I can't add strings, I can't use it
0
ing i will test it later on my code, tnx