How to iterate through a float..? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to iterate through a float..?

Here when i tried iterating "pi" I couldn't since its a float But when i converted it into a string..its digits is not being iterated..how to iterate through its digits? https://code.sololearn.com/cuWAgfTBBRFP/?ref=app

5th Aug 2019, 3:38 PM
Y AD Ù
Y AD Ù - avatar
2 Answers
+ 3
https://code.sololearn.com/c75dxfa0UbZD/?ref=app Fixed it. Since you converted pi to a string, the characters will all be strings. "string == int" will always be false, and thats why it returns 0
5th Aug 2019, 3:45 PM
Trigger
Trigger - avatar
+ 1
Oohhh yeahh Thomas Williams tnks mahnn
5th Aug 2019, 3:50 PM
Y AD Ù
Y AD Ù - avatar