Innings2
Powered by Innings 2

Glossary

Select one of the keywords on the left…

Learn Python > First steps

First steps

Welcome back. Today we will start with Python coding. To make it easier, we will provide a python interpreter(something which understands the python language). So you can type the python code in the browser itself.

There is one difference in this python interpreter and the regular python interpreter. Here, you need to hit "enter" key twice to get the answer. This is just to make things easier for us.

Make sure you type all commands mentioned below in the terminal above.

As I explained earlier, you can tell the computer what to do in it's language. So, the first thing we will ask the computer to do is ask it to print something. And how do you do that, we do that by using the print() function.

So, what is print()?

print() is like telling the computer,"Hey computer, take whatever I put in between ( and ) and display it". Instead of typing the full English sentence everytime and since the computer does not know English, we use print() in python language. Let's try it out.

print(4)

What do you think it will output? Try it above, type print(4) at the prompt and hit "enter" key twice and write the answer. .

Now try:

print(987)

Try: print(54)

Now,let's try something else.

print("Hello World")

Did you see. I used " and ". This is another rule in the python language. When you use numbers 4, 987, 54 etc we don't need to use "". But if we are working with words and sentences then we need to use " ". When we use " ", they are called as strings.

What do you think will happen if I say print("987")?

Ok. Good. This is all great. But the computer is not doing anything useful. It is just displaying what we give it. Let's try something more useful.

print(4+5)

Wow! The computer did the addition and gave the answer for you.

Now try print(45675456+98373747)