Question:
i need help i would like to convert this code to python is there anything online that will turn me into a python? from javascript? the question is how can I convert it online?Answer:
I believe this does what you ask. Some of this is silly. It splits the number up into digits, then prints the individual digits in the same order.number = int(input(‘od: ‘))
nrange = int(input(‘do: ‘))
def d_root(num):
return (num % 9) or 9
for i in range(nrange):
result = (i+1) * number
z = result * 2
zs = str(z)
if z < 10: print( f"{number} * {i+1} = {result}, *2=vysledek,{z}" ) elif z < 100: a = zs[0] b = zs[1] print( f"{number} * {i+1} = {result}, *2=vysledek,{z}, {a+b},{b+a}" ) elif z < 1000: a = zs[0] b = zs[1] c = zs[2] print( f"{number} * {i+1} = {result}, *2=vysledek,{z}, {a+c+b},{a+b+c}" ) elif z < 10000: a = zs[0] b = zs[1] c = zs[2] d = zs[3] print( f"{number} * {i+1} = {result}, *2=vysledek,{z}, {a+c+d+b},{a+b+c+d}" ) [/code]
If you have better answer, please add a comment about this, thank you!