0
Someone to help me in python
I want to remove the [ ] by using ' '.join(list[ ]) can someone help? import random from random import randint from random import shuffle from random import seed from random import choice # random number generator seed(3) i = 1 while i <= 6: i = i + 1 l = [i for i in range(1, 41)] for x in range(3): selection_1 = choice(l) random.shuffle(l) ' '.join(list[ ]) # print value + string + value print("Number", random.choices(l)) print("Finished") https://code.sololearn.com/cQDQVadj1yEm/?ref=app
4 Answers
+ 1
You can just use the unpacking operator * like this;
print("Number", *random.choices(l))
+ 1
Thanks a lot ChaoticDawg
May I ask in which lesson is unpacking operator * ?
+ 1
It is in a couple of the Python courses under 'tuple unpacking'. It works for iterator types not just tuples.
Python core lesson 96.1
Intermediate Python lesson 5.1
+ 1
Ok thanks for your help.



