34.4k views
2 votes
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:

User Shmiel
by
3.7k points

2 Answers

1 vote

Answer:

car_makers = {'Acura':'Japan','Fiat':'Egypt'}

car_makers['Tesla'] = "USA"

car_makers['Fiat'] = "Italy"

Step-by-step explanation:

python

User Eternal
by
3.5k points
1 vote

Answer:

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'])

Step-by-step 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.

User Yamenk
by
3.4k points