Skip to content

Instantly share code, notes, and snippets.

View mattegeni_numpy.py
import numpy
import numpy.random
# Befolkningen (100 stk) med telefoner
telefoner = numpy.array(["android"] * 45 + ["iphone"] * 35 + ["diverse"] * 20)
simuleringer = 1000000
minst_7_av_10 = {"android": 0, "iphone": 0, "diverse": 0}
for _ in range(simuleringer):
# Trekk ut ti tilfeldige telefoner
View mattegeni.py
import random
# Befolkningen (100 stk) med telefoner
telefoner = ["android"] * 45 + ["iphone"] * 35 + ["diverse"] * 20
simuleringer = 1000000
minst_7_av_10 = {"android": 0, "iphone": 0, "diverse": 0}
for _ in range(simuleringer):
# Trekk ut ti tilfeldige telefoner
tilfeldige = random.sample(telefoner, 10)
View gist:1497343
from suds.cache import NoCache
from suds.sax.parser import Parser
class StaticSudsCache(NoCache):
def get(self, id):
STATIC = {"http://www.w3.org/2001/xml.xsd": XML_XSD,
"http://www.w3.org/2001/XMLSchema.xsd": XMLSCHEMA_XSD }
xml_string = STATIC.get(id.name)
if xml_string:
p = Parser()
View foo.txt
=============
example
=============
>>> a = 3
>>> a - 1
2