Orscalla

Dream On, Dream Strong, Dream become thy Reality...

Bombdigidi News

On the hunt...

Posted by Orscalla on August 25, 2010 at 3:08 AM


On the hunt for a job...

The lastest place I applied for was working in Python.

Python is apparently an equivalent to C++, which means

I practically have 1 to 2 years of experience in the langauge.


This was a great source to get an idea on the syntax-

http://www.sthurlow.com/python/lesson01/


The twist though is, I was building everything in Python 3.0.

That site builds everything in an older version.


I'll go ahead an list my code though if anyone wants some 3.0 code to mess around with.


===========

Printing

===========

#Programming Test No.01

print ("This is the part-")

print ("Where the end meets the middle-")

print ("And hearts bursts out from the riddles and mysteria.")

print ("Gazing at the life that survived at this time-")

print ("of a crime where it all fell apart.")

print ("    ")

print ("I feel yeah")

print ("    ")

print ("-misc song")

============

Operations

============

#Program Test 02:  How do variables work???

 

 

n = 20

 

print("Ok, so let's use a single letter variable and put something in it!")

print("If I did this right, Python should print n as 20.")

print("n = ", n)

print("   ")

 

n = n + 2

 

print("Now let's add to n...")

print("If I did this right, Python should return n as 22.")

print("n = ", n)

print("   ")

 

n = 7

 

print("Ok, let's change n...")

print("If I did this correctly, Python should change n to 7.")

print("n = ", n)

print("   ")

 

n = (n*5)/7

 

print("And now for some crazy math |n=(n*5)/7|.  If I'm correct, Python should reply as 5.")

print("n = ", n)

print("   ")

print("   ")

 

#Testing Strings

 

print("The following are just strings being put together via variables")

print("   ")

 

w1 = "Its good to "

w2 = "see you again FUHU, "

w3 = "I hope your day is going well!"

 

sA = w1 + w2 + w3

 

print("The word groups w1|Its good to|, w2|see you again FUHU|,")

print("and w3|I hope your day is going well!| are printed together")

print("   ")

 

print(w1, w2, w3)

 

print("   ")

print("Now the word groups are placed into a single variable sA|=w1+w2+w3| and printed")

print("   ")

 

print(sA)

==============

Loops and Conditionals

==============

 

 

#Good ol' loops and conditionals

print("good ol' loops and conditionals")

print("   ")

print("   ")

print("The while loop...")

 

n = 0

while n < 10:

    n = n + 1

    print(n)

 

print("   ")

print("Something more original...")

 

n = 3

while n != 0:

    print("I've got a lovely bunch of coconuts...bum bum...")

    print("There they are standing in a ROW!...bum bum bum...")

    print("Big ONE, Small ONE!  Some bigger than your head!")

    print("   ")

    n = n - 1

    print("...and now we have ", n, " of them left!")

    print("   ")

 

print("I'm afraid we are now out of coconuts...")

print("   ")

 

#CONDITIONALS TIME

print("   ")

print("===")

print("...its time for conditionals!")

print("===")

 

n = 30

while n >= 0:

    if n % 3 == 0:

        print(n)

    n = n - 1

 

print("  ")

print("...I should probably do something more creative...")

print("...nah...maybe another time...")

print("  ")

print("  ")

 

print("I liked this joke too much, I had to show it again...")

      

x = 2

if x > 80:

      print("...we are in a very strange place...")

elif x < 4:

      print("...everything seems normal.")

=====================

Love Quiz

=====================

#Let's start with making a function that spits back your name...

 

 

#Input your name

n = input("What is your name?:  ")

#Spit out name

print("Well, Hello there!  ", n)

 

 

#Love calculator program

#How much LOVE do you got?

 

print("Welcome to the LOOOoooVE Calculator!  Where we tell you how much LOVE you got to give ;D")

print("  ")

 

#controls loop

 

loop = 1

 

#hold user's response

 

r = 0

r2 = "Y"

text = "This isn't working!"

 

 

