You are on page 1of 5

#python

print"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
print"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
print"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
print "PYTON TUTORIAL"
n = 5
print n
#l;aksdjfasdf
#hello brotha
print n ==5 == 5== n
print
print
print "learning about lists"
print"lists are similar to arrays."
print"lists can have any data type."
list1 = []
print list1
list1.append(5)
print list1
list1.append(4)
list1.append("t")
list1.append('r')
print list1
list1.insert(1,666)
print list1
print
print
print "learnign about tuples"
print"tuples are immutable, the shit inide them aint changing"
tuple1 = (5, "hello" , 3)
print tuple1
print tuple1[1]
print
print
print" learning about dictionaries"
dic1 = {1:"one", 2:"two", 3:"three"}
print dic1[1]
print
print
print "now for the if then for statemetns!!"
x = 4
y = 4
if x == y:
print "yes"

for x in [4,5,6,7]:
print x


print
print
print "range"
print range(3)
print
print
print "playing with functions"
def myFirstPythonFunction():
print "this function dont do shit!"

print"hello world????? wtf??????"


myFirstPythonFunction()
def funcWithArgs(n):
print n+n

funcWithArgs(3)
def orderDontMatter(a,b,c):
print a
print b
print c

print a + b + c

orderDontMatter(b = "it", a = "das", c = 'mane')
print
print
print
print "learning about classes"
class EthanFirstClass:

a = "hello"

def __init__(self, b):
self.plop = b

def functionOne(self):
print "this is the class variable:"
#these 2 do the same thing, but are sorta diferent
#the frst acceses the variable a when its a class variable (not an instance of that
class)
#the second acceses a when the a is variable of the instance of that class
print EthanFirstClass.a
print self.a

print
print"this is the instance variable"
print self.plop


instanceOfEthanClass = EthanFirstClass(666)
instanceOfEthanClass.functionOne()
print instanceOfEthanClass.plop
print EthanFirstClass(666).a
print EthanFirstClass.a
# this doesnt work print EthanFirstClass.plop
print EthanFirstClass(666).plop

You might also like