T
thiefmn6092
Guest
Yes I copied & Pasted from my tutorials on mopar. I'll be adding more soon
[Updates]
[Added Lesson 2]- July 10, 2006
[size=28pt]Starting Out In Python By Thiefmn6092[/size]
Python is an easy language and uses OO ( Object Orientation ), It can be integrated with other languages allowing the speed C/C++ offers and usefullness of Java. Python is usable on 99.9% of all Operating Systems and 99.9% of all programs written in Python can be used on other operating systems. It is an open source project and is completely free and users are permitted to sell Python and anything that goes with the license, Visit www.Python.org for more information.
[size=16pt]Installing Python[/size]
Go to www.Python.org/download ( Make sure to get the current version ) and select the version that suits your Operating System. Download & Install it, Once that is done open the directory you installed Python to and look for "IDLE (Python GUI)" Open it up and you should see a screen similiar to
( for the next part you can use interactive which is the window your on, or go to file-->New window and when you want to run somthing from script mode go to Run-->Run Module and it will run it through IDLE )
[size=16pt]Chapter 1 - The Print Statement[/size]
[size=10pt]{Starting Out} Jargon( Programmer Talk ) Vocabulary[/size]
Statement - A instruction, Does somthing
Expression - A somthing, Has a value
Variable - A "Thing" that can information stored in it
Commenting - Comments text, Use "#" then text afterwards IE. #Hello
Uses the statement "print" which will tell the computer to output the following expression "Hello World", After inserting the following code follow the instructions on Running from the script mode above and if your using IDLE, You will have noticed the expression was displayed to the output box. Congratulations you have written your first program! your technically a programmer now but your a clueless one.
Programmer Joke
Whats your statement of sending expressions to chicks?
[/end programmer joke]
If you wanted to display a larger area of text, use
[size=16pt]Chapter 2 - Tabbing and starting a Newline[/size]
Would display:
Mrs Silabsoft is hawt
The Newline feature comes in alot of use as so
would come out like:
Hello
Omfg
[size=16pt]Chapter 3 - Using raw_input()[/size]
Will ask the user to enter a piece of text, which will be stored into "Myvar"
Now i'm assuming you want to print whatever was typed?
Will display whatever was stored into "Myvar"
Mathematical Operators:
* = Multiplication
/ = Division
+ = Addition
- = Substraction
[size=25pt]Lesson 2 - Advancing in Python[/size]
[size=10pt]{Advancing in Python} Jargon( Programmer Talk ) Vocabulary[/size]
String - A mixture of numbers & letters
Integer - A number
[size=16pt]Chapter 4 - Using string methods[/size]
There are several "things" you can do to a string, Like capitalize etc..
for example
would appear as THIEF etc, You can use the above methods to change a string into almost anything.
You can also convert strings to integers, By using raw_input() and return the refrenced
str() and float() can be used instead of int() as well.
[size=16pt]Chapter 5 - Loops and using the "random" module[/size]
Randoms can help in many things from computer generated movements in a advanced game to a simple slots like game, When you want to use "additional" code, you can use the statement
which will allow the use of code inside the module, for example what were going to do is generate random numbers
On the first line we use the import statement to import the module, Then we declare the variable(s) Slot1 & Slot2 are equal to a random number from 0-6, Then we print the results of Slot1 and Slot2. Your wondering why it starts with 0 while most programming languages start with 0 and not 1, But there is a way to have it start at 1 instead using the following code
You can replace your randranges with that to have it start at 1 and go to 6.
When you call "code" from a module, you must include the module name "random" to tell Python were to find your function, It works the same way with every module. Now on to while loops
Defines the variable "counter" and assigns a value of "1", It then basically says as long as counter = "1", do the following code. Not that hard aye
You can also use "not" like the following:
Try putting that into the IDE and tell me what happens.
I will be adding more but I have other things to do right now, goodluck!
[Updates]
[Added Lesson 2]- July 10, 2006
[size=28pt]Starting Out In Python By Thiefmn6092[/size]
Python is an easy language and uses OO ( Object Orientation ), It can be integrated with other languages allowing the speed C/C++ offers and usefullness of Java. Python is usable on 99.9% of all Operating Systems and 99.9% of all programs written in Python can be used on other operating systems. It is an open source project and is completely free and users are permitted to sell Python and anything that goes with the license, Visit www.Python.org for more information.
[size=16pt]Installing Python[/size]
Go to www.Python.org/download ( Make sure to get the current version ) and select the version that suits your Operating System. Download & Install it, Once that is done open the directory you installed Python to and look for "IDLE (Python GUI)" Open it up and you should see a screen similiar to
( for the next part you can use interactive which is the window your on, or go to file-->New window and when you want to run somthing from script mode go to Run-->Run Module and it will run it through IDLE )
[size=16pt]Chapter 1 - The Print Statement[/size]
[size=10pt]{Starting Out} Jargon( Programmer Talk ) Vocabulary[/size]
Statement - A instruction, Does somthing
Expression - A somthing, Has a value
Variable - A "Thing" that can information stored in it
Commenting - Comments text, Use "#" then text afterwards IE. #Hello
Code:
print "Hello World"
Uses the statement "print" which will tell the computer to output the following expression "Hello World", After inserting the following code follow the instructions on Running from the script mode above and if your using IDLE, You will have noticed the expression was displayed to the output box. Congratulations you have written your first program! your technically a programmer now but your a clueless one.
Programmer Joke
Whats your statement of sending expressions to chicks?
[/end programmer joke]
If you wanted to display a larger area of text, use
Code:
print
"""
IM SUCH A NOOB OMFG
MY NAME IS PWNED
"""
[size=16pt]Chapter 2 - Tabbing and starting a Newline[/size]
Code:
print " Mrs Silabsoft is hawt
Would display:
Mrs Silabsoft is hawt
The Newline feature comes in alot of use as so
Code:
print "Hello
"
print "Omfg"
would come out like:
Hello
Omfg
[size=16pt]Chapter 3 - Using raw_input()[/size]
Code:
Myvar = raw_input("Text: ")
Will ask the user to enter a piece of text, which will be stored into "Myvar"
Now i'm assuming you want to print whatever was typed?
Code:
Myvar = raw_input("Text: ")
print (Myvar)
Will display whatever was stored into "Myvar"
Mathematical Operators:
* = Multiplication
/ = Division
+ = Addition
- = Substraction
[size=25pt]Lesson 2 - Advancing in Python[/size]
[size=10pt]{Advancing in Python} Jargon( Programmer Talk ) Vocabulary[/size]
String - A mixture of numbers & letters
Integer - A number
[size=16pt]Chapter 4 - Using string methods[/size]
There are several "things" you can do to a string, Like capitalize etc..
Code:
upper() - Returns the string in uppercase
lower() - Returns the string in lowercase
swapcase() - Returns all uppercase in lowercase and all lowercase in uppercase
title() - Returns the first letter of each word is capitalized
strip() - Returns a string with no spaces, tabs and newlines
for example
Code:
MyName = "Thief"
print MyName.upper()
would appear as THIEF etc, You can use the above methods to change a string into almost anything.
You can also convert strings to integers, By using raw_input() and return the refrenced
Code:
Bleh = int(raw_input("Enter a random group of #'s and letters))
str() and float() can be used instead of int() as well.
[size=16pt]Chapter 5 - Loops and using the "random" module[/size]
Randoms can help in many things from computer generated movements in a advanced game to a simple slots like game, When you want to use "additional" code, you can use the statement
Code:
import
which will allow the use of code inside the module, for example what were going to do is generate random numbers
Code:
import random
Slot1 = random.randrange(6)
Slot2 = random.randrange(6)
print (Slot1)
print (Slot2)
On the first line we use the import statement to import the module, Then we declare the variable(s) Slot1 & Slot2 are equal to a random number from 0-6, Then we print the results of Slot1 and Slot2. Your wondering why it starts with 0 while most programming languages start with 0 and not 1, But there is a way to have it start at 1 instead using the following code
Code:
random.randrange(6) + 1
You can replace your randranges with that to have it start at 1 and go to 6.
Code:
random.randrange()
When you call "code" from a module, you must include the module name "random" to tell Python were to find your function, It works the same way with every module. Now on to while loops
Code:
counter = "1"
while counter == "1":
print "Hello"
Defines the variable "counter" and assigns a value of "1", It then basically says as long as counter = "1", do the following code. Not that hard aye
You can also use "not" like the following:
Code:
while not counter == "1":
print "Hello"
Try putting that into the IDE and tell me what happens.
I will be adding more but I have other things to do right now, goodluck!


