DEV Community

loading...
Cover image for Building a basic tarot card app using Python

Building a basic tarot card app using Python

redlotusdesignz profile image Diana Chin Originally published at thecodingcow.com ・2 min read

Hello, friends! As part of Hashnode's Christmas Hackathon, I decided to create a basic tarot card app using Python.

For those who don't know, I was a former professional tarot reader many years ago. I've always enjoyed using tarot cards for my personal and career development. I also use them when I need storytelling ideas for my webcomics and visual novel games.

When I'm traveling, I rely on my tarot card apps on my phone instead of bringing my physical deck with me. So, I wanted to try and create a basic form of the tarot card app, which pulls three random cards to represent the past, present, and future. The problem that I'm trying to solve? Having a no-frills option to provide instant fortune-reading results on what the past, present, and future will look like for a general reading setting.

This Python app utilizes the random library, along with a large list that I manually added all 78 individual cards. I also included a fun crystal ball ASCII art in a separate file. It's a beginner-friendly project that offers room for improvement.

You can see this in action below:

tarotcard_python.gif

Running this the second time and you'll get different results:

tarotcard_python-2.gif

Of course, if the querent doesn't want a reading, it simply prints out the following message:

image.png

What could be improved?

  • The ability to add descriptions for each of the cards. Might need to utilize dictionaries for the next iteration of the tarot card app.

  • Ensuring that the choices are not duplicated. While it's running functionally as expected, there's a slim chance that either one or all three cards may have the same card. Imagine having all three cards to read Death all at once! I don't think that wouldn't make the querent happy...😅

  • The ability to shuffle and draw multiple card options. While the three-card layout is a popular choice, I believe there's room to add a feature on adding multiple cards pulls for the querent.

That's all for today!

If you happen to like this article, let me know in the comments section below! You can also follow me on Twitter for more coding and art adventures. Wishing everyone Merry Christmas and a Happy New Year!

Discussion (3)

pic
Editor guide
Collapse
joyshaheb profile image
Joy Shaheb

Cool project 🤯

Collapse
redlotusdesignz profile image
Diana Chin Author

Thanks so much!

Collapse
maelingcodes profile image
Maeling (she/her)

Really cool idea!