Objective
TOML is the modern configuration format of Python (pyproject.toml uses it). With tomllib (Python 3.11+) a file becomes dictionaries and lists with real types: strings, integers, booleans and lists.
Instructions
- The file
config.tomlexists with the keytitle, a table[server]with the listportsand, optionally, a list of tables[[users]]withnameandrole. - Show the title,
Ports: sumwith the sum of the ports and one linename (role)for each user. Remember to open the file in binary mode.
Demo
Ports: 8603
ana (admin)
luis (guest)
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise