You can download this code by clicking the button below.
This code is now available for download.
Uses the zfill method of the string to fill the string with a specified fill character to make its length equal to the specified width.
Technology Stack : str.zfill(width)
Code Type : String processing
Code Difficulty : Intermediate
def zfill(string, width, fillchar=' '):
"""
Fills the string with the fillchar to make its length equal to the specified width.
"""
return string.zfill(width)