We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d1a5d2e commit 284c7baCopy full SHA for 284c7ba
guessingGameSolution
@@ -0,0 +1,26 @@
1
+# Create a guessing game program:
2
+
3
+import random
4
+randomNumber = random.randint(1,100)
5
6
+# randomNumber is a variable from 1 to 100 that will be
7
+# chosen everytime the program is run
8
9
+print('Welcome to the guessing game!')
10
+while True:
11
+ print('I want you to guess a number from 1-100')
12
13
+ usrInput = input()
14
+ usrInput = int(usrInput)
15
16
+ if(usrInput > randomNumber):
17
+ print('You guessed too high!')
18
+ if(usrInput < randomNumber):
19
+ print('You guessed too low!')
20
21
+ if(usrInput == randomNumber):
22
+ print('You guessed my secret number!')
23
+ print('You won the game!')
24
+ break
25
26
+print('End of Program')
0 commit comments