dimanche 12 mai 2019

How to get new random list in such a way that two values should be adjacent to one another?

['New York', 'TRUE', 'Thimphu', 'FALSE', 'Tokyo', 'FALSE', 'Japan', 'FALSE', 'India', 'FALSE']

This is my list, I want to generate new list from it but a new list should have TRUE and New York move together whenever a new list is generated, index doesn't matter but 'New York', 'TRUE', should be adjacent to one another.for eg: following can be a new list:

[ 'Thimphu', 'FALSE', 'New York', 'TRUE','Tokyo', 'FALSE', 'Japan', 'FALSE', 'India', 'FALSE']
[ 'Thimphu', 'FALSE','Tokyo', 'FALSE', 'Japan', 'FALSE', 'India', 'FALSE' 'New York', 'TRUE',]




Aucun commentaire:

Enregistrer un commentaire