Zum Inhalt
Vorlesung 4 Seidl
Aus ProgrammingWiki
<
BuK
<
IIm20
Archivierte Version vom 2021-04-17T19:03:12+00:00.
Aktuelle Version
KA
from itertools import product from browser import timer import math a = ["a", "b", "c"] def paarungsfunktion(i): z = i w = math.trunc((math.sqrt(8 * z + 1) - 1) / 2) t = (w * (w + 1)) / 2 y = z - t x = w - y return (x, y) def g(generator, index): count = -1 for w in generator(): count += 1 if count == index: return w def a_stern(): count = 0 while True: for w in product(a, repeat=count): yield "".join(w) count += 1 def chi_strich(wort, ticks): if wort.startswith("ab") is True: return True else: for i in range(0, ticks): timer.set_timeout(None, 1) return def f(z): count = 0 while True: wort_index, ticks = paarungsfunktion(count) wort = g(a_stern, wort_index) wert = chi_strich(wort, int(ticks)) if wert is True: print(wort) else: print("abc") count += 1 if count >= z: return
f(5000)
ausführen
Seite
Quelltext
Versionen/Autoren
Konto registrieren
Anmelden
Navigation
Startseite
Letzte Änderungen
Alle Seiten
Einführungskurs
Hilfe
Dateien
Suche
Suchen
Werkzeuge
Links auf diese Seite
Spezialseiten