Python Forum
Python Forum
>
Python Coding
>
General Coding Help
> Is this right code for 3 digit pin ?
Full Version:
Is this right code for 3 digit pin ?
You're currently viewing a stripped down version of our content.
View the full version
with proper formatting.
fatjuicypython
Aug-21-2020, 11:02 PM
Is this the right code for a 3 digit pin ?
for pin in range(1000): if test(f'{pin:03d}'): print(f'{pin:03d}')
bowlofred
Aug-21-2020, 11:15 PM
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.
Python Forum
>
Python Coding
>
General Coding Help
> Is this right code for 3 digit pin ?