Understanding Input and Print Statement

For Python Programming, we will first understand the use of Input and print Statements and then move step by step to further learning.

Using Input and Print Statement to print Name

We use Input Statement to take data as input. Data can be a variable, integer, or alpha-numeric number. The use of Print Statement is to print the value.

So let's start with the example of printing name-

In this code, we have used both Input and Print Statement

So in the above code, we had used a variable 'name' which will take the input entered by the user using the "input" command and will give the output using the "print" statement as stated above.

Adding custom message in Print Statement

Now we will add some custom text with the print statement to get our desired output as per our need.

Here we had added "hi" in our print statement for a custom message

We can add any text in the print statement according to our needs or to the needs of the user.

Using Comment Statement

We can add comments in our python code using hashtags( # ). Basically, comments are used to give additional information about the code.

In the above code, we had added comments which will explain to you the information regarding your code that what you have to do for the following line of code. In the above code, I had used two comments lines and each line has its own meaning.

If you have any queries in understanding the use of Input and Print statements, then either you can contact us through the chatbox or you can watch my youtube video for your reference.

This video is for the Input Statement.
This video is for Print and Comment Statement

It's a wrap. Thanks for Reading. Stay tuned with us for many more to come!!!

NOTE:- The awesome artwork used in this article was created by Clint Kadera

Get the latest episodes directly in your inbox