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.

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 of activities on this page