DEV Community

loading...
Cover image for Python Daily Problems on Edabit: Return a String as an Integer

Python Daily Problems on Edabit: Return a String as an Integer

Anthony Beckford🚀
I'm a self taught developer at 30. I tweet about my journey learning Software Development and will be providing the resources I've used along the way to hopefully help others.
・1 min read

Edabit is a website where you can practice you problem solving skills. I'm using python but they have it for javascript as well

Problem: Create a function that takes a string and returns it as an integer.

Examples
string_int("6") ➞ 6

string_int("1000") ➞ 1000

string_int("12") ➞ 12

Solution:
def string_int(txt):
return int(txt)

Discussion (0)