-1

I created a list with random and string methods, and what is it does it just create 1 uppercase letter and then print 6 lowercase letters.

Now, it is always creating a space between the characters, how can I remove the spaces ?

Example:

mport random
import string

randomProfile = [random.choice(string.ascii_uppercase)] + random.choices(string.ascii_lowercase, k=6)

print(*randomProfile) # unpack the list

Example of output:

W t o v s q j

1 Answers1

2

Yes, we could use

"".join(randomProfile)

str.join(iterable) joins the elements of iterable by a given "glue"-string str, which is empty in our case.

Jonathan Scholbach
  • 4,925
  • 3
  • 23
  • 44