[Solved]Q1 Lists 05 Points Results Hypothetical Experiment Measuring Height Class Land Far Away Ma Q37128126
Need help coding this assignment



Q1-Lists (0.5 points) Below are the results of a hypothetical experiment of measuring the height of a class in a land far away: Mario is 5.6 feet tall Sarai is 5.4 feet tall Demi is 6.2 feet tall lan is 5.8 feet tall Dawn is 5.7 feet tall Create a list, called class_names and fill it with the names of each person in the class. Create another list, called class_heights and fill it with the heights of each person in the class. Remember that the order of lists matters, and so make sure to keep the order of items the same as listed above! In [24]: # rouR CODE HERE class_names Mario’, ‘Sarai’, ‘Demi, ‘Ian’, ‘Dawn’ class heights – [5.6, 5-4, 6-2, 5.8, 5.7 In [ ]: # Tests for Q1 # Check both lists are defined assert isinstance(class_names, list) assert isinstance(class_heights, list) # Check both lists have the same length, and are of length 5 assert len(class-names)-len (class-heights) 5 1entelass heighta Now that we have the data stored in lists, we will explore other collection types. Q2-Tuples (0.25 points) Create a tuple, that contains just the names of the people in the experiment. Call this tuple ‘names tuple’ In [32]: # YOUR CODE HERE names-tuple . ( Mario’ , print (names_tuple) ‘ Sarai ‘ , ‘ Demi ‘ , ‘ Ian ‘ , ‘ Dawn’ ) ‘Mario’ ‘Sarai’, ‘Demi’, Ian’ Dawn In : assert isinstance (names_tuple, tuple) Q3- Dictionaries (0.25 points) Next, store the data into a dictionary, where each student’s name is the key and their height is the value Call this dictionary results_dictionary In [56]: # YOUR CODE HERE In [ assert isinstance (results_dictionary, dict) Q4 – Lists of Lists (0.5 points) You can also make lists, that are filled with lists! List-ception. First, create three different lists: .A list called string_list that contains three strings (can be any strings) .A list called number_list that contains three numbers (can be any numbers-int or float) A list called boolean_list that contains three boolean (can be any booleans) Then, create a new list, called nested_list which contains the three lists you created above. In [ ]: YOUR CODE HERE In : assert isinstance(string_list, list assert len (string list)3 assert isinstance(string_list[o], str) assert isinstance (number list, list) assert len (number_list)3 assert isinstance(number_list[o], int) or isinstance (number_list[o], float) assert isinstance(boolean_list, list) assert len (boolean_list)3 assert isinstance(boolean_list[o],bool) In assert isinstance(nested list, list assert len (nested_list)3 assert isinstance(nested_list[0], list) Show transcribed image text Q1-Lists (0.5 points) Below are the results of a hypothetical experiment of measuring the height of a class in a land far away: Mario is 5.6 feet tall Sarai is 5.4 feet tall Demi is 6.2 feet tall lan is 5.8 feet tall Dawn is 5.7 feet tall Create a list, called class_names and fill it with the names of each person in the class. Create another list, called class_heights and fill it with the heights of each person in the class. Remember that the order of lists matters, and so make sure to keep the order of items the same as listed above! In [24]: # rouR CODE HERE class_names Mario’, ‘Sarai’, ‘Demi, ‘Ian’, ‘Dawn’ class heights – [5.6, 5-4, 6-2, 5.8, 5.7 In [ ]: # Tests for Q1 # Check both lists are defined assert isinstance(class_names, list) assert isinstance(class_heights, list) # Check both lists have the same length, and are of length 5 assert len(class-names)-len (class-heights) 5 1entelass heighta Now that we have the data stored in lists, we will explore other collection types.
Q2-Tuples (0.25 points) Create a tuple, that contains just the names of the people in the experiment. Call this tuple ‘names tuple’ In [32]: # YOUR CODE HERE names-tuple . ( Mario’ , print (names_tuple) ‘ Sarai ‘ , ‘ Demi ‘ , ‘ Ian ‘ , ‘ Dawn’ ) ‘Mario’ ‘Sarai’, ‘Demi’, Ian’ Dawn In : assert isinstance (names_tuple, tuple) Q3- Dictionaries (0.25 points) Next, store the data into a dictionary, where each student’s name is the key and their height is the value Call this dictionary results_dictionary In [56]: # YOUR CODE HERE In [ assert isinstance (results_dictionary, dict)
Q4 – Lists of Lists (0.5 points) You can also make lists, that are filled with lists! List-ception. First, create three different lists: .A list called string_list that contains three strings (can be any strings) .A list called number_list that contains three numbers (can be any numbers-int or float) A list called boolean_list that contains three boolean (can be any booleans) Then, create a new list, called nested_list which contains the three lists you created above. In [ ]: YOUR CODE HERE In : assert isinstance(string_list, list assert len (string list)3 assert isinstance(string_list[o], str) assert isinstance (number list, list) assert len (number_list)3 assert isinstance(number_list[o], int) or isinstance (number_list[o], float) assert isinstance(boolean_list, list) assert len (boolean_list)3 assert isinstance(boolean_list[o],bool) In assert isinstance(nested list, list assert len (nested_list)3 assert isinstance(nested_list[0], list)
Expert Answer
Answer to Q1-Lists (0.5 points) Below are the results of a hypothetical experiment of measuring the height of a class in a land fa… . . .
OR

