
# your code goes here
import random
stulya = {
	"S pikami" : {"weight": 4},# 50%
	"S huyami": {"weight": 3}, # 37.5%
	"Norm": {"weight": 1} # 12.5%
	}

start = 0
points = []
for key, value in stulya.items():
	start += value["weight"]
	points.append({ "point": start, "key": key })
a = sorted(points, key=lambda s: s["point"])

choises = { key: 0 for key in stulya.keys()}

for i in range(100000):
	choise = random.uniform(0, start)
	left = 0
	for p in points:
		if left < choise <= p["point"]:
			choises[p["key"]] += 1
			break


print(choises)
total = sum([c for c in choises.values()])
print("Vsego vibiraly {} raz".format(total))
for key, value in choises.items():
	print("Varant '{}' vipal {} raz ili v {}% sluchaev".format(key, value, value*100/total))






