Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A Magic Eight Ball, And A Guessing Game
#1
Magic 8 ball

Code:
import os
os.system("clear")
loop = 1
while loop == 1:
    import random
    raw_input("Ask your question: ")
    a = ["Yes","No","Ask Again Later","Go die","Maybe"]
    p = random.choice(a)
    print(p)

Guessing Game

Code:
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")
Reply
#2
Don't worry, I thought i clicked on the pearl section.
Reply
#3
That;s nice thanks for sharing
[Image: 2d75599e9a.png]:superman:
Reply
#4
Very nice Big Grin
Thanks for sharing it.
Reply
#5
Thanks for the share. Looks cool!
(05-24-2010, 06:15 PM)Omniscient Wrote: We take HF refugees in bulk.
Lol
Reply
#6
Thanks for the share. Nice work.
Reply
#7
Nice with the first one, but when you start using 'for loops' you will be able to shorten the second code =P
[Image: idgjkO.png]
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)