Updated zahlensysteme.py to python3

This commit is contained in:
madmaurice 2016-02-21 15:37:03 +01:00
parent c420cd1e9b
commit 2ec2043cfa

View file

@ -5,7 +5,7 @@ class NumericSystemException(Exception):
pass pass
class Zahlensystem: class Zahlensystem:
chars = map(str, range(0,10)) + map(chr, range(ord('A'), ord('F')+1)) chars = list(map(str, range(0,10))) + list(map(chr, range(ord('A'), ord('F')+1)))
def __init__(self, basis): def __init__(self, basis):
self.basis = int(basis) self.basis = int(basis)
if self.basis > 16 or self.basis < 2: if self.basis > 16 or self.basis < 2:
@ -77,8 +77,8 @@ class Zahlensystem:
return v return v
if __name__ == '__main__': if __name__ == '__main__':
num = raw_input("Num> ") num = input("Num> ")
fr = int(raw_input("From> ")) fr = int(input("From> "))
to = int(raw_input("To> ")) to = int(input("To> "))
print Zahlensystem(to).toNum(Zahlensystem(fr).fromNum(num)) print(Zahlensystem(to).toNum(Zahlensystem(fr).fromNum(num)))