6.11. Chapter Assessment

Check your understanding

Write a program that extracts the last three items in the list sports and assigns it to the variable last. Make sure to write your code so that it works no matter how many items are in the list.

Before you keep reading...

Runestone Academy can only continue if we get support from individuals like you. As a student you are well aware of the high cost of textbooks. Our mission is to provide great books to you for free, but we ask that you consider a $10 donation, more if you can or less if $10 is a burden.

Write code that combines the following variables so that the sentence “You are doing a great job, keep it up!” is assigned to the variable message. Do not edit the values assigned to by, az, io, or qy.

Write code to determine how many 9’s are in the list nums and assign that value to the variable how_many. Do not use a for loop to do this.

Write code that uses slicing to get rid of the the second 8 so that here are only two 8’s in the list bound to the variable nums.

Assign the last element of lst to the variable end_elem. Do this so that it works no matter how long lst is.

Assign the number of elements in lst to the variable num_lst.

Create a variable called wrds and assign to it a list whose elements are the words in the string sent. Do not worry about punctuation.

You have attempted 1 of 14 activities on this page