self teaching myself how to code and starting with this book and a Udemy course.
have been working on this practice project for 2 days now and I keep running into "Local variable 'streaks' not used when I have the streak counter placed inside the htcheck function even though I'm Cleary defining the variable, I tried placing the streak variable outside of the function at the top of the code to declare as it a global value but that still doesn't work and then I get the "Shadow name" error.
what the code should be doing is flipping a coin 10000 times then checking for streaks of 6 then present the user with how many streaks of 6 occurred and a percent value of how often a streak of 6 was, I'm sure a lot of you have seen this question been asked before as it's from Al Sweigart's Automate The Boring Stuff with python 2nd edition <- I just cant find the answer to my specific error hence this post.
I just need help with figuring out why my variable ' streaks = 0 ' isn't working as shown below. and why it doesn't work as a global variable declared where I have heads tails and x. I would prefer a solution that keeps streaks inside the htcheck function but i'm open to any and all solutions.
Thank you in advance.
# Automate Python - Coin Flips Streaks
heads = []
tails = []
x = 0
#Flips a coin, then stores result into respective list
def coinflip():
    y = random.randint(0, 1)
    if y == 0:
        heads.append('H')
        tails.clear()
    elif y == 1:
        tails.append('T')
        heads.clear()
#checks if list len is 6 then clears and adds +1 to streak
def htcheck():
    streaks = 0
    if len(heads) == 6:
        streaks = streaks + 1
        heads.clear()
    elif len(tails) == 6:
        tails.clear()
        streaks = streaks + 1
while x < 10000:
    x = x + 1
    coinflip()
    htcheck()
print('# Streaks of 6: ", streaks)
 
    