Support Forums

Full Version: Python Tutorial For Begginers
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This tutorial is directed to people learning python, and that already have python installed on their computer and know how to execute a script. If you don't, download python from python.org. If you are on Linux or mac, you should already have python and to execute the script you made in text edit and saved as a .py, go into terminal and type
Code:
python scriptname.py

The Print Command:
This simple but useful function displays text on the screen
Code:
print "Hello there"
This will display:
Quote:Hello there

Variables:
Used to store information, variables can be very helpful
Code:
a = "hello"
a now equals "hello", so when you
Code:
print a
You will see
Quote:hello

raw_input:
This function is used to take input from the user of your program
Code:
raw_input("Type Something: ")
This will display
Quote:Type Something:
This function isn't very useful without it meaning something, so to do this we will allow a variable to store the information the user inputs
Code:
x = raw_input("Type Something: ")
This will display
Quote:Type Something:
This may look the same, however, adding the "x =" makes whatever the user types equal to x

Your first python script:
putting everything you just learned together we will make our first script
Code:
x = raw_input("Type Something: ")
print x
The most simple, but best python tutorial I've seen here Smile.
Nice work.
Your a quick learner with Python Smile