Identify Parameter Type

Identify Parameter Type

Tags: Basics

Credit: CodingChallenge

Difficulty: Beginner

Type: Text

Category: Practice

Time Allowed: 5 s

Description:

Write a function that takes a parameter and returns the type of the variable as a string. The function should accept one parameter and return a string indicating whether the variable is of type int, float or str.

Constraints:

  • The input will be a parameter of type int, float, or str.
  • The function should return a string: "int", "float", or "string".

Example:

  • Input: 1
  • Output: "int"

Test Case Input Expected Output
1 1 "int"
2 2.8 "float"
3 hello "string"
4 0 "int"
5 -3.14 "float"
6 world "string"

Please register or login to submit solutions to challenges.