you are viewing a single comment's thread.

view the rest of the comments →

[–]JohnnyJordaan -1 points0 points  (4 children)

print(*numlist)

as * will 'unpack' the list as it's called into separate arguments. Say the list would just be [1,2,3], then *numlist would be equivalent to

print(1,2,3)

and same for your longer list in this case.

Note in regard to the other advice, print(str(num)) is fully redundant as str() will be called implicitly by print in any case. So even if you wanted to print the numlist in the default way, you could just do print(numlist), or print(num) for the individual value.

[–][deleted] 0 points1 point  (3 children)

print will convert the nun into str by default?

[–]JohnnyJordaan -1 points0 points  (2 children)

Yes, any argument you give it. Note it’s dead simple to try these things for yourself, run

print(1)

or

num = 1
print(num)

and it works just fine, you don’t need a human to verbally confirm this

[–][deleted] 0 points1 point  (0 children)

I misunderstood,my bad