Skip to content

Instantly share code, notes, and snippets.

@dmnchild
Last active November 22, 2015 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmnchild/eb1393b4c957bdcf31aa to your computer and use it in GitHub Desktop.
Save dmnchild/eb1393b4c957bdcf31aa to your computer and use it in GitHub Desktop.
LPTHW All my .py files.
print "Wankers.."
print "No, really."
print "Whatever is clever."
print "Blah blah blah blah."
print "I dont want to type anymore."
# Commented out blah blah blah
# More code with blah blah
print "This is something stupid." # Yes, yes it is.
print "This is another stupid line." # yeah, this one is too.
# Yes I understand commenting out.
print "Blah blah blah blah." # Yep
# print the statement
print "I will now count my chickens:"
# Print the statement and then adds the sum of the forumla after
print "Hens", 25 + 30 / 6
print "Roosters", 100 - 25 * 3 % 4
# Another print statement
print "Now I will count the eggs:"
# Will output the total of the math problem.
print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6
# Ask the question.
print "Is it true that 3 + 2 < 5 - 7?"
# Do the problem. With the > < >= etc it will generate true or false statements.
print 3 + 2 < 5 - 7
# Do the math (with a print first)
print "What is 3 + 2?", 3 + 2
print "What is 5 - 7?", 5 - 7
print "Oh, that is why it is false."
print "How about some more."
# Just some other examples of true false statements.
print "Is it greater?", 5 > -2
print "Is it greater or equal?", 5 >= -2
print "Is it less or equal?", 5 <= -2
cars = 100
space_in_a_car = 4
drivers = 30
passengers = 90
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_capacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven
print "There are", cars, "cars available."
print "There are only", drivers, "drivers available."
print "There will be", cars_not_driven, "empty cars today."
print "We can transport", carpool_capacity, "people today."
print "We have", passengers, "to carpool today."
print "We need to put about", average_passengers_per_car, "in each car."
name = 'The Franko Rocks'
age = 25 # this is a lie
height = 74 # inches
weight = 250 # pounds
eyes = 'Blue'
teeth = 'White'
hair = 'Brown'
print "Lets talk about %s." % name
print "He is %d inches tall." % height
print "He is %d pounds heavy." % weight
print "Actually, thats pretty fucking heavy."
print "He has got %s eyes and %s hair." % (eyes, hair)
print "His teeth are usually %s, depending on the coffee." % teeth
# this line is tricky, try and get it exactly right.
print "If I add %d, %d, and %d I get %d." % (age, height, weight, age + height + weight)
x = "There are %d types of people." % 10
binary = "binary"
do_not = "don't"
y = "Those who know %s and those who %s." % (binary, do_not)
print x
print y
print "I said: %r." % x
print "I also said: '%s'." % y
hilarious = False
joke_evaluation = "Isn't that joke so funny? %r"
print joke_evaluation % hilarious
w = "This is the left side of ... "
e = "a string with a right side."
print w + e
print "Mary had a little lamb."
print "Its fleece was white as %s." % 'snow'
print "And everywhere that Mary went."
print "." * 10 # what did that do
a1 = "C"
a2 = "h"
a3 = "e"
a4 = "e"
a5 = "s"
a6 = "e"
a7 = "b"
a8 = "u"
a9 = "r"
a10 = "g"
a11 = "e"
a12 = "r"
# watch that comma at the end.
# try removing it and see what happens.
print a1 + a2 + a3 + a4 + a5 + a6,
print a7 + a8 + a9 + a10 + a11 + a12
formatter = "%r %r %r %r"
print formatter % (1, 2, 3, 4)
print formatter % ("one", "two", "three", "four")
print formatter % (True, False, False, True)
print formatter % (formatter, formatter, formatter, formatter)
print formatter % (
"I had this thing.",
"That you could type up right.",
"But it didnt sing.",
"So I said goodnight."
)
# Here is some strange stuff, remember to type it exactly.
days = "Monday Tuesday Wednesday Thursday Friday Saturday Sunday"
months = "Jan\nFeb\nMar\nApr\nMay\nJune\nJuly\nAug"
print "Here are the days:", days
print "Here are the months:", months
print """
There is something oging on here.
With the three double-quotes.
We'll be able to type as much as we like.
Even 4 lines if we want. Or 5, or 6.
"""
tabby_cat = "\tI'm tabbed in."
persian_cat = "I'm split\non a line."
backslash_cat = "I'm \\ a \\ cat."
fat_cat = """
I'll do a list:
\t* Cat food
\t* Fishies
\t* Catnip\n\t* Grass
"""
print tabby_cat
print persian_cat
print backslash_cat
print fat_cat
while True:
for i in ["/","-","|","\\","|"]:
print "%s\r" % i,
#print "How old are you?",
#age = raw_input()
#print "How tall are you?",
#height = raw_input()
#print "How much do you weigh?",
#weight = raw_input()
#print "So, you are %r old, %r tall, and %r heavy." % (age, height, weight)
# Additions examples playing around.
print "How old are you?",
age = raw_input()
print "Are you sure that you are %r? You look much older..." % (age)
print "So really, how old are you?",
realage = raw_input()
print "I am still not sure that I believe you."
print "How tall are you? Reallllllyyyy...?"
height = raw_input()
print "Yeah right, like I believe that you are %r..." % (height)
print "Whatever, well pretend you are telling the truth."
print "This means that you are %r and %r tall..." % (realage, height)
age = raw_input("How old are you? ")
weight = raw_input("How much do you weigh? ")
height = raw_input("How tall are you? ")
print "So, you are %r old, %r tall and %r heavy." % (age, height, weight)
from sys import argv
script, first, second, third = argv
username = raw_input("What is your username? ")
utime = raw_input("What time is it now? ")
#print "This script is called:", script
#print "Your first variable is:", first
#print "Your second variable is:", second
#print "Your thiurd variable is:", third
print "%s, at %s you ran the script %s and put these in as the three arguments: %s, %s, %s." % (username, utime, script, first, second, third)
from sys import argv
script, user_name = argv
prompt = 'Whats your answer bitch? : '
print "Hi %s, I'm the %s script." % (user_name, script)
print "I would like to ask you a few questions."
print "Do you like me %s?" % user_name
likes = raw_input(prompt)
print "Where do you live %s?" % user_name
lives = raw_input(prompt)
print "What kind of computer do you have?"
computer = raw_input(prompt)
print """
Alright, so you said %r about liking me.
You live in %r. Not sure here that is.
And you have a %r computer. Nice.
""" % (likes, lives, computer)
# this pulls argv from sys. this is what grabs the filename after running python ex15.py
from sys import argv
script, filename = argv # sets the filename to specified argument after running python script.
txt = open(filename)
print "Here's your file %r:" % filename
print txt.read() # this takes the set txt, and then reads (displays) it.
#print "Type the filename again."
#file_again = raw_input("> ") # specify the filename again.
#txt_again = open(file_again) #this takes the raw input filename, and loads the text
#print txt_again.read() # this prints the text loaded from the external file.
from sys import argv
script, filename = argv
print "We are going to erase %r." % filename
print "If you do not want that hit CTR+C (^C)."
print "If you do want this, hit RETURN."
raw_input("?")
print "Opening the file. . ."
target = open(filename, 'w')
print "Truncating the file. Goodbye!"
target.truncate()
print "Now I am going to ask you for three lines."
line1 = raw_input("line 1: ")
line2 = raw_input("line 2: ")
line3 = raw_input("line 3: ")
print "I am going to write these to the file."
target.write(line1 + "\n" + line2 + "\n" + line3)
print "And finally, we close it."
target.close()
from sys import argv
from os.path import exists
script, from_file, to_file = argv
print "Copying from %s to %s." % (from_file, to_file)
# We could do these two lines in a single line, how?
indata = open(from_file).read()
print "The input file is %d bytes long." % len(indata)
print "Does the output file exist? %r" % exists(to_file)
print "Ready, hit RETURN to continue. CTRL+C to abort."
raw_input()
out_file = open(to_file, 'w').write(indata)
print "Alright, all done."
#from sys import argv
#from os.path import exists
#script, from_file, to_file = argv
#print "Copying from %s to %s" % (from_file, to_file)
# we could do these two on one line, how?
#in_file = open(from_file)
#indata = in_file.read()
#print "The input file is %d bytes long" % len(indata)
#print "Does the output file exist? %r" % exists(to_file)
#print "Ready, hit RETURN to continue, CTRL-C to abort."
#raw_input()
#out_file = open(to_file, 'w')
#out_file.write(indata)
#print "Alright, all done."
#out_file.close()
#in_file.close()
# this one is like your scripts with argv
def print_two(*args):
arg1, arg2 = args
print "arg1: %r, arg2: %r" % (arg1, arg2)
# ok, that *args is actually pointless, we can just do this
def print_two_again(arg1, arg2):
print "arg1 %r, arg2: %r" % (arg1, arg2)
# this just takes one argument
def print_one(arg1):
print "arg1: %r" % arg1
# this one takes no arguments
def print_none():
print "I got nothing."
print_two("The","Franko")
print_two_again("The","Franko")
print_one("First")
print_none()
# sets the function cheese_and_crackers, and uses the different variables set
# to show the different amounts.
#def cheese_and_crackers(cheese_count, boxes_of_crackers):
# print "You have %d cheeses!" % cheese_count
# print "You have %d boxes of crackers!" % boxes_of_crackers
# print "Man thats enough to have a party!"
# print "Get a blanket.\n"
#
# this sets the numbers directly. first number being cheese_count
# second number being the boxes_of_crackers
#print "We can just give the funtion numbers directly:"
#cheese_and_crackers(20, 30)
#
# this sets the numbers directly for each variable.
#print "Or, we can use the variables from our script:"
#amount_of_cheese = 10
#amount_of_crackers = 50
#
# this outputs the statement, and then with the above numbers.
#cheese_and_crackers(amount_of_cheese, amount_of_crackers)
#
# this is using math to set the 2 numbers.
#print "We can even do math inside too:"
#cheese_and_crackers(10 + 20, 5 + 6)
#
# this is also using math, but using the variables and additional numbers
#print "And we can combine the two, variables and math:"
#cheese_and_crackers(amount_of_cheese + 100, amount_of_crackers + 1000)
#
#
def pimps_and_hoes(pimp_count, ho_count):
print "You have %d Pimps..." % pimp_count
print "You have %d Hoes...." % ho_count
if (pimp_count >= ho_count):
print "Look like you need to kill off a few of these niggas."
elif (pimp_count <= ho_count):
print "Looks like there is more hoes than pimps.\n Money to be had for everyone!"
print "How many districts do you have pimps in?",
districts = input()
print "How many pimps (average) per district?",
pimps_per_district = input()
print "How many hoes (average) per district?",
ho_per_district = input()
pimps_and_hoes(districts * pimps_per_district, districts * ho_per_district)
from sys import argv
# sets the file after python ex20.py as input_file
script, input_file = argv
# variable to print entire file.
def print_all(f):
print f.read()
# variable to reset position to beggning
# I imagine specifying specific numbers jump to that start point.
def rewind(f):
f.seek(0)
# variable to print a single line
def print_a_line(line_count, f):
print line_count, f.readline()
# opens the argv file
current_file = open(input_file)
print "First let's print the whole file:\n"
# calls the variable to print all from the specified file.
print_all(current_file)
print "Now let's rewind, kind of like a tape."
# calls the variable to reset position
rewind(current_file)
print "Let's print three lines:"
# calls the lines to be printed back. += 1 adds 1 to the existing current_line
current_line = 1
print_a_line(current_line, current_file)
current_line += 1
print_a_line(current_line, current_file)
current_line += 1
print_a_line(current_line, current_file)
def add(a, b):
print "ADDING %d + %d" % (a, b)
return a + b
def subtract(a, b):
print "SUBTRACTING %d - %d" % (a, b)
return a - b
def multiply(a, b):
print "MULTIPLYING %d * %d" % (a, b)
return a * b
def divide(a, b):
print "DIVIDING %d / %d" % (a, b)
return a / b
print "Let's do some math functions!"
age = add(30, 5)
height = subtract(78, 4)
weight = multiply(90, 2)
iq = divide(100, 2)
print "Age: %d Height: %d, Weight: %d, IQ: %d" % (age, height, weight, iq)
# A puzzle for extra credit.
print "Here is a puzzle."
what = add(age, subtract(height, multiply(weight, divide(iq, 2))))
# 35 + 74 - > 180 * > (50 / 2)
# 4391 4426 4500 25
print "That becomes:", what, "Can you do it by hand?"
# math_answer = 35 + (74 - (180 * (50 / 2)))
# print "Math test:", math_answer
math_answer2 = (30 + 5) +((78 - 4) - ((90 * 2) * (100 / 2) / 2))
print "Math formula: (30 + 5) +((78 - 4) - ((90 * 2) * (100 / 2) / 2)) = ", math_answer2
from sys import argv
from os.path import exists
script, filename = argv
target = open(filename, 'w')
print """
Lets have a little MadLib Fun!
I am going to ask you for a few words.
Be creative and lets make a story!
"""
print "Give me an:"
first_adj = raw_input("Adjective:")
second_adj = raw_input("Adjective:")
first_num = raw_input("Number:")
food = raw_input("Type of food (plural):")
third_adj = raw_input("Adjective:")
noun = raw_input("Noun:")
fourth_adj = raw_input("Adjective:")
line1 = "Fractured Aesop's Fables\n\n"
line2 = "The Mole and his Mother\n"
line3 = "By: Aesop (Fractured by Us)\n\n"
line4 = "A %s Mole, a creature blind from birth,\n" % first_adj
line5 = "once said to his %s Mother:\n" % second_adj
line6 = "'I am sure that I can see, Mother!'\n"
line7 = "In an effort to prove to him his mistake,\n"
line8 = "his Mother placed before him %s %s, and asked,\n" % (first_num, food)
line9 = "'What is it?' The %s Mole said,\n" % third_adj
line10 = "'It is a %s.' His Mother exclaimed:\n" % noun
line11 = "'My %s son, I am afraid that you are not only blind,\n" % fourth_adj
line12 = "but that you have lost your sense of smell.'"
target.writelines([line1, line2, line3, line4, line5, line6, line7, line8, line9, line10, line11, line12])
target = open(filename, 'r')
def print_all(f):
print f.read()
print "Here is your story!:\n"
print_all(target)
target.close()
# run this and include an export file, ie: python ex22b.py ex22b.txt
# after completing the madlib it will output to the specified file.
from sys import argv # allows us to specify the file we are going to use for saving the madlib.
# from os.path import exists # this was in here to notify if the file exists or not. didnt end up using that.
import os # using this to use the screen clear function.
script, filename = argv # sets filename to the file we specified in running the script.
os.system('cls' if os.name == 'nt' else 'clear') # clears screen.
# wanted to give the option to clear the file, or stop the script.
print "We are going to clear %r. If you don't want this, press CTRL+C now. Otherwise hit RETURN." % filename
raw_input() # waits for the RETURN to continue.
target = open(filename, 'w') # opens the files
target.truncate() # clears it out
print "File Erased, and ready to write a new one! hit RETURN to get started!"
raw_input() # Wait for the RETURN to continue, and the next line clears screen.
os.system('cls' if os.name == 'nt' else 'clear')
# simple multi line print.
print """
Lets have a little MadLib Fun!
I am going to ask you for a few words.
Be creative and lets make a story!
"""
# set the variables used in the madLib.
print "Give me an:"
adj1 = raw_input("Adjective:")
adj2 = raw_input("Adjective:")
num = raw_input("Number:")
food = raw_input("Type of food (plural):")
adj3 = raw_input("Adjective:")
noun = raw_input("Noun:")
adj4 = raw_input("Adjective:")
print "Got the data! Press RETURN to save your MadLib to %r, and display it!" % filename
raw_input()
# above lets the user know they are done, below clears the screen again to display only the finished MadLib
os.system('cls' if os.name == 'nt' else 'clear')
# this sets the line1 with the story and fills in the variables.
line1 = """
Fractured Aesop's Fables\n
The Mole and his Mother
By: Aesop (Fractured by Us)\n
A %s Mole, a creature blind from birth,
once said to his %s Mother:
"I am sure that I can see, Mother!"
In an effort to prove to him his mistake,
his Mother placed before him %s %s, and asked,
"What is it?" The %s Mole said,
"It is a %s." His Mother exclaimed:
"My %s son, I am afraid that you are not only blind,
but that you have lost your sense of smell."
""" % (adj1, adj2, num, food, adj3, noun, adj4)
target.write(line1) # this writes the story to the specified file.
# the rest opens, and prints back the file to screen.
target = open(filename, 'r')
def print_all(f):
print f.read()
print "Here is your story!:\n"
print_all(target)
# now lets clear it out, and exit it out.
print "Hit enter to get back to your command prompt!"
raw_input()
os.system('cls' if os.name == 'nt' else 'clear')
target.close()
print "let's practice everything."
print 'You\'d need to know \'bout escapes with \\ that do \n newlines and \t tabs.'
poem = """
\tThe lovely world
with logic so firmly planted
cannot discern \n the needs of love
nor comprehend passion from intuition
and requires an explanation
\n\t\twhere there is none.
"""
print "---------------"
print poem
print "---------------"
five = 10 - 2 + 3 - 6
print "This should be five: %s" % five
def secret_formula(started):
jelly_beans = started * 500
jars = jelly_beans / 1000
crates = jars / 100
return jelly_beans, jars, crates
start_point = 10000
beans, jars, crates = secret_formula(start_point)
print "With a starting point of: %d" % start_point
print "We'd have %d beans, %d jars, and %d crates." % (beans, jars, crates)
start_point = start_point / 10
print "We can also do that this way:"
print "We'd have %d beans, %d jars, and %d crates." % secret_formula(start_point)
def break_words(stuff):
"""This function will break up words for us."""
words = stuff.split(' ')
return words
def sort_words(words):
"""Sorts the words."""
return sorted(words)
def print_first_word(words):
"""Prints the first word after popping it off."""
word = words.pop(0)
print word
def print_last_word(words):
"""Prints the last word after popping it off."""
word = words.pop(-1)
print word
def sort_sentence(sentence):
"""Takes in a full sentence and returns the sorted words."""
words = break_words(sentence)
return sort_words(words)
def print_first_and_last(sentence):
"""Prints the first and last word of the sentence."""
words = break_words(sentence)
print_first_word(words)
print_last_word(words)
def print_first_and_last_sorted(sentence):
"""Sorts the words then prints the first and last one."""
words = sort_sentence(sentence)
print_first_word(words)
print_last_word(words)
def break_words(stuff):
"""This function will break up words for us."""
words = stuff.split(' ')
return words
def sort_words(words):
"""Sorts the words."""
return sorted(words)
def print_first_word(words): # fixed
"""Prints the first word after popping it off."""
word = words.pop(0) # fixed
print word
def print_last_word(words):
"""Prints the last word after popping it off."""
word = words.pop(-1) # fixed
print word
def sort_sentence(sentence):
"""Takes in a full sentence and returns the sorted words."""
words = break_words(sentence)
return sort_words(words)
def print_first_and_last(sentence):
"""Prints the first and last words of the sentence."""
words = break_words(sentence)
print_first_word(words)
print_last_word(words)
def print_first_and_last_sorted(sentence):
"""Sorts the words then prints the first and last one."""
words = sort_sentence(sentence)
print_first_word(words)
print_last_word(words)
print "Let's practice everything."
print 'You\'d need to know \'bout escapes with \\ that do \n new lines and \t tabs.'
poem = """
\tThe lovely world
with logic so firmly planted
can not discern \n the needs of love
nor comprehend passion from intuition
and requires an explantion
\n\t\twhere there is none.
"""
print "--------------"
print poem
print "--------------"
five = 10 - 2 + 3 - 6 # fixed
print "This should be five: %s" % five
def secret_formula(started):
jelly_beans = started * 500
jars = jelly_beans / 1000 # fixed
crates = jars / 100
return jelly_beans, jars, crates
start_point = 10000
beans, jars, crates = secret_formula(start_point) # fixed
print "With a starting point of: %d" % start_point
print "We'd have %d jeans, %d jars, and %d crates." % (beans, jars, crates)
start_point = start_point / 10
print "We can also do that this way:"
print "We'd have %d beans, %d jars, and %d crabapples." % secret_formula(start_point) # fixed
sentence = "All good things come to those who wait."
words = break_words(sentence) #fixed
sorted_words = sort_words(words) # fixed
print_first_word(words)
print_last_word(words)
print_first_word(sorted_words) # fixed
print_last_word(sorted_words)
sorted_words = sort_sentence(sentence) # fixed
print sorted_words # fixed
print_first_and_last(sentence)
print_first_and_last_sorted(sentence) # fixed
people = 40
cats = 39
dogs = 20
if people < cats:
print "Too many cats! The world is doomed!"
if people > cats:
print "Not many cats! The world is saved!"
if people < dogs:
print "The world is drooled on!"
if people > dogs:
print "The world is dry!"
dogs += 8
if people >= dogs:
print "People are greater than or equal to dogs."
if people <= dogs:
print "People are less then or equal to dogs."
if people == dogs:
print "People are dogs."
people = 80
cars = 19
trucks = 15
if cars > people:
print "We should take the cars."
elif cars < people:
print "We should not take the cars."
else:
print "We cant decide."
if trucks > cars:
print "That's too many trucks."
elif trucks < cars:
print "Maybe we could take the trucks."
else:
print "We still cant decide."
if people > trucks:
print "Alright, let's just take the trucks."
else:
print "Fine, let's just stay home then."
# irc.shareandenjoy.tv
import os
os.system('cls' if os.name == 'nt' else 'clear')
user = raw_input("Who dares enter the share and enjoy irc network? >")
print """
Welcome %s, you just joined the irc network of Share and Enjoy.
There are 6 channels you can enter. They are all labled as follows:
1: #enjoy
2: #chaos
3: #share
4: #coding
5: #gentlemensclub
6: #mobile
Type in the number for which channel you dare to enter:
""" % user
channel = raw_input("> ")
if channel == "1":
print """
Topic for #enjoy is: Welcome to #enjoy. Do NOT feed the trolls!
There is some chit chat when you see someone named uFOURt say:
http://explosm.net/comics/4120/ << Oh look, its %s.
You have a few actions you can do here.
\t1: Do nothing and hope he doesn't say anything else.
\t2: Reply back something witty.
\t3: Leave the channel before this virus named uFOURt spreads.
\t4: Close IRC and hope you never see the name uFOURt again.
""" % user
act1 = raw_input("Quick, what number do you choose: >")
if act1 == "1" or act1 == "3" or act1 == "4":
print "You have chosen wisely. Feeding the troll results in many years of mindless babble."
print "You may, just may, live your irc life in peace now."
elif act1 == "2":
print "Noooo! Now you've done it. You have fed the troll and he may never rest again."
print "You have now tainted everyone in the channel. Good job %s! /glined."
else:
print "Your option was not registered. You are now doomed to an eternity of listening to the troll."
elif channel == "2":
print """
Topic for #chaos is: Welcome to #chaos! Anything and Everything goes!
You see people kicking, banning, and talking smack.
derailius is mowing people down left and right, kicking and banning.
mango is trying to keep pace with him.
What do you want to do %s? You have a few options.
\t1: Kick and Ban derailius.
\t2: Kick and Ban mango.
\t3: Do nothing and just watch the show.
\t4: Close the channel. This is boring.
""" % user
act2 = raw_input("Quick! What number do you choose: >")
if act2 == "1":
print "You done messed up. derailius quickly rejoins the channel with his anti kick-ban script."
print "You are immediately zlined. (Reason: Never kick the derailius.)"
elif act2 == "2":
print "Good job! derailius applauds you for your help. Good job %s!" % user
print "derailius then proceeds with his kick-bans, and includes you as well."
elif act2 == "3":
print "As you sit and watch, derailius gets to your nick and says, \"Bye %s!\"" % user
print "You have been kick-banned."
elif act2 == "4":
print "This is a wise choice. You have made it out unscathed. Good job %s!" % user
elif channel == "3":
print """
Topic for #share is: Welcome! Feel free to download whatever you want! Type: !dl ID for what you want!
Some stuff scrolls by, different tv shows and movies..
ID Name Size
12 Walking.Dead.Current 1.5gb
200 Sleepy.Hollow.Current 1.2gb
250 Game.of.Thrones.Current 1.8gb
280 Minions.2015.1080p 7.8gb
Pick one of the torrents, and download it!
"""
file1 = "Walking Dead - Current"
file2 = "Sleepy Hollow - Current"
file3 = "Game of Thrones - Current"
file4 = "Minions 2015 1080p"
act3 = raw_input("Type the command to get the file you want: >")
if act3 == "!dl 12":
print "The bot PM's you a magnetic link to past into your torrent client."
print "Here you go %s! Good job using the bot! Enjoy your show %s" % (user, file1)
elif act3 == "!dl 200":
print "The bot PM's you a magnetic link to past into your torrent client."
print "Here you go %s! Good job using the bot! Enjoy your show %s" % (user, file2)
elif act3 == "!dl 250":
print "The bot PM's you a magnetic link to past into your torrent client."
print "Here you go %s! Good job using the bot! Enjoy your show %s" % (user, file3)
elif act3 == "!dl 280":
print "The bot PM's you a magnetic link to past into your torrent client."
print "Here you go %s! Good job using the bot! Enjoy your show %s" % (user, file4)
else:
print "You are obviously challenged if you can't get type the small command as listed."
print "No wonder you do not win at irc, and unable to use the bot to get free torrents!"
elif channel == "4":
print """
Welcome to #coding! Chat about coding, ask for help, or help others!
You have a question about some python coding. There are three people in the channel.
Who do you want to highlight and ask?
The users are: Dan39, mango, and TheFranko.
"""
act4 = raw_input("Type the name of whom you want to highlight (Caps Matter):")
if act4 == "Dan39":
print "While this is the best option, as he probably knows the most....."
print "He is most likely AFK and wont get back to you for a long while!"
elif act4 == "mango":
print "%s, you are not thinking very clearly are you? He gave up on LPTHW..." % user
print "mango tries to help you, but he just isn't fast enough on the google."
elif act4 == "TheFranko":
print "Honestly, this isn't much help either. This guy just makes it up as he goes along."
print "Really %s, this was also a bad idea. Better luck next time!"
else:
print "You obviously did not notice who all was in the room. Guess you have to google for yourself!"
elif channel == "5":
print """
Welcome to #gentlemensclub! Commands are !pussy !ass !lesbians !uFOURtsMOM
Type in from the above commands, what you want to see displayed!
"""
act5 = raw_input("Type the command you wish to use from the topic:")
if act5 == "!pussy":
print "Nice choice! The bot provides you with 10 links to some pussy pics!"
elif act5 == "!ass":
print "Cant go wrong with a nice ass! The bot provides you with 10 links to some ass pics!"
elif act5 == "!lesbians":
print "You must have forgot that uFOURt was in the channel."
print "He immediately says more retarded shit, \"NEEDS MOAR LESBIANS\"."
elif act5 == "!uFOURtsMOM":
print "You are provided with a pic of the largest most stretched out pussy imaginable."
print "Around it you see the entire networks population with their dicks out while she finishes them up using all means possible."
else:
print "You have picked an invalid option, and therefore have no links."
elif channel == "6":
print """
Welcome to #mobile! Talk about all things mobile!
You realized you messed up by coming here, as its all stupid talk.
Android bashing Apple, and Apple bashing Android.
Apparently no, we cant all get along.
"""
else:
print "You have chosen an option that is not available. You have been disconnected."
print "You enter a dark room with two doors. Do you go through door #1 or door #2?"
door = raw_input("> ")
if door == "1":
print "There is a giant bear here eating a cheese cake. What do you do?"
print "1. Take the cake."
print "2. Scream at the bear."
bear = raw_input("> ")
if bear == "1":
print "The bear eats your face off. Good Job!"
if bear == "2":
print "The bear eats your legs off. Good Job!"
else:
print "Well, doing %s is probably better. Bear runs away." % bear
elif door == "2":
print "You stare into the endless abyss at Cthulu's retina."
print "1. Blueberries."
print "2. Yellow jacket clothespins.."
print "3. Understanding revolvers yelling melodies."
insanity = raw_input("> ")
if insanity == "1" or insanity == "2":
print "Your body survives powered by a mind of jello. Good job!"
else:
print "The insanity rots your eyes into a pool of muck. Good Job!"
else:
print "You stumble around and fall on a knife and die. Good Job!"
the_count = [1, 2, 3, 4, 5]
fruits = ['apples', 'oranges', 'pears', 'apricots']
change = [1, 'pennies', 2, 'dimes', 3, 'quarters']
# this first kind of for-loop goes through the list.
for number in the_count:
print "This is count %d" % number
# same as above
for fruit in fruits:
print "A fruit of type: %s" % fruit
# also we can go through mixed lists too. notice we have to use %r since we dont know whats in it.
for i in change:
print "I got %r" % i
# we can also build lists, first start with an empty one.
elements = list(range(1,21)) # modified to eliminate the next few lines.
# then use the range function to do 0 to 5 counts. for i in range(10):
# print "Adding %d to the list." % i
# append is a function that lists understand.
# elements.append(i)
# now we can print them out too.
for i in elements:
print "Element was: %d" % i
def theloop(the_limit):
"""This function should loopback x amount of times."""
i = 0
numbers = []
while i < the_limit:
print "At the top i is %d" % i
numbers.append(i)
i += 1
print "Numbers now: ", numbers
print "At the bottom i is %d" % i
print "The numbers: "
for num in numbers:
print num
print "How many time would you like this loop to run?"
set_limit = int(input("Enter Number: "))
theloop(set_limit)
animals = ['bear', 'python', 'peacock', 'kangaroo', 'whale', 'platypus']
print """
This is an exercise in the extracting items from a list.
All these statements should result in True.
"""
print "Lets go through the list and check these bad boys out."
print "The animal at 1 is python is", "python" == animals[1]
print "The third animal is peacock is", "peacock" == animals[2]
print "The first animal is bear is", "bear" == animals[0]
print "The animal at 3 is kangaroo is", "kangaroo" == animals[3]
print "The fifth animal is whale is", "whale" == animals[4]
print "The animal at 2 is peacock is", "peacock" == animals[2]
print "The sixth animal is platypus is", "platypus" == animals[5]
print "The animal at 4 is whale is", "whale" == animals[4]
# Self lists and practice
good_beers = ['Sol', 'Michelobe', 'Bohemia', 'Dos Equis']
bad_beers = ['Bud Light', 'Natty light', 'Miller']
hard_stuff = ['Jack', 'Vodka', 'Gin', 'Tequila']
mixers = ['Coke', 'Orange Juice', 'Juice']
print "There is good beers: ", good_beers, "..."
print "and there are bad one: ", bad_beers, "..."
print "My personal favorites are %s and %s." % (good_beers[0], good_beers[2])
print "Some people like a shot of %s, while some people like mixed drinks such as %s and %s." % (hard_stuff[3], hard_stuff[0], mixers[0])
print "Them girlies like to drink fuzzy navels which is just %s and %s." % (hard_stuff[1], mixers[1])
print "Then there is you.. that wanna be gansta dranking his %s and %s." % (hard_stuff[2], mixers[2])
from sys import exit
def gold_room():
print "This room is full of gold. How much do you take?"
choice = raw_input("> ")
try:
how_much = int(choice)
except ValueError:
dead("Man, learn to type a number.")
if how_much < 50:
print "Nice, you're not greedy, you win!"
exit(0)
else:
dead("You greedy bastard!")
def bear_room():
print "There is a bear here."
print "The bear has a bunch of honey."
print "The fat bear is in front of another door."
print "How are you going to move the bear?"
bear_moved = False
while True:
choice = raw_input("> ")
if choice == "take honey":
dead("The bear looks at you then slaps your face off.")
elif choice == "taunt bear" and not bear_moved:
print "The bear has moved from the door. You can go through it now."
bear_moved = True
elif choice == "taunt bear" and bear_moved:
dead("The bear gets pissed off and chews your leg off.")
elif choice == "open door" and bear_moved:
gold_room()
else:
print "I got no idea what that means."
def cthulhu_room():
print "Here you see the great evil Cthulhu."
print "He, it, whatever stares at you and you go insane."
print "Do you flee for your life or eat your head?"
choice = raw_input("> ")
if "flee" in choice:
start()
elif "head" in choice:
dead("Well that was tasty!")
else:
cthulhu_room()
def dead(why):
print why, "Good job!"
exit(0)
def start():
print "You are in a dark room."
print "There is a door to your right and left."
print "Which one do you take?"
choice = raw_input("> ")
if choice == "left":
bear_room()
elif choice == "right":
cthulhu_room()
else:
dead("You stumble around the room until you starve.")
start()
print """
This is soon to come.
I plan to build a mild dungeon.
Due to how much time is involved,
I decided I will come back to it.\n
\n(Perhaps when I get bored and need a break)
\t-TheFranko
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment