Challenge: Sales and Revenue
If you want to multiply rows (or columns) by different values, the length of the vector you use must match the number of rows (or columns) in the matrix. This ensures that each row (or column) element is multiplied by the corresponding value.
Swipe to start coding
You have the selling data for a local furniture store stored in the sellings matrix:
| Month | Sofa | Armchair | Dining table | Dining chair | Bookshelf |
|---|---|---|---|---|---|
| March | 16 | 21 | 30 | 23 | 10 |
| April | 40 | 39 | 13 | 21 | 16 |
| May | 11 | 21 | 36 | 32 | 16 |
And a vector of prices named prices:
| Sofa | Armchair | Dining table | Dining chair | Bookshelf |
|---|---|---|---|---|
| 340 | 150 | 115 | 45 | 160 |
Your tasks are:
- Output the total number of items sold each month.
- Transpose the
sellingsmatrix and reassign the result to thesellingsvariable. - Find out the revenue for each good by multiplying
sellingsandprices. Save the result in theincomevariable. - Output the monthly revenues.
- Output the total three months' revenue.
Solução
Obrigado pelo seu feedback!
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Incrível!
Completion taxa melhorada para 2.27
Challenge: Sales and Revenue
Deslize para mostrar o menu
If you want to multiply rows (or columns) by different values, the length of the vector you use must match the number of rows (or columns) in the matrix. This ensures that each row (or column) element is multiplied by the corresponding value.
Swipe to start coding
You have the selling data for a local furniture store stored in the sellings matrix:
| Month | Sofa | Armchair | Dining table | Dining chair | Bookshelf |
|---|---|---|---|---|---|
| March | 16 | 21 | 30 | 23 | 10 |
| April | 40 | 39 | 13 | 21 | 16 |
| May | 11 | 21 | 36 | 32 | 16 |
And a vector of prices named prices:
| Sofa | Armchair | Dining table | Dining chair | Bookshelf |
|---|---|---|---|---|
| 340 | 150 | 115 | 45 | 160 |
Your tasks are:
- Output the total number of items sold each month.
- Transpose the
sellingsmatrix and reassign the result to thesellingsvariable. - Find out the revenue for each good by multiplying
sellingsandprices. Save the result in theincomevariable. - Output the monthly revenues.
- Output the total three months' revenue.
Solução
Obrigado pelo seu feedback!
single