abcgross = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" abcklein = "abcdefghijklmnopqrstuvwxyz" txt = input("Bitte zu kodierenden Text eingeben:") r = 0 while r > 26 or r < 1: r = int(input("Um wieviele Stellen soll verschoben werden?(1-26) ")) atxt = "" warn = 0 warntxt = "" for i in txt: if i == " ": atxt = atxt + " " continue if i.upper() not in abcgross: atxt = atxt + i # nicht codierbare Zeichen direkt zur Ausgabe bitte! warn = warn + 1 warntxt = warntxt + i + "," continue if i == i.upper(): abc = abcgross if i == i.lower(): abc = abcklein abcl = len(abc) for j in range(abcl): if i == abc[j]: if j + r >= abcl: atxt = atxt + abc[j + r - abcl] else: atxt = atxt + abc[j + r] print("Codierter Text:", atxt) if warn > 0: print("Achtung! folgende im Text enthaltenen Zeichen wurden nicht kodiert:", warntxt[:-1])