Finish Mbak Juwita's first Python scripts at a rubber weigh post: data types, while, type hints. 16 levels, played right in the browser with nothing to install.
What the levels ask
The first Saturday of July. From this season Mr. Hendra wants the weigh slips typed, so Ms. Juwita writes her first script on the group's computer. Mr. Tono's sack has just come off the scale: 52.5 kg, two sacks, not paid yet, no note yet. Choose the values of berat and lunas so the slip prints the right types: the weight as a number with a fraction, paid as true or false.
The second Saturday. In her father's book, every Saturday's count opens with the whole number 0. Ms. Juwita uses one name, total, from morning to evening: it starts at zero, the weight of two sacks is added, and it is written for the post's board as 99.5 kg. Choose its starting value and how it is written for the board, so the morning line prints int, noon float, and evening str.
The third Saturday. The neighbourhood head wants a slip for the haulage fee: Rp3000 a sack for the motorbike taxi that brings the sacks out of the garden. The number of sacks is written in the paper book, so what is read is the text "4". The slip sits between two lines of twenty = signs. Choose how the line is made and how the number of sacks is read so the slip prints Rp12000.
The fourth Saturday. The scale is being mended, so Grandma Marni brings a handwritten note: a weight of 52,5 with a comma, and 3 sacks. The script has to turn that writing into numbers. Choose how both are turned so the slip prints the weight as a float and the sacks as an int.
The fifth Saturday. Grandma Marni weighs twice: 10.1 kg in the morning, 10.2 kg at noon. Ms. Juwita's father has the total in his book as 20.3 kg, and this week's rubber price is Rp11.500 a kilo. Choose how the weight is compared with his book and how the pay is worked out, so the slip says Sama dengan buku Bapak: True (same as Dad's book) and the pay is a whole rupiah amount, not a rupiah short.
The sixth Saturday. Mr. Hendra complains last week's slip was hard to read: the weight said 20.299999999999997 and the money had no thousands points. Choose how the weight line and the pay line are written so Grandma Marni's slip reads Berat : 20.3 kg and Bayar : Rp233.450.
The seventh Saturday. Mr. Hendra's pickup leaves for the factory once its bed carries 200 kg. Ms. Juwita writes a while loop: while the load is not enough yet, weigh the next sack and lift it onto the bed. Choose the loop's condition so the sacks go up one by one and the pickup leaves right when its load reaches 200 kg.
The eighth Saturday. Ms. Juwita adds a sack count to the pickup script, and the two lines that add things up have not been placed yet. Choose what they say and where they sit so the pickup leaves with 4 sacks and 200 kg.
The ninth Saturday. Today's queue is short, so the scale will be empty before the pickup reaches 200 kg: an empty scale reads 0.0. One sack is also still wet, and a wet sack is not bought until it dries. Choose what happens in those two places so the wet sack is passed over and the pickup leaves once the queue runs out.
The tenth Saturday. Mr. Hendra sends two small pickups that leave at 100 kg. If the queue runs out before a pickup is full, the slip says the queue ran out. If the pickup is full, the slip says penuh, berangkat (full, leaving). Choose the line under the loop so the full sentence is printed only for a pickup that really is full.
The eleventh Saturday. The new pickup bed holds only 4 sacks. Ms. Juwita counts sacks with karung and stops at 4. Choose the starting value and the comparison so exactly four sacks go up and the slip prints 4 karung naik pikap (4 sacks on the pickup).
The twelfth Saturday. From her course Ms. Juwita learns about type hints: type labels on a function's parameters and result, read by the checker mypy before the script runs. Choose the label of berat and the result label of bayar so mypy has no complaint at all.