August 2020
Intermediate to advanced
508 pages
11h 53m
English
Suppose we’re writing software for a clothing manufacturer. Our code accepts an array of newly produced clothing items (stored as strings), and creates text for every possible label we’ll need.
Specifically, our labels should contain the item name plus its size, ranging from 1 to 5. For example, if we have the array, ["Purple Shirt", "Green Shirt"], we want to produce label text for those shirts like this:
| | [ |
| | "Purple Shirt Size: 1", |
| | "Purple Shirt Size: 2", |
| | "Purple Shirt Size: 3", |
| | "Purple Shirt Size: 4", |
| | "Purple Shirt Size: 5", |
| | "Green Shirt Size: 1", |
| | "Green Shirt Size: 2", |
| | "Green Shirt Size: 3", |
| | "Green Shirt Size: 4", |
| | "Green Shirt Size: 5" |
| | ] |
Here is Python code that will create this text for an entire array of clothing ...
Read now
Unlock full access