From da345c7f5a53bd533659c47eb419364b12e663ff Mon Sep 17 00:00:00 2001 From: eslopfer Date: Thu, 19 Jan 2023 15:59:15 +0000 Subject: [PATCH] docs(clean_the_list): add subject description --- subjects/devops/clean_the_list/README.md | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 subjects/devops/clean_the_list/README.md diff --git a/subjects/devops/clean_the_list/README.md b/subjects/devops/clean_the_list/README.md new file mode 100644 index 00000000..1476817c --- /dev/null +++ b/subjects/devops/clean_the_list/README.md @@ -0,0 +1,32 @@ +## clean_the_list + +### Instructions + +Create a file `shopping.py` that contains a function `clean_list` which takes in a list of strings and performs the following operations on each list item: + +- Removes all spaces before and after (but not between words). +- Capitalizes the first letter (first letter only, other ones should be to lowercase). +- Adds its index number before a separator `x/ `. +- An empty list as input should return an empty list as output. +- And don't forget the milk !!!! (add it at the end of the list if missing). + +### Usage + +Here is an example of how to use the clean_list function: + +```python +import shopping +shopping_list = ['tomatoes', 'pastas', 'milk', 'salt'] +print(shopping.clean_list(shopping_list)) +``` + +This will output: + +```console +['1x/ Tomatoes', '2x/ Pastas', '3x/ Milk', '4x/ Salt'] +``` + +### References + +[string strip](https://www.w3schools.com/python/ref_string_strip.asp) +[string capitalize](https://www.w3schools.com/python/ref_string_strip.asp)