-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlottery.py
36 lines (28 loc) · 972 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
35
36
#The program selects a random number between 1000 & 9999
#The player is asked to input his choice number
#The player is allowed to pick 5 different numbers
#All 5 numbers are compared with the computers choice
#The computer then takes 3 seconds and prints out each second
#Finally the computer prints wether the player has won or lost.
import random
from time import sleep
def rungame():
compnum = random.randrange(1000, 9999)
print "Please enter your choices"
a = input("Enter 1st choice: ")
b = input("Enter 2nd choice: ")
c = input("Enter 3rd choice: ")
d = input("Enter 4th choice: ")
as_string = str(a) + str(b) + str(c) + str(d)
as_int = int(str(a) + str(b) + str(c) + str(d))
print "Your numbers... "
sleep(2)
print as_string
print as_int
if compnum == as_int:
print "Goddamn you Won"
else:
print "The computer chose: %d" %(compnum)
sleep(2)
print "YOU LOSE"
rungame()