Articles

Python program to print a sentence

Python program to print a sentence

In this python programs guide, we will learn to write:

  • python program to print a sentence

Python program to print a sentence

The code or python program to print a sentence is as follows:

 

# Owner : TutorialsInhand Author : Devjeet Roy
sentence = input("Enter a sentence: ")
print("Your sentence is:")
print(sentence)

The output is:

 

PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
Enter a sentence: I am a Developer
Your sentence is:
I am a Developer

Few important points on this program:

1. As discussed earlier, there is no main() method in Python. However you can make a use of one using the __name__ attribute.

2. In Python, we take user input using the input() function. The parameter to the input() function is the text which you want to get displayed in the console.

3. By default, print() function outputs a line in the console, starting from a new line always. However, you can make use of the same line using the end attribute.

 

print a sentence in python

 


Basic Python Programs

Would you like to see your article here on tutorialsinhand. Join Write4Us program by tutorialsinhand.com

About the Author
Devjeet Roy
Full Stack Web Developer & Data Science Enthusiast
Page Views :    Published Date : Jan 18,2021  
Please Share this page

Related Articles

Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!