Note: This kata is inspired by [Convert a Number to a String!](http://www.codewars.com/kata/convert-a-number-to-a-string/). Try that one too.
## Description
We need a function that can transform a string into a number. What ways of achieving this do you know?
Note: Don't worry, all inputs will be strings, and every string is a perfectly valid representation of an integral number.
## Examples
```python
stringToNumber("1234") == 1234
stringToNumber("605" ) == 605
stringToNumber("1405") == 1405
stringToNumber("-7"  ) == -7
```
def string_to_number(s):
    # ... your code here
    num = 0
    flag = False
    if s[0] == '-':
        flag = True
    for i in range(len(s)):
        if flag and i == 0: 
            continue
        else:
            num += int(s[i])
            if i != len(s) - 1:
                num *= 10
    return num if not flag else -1* num

def string_to_number(s):
    # ... your code here
    num = 0
    flag = False
    if s[0] == '-':
        flag = True
    for i in range(len(s)):
        if flag and i == 0: 
            continue
        else:
            num += int(s[i])
            if i != len(s) - 1:
                num *= 10
    return num if not flag else -1* num
