strings = None
def test(a)
strings = str(strings) + f"{a} \n"
when this function is called multiple times
test("hello")
test("world")
how do I allow strings to be equal to
"hello" \n
"world"
At the moment it just picks up the last time a was passed so strings is "world"
>Solution :
Try:
strings = ""
def test(a):
global strings
strings += f"{a} \n"
test("hello")
test("world")
print(strings)