Hi, here’s your problem today. This problem was recently asked by LinkedIn:
Given a string, convert it to an integer without using the builtin str function. You are allowed to use ord to convert a character to ASCII code.
Consider all possible cases of an integer. In the case where the string is not a valid integer, return None.
Here’s some starting code:
def convert_to_int(s):
# Fill this in.
print(convert_to_int('-105') + 1)
# -104