Amazing-Python-Scripts
111 строк · 2.9 Кб
1import random2
3
4# get tarot deck of 78 cards and 'predictions' from tarot.txt
5file_handle = open("./Tarot Reader/tarot.txt", "r")6cards = file_handle.readlines()7tarot_deck = []8for card in cards:9tarot_deck.append(card)10
11
12# Close file, display outro text
13def fin():14file_handle.close()15print("Whichever your choice was...")16input(">> press enter")17print("May the cards ever be in your favour")18input(">> press enter")19print()20print("\x1B[3mFin\x1B[23m".center(72))21print("*"*72)22
23
24# Display when 'Y' or 'y' is entered
25def youve_chosen_yes():26print("I see that you've chosen to divine your future....")27input(">> press enter")28print("Let's make haste then...")29input(">> press enter")30print("Neither fame nor fortune wait for man")31input(">> press enter")32print()33print("You have drawn three cards")34print()35print("Your first card is...")36pick_card1 = random.randint(0, 77)37print(tarot_deck[pick_card1])38input(">> press enter")39print()40print("Your second card is...")41pick_card2 = random.randint(0, 78)42print(tarot_deck[pick_card2] if pick_card2 !=43pick_card1 else tarot_deck[random.randint(0, 78)])44input(">> press enter")45print()46print("And your third and final card is...")47pick_card3 = random.randint(0, 78)48print(tarot_deck[pick_card3] if pick_card3 != pick_card1 and pick_card3 !=49pick_card2 else tarot_deck[random.randint(0, 78)])50input(">> press enter")51print()52fin()53
54
55# Display when 'N' or 'n' is entered
56def youve_chosen_no():57print("Are you wise...")58input(">> press enter")59print("Or foolish?")60input(">> press enter")61print("I suppose only time will tell")62input(">> press enter")63fin()64
65
66# Handles other cases
67def youve_chosen_neither():68print("*le sigh*")69input(">> press enter")70print("I suppose you think this is a game...")71input(">> press enter")72print("You wouldn't be wrong...")73input(">> press enter")74print("But the only thing that you've played...")75input(">> press enter")76print("Is yourself.")77input(">> press enter")78print("\nNever gonna give you up,\nNever gonna let you down,\nNever gonna run around and desert you.\nNever gonna make you cry,\nNever gonna say goodbye,\nNever gonna tell a lie and hurt you.\n")79fin()80
81
82# Intro text
83print("In this black box, you read white words")84input(">> press enter")85print("Words that might warn you of danger...")86input(">> press enter")87print("Words that might foretell great fortune...")88input(">> press enter")89print("Or words that might make you laugh")90input(">> press enter")91print()92
93
94# Choice made here
95print("Do you dare draw a card?")96ch = input(">> enter Y/n: ")97print("\nInteresting...")98
99
100# Driver code
101if ch.lower() == 'y':102print()103youve_chosen_yes()104
105elif ch.lower() == 'n':106print()107youve_chosen_no()108
109else:110print()111youve_chosen_neither()112