List modification in Python
Posted
by
user2945143
on Stack Overflow
See other posts from Stack Overflow
or by user2945143
Published on 2013-11-02T20:45:21Z
Indexed on
2013/11/02
21:54 UTC
Read the original article
Hit count: 204
We are given an algorithm to modify a list of numbers from 1 to 28. There are 5 steps in the algorithm. We have written functions for each step (all correct). We need to write a function that combines all 5 steps. The algorithm modifies the list to get a value. Each time you get a new value, you use the list created by the algorithm from the previous step.
This is what we have gotten so far for the code:
get_card_at_top_index(insert_top_to_bottom(triple_cut((move_joker_2( move_joker_1(deck))))))
When we run the code to generate the get_card_at_top_index, the first answer is correct. However, the rest are not. Instead of using from the new list, python uses the value that it generated from the last step.
What did we do wrong?
UPDATE:
The other 5 codes passed the tests, they are correct.
- Code 1 (List) => list1
- Code 2 (list1) => list2
- Code 3 (list2) => list3
- Code 4 (list3) => list4
- Code 5 (list4) => list5
we generate a number from 5. We need to run the algorithm again to generate 25 more numbers. We will use list 5 start from step 1
© Stack Overflow or respective owner