Exercise 3
Table of contents
No headings in the article.
Creating a to-do list
mabels_todo_list= ["wake up", "morning devotion", "cook", "eat", "do task assigned to me by my boss", "crochet", "type my project", "learn Spanish on Duolingo", "dance", "dinner", "sleep"]
mabels_todo_list[8]= "take passports"
print(mabels_todo_list)
#output: ['wake up', 'morning devotion', 'cook', 'eat', 'do task assigned to me by my boss', 'crochet', 'type my project', 'learn Spanish on Duolingo', 'take passports', 'dinner', 'sleep']
what_to_do = input ("What do you want to do?")
mabels_todo_list.append(what_to_do)
print (mabels_todo_list)
# output: What do you want to do?
#Bathe
#['wake up', 'morning devotion', 'cook', 'eat', 'do task assigned to me by my boss', 'crochet', 'type my project', 'learn Spanish on Duolingo', 'dance', 'take passports', 'sleep', 'Bathe']
done_list = input ("What have you done?")
mabels_todo_list.remove (done_list)
print (mabels_todo_list)
#output: What have you done? wake up
# ['morning devotion', 'cook', 'eat', 'do task assigned to me by my boss', 'crochet', 'type my project', 'learn Spanish on Duolingo', 'take passports', 'dinner', 'sleep', 'Bathe']
del mabels_todo_list [-1]
del mabels_todo_list [-3]
print (mabels_todo_list)
# # Output: ['morning devotion', 'cook', 'eat', 'do task assigned to me by my boss', 'crochet', 'type my project', 'learn Spanish on Duolingo', 'take passports', 'sleep']
Numbers
class_scores = [20, 9, 50, 1, 52, 100, 89, 57, 60, 40, 36, 63, 95, 85, 15]
class_scores.reverse()
print (class_scores)
# output: [15, 85, 95, 63, 36, 40, 60, 57, 89, 100, 52, 1, 50, 9, 20]
class_scores.sort()
print (class_scores)
#output : [1, 9, 15, 20, 36, 40, 50, 52, 57, 60, 63, 85, 89, 95, 100]
class_scores = class_scores[:-3]
print (class_scores)
#output : [1, 9, 15, 20, 36, 40, 50, 52, 57, 60, 63, 85]
class_scores2 = [3, 7, 8, 11]
class_scores.extend(class_scores2)
print (class_scores)
# output : [1, 9, 15, 20, 36, 40, 50, 52, 57, 60, 63, 85, 3, 7, 8, 11]
#or you can add using append
class_scores = [1, 9, 15, 20, 36, 40, 50, 52, 57, 60, 63, 85]
class_scores.append(3)
class_scores.append(7)
class_scores.append(8)
class_scores.append(11)
print (class_scores)