lolamontes69

Python/Heads or Tails

May 16th, 2013
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. from random import choice
  2.  
  3. patterns = {}
  4. lasthuman = 'tails'
  5. num = 5
  6. a = ['heads','tails']
  7. patterns['heads'] = ['heads']
  8. patterns['tails'] = ['tails']
  9.  
  10. print 'Think of a number between 1 and 10'
  11. while num < 11:
  12.  
  13.     robo = choice(patterns[lasthuman])
  14.     print "I guess",robo
  15.     print "----------------------------------"
  16.     human = str(raw_input('What did it land on > '))
  17.     a.append(human)
  18.     patterns[lasthuman].append(human)
  19.     lasthuman = human
  20.  
  21. """ Machine statistically guesses whether next toss will be heads or tails by choosing randomly from two list of previous results; if previous was head append result to head list etc """
Advertisement
Add Comment
Please, Sign In to add comment