-2

I want to join strings but randomly. If I do this:

a = 'this'
b = 'is'
c = 'a'
d = 'string'
e =  ''

f = e.join(a + b + c + d)


output : 'this is a string'

This is excatly what I don't want.

I want to get string in random order. Like this:

'string this a is'
Szeverin
  • 41
  • 3

1 Answers1

1

You can create a list of your strings and shuffle it with the shuffle function of random module.

import random 
random.shuffle(list)
Elio Bteich
  • 123
  • 1
  • 10