Python Forum
Is this right code for 3 digit pin ? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Is this right code for 3 digit pin ? (/thread-29184.html)



Is this right code for 3 digit pin ? - fatjuicypython - Aug-21-2020

Is this the right code for a 3 digit pin ?

for pin in range(1000): if test(f'{pin:03d}'): print(f'{pin:03d}')



RE: Is this right code for 3 digit pin ? - bowlofred - Aug-21-2020

Not sure what you want by "right code", but that format will give you the three-digit, zero-prefixed string for any number under 1000.