Friday, July 16, 2021

Python 101: Input/Output

In programming (or life generally), communication involves you being able to send and receive messages.
Programming has now made this possible by introducing I/O to every program.
I/I is the part of the program that allows you to print out messages on a screen, like the hello world program we ran, and receive input from the users.
In python, the two main I/O functions are print() and input().

Python Output
The output function for python is print() as you probably know already. But the main syntax is:




 Print is the main command the computer looks for.
Objects represents the message you want to display
sep is used to separate characters, by default it is a space. But you can manually change it


output:

 File is the location you want the message to be printed to, by default it is sys.stdout 
which is the screen.
end is used to jump to a new line
Flush is a Boolean argument which is false by default


Python Input
The function for receiving inputs from users is  input (__prompt)
The computer prints out the prompt as some sort of questioner and leaves the cursor blinking to enable user input.

No comments:

Post a Comment

HTML 101: Form

  I believe that everyone who has made use of the internet knows what a form is but in case you don't know, a form is a way of receiving...