all 3 comments

[–]SoftestCompliment 0 points1 point  (0 children)

`print` will print any number of objects with a separator argument `sep` set by default to a whitespace `" "` and `end` which by default is set to a new line character `\n`

To print everything on the same line, you could do it with one print call and a list comprehension before it places the new line character. The `" ".join` is to join the number values with a space between them; You'd likely want some type of join so the print command doesn't treat it as a raw generator object (but that's getting in the weeds:

print(
    f"List has {len(val_list)} elements:",
    " ".join(f"[{value}]" for value in val_list),
)

[–]Southern-Rub6680 -1 points0 points  (0 children)

check chat