-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lottery.py
34 lines (27 loc) · 956 Bytes
/
Lottery.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
#lottery number
from random import randint
while True:
ll=int(input('Enter the lower limit of your range:- '))
ul=int(input('Enter the upper limit of your range:- '))
n=randint(ll,ul)
t=int(input('\n\nEnter number of times you wanna attempt:- '))
while t!=0:
a=int(input('Enter any number between your provided range:- '))
if a==n:
print('Hurray! You did it champ\n')
break
elif a>n and a<=ul:
print('You guessed it too high')
t-=1
print('Now you have', t, 'chances left.\n')
elif a<n and a>=ll:
print('You guessed it too low')
t-=1
print('Now you have', t, 'chances left.\n')
else:
print('Please enter within the range\n')
t-=1
print('Now you have', t, 'chances left.')
s=input('Do you want to continue:- ')
if s.lower() != 'yes':
break