Question
Python # # Follow the directions below. Add your code below the starter # code to complete the assignment as directed. # # This homework
Python
#
# Follow the directions below. Add your code below the "starter"
# code to complete the assignment as directed.
#
# This homework covers Chapter 3 Strings as Data Structures & Chapter 4 Data Structures: Dictionaries
# 1. Format the following string into title case and print it
varTitle = "once upon a time in a land far far away"
# 2. Create a sequence from the following string (List or Tuple)
varSequence = "over hill over dale as we hit"
# 3. Print a the decimal number 25 as a binary number
varDecimal = 25
# 4. Create a sequence with four string elements. Use the '*' as a separator and join the elements together.
# 5. Print out the left index of the word "night" in the following string
varString = "It was a dark and stormy night in Augusta"
# 6. Create a dictionary from the following sequence
seq = [('color', 'blue'), ('gender', 'female'), ('car', 'toyota')]
# add the following dictionary to the one you just created (i.e., seq should now be BIGGER)
diction2 = {'movie': 'Star Wars'}
# print the combined dictionary
# 7. Create a dictionary from the following sequence and print it out
seq2 = [('color', 'blue'), ('gender', 'female'), ('car', 'toyota')]
# 8. Using the dictionary you created for #7, empty the dictionary of all elements
# 9. Using the empty dictionary you created for #8, attempt to access a dictionary item without causing an error
# 10. Create a list of the VALUES from the following dictionary, then print it
tempDict = {'car': 'Ford', 'country': 'USA', 'continent': 'North America'}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started