← Back to challenges

String to Integer and Vice Versa

PythonMediumstringslanguage_fundamentals

Instructions

Write two functions:

  1. to_int() : A function to convert a string to an integer.
  2. to_str() : A function to convert an integer to a string.

Examples

to_int("77") ➞ 77

to_int("532") ➞ 532

to_str(77) ➞ "77"

to_str(532) ➞ "532"

Notes

  • Don't forget to return the result.
  • If you get stuck on a challenge, find help in the Resources tab.
  • If you're really stuck, unlock solutions in the Solutions tab.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Check if objOne Is Equal to objTwo