Ask Question

Write a statement to add the key Tesla with value USA to car_makers. Modify the car maker of Fiat to Italy. Sample output for the given program:

+4
Answers (1)
  1. 30 January, 14:38
    0
    Input code:

    car_makers = {'Honda': 'Japan', 'Fiat': 'Germany'}

    #add Tesla and USA as corresponding value

    car_makers['Tesla'] = 'USA'

    #change Fiat entry to Italy instead of Germany

    car_makers['Fiat'] = 'Italy'

    print (car_makers)

    print ('Honda made in', car_makers['Honda'])

    print ('Fiat made in', car_makers['Fiat'])

    print ('Tesla made in', car_makers['Tesla'])

    Explanation:

    The first line is a define object in the python code, containing two entries of Honda and Fiat and their respective countries.

    The python code adds an entry to the object "car maker" using the bracket notation, the tesla car from USA.

    The country of the Fiat car is changed from Germany to Italy, using the bracket notation.

    The output of the complete object and the individual cars is given.

    output of the python code:

    {'Honda': 'Japan', 'Fiat': 'Italy', 'Tesla': 'USA'}

    Honda made in Japan

    Fiat made in Italy

    Tesla made in USA.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a statement to add the key Tesla with value USA to car_makers. Modify the car maker of Fiat to Italy. Sample output for the given ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers