Beginner
The type of one cart line
A Cart has a list of lines. Without retyping the line shape, define Line (one entry of Cart["lines"]) and Price (the type of a line's price).
Use indexed access with [number]. Then lineTotal should compile, and the program should print 45.
What Check tests
- Your code has no type errors
- The console prints
45 - A full line is accepted
- A line without
priceandqtyis rejected Priceis a number, not text
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Press Run to see the page.
Console
Nothing printed yet.