I am trying make a counter for base 4 numbers the base conversion is successful but when it comes to making a counter it gives me an error, can someone help?
What I have tried:
x=7
i=1
n=5
base=4
def toStr(n,base):
convertString = "0123"
if n < base:
return convertString[n]
else:
return toStr(n//base,base) + convertString[n%base]
return tostr(x//base,base)+convertstring[x%base]
return tostr(i//base,base)+convertstring[i%base]
def counter(low, high):
current = low
while current <= high:
yield current
current += 1
for c in counter(toStr(n,base), toStr(x,base)):
print(c)
print(toStr(n,base))
print(toStr(x,base))
print(toStr(i,base))
x=7
i=1
n=5
base=4
def toStr(n,base):
convertString = "0123"
if n < base:
return convertString[n]
else:
return toStr(n//base,base) + convertString[n%base]
return tostr(x//base,base)+convertstring[x%base]
return tostr(i//base,base)+convertstring[i%base]
def counter(low, high):
current = low
while current <= high:
yield current
current += 1
for c in counter(toStr(n,base), toStr(x,base)):
print(c)