Skip to content

ReDi-school-Berlin/week-5--homework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Homework for Week 5

(Scroll down for some reminder on cloning this repository and making commits)

Exercises:

Exercise 1

From given list

```
gadgets = [“Mobile”, “Laptop”, 100, “Camera”, 310.28, “Speakers”, 27.00,
“Television”, 1000, “Laptop Case”, “Camera Lens”]
```

a)create separate lists of strings and numbers.

b)Sort the strings list in ascending order

c)Sort the strings list in descending order

d)Sort the number list from lowest to highest

e)Sort the number list from highest to lowest

Hints:

  • You can check data type using isinstance(item, str)
  • You can use list sort function

Exercise 2

From given list

```
numbers = [3,8,1,7,2,9,5,4]

Finds the largest number in a list

Exercise 3

Create shopping_list, with list of all the things that you need to buy, e.g. cheese, apple and banana. Create dictionary shop, where keys are products names, e.g. apple or banana, and values is how many items there are in the shop. Create dictionary prices, where keys are products and values are prices of the products. Calculate the remaining number of items in the shop and calculate a price of products from your shopping list.


Bonus Exercise:

This exercise is totally optional, but you can do it if you are up for a challenge. Get first, second best scores from the list.

Remeber: List may contain duplicates.

Ex: [86,86,85,85,85,83,23,45,84,1,2,0] => should get 86, 85

What you need to do to publish your code

  1. Download (clone) this repository to your computer by clicking on Code, copying the URL from there and then putting the following command in VSCode terminal: git clone {url_you_copied}
  2. Open it in VSCode
  3. Open the main.py file
  4. Edit the file (instructions are directly in the file)
  5. Push your changes to GitHub

Hint: pushing changes to GitHub

  • Click on the Git button in VSCode
    git-button
  • Prepare (=stage) any changes you want to commit with the + button next to the file name
    change
  • Add a commit message
    image
  • Click the ✅ button to commit your changes
    image
  • Click on the icon in the bottom left part of VSCode to push your changes to GitHub (will look like either of the images below)
    image image

Releases

No releases published

Packages

No packages published