Since this is my first time in python too, I want to convert my "Hello World!" program in C into Python and this is how it looks like:
#!/usr/bin/env python
# This is a comment in python
# Filename: hello.py
# Description: This program will display the very famous "Hello World!" in python
# Author: Obispo
print "Hello World!"
# The program ends here
I installed my python interpreter at my FreeBSD box and used the vi editor to write this code. I named the program "hello.py" and after saving it, I make it executable by changing the user permission of the file to executable. I used the command:
# chmod +x hello.py
Now that its executable, I got very excited to see the output. And so I run the program like this:
# ./hellopython.py
Hello World!
The "Hello World!" message did appear! Wow!
Digg
No comments:
Post a Comment