Python: Get the class name of an instance in Python
Write a Python class to get the class name of an instance in Python.
Sample Solution:
Python Code:
import itertools
x = itertools.cycle('ABCD')
print(type(x).__name__)
Sample Output:
cycle
Flowchart:
Python Code Editor:
Contribute your code and comments through Disqus.
Previous: Write a Python class named Circle constructed by a radius and two methods which will compute the area and the perimeter of a circle.
Next: Data Structures and Algorithms Home.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics