forked from rrmckeever0319/Python-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathperfectSquares.py
More file actions
46 lines (29 loc) · 1.09 KB
/
Copy pathperfectSquares.py
File metadata and controls
46 lines (29 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import random
total = (0)
testActive = ("True")
answerEntered = ("False")
while testActive == ("True"):
for i in range(26):
randomVariable = (random.randrange(0,25))
userAnswer = int(raw_input("What is " + str(i) + " " + "squared?" + " "))
print randomVariable
if userAnswer == (i) * (i):
print ("CORRECT!")
print (" " )
total += 1
elif userAnswer != (i) * (i):
print ("Incorrect, the correct answer is " + str((i) * (i)))
print (" " )
print ("You got " + str(total) + (" correct") )
while answerEntered == ("False"):
userAnswer = raw_input(("Again? yes/no" + " "))
if userAnswer == ("yes") :
testActive = ("True")
answerEntered = ("True")
total = (0)
elif userAnswer == ("no") :
testActive = ("False")
answerEntered = ("True")
elif userAnswer != ("yes") or ("no") :
print ("yes or no")
print (" ")