[RELEASED] Random math olympiad problems

I have been working on this Python program that randomizes and gives a math Olympiad problem per run. This is what I use to determine which problem I will do. 

You can see the code below and run it either on your computer or at repl.it

import random

competitions = {
    1: "IMO Shortlist",
  2: "IMO Shortlist",
  3: "APMO",
  4: "Austrian-Polish",
    5: "Balkan MO Shortlist",
    6: "Balkan MO Shortlist",
    7: "Baltic Way",
    8: "Benelux",
    9: "Caucasus MO",
    10: "CentroAmerican",
    11: "Cono Sur MO",
    12: "Czech-Polish-Slovak Match",
    13: "Danube Competition in Mathematics",
    14: "EGMO",
  15: "European Mathematical Cup",
    16: "Gulf MO",
    17: "Hungary-Israel Binational",
    18: "IberoAmerican",
    19: "Iranian Geometry Olympiad",
    20: "International Olympiad of Metropolises",
    21: "International Zhautykov Olympiad",
    22: "JBMO Shortlist",
    23: "JBMO Shortlist",
    24: "Lusuphon MO",
    25: "Mediterranean MO",
    26: "Middle European MO",
    27: "Nordic",
    28: "Pan African",
    29: "Rioplatense MO",
    30: "Romanian Masters of Mathematics",
    31: "Silk Road",
    32: "Simon Marais Mathematical Competition",
    33: "Tournament of Towns",
    34: "Tuymaada Olympiad",
    35: "IMC",
    36: "Francophone MO",
    37: "Czech-Polish-Slovak Junior Match",
    38: "Mathematical Excellence Olympiad",
    39: "USA BAMO",
    40: "USA ELMO Shortlist",
    41: "USA ELMO Shortlist",
    42: "USA USEMO",
    43: "USA Math Prize for Girls Olympiad",
    44: "USA TST",
    45: "USA TSTST",
    46: "USAJMO",
    47: "Canada National Olympiad",
    48: "Bulgaria National Olympiad",
    49: "Estonia TST",
    50: "Greece TST",
    51: "Greece Junior Math Olympiad",
    52: "Greece National Olympiad",
    53: "Hong Kong CHKMO",
    54: "China TST",
    55: "India IMO Training Camp",
    56: "India National Olympiad",
    57: "India Regional MO",
    58: "Indonesia Juniors",
    59: "Indonesia MO",
    60: "Iran TST",
    61: "Kazakhastan National Olympiad",
    62: "Korea - Final Round",
    63: "Korea National Olympiad",
    64: "Dutch MO",
    65: "Vietnam National Olympiad",
    66: "Vietnam TST",
    67: "Singapore MO Open",
    68: "Turkey MO (2nd round)",
    69: "International Zhautykov Olympiad"

competitionName = competitions[numb]

startyear = int(input("What is the oldest year available of %s? (e.g. 1959 for IMO) " %competitionName))
endyear = int(input("What is the latest year available of %s (e.g. 2021 for IMO) " %competitionName))

year = random.randint(startyear, endyear)

howmanyprobs = int(input("How many problems are in %s in each year's test? " %competitionName))

prob = random.randint(1, howmanyprobs)

print("Do %d %s Problem %d\n" %(year, competitionName, prob))

This randomizes which competition you are going to do. As you may have noticed, I have put a few competitions 2 times. I did this on purpose because those competitions are shortlists.

Once it is finalized which competition you are exactly doing, you have to input in which years the contest is available (you'll see when you run it).

Then, you have to input how many problems are there (it is different for every contest).

Finally, you will have your problem and you can access the problem through any means.

I hope you like it!


  1. Anonymous11/25/2022

    Wow this is amazing! Thanks for making this


Post a Comment

Popular posts from this blog

1995 IMO #2

Inequality problem I made