diff --git a/05_Day_Lists/05_lists.md b/05_Day_Lists/05_lists.md index 682d7341..ac18fce3 100644 --- a/05_Day_Lists/05_lists.md +++ b/05_Day_Lists/05_lists.md @@ -209,7 +209,7 @@ all_fruits = fruits[0:4] # it returns all the fruits all_fruits = fruits[0:] # if we don't set where to stop it takes all the rest orange_and_mango = fruits[1:3] # it does not include the first index orange_mango_lemon = fruits[1:] -orange_and_lemon = fruits[::2] # here we used a 3rd argument, step. It will take every 2cnd item - ['orange', 'lemon'] +orange_and_lemon = fruits[::2] # here we used a 3rd argument, step. It will take every 2cnd item - ['banana', 'mango'] ``` - Negative Indexing: We can specify a range of negative indexes by specifying the start, end and step, the return value will be a new list. @@ -477,10 +477,10 @@ lst.reverse() ```py fruits = ['banana', 'orange', 'mango', 'lemon'] fruits.reverse() -print(fruits.reverse()) # ['lemon', 'mango', 'orange', 'banana'] +print(fruits) # ['lemon', 'mango', 'orange', 'banana'] ages = [22, 19, 24, 25, 26, 24, 25, 24] ages.reverse() -print(ages.reverse()) # [24, 25, 24, 26, 25, 24, 19, 22] +print(ages) # [24, 25, 24, 26, 25, 24, 19, 22] ``` ### Sorting List Items diff --git a/06_Day_Tuples/06_tuples.md b/06_Day_Tuples/06_tuples.md index 2bd21cb8..5e54994b 100644 --- a/06_Day_Tuples/06_tuples.md +++ b/06_Day_Tuples/06_tuples.md @@ -9,10 +9,9 @@ Author: Asabeneh Yetayeh
- First Edition: Nov 22 - Dec 22, 2019 + Second Edition: July, 2021
- [<< Day 5](../05_Day_Lists/05_lists.md) | [Day 7 >>](../07_Day_Sets/07_sets.md) @@ -26,7 +25,7 @@ - [Accessing Tuple Items](#accessing-tuple-items) - [Slicing tuples](#slicing-tuples) - [Changing Tuples to Lists](#changing-tuples-to-lists) - - [Checking an Item in a List](#checking-an-item-in-a-list) + - [Checking an Item in a Tuple](#checking-an-item-in-a-tuple) - [Joining Tuples](#joining-tuples) - [Deleting Tuples](#deleting-tuples) - [💻 Exercises: Day 6](#-exercises-day-6) @@ -115,7 +114,7 @@ len(tpl) ### Slicing tuples -We can slice out a subtuple by specifying a range of indexes where to start and where to end in the tuple, the return value will be a new tuple with the specified items. +We can slice out a sub-tuple by specifying a range of indexes where to start and where to end in the tuple, the return value will be a new tuple with the specified items. - Range of Positive Indexes @@ -170,9 +169,9 @@ fruits = tuple(fruits) print(fruits) # ('apple', 'orange', 'mango', 'lemon') ``` -### Checking an Item in a List +### Checking an Item in a Tuple -We can check if an item exists or not in a list using _in_, it returns a boolean. +We can check if an item exists or not in a tuple using _in_, it returns a boolean. ```py # Syntax