Advertisement
Guest User

Untitled

a guest
Aug 31st, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.04 KB | None | 0 0
  1. from random import randint
  2. import math
  3.  
  4. score = 0
  5.  
  6.  
  7. def strong_pass(password):
  8. if len(password) < 8:
  9. print("Password is less than 8 characters, please try again.")
  10. password = input("Please enter a new password: ")
  11. strong_pass(password)
  12. elif password.islower():
  13. print("Password requires a capital letter, please try again.")
  14. password = input("Please enter a new password: ")
  15. strong_pass(password)
  16. else:
  17. print("Password is valid.\nWelcome " + username + " to the area trainer!")
  18.  
  19.  
  20. def shapes(task, score, response):
  21. if task.lower() == 'rectangle':
  22. print(" _______\n| |\n| |\n| | \n| |\n|_______|\n \n Base = " + str(
  23. w) + " and Height = " + str(h))
  24. answer = input(
  25. "\n Please type the correct answer: A, B or C.\n A = " + str(x) + "\n B = " + str(y) + "\n C = " + str(
  26. z) + "\n")
  27. if answer.upper() == 'C':
  28. print("Well done, that is correct!")
  29. score = score + 2
  30. print("Your score is currently " + score)
  31. retry(response)
  32. elif answer.upper() == 'A' or 'B':
  33. print("Try again, remember the formula is base multiplied by height!")
  34. answer = input("")
  35. if answer.upper() == "B":
  36. print("That's the correct answer!")
  37. score = score + 1
  38. print(score)
  39. response = input("Would you like to try again?\nYes or no?: ")
  40. retry(response, score)
  41. else:
  42. print("That's incorrect again. The correct answer was " + str(z))
  43. response = input("Would you like to try again?\nYes or no?: ")
  44. retry(response)
  45. else:
  46. print("Invalid input.")
  47. elif task.lower() == 'triangle':
  48. print(
  49. " /| \n / | \n / | \n / | \n / | \n/_____|\n \n Base = " + str(w) + " and Height = " + str(
  50. h))
  51. answer = input(
  52. "\n Please type the correct answer: A, B or C.\n A = " + str(a) + "\n B = " + str(b) + "\n C = " + str(
  53. c) + "\n")
  54. if answer.upper() == 'C':
  55. print("Well done, that is correct!")
  56. elif answer.upper() == 'A' or 'B':
  57. print("Try again, remember the formula is base multiplied by height!")
  58. answer = input("")
  59. if answer.upper() == "B":
  60. print("That's the correct answer!")
  61. response = input("Would you like to try again?\nYes or no?: ")
  62. retry(response, score)
  63. else:
  64. print("That's incorrect again. The correct answer was " + str(c))
  65. response = input("Would you like to try again?\nYes or no?: ")
  66. retry(response, score)
  67. else:
  68. print("Invalid input.")
  69. elif task.lower() == 'circle':
  70. print(
  71. " * * \n * * \n* *\n* *\n * * \n * * \n \n Diameter = " + str(
  72. d))
  73. answer = input(
  74. "\n Please type the correct answer: A, B or C.\n A = " + str(e) + "\n B = " + str(f) + "\n C = " + str(
  75. g) + "\n")
  76. if answer.upper() == 'C':
  77. print("Well done, that is correct!")
  78. elif answer.upper() == 'A' or 'B':
  79. print("Try again, remember the formula is base multiplied by height!")
  80. answer = input("")
  81. if answer.upper() == "B":
  82. print("That's the correct answer!")
  83. response = input("Would you like to try again?\nYes or no?: ")
  84. retry(response)
  85. else:
  86. print("That's incorrect again. The correct answer was " + str(g))
  87. response = input("Would you like to try again?\nYes or no?: ")
  88. retry(response)
  89. else:
  90. print("Invalid input.")
  91. else:
  92. print("Invalid input")
  93. task = input("Please enter a valid option: ")
  94. shapes(task)
  95.  
  96.  
  97. def retry(response, score):
  98. if response.lower() == "yes":
  99. task = input("Please choose a task from:\nRectangle\nTriangle\nCircle\n")
  100. elif response.lower() == "no":
  101. print("Thank you for playing\nYour score today was: " + str(score))
  102. else:
  103. print("Invalid input.")
  104. response = input("Please enter Yes or No: ")
  105.  
  106.  
  107. username = input("Please choose a username:")
  108. password = input("Please choose a password:")
  109. strong_pass(password)
  110.  
  111. rectangle = "Rectangle"
  112. triangle = "Triangle"
  113. circle = "Circle"
  114. task = input("Please choose a task from:\nRectangle\nTriangle\nCircle\n")
  115.  
  116. h = randint(1, 10)
  117. w = randint(1, 10)
  118. d = randint(1, 10)
  119.  
  120. x = (h * w) + randint(1, 5)
  121. y = (h * w) + randint(-5, -1)
  122. z = h * w
  123.  
  124. a = (h * w) / 2 + randint(1, 5)
  125. b = (h * w) / 2 + randint(-5, -1)
  126. c = (h * w) / 2
  127.  
  128. e = (math.pi * d * d) + randint(1, 5)
  129. f = (math.pi * d * d) + randint(-5, -1)
  130. g = (math.pi * d * d)
  131.  
  132. shapes(task, score, response)
  133.  
  134. score = int(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement