You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
7-add_item.py - Script that adds all arguments to a Python list, and then save them to a file.
8. Class to JSON
8-class_to_json.py - Function that returns the dictionary description with simple data structure (list, dictionary, string, integer and boolean) for JSON serialization of an object.
9. Student to JSON
9-student.py - Class Student that defines a student with:
Public instance attributes first_name, last_name, and age.
Instantiation with first_name, last_name, and age: def __init__(self, first_name, last_name, age).
Public method def to_json(self) that retrieves a dictionary representation of a Student instance.
10. Student to JSON with filter
10-student.py - Class Student that defines a student. Based on 9-student.py with:
Public method def to_json(self, attrs=None) that retrieves a dictionary representation of a Student instance.
If attrs is a list of strings, only attribute names contained in this list must be retrieved. Otherwise, all attributes must be retrieved.
11. Student to disk and reload
11-student.py - Class Student that defines a student. Based on 10-student.py with:
Public method def reload_from_json(self, json) that replaces all attributes of the Student instance using the key/value pairs listed in json.
The method assumes json is a dictionary containing attributes with name/value corresponding to key/value.
12. Pascal's Triangle
12-pascal_triangle.py - Function that returns a list of lists of integers representing the Pascal’s triangle of n.