How to Print in Python with Examples:
How to print simple string?
More often then not you require to Print strings in your coding construct.
Example: 1
To print the "Welcome The Next Globe" use the print () function as follows:
Output:
How to print blank lines
Sometimes you need to print one blank line in your Python program. Following are an example to perform this task.
Example:
Let us print 10 blank lines. You can type:
print ("Welcome to The next Globe")
print (10 *"\n")
print ("Welcome to The next Globe")
Output:
Print end command
By default, python's print() function ends with a newline. This function comes with a parameter called 'end.' The default value of this parameter is '\n,' i.e., the new line character. You can end a print statement with any character or string using this parameter.
e.g.
print("Python" , end = '::')
Output is :
Comments
Post a Comment