Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

One of these answers are incorrect. How do I fix this? 7 9/12 points (note: Since there are multiple ways to solve each problem, to

image text in transcribedOne of these answers are incorrect. How do I fix this?

7 9/12 points (note: Since there are multiple ways to solve each problem, to make each solution unique for auto-grading, you should use default bounds in index-slicing when they can work:That is, when a bound can be omitted, you should omit it.) Let Lbe the list L=['A', 'B', 'c','d', 'e','f','g', 'h']. The following four commands using index slicing obtain the shown sub-lists: ['A', 'c', 'e','g'l=cmd1 ['B', 'd', 'f', 'h']=cmd2 ['h', 'f', 'd', 'B']=cmd3 ['g, 'e', 'c','A']=cmd4 Put the explicit commands in the provided boxes: (Hint: The index step lengths are all 2. Some slicings are forward, some are backward. For the backward slicing cases, use negative index, do not use positive index, you do not need to count the total length to do backward slicing. For example, backward starting from the last position to the beginning with step 1, you can use either L[-1:-1] or simply omit the initial index as L[::-1]. Since this problem only accepts the default bound if a default works, your should only submit L[::-1]) cmd1= E L[::2] ; cmd2= E. L[1::2] ; cmd3= Fo L[::-2] ; cmd4= E L[6::-2] 7 9/12 points (note: Since there are multiple ways to solve each problem, to make each solution unique for auto-grading, you should use default bounds in index-slicing when they can work:That is, when a bound can be omitted, you should omit it.) Let Lbe the list L=['A', 'B', 'c','d', 'e','f','g', 'h']. The following four commands using index slicing obtain the shown sub-lists: ['A', 'c', 'e','g'l=cmd1 ['B', 'd', 'f', 'h']=cmd2 ['h', 'f', 'd', 'B']=cmd3 ['g, 'e', 'c','A']=cmd4 Put the explicit commands in the provided boxes: (Hint: The index step lengths are all 2. Some slicings are forward, some are backward. For the backward slicing cases, use negative index, do not use positive index, you do not need to count the total length to do backward slicing. For example, backward starting from the last position to the beginning with step 1, you can use either L[-1:-1] or simply omit the initial index as L[::-1]. Since this problem only accepts the default bound if a default works, your should only submit L[::-1]) cmd1= E L[::2] ; cmd2= E. L[1::2] ; cmd3= Fo L[::-2] ; cmd4= E L[6::-2]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions