Argument:The part of a statement that Python will operate on.For example,in a print statement,the text that will actually be printed to the screen is the argument.
Example---->print "hello world!"The "hello world" text statement is the argument that Python will operate on.
Comment:A comment is a specially marked element(looks like this #) in a program that is ignored by Python.Comments are useful for explaining what you're trying to accomplish.
Compiled Language:In compiled languages,the code is translated completely into a machine-readable format before it runs.In general,compiled languages are faster-running programs,but interpreted languages can be more flexible.
Console:A text based interface.You can interact with Python at DOS or UNIX shells in a console mode.
Docstring:A unique text value that happens at the beginning of a Python program.Docstrings are used to create the automatic documentation for the program,and they are usually multi-line string.
Example---> """spaceGame2.py project inception: 2/2/2014
Game Programmer:Jason Woodstock"""
IDLE(Interactive Development Environment):A simple-but-potent text editor and Python environment that comes with most versions of Python.
Interactive Mode:A special way of interacting with the Python environment.When you use interactive mode,you type the commands directly into Python rather than storing them in a text file.Interactive mode is useful for quick code checks and accessing the online help system.
Interpreted Language:An interpreted language(such as Python) is one translated from a human-like dialect into machine-readable code in real time.Programs written in an interpreted language cannot run unless the user also has the interpreted program installed on the same system.Interpreted languages can be slow,but the programmer can interact with with them in real time.The alternative to an interpreted language is a compiled language(such as C+).
Method:Something an object knows how to do.For example,Python's built-in string object has a method to convert to lowercase(string.lower()).
Object Oriented Programming:A form of programming that allows the programmer to organize code in objects much like those in the real world.Most built-in Python elements(variables,lists,etc) are objects.
Pygame:A module that adds game-programming functionality to Python.
Python:An interpreted language designed to be powerful yet simple for beginners.
SDL(Simple DirectMedia Layer):A reasonably universal graphics package.
Slicing:Using the square braces() operators to pull a subset of a string or list.
Statement:A command or line of code in a programming language.
String:A variable containing text.
String Interpolation:A technique for embedding(or enclose firmly) variables into a string for easy formatting.
Syntax:A programming language's rules of grammar and punctuation.
Tuple:Values inside parentheses,separated by commas.The elements can't be changed.
Variable:A variable is a reference to a specific place in a computer's memory meant to store information.Each variable has a name and value.
Data Type:What kind of data a variable contains.Even though Python automatically assigns a data type to every item of data,the programmer has to know what type a variable is because each type has different methods associated with it.
Debugger:A special program that allows you to view your program one line at a time and watch what it's doing.IDLE has a debugger built in.
Dynamically Typed Language:A programming language that allocates data types automatically as the programmer assigns values to variables.Python is dynamically typed.
Float:A floating-point real number.
For Loop:A programming structure that repeats code once for each element of a list.Use the range() function to make the code repeat a certain number of times.
Example---> for i in range(2):
print"I love woodstock production!"
I love woodstock production!
I love woodstock production!
I used the range(2) function to make a list with two elements and repeat the line "I love woodstock production!" two times in a row using the for loop to step through the (two elements) list.So the line is repeated once for every element in the list.
Integer:A number without a decimal part.
List:A variable containing multiple values.
Operator Overloading:A mathematical operator sometimes does different things on different data types.For example,an operator will concatenate(combine) string data with the plus sign(+),but it will add integers and real numbers with a plus sign(+) as well.
Example(string data)---> print "Jason" + "Woodstock"
Example(integers)---->print 1 + 2
Real Number:A number that can include decimal values.Real numbers can be referred to as floats.
String Concatenation:Combining two strings to make a larger string.This can be done with the plus sign(+).
Boolean Variable:A variable containing either True or False.Boolean variables are often used to make main loops easier to follow.
Condition:An expression that can be evaluated to True or False.Can be compared to a Boolean value or something else that Python can interpret as a Boolean value.
Encapsulation:The concept that functions can be used to conceal(hide) details from the main program,making the program easier to read and maintain.
Equality Operator:Checks to see whether two values are equal.Use the double equals sign(==)to see whether two values are equal to each other.
Example--->lastName=raw_input("what is your last name?")
if lastName == "woodstock":
print"Hi jason woodstock!"
what is your last name?woodstock
Hi jason woodstock!
This example asks the user a question on what is their last name.I used an if statement to indicate a condition(if lastName == "woodstock").Whatever the user types to respond to the question,that value will equal the lastName variable. If the user types in woodstock as a response to the question on what their last name is,then the lastName variable will equal woodstock and the user receives a greeting(Hi jason woodstock!)
Function:A subprogram that works by itself to solve a specific problem.
Global Scope:A variable declared outside any function.The variable's value can be read from any function.
Local Scope:A variable created inside a function is considered local to that function.The variable has a value only as long as the function is running.
Main Loop:Most programs have a primary loop that controls how long the program runs.This loop is usually some form of a while loop.Main loops often have a plethora(many)of exit points,so they are best controlled by a Boolean sentry variable.
Parameters:When you define a function,you can indicate a number of variable names inside the parentheses behind the function's name.These variables become local variables when the function is called.When you call a function that has parameters,you must supply a value for every parameter.
Self-Documenting Code:Code designed to be as easy to read as possible.You can make your code self-documenting by choosing your variable names carefully and making your code as straightforward as possible.
Sentry Variable:A variable which controls access to a loop.Sentry variables must be properly initialized,must be part of of the condition,and must be changed inside the body of the loop.
Shortcut Evaluation:If you have a prolific amount of conditions chained together with a series of elif statements,Python exits the chain as soon as it finds the first True condition.This means the order in which you place the conditions can be very important.
Example----> firstName=raw_input("what is your name?")
if firstName == "Jason":
print"Hey Jason Woodstock!"
elif firstName == "Mark":
print "Hello Mark.Where's Jason?"
what is your name?Jason
Hey Jason Woodstock!
I made python asks the user for its name using the raw_input() function and then setup two conditions.If the user types in Jason as their response,then the user gets "Hey Jason Woodstock!".If the user types in Mark,then the user gets "Hello Mark.Where's Jason?". The user then types in Jason as their name and python greets the user with "Hey Jason Woodstock!",but ignores the other condition that I set up if the user types in Mark.Python exits the program as soon as the first condition's value is True and this is known as shortcut evaluation.
Variable Interpolation:A technique for putting many kinds of data into a string,which allows automatic conversion and formatting.
Variable Scope:The notion that variables only have value within some block of code.