Running code a thousand times over

Nora M
2 min readOct 9, 2021

--

As part of my English A-level, I’m studying one of my favourite novels, Kite Runner by Khaled Hosseini. I decided to create a simple study guide on the novel, a project that allowed me to revise my english while sharpening my python skills. I named it KiteRunner101!

Photo by Umut YILMAN on Unsplash

I used Sparknotes to create dictionaries with information on characters, themes, symbols etc. My code calls a function which prompts the user to enter a category (e.g characters) from a list of available information.

Hello! Welcome to KiteRunner101, a simple study guide to Khaled Hosseini’s bestselling novel.

Select a category to revise:
-characters;
-symbols;
-key facts;
-themes;

A for loop iterates through the keys in a dictionary of available categories, (“characters” : character_dict). If the category input matches a key the user is prompted to select an item from the dictionary:

Pick a character:
-amir;
-hassan;
-baba;
-ali;
-sohrab;
-assef;
or press ENTER for first

This will print both the key and value of the specified item. The user is then asked to press enter to print the next item in the category or to type either ‘back’, which prints the prompt to input a category, or ‘exit’, which will print a final message and end the program.

Press ENTER for next character or type BACK/EXIT: exit
— — — — — — — — — — — — — — — — — — — — —
Thanks for using KiteRunner101

for you a thousand times over!
— — — — — — — — — — — — — — — — — — — — — — — — — — -

If an input is not recognised an error message will occur and the user will be prompted to re-enter the value.

--

--