String to Integer and Vice Versa

Published by Helen Yu in

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.
Watch a quick demo on how Edabit works.