Looking for Feedback on a Coin/Dice Game

Hello!

I am working on the Data Science course and came across my first challenge project. Sadly, the link for it’s forum is broken so I thought I’d come here for some feedback.

I was basically given the following user stories and asked to write a program to tackle it. Below is the info I was given and at this point in the course I have basic skills up to, and including, loops.

Basic Requirements

  • User Story: As a user I want to be able to guess the outcome of a random coin flip(heads/tails).
  • User Story: As a user I want to clearly see the result of the coin flip.
  • User Story: As a user I want to clearly see whether or not I guessed correctly.

Intermediate Challenge

  • User Story: As a user I want to clearly see the updated guess history (correct count/total count).
  • User Story: As a user I want to be able to quit the game or go again after each cycle.

Advanced Challenge

User Story: As a user I want to be able to guess the outcome of a 6-sided dice roll (1-6), with the same feature set as the coin flip (see above).

I’ve saved my code file to github and linked it below. Any feedback for a beginning coder on ways to improve would be super helpful!

Coin and Dice Game.ipynb

Hello @web1886190748, welcome to the forums! It seems you’ve covered all of the users’ stories well; good job! Your code is neatly laid out, with good use of comments in it. One thing I would say is that since you’ve created a coin_flip_game() function, you could just use that in the game() function-instead of re-writing the code. It would also keep the code DRY (don’t repeat yourself). Apart from that, great job!

1 Like

Oh that’s a good point! Thanks for the feedback! I like that acronym of DRY haha

1 Like