For the complete documentation index, see llms.txt. This page is also available as Markdown.

🎯 Exercise 4

Objective: Practice using Formatter to convert between data formats, and Code Runner to write custom logic when built-in tools are not sufficient.

Activity

Initialize a JSON array variable called products:

[
  {"name": "Laptop", "price": 1200, "quantity": 5},
  {"name": "Mouse", "price": 25, "quantity": 50},
  {"name": "Keyboard", "price": 75, "quantity": 30}
]

Part 1 — Using Formatter: Convert the products array to CSV format using the Formatter tool. Log the CSV output to the Console.

Part 2 — Using Code Runner: Write Python code to calculate the total inventory value (price × quantity for each product, then sum them all). Return the result and log it to the Console.

Expected Output:

CSV Format:
name,price,quantity
Laptop,1200,5
Mouse,25,50
Keyboard,75,30
Total Inventory Value: 9500

Last updated

Was this helpful?