I am familiar with the spread/rest syntax in JavaScript:
// spread syntax
const foo = [1, 2];
const bar = [3, 4];
console.log([...foo, ...bar]); // [1, 2, 3, 4]
// rest syntax
function baz(...nums) {
console.log(nums);
}
baz(1, 2, 3); // [1, 2 ,3]
I know how to concatenate arrays.
foo = [1, 2, 3]
bar = [*foo, 4, 5]
print(bar) # [1, 2, 3, 4, 5]
Is there a way to use the Rest Syntax in python?
PS: Look at the second JS example.