Challenge: Let's Check Out the Type of Data
Complete this hands-on exercise to test your knowledge.
We'll cover the following
Problem statement
Implement the p_any()
function, which takes an any
object as input and prints its type and value in a specific format. The function should handle int
, string
, and list<int>
types, and should print "None"
if the any
object does not have a value.
Input
The input to the function is a const
reference to an any
object. The object may or may not have a value, and may have one of the following types:
int
string
list<int>
Any other type
Output
Prints the type and value of the argument to the console.
Get hands-on with 1400+ tech skills courses.