text = ["this","is","text"]
print(f"hello and {text, end=","}")
Input In [58]
print(f"hello and {text, end=","}")
^
SyntaxError: f-string: expecting '}'
I am trying to remove brackets and commas while using an f string
……………………
>Solution :
It appears you are trying to print the contents of the list after the hardcoded string. So your code is first printing "hello and" and then the string representation of the list ‘text’. In order to print the elements of the list using an f string you can do:
text = ['this','is','text']
print(f"hello and {' '.join(text)}")