while loop == 1:

    #show what options you have

    print("Let us determine how much LOVE you have to give!.")

    print("The following our your choices to determine the answer!")

    print("   ")

    print("Option 1:  I hug my mom.")

    print("Option 2:  I give money to the homeless!")

    print("Option 3:  I cuddle my wife to sleep every night.")

    print("Option 4:  I spend my time feeding children with no shelter.")

    print("Option 5:  I am the reason world peace happens.")

    print("Option 6:  TO QUIT PROGRAM.")

    print("Type in any number (1 thru 6) to choose an option")

    print("   ")

    r = input("Choose your option:  ")

    print("...")

    #print(r) #testing if r is properly receiving info

    

    #if statements are not working in WHILE LOOP for some reason...

    if r == "1":

        print("You are a family man and have a lot of love to give!"       )

    elif r == "2":

        print("That homeless guy just bought booze and drugs with your money and ended up dying!!  FoShame! For feeding his addiction!"       )

    elif r == "3":

        print("You are a DEFENDER!  With the power of love you will DEFEND your loved ones!")

    elif r == "4":

        print("You are indeed PRO!  The LOVE within overwhelms you and you share it with the world to bare far more fruit than anyone could every imagine!")

    elif r == "5":

        print("There are no words to describe how much LOVE pulsates through your entire being!")

    elif r == "rickroll":

        print("NEVER GONNA GIVE U UP!")

        print("NEVER GONNA LET YOU DOWN!")

        print("NEVER GONNA TELL A LIE OR DESERT YOU!")

    elif r == "6":

        loop = 0

        break

        

    print(" ")

    r2 = input("Would you like to try again? Y/N:  ")

    if r2 == "N":

        loop = 0

 

print("Thank you for trying ou the LOOOOOoooVE Calculator!")

print(" ")

print(" ")

 

 

====================

Fitness Quiz & Calculator+

====================

# Small Fitness Quiz Program

# The purpose of this program was simply to build defined functions,

# return their values, and do something with these values.

 

def endurance_test(score):

    print("processing...")

    return score

def muscle_test(score):

    print("processing...")

    return score

def respiratory_test(score):

    print("processing...")

    return score

def leg_test(score):

    print("processing...")

    return score

 

def health_test():

    print("How do you rate yourself on a scale of 1 to 10, 10 being best, in lifting heavy objects?")

    a = endurance_test(int(input("Endurance rate:  ")))

    print("How do you rate yourself on a scale of 1 to 10, 10 being best, in lifting heavy objects?")

    b = muscle_test(int(input("Muscle rate:  ")))

    print("How do you rate yourself on a scale of 1 to 10, 10 being best, in swimming underwater?")

    c = respiratory_test(int(input("Respiratory rate:  ")))

    print("How do you rate yourself on a scale of 1 to 10, 10 being best, in sprinting short distances?")

    d = leg_test(int(input("Leg rate:  ")))

    

    #add those numbers together to get total score

    print("You total score is...")   

    print(a + b + c + d , " out of 40.")

    print("  ")

    print("  ")

 

#Start the Program here...

 

health_test()

 

#================================

#The Renowned Calculator Program

#================================

    

#version - MEDI Style

#by Aaron J. Becker, based on Sthrulow's Calculator

 

#importing math

import math

 

# This is where the user is prompted on what options are available to use.

# Main Menu...

def menu():

    #options are printed here...

    print("Welcome to the Renowned Calculator Program")

    print("your options are:")

    print(" ")

    print("1) Addition")

    print("2) Subtraction")

    print("3) Multiplication")

    print("4) Division")

    print("5) Square Root")

    print("6) Square")

    print("7) Add and Subtract simultaneously")

    print("8) Quit calculator.py")

    print(" ")

    return input("Choose your option: ")

 

# I added Sq Roots, Sqauring, and an add/sub at the same time option.

# Functions will be defined here...

 

# this adds two numbers given

def add(a,b):

    print(a, "+", b, "=", a + b)

    print(" ")

    

# this subtracts two numbers given

def sub(a,b):

    print(b, "-", a, "=", b - a)

    print(" ")

    

# this multiplies two numbers given

def mul(a,b):

    print(a, "*", b, "=", a * b)

    print(" ")

    

# this divides two numbers given

def div(a,b):

    print(a, "/", b, "=", a / b)

    print(" ")

 

# this finds the sqaure a number given

def sqrt(a):

    print(math.sqrt(a))

    print(" ")

 

