The Hall’s Pledge — Python

Keep the promises of Mas Wira's Python functions at a silat hall: return, errors, generators. 14 levels, played right in the browser with nothing to install.

What the levels ask

  1. Mr. Wira wrote nilai_akhir in perguruan.py: the sum of five judges’ scores without the highest and the lowest. Tonight Mr. Jaya’s papan_skor.py calls it for both corners. Complete the function’s last line so Mr. Jaya gets the score, not just sees it on the screen.
  2. Mr. Bayu, the silat school’s treasurer, sends a WhatsApp reminder to every member who has not paid the dues. The list comes from belum_bayar. Choose where the line return hasil sits so the function checks every member first, and the reminder reaches the three who have not paid.
  3. Mrs. Ratna enters her pupils for the championship. kategori(umur) decides the age group: Dewasa from 17, Remaja 14 to 16, Pra Remaja 12 to 13, Usia Dini under 12. Fill the three branches so Dimas (9), Rara (12), Bagas (15) and Tia (17) each land in their own group.
  4. undi_sudut draws two names: the first out goes to the red corner, the second to the blue. Mr. Jaya unpacks the result into merah, biru, and the neighbourhood head uses the pair as a key of the rings’ schedule. Choose the last line so both scripts get the pair they need.
  5. The secretariat computer has been on since January, and each month the neighbourhood head records the champion of the joint practice with catat_juara(nama). Dina uses the same function for her own archive: she hands over her list and expects it to fill. Choose the default value and the function’s first line so each month gets a list of its own, and Dina’s archive holds her two champions.
  6. Mrs. Ratna lists her pupils in the order they arrive: the first to arrive leads the warm-up. Then she asks urut_berat to line them up from the lightest for the weigh-in. The function’s promise: the list handed over is not changed. Choose its body so Dimas is weighed first and Bagas still leads the warm-up.
  7. The regency’s pencak silat festival borrows Mr. Wira’s module for the desk at Mr. Piksel’s internet café. pendaftar_baru finds the names on today’s forms that are not yet in the book of 5,000 names. Every name in the book counts how many times it is compared. Choose the container for the book so the answer is right and the forms are checked with at most 100 name comparisons in all.
  8. Weight forms come in on WhatsApp: 47,5, empat puluh (forty), 52000 (in grams). baca_berat turns them into kilograms, and the unreadable ones go into the red folder. But there is a typo in Mr. Wira’s code, and tonight he wants that typo to show, not hide. Choose the except so empat puluh goes into the red folder and 52000 stops the script at the line with the typo.
  9. Mr. Jaya closes three bouts through tutup_partai. Its promise: a readable score is written on the board, an unreadable one is reported, and whatever happens the closing gong is struck. The board only has numbers up to 10, and refuses anything bigger. Arrange the blocks so bout 3, whose score is 12, stops with the board’s own refusal, not an "unreadable" report, and the gong still sounds.
  10. The neighbourhood head enters a team: Bagas, Tia and 'Galih ' from a WhatsApp form, with a space at the end of the name. berat_resmi takes each weight from the weigh-in book, and he adds them up: the team may compete if the total is at most 150 kilograms. Choose what the function does for a name the book lacks, so this entry stops with a message that names it, instead of slipping through quietly.
  11. Every entrant of the festival must hand in a health letter. pertama_tanpa_surat finds the first entrant who has not, and returns None if everyone has. Mr. Piksel calls it for the festival’s book of 5,000 pages, Mrs. Ratna for the branch’s book of five names. Choose how it searches so both get the right answer, with at most 100 pages read and memory under 16 KB.
  12. Mrs. Ratna wants a rota of warm-up leaders: Bagas, Tia, Galih, then back to Bagas, on and on for as long as there is practice. Her script asks for one name a week with next(rota), for eight weeks. Fill the body of giliran so each request gets one name, and the script uses no more memory than it needs: its budget is 256 KB.

And more, 14 levels in all.