Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

%3Cp%3EWorking%20on%20a%20python%20homework%20question%20but%20a%20little%20stuc

ID: 3553327 • Letter: #

Question

%3Cp%3EWorking%20on%20a%20python%20homework%20question%20but%20a%20little%20stuck.%20Any%0Ahelp%20would%20be%20hugely%20apprecaited!%20%3C%2Fp%3E%0A%3Cp%3E%3Cbr%20%2F%3E%3C%2Fp%3E%0A%3Cp%3EWrite%20a%20Python%20program%20to%20convert%20a%20string%20of%20digits%20into%20the%0Acorresponding%20integer%20number.%20For%20example%2C%20the%20string%20%22182642%22%20is%0Aconverted%20into%20the%20number%20182%2C642.%20The%20program%20will%20read%20the%20string%0Afrom%20a%20file%20given%20in%20the%20command%20line.%20You%20are%20allowed%20to%20use%0Arecursion%20and%20basic%20arithmetic%20operations%20only%3B%20no%20Python%20functions%0Ato%20convert%20a%20string%20to%20an%20integer.%3C%2Fp%3E%0A

Explanation / Answer

# your code goes here

str1 = raw_input("Enter Number.")

x = 0

num = 0

l = len(str1)



while x < l :

num = num*10 + (ord(str1[x]) - ord('0'))

x=x+1

print num