Hello! This is our second part of our series. In the previous part, we had installed python on your system. In this part, we are going to write our first Python program in a simple and fun way.
So before we write our first program, let me introduce Python IDLE (Integrated Development and Learning Environment) to you. It is the software where we write and run our python code. It's like a playground, if anyone wants to play games he goes to the playground to play. Like that we use python IDLE to write and execute and run our code.
Before we begin you also need to install a python IDLE on your system, which I have taught in the previous part, if you haven’t read it go and read it first.
So to write our first program in python we are going to open the idle first. So to open your
Python idle on Windows, go to search and type for python and you will see a python logo,
just click on that, and idle will launch.
If you have a Mac you can search on the spotlight for python idle and launch it.
If you are on Linux you have to open the terminal and run
command python or install idle by your package manager.
Now to write our first Python
program you have to type
python print(“Hello World!”)
and just press enter. Yeah! Voila! We wrote our first python program!
Now we wrote our first program, now let's understand what we did. So first we called up a function called print(). You can suppose function like a vending machine for now which takes something in and gives us something.
Now we gave a string to the function. Now the string is very simple, you can suppose it like a box, with many items. In the book language is the combination of characters, but forgot book stuff for now.
And at last, we got the sentence "Hello World", this means our program has run successfully.
Now a quick quize for you. Write a python program to write your name to console. Solution will be in next article.
If you were not able to understand something, don't worry about that, I am going to teach everything like I am explaining to a 5-year boy. You can comment to me also to ask something or to discuss something. That's it, thank you for reading this article.