mirror of https://github.com/01-edu/public.git
docs(shopping): update subject
This commit is contained in:
parent
32660b2aa0
commit
2a9823cfee
|
@ -1,10 +1,10 @@
|
|||
# shopping
|
||||
## shopping
|
||||
|
||||
## Instructions
|
||||
### Instructions
|
||||
|
||||
Create a file `shopping.py` with a function `remember_the_apple(shopping_list)`.
|
||||
|
||||
This function input is a list of string, like this:
|
||||
This function input is a list of strings, like this:
|
||||
|
||||
```python
|
||||
['tomatoes', 'pastas', 'apple', 'salt']
|
||||
|
@ -14,28 +14,28 @@ If the string `'apple'` is not in the list, it should be added. The function ret
|
|||
|
||||
If the input list is empty, the returned list should be also empty (don't add the apple in that case).
|
||||
|
||||
## Usage
|
||||
### Usage
|
||||
|
||||
Here is a possible `test.py` to test your functions:
|
||||
Here is a possible `test.py` to test your function:
|
||||
|
||||
```python
|
||||
import shopping
|
||||
|
||||
if __name__ == '__main__':
|
||||
list_with_apple = ['tomatoes', 'pastas', 'apple', 'salt']
|
||||
list_without_apple = ['tomatoes', 'pastas', 'salt']
|
||||
list_with_apple = ['tomatoes', 'pastas', 'apple', 'salt']
|
||||
list_without_apple = ['tomatoes', 'pastas', 'salt']
|
||||
|
||||
print(shopping.remember_the_apple(list_with_apple))
|
||||
print(shopping.remember_the_apple(list_without_apple))
|
||||
print(shopping.remember_the_apple(list_with_apple))
|
||||
print(shopping.remember_the_apple(list_without_apple))
|
||||
```
|
||||
|
||||
```bash
|
||||
$ python test.py
|
||||
['tomatoes', 'pastas', 'apple', 'salt']
|
||||
['tomatoes', 'pastas', 'salt', 'apple']
|
||||
$
|
||||
```
|
||||
|
||||
## Notions
|
||||
### Notions
|
||||
|
||||
- [lists](https://docs.python.org/3/tutorial/datastructures.html#)
|
||||
- [Lists](https://docs.python.org/3/tutorial/datastructures.html#)
|
||||
- [Conditions](https://docs.python.org/3/tutorial/datastructures.html#more-on-conditions)
|
||||
|
|
Loading…
Reference in New Issue