Page 253 - Robotics and AI class 10
P. 253
# Print the dictionary dataset
print("****CITY DATA - DETAILS****")
for city, data in cities.items():
print("CITY: ",city)
print("Avg Temperature: ",data['avg_temp'],"°C")
print("Pollution: ",data['pollution'])
print()
Output:
****CITY DATA - DETAILS****
CITY: Delhi
Avg Temperature: 28 °C
Pollution: High
CITY: Mumbai
Avg Temperature: 32 °C
Pollution: Moderate
CITY: Chennai
Avg Temperature: 30 °C
Pollution: Moderate
CITY: Kolkata
Avg Temperature: 27 °C
Pollution: Moderate
4. Create Numpy arrays
a. Getting elements from Numpy arrays using index values.
b. Numpy array slicing.
c. Getting Numpy array shape and reshaping them.
d. Iterating a Numpy array.
e. Join and split Numpy arrays.
f. Searching and sorting of Numpy arrays,
g. Using mean, median and mode methods given in Numpy,
a. (i) Write program a python program for creating a numpy array of marks and student names and
Ans. import numpy as np
sdata = np.array([('Alisha', 85),
('Sneha', 92),
('Dinesh', 78),
('David', 65),
Assignment 251

