Updated zahlensysteme.py to python3

This commit is contained in:
madmaurice 2016-02-21 15:37:03 +01:00
parent c420cd1e9b
commit 2ec2043cfa
1 changed files with 5 additions and 5 deletions

View File

@ -5,7 +5,7 @@ class NumericSystemException(Exception):
pass
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):
self.basis = int(basis)
if self.basis > 16 or self.basis < 2:
@ -77,8 +77,8 @@ class Zahlensystem:
return v
if __name__ == '__main__':
num = raw_input("Num> ")
fr = int(raw_input("From> "))
to = int(raw_input("To> "))
num = input("Num> ")
fr = int(input("From> "))
to = int(input("To> "))
print Zahlensystem(to).toNum(Zahlensystem(fr).fromNum(num))
print(Zahlensystem(to).toNum(Zahlensystem(fr).fromNum(num)))