# this sqaures a number given

def sqr(a):

    print(a**2)

    print(" ")

 

# this adds two numbers, and additionally subtracts the two numbers given

def add_sub(a,b):

    print(a, "+&-", b, "=", a + b, ", ", a - b)

    print(" ")

    

# MAIN PROGRAM STARTS HERE

loop = 1

choice = 0

while loop == 1:

    choice = menu()

    if choice == "1":

        add(int(input("Add this: ")),int(input("to this: ")))

    elif choice == "2":

        sub(int(input("Subtract this: ")),int(input("from this: ")))

    elif choice == "3":

        mul(int(input("Multiply this: ")),int(input("by this: ")))

    elif choice == "4":

        div(int(input("Divide this: ")),int(input("by this: ")))

    elif choice == "5":

        sqrt(int(input("Find the square root of this:  ")))

    elif choice == "6":

        sqr(int(input("Sqaure this:  ")))

    elif choice == "7":

        add_sub(int(input("Add and subtract this:  ")),int(input("by this:  ")))

    elif choice == "8":

        loop = 0

 

print("Thank you for using the Renowned Calculator Program!")

 

# End of Program

 

 

======================

A list program

=====================

 

#I want to make a list and create a few functions...

#that allow you to add and delete from the list

 

NameList = ['pete', 'bob', 'danny', 'stewie']

 

#States options (Menu function)

def menu():

    print("The following are this programs commands...")

    print("Type 'show_NameList' to show your current list")

    print("Type 'remove_name' to remove a name from the list")

    print("Type 'add_name' to add a name to the list")

    print("Type 'quit' to quit program")

    return input("Command:  ")

 

#Defines functions

#Shows names in list (up to 10)

def Show_NameList():

    print(NameList[0:10])

 

#Removes a name from the list via index

def remove_name(name):

    print(NameList[name], " has been deleted from list.")

    del NameList[name]

 

#Adds a name to the list        

def add_name(name):

    NameList.append(name)

    print(name, " has been added to the list.")

 

#Program Starts

loop = 1

choice = 0

while loop == 1:

    choice = menu()

    if choice == "show_NameList":

        Show_NameList()

    elif choice == "remove_name":

        remove_name(int(input("Index:  ")))

    elif choice == "add_name":

        add_name(input("Name:  "))

    elif choice == "quit":

        loop = 0

===========================

Text Adventure!

===========================

#For Loop Text Adventure GAme

 

#import random

import random

 

#Menu

def menu(list, inspection):

    for entry in list:

        print(list.index(entry), ") ", entry)

 

    return int(input(inspection))

 

#items in room

items = ["old torn up chair", "oilly wrinkled ugly rug", "broken lamp",\

         "guitar bolted to the ceiling", "keyboard balancing through a window",\

         "unsuspicious looking drawer", \

         "new artpad resting in the corner on the floor",\

         "triple bolted and chained door consisting of a single key hole"]

 

#make a random keylocation

#The key's location

keylocation = random.randrange(0,7)

#print("This is the keylocation:  ", keylocation)

 

#You haven't found the key:

keyfound = 0

 

loop = 1

 

#Give some introductary text:

