I'm working on my first project, but I've encountered a problem, I am trying to make a program that randomly generates a skateboarding trick for you to do, and if you can do the trick, then you get +1 points and if not then 0 points. everything else runs smoothly, but the points are not stacking up. Here is the code.
import random
import time
print()
print("Welcome to 'Can you really skate?'")
print()
# starting by defining the different levels
print("Level")
print("1: Beginner")
print("2: Intermidiete")
print("3: Kind of advanced")
print("4: Advanced")
level = input("Choose your level: ") # asking the user to input which level they are at
points = int(0)
def main():
if level == "1":
stance = ["fakie", "switch", "regular", "nollie"]
trick = ["ollie", "shuv-it", "frontside 180", "backside 180"]
print("Your random trick is:", random.choice(stance), " ", random.choice(trick))
elif level == "2":
stance = ["fakie", "switch", "regular", "nollie"]
trick = ["ollie", "shuv-it", "frontside 180", "backside 180", "kickflip", "heelflip", "popshuv-it", "frontside popshuv-it", "bigspin", "varialkickflip"]
print("Your random trick is:", random.choice(stance), " ", random.choice(trick))
time.sleep(4)
# so here is where the problem is, when the user types in "yes", it
# should add points which should then be stored in the variable and
# then added on when it loops again
print("did you make your trick? ")
make = input("yes / no ?")
if make == "yes":
points = 1
elif make == "no":
points = int(0)
print(f"You have {points} points")
play = input("play again? yes/no ?")
if play =="yes":
main()
elif play =="no":
print("you have compleated the game, your final score is: ", points)
exit()
main()
The goal is to make the program add on points for each time the user types "yes" to the question, and then the points to be displayed at the very end when the user types "no" to the question "play again?"