Iterating through integers in Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Iterating through integers in Python

Happy pm to you fine folks! Any of you all have favorite methods for iterating through integers in Python, especially for larger numbers? All that flip flopping from int to str and back feels like it messes with the larger numbers.

7th Aug 2018, 4:53 AM
Davod
Davod - avatar
3 Answers
+ 1
i do that flip flopping. depending on how much i iterate i might save the int into a str variable so i dont have to str() every time
7th Aug 2018, 5:01 AM
Markus Kaleton
Markus Kaleton - avatar
+ 1
Be more precise, pb not clear. If you flip flop you probably do things the wrong way
7th Aug 2018, 7:10 AM
VcC
VcC - avatar
0
[int(n) for n in str(num)] 😃😄
7th Aug 2018, 5:08 AM
Davod
Davod - avatar