Complete the create coins list function. This function returns a list of and 4 randomly placed "s' symbols. The total le

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Complete the create coins list function. This function returns a list of and 4 randomly placed "s' symbols. The total le

Post by answerhappygod »

Complete The Create Coins List Function This Function Returns A List Of And 4 Randomly Placed S Symbols The Total Le 1
Complete The Create Coins List Function This Function Returns A List Of And 4 Randomly Placed S Symbols The Total Le 1 (48.54 KiB) Viewed 37 times
Complete the create coins list function. This function returns a list of and 4 randomly placed "s' symbols. The total length of the list which is returned by this function will always be 9. To randomly place the "s" symbols, start off with a coins list of ['-''S' 'S', '-') and call the move_random_character_to_end(coins_list) function 4 times Note: • Copy your answer from the previous question (ie the move_random_character_to_end() function into the answer box below. • Do not import the random module. This has been done for you as part of the CodeRunner question For example: Test Result $0 random seed(30) I'S', '., 's coins_list = create_coins_list() $-$-$-$ print(coins_list) print.join(coins_list)) random seed(20) coins_list = create_coins list() print(coins_list) $','.' Answer: (penalty regime: 0 %) Reset answer 3 1.def move_random_character_to_end(coins_list): 2 random_position = random.randint(0, len(coins_list) -1) # generating a random position coins_list.append(coins_list[random_position]) # adding the coin to a random position in the list 4 coins_list.pop(random_position) # using pop to remove the coin at a random position 7. def create_coins_list(): 5 6
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply