Checkpoint 28.5.1.
-
cutPoint
is set to a random location in the list of cardsdeck
. Use it to make a slice which contains list items 0 up to (but not including) thecutPoint
. Store it in a new variabletop
and then print outtop
. Run the program a few times to make sure that you are printing out a random amount of the list each time. Tests 1-2 should now pass. -
Now make a slice that starts at
cutPoint
and goes until the end. Store that slice asbottom
. Print it out and make sure it has the part of the list thattop
does not. Tests 3-4 should now pass. -
Set
deck
to bebottom
plustop
and print what deck becomes. That should reverse the order of the two halves. (Doing+
will merge two lists into one big list.) Printdeck
to see that you did in fact cut the cards and swap the two halves.
Note 28.5.2.
The checks for this program can’t verify it works because it is doing something random. They will just make sure you have some of the basic elements that are needed. Make sure to test your program until you are sure it is working. The checks do depend on you using the specified variable names in your code.