Python Forum
Is this right code for 3 digit pin ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is this right code for 3 digit pin ?
#1
Is this the right code for a 3 digit pin ?

for pin in range(1000): if test(f'{pin:03d}'): print(f'{pin:03d}')
Reply
#2
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] Pad strings to always get three-digit number? Winfried 2 289 Jan-27-2024, 05:23 PM
Last Post: Winfried
  prefix ID Number with 0,00 make 3 digit. mg24 1 708 Oct-06-2022, 07:20 AM
Last Post: ibreeden
  if a string has a digit - print tester_V 2 2,081 Jan-16-2021, 04:48 AM
Last Post: tester_V
  [split] I need help making a four digit code cracker with random tycpytyt 1 2,516 Mar-24-2019, 05:53 PM
Last Post: micseydel
  Writing a code with 3 digit numbers while they cant contain 0 and then sum them AFKManager 2 2,342 Jan-13-2019, 12:00 PM
Last Post: perfringo
  syntax for endswith a digit birdieman 2 5,585 Mar-04-2017, 07:21 PM
Last Post: birdieman

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020