Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this problem, follow these steps: Create a list named dogs containing the following elements: Bulldog , Poodle , Beagle , and Terrier . Print

For this problem, follow these steps:
Create a list named dogs containing the following elements: Bulldog,Poodle,Beagle, and Terrier.
Print the list.
Convert the dogs list to a tuple named dogs _tuple.
Print the tuple.
Convert the dogs list to a set named dogs _set.
Print the set.
Convert the dogs list to a dictionary named dogs _dict that contains the dogs as keys and their lengths as values:
Lengths being the size of the word (key)- Bulldog is 7, Poodle is 6, but these should not be hardcoded values, you need to use the len() function to gather the length of the key.
Print the dictionary.
Add Pug and Chihuahua to the dogs list.
Remove Beagle from the dogs list.
Print the updated list.
Update dogs_dict to reflect the changes made to the dogs list.
Print the updated dictionary.
When your program runs, it should match the expected output below.For this problem, follow these steps:
a. Create a list named dogs containing the following elements:
"Bulldog", "Poodle", "Beagle", and "Terrier".
b. Print the list.
c. Convert the dogs list to a tuple named dogs _tuple.
d. Print the tuple.
e. Convert the dogs list to a set named dogs _set.
f. Print the set.
g. Convert the dogs list to a dictionary named dogs _dict that
contains the dogs as keys and their lengths as values:
i. Lengths being the size of the word (key)- Bulldog is 7,
Poodle is 6, but these should not be hardcoded values, you
need to use the len() function to gather the length of the key.
h. Print the dictionary.
i. Add "Pug" and "Chihuahua" to the dogs list.
j. Remove "Beagle" from the dogs list.
k. Print the updated list.
I. Update dogs_dict to reflect the changes made to the dogs list.
m. Print the updated dictionary.
When your program runs, it should match the expected output below.
Tuple: ('Bulldog', 'Poodle', 'Beagle', 'Terrier')
Set: {'Beagle', 'Terrier', 'Poodle', 'Bulldog'}
Dictionary: {'Bulldog': 7, 'Poodle': 6, 'Beagle': 6, 'Terrier': 7}
Updated List: ['Bulldog', 'Poodle', 'Terrier', 'Pug', 'Chihuahua']
Updated Dictionary: {'Bulldog': 7, 'Poodle': 6, 'Terrier': 7, 'Pug': 3, 'Chihuahua': 9}
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

1. In what ways has flexible working revolutionised employment?

Answered: 1 week ago