0% found this document useful (0 votes)
9 views1 page

Experiment 14

The document outlines an experiment to implement a program that creates a dictionary using key-value pairs to record temperature data for various cities. The program generates random temperature values and updates the dictionary accordingly. The conclusion states that the program successfully allows for adding, retrieving, removing, and displaying entries in the dictionary.

Uploaded by

Ayush Gautam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Experiment 14

The document outlines an experiment to implement a program that creates a dictionary using key-value pairs to record temperature data for various cities. The program generates random temperature values and updates the dictionary accordingly. The conclusion states that the program successfully allows for adding, retrieving, removing, and displaying entries in the dictionary.

Uploaded by

Ayush Gautam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

EXPERIMENT 14

Objective: To implement a program to make a dictionary using key-value pair.


Source code:
import time
import random
temperature_data={}
cities=['Una','Delhi','Varanasi','Dehradun','Lucknow']
for i in range(5):
print(f"---Recording data{i+1}---")
for city in cities:
temperature=round(random.uniform(15,32),2)
temperature_data[city]=temperature
print("updated temperature data:",temperature_data)
time.sleep(3)

Input and output:

Conclusion: The program to make a dictionary using key value pair has been successfully
implemented. It allows me to add, retrieve, remove, and display entries as well.

You might also like