Skip to content

Instantly share code, notes, and snippets.

@CavaTrendy
Created April 11, 2018 01:59
Show Gist options
  • Save CavaTrendy/f264c781b55638ebec5d8bcc3e246cd0 to your computer and use it in GitHub Desktop.
Save CavaTrendy/f264c781b55638ebec5d8bcc3e246cd0 to your computer and use it in GitHub Desktop.
Tarot card reading exercise
import random
user= input("Which tarot reading do you want 3(input 3) cards or 7(input 7) cards? or Quit ")
### major arcana
major = ['The Magician', 'The High Priestess', 'The Empress', 'The Emperor', 'The Hierophant', 'The Lovers',
'The Chariot', 'The Strength', 'The Hermit', 'The Wheel of Fortune', 'The Justice', 'The Hanged Man',
'The Death', 'The Temperance', 'The Devil', 'The Tower', 'The Star', 'The Moon', 'The Sun',
'The Judgement', 'The World', 'The Fool']
### minor arcana pentacle
minor_pentancles = ['1p', '2p', '3p', '4p', '5p', '6p', '7p', '8p', '9p', '10p', 'Jp', 'Qp', 'Kp']
minor_wands = ['1w', '2w', '3w', '4w', '5w', '6w', '7w', '8w', '9w', '10w', 'Jw', 'Qw', 'Kw']
minor_cups = ['1c', '2c', '3c', '4c', '5c', '6c', '7c', '8c', '9c', '10c', 'Jc', 'Qc', 'Kc']
minor_swords = ['1s', '2s', '3s', '4s', '5s', '6s', '7s', '8s', '9s', '10s', 'Js', 'Qs', 'Ks']
### fishing functions
card = 0
drawn_tarot = []
if user == '7':
while card <= 6:
card += 1
drawn_tarot += [random.choice(major + minor_pentancles + minor_cups + minor_swords + minor_wands)]
print(drawn_tarot)
elif user == '3':
while card <= 2:
card += 1
drawn_tarot += [random.choice(major + minor_pentancles + minor_cups + minor_swords + minor_wands)]
print(drawn_tarot)
else:
print('Thanks')
### Second variant
def tarot ():
import random
user = input("Which tarot reading do you want 3(input 3) cards or 7(input 7) cards? or Quit ")
### major arcana
major = ['The Magician', 'The High Priestess', 'The Empress', 'The Emperor', 'The Hierophant', 'The Lovers',
'The Chariot', 'The Strength', 'The Hermit', 'The Wheel of Fortune', 'The Justice', 'The Hanged Man',
'The Death', 'The Temperance', 'The Devil', 'The Tower', 'The Star', 'The Moon', 'The Sun',
'The Judgement', 'The World', 'The Fool']
### minor arcana pentacle
minor_pentancles = ['1p', '2p', '3p', '4p', '5p', '6p', '7p', '8p', '9p', '10p', 'Jp', 'Qp', 'Kp']
minor_wands = ['1w', '2w', '3w', '4w', '5w', '6w', '7w', '8w', '9w', '10w', 'Jw', 'Qw', 'Kw']
minor_cups = ['1c', '2c', '3c', '4c', '5c', '6c', '7c', '8c', '9c', '10c', 'Jc', 'Qc', 'Kc']
minor_swords = ['1s', '2s', '3s', '4s', '5s', '6s', '7s', '8s', '9s', '10s', 'Js', 'Qs', 'Ks']
### fishing functions
card = 0
drawn_tarot = []
if user == '7':
while card <= 6:
card += 1
drawn_tarot += [random.choice(major + minor_pentancles + minor_cups + minor_swords + minor_wands)]
print(drawn_tarot)
elif user == '3':
while card <= 2:
card += 1
drawn_tarot += [random.choice(major + minor_pentancles + minor_cups + minor_swords + minor_wands)]
print(drawn_tarot)
else:
return 'Thanks'
print(tarot())
@WendySci
Copy link

Interesting code for python. And where did you get information about tarot cards? I would like to understand what is the essence of them

@AndrwGreen-ok
Copy link

AndrwGreen-ok commented Feb 16, 2021

You have very good python code. I also tried to create a similar code, but in C++, in order to help people learn the meaning of tarot cards. I used the sorting algorithm and for this I took information from different sources similar to thetarotguru in order to give out as accurate an answer as possible, but I did not succeed due to the complexity of the language's syntex. At the moment, from the projects I have managed to create a program that gives a prediction in Java, but this is not related to tarot cards, but more with a ball of luck. In the future, I want to implement tarot predictions, but for this I will need an expert or a fortune teller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment