diff --git a/06_Day_Tuples/06_tuples.md b/06_Day_Tuples/06_tuples.md index 8f40a3dc..2bd21cb8 100644 --- a/06_Day_Tuples/06_tuples.md +++ b/06_Day_Tuples/06_tuples.md @@ -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 @@ -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 @@ -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) diff --git a/08_Day_Dictionaries/08_dictionaries.md b/08_Day_Dictionaries/08_dictionaries.md index 058484e2..d6da7fc0 100644 --- a/08_Day_Dictionaries/08_dictionaries.md +++ b/08_Day_Dictionaries/08_dictionaries.md @@ -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 ``` @@ -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 diff --git a/09_Day_Conditionals/09_conditionals.md b/09_Day_Conditionals/09_conditionals.md index 14db7e54..6408b5dd 100644 --- a/09_Day_Conditionals/09_conditionals.md +++ b/09_Day_Conditionals/09_conditionals.md @@ -49,7 +49,7 @@ if condition: this part of code runs for truthy conditions ``` -**Example: ** +**Example: 1** ```py a = 3 diff --git a/14_Day_Higher_order_functions/14_higher_order_functions.md b/14_Day_Higher_order_functions/14_higher_order_functions.md index e91b8a9c..cba93899 100644 --- a/14_Day_Higher_order_functions/14_higher_order_functions.md +++ b/14_Day_Higher_order_functions/14_higher_order_functions.md @@ -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 ``` @@ -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. diff --git a/21_Day_Classes_and_objects/21_classes_and_objects.md b/21_Day_Classes_and_objects/21_classes_and_objects.md index 9b536b58..e10a64bc 100644 --- a/21_Day_Classes_and_objects/21_classes_and_objects.md +++ b/21_Day_Classes_and_objects/21_classes_and_objects.md @@ -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)] diff --git a/25_Day_Pandas/25_pandas.md b/25_Day_Pandas/25_pandas.md index cbed5f8b..d3acd118 100644 --- a/25_Day_Pandas/25_pandas.md +++ b/25_Day_Pandas/25_pandas.md @@ -1295,14 +1295,15 @@ print(df[df['Ages'] < 120]) ## 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 ! 🎉 diff --git a/26_Day_Python_web/26_python_web.md b/26_Day_Python_web/26_python_web.md index 9265d3cf..a7bfb398 100644 --- a/26_Day_Python_web/26_python_web.md +++ b/26_Day_Python_web/26_python_web.md @@ -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 diff --git a/29_Day_Building_API/29_building_API.md b/29_Day_Building_API/29_building_API.md index 8d8b60a9..9adddfeb 100644 --- a/29_Day_Building_API/29_building_API.md +++ b/29_Day_Building_API/29_building_API.md @@ -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)