Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Asabeneh committed Sep 6, 2020
1 parent d3c9742 commit 29f6622
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 21 deletions.
15 changes: 8 additions & 7 deletions 06_Day_Tuples/06_tuples.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ A tuple is a collection of different data types which is ordered and unchangeabl
- tuple(): to create an empty tuple
- count(): to count the number of a specified item in a tuple
- index(): to find the index of a specified item in a tuple
- - operator: to join two or more tuples and to create a new tuple
- + operator: to join two or more tuples and to create a new tuple

### Creating a Tuple

Expand Down Expand Up @@ -230,11 +230,12 @@ del fruits
4. How many siblings do you have?
5. Modify the siblings tuple and add the name of your father and mother and assign it to family_members
6. Unpack siblings and parents from family_members
7. Create fruits, vegetables and animal products tuples. Join the three tuples and assign it to a variable called food_stuff.
8. Slice out the middle item or items from the food_staff list
9. Slice out the first three items and the last three items from food_staff list
10. Delete the food_staff list completely
11. Check if an item exist in a tuple:
7. Create fruits, vegetables and animal products tuples. Join the three tuples and assign it to a variable called food_stuff_tp.
8. Change the about food_stuff_tp tuple to a food_stuff_lt list
9. Slice out the middle item or items from the food_stuff_tp tuple or food_stuff_lt list.
10. Slice out the first three items and the last three items from food_staff_lt list
11. Delete the food_staff_tp tuple completely
12. Check if an item exists in tuple:

- Check if 'Estonia' is a nordic country
- Check if 'Iceland' is a nordic country
Expand All @@ -243,4 +244,4 @@ del fruits
nordic_countries = ('Denmark', 'Finland','Iceland', 'Norway', 'Sweden')
```

[<< Day 5](../05_Day_Lists/05_list.md) | [Day 7 >>](../07_Day_Sets/07_set.md)
[<< Day 5](../05_Day_Lists/05_lists.md) | [Day 7 >>](../07_Day_Sets/07_sets.md)
4 changes: 2 additions & 2 deletions 08_Day_Dictionaries/08_dictionaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ person = {
}
}
person.pop('first_name') # Removes the firstname item
person.popitem() # Removes the lastname item
person.popitem() # Removes the address item
del person['is_married'] # Removes the is_married item
```

Expand Down Expand Up @@ -326,7 +326,7 @@ print(values) # dict_values(['value1', 'value2', 'value3', 'value4'])

## 💻 Exercises: Day 8

1. Create a an empty dictionary called dog
1. Create an empty dictionary called dog
2. Add name, color, breed, legs, age to the dog dictionary
3. Create a student dictionary and add first_name, last_name, gender, age, marital status, skills, country, city and address as keys for the dictionary
4. Get the length of the student dictionary
Expand Down
2 changes: 1 addition & 1 deletion 09_Day_Conditionals/09_conditionals.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if condition:
this part of code runs for truthy conditions
```

**Example: **
**Example: 1**

```py
a = 3
Expand Down
8 changes: 4 additions & 4 deletions 14_Day_Higher_order_functions/14_higher_order_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,15 +311,14 @@ print(list(long_names)) # ['Asabeneh']
### Python - Reduce Function

The _reduce()_ function is defined in the functools module and we should import it from this module. Like map and filter it takes two parameters, a function and an iterable. However, it doesn't return another iterable, instead it returns a single value.

**Example:2**
**Example:1**

```py
numbers_str = ['1', '2', '3', '4', '5'] # iterable
def add(x, y):
def add_two_nums(x, y):
return int(x) + int(y)

total = reduce(add_two, numbers_str)
total = reduce(add_two_nums, numbers_str)
print(total) # 15
```

Expand Down Expand Up @@ -352,6 +351,7 @@ numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
19. Create a function returning a dictionary, where keys stand for starting letters of countries and values are the number of country names starting with that letter.
20. Declare a get_first_ten_countries function - it returns a list of first ten countries from the countries.js list in the data folder.
21. Declare a get_last_ten_countries function that returns the last ten countries in the countries list.

23. Use the countries_data.py (https://github.com/Asabeneh/30-Days-Of-Python/blob/master/data/countries-data.py) file and follow the tasks below:
- Sort countries by name, by capital, by population
- Sort out the ten most spoken languages by location.
Expand Down
1 change: 0 additions & 1 deletion 21_Day_Classes_and_objects/21_classes_and_objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ print('Range: ', data.range() # 14
print('Mean: ', data.mean()) # 30
print('Median: ', data.median()) # 29
print('Mode: ', data.mode()) # {'mode': 26, 'count': 5}
print('Variance: ', data.var()) # 17.5
print('Standard Deviation: ', data.std()) # 4.2
print('Variance: ', data.var()) # 17.5
print('Frequency Distribution: ', data.freq_dist()) # [(20.0, 26), (16.0, 27), (12.0, 32), (8.0, 37), (8.0, 34), (8.0, 33), (8.0, 31), (8.0, 24), (4.0, 38), (4.0, 29), (4.0, 25)]
Expand Down
9 changes: 5 additions & 4 deletions 25_Day_Pandas/25_pandas.md
Original file line number Diff line number Diff line change
Expand Up @@ -1295,14 +1295,15 @@ print(df[df['Ages'] < 120])
</table>

## Exercises: Day 25
1. Read the hacker_ness.csv file from data directory

1. Read the hacker_news.csv file from data directory
1. Get the first five rows
1. Get the last five rows
1. Get the title column as pandas series
1. Count the number of rows and columns
* Filter the titles which contain python
* Filter the titles which contain JavaScript
* Explore the data and make sense of it
- Filter the titles which contain python
- Filter the titles which contain JavaScript
- Explore the data and make sense of it

🎉 CONGRATULATIONS ! 🎉

Expand Down
2 changes: 1 addition & 1 deletion 26_Day_Python_web/26_python_web.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Python is a general purpose programming language and it can be used for many pla
### Flask

Flask is a web development framework written in python. Flask uses Jinja2 template engine. Flask can be also used with other modern frond libraries such as react.
If you did not install the virtualenv package ye install it first. Virtual environment will allows to isolate project dependencies.
If you did not install the virtualenv package yet install it first. Virtual environment will allows to isolate project dependencies.

#### Folder structure

Expand Down
2 changes: 1 addition & 1 deletion 29_Day_Building_API/29_building_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -492,4 +492,4 @@ if __name__ == '__main__':

🎉 CONGRATULATIONS ! 🎉

[<< Day 28](../28_Day_API/28_API.md) | [Day 29 >>](../30_Day_Conclusions/30_conclusions.md)
[<< Day 28](../28_Day_API/28_API.md) | [Day 30 >>](../30_Day_Conclusions/30_conclusions.md)

0 comments on commit 29f6622

Please sign in to comment.