← Back to challenges

String or Integer?

PythonHardnumbersstringslanguage_fundamentalsvalidation

Instructions

Create a function that checks if the argument is an integer or a string. Return "int" if it's an integer and "str" if it's a string.

Examples

int_or_string(8) ➞ "int"

int_or_string("Hello") ➞ "str"

int_or_string(9843532) ➞ "int"

Notes

Input will either be an integer or a string.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Perfect Roots