Skip to content

Instantly share code, notes, and snippets.

sahilsinha

Block or report user

Report or block sahilsinha

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Lesson1.org

Cheat Sheet

Variables

Variables are just boxes that you can put other things into. You can put numbers, words, other variables, and any value you can think of inside a variable. A variable is a box for stuff!

Today we will be working only with strings and ints.

View race.py
import turtle
import random
def main():
turtle1 = turtle.Turtle()
turtle2 = turtle.Turtle()
turtle3 = turtle.Turtle()
turtle4 = turtle.Turtle()
turtle1_distance = random.randrange(100)
View turtletricks.py
import turtle
def get_user_input():
userInput = raw_input("What trick do you want to do?")
try:
userInput = str(userInput)
except:
print "That's not a trick!"
View polygon.py
import turtle
def get_user_input():
userInput = raw_input("How many sides does your shape have?")
try:
userInput = int(userInput)
except:
print "Hey that's not a number!"
View fizzbuzz.py
import turtle
def drawPolygon (the_turtle,num_side):
angle = 360 / num_side
for iter in range (num_side):
are_we_fizz = iter + 1
print are_we_fizz
if are_we_fizz % 3 == 0 and are_we_fizz % 5 == 0:
the_turtle.color('blue')
View pythonturtle2.org

https://goo.gl/ulOqGU

Key Concepts

Sequence

Decision

Repetition

Objects

Methods

Attributes

Variable

functions + arguments

View pythonturtle.org

Intro

Programming is my favorite thing

Who has programmed before?

Computers do exactly what you tell them to do if you can program you can do almost anything

Syntax matters - computers are very particular about how they understand things

You can’t perform that action at this time.