March 11, 2009

Python IF Statements

if variable == "hello":
print "your variable equalled: hello"
elif variable == "goodbye":
print "your variable equalled: goodbye"
else:
print "your variable equalled something else"
----------------------------------------------------

the "if" checks the variable to see whether or not its value is "hello".
if the value is "hello" then it prints "your variable equalled: hello"
the "elif" is basically another if statement.  elif your variable equalled goodbye then it prints "your variable equalled: goodbye"

February 18, 2009

Making Variables:


----------------------------------------------------------------------------------
>>>the = 1
>>>if the:
... print("hello")
...
hello

----------------------------------------------------------------------------------
i defined the variable "the" to equal 1
>>> the = 1
then i created an "if" statement
if the:
then i defined what would happen "if" "the" equaled 1
print("hello")



February 15, 2009

Basic python syntax:


print("text to print\n")
text to print

print  = the command
()    = the arguments for the command
" "       = input
\n       = new line