Python: Display a number in left, right and center aligned of width 10
Align number left, right, center (width=10).
Write a Python program to display a number in left, right, and center aligned with a width of 10.
Sample Solution:
Python Code:
Sample Output:
Original Number: 22 Left aligned (width 10) :22 Right aligned (width 10) : 22 Center aligned (width 10) : 22
Flowchart:
Python Code Editor:
Previous: Write a Python program to format a number with a percentage.
Next: Write a Python program to count occurrences of a substring in a string.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics