Lab, Foundations Projects
7 tasks, easy to hard: Predict, then run, Write it, Complete it, Fix it, Trace it, Refactor it, Mini challenge. Hints come one at a time and you can see each answer. Lab work is saved as practice and earns no XP.
Open the lessonYou can read every task below. Running, checking and saving them needs a free ID.
7 tasks
Task 01 .Type what the program will print, then run it to compare.
Type exactly what this program prints.
Sign in to access the interactive Python editor, write and run code checks against automated tests, use hints, and save your practice. Practice does not award XP.
Task 02 .Solve it from the prompt, starting from an empty editor.
Write add_task(tasks, title) that appends a new task dictionary with the given title and done set to False. Ignore titles that are empty after stripping spaces. Add "Read", " " and "Run" to an empty list, then print the list.
Sign in to access the interactive Python editor, write and run code checks against automated tests, use hints, and save your practice. Practice does not award XP.
Task 03 .Fill the marked gaps in the starter code.
Replace each ___ so show numbers the tasks from 1 with a checkbox, printing 1. [x] Bins and 2. [ ] Shop.
Sign in to access the interactive Python editor, write and run code checks against automated tests, use hints, and save your practice. Practice does not award XP.
Task 04 .The starter code has a bug. Repair it so the checks pass.
complete(tasks, number) should mark the task with that people-friendly number as done and print No such task for a number that does not exist. It has two bugs. Fix it so the program prints No such task and then False True.
Sign in to access the interactive Python editor, write and run code checks against automated tests, use hints, and save your practice. Practice does not award XP.
Task 05 .Fill the table with the variable values, step by step.
Each row shows number and left each time either changes, once both exist. left is how many tasks remain.
titles = ["Bins", "Shop", "Cook", "Read"]
left = len(titles)
for number in [3, 1]:
titles.pop(number - 1)
left = len(titles)Sign in or create a free ID to fill in and check this table.
Task 06 .Rewrite working code to the stated rule, keeping the same output. Rule: Collect the unfinished tasks in a list and return len() of it, without a += counter.
This function counts unfinished tasks with a counter. Rewrite it to build a list of the unfinished tasks and return its length, with no +=. The output must stay 2.
Sign in to access the interactive Python editor, write and run code checks against automated tests, use hints, and save your practice. Practice does not award XP.
Task 07 .A short task that combines this lesson with earlier ones.
Write run(commands) that starts with an empty task list and handles each command string in order: add TITLE, done N, remove N (N counts from 1) and show. A bad number prints No task N. show prints each task as N. [x] TITLE and then K left. Run it on the commands in the starter so the output is:
No task 9 Removed Shop 1. [x] Bins 2. [ ] Cook 1 left
Sign in to access the interactive Python editor, write and run code checks against automated tests, use hints, and save your practice. Practice does not award XP.