Kodewick
Start learning →
Starter←→0 / 80

Pet tag

#055StarterClasses3 min

The pet shop makes a name tag for every animal. When a PetTag is made it gets a name and a kind; save them as the tag's own self.name and self.kind. pet_tag(name, kind) makes a tag and joins the two.

Examples
pet_tag("Momo", "cat")→'Momo · cat'
pet_tag("Rex", "dog")→'Rex · dog'
main.py
class PetTag:
    def __init__(self, name, kind):
        # your code here: save name and kind on self (replacing the two empty lines below)
        self.name = ""
        self.kind = ""


def pet_tag(name, kind):
    tag = PetTag(name, kind)
    return f"{tag.name} · {tag.kind}"
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.