• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home » Resolved: convert script from javascript to python

Resolved: convert script from javascript to python

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

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?
how do i convert slice? and change the order of the digits?

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!

javascript python
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: TypeScript does not recognize properties when instantiating interface array

27/03/2023

Resolved: How to make statement case insensitive when uploading a dta file with specified columns?

27/03/2023

Resolved: Sort dataframe columns value by close it to another column

27/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.