WCM Forum

WCM Forum (http://www.wcm.at/forum/index.php)
-   Programmierung (http://www.wcm.at/forum/forumdisplay.php?f=17)
-   -   Fun wi76 C0d3 (Spaß beim Proggen lernen) (http://www.wcm.at/forum/showthread.php?t=232371)

oitt 16.12.2008 20:15

Fun wi76 C0d3 (Spaß beim Proggen lernen)
 
Hier könnt ihr Eure verrückten Codes posten ;)

Mein erstes Pythonwerk ist bestimmt nicht komplett oder gar korrekt, aber machte riesen Spaß und ergab eine riesige Befriedigung, als es funktionierte!

:D

Code:

# AUTOR: THOMAS STRIGL, Linz, Austria
#
# License: GPL Ver.3
# Programname: GeekLang
# Sprache: Python
##################################
print u"Herzlich Willkommen zum LEET Uebersetzungsprogramm 'GeekLang'!"
print u"Bitte auswaehlen: "
print u"a.) Von normalen Ausdruecken nach Leet uebersetzen "
print u"b.) Von 1337 in normale Ausdruecke "
print u"x.) Beenden "
while True:
    auswahl = raw_input(" Auswahl: ")
    if auswahl == 'a':
        s = raw_input("Eingabe: ")
        s = s.replace("o","0")
        s = s.replace("l","1")
        s = s.replace("b","8")
        s = s.replace("e","3")
        s = s.replace("t","7")
        s = s.replace("a","4")
        s = s.replace("h","6")
        canz = len(s)
        list = []
        i = 0
        for i in range(0, canz, 1):
            x = s[i]
            list.append(x)
            i += 1
        atx = len(list)
        i = 0
        for c in list:
            while i < atx - 3:
                x = list[i]
                if x.islower() == True:
                    y = x.upper()
                    list[i] = y 
                i += 3
        f = ""
        i = 0   
        for i in range(0, atx, 1):
            y = list[i]
            f = f + y
            i += 1
        print f
        continue
    elif auswahl == 'b':
        s = raw_input("Eingabe: ")
        canz = len(s)
        list = []
        i = 0
        for i in range(0, canz, 1):
            x = s[i]
            list.append(x)
            i += 1
        atx = len(list)
        i = 0
        for c in list:
            while i < atx - 3:
                x = list[i]
                if x.isalpha() == True:
                    y = x.lower()
                    list[i] = y 
                i += 3
        f = ""
        i = 0   
        for i in range(0, atx, 1):
            y = list[i]
            f = f + y
            i += 1
        f = f.replace("0","O")
        f = f.replace("1","l")
        f = f.replace("8","B")
        f = f.replace("3","E")
        f = f.replace("7","T")
        f = f.replace("4","A")
        f = f.replace("6","h")
        f = f.lower()
        print f
        continue
    elif auswahl == "x":
        print u"Danke fuer die Benutzung des Programmes. Ich hoffe Sie hatten viel Spass!"
        print u"Ende der Kommunikation..."
        break
    else:
        print u"Bitte wiederholen..."
        continue



Alle Zeitangaben in WEZ +2. Es ist jetzt 19:30 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© 2009 FSL Verlag