royal_python_snake_w520

Getting started with Python

on February 26 | in Homeschooling, Technology | by | with No Comments

Python is a programming language. It is not the latest or easiest and it is a lot harder than Scratch. But what makes it good is how powerful it is. The only place that it lacks in is controlling things via USB ports, but other than that it is one of the most powerful languages ever made. The only other coding methods that surpass it are very hard to learn, and very complicated.

An example of Python program is this:

print (‘Hello world!’)

What do you think that will do? It will print on the screen: Hello world! But why without the quote marks?  The speach marks tell it that it should print from after the first to before the last quote marks. This is Python’s “hello world” program. The “hello world” program can be done in almost any code language, and is the traditional way to start a new language.

Another type of simple code is a variable. Here is an example of one:

A = 25

So what can we do with A? We can change its value:

A = 1

Or we can add another variable to it and print the result:

B = 1243
C = A+B
print(C)

You may have noticed that some text is coloured. This is because in Python different colours represent different things; Some are yellow, some are purple, and some are green. Green is for strings (sets of letters) purple and yellow are for keywords. Black text is for other stuff. The other thing that you may have noticed is that you don’t use speach marks when printing variables. The reason is, this is the difference between strings and numbers/variables. For example, if we used speach marks around C when we were printing it, it would print the letter C.

Python is free to download, but to use it you download IDLE; Python and quite a few other languages work there. To create a program that you can save, Click on File, Select New Window, and type in the code you want to use. To run it, click File > Save, then Run > Run Module and it should run fine. If it does not, check your code on the highlighted line.

Pin It

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

« »

Scroll to top