Q1.
Return the Next Number from the Integer Passed
• Create a function that takes a number as an argument,
increments the number by +1 and returns the result.
• addition(0) ➞ 1
• addition(9) ➞ 10
• addition(-3) ➞ -2
HK©2026
Q2. Convert Minutes into Seconds
• Write a function that takes an integer minutes and converts it to
seconds.
• convert(5) ➞ 300
• convert(3) ➞ 180
• convert(2) ➞ 120
HK©2026
Q3. Convert Hours into Seconds
• Write a function that converts hours into seconds.
• how_many_seconds(2) ➞ 7200
• how_many_seconds(10) ➞ 36000
• how_many_seconds(24) ➞ 86400
HK©2026
Q4. Buggy Code
• Look at the examples below to get an idea of what the function
should do.
• myFunc(3) ➞ 27
• myFunc(5) ➞ 125
• myFunc(10) ➞ 1000
• myFunc(7) ➞ 343
• myFunc(11) ➞ 1331
HK©2026
Q5. Return the Remainder from Two Numbers
• There is a single operator in Python, capable of providing the
remainder of a division operation. Two numbers are passed as
parameters. The first parameter divided by the second parameter
will have a remainder, possibly zero. Return that value.
• remainder(1, 3) ➞ 1
• remainder(3, 4) ➞ 3
• remainder(5, 5) ➞ 0
• remainder(7, 2) ➞ 1
HK©2026
Q6. Convert Age to Days
• Create a function that takes the age in years and returns the age in
days.
• Use 365 days as the length of a year for this challenge.
• Ignore leap years and days between last birthday and now.
• Expect only positive integer inputs.
• calc_age(65) ➞ 23725
• calc_age(0) ➞ 0
• calc_age(20) ➞ 7300
HK©2026
Q7. Football Points
• Create a function that takes the number of wins, draws and losses
and calculates the number of points a football team has obtained so
far.
• Wins get 5 points
• Draws get 2 points
• Losses get 1 points
• football_points(3, 4, 2) ➞ 25
• football_points(5, 0, 2) ➞ 27
• football_points(0, 0, 1) ➞ 1
HK©2026
Q8. The Farm Problem
• In this challenge, a farmer is asking you to tell him how many legs
can be counted among all his animals. The farmer breeds three
species:
• chickens = 2 legs
• cows = 4 legs
• lambs = 4 legs
• animals(2, 3, 5) ➞ 36
• animals(1, 2, 3) ➞ 22
• animals(5, 2, 8) ➞ 50
HK©2026
Reference
Textbook:
서명:Think Python: How to Think Like a Computer Scientist
(How to Think Like a Computer Scientist)
저자: O'Reilly Media
출판사: O'Reilly Media
출판년도: 20151225
ISBN: 9781491939369
HK©2026