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}
1. 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.
L.
Update dogs_dict to reflect the changes made to the dogs list
m. Print the updated dictionary.
2. When your program runs, it should match the expected output below.
Shell - >>> %Run PS4_P1.py List: ['Bulldog', 'Poodle', 'Beagle', 'Terrier'] 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} <<<