Ask Question
27 November, 20:58

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:

+5
Answers (1)
  1. 27 November, 23:55
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers