I have used this code and I've got weird answer!! Why this happened? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I have used this code and I've got weird answer!! Why this happened?

i=1 While i<=5: print (i) i+= 0.05

24th Feb 2022, 6:43 PM
andrew 26d
3 Answers
+ 2
Read this documentation, it will answer your question. https://docs.python.org/3/tutorial/floatingpoint.html
24th Feb 2022, 6:51 PM
ChaoticDawg
ChaoticDawg - avatar
+ 3
Hi! what exactly answer did you receive and what result do you expect? I launched your program and it works great. really I fixed a little mistake you made
24th Feb 2022, 6:53 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
this could happen accidentally, the capital letter was formed when copying the code. most likely, the interrogator had in mind the result. he surprised him
25th Feb 2022, 9:41 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar