Question 4
Answer:
Question 4 Output
array([8 10 12 14 16 18 20])
Question 5
print("Original array:")
Answer:
print(x)
>>>[12 13 14 15 16 17 18 19]
print("Reverse array:")
Answer:
>>>array([19, 18, 17, 16, 15, 14, 13, 12])
Question 6
x = [11, 12, 13]
print("Original array:")
print(x)
Answer:
print("After append values to the end of the array:")
print(x)
Question 6 Output
Original array:
[11,12,13]
After append values to the end of the array:
[21 22 23 24 31 32 33 34]
#Question 4
x = [8, 10, 12, 14, 16, 18, 20]
print("Q.4: Output: ",x)
#Question 5
x = [19, 18, 17, 16, 15, 14, 13, 12]
print("\nQ.5: Original array: ",x)
x = sorted(x)#,reverse=True)
print("Reverse array: ",x)
#Question 6
x = list([11, 12, 13])
print("\nQ.6: Original array: ",x)
x = x+list([21, 22, 23, 24, 31, 32, 33, 34])
print("After append values to the end of the array: ",x)
Comments
Leave a comment