Monday, June 16, 2014

Python Fundamentals Part 2

What the holy hell happened!  Man o man, did I hit a wall this week.  The first few week of this course and I'm zipping through it thinking this is going to be a great summer and then week 4 happened.  I realize, that I am a visual learner.  I need to see the action in order for it to click in my head, I need to be able to dissect the working code in order to understand the ins and outs.

This week, we were given the start of a script.  The import random module was already loaded at the start of the script.  We then needed to find some errors in a block of code that would allow the scipt to run properly. Luckily, the lecture helped to clear this up.  And then step three happened.  In step three we were to create a list from scratch using 20 random numbers between 0 and 10.  I knew some of the modules that I needed to use, and individually I could run them with proper results, however, the while loop, threw me.  I had a very hard time comprehending how to include the append function and the random integer. Once I got past step 3, things seemed to move along a little better.  Once I had my list created, I needed to create a random unlucky number that would be counted and then removed from the list.  I'm not sure why this while loop was easier to understand than the last one, perhaps because I was able to dissect the previous one.  Our final results were to include the original block of code that we fixed, our created list, a statement declaring how many of the unlucky number would be removed from our list; if any, and our final list with the unlucky number removed. Below are the result of the my script.

Script results

Here's hoping my clicker works better next week.

No comments:

Post a Comment