Python Day Two : Python Output & Print
print() is a Python🐍 command used to show something on the screen.
Example:
print ( " Pure Pearl Foundation " )
Enter fullscreen mode
Exit fullscreen mode
print → tells Python to display output
"Pure Pearl Foundation" → the text to show on the screen
Text must be inside quotation marks " "
Output:
Pure Pearl Foundation
Enter fullscreen mode
Exit fullscreen mode
Print Number
print() can also display numbers in Python.
Example:
print ( 70 ) print ( 80 ) print ( 90 )
Enter fullscreen mode
Exit fullscreen mode
Explanation:
Numbers are written without quotation marks.
Python treats them as real numbers, not text.
Each print() shows the number on a new line.
Output:
70 80 90
Enter fullscreen mode
Exit fullscreen mode
Calculation
You can do calculations directly inside print() in Python.
Example:
print ( 10 + 10 ) print ( 20 - 20 ) print ( 50 / 5 ) print ( 5 * 5 )
Enter fullscreen mode
Exit fullscreen mode
Explanation:
+ means addition
-…