Page 337 - Informatics_Practices_Fliipbook_Class12
P. 337
26. Write programs to display the following patterns:
27. Write a program to accept a list of integers, reverse the order of elements in the list, and display the reversed
list. Do NOT use any built-in function or apply slicing in your program. For example, for the given list
[1, 4, 2, 6], the program should output the list [6, 2, 4, 1]
28. Consider the table Athlete given below:
Table: Athlete
Write SQL statements to perform the following tasks
Display the records of category Sub Junior
Change the category of Piyush to Junior
Display the records in alphabetical order of names.
Delete the records of students who are not participating in Event2.
29. Consider the DataFrame weatherDF created given below and write the code snippet for the following
queries:
weatherData = {
'Date': ['2023-01-01', '2023-01-02', '2023-01-03', '2023-01-04', '2023-01-05'],
'Temperature': [15.0, 14.5, 16.2, 13.8, 15.5],
'Humidity': [50, 52, 48, 55, 51],
'Wind_Speed': [10, 12, 9, 11, 13]
}
weatherDF = pd.DataFrame(weatherData)
(i) Retrieve the columns Date and Temperature.
(ii) Retrieve rows with Temperature greater than 15.
(iii) Retrieve rows where Humidity is greater than 50.
(iv) Use the iloc function to select the rows from index 1 to index 3.
(v) Set row labels to ['A', 'B', 'C', 'D', 'E']. Also, display the updated DataFrame.
(vi) Retrieve the summary statistics of the DataFrame.
(vii) Determine the maximum wind speed.
(viii) Retrieve the number of occurrences for each unique value in the Temperature column.
(ix) Add a new column Heat Index to the DataFrame, calculated as a function of temperature and humidity.
Practical 323

