#100DaysofCode — Day (4)
Another sleepless night made for another doozy of an hour here.
Today’s section was on randomness and lists. We were able to create a coin flip app, which I’d like to revisit and add some ASCII art to make my main driver for flipping a coin rather than Google’s coin flipper. Nothing against them though.
One of the biggest takeaways for me today, that seemed insignificant in the whole lesson was the concept of modules. Modules seem to be different bits of programming that are responsible for different functionality in programs. I’ll have to scroll through some of the documentation to see what other modules are out there. I used the
random module repeatedly throughout the section, since that’s what the entire section was about.
To top off the day, I ended up working on a rock paper scissors game. Users can type in 0, 1, or 2 for rock, paper, or scissors respectively. The computer randomly selects one of these, and based on what you selected you either win or lose. There’s also an exception where, if someone types something other than 0, 1, or 2 they lose, which is neat.
One thing I need to look into is figuring out how to loop these. For instance, once the game resolves, I’d like to ask the player if they’d like to play again. Then I’ll be able to revisit the RPS game, along with some of the previous days work to modify them!