4.3 Input and Output

As you saw in the video course, inputs and outputs are crucial in software. Python includes a plethora of built-in functions and methods for dealing with I/O operations. You must be familiar with two of the most widely used methods, input() and print(). In this video, we'll go through each technique in further depth and see what other features they have.




Inputs

When it comes to input, the thing doing the action does not have to be a person. In most circumstances, it is most likely one piece of computer software communicating with another. This course will just cover the human side of the process; in subsequent topics, you will learn how to develop programs that communicate with one another.

The console is one of the primary ways a human may interface with software. By this point, you should have a solid idea of what a console is and how to utilize itint, you should have a solid idea of what a console is and how to utilize it. When it comes to interacting with Python applications, there is another option in the shape of the IDLE. In any instance, we may utilize the input() function to receive user input. This tells the application to halt and wait for the user to enter something. By clicking the enter key, we signal the software that we have finished inputting our data and ask it to process it.





Even though we only used text-related examples during the session, inputs do not have to be text-based. They can also be mouse clicks, drag and drops, or even an audio clip. Unlike text, dealing with various types of data is a little more difficult. As a result, after you have a better grasp of the programming language, you will be able to go further into these areas as well.

Outputs

Outputs can take many different shapes and forms. The most popular format will be text outputs, but there are many more fascinating formats to consider, such as binary files, graphics, and even speech. Instead of merely presenting text outputs on the screen, we may style them to make them seem nicer and simpler to comprehend. If we need to print data in a table format, for example, we may use Python's string formatting function to structure how a row should look and then fill in the gaps with the format() method


When displaying text, we may include ornamental characteristics such as text colors and backdrop colors in addition to spatial formatting. You may accomplish this manually or with the help of a Python module. We will not go further into this issue because it is quite sophisticated, but if you are interested, you may learn more about it here. If you're up for a challenge, try constructing a green Christmas tree. In this method, you may also print letters in styles such as bold and italic.