Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sqlite3
- from random import randint
- conn = sqlite3.connect("computer_cards.db")
- def read_all_cards():
- result = conn.execute("SELECT * FROM computer")
- return result.fetchall()
- def pick_card():
- cards = read_all_cards()
- random_card = cards[randint(0, len(cards) - 1)]
- return random_card
- resp = "y"
- while resp == "y":
- print(pick_card())
- resp = input("pick another card?[y/n]:")
- conn.close()
Advertisement
Add Comment
Please, Sign In to add comment