After successful installation of Python software now it's the time to write us first Hello World program.
In this Hello World program, we will simply print Hello World message on the console and some few direct arithmetics manipulation on the console.
Please find the below steps to write Hello World program in Python,
Step 1
Open your notepad editor and write the following single line of code,
Note Point
Step 3
Now just type python hello-world.py, you will see the message Hello World on the console.
In this Hello World program, we will simply print Hello World message on the console and some few direct arithmetics manipulation on the console.
Please find the below steps to write Hello World program in Python,
Step 1
Open your notepad editor and write the following single line of code,
print("Hello World")
or
print('Hello World')
Note Point
- The difference between the above two lines of code is in the first line of code we have used double quotes ("") to represent the string Hello World and in the second line of code we have used single quotes ('') to represent the string Hello World.
- print() is the built-in methods available in Python to display the messages on the console.
Step 2:
After writing above any one line of code in your notepad, save the file with hello-world .py and don't forget to place hello-world.py inside the double quotes i.e "hello-world.py" as shown below,
Note Point
- .py is the extension for the files having Python code.
Step 3:
Open the command prompt from your file location where you have saved your hello-world.py.
You can open the command prompt just by typing cmd on your address bar,
Or
Or you can open the command prompt by doing Shift + Right Click and then click on Open PowerShell window here,
Step 3
Now just type python hello-world.py, you will see the message Hello World on the console.
No comments:
Post a Comment