Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flip a Coin
#1
Code:
import random
raw_input('Press Enter To Flip The Coin')
b = '   @@@@@   ','  @     @  ',' @  O O  @ '  ,' @  ___  @ ','  @     @  ','   @@@@@   '
a = '   @@@@@   ','  @|/ \|@  ',' @ |/ \| @ '  ,' @ |/ \| @ ','  @|/ \|@  ','   @@@@@   '
c = [a,b]
print "\n".join(random.choice(c))

EDIT:
Now you can choose how high to throw the coin, and this version gives the illusion the coin is spinning.

Code:
import random,os,time
os.system("clear")
print '1) Low'
print '2) High'
z = int(raw_input('How high do you want to flip the coin: '))
if z == 1:
    qz = 2
if z ==2:
    qz = 5
x = 0
x = x + 1
time.sleep(0.2)
b = '   @@@@@   ','  @     @  ',' @  O O  @ '  ,' @  ___  @ ','  @     @  ','   @@@@@   '
q = '    |','    |','    |','    |','    |','    |'
a = '   @@@@@   ','  @|/ \|@  ',' @ |/ \| @ '  ,' @ |/ \| @ ','  @|/ \|@  ','   @@@@@   '
c = [a,b]
os.system("clear")
for x in xrange(qz):
    os.system("clear")
    print "\n".join(q)
    time.sleep(0.2)    
    os.system("clear")
    time.sleep(0.2)
    print "\n".join(random.choice(c))
    time.sleep(0.2)
Reply
#2
I like this one its fun.
Good and Bad you Decide.
SupermanDevlish
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)