How do I define my variable?
So I've created a new program for the same purpose, to create a heads and tails game but it says my flip variable is undefined how do i define it?
This should fix your problem
i just changed the code a little. I will explain what i did down here. So basically the reason it is saying flip is undefined is because you have to include flip in the parameters of the function you are declaring. For example, you would have to do def coinFlip(flip):, and then blah blah blah. But, you also have to assign flip a temporary value, i did "" cause thats the easiest.
On a side note after running your program to test it I found that your program was not returning the user's score, as it is supposed to, so I fixed that as well. What was wrong with that was that flip was a string, but you were checking it as if it was an integer, which meant the program just stopped there. Thus, you can make a new variable, I called it flip1 for conciseness, and made it's value int(flip), so you can use flip1 instead of flip in your if statement. Hope these answers helped, and if they did, you can mark this as the answer.