Thursday, November 8, 2012

6/30: Coding

Not much to say! I didn't spend that much time coding, but I do understand what I was doing a little bit better.  Throwing the raw (and inelegant) code in to make sure I understand it later when I've slept and forgotten a bunch of things.  This is after figuring it out twice, and it took me 20 minutes the second time as well since I didn't really understand it the first time around.  And that was with the Q&A to guide me! The if, else, elif statements are rather mind bending.  I am glad I spent the extra time with them.  Even if it is 5 in the morning! But I get why the bottom code works! (I think.)

I'm noticing a few similarities between python and ruby.  I think the Ruby platform I was working with was a little easier to understand, and it felt like I was learning faster.  It wouldn't really let me go off script though.  The python platform is giving me a much deeper understanding, even though it isn't as simple to understand.  It's also a lot more willing to let me tamper with the code and the format they set up.  So I can screw up! But the problem is I can screw up!  So yeah.  I think I'll be able to use Python better when I'm done simply because I'm spending so much more time on it.

I see how the old "Hitchhikers Guide" video game was set up.  I could probably write something like that now.  It would take me a while, but I think I could do it if I really wanted to have 100 diff options for every question and hated my free time.  Hell I manged to ask a question, give several options, and depending on the answer, offer different responses!

Didn't do too much today.  Made a yummy chicken salad.  Skipped my coffee, but down diet Pepsi like it was full of crack.  Had a "Psych" marathon! Recovered from all the election nerves of yesterday.  Stayed in the house, all day. Feel a tiny bit guilty for that, but that's part of not working and not having a reason to leave the house.

Here is an awesome kickstarter project for time travel underpants!  I really want some.  If nothing else these should be made.  Not my favorite DW swag, but cute.  This idea comes from JRose at the cheeseblarg!  She does some really fun things throughout the year and I love her scavenger hunts.

It's almost 6 am.  I should take Ada dog out and get some sleep.


Notes:
#Starting code! Use # to get used to it. Must return true.  Does not need to print.
def the_flying_circus():  #<- is the function.
    if True or False:           #Everything after function must be indented.
        return True
    elif 7+8>7**2:         #elif statement comes before my else!
        return False        #return or print statements need a tab as well
    else:                          #else statement is left blank
           return True
   

Spelling is VITAL!!  Get better at it. The below code is because I watched "the Wiz" earlier this year for the first time and have seen a billion "Sexy Dorathy!" costumes. Almost worked in my awesome Elphaba into the mention, but just didn't have the energy to be that witty.

def oz():
    print "Welcome to Munchkin land!"      #no extra tab yet since it's the A statement
    print "Where are you from? Kansas or New York City?"
    answer = raw_in
put("Type Kansas or New York City and press 'Enter'.")
    if answer == "Kansas" or answer == "kansas":
        print "White Dorathy! Great now we'll be seeing sexy halloween costumes for 50 years!"  #this is a B statement, the return or print needs the extra indent like in the simple above code
    elif answer == "New York City" or answer == "new york city" or answer == "NYC" or answer == "nyc":
        print "Black Dorathy! Great, now we get our own Disco Diva!"
    else:
        print "Can't make up your mind? I guess you're from the Matrix!"

        oz()      #I'm assuming this is to define the end of the function

oz()       #I'm assuming this is to actually run the function. I can have another function after that and it will run as long as it's been defined before hand.

clinic()  #for example, not sure how it would run if I had a diff function for each answer.  I bet I would have to attach the new function to the answer of the previous one.

No comments:

Post a Comment