PrepAway - Latest Free Exam Questions & Answers

Which two code segments should you use?

You develop a Python application for your company.

A list named employees contains 200 employee names, the last five being company management. You need to slice the list to display all employees excluding management.

Which two code segments should you use? Each correct answer presents a complete solution. (Choose two.)

A. employees [1:-4]

B. employees [:-5]

C. employees [1:-5]
D. employees [0:-4]

E. employees [0:-5]

References: https://www.w3resource.com/python/python-list.php#slice


Leave a Reply