Write the output of the following code
# !/usr/bin/python
str = "this is string example….wow!!!"
print str.zfill(40)
print str.zfill(50)
Answers
Answered by
0
The given code uses the method of Zfill pads.
- The method of Zfil pads string on the left with the zeros to fill the width.
- The syntax for the same is str.zfill ( width). This method returns a padded string
- On running the above code, the following result will be produced -
OOOOOOOOthis is string example….wow!!!
000000000000000000 this is string example…. wow!!!
Similar questions
Social Sciences,
5 months ago
Hindi,
5 months ago
Economy,
5 months ago
Computer Science,
11 months ago
Computer Science,
11 months ago