print("You wake up in a room strapped to a wooden chair,\

you have no idea how you got there nor why you're there. \

Thoughts of creepy movies like 'Saw' start pouring through \

your mind.  Then you realize you've been living a pretty \

good life with little evidence showing you've taken it for \

granted.")

print("")

print("A man walks through the door in front of you wearing \

a dark blue suit.  'I apologize for meeting you under such \

rude circumstances, but you see I have a question that really \

needs an answer... and if I met you under normal circumstances \

I'm afraid the answer I'm looking for would not surface so easily...")

print("")

print("THUD!!!!")

print("")

print("'??? What was that I wonder?  Hmmm...  Well I'll get \

back to you on that question.  Just, uh... stay comfortable \

while I check out what's going on outside...' The man leaves \

the room locking the door behind him")

print(len(items), " things to inspect are in the room:  ")

for x in items:

    print(x)

print("")

print("You break out of the chair with many deep grunts and flexings.  \

There's no telling when that man will return and for all \

you know this may be some kind of horror movie.  So find the key \

and get out while you still have a chance!")

 

#Start Menu

while loop == 1:

    choice = menu(items, "What do you want to inspect?(Number):  ")

    #Chair

    if choice == 0:

        if choice == keylocation:

            print("You inspect the chair you just broke out of.  In your")

            print("haste, you make a big mess out of its interrior feathers.")

            print("There's a tinkling sound-as if a metallic small object were")

            print("rocking swiftly to a dead stop...  is it?  It is- you found the key!")

            print("")

            keyfound = 1

        else:

            print("You inspect the chair you just broke out of. In your")

            print("haste, you make a big mess out of its interrior feathers.")

            print("You hear nothing but the miniscule sounds of ruffled feathers")

            print("brushing against each other on their way down to the floor.")

            print("")

    #Rug

    elif choice == 1:

        if choice == keylocation:

            print("You cautiously pick up the rug trying to avoid getting the")

            print("oilly substances all over the place.  Disgustedly you pick up a")

            print("shiny metallic object under it.  Its the key!")

            print("")

            keyfound = 1

        else:

            print("You cautiously pick up the rug trying to avoid getting the")

            print("oilly substances all over the place.  Disgustedly you peek about")

            print("where it once laid, but nothing ressembling a key rests there.")

            print("")

    #Lamp

    elif choice == 2:

        if choice == keylocation:

            print("Wait a minute... this isn't a broken lamp.. its a KEY!  How")

            print("did you make that mistake?!")

            print("")

            keyfound = 1

        else:

            print("Ow!  You accidntly cut your finger on one of the broken")

            print("shards.  Being a little more careful, you move the remaining pieces")

            print("about but end up revealing nothing.")

            print("")

    #Guitar

    elif choice == 3:

        if choice == keylocation:

            print("Wait a minute... this isn't a guitar... its a KEY!  How")

            print("did you make that mistake?!")

            print("")

            keyfound = 1

        else:

            print("The guitar is too high up.  You can't seem to reach it.")

            print("Who knows if there's actually a key up there...")

            print("")

    #Keyboard

    elif choice == 4:

        if choice == keylocation:

            print("You pull the keyboard in, making a tremendious amount of")

            print("noise.  A little started by the glass breaking you quickly pull")

            print("apart the already damaged music machine.  There's actually a key!")

            print("Its tied up in the wiring!")

            print("")

            keyfound = 1

        else:

            print("You pull the keyboard in, making a lot of noise!")

            print("Startled by your actions you quickly rip the music machine apart")

            print("revealing nothing inside!  Who would put a key inside a key")

            print("board?!")

            print("")

    #Drawer

    elif choice == 5:

        if choice == keylocation:

            print("You find a key... who would of thought of putting a key")

            print("in an unsuspicious drawer like this?")

            print("")

            keyfound = 1

        else:

            print("...you open the drawer.  There's nothing inside.")

            print("")

    #ArtPad

    elif choice == 6:

        if choice == keylocation:

            print("You lift the artpad up revealing a key underneath it.")

            print("")

            keyfound = 1

        else:

            print("You lift the artpad up revealing nothing beneath it.")

            print("")

    #Door

    elif choice == 7:

        if keyfound == 1:

            loop = 0

            print("You use the key on the door.")

            print("")

        else:

            print("The door... is still locked... Probably would help")

            print("if you had a key.  Probably should keep looking for one...")

            print("")

 

print("YES...YES!!!  The door is unlocked!  You step out and think about")

print("making a run for it!  However, you are stopped!!  That man is there!!  Outside")

print("the door!  It looks like he was about to enter the room!")

print("'hey...  so my question... I was wondering, what did you want for your birthday?'")

 

print("")

print("")

print("The End.")

 

 

===============================


So yeah...

I'm in the process of learning how to draw in pythong because I want to make something cool.  Shhh- I'll tell you what it is when its done.  :D

 

 


Categories: Site Blog

Post a Comment

Oops!

Oops, you forgot something.

Oops!

The words you entered did not match the given text. Please try again.

Already a member? Sign In

0 Comments

Kek Search

Custom Search

Contact Info

Email: FargoKraft@yahoo.com

(Dontations accepted via PayPal through this email too!)