Learn practical skills, build real-world projects, and advance your career
We need to write a program to find the position of a given number in a list of numbers arranged in decreasing order. We also need to minimize the number of times we access elements from the list.

Input
cards: A list of numbers sorted in decreasing order. E.g. [13, 11, 10, 7, 4, 3, 1, 0]
query: A number, whose position in the array is to be determined. E.g. 7
Output
position: The position of query in the list cards. E.g. 3 in the above case (counting from 0)
Based on the above, we can now create the signature of our function:
def location_card(cards,query):
    pass
cards = [13, 11, 10, 7, 4, 3, 1, 0]
query = 7
output = 3
#test 
result = location_card(cards, query)
print(result)
None
result == output
False