Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- import math
- def strong_pass(password):
- if len(password) < 8:
- print("Password is less than 8 characters and is therefore weak, please try again.")
- password = input("Please enter a new password: ")
- strong_pass(password)
- elif password.islower():
- print("Password has no capitals and is therefore weak, please try again.")
- password = input("Please enter a new password: ")
- strong_pass(password)
- else:
- print("Password is valid.\nWelcome " + username + " to area trainer!")
- def shapes(task):
- if task.lower() == 'rectangle':
- print(" _______\n| |\n| |\n| |\n| |\n|_______|\n \n Base = " + str(x) + " and Height = " + str(y))
- answer = input("\n Please type the correct answer: A, B or C.\n A = " + str(z1) + "\n B = " + str(c1) + "\n C = " + str(w1) + "\n")
- if answer.upper() == "B":
- print("That's the correct answer!")
- response = input("Would you like to try again?\nYes or no?: ")
- retry(response)
- elif answer.upper() == "A" or "C":
- print("That's incorrect. Remember, the formula is base x height. Please choose a different letter: ")
- 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(c1))
- response = input("Would you like to try again?\nYes or no?: ")
- retry(response)
- else:
- print("Invalid input.")
- task = input("Please select a task: ")
- shapes(task)
- elif task.lower() == 'triangle':
- print(" /|\n / |\n / |\n / |\n /____|\n \n Base = " + str(x) + " and Perpendicular Height = " + str(y))
- answer = input("\n Please type the correct answer: A, B or C.\n A = " + str(c2) + "\n B = " + str(z2) + "\n C = " + str(w2) + "\n")
- if answer.upper() == "A":
- print("That's the correct answer!")
- response = input("Would you like to try again?\nYes or no?: ")
- retry(response)
- elif answer.upper() == "B" or "C":
- print("That's incorrect. Remember, the formula is base x height. Please choose a different letter: ")
- answer = input("")
- if answer.upper() == "A":
- 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(c2))
- response = input("Would you like to try again?\nYes or no?: ")
- retry(response)
- else:
- print("Invalid input.")
- task = input("Please select a task: ")
- shapes(task)
- elif task.lower() == 'circle':
- print(" * * \n * * \n* *\n* *\n * * \n * * \n \n Radius = " + str(x))
- answer = input("\n Please type the correct answer: A, B or C.\n A = " + str(w3) + "\n B = " + str(z3) + "\n C = " + str(c3) + "\n")
- if answer.upper() == "C":
- print("That's the correct answer!")
- response = input("Would you like to try again?\nYes or no?: ")
- retry(response)
- elif answer.upper() == "A" or "B":
- print("That's incorrect. Remember, the formula is base x height. Please choose a different letter: ")
- answer = input("")
- if answer.upper() == "C":
- 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(c3))
- response = input("Would you like to try again?\nYes or no?: ")
- retry(response)
- else:
- print("Invalid input.")
- task = input("Please select a task: ")
- shapes(task)
- else:
- print("Invalid input")
- task = input("Please enter a valid option: ")
- shapes(task)
- def retry(response):
- if response.lower() == "yes":
- task = input("Please select a task:\nRectangle\nTriangle\nCircle\n")
- shapes(task)
- elif response.lower() == "no":
- print("Thank you for playing Area Trainer")
- else:
- print("Invalid input.")
- response = input("Please enter either Yes or No: ")
- retry(response)
- def score(answer):
- if answer.lower == "a":
- print("a")
- username = input("Please enter a username: ")
- password = input("Please enter a password: ")
- x = randint(1, 10)
- y = randint(1, 10)
- # Rectangle Variables
- z1 = (x * y) + randint(-5, -1)
- w1 = (x * y) + randint(1, 5)
- c1 = x * y
- # Triangle Variables
- z2 = ((0.5 * x) *y) + randint(-5, -1)
- w2 = ((0.5 * x) *y) + randint(1, 5)
- c2 = (0.5 * x) *y
- # Circle Variables
- z3 = (math.pi * x * x) + randint(-5, -1)
- w3 = (math.pi * x * x) + randint(1, 5)
- c3 = math.pi * (x*x)
- strong_pass(password)
- task = input("Please select a task:\nRectangle\nTriangle\nCircle\n")
- shapes(task)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement