|

Print Function | Python Tutorial in Sinhala Learn Basic of Python Programming #2 Video

Watch the video before you read this.

Let`s talk about Print Function.

Before you start that you need to open Python Shell. Now I`m open Python Shell now.

What is Python Shell? Python shell means If we type 2 inputs at once, we can get the output immediately.

But what we are going to do today cannot be done at all once in the shell. Let’s open a new file. So then you can see there’s nothing to see. Now let’s type python codes in this window.

Today we are going to learn about  How do we use print ?  You need to type this one on your python software.

print ("Hello world")

I`m typed print “Hello world ” and I’m going to run this. First we need to save this where we can save. We must select the location. After that put  <your file name here>.py at the last one that was typed. .py mean is python file extension.

answer

Hello World

Now you can see the answer in Python Shell. Okay I will type 2 more lines in Python

print ("Hello world")
print ("Hello world")
print ("Hello world")

So then I run this 

Hello World
Hello World
Hello World

You can see that the shell says ” Hello world ” three times. This means that the print function works in a horizontal manner.

Okay, Why use quotes for this example, because this “Hello World” word is a string If you type strings definitely you need put single quotes or double quotes. Now I will give you a bonus tip in the print function. Ok, let`s go to that thing.

print("Hello World"*2)

answer

Hello WorldHello World

Now you can see the answer. If you want to print your answer twice, you can easily do it using the method I suggested.

So that`s all We talked about in this video I hope you will learn anything from this video.

Subscribe My Channel for watch More Educational Contents.

Thank You.

Similar Posts

Leave a Reply

Your email address will not be published.