This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
number = random.randint(1, 100) # Here's the range of numbers the computer randomly chooses from | |
print number # this line is just so you can test/see the numbers the computer chooses from | |
# You likely want to comment this out once your whole program is running! | |
# GameRunning variable here | |
# Start your while loop here, Watch your indents below this loop! | |
guess = int(raw_input("Guess a number between 1-100: ")) # letting Python know this is an integer | |
if guess == number: # starting your condition statements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BASIC SNAKE GAME | |
import pygame | |
import time | |
import random | |
pygame.init() | |
black = (0, 0, 0) | |
white = (255, 255, 255) | |
red = (255, 0, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle | |
t = turtle.Turtle() | |
print("Give me a number") | |
number1 = raw_input() | |
print("Give me another number") | |
number2 = raw_input() | |
number1 = int(number1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random # importing the random module | |
number = random.randint(1, 100) # were are creating a variable to equal an array (or range) of numbers for the computer to choose from | |
GameRunning = True | |
while True: # make a loop | |
guess = # don't forget your indents | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BASIC SNAKE GAME | |
# python 2.7 | |
import pygame | |
import time | |
import random | |
pygame.init() | |
black = (0, 0, 0) | |
white = (255, 255, 255) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A simple program to demonstrate using a for loop | |
# To print hello world! five times in Python, you could type | |
# print('hello world!') five times, each on its own line | |
# Or, you could use a 'for loop' to have the same result with less typing: | |
for x in range (0, 5): | |
print('hello world!') | |
# The range function can create a list of numbers ranging from a starting number | |
# to the number just before the ending number. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
number = random.randint(1, 100) | |
print number | |
GameRunning = True | |
while True: | |
guess = int(raw_input("Guess a number between 1-100: ")) | |
if guess == number: | |
GameRunning = True | |
print("You guessed correctly!") | |
elif guess > number: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
number = random.randint(1, 100) | |
print number | |
GameRunning = True | |
while True: | |
guess = int(raw_input("Guess a number between 1-100: ")) | |
if guess == number: | |
GameRunning = True | |
print("You guessed correctly!") | |
elif guess > number: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Choose your own adventure game | |
# WIZARD MOUNTAIN | |
# a text-based choose your own adventure game | |
# This adventure is like an upside down tree with branches | |
# this program is full of blocks of code, known as branches, or code branches | |
# Make sure to visit every branch to make sure all of the code works | |
def parachute_fail(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/local/bin/bash | |
apt-get --assume-yes install matplotlib | |
apt-get --assume-yes install idle | |
apt-get --assume-yes install git | |
apt-get --assume-yes install python-setuptools | |
apt-get --assume-yes install python-dev | |
apt-get --assume-yes install build-essential | |
easy_install pip | |
apt-get --assume-yes install git-cola |