Holla Tech - Learn

Output
 

Usually, programs take input and process it to produce output.
In Python, you can use the print function to produce output. This displays a textual representation of something to the screen. 

>> print(1 + 1)
2
>>> print(“Hello\nWorld!”)
Hello
World

 

NOTE!
When a string is printed, the quotes around it are not displayed.

Input
 

To get input from the user in Python, you can use the intuitively named input function.
The function prompts the user for input, and returns what they enter as a string (with the contents automatically escaped).

>> input(“Enter something please: “)
Enter something please: This is what\nthe user enters!

‘This is what\\nthe user enters!’ 

 

NOTE!
The print and input functions aren’t very useful at the Python console, which automatically does input and output. However, they are very useful in actual programs.

BACK NEXT

CLICK ON THE BUTTON BELOW TO GO TO THE PYTHON MAIN COURSE PAGE. 

PYTHON MAIN COURSE PAGE

 


©️ License: All Rights Reserved 


CONTACT HOLLA TECH – LEARN SUPPORT