@ebest/

Monty hall

Python

No description

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.5169436127771936","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"ZnJvbSByYW5kb20gaW1wb3J0IHJhbmRpbnQKZnJvbSB0aW1lIGltcG9ydCBzbGVlcApjYXJzID0gMApnb2F0cyA9IDAKY2hvc2VuID0gMAp3aGlsZSBUcnVlOgoJYSA9IFsxLDIsM10KCWNkb29yID0gcmFuZGludCgwLCAyKQoJZG9vcnMgPSBbMCwwLDBdCglkb29yc1tjZG9vcl0gPSAxCgl3aGlsZSBjaG9zZW4gbm90IGluIFsiMSIsIjIiLCIzIiwgInIiXToKCQljaG9zZW4gPSBpbnB1dCgiZG9vciAxLCAyLCBvciAzICIpCglpZiBjaG9zZW4gPT0gInIiOgoJCWNob3NlbiA9IHJhbmRpbnQoMSwzKQoJY2hvc2VuID0gaW50KGNob3NlbikgLSAxCglkb29yc24gPSBbXQoJZm9yIGQgaW4gcmFuZ2UoMCwgbGVuKGRvb3JzKSk6CgkJaWYgZCAhPSBjaG9zZW46CgkJCWlmIGRvb3JzW2RdID09IDA6CgkJCQlkb29yc24uYXBwZW5kKGQpCglpZiBsZW4oZG9vcnNuKSA+IDE6CgkJZG9vciA9IHJhbmRpbnQoMCwxKQoJCWRvb3IgPSBkb29yc25bZG9vcl0KCQlwcmludCgiZG9vciAiICsgc3RyKGRvb3IgKyAxKSArICIgaGFzIGEgZ29hdCEiKQoJZWxzZToKCQlkb29yID0gc3RyKGRvb3JzblswXSArIDEpCgkJcHJpbnQoImRvb3IgIiArIGRvb3IgKyAiIGhhcyBhIGdvYXQhIikKCXNvcm4gPSBpbnB1dCgiU3dpdGNoIG9yIG5vdD8gKFkgb3IgTikgIikKCWlmIHNvcm4gPT0gIk4iIG9yIHNvcm4gPT0gIm4iOgoJCWlmIGRvb3JzW2Nob3Nlbl0gPT0gMToKCQkJcHJpbnQoIkhlcmUncyBhIGNhciEiKQoJCQljYXJzICs9IDEKCQllbHNlOgoJCQlwcmludCgiSGVyZSdzIGEgZ29hdCEiKQoJCQlnb2F0cyArPSAxCgllbGlmIHNvcm4gPT0gIlkiIG9yIHNvcm4gPT0gInkiOgoJCWZvciBuIGluIFsxLDIsM106CgkJCWlmIG4gLSAxID09IGNob3NlbiBvciBuID09IGludChkb29yKToKCQkJCWEucG9wKGEuaW5kZXgobikpCgkJY2hvc2VuID0gYVswXSAtIDEKCQlpZiBkb29yc1tjaG9zZW5dID09IDE6CgkJCXByaW50KCJIZXJlJ3MgYSBjYXIhIikKCQkJY2FycyArPSAxCgkJZWxzZToKCQkJcHJpbnQoIkhlcmUncyBhIGdvYXQhIikKCQkJZ29hdHMgKz0gMQoJc2xlZXAoMSkKCXByaW50KCJcbiIgKiA0NSkKCXByaW50KCJZb3UgaGF2ZSAiICsgc3RyKGdvYXRzKSArICIgZ29hdChzKSBhbmQgIiArIHN0cihjYXJzKSArICIgY2FyKHMpISIpCgkKCQ=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from random import randint
from time import sleep
cars = 0
goats = 0
chosen = 0
while True:
	a = [1,2,3]
	cdoor = randint(0, 2)
	doors = [0,0,0]
	doors[cdoor] = 1
	while chosen not in ["1","2","3", "r"]:
		chosen = input("door 1, 2, or 3 ")
	if chosen == "r":
		chosen = randint(1,3)
	chosen = int(chosen) - 1
	doorsn = []
	for d in range(0, len(doors)):
		if d != chosen:
			if doors[d] == 0:
				doorsn.append(d)
	if len(doorsn) > 1:
		door = randint(0,1)
		door = doorsn[door]
		print("door " + str(door + 1) + " has a goat!")
	else:
		door = str(doorsn[0] + 1)
		print("door " + door + " has a goat!")
	sorn = input("Switch or not? (Y or N) ")
	if sorn == "N" or sorn == "n":
		if doors[chosen] == 1:
			print("Here's a car!")
			cars += 1
		else:
			print("Here's a goat!")
			goats += 1
	elif sorn == "Y" or sorn == "y":
		for n in [1,2,3]:
			if n - 1 == chosen or n == int(door):
				a.pop(a.index(n))
		chosen = a[0] - 1
		if doors[chosen] == 1:
			print("Here's a car!")
			cars += 1
		else:
			print("Here's a goat!")
			goats += 1
	sleep(1)
	print("\n" * 45)
	print("You have " + str(goats) + " goat(s) and " + str(cars) + " car(s)!")