I have the below function that loops through two lists and prints out a selection of vegetables and then fruits.
def Selection():
print("VEGETABLES FOR THE WEEK:\n")
for veg in veg_selection:
print(veg.upper())
print("\n")
print("FRUITS FOR THE WEEK:\n")
for fruit in fruit_selection:
print(fruit.upper())
So the result could look like:
VEGETABLES FOR THE WEEK:
BROCOLLI
PEAS
CARROTS
SWEET CORN
WHITE ONIONS
FRUITS FOR THE WEEK:
GRAPEFRUIT
CHERRIES
ORANGE
COCONUT
RASPBERRIES
I'm struggling to get my head around assigning the printed results of the function to a single variable that contains the formatted string. Would I need to save the results as a text file and then read it in again? Can I just use text concatenation? I'm unsure how to deal with the for loops in the function? Any help really appreciated.