You can put cat1 and cat2 variables in a list using square brackets and separating them with a comma:
main.py20 chars2 lines
Then, you can iterate through the cats list and concatenate their descriptions as follows:
main.py77 chars4 lines
This code first initializes an empty string called description. We then iterate through each cat in the cats list using a for loop, and concatenate its description to the description string. We also add a space after each description to separate the two strings.
Finally, description will contain the concatenated string: the description of cat1, followed by a space, followed by the description of cat2.
Here's the complete code:
main.py229 chars10 lines
gistlibby LogSnag