Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ipeirotis/4d8d50baab6c0c8dfecefc5ae3766238 to your computer and use it in GitHub Desktop.
Save ipeirotis/4d8d50baab6c0c8dfecefc5ae3766238 to your computer and use it in GitHub Desktop.
# Panos Ipeirotis, Oct 30 2016
# Just trying to keep my 5yo busy while it is pouring rain outside...
import random
import emoji # https://pypi.python.org/pypi/emoji/
# Selection from http://www.webpagefx.com/tools/emoji-cheat-sheet/
emojis = [':apple:', ':green_apple:', ':tangerine:', ':lemon:', ':cherries:', ':grapes:', ':watermelon:', ':strawberry:',
':peach:', ':melon:', ':banana:', ':pear:', ':pineapple:', ':sweet_potato:', ':eggplant:', ':tomato:', ':corn:']
def generate_exercise(upperlimit):
l1 = random.randint(1,upperlimit-1)
l2 = random.randint(l1+1,upperlimit)
char = random.choice(emojis)
line1 = emoji.emojize(l1*char, use_aliases=True)
line2 = emoji.emojize(l2*char, use_aliases=True)
message = line1 + "\n" + line2 + "\n\n"
message += str(l1) + " is ____ less than " + str(l2)
return message
for i in range(12):
print(generate_exercise(10))
print("\n--------------------\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment