Python Programming · High School (9–10) · 1 course, 13 worked problems, 20 practice questions
A project joins many skills in one longer program. In this topic you plan and build programs that use dictionaries, files, string handling, searching, sorting and error handling together. The projects include a contact book, a program that cracks a secret message and a marks report for a class. Each project starts with a plan of inputs, processes and outputs. It then grows in small steps, with a test after each step. Finishing a project shows how the separate tools of Python fit together to solve a real problem.
Choose an answer, then check it. Each one shows a full explanation.
contacts = {"ravi": "98765"}. What does contacts.get("Ravi".lower()) give?
A message was coded with a shift of 19. Which shift, from 0 to 25, decodes it with the same function?
ranked = sorted([("Asha", 72), ("Ravi", 85), ("Meera", 64)], key=lambda p: -p[1]). What is ranked[0][0]?
commands = {"hi": greet}, where greet is a function. What does commands["hi"]() do?
Why is a dictionary a good tool for a contact book?
What does contacts.get("zoya") give if there is no Zoya in the book?
In a long English text, which letter is the most common?
The most common letter of a long secret is h. The place of h is 7 and the place of e is 4. What shift does the rule guess?
Which module gives the mean, the median and the standard deviation?
A student writes a bare except: around the whole marks report, so that nothing ever stops it. What is the problem?
Each one has a hint, the key idea and a full worked solution.