Skip to content

Instantly share code, notes, and snippets.

@libert-xyz
Created December 30, 2015 05:52
Show Gist options
  • Save libert-xyz/0ceab7fb19ccb053ee5b to your computer and use it in GitHub Desktop.
Save libert-xyz/0ceab7fb19ccb053ee5b to your computer and use it in GitHub Desktop.
A simple Guest the Number Game
#!/usr/bin/env python
from random import randint
opt = 3
rn = (randint(100,199))
while opt >= 0:
if opt == 0:
print "You Lost, the number was: ", rn
break
else:
num = int(raw_input("Guess a Number Between 100 and 199: "))
if num == rn:
print "YES! you won 1,000,000 $"
opt = -1
else:
if num > rn:
print "Less, Keep Trying, ","Opportunities: " , opt-1
opt = opt - 1
else:
print "Greater, Keep Trying, " , "Opportunities: ", opt -1
opt = opt -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment