How to execute the print() function in Python
The print() function prints the specified message to the screen or another standard output device. The message can be a string or any other object, the object will be converted into a string before written to the screen.
Syntax:-
print(object(s), separator=separator, end=end, file=file, flush=flush)
Example:
print(object(s), sep=' ', end='\n', file=sys, flush=False)
Parameters:
- object(s) – Object(s) to be printed on the screen.
- sep – object(s) will be printed separately with the separator between and the default value is ‘ ‘
- end – It will break the line into the next line. By default, it is set to ‘\n’.
- file – An object with a write method. Default: sys.stdout
- flush – A Boolean, specifying if the output is flushed (True) or buffered (False). Default: False
Example to use of Print Function
- Printing single object onto the screen:
print("hello world")
- Printing two or more objects onto the screen.
print("line A \nline B") print("line a\n line b\n line c")
- Print string into in single ‘abc’ and the double court “abc” in a sentence.
print('line "a" \nline "b"')
- Print single ‘/’ or more slice ‘//’ in a sentence.
print("/\ /\\ //\ ")
- Input the value using a separator (“,”)
name,age=input("enter value a and b:").split(",") age=int(age) print(name,'\n',age)
Output:
C:\Users\Pramod\PycharmProjects\pythonProject\venv\Scripts\python.exe C:/Users/Pramod/PycharmProjects/pythonProject/main.py enter value a and b:pramod,24 pramod 24
Recommended Post:
- Python Hello World Program
- Python Comment | Creating a Comment | multiline comment | example
- Python Dictionary Introduction | Why to use dictionary | with example
- How to do Sum or Addition in python
- Python Reverse number
- find the common number in python
- addition of number using for loop and providing user input data in python
- Python Count char in String
- Python Last Character from String
- Python Odd and Even | if the condition
- Python Greater or equal number
- Python PALINDROME NUMBER
- Python FIBONACCI SERIES
- Python Dictionary | Items method | Definition and usage
- Python Dictionary | Add data, POP, pop item, update method
- Python Dictionary | update() method
- Delete statement, Looping in the list In Python
- Odd and Even using Append in python
- Python | Simple Odd and Even number
Get Salesforce Answers
プレドニン処方 – г‚ўг‚ёг‚№гѓгѓћг‚¤г‚·гѓійЊ 500mg еј·гЃ• г‚ёг‚№гѓгѓћгѓѓг‚Ї гЃЇйЂљиІ©гЃ§гЃ®иіј