Hello World Program in Python




What is Python?

Python is a very powerful programming language and can be used to write any piece of software. But you can also use it to do data science. Model your sales data, to text mining on your latest Twitter feeds, or build the next movie recommendation engine. It's all possible with Python. Python is open source, and there's a bunch of programmers across the world that have written amazing extensions to Python, to help you achieve great things.
Python can be used in the cases where the legacy analytical tools fail.

Before we start to learn the python program following is a list of some commands which can we will be mostly using while working with python:


For Linux / Mac

  • pwd: prints present working directory (folder) of the terminal
  • cd: It is used to change the directory (folder) from the terminal
    • cd... : used to go one directory back
    • cd<directory name >: used to go to child directory from the parent directory
  • ls: to print all the folders in the current folder
  • mkdir: to create a folder in the current directory

Terminal commands for windows

  • cd: prints present working directory (folder) of the terminal
  • cd: It is used to change the directory (folder) from the terminal
    • cd... : used to go one directory back
    • cd<directory name >: used to go to child directory from the parent directory
  • Is: to print all the folders in the current folder
  • dir: to create a folder in the current directory

Python Commands

  • To run a python file:
    • Go to terminal and navigate to the directory
    • Run python filename.py
  • To run jupyter notebook
    • Go to terminal and navigate to the directory
    • Run jupyter notebook
  • To install a package
    • Go to terminal and run
    • Pip install package-name OR
    • Conda install –c channel-name package-name

Writing a Hello World Program in Python


Hello World program in python so simple that it takes just one line of code to run this program using the commands explained above:

print("Hello World") 

Yes, that's it this is how a simple hello world program in python looks like.
the "print" is a function (For now consider. a function as a helper which helps you to accomplish some task without writing any code) which helps us to print anything on the screen, in our code, we are print "Hello World"


Now, to run this code go to the directory where you have saved the file (check the commands above)
and type 
python <your file name>

You will see Hello World on the terminal screen.

If you still have any doubt watch this video:

Thanks for learning with me and subscribe to learn more :

Youtube channel: The Data Singh

Comments

Popular posts from this blog

Spidering the web with Python

Word Vectorization

Machine Learning -Solution or Problem