Question: python 3.7.8 The following programs are not working correctly. Find and resolve the error(s) so they work as intended. Above each code snippet is a

python 3.7.8

The following programs are not working correctly. Find and resolve the error(s) so they work as intended. Above each code snippet is a description of how the program should function.

The following function HALF takes a list of numbers and returns True of each element is exactly half the previous, and False otherwise. #Test with the following: #a = [7,5,3,1] returns False #b = [4,3,2,1] returns False #c = [20,10,5] returns True

HALF(nums): for i in range(0,len(nums)-1): if nums[i+1] == (nums[i]*2): pass else: return False return True

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!