Computer Science, asked by rxharrisns46, 2 months ago

What will be the output of the following statements?

x=[86,23,45,67,89,90,23,45,67]

a) x.sort()

print(x)

b) print(x[::-2])

print(x)

c) print(x[3:])+x[:3])

print(x)

d) del x[4:]

print(x)

e) del x[:5]

print(x)

Answers

Answered by Equestriadash
8

Given list:

x = [86 ,23, 45, 67, 89, 90, 23, 45, 67]

a) [23, 23, 45, 45, 67, 67, 86, 89, 90]

b)

  • [67, 23, 89, 45, 86]
  • [86 ,23, 45, 67, 89, 90, 23, 45, 67]

c)

  • [67, 89, 90, 23, 45, 67, 86, 23, 45]
  • [86, 23, 45, 67, 89, 90, 23, 45, 67]

d) [86, 23, 45, 67]

e) [90, 23, 45, 67]

  • sort() is a method that sorts the elements in ascending/descending order.
  • del is a command that deletes elements from the list.
Similar questions