Page 1 of 1

coin strip photo of question below i have done the code but it doesnt pass all tests shown in thr photos

Posted: Sun May 15, 2022 12:32 pm
by answerhappygod
coin strip
photo of question below
i have done the code but it doesnt pass all tests shown in thr photos
Coin Strip Photo Of Question Below I Have Done The Code But It Doesnt Pass All Tests Shown In Thr Photos 1
Coin Strip Photo Of Question Below I Have Done The Code But It Doesnt Pass All Tests Shown In Thr Photos 1 (25.36 KiB) Viewed 68 times
Coin Strip Photo Of Question Below I Have Done The Code But It Doesnt Pass All Tests Shown In Thr Photos 2
Coin Strip Photo Of Question Below I Have Done The Code But It Doesnt Pass All Tests Shown In Thr Photos 2 (25.36 KiB) Viewed 68 times
Coin Strip Photo Of Question Below I Have Done The Code But It Doesnt Pass All Tests Shown In Thr Photos 3
Coin Strip Photo Of Question Below I Have Done The Code But It Doesnt Pass All Tests Shown In Thr Photos 3 (17.4 KiB) Viewed 68 times
Coin Strip Photo Of Question Below I Have Done The Code But It Doesnt Pass All Tests Shown In Thr Photos 4
Coin Strip Photo Of Question Below I Have Done The Code But It Doesnt Pass All Tests Shown In Thr Photos 4 (62.17 KiB) Viewed 68 times
Coin Strip Photo Of Question Below I Have Done The Code But It Doesnt Pass All Tests Shown In Thr Photos 5
Coin Strip Photo Of Question Below I Have Done The Code But It Doesnt Pass All Tests Shown In Thr Photos 5 (24.5 KiB) Viewed 68 times
Coin Strip Photo Of Question Below I Have Done The Code But It Doesnt Pass All Tests Shown In Thr Photos 6
Coin Strip Photo Of Question Below I Have Done The Code But It Doesnt Pass All Tests Shown In Thr Photos 6 (24.5 KiB) Viewed 68 times
Complete the valitate, con list, position, to ve function. This function takes the consis, the position of the $ symbol to be moved and the number of positions to move as parameters. The function returns True if the number of places to move is a valid number is the coin will always end up in an empty location and will never tand on ot pass another coin and return false otherwise. For example, consider the following code fragment data- "S'. print validate wive(data, . 2) print(validate_move(data) The second statement checks if the element at index 3 and index 2 are not equal to $. The third statement checks if the element at index index 4 and index 3 are not equal to Note: you can assume that the element at the given index position number 1) is equal to : For example: Test Result duto ..'S.... 5'. print validate_ovedata, 5.2) invalliveduta 1)) Falu print(ledate. 3. 53) printivaltiovet. 3. ) '5', true erintivalidteavedat, 21)) True print(valdate_dat 7, 1)) Answer: (penalty regime: 0% Focate

Tile Edit Format Ran Options Window Hele Det validate move (coins last position_humber. to move - position number 1 length - len(coins list) 1tic or islength coins listi ta it ito_movec and ico_novelength-1: en als 11- Bovec If coin listrito_move+1}.count(*) - toth This elit ito novelength-1 it coin isti-to move :) .count) es else it coins_list[i+1:1 to move+1}.count('') - 0 coins list[i-to move111.count(5) -0 retur

Test Expected Got True data = ['-', '', -', -', 's', '.', $', '$', '-'] True print(validate_move(data, 5, 2)) False print(validate_move(data, 3, 1)) False print(validate_move (data, 2, 5)) False print(validate_move (data, 5, 3)) False False False True data = ['-', 'S', '', '', $', '-', '$', '$', '-'] True print(validate_move(data, 2, 1)) True print(validate_move (data, 7, 1)) True x x X data = ['-', '$', 's', 's', '-', print(validate_move(data, 9, 1)) print(validate_move(data, 4, 2)) -', '$'] True False True True True X X False data = ['-', 's', 's', '-', '', '', '', '', $'] False print(validate_move(data, 3, 3)) False print(validate_move(data, 7, 4)) True print(validate_move(data, 7, 3)) True Your code must pass all tests to earn any marks. Try again.

Complete the validateve commit position numbers to move) function. This function takes the coins list, the position of the $ symbol to be moved and the number of positions to move as parameters. The function returns True if the number of places to move is a valid number in the coin will always end up in an empty location and will never land on or pass another coin, and returns False otherwise. For example, consider the following code fragment date, privalidate(t, 2)) print(valdatudta, .))) The second statement ched it the elementat index 3 and index 2 are not equal to $. The third statement checks if the elementat index index 4 and index3 are not equal to's Note: you can assume that the element at the given index (le position number 1) is equal to 5 For example: Test Result Printvett, print validated,>, 1)) print(alidate(data, 2,5)) - True tai False 1 T data- or invalid. 1)) print (alidate data,1,1) Answer hat eine