SPL_Patrons = [
['Kim Tremblay', 134, True],
['Emily Wilson', 42, False],
['Jessica Smith', 215, True],
['Alex Roy', 151, True],
['Sarah Khan', 105, False],
['Samuel Lee', 220, True],
['William Brown', 24, False],
['Ayesha Qureshi', 199, True],
['David Martin', 56, True],
['Ajeet Patel',69, False]
]
part a)
goodreaders = [i[0] for i in SPLPatrons if i[1] > 100]
part b)
notteenagers = [i[0] for i in SPLPatrons if i[2] is False]
part c)
savedamount = [i[1] * 9.95 for i in SPLPatrons]
part d)
namesandsavedamount = [(i[0], savedamount[x]) for i in SPLPatrons for x in savedamount if i[2] is True]
print(goodreaders)
print(notteenagers)
print(savedamount)
print(namesandsavedamount)
TypeError: list indices must be integers or slices, not float
Created at: 2018/02/06 19:26; Updated at: 2018/02/07 15:59