human
Give me a code to convert string to integer without using any in and the other steps required given the following:
Convert string to integer without using any in | Function to convert string to integer without using functions.
Initialize a variable.
Iterate till length of the string.
Subtract 48 from the current digit.
Print the answer.
Driver code.
Given string of number.
Function Call"
How can the above be solved in Python?
assistant
#Here is code to convert string to integer without using any in and the other steps required.
 def convert ( s ) :
	num = 0
	n = len ( s )
	for i in s :
		num = num * 10 + ( ord ( i ) - 48 )
	print ( num )
if __name__ == ' _ _ main _ _ ' :
	s = "123"
	convert ( s )