How to loop this code indefinitely? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to loop this code indefinitely?

I wrote some code to convert a base-10 number to a base of the user's choice. However it only works for a finite number and I would like to make it more dynamic, basing the length of the loop on the input. also I don't want to print unnecessary 0's in the prefix of the numbers printed. https://code.sololearn.com/cj8b0KsfVBPR/?ref=app

24th Feb 2018, 7:21 PM
Kevin C
2 Answers
+ 1
Loops are broken automatically by SoloLearn if it takes too long to process the output. I've had this happen way too often. This is why at high numbers your function stops. I hope I could be of help
5th Apr 2021, 8:02 AM
️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️
️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️ - avatar
0
I have not encountered your problem of prefix 0s in the output. Unfortunately, there is not much that can be done about the function just outright stopping at higher values. Although I was able to change how the function outputs the number (compacted it). https://code.sololearn.com/c1oES293M87T/?ref=app
5th Apr 2021, 8:00 AM
️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️
️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️ - avatar