DEV Community

Cover image for Python Daily Problems on Edabit: Return a String as an Integer
Anthony Beckford🚀
Anthony Beckford🚀

Posted on

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

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)

Top comments (0)