My To- DoList 1)
#To-do list Terminal
my_to_do_list = ["Pray",
"Work out" ,
"Breakfast",
"Code_Code_Code",
"Lunchbreak",
"Study",
"Me time/other duties",
"Dinner",
"Netflix & Chill",
"Sleep"]
print(len(my_to_do_list))
# Output: 10
#a)Replace
my_to_do_list[1]= "jogging"
print(my_to_do_list)
#["Pray",
#"jogging" ,
#"Breakfast",
#"Code_Code_Code",
#"Lunchbreak",
#"Study",
#"Me time/other duties",
#"Dinner",
#"Netflix & Chill",
#"Sleep"]
#b)Add
my_to_do_list.append("Cooking")
print(my_to_do_list)
#output
#["Pray",
#"jogging" ,
#"Breakfast",
#"Code_Code_Code",
#"Lunchbreak",
#"Study",
#"Me time/other duties",
#"Dinner",
#"Netflix & Chill",
#"Sleep"
#"Cooking"]
my_to_do_list.insert(4,"Do_laundry")
print (my_to_do_list)
#output
#["Pray",
#"jogging" ,
#"Breakfast",
#"Code_Code_Code",
#"Do_laundry",
#"Lunchbreak",
#"Study",
#"Me time/other duties",
#"Dinner",
#"Netflix & Chill",
#"Sleep"
#"Cooking"]
#c)Remove
my_to_do_list.remove("Do_laundry")
print (my_to_do_list)
#["Pray",
#"jogging" ,
#"Breakfast",
#"Code_Code_Code",
#"Lunchbreak",
#"Study",
#"Me time/other duties",
#"Dinner",
#"Netflix & Chill",
#"Sleep"
#"Cooking"]
my_to_do_list.pop()
print (my_to_do_list)
#["Pray",
#"jogging" ,
#"Breakfast",
#"Code_Code_Code",
#"Lunchbreak",
#"Study",
#"Me time/other duties",
#"Dinner",
#"Netflix & Chill",
#"Sleep"]
#N/B Cooking was removed
#d) Delete
del my_to_do_list[0]
print (my_to_do_list)
#["jogging" ,
#"Breakfast",
#"Code_Code_Code",
#"Lunchbreak",
#"Study",
#"Me time/other duties",
#"Dinner",
#"Netflix & Chill",
#"Sleep"]
#N/B Pray was deleted
del my_to_do_list
# deletes the whole list
- List of Numbers
scores = [20, 15, 12, 19, 27, 30, 26]
scores.sort()
print (scores)
#[12, 15, 19, 20, 26, 27, 30]
scores.reverse()
print (scores)
#[30, 27, 26, 20, 19, 15, 12]
del scores [4:]
print (scores)
#[30, 27, 26, 20 ]
#N/b last 3 numbers were deleted
random_no =[0, 5, 9, 10]
scores.extend(random_no)
print (scores)
#[30, 27, 26, 20, 0, 5, 9, 10]
#N/b 4 more numbers were added.