Custom Search

Sunday, October 18, 2009

Guessing game

import random
import os
os.system("clear")
a = 0
g = 0
l = 1
b = ["1","2","3","4","5","6","7","8","9","10"]
c = random.choice(b)
while l == 1:
os.system("clear")
print "1) Single Player"
print "2) Two Players"
a = input("Chooce Amount Of Players: ")
os.system("clear")
if a == 1:
d = raw_input("Guess A Number Between One And Ten: ")
os.system("clear")
if c == d:
print "You Win!"
elif c != d:
print "You Lose..."

if a == 2:
e = raw_input("Player 1, Choose A Number Between One And Ten: ")
os.system("clear")
f = raw_input("Player 2, Guess A Number Between One And Ten: ")
os.system("clear")
if f == e:
print("Player 2 Wins!")
elif f != e:
print("Player 1 Wins!")
print "1) Play Again"
print "2) Exit"
g = input("Make Your Decision: ")
if g == 1:
l = 1
if g == 2:
l = 0
os.system("clear")

No comments:

Post a Comment