Instructions: Create a Python solution to the following task. Ensure that the solution produces output in exactly the same format shown in the sample(s) below, including capitalization and whitespace. Task: Create a solution that accepts an integer input representing the index value for any any of the five elements in the following list: various_data_typ
Instructions:
Create a Python solution to the following task. Ensure that the solution produces output in exactly the same format shown in the sample(s) below, including capitalization and whitespace.
Task:
Create a solution that accepts an integer input representing the index value for any any of the five elements in the following list:
various_data_types = [516, 112.49, True, "meow", ("Western", "Governors", "University"), {"apple": 1, "pear": 5}]
Using the built-in function type() and getting its name by using the .name attribute, output data type (e.g., int”, “float”, “bool”, “str”) based on the input index value of the list element.
The solution output should be in the format
Element index_value: data_type
Sample Input/Output:
If the input is
4
then the expected output is
Element 4: tuple
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images