String Ljust in Python
Level 254 keystrokes
This left-justifies a string within a specified width, padding with a character on the right.
Python code
# Create a short string1text = "Hi"# ljust(width, char) pads the string to the specified width# The string is left-aligned, padding goes on the right2padded = text.ljust(10, "-")# Print the padded string (Hi followed by 8 dashes)3print(padded)Output
Hi--------
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this Python code and how often they appear.
"× 4(× 2)× 2=× 2-× 1,× 1.× 1