Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

question: 2 what does this program print? heights = 65, 56, 67, 48, 64 …

Question

question: 2
what does this program print?
heights = 65, 56, 67, 48, 64
heights.sort()
heights.extend(60, 61, 62)
heights.remove(67)
print(heights)

48, 56, 64, 65, 60, 61, 62

48, 56, 60, 61, 62, 64, 65

48, 56, 64, 65, 60, 61, 62

the program will error.

Explanation:

Step1: Initial list and sort

Original list: [65,56,67,48,64]. After sort(): [48,56,64,65,67]

Step2: Extend the list

Add [60,61,62] to the list: [48,56,64,65,67,60,61,62]

Step3: Remove element 67

New list: [48,56,64,65,60,61,62]

Step4: Sort the final list

Final sorted list: [48,56,60,61,62,64,65]

Answer:

[48, 56, 60, 61, 62, 64, 65]