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
# This program shows the difference between a strings and lists | |
# with a quick introduction to using functions with a list | |
# This is my typical grocery list stored as one single STRING | |
grocery_list_for_Joe = ['eggs, milk, dandruff shampoo, holy grail, 2 african swallows, coconut'] | |
#print(grocery_list_for_Joe) | |
# Below is my grocery list created as a LIST instead of a STRING: | |
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 program to make your own grocery list | |
# What happens: python asks for a few items and their prices to be put into a grocery list | |
# this program shows functions, comments, varaiables, user input and FLOAT | |
print("give me a food product you want in your grocery list") | |
food = raw_input() | |
#foodp = int(input('enter food foodp = int(input('enter food pric: ')) | |
#print("what is the price of that food?") | |
#food_price = raw_input() |
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
# If and Elif Statements | |
print("You are a tree.") | |
print("Tree, what is your name?") | |
tree_name = input() | |
print(tree_name + ", how old are you?") | |
tree_age = float(input()) | |
if tree_age > 112: | |
print(tree_name + ", you are an old tree!") | |
elif tree_age < 112: | |
print(tree_name + ", do some more growing!") |
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
for i in range(4): | |
t.forward(100) # notice the indentation | |
t.left(90) | |
# VERSUS | |
for i in range(4): | |
t.forward(100) # notice the lack of indentation here | |
t.left(90) |
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
# coding: utf-8 | |
print("type command: hello") | |
COMMAND1 = "hello" | |
def handle_command(command): | |
""" | |
Determine if the command is valid. If so, take action and return | |
a response, if neccessary. | |
""" | |
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
# coding: utf-8 | |
# A simple command-respond program | |
# Python asks for input then carries out the specified action base don the condtions of the input | |
#COMMAND1 = "hello" | |
#def handle_command(command): | |
# response = "" |
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 crude program to show examples of a tuple | |
# and relate to lists and strings | |
# a tuple is similar to a list, but uses parentheses | |
fibs = (0, 1, 1, 2, 3) | |
print(fibs[3]) | |
# Above, we define the variable fibs as the numbers 0, 1, 1, 2, and 3. | |
# Just like a list, we print the item in the index position 3 in the tuple. |
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
# SiliconValleyOfTheSouth | |
# Original Program by Wray at Tech Em Studios | |
# Put your commands here | |
# Keep the values lowercase | |
COMMAND1 = "what?" | |
# Your handling code goes in this function | |
def handle_command(command): | |
""" |
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 |
OlderNewer