Hello World



Now is the time to get your hands dirty with some real Python Programming. Open the Jupyter Notebook by launching it from Anaconda Navigator you installed in previous articles.

Save the new Notebook with name HelloWorld so that when in future you revisit your codes you can identify it with the name of the file. While programming, always keep this in mind that you use descriptive file names to the notebook and always try to use descriptive entity name (variables, classes, functions, etc.)

hello World

You will find the code on GitHub. In this image, in Cell #In[1] a print method is used to print a string which is "hello World!" in this case. To run the current cell either hit the RUN button from the menu shown above or press SHIFT+ENTER combination. This will run the statement(s) in the cell and gives you the output and add a new cell for you to write more code.

hello World

After printing a static string using Python, let us try to have something dynamic. Static means hardcoding of something into the code and dynamic means usage of variables or object and their value can be invoked at runtime from other input mediums like keyboard, database or other input streams. In this code, I am hard coding the values of variables but this still can be treated as dynamic because we need to change the value at one place, we will learn about variables in subsequent articles.

In the above image, there is a variable with name "name" and to this, assigned a string value "Sudhir". In cell #In[2], to concatenate the string there is a "+" operator which concatenate the left string and right string as it is, you may see the output is "helloSudhir". In cell #In[3], to concatenate the string there is a "," operator which concatenate the left string and right string by adding a delimiter between them; it is "SPACE" in this case, you may see the output is "hello Sudhir".

Try a few examples in which you will print a few static strings and a few in which you will invoke a few dynamic values in the print statement. Next, we are going to learn about variables; what they are and how they work and why we should use them in our programs.