Lab: Practice Problems I

More lists and strings

Copy this into a Python file and add the specified code under each comment. For testing purposes, you can comment out working parts as you go (surround the lines with """).

"""
This is how you comment
out a whole block of stuff.
"""
# write python code to...

# create a list holding the strings "alpha", "beta" and "banana"


# using a loop, get two more strings from the user and append them to that list


# using a loop, alter the list so that every string has its position (index) prepended to it
#  e.g. it might end up being "0alpha", "1beta", "2banana", "3bacon", "4cheese"


# using a loop, calculate the total number of characters in all 5 strings in the list


# get a string from the user and replace the third string in the list with it


# create a list containing 4 real numbers (floats)


# using a loop, create another list that holds the cosine of each number in that list
# (recall that the built-in math module has a cosine function named cos)