diff --git a/01_Day_Introduction/helloworld.py b/01_Day_Introduction/helloworld.py index 3e550774..cfded3c6 100644 --- a/01_Day_Introduction/helloworld.py +++ b/01_Day_Introduction/helloworld.py @@ -17,4 +17,5 @@ print(type('Asabeneh')) # String print(type([1, 2, 3])) # List print(type({'name':'Asabeneh'})) # Dictionary -print(type({9.8, 3.14, 2.7})) # Tuple \ No newline at end of file +print(type({9.8, 3.14, 2.7})) # Set +print(type((9.8, 3.14, 2.7))) # Tuple diff --git a/04_Day_Strings/04_strings.md b/04_Day_Strings/04_strings.md index d582fcd6..1d5ea5e1 100644 --- a/04_Day_Strings/04_strings.md +++ b/04_Day_Strings/04_strings.md @@ -373,8 +373,8 @@ print(challenge.index(sub_string, 9)) # error ```py challenge = 'thirty days of python' sub_string = 'da' -print(challenge.index(sub_string)) # 8 -print(challenge.index(sub_string, 9)) # error +print(challenge.rindex(sub_string)) # 8 +print(challenge.rindex(sub_string, 9)) # error ``` - isalnum(): Checks alphanumeric character diff --git a/05_Day_Lists/day_5.py b/05_Day_Lists/day_5.py index 971b4e14..7ffec5e5 100644 --- a/05_Day_Lists/day_5.py +++ b/05_Day_Lists/day_5.py @@ -58,7 +58,7 @@ print(fruits) # ['avocado', 'orange', 'mango', 'lemon'] fruits[1] = 'apple' print(fruits) # ['avocado', 'apple', 'mango', 'lemon'] -last_index = len(fruits) +last_index = len(fruits) - 1 fruits[last_index] = 'lime' print(fruits) # ['avocado', 'apple', 'mango', 'lime'] @@ -80,7 +80,7 @@ fruits = ['banana', 'orange', 'mango', 'lemon'] fruits.insert(2, 'apple') # insert apple between orange and mango print(fruits) # ['banana', 'orange', 'apple', 'mango', 'lemon'] -fruits.list(3, 'lime') # ['banana', 'orange', 'apple', 'mango', 'lime','lemon',] +fruits.insert(3, 'lime') # ['banana', 'orange', 'apple', 'mango', 'lime','lemon',] print(fruits) # remove @@ -92,10 +92,10 @@ # pop fruits = ['banana', 'orange', 'mango', 'lemon'] -fruits.remove() +fruits.pop() print(fruits) # ['banana', 'orange', 'mango'] -fruits.remove(0) +fruits.pop(0) print(fruits) # ['orange', 'mango'] # del @@ -161,10 +161,10 @@ # Reverse fruits = ['banana', 'orange', 'mango', 'lemon'] fruits.reverse() -print(fruits.reverse()) +print(fruits) ages = [22, 19, 24, 25, 26, 24, 25, 24] ages.reverse() -print(ages.reverse()) +print(ages) # sort fruits = ['banana', 'orange', 'mango', 'lemon'] diff --git a/08_Day_Dictionaries/08_dictionaries.md b/08_Day_Dictionaries/08_dictionaries.md index d51b2a9a..20248a1d 100644 --- a/08_Day_Dictionaries/08_dictionaries.md +++ b/08_Day_Dictionaries/08_dictionaries.md @@ -61,7 +61,7 @@ person = { 'age':250, 'country':'Finland', 'is_marred':True, - 'skills':['JavaScript', 'React', 'Node', 'MongoDB', 'Python'] + 'skills':['JavaScript', 'React', 'Node', 'MongoDB', 'Python'], 'address':{ 'street':'Space street', 'zipcode':'02210' diff --git a/12_Day_Modules/12_modules.md b/12_Day_Modules/12_modules.md index 79db3e9d..caa6e94b 100644 --- a/12_Day_Modules/12_modules.md +++ b/12_Day_Modules/12_modules.md @@ -259,7 +259,7 @@ print(randint(5, 20)) # it returns a random integer number between [5, 20] inclu 2. Modify the previous task. Declare a function named user_id_gen_by_user. It doesn’t take any parameters but it takes two inputs using input(). One of the inputs is the number of characters and the second input is the number of IDs which are supposed to be generated. ```py -user_id_gen_by_user() # user input: 5 5 +print(user_id_gen_by_user()) # user input: 5 5 #output: #kcsy2 #SMFYb @@ -267,7 +267,7 @@ user_id_gen_by_user() # user input: 5 5 #ZXOYh #2Rgxf -user_id_gen_by_user() # 16 5 +print(user_id_gen_by_user()) # 16 5 #1GCSgPLMaBAVQZ26 #YD7eFwNQKNs7qXaT #ycArC5yrRupyG00S