Question: Here is my code and 3 reflection questions can you please help in answering them 1. Which functions did you use a nested structure (nested



Here is my code and 3 reflection questions can you please help in answering them
1. Which functions did you use a nested structure (nested loops, nested conditionals, etc) to implement the requirements? Would it have been possible to implement them without using a nested structure? Which functions did you not use a nested structure? Would it have been possible to implement them with a nested structure? 2. Suppose we wanted to create an additional map classification called 'Urban City' which is indicated by the number of 'R' cells plus the number of 'C' cells being between 60% and 80%. Can we do this? How might this affect our classify_map() function? 3. How many test cases would you need to confirm that your classify_map() function correctly identifies a "Farmland" map? Explain what your test cases would be. 5 def count_type (map_data, map_type): 6 count = 0 # count variable to store the count 7 for i in map_data: 8 for j in i: 9 if j == map_type: LO count += 1 11 return count 12 #For this function I am using nested loops and inside the inner loop I am checking if the element is equal to map 13 14 #******************************************** 15 # Write your classify_map function below: (4 marks) 16 #******************************************** 17 18 def classify_map (map_data): 19 # calculating the total count of data points in the map_data 20 for i in map_data: 21 # conditions check 22 if count_type(i, "R") > (len(map_data)*len(i))/2: 23 return "Suburban" 24 elif count_type(i, "A") > (len (map_data) *len(i))/2: 25 return "Farmland" 26 elif (count_type(i, "U") + count_type(i, "U")) > (len (map_data) *len(i))/2: 27 return "Conversation" 28 elif (count_type(i, "C") > (len (map_data) *len(i)/2)) and (count_type(i, "U") 29 + count_type(i, "A")) >= 0.1* len(map_data) * len(i) and (count_type(i, "U") 30 + count_type(i, "A"))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
