Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 Complete the code to iterate through the keys and values of the car_prices dictionary, printing out some information about each one. 1. def car_listing(car_prices):

image text in transcribed

1 Complete the code to iterate through the keys and values of the car_prices dictionary, printing out some information about each one. 1. def car_listing(car_prices): result = "" 3- for : result += "{} costs {} dollars". _ + " " return result 7 print(car_listing({"Kia Soul":19900, "Lamborghini Diablo":55000, "Ford Fiesta" :13000, "Toyota Prius":24000})) 2 Use a dictionary to count the frequency of letters in the input string. Only letters should be counted, not blank spaces, numbers, or punctuation. Upper case should be considered the same as lower case. For example, count_letters("This is a sentence.") should return ('t': 2, 'h': 1, 'i': 2, 's': 3, 'a': 1, 'e': 3, 'n': 2, 'c': 1}. 1 - def count_letters (text): 2 result = {} # Go through each letter in the text for letter in : # Check if the letter needs to be counted or not # Add or increment the value in the dictionary return result print(count_letters ("AaBbcc")) # Should be {'a': 2, "b': 2, 'c': 2) print(count_letters ("Math is fun! 2+2=4")) # Should be {'m': 1, 'a': 1, 't': 1, 'h': 1, 'i': 1, 's': 1, 'f': 1, 'u': 1, 'n' 17 17 18 print(count_letters ("This is a sentence.")) # Should be {'t': 2, 'h': 1, "i': 2, 's': 3, 'a': 1, 'e': 3, 'n': 2, 'c': 1)

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

What is the difference between a drill-down and a slicer?

Answered: 1 week ago