#4 - Hello World - Our first program using print function

Print Function - Hello World




Now, we have reached the excitement point when we will write our first program using the print function to output a text on the console. But first, let's understand what is a function.


What is a function?

In the easiest way, the function is a work that is to be performed on the data that is given inside the parenthesis that is in front of the keyword. Confused? Let's write a Hello World program to make you understand everything. We can also make our own custom functions which are called User-Defined Functions.

Writing the code

First, let's write and run the whole code and then understand everything. Open your VS Code and a python file to start writing code. If you don't know how to do it then it means surely you don't have read our post on how to setup VS Code and open a python file in it. Please click HERE to read it.
Now, simply write print("Hello world!") and search for the run button (   ) and click it. You will find a console appearing and Hello world as an output will be texted there. You can write any custom text inside the quotes but we continued the old coding tradition to print Hello world only.

Understanding the code

Keyword - The literal text that is written for using a function. Mostly the keywords are the same as the name and use of a function in python like here print is the keyword for the print function.

Parenthesis - A function is always followed by parenthesis where we give the data on which the function is to be performed. Here the custom text that we give is the data. Some functions don't need any data so in such a case the parenthesis is left empty.

Quotation mark - They are always used for making a string. If you don't give the text in quotations then the compiler will take the text as a variable name.

What next?

After writing our first program, we will be moving to learn variables.

Variables

You are here means surely you are a programmer and of course, a programmer's biggest motivation is 

Developer swags

And so here we have brought the best platform ever to buy Coding-related stuff at the best prices.

Click here to go

 





Comments

  1. Woow!!!!! great to listen that in python its just one line of function and not like other languages that so many lines of class setup etc is needed.👍 👍 👍 👍

    ReplyDelete

Post a Comment

Popular posts from this blog

Comments

#1- Let's Learn Python In the least possible time

#9 - String Concatenation