Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Problem Description: An undergraduate student researcher is working on some data for a climato study. Help the student with the Python skills that you

Python image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Problem Description: An undergraduate student researcher is working on some data for a climato study. Help the student with the Python skills that you have learned so far Specific tasks for this problem are given below, Task-1 (2 pointa): The student is working on a data structure data that is given in the coll below and it contains the temperature values in Celsius of different cold regions in the United States. Run the cell below and the questions to be answered for this task are: 1) What type of data structure is stored in the variable name data? 2) What kind of data types are present inside data? In 1: data - 12, 12, s.8, 1, 6, 21.0, 5, 2.2, 6, 4, 7.4, 2, 9, 10, 6, 15, , 'winter'] print("Student's data:" data) GIVE THE SOLUTION FOR THE QUESTIONS 1) AND 2) OF TASK-1 IN THE MARKDOWN CELL BELOW (CLICK ON THE MARKDOWN CELL BELOW TWICE TO GIVE THE ANSWERS): Type Markdown and LaTeX: a? Task 2 (2 points): The student realizes that there is a non-number i.e., a string data type inside the data structure data. Can you help the student to remove that string data type from the data structure data? After removing the string data type, please print the data structure data to the output and check whether you have successfully removed it. Note: To do this task, you must use an in-built function that was discussed in the lecture class to remove the string data type based on its index position from the data structure data. Also, after using the correct in-built function below, do not run the cell twice because when you run the cel once, the function that you implement would have removed the element that you want to remove and running the cell for the second time will throw an error as that element would have already been removed when you ran the cell the first time itself and the removed element cannot be found anymore. In 1: #GIVE THE SOLUTION FOR TASK-2 IN THIS CELL: Task-3 (2 points): The student finds that the data structure data still has mistakes. The student realizes that every number that is a 6 inside the data structure data, should have actually been the number 9. The student has tried to rectify this by writing a function in the cell below to replace the number 6 with number 9 however he is struggling to complete the function. Can you help the student to complete the function below by giving your answers in the places where you find the TRIPLE QUOTES 60 that the student can successfully replace the number 6 with number 99 Note: After completing the function in the cell below, run the cell and check whether the number 6 has been replaced with the number 9 successtudy in the corrected data structure that is stored in a new variable name correct data. In other words, if you complete the function in the cell below correctly, you should not see the number 6 in the data structure correct data anymore. In 1: COMPLETE THE FUNCTION BELOW WHERE YOU FIND TRIPLE QUOTES IN THIS CELL TO FINISH TASK-3: def error_correction(data): # Creating an empty list and storing it in a new variable name 'corrected_data' corrected_data = [] for din data: if dw 6: # Appending the values to the list 'corrected_name corrected_data.append("GIVE YOUR ANSWER HERE) else: # Appending the values to the list 'corrected_name' corrected_data.append("GIVE YOUR ANSWER HERE) return corrected_data I correct_data - error correction(data) print("Student's corrected data:", correct_data) Task-4 (2 points): Now, the student wants to keep track of the frequency of occurence of number 9 in the correct_data. The student is trying to implement a condition to check for the number 9 by looping over the data structure correct data to see how many times the number 9 is repeated inside it. However, the student has no idea as to what condition must be implemented. Could you please help the student by filling in the condition in the place where you find the TRIPLE QUOTES inside the loop below? Note: After implementing the correct condition, run the cell and check if the output matches with the frequency of occurences of number inside the data structure correct_data by looking at it manually. In 1: COMPLETE THE CONDITION INSIDE THE LOOP BELOW WHERE YOU FINO TRIPLE QUOTES IN THIS CELL TO FINISH TASK47 counter for e in correct data: if GIVE YOUR CONDITION HERE: counter - counter + 1 print("Frequency of occurence of number 9:", counter) Task-5 (2 points): The student is now interested in getting the numbers that are odd and divisible by 3 (both the condition must be satisfied) from the data structure correct_data. He is not giving up on his research and is again writing a function below to get all the number that satisfy both the given conditions from the data structure correct data. However, he cannot implement the condition correctly and asks you for help to write the condition in the place where you find TRIPLE QUOTES that could help the student in picking all the numbers that are odd and divisible by 3 from the data structure correct data. Note: Atter implementing the correct conditions, run the cell and check if the numbers in the data structure odd_and_div_3_data that you get in the output satisfies the conditions that the numbers are odd and divisible by 3 by manually checking each of the numbers carefully In 1 1: COMPLETE THE CONDITION INSIDE THE FUNCTION BELOW WHERE YOU FIND TRIPLE QUOTES IN THIS CELL TO FINISH TASK-S: det odd_and_div_3_func(correct_dota): condition_data - D for f in correct_data: if GIVE YOUR CONDITIONS HERE: condition_data.append() return condition data odd_and_div_3_data = odd_and_div_3_func(correct_data) print("Nombers that are odd and divisible by 3:", even_and_div_3_data) -ERROR -END OF PROBLEM-1- -ERROR

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sybase Database Administrators Handbook

Authors: Brian Hitchcock

1st Edition

0133574776, 978-0133574777

More Books

Students also viewed these Databases questions