Commits

Anonymous committed 5008b25

Initial commit

Comments (0)

Files changed (2)

+from random import randint
+m = randint(1, 10000) # The number of times to run for each choice
+
+choices = {'cat1': m, 'cat2': m, 'money': m}
+remaining_door = list()
+wins = 0
+loses = 0
+n = 0 # The total number of times one has played this game
+
+
+def select(option, switched):
+    doors = ['cat1', 'cat2', 'money']
+    print "You've chosen " + option
+    for element in doors:
+        if element != option and element != 'money':
+            print "The door revealed is " + element
+            doors.remove(element)
+    if switched:
+        option = 'money'
+    if option == 'money':
+        global wins
+        wins = wins + 1
+        print "You win!"
+    else:
+        global loses
+        loses = loses + 1
+        print "You lost!"
+
+    global n
+    n = n + 1
+    
+
+def main():
+    global n, wins, loses, choices
+    for k, v in choices.iteritems():
+        for i in range(v):
+            select(k, True)
+            select(k, False)
+
+    print "You have played the game " + str(n) + " times."
+    print "You won " + str(wins) + " times."
+    print "You lost " + str(loses) + " times."
+    
+
+main()
+choices = {'cat1': 1000, 'cat2': 1000, 'money': 1000}
+remaining_door = list()
+wins = 0
+loses = 0
+n = 0 # The number of times one has played this game
+
+
+def select(option, switched):
+    doors = ['cat1', 'cat2', 'money']
+    print "You've chosen " + option
+    for element in doors:
+        if element != option and element != 'money':
+            print "The door revealed is " + element
+            doors.remove(element)
+    if switched:
+        option = 'money'
+    if option == 'money':
+        global wins
+        wins = wins + 1
+        print "You win!"
+    else:
+        global loses
+        loses = loses + 1
+        print "You lost!"
+
+    global n
+    n = n + 1
+    
+
+def main():
+    global n, wins, loses, choices
+    for k, v in choices.iteritems():
+        for i in range(v):
+            select(k, True)
+            select(k, False)
+
+    print "You have played the game " + str(n) + " times."
+    print "You won " + str(wins) + " times."
+    print "You lost " + str(loses) + " times."
+
+main()