Skip to the content.

3.2 Homework

import json  # make sure to import this or it will break your code

# dict
ferrari_laferrari = {
    "name": "Ferrari LaFerrari",
    "performance": {
        "engine": "6.3-liter V12 hybrid",
        "horsepower": 950,
        "acceleration": "0 to 100 km/h in 2.6 seconds",
        "top_speed": "over 350 km/h"
    },
    "features": {
        "aerodynamics": "active aerodynamics",
        "stability_technologies": "Ferrari Dynamic Enhancer",
        "stability_control": "superb at high speeds"
    },
    "pricing": {
        "original_price": "$1.5 million",
        "production_run": 499,
        "rarity": "exclusive, highly desirable among collectors"
    }
}

# as you can see, you can mix and match different data types such as strings, int/floats, bools, dicts, lists, etc

jsonstring = json.dumps(ferrari_laferrari)

print(jsonstring)

let facts = true
console.log("Magic 8 Ball, does Nolan deserve an A in this class?")
console.log("[8] Magic 8 Ball is thinking ...")
console.log("[8] The ball has decided, that is " + facts)