Join with prefix and suffix
Input
join_with_options('-', 'a', 'b', prefix='X', suffix='Z')
Output
Xa-bZ
Items 'a' and 'b' are joined with '-', then prefixed with 'X' and suffixed with 'Z'.
Full lesson preview
Practice using *args and **kwargs to accept variable positional and keyword arguments, then unpack and use them.
Problem statement
Task
Examples
Input
join_with_options('-', 'a', 'b', prefix='X', suffix='Z')
Output
Xa-bZ
Items 'a' and 'b' are joined with '-', then prefixed with 'X' and suffixed with 'Z'.
Input
join_with_options(' ', 'hello', 'world', uppercase=True)
Output
HELLO WORLD
The joined core string 'hello world' is converted to uppercase because uppercase=True.
Input format
Output format
Constraints
Samples
Input
join_with_options(',', prefix='start', suffix='end')
Output
startend
No items provided, so join yields an empty string and prefix/suffix are concatenated.