String Rjust in Python
Level 254 keystrokes
This right-justifies a string within a specified width, padding with a character on the left.
Python code
# Create a short string1text = "Hi"# rjust(width, char) pads the string to the specified width# The string is right-aligned, padding goes on the left2padded = text.rjust(10, "*")# Print the padded string (8 asterisks followed by Hi)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