Intro to python

Hello everyone! I thought why not give people a simple introduction to python coding, because personally I know I have had a hard time finding an easy to understand tutorial in the past. So by doing this I hope to ease the pressure from some of you who might have been in the same situation.

 

In this article, I will cover:

  • hello world program

Now let's start, shall we?

Hello world!

Open your text editor which will probably be gedit for Ubuntu

type

print("Hello World!")

 

save the file as "hello_world.py" and remember where you saved it

now open the terminal and change to the directory where you saved the file
for me it's going to be

cd tutorials/

now type

python hello_world.py

and this is what you should get

So what does all this code mean?

Our code has three parts:

  1. print
  2. ()
  3. "Hello World!"

1: "print" tells python that whatever is up next, is to be printed on the screen

2: the parentheses can be regarded as a container for the content to be printed (They are not needed in the 2.x Python versions)

3: this is the text to be printed, the quotes around it indicate that this is a string

 

This is it for now. If you're into computers please consider checking out myelectrons.com and bye bye!

 

Leave a Reply

Your email address will not be published.