The built-in print function for Python class instances is not very entertaining.

In this Kata, we will implement a function ```show_me(instname)``` that takes an instance name as parameter and returns the string "Hi, I'm one of those (classname)s! Have a look at my (attrs).", where (classname) is the class name and (attrs) are the class's attributes. If (attrs) contains only one element, just write it. For more than one element (e.g. a, b, c), it should list all elements sorted by name in ascending order (e.g. "...look at my a, b and c").

Example:
For an instance ```porsche = Vehicle(2, 4, 'gas')``` of the class
```
class Vehicle:
  def __init__(self, seats, wheels, engine):
    self.seats = seats
    self.wheels = wheels
    self.engine = engine
```
the function call ```show_me(porsche)``` should return the string 'Hi, I'm one of those Vehicles! Have a look at my engine, seats and wheels.'

Hints:
For simplicity we assume that the parameter "instname" is always a class instance.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def show_me(instname):
	

Solutions:
def show_me(instname):
	attrs = sorted(instname.__dict__.keys())
	if len(attrs) == 1:
		attrs = attrs[0]
	else:
		attrs = '{} and {}'.format(', '.join(attrs[:-1]), attrs[-1])
	return "Hi, I'm one of those {}s! Have a look at my {}.".format(instname.__class__.__name__, attrs)


def show_me(instname):
	classname = instname.__class__.__name__
	attrs = ' and'.join(', '.join((attr for attr in sorted(instname.__dict__.keys()))).rsplit(',', 1))
	return f"Hi, I'm one of those {classname}s! Have a look at my {attrs}."


def show_me(instname):
	attr = sorted(list(instname.__dict__.keys()))
	attr = ', '.join(attr[:-1]) + ' and ' * (len(attr) >= 2) + attr[-1]
	return "Hi, I'm one of those {}s! Have a look at my {}.".format(type(instname).__name__, attr)


def show_me(inst):
	name = inst.__class__.__name__
	atts = ' and'.join(', '.join(sorted((k for k in inst.__dict__))).rsplit(',', 1))
	return "Hi, I'm one of those {}s! Have a look at my {}.".format(name, atts)


def show_me(instname):
	name = type(instname).__name__ + 's'
	l = list(instname.__dict__.keys())
	l.sort()
	if len(l) == 1:
		string = f'{l[0]}.'
	else:
		s = ', '.join(l[0:-1])
		string = s + f' and {l[-1]}.'
	return f"Hi, I'm one of those {name}! Have a look at my {string}"


def show_me(instname):
	hi = f"Hi, I'm one of those {instname.__class__.__name__}s!"
	fields = sorted(vars(instname))
	if len(fields) == 1:
		return f'{hi} Have a look at my {fields[0]}.'
	else:
		return f"{hi} Have a look at my {', '.join(fields[:-1])} and {fields[-1]}."


def show_me(instname):
	return "Hi, I'm one of those {}s! Have a look at my {}.".format(instname.__class__.__name__, ' and '.join(', '.join(sorted(instname.__dict__.keys())).rsplit(', ', 1)))