-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
133 lines (95 loc) · 3.26 KB
/
main.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# This is my guess game Python prog script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import random
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
# Press the green button in the gutter to run the script...
if __name__ == '__main__':
print_hi('WELCOME TO MY GUESS GAME\n')
print("GUESS THE NUMBER GAME")
#var = a, b, c, d, e, f, g, h, i
no = 0
again = 0
rar = 0
while again != 2:
#while is incase user wants to try again
print("-----------------------GUESS THE NUMBER------------------------\n")
print("-----------------------CHOOSE DIFFICULTY------------------------\n")
print("1 --EASY-------------")
print("2 --MEDIUM-----------")
print("3 --HARD-------------")
print("4 --EXTREME----------")
##diffculty starts
num = int(input("input number: "))
if num == 1:
print('you have chosen easy.\n')
print('Guess the number chose from 0 to 9')
nua = int(input())
print("you have chosen",nua)
elif num == 2:
print('you have chosen medium')
print('Guess the number chose from 0 to 99')
nua = int(input())
print("you have chosen", nua)
elif num == 3:
print('you have chosen hard')
print('you have chosen medium')
print('chose from 0 to 999')
nua = int(input())
print("you have chosen", nua)
elif num == 4:
print('you have chosen extreme')
print('you have chosen medium')
print('chose from 0 to 9999')
nua = int(input())
print("you have chosen", nua)
else:
print('wrong input')
## difficulty ends
# the users input another number to guess the number
value = False
if num == 1:
rar = random.randint(0, 9)
print('CPU number is: ',rar)
elif num == 2:
rar = random.randint(0, 9)
print(rar)
print('Guess the number',rar)
elif num == 3:
rar = random.randint(0, 9)
print(rar)
print('Guess the number',rar)
elif num == 4:
rar = random.randint(0, 9)
print(rar)
print('Guess the number',rar)
## ends here
#To generate random number
"""rar = random.randint(0, 9)
print(rar)"""
# ends here to generate number
## This part is to make see if user guessed the number
#for easy
if rar == num:
print('correct')
print('wanna play again?')
print('1 for yes')
print('2 for no')
again = int(input())
else:
print("Wrong Guess")
print('wanna play again?')
print('1 for yes')
print('2 for no')
again = int(input())
# while play == 1:
# print("lets go again")
while again != 1:
print("THANKS FOR PLAYING")
break
#while input() == 1:
# print("you tried again")
# continue
# See PyCharm help at https://www.jetbrains.com/help/pycharm/