Complete the code to identify the unique session for a user.
session_id = request.cookies.get([1])The session ID is stored in the cookie named 'session_id' to track the user's session uniquely.
Complete the code to add an item to the shopping cart stored in session.
session['cart'].[1](item_id)
To add an item to the cart list in session, use the 'append' method.
Fix the error in the code to retrieve the cart items safely from session.
cart_items = session.get([1], [])The shopping cart is stored under the key 'cart' in the session dictionary.
Fill both blanks to create a dictionary of item counts in the cart.
item_counts = {item: cart.count([1]) for item in set(cart) if cart.count(item) [2] 1}The dictionary comprehension counts each unique item in the cart if its count is greater than 1.
Fill all three blanks to update the session cart and set cookie expiration.
session[[1]] = updated_cart response.set_cookie([2], session[[3]], max_age=3600)
The cart is stored in session under 'cart'. The cookie named 'session_id' is set with the session cart value and expiration.
