Written lessons for python 3.4 off buckys vids

+9 Isaiah Rahmany · August 30, 2014
Well guys it's gonna take a while to catch up but I finally got lesson 2 of his python 3.4 tutorials


# For those new to python, there are many simple operators you will
# need to learn. Now I assume that you know how to do addition and subtraction.
# For ex: 3+4 or 4-3, fairly easy right? Now when it comes to multiplication
# you use the asterisk key * and for division it's the forward slash /
# Now if you run this we will put it to the test.

print("4 + 16 = ", 4+16)
print("16 - 4 = ", 16-4)
print("2 * 2 = ", 2*2)
print("2 / 2 = ", 2/2)

# Also python does follow the order of operations so if I put 8 + 10 * 2
# you would think I would get 36 right? Well, no I wouldn't actually I would
# get 28 because what it's doing here is following PEMDAS as in:


# Also if you want to divide and take your answer and round it down to the
# Nearest whole number you simply type //  for example if I type 18//4 I get
# The number 4 as to where if I type 18/4 I get 4.5 see it rounds it down
# and to do a number to the power of something its simply 2 asterisks **

print("18 // 4 = ",18//4)
print("18 / 4 = ",18/4)
print("2 ** 2 = ",2**2)

# ALSO! I almost forgot modulus which I don't know what the hell it is but I
# Do know what it does it gives you the remainder of a division equation.
# The key for it is % or percentage sign... for example 8%3 would equal 2
# Because 8 / 3 has a remainder of 2

print("8 % 3 = ",8%3)

# Also we have variables like if you type: isaiah = 14 and then type
# print(isaiah) you will see the number 14

isaiah = 14

# That concludes lesson 2

lesson 3:

# Strings guys it's all about string's in this tutorial!
# So what are strings? Well it's the coding term for a line of text.
# That's right I know it sounds dumb but it is what it is...
# So how do I make a string? The same way you made a variable, but
# You need to add quotes for ex: me = "Isaiah Rahmany"
# now if I type: print(me), it will print my name! Cool, right?
# But you can use single quotes too but there's a problem and here's why.
# Those quotes define where to start and end the string so what if I wanted
# a quote inside my string like quote = "isaiah said,"This is awesome.""
# now well python will be like what the hell are you doing?
# So what I would do is this: quote = 'isaiah said,"Now it should work!"'
# notice that since I used single quotes to start insted it was looking for a
# single quote to end with so thats why I didn't get and error
# look:

quote = 'isaiah said,"it worked"'

# Also lets say I have to use singlequotes and double quotes inside the same
# string, so here's our string: quote = 'isaiah said,"that's what she said"'
# now as you can see in the word that's it would stop and the last word would
# be: that, so what you'll need to do is use something called an escape
# character which is the back slash \ so if you want it to continue reading the string
# You would type quote = 'isaiah said,"that\'s what she said"' and look Ill even print
# It so that when you run it you can see it worked.

quote = 'isaiah said,"that\'s what she said"'

# so backslash anything inside the string according to python means
# treat that as part of the string...

# also you have have noticed that i have been using a function called print()
# what this fuction does it print text on the screen as you can see it's what
# I used to print text on the screen when you run the program
# So how to use it is type print("text goes here") or you can print a string
# for ex: name = 'isaiah' print(isaiah)
# you can also print a variable, for ex:

a = 2+3

# also you can print a string and a number or number and a string like this
# ex:

name = ' isaiah rahmany '
age = 14
print(name, age)
print(age, name)

# Notice the comma normally to put together to strings you type: print(name + age)
# But since age is a variable you must join them with a comma why I don't know
# I know it's stupid but I don't make the rules they do...
# Also almost forgot if you want to move all the text after a certain point to
# A new line then type \n somewhere in your text and all text after that \n will
# Be moved to a new line

# Now bucky in his tutorial brings me to something I totaly never thought of
# So here it is, if I type print('C:\users\isaiah\desktop\newfolder')
# I am gonna get this :


# The reason you get C:\users\isaiah\desktop
# ewfolder is because it read \newfolder as \n ewfolder notice the \n it though
# I meant new line The way you fix this is simply type: print(r'C:\users\isaiah\desktop\newfolder')
# The r tells it to simply print the raw string

# And I covered this but I'll say it again if you add together strings with the + sign
# It combines the strings for ex:

firstname = 'isaiah '
lastname = 'rahmany'
print(firstname + lastname)

# Also to finish up you can multiply string's and what I mean by this is

print(30 * "*")

# What this would do is print an asterisk 30 times accross the same line

# so I hope you get the Idea I am sorry I am so slow on the tutorials I can't
# type so it takes a while :P but that's all for this tutorial

in part 5 you actually will get a unicode error I think but yea still to fix it make it a raw string...

lesson 4:

# Hello and welcome back guys today were going over more crap
# on strings I know sounds boring but trust me it's the fun
# stuff today we're gonna be slicing strings! Now you're
# probably like wtf is slicing strings Isaiah? Well
# Here's an example

ham = "I like ham"
print("the first char in the string ham is -> " + ham[0])

# and what I did there is I took the first character from ham and printed it
# now I know you're probably like what the hell? Why did he put zero? Well leme tell you why,
# when counting computers start from zero so the first char is 0 second is 1
# third is 2 etc. But how did I grab that first char? well you type the string name
# then [] and between those brackets the position of the char you want to take like 0 for pos 1.
# or I can do print(ham[0:10]) and this will print the first 11 characters in a sequence.


# now it goes left to right but what if I want right to left? No worries bud I got you
# covered simply do ham[-1] and so on to start from the right if you type ham[-1] it
# will always give you the last letter or number or whatever...
# also another function called len() will get you the length of a list or sting or tuple
# for ex:

print("The length of ham is -> ", len(ham))

# also spaces count as characters and again length gives you the number
# of characters in a string and for a list or tuple or dictionary, the number of items
# Thats all for this tutorial have a good one...

lesson 5:

# Today's tutorial is on lists and I am only gonna be
# referencing things from now on as little side notes
# Only because it's a bit hard to explain everything in depth

items1 = ['isaiah', 'rahmany']
print(items1[0] + " " + items1[1])

# what this does is make a list with 2 items the list name is called items
# and to print an item from the list you type print(items[0])
# where I put that zero is where you put the item number

items2 = [14, 'isaiah rahmany']

# this list has 2 different types of items so yes you can put integers and floats and doubles
# inside of lists as items alongside strings

print(len(items1 + items2))

# this prints the number of items total of those 2 lists combined


# Adds an item with value of 14 to items2 as you can see


items2[1]='Bucky Roberts'

# changes items2[1] to bucky roberts as you can see


# prints everything in items2


# deletes the 3rd or last item from the list items2

items2[:2] = [14, 'isaiah rahmany']

# changes items 1 and 2 so that 1 = 14 and 2 = 'isaiah rahmany'


# prints the first 2 items from the list

# sorry that I am no longer going in depth
# I am just going to sum up what we've learned
# in each tutorial to make things easier
# So yea, thank you for reading.
# Have a nice day!

and btw in lesson 5 if you did this to delete an Item off the list I got this when I did it idk about

items2 = [14, 'isaiah rahmany', 'age:']
items2[2] = []

so i fixed it by doing this:


Post a Reply


Oldest  Newest  Rating
+2 Maria Scuilli · August 30, 2014
This is very helpful, thank you!
+1 Isaiah Rahmany · August 30, 2014
Thank you !
+3 Jake Scaife · August 30, 2014
This is great! The bit about modulus made me laugh ;) I need to watch the python series but I can't seem to find the time.
+2 Kaveh Greenwood · September 1, 2014
Thank you so much for this. It is much appreciated.
+1 Wei Zeng · September 3, 2014
0 Barbie Banks · February 25, 2015
Great Summarization .... now can you tell me how to read in a Directory... I don't think a simple read statement will do or will it...
0 Abdullah Nauman · February 25, 2015
This is great!
0 SCOTT BUSINGE · March 3, 2015
so helpful!! thanks
  • 1



This section is all about snakes! Just kidding.

Bucky Roberts Administrator