Writing the First Python Program
In this tutorial, you will learn how to write the first simple and famous program in Python which call “Hello World”.
- First you need to launch the NetBeans IDE. Then you can create a Python project inside NetBeans IDE which calls “HelloWorld”
- Second enter the following line of code into the file helloworld.py
print("Hello World")
- Third Click “Run” button on the toolbar or press keyboard F8. You will see in the output window displays the following message:
Hello World
Congratulation! You’ve written the first program in Python. Basically you use a built-in function called print to print a message on screen. You see that it is so simple and clear to program in Python.
After learning function in Python, you will see another version of “Hello World” program as follows:
def main():
print("Hello World")
main()
- First you defined a function (you’ll learn it in later tutorial) which called main by using keyword def and followed by function name.
- Second you call print function to print message inside function main
- Third you call function main to print the message.
You've learn how to write the first program in Python. In the next tutorials, you will learn Python language and programming techniques in more details.