@bossotron13/

Higher or Lower?

Python

No description

fork
loading
Files
  • main.py
  • C:\Users\bosso\Desktop\New folder\HighScore.txt
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
import random
PreRoll = 0
loop = 0
loop2 = 0
Roll = 0
check = 0
x = 0



def Roll_Dice():
  global Roll
  global check
  global PreRoll
  Roll = random.randint(1, 15)

def Start():
  global x
  print("Hello! you are going to be playing a game where you choose if its higher or lower")
  print("this is 50% random so dont get stressed!")
  print("This is out of 5!")
  
def TwoNum():
  global Roll
  global x
  global check
  global PreRoll
  if Roll > x:
    print(x,"is smaller then the roll")
  elif Roll < x:
    print(x,"is bigger then roll")
  elif Roll == x:
    print(x,"is the roll!")
  
def Higher():
  global check
  global Roll
  global PreRoll
  if Roll > PreRoll or Roll == PreRoll:
    check = 1
  elif Roll < PreRoll:
    check = 2

def Lower():
  global check
  global PreRoll
  global Roll
  if Roll < PreRoll or Roll == PreRoll:
    check = 1
  elif Roll > PreRoll:
    check = 2
  
Start()

Roll_Dice()
PreRoll = Roll
Roll_Dice()

x = int(input("Please input one number to help you guess: "))

while loop in range (0, 5):
  print("The Previous roll was: ", PreRoll)
  TwoNum()
  player = input("Higher = H, Lower = L : ")
  loop += 1
  if loop == 1:
    loop2 = 4
  elif loop == 2:
    loop2 = 3
  elif loop == 3:
    loop2 == 2
  elif loop == 4:
    loop2 == 1
  if player == "H" or player == "h":
    Higher()
    if check != 1:
      print("Game Over, the number was", Roll)
      import sys
      sys.exit()
    elif loop < 5:
      print("Correct! You got", loop2 ,"more guesses to go!")
    elif loop == 5:
      print("Nice job! you won")
  elif player == "L" or player == "l":
    Lower()
    if check != 1:
      print("Game Over, the number was", Roll)
      import sys
      sys.exit()
    elif loop < 5:
      print("Correct! You got", loop2 ,"more guesses to go!")
    elif loop == 5:
      print("Nice job! you won")
  PreRoll = Roll
  Roll_Dice()