Python: Set the indentation of the first line
Set first line indentation.
Write a Python program to set the indentation of the first line.
Sample Solution:
Python Code:
Sample Output:
Python is a widely used high-level, general-purpose, interpreted, dynamic programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than possible in languages such as C++ or Java.
Flowchart:
For more Practice: Solve these Related Problems:
- Write a Python program to indent only the first line of a multi-line string by a specified number of spaces.
- Write a Python program to add a custom indentation to the first line of text while leaving subsequent lines unchanged.
- Write a Python program to use string concatenation to apply a prefix of spaces to the first line of a paragraph.
- Write a Python program to implement a function that sets the first line indentation based on user input.
Go to:
Previous: Write a Python program to add a prefix text to all of the lines in a string.
Next: Write a Python program to print the following floating numbers upto 2 decimal places.
Python Code Editor:
Contribute your code and comments through Disqus.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.