Saturday, December 1, 2012

25/30- 28/30 Coding!

 So I've kept up slowly with my coding.  I think I'll keep trying to get it even past my 30 days.  I like learning this and it is rather fun to go through it with my boyfriend on occasion.  He's a better teacher than the internet and makes me work through things properly so that I actually understand them.  I don't often have the courage to ask for help.  Since I only make baby steps it's rather embarrassing to show how far I've come day by day.

 I've had my birthday and have gotten old! I got to take the Ada-dog to Macy's and we took a picture with Santa Claus.  ^__^ She was so polite and sweet.  I got flowers and was taken to German dinner.  It was nice!

I have also spent time creating Christmas Cards! (Or holiday cards for the non religious.)  It was fun and took forever.  I made embossed snowflake cards on nice midnight blue paper! It costs more than I like to do that sort of thing, but it was fun.

This is my latest code.  Only works because I knew it was wrong and my boyfriend helped me work though it line by line.  He actually wrote a tiny bit of it.  I made it run.  With a lot of hand-holding.

def fizzCount(x):
    c = 0 #set c to = 0 in the function
    for i in x:
        if i == "fizz":
            c += 1
    return c
   
somelist = ["a","b","fizz","not_fizz","fizz"]
someotherlist = ["fizz", None]
athirdlist = [None, "not_fizz", "abcde", "fizz"]

listoflists = [somelist, someotherlist, athirdlist]
for l in listoflists:
    print fizzCount(l)





For i in x:
for statements run though the x and look for i's. Confusing, but useful.

No comments:

Post a Comment