• Our Minecraft servers are offline but we will keep this forum online for any community communication. Site permissions for posting could change at a later date but will remain online.

How to Pyhton - Episode One

Would you like to see more?


  • Total voters
    4
  • Poll closed .

Matt0808

Career
Joined
Apr 19, 2012
Messages
543
Reaction score
207
How to Python
Episode One

Downloading Python

The first thing you need to do in order to write your code is to download Python. You can download it HERE. I recommend you download 3.4.2:


Using Python
In order to write programs we need to open the Python IDLE. Just type search for Python and click the IDLE version. It should look something like this:


Traditionally, the first program you write when learning a new programming language is Hello World. A Hello World program is a program that outputs the words "Hello World" or whatever you would like it to output. So let's write it in Python now!

Hello World

Code:
print("Hello World")
First we will need to type in the print() function. This simply prints a 'string' or text to the user. The brackets or parenthesis in the print function contain what we want the user to see. These are called arguments. In this example our brackets contain the words Hello World surrounded by a pair of quotation marks. This tells Python that we are using a string (we will learn more about 'types' like string later on). Python allows us to choose what type of quotation marks we use. I like to use the double ones (" ") for my text but you could use the single ones (' ') if you would like.

If you managed to understand all that you should now be able to run your code (press
ENTER). This should print the words "Hello World". Congratulations! You just made your first program! Now try changing the text to something like Hello MCSG or I love MCSG.



I hope you enjoyed the tutorial, make sure you check out next weeks addition to the series in which we will learn how to ask the user for input!

Sneak peek:
 
Last edited:

Members online

No members online now.

Forum statistics

Threads
242,192
Messages
2,449,550
Members
523,971
Latest member
Atasci