Please can someone explain what's going wrong here? Unfortunately, I have been tasked to complete this using a function; otherwise, I would've used a built-in function like count() Thanks!
scores = [3,7,6,9,4,3,5,2,6,8]
y = int(input("What score are you searching for in the scores array? "))
a = len(scores)
z = False
def count1(c,b):
for d in range(0,c):
if scores[d] == y:
print("yes")
b = True
return(b)
else:
print("no")
count1(a,z)
if z == True:
print(y, "occurs in the array")
else:
print(y, "does not occur in the array")
my code^
Python 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
= RESTART: C:\Users\18skeffingtonc\
What score are you searching for in the scores array? 3
yes
3 does not occur in the array
the output, after entering what should be a valid input^