Last active
July 8, 2020 06:58
-
-
Save guillermo-carrasco/f95cf9148e5673b6bfa2c9fbe997309a to your computer and use it in GitHub Desktop.
Select a random Machine Learning card
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob | |
import os | |
import random | |
if not os.path.exists('selected.txt'): | |
open('selected.txt', 'a').close() | |
with open('selected.txt', 'r') as f: | |
selected = f.read().splitlines() | |
cards = glob.glob('*.png') | |
n_cards = len(cards) | |
while True: | |
card_index = random.randint(0, n_cards) | |
card = cards[card_index] | |
if not card in selected: | |
with open('selected.txt', 'a') as f: | |
f.writelines(card.strip() + '\n') | |
print(card) | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I bought a set of Machine Learning Flash Cards from Chris Albon. A very much worth piece of art and knowledge!
This very simple script will print out the name of a random card every time you run it for you to study.
How
png_web
directorypython select_random_card.py