avatar Bite 271. Get all class names from a module

In this Bite you will write a function to get all the class names from the module passed in.

Only return the class names that start with an uppercase character.

We recommend you check out the inspect module for this.

Here is how your code should work:

  >>> from cls import get_classes
  >>> import csv, string
  >>> get_classes(csv)
  ['Dialect', 'DictReader', 'DictWriter', 'Error', 'Sniffer', 'StringIO']
  >>> get_classes(string)
  ['Formatter', 'Template']

Introspection of Python can be very useful. Have fun!

Login and get coding
go back Intermediate level
Bitecoin 3X

58 out of 62 users completed this Bite.
Will you be Pythonista #59 to crack this Bite?
Resolution time: ~33 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 2.5 on a 1-10 difficulty scale.
» You can do it! 😌

We use Python 3.8