MCPcopy Create free account
hub / github.com/Ayush7614/Daily-Coding-DS-ALGO-Practice / myAtoi

Function myAtoi

Leetcode/Python/StringtoInteger.py:1–10  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

1def myAtoi(string):
2 result = 0
3 sign = 1
4 i = 0
5 if string[0] == '-':
6 sign = -1
7 i += 1
8 for j in range(i,len(string)):
9 result = result*10+(ord(string[j])-ord('0'))
10 return sign * result
11string =input("Enter string")
12print (myAtoi(string))
13"""

Callers 1

StringtoInteger.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected