Games of Chance Challenge Project (Python)

Congratulations on completing your project!

Compare your project to our solution code and share your project below! Your solution might not look exactly like ours, and that’s okay! The most important thing right now is to get your code working as it should (you can always refactor more later). There are multiple ways to complete these projects and you should exercise your creative abilities in doing so.

This is a safe space for you to ask questions about any sample solution code and share your work with others! Simply reply to this thread to get the conversation started. Feedback is a vital component in getting better with coding and all ability levels are welcome here, so don’t be shy!

About community guidelines: This is a supportive and kind community of people learning and developing their skills. All comments here are expected to keep to our community guidelines

How do I share my own solutions?

  • If you completed the project off-platform, you can upload your project to your own GitHub and share the public link on the relevant project topic.
  • If you completed the project in the Codecademy learning environment, use the share code link at the bottom of your code editor to create a gist, and then share that link here.

Do I really need to get set up on GitHub?
Yes! Both of these sharing methods require you to get set up on GitHub, and trust us, it’s worth your time. Here’s why:

  1. Once you have your project in GitHub, you’ll be able to share proof of your work with potential employers, and link out to it on your CV.
  2. It’s a great opportunity to get your feet wet using a development tool that tech workers use on the job, every day.

Not sure how to get started? We’ve got you covered - read this article for the easiest way to get set up on GitHub.

Best practices for asking questions about the sample solution

  • Be specific! Reference exact line numbers and syntax so others are able to identify the area of the code you have questions about.

The solutions file won’t open on my computer.

I have version 3.8 installed on my computer and am trying to install 2.7.17 but don’t know if I’m doing it correctly. After installing, when I go to open it asks to repair python 2.7 and the installation repeats?

I read that 2.7 is needed to view the solutions but I’m a bit stuck at the moment, would appreciate some insight into what I’m doing wrong.


Looking at the code, it seems to be made for python3. Do you get errors when you try to run the code in python3.8? Where does it say you need python2 for this solution to work?

1 Like

Oh I checked the page setting up Python with Codecademy and it mentioned most will only be compatible with python 2, but that’s great it was made for 3.

I followed the link to the solution and tried to open the file, but the python app just blinks and closes every single time, so I cannot view the code.

To view the code, you can just open the file using a text-editor

there is no reason for the window to stay open after its executed the program, so you might want to run this script from the command line.

Oh okay that worked, thank you. I appreciate your patience with a python newbie. Have a great weekend!

wait? That was it? Usually people then struggle to run there programs from command line.

nice that you figured it out on your own :slight_smile: Strange as it may sound, but the less i help you, the better it actually is. Programming is about problem solving and figuring things out

Thank you, you too :slight_smile:

Oh I just wanted to be able to view the code :laughing:. I did, however, just paste the solution code and tried to run it on the command line but got a few errors. I think I’ll need to look into that a bit myself. Like you said, I’d prefer to try and figure it out myself first since that is the best way to learn. If I hit a wall I will reach back out, but thank you so much for your help!

1 Like

that’s my code.

not the most elegant, but i’m proud of it… :slight_smile:


Here is what I ended up with:


Here’s my code. Was a fun little project and learnt some stuff along the way like deleting array objects and only getting the first few characters of a string.

My code! Good luck everyone!

1 Like

My first go at this thing.


My first coding project! Learnt alot from this!

Here’s my attempts, pretty happy with this! Its well commented so anyone struggling feel free to take a look :slight_smile:

Nice, lestrang, this looks great! I wrote this project, so it’s cool to see what people are doing with it - really clever way of making the deck of cards.

If you want to continue adding on to this project, I might consider separating the code that checks whether they have enough money into a separate function. This might be helpful since you use it multiple times!

Good work!

Thanks for the feedback, its great to get a positive comment from the person who wrote it themselves!

Yes agree, I need to think ahead more about when its worth making a new function and how I can save myself time. I love this course it really builds up your knowledge quickly so you keep up the good work too!

1 Like


Here’s my attempt at this project. Let me know what you think, I’m sure there is room for improvement. I had fun doing this project.

Hello All, my first attempt at this challenge. Any and all feedback would be greatly appreciated!

Thank you :facepunch: