Can anyone help me? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

21st Dec 2021, 1:10 PM
Some Guy Whit A Computer
Some Guy Whit A Computer - avatar
11 Answers
+ 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
21st Dec 2021, 3:09 PM
Lothar
Lothar - avatar
+ 3
s = 1 for i in range(int(input())): print("0."+"3"*s) s += 1
22nd Dec 2021, 6:31 PM
ing
+ 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.
21st Dec 2021, 2:35 PM
JaScript
JaScript - avatar
+ 2
Thanks you all
21st Dec 2021, 4:29 PM
Some Guy Whit A Computer
Some Guy Whit A Computer - avatar
+ 2
Did you try to start with the smallest one (r += 0.000003) , and end with the biggest (r += 0.3) ?
23rd Dec 2021, 8:20 AM
SoloilSole
SoloilSole - avatar
+ 2
Günes no, but the code that I need to write needs do be the biggest one summed whit the smallest one
23rd Dec 2021, 10:25 AM
Some Guy Whit A Computer
Some Guy Whit A Computer - avatar
+ 2
Some Guy Whit A Computer, That is good to know, cause reverse order would working fine.
23rd Dec 2021, 10:38 AM
SoloilSole
SoloilSole - avatar
+ 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
23rd Dec 2021, 10:52 AM
ing
+ 1
ing that is a good idea, but because I can't add strings, I can't use it
23rd Dec 2021, 10:26 AM
Some Guy Whit A Computer
Some Guy Whit A Computer - avatar
0
ing i will test it later on my code, tnx
23rd Dec 2021, 11:09 AM
Some Guy Whit A Computer
Some Guy Whit A Computer - avatar