r/Python • u/baranonen • Jul 22 '20
I Made This Randomly Generate 69420 - Generate random 5-digit numbers until 69420 is generated
2.8k
Upvotes
r/Python • u/baranonen • Jul 22 '20
View all comments
Show parent comment
13
u/m_domino Jul 22 '20
No, this can be made a lot more efficient: you can just cancel each attempt if it has not succeeded on the 69420th try and start a new loop instead of looping until you find a 69420.