Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- import math
- score = 0
- def strong_pass(password):
- if len(password) < 8:
- print("Password is less than 8 characters, please try again.")
- password = input("Please enter a new password: ")
- strong_pass(password)
- elif password.islower():
- print("Password requires a capital letter, please try again.")
- password = input("Please enter a new password: ")
- strong_pass(password)
- else:
- print("Password is valid.\nWelcome " + username + " to the area trainer!")
- def shapes(task, score, response):
- if task.lower() == 'rectangle':
- print(" _______\n| |\n| |\n| | \n| |\n|_______|\n \n Base = " + str(
- w) + " and Height = " + str(h))
- answer = input(
- "\n Please type the correct answer: A, B or C.\n A = " + str(x) + "\n B = " + str(y) + "\n C = " + str(
- z) + "\n")
- if answer.upper() == 'C':
- print("Well done, that is correct!")
- score = score + 2
- print("Your score is currently " + score)
- retry(response)
- elif answer.upper() == 'A' or 'B':
- print("Try again, remember the formula is base multiplied by height!")
- answer = input("")
- if answer.upper() == "B":
- print("That's the correct answer!")
- score = score + 1
- print(score)
- response = input("Would you like to try again?\nYes or no?: ")
- retry(response, score)
- else:
- print("That's incorrect again. The correct answer was " + str(z))
- response = input("Would you like to try again?\nYes or no?: ")
- retry(response)
- else:
- print("Invalid input.")
- elif task.lower() == 'triangle':
- print(
- " /| \n / | \n / | \n / | \n / | \n/_____|\n \n Base = " + str(w) + " and Height = " + str(
- h))
- answer = input(
- "\n Please type the correct answer: A, B or C.\n A = " + str(a) + "\n B = " + str(b) + "\n C = " + str(
- c) + "\n")
- if answer.upper() == 'C':
- print("Well done, that is correct!")
- elif answer.upper() == 'A' or 'B':
- print("Try again, remember the formula is base multiplied by height!")
- answer = input("")
- if answer.upper() == "B":
- print("That's the correct answer!")
- response = input("Would you like to try again?\nYes or no?: ")
- retry(response, score)
- else:
- print("That's incorrect again. The correct answer was " + str(c))
- response = input("Would you like to try again?\nYes or no?: ")
- retry(response, score)
- else:
- print("Invalid input.")
- elif task.lower() == 'circle':
- print(
- " * * \n * * \n* *\n* *\n * * \n * * \n \n Diameter = " + str(
- d))
- answer = input(
- "\n Please type the correct answer: A, B or C.\n A = " + str(e) + "\n B = " + str(f) + "\n C = " + str(
- g) + "\n")
- if answer.upper() == 'C':
- print("Well done, that is correct!")
- elif answer.upper() == 'A' or 'B':
- print("Try again, remember the formula is base multiplied by height!")
- answer = input("")
- if answer.upper() == "B":
- print("That's the correct answer!")
- response = input("Would you like to try again?\nYes or no?: ")
- retry(response)
- else:
- print("That's incorrect again. The correct answer was " + str(g))
- response = input("Would you like to try again?\nYes or no?: ")
- retry(response)
- else:
- print("Invalid input.")
- else:
- print("Invalid input")
- task = input("Please enter a valid option: ")
- shapes(task)
- def retry(response, score):
- if response.lower() == "yes":
- task = input("Please choose a task from:\nRectangle\nTriangle\nCircle\n")
- elif response.lower() == "no":
- print("Thank you for playing\nYour score today was: " + str(score))
- else:
- print("Invalid input.")
- response = input("Please enter Yes or No: ")
- username = input("Please choose a username:")
- password = input("Please choose a password:")
- strong_pass(password)
- rectangle = "Rectangle"
- triangle = "Triangle"
- circle = "Circle"
- task = input("Please choose a task from:\nRectangle\nTriangle\nCircle\n")
- h = randint(1, 10)
- w = randint(1, 10)
- d = randint(1, 10)
- x = (h * w) + randint(1, 5)
- y = (h * w) + randint(-5, -1)
- z = h * w
- a = (h * w) / 2 + randint(1, 5)
- b = (h * w) / 2 + randint(-5, -1)
- c = (h * w) / 2
- e = (math.pi * d * d) + randint(1, 5)
- f = (math.pi * d * d) + randint(-5, -1)
- g = (math.pi * d * d)
- shapes(task, score, response)
- score = int(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement