forked from geekcomputers/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGuess_the_number_game
More file actions
41 lines (30 loc) · 774 Bytes
/
Guess_the_number_game
File metadata and controls
41 lines (30 loc) · 774 Bytes
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
# using codeSkulpter
import simplegui
import random
def new_game():
global num
print("new game")
def range_of_100():
global num
num = random.randrange(0,100)
print("your range is 0-100")
def range_of_1000():
global num
num = random.randrange(0,1000)
print("range is 0-1000")
def input_guess(guess):
global num
print("Your Guess is " , guess)
num1 = int(guess)
if num1 == num:
print("Correct")
elif num1 >= num:
print("Greater")
elif num1 <= num:
print("Lower")
frame = simplegui.create_frame("Guess The Number",200,200)
frame.add_button("range[0-1000)",range1000)
frame.add_button("range[0-100)",range100)
frame.add_input("enter your guess",input_guess,200)
frame.start()
new_game()