You can download this code by clicking the button below.
This code is now available for download.
This function is used to pad a string with characters at the beginning to make its length reach a specified width. The default padding character is '0' and the default width is 2.
Technology Stack : str.zfill(width), str.rjust(width, fillchar)
Code Type : String operation
Code Difficulty : Intermediate
def zfill(number, width=2, fillchar='0'):
return str(number).zfill(width).rjust(width, fillchar)