please solve it as Python, use recursion

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

please solve it as Python, use recursion

Post by answerhappygod »

please solve it as Python, use recursion
Please Solve It As Python Use Recursion 1
Please Solve It As Python Use Recursion 1 (26.36 KiB) Viewed 30 times
Scavenger Hunt Function Name: scavengerHunt() Parameters: directions ( list ) Returns: distance_to_prize ( int ) Description: Given a list of directions, signified by strings (either, recursively find the distance from our starting location. signifies a +1 direction towards right, while signifies a −1 direction towards left. ≫> scavengerHunt(['right', 'left', 'right', 'right', 'right']) 3 # right + left + right + right + right =+1−1+1+1+1=3 ≫> scavengerHunt ([′left′, 'left', 'left', 'right']) −2 # left + left + left + right =−1−1−1+1=−2
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply