zman7895's class hack post

by Zach Lund

14 Jun 2017

Below is my embedded trinket.

I took my blackjack game and created a class for a player. Essentially, the player class has your standard initializing function that requires two parameters, name and nickname. Then, the functions are to getname, getnickname, and a string method that returns a small statement. In my blackjack game I made it so a player gets initialized at the beginning of the game, and the two paramters are created by asking the user for inputs to enter their name and nickname. Then, through methodcalls to the class, the name is utilized throughout the dialogue in the game. Some example code to make this happen is below. I feel fairly comfortable with the creation of a basic class. I will be interested however, to see how to take my final project and implement a class when I am struggling to figure out what could be turned into a class. I look forward to the challenge though!

  while getbuyin: 
    try:
      initialchipcount = float(input("So " + mrplayer.getname() +  ", how much would you like to buy in for?"))
      getbuyin = False
I am a rising senior at UNC and in the information science major. I lived most of my life just outside of Washington D.C. I love sports, music, and gambling. Find Zach Lund on Twitter, Github, and on the web.