Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python jointly shuffle list

import random

a = ['a', 'b', 'c']
b = [1, 2, 3]

c = list(zip(a, b))

random.shuffle(c)

a, b = zip(*c)

print a
print b

[OUTPUT]
['a', 'c', 'b']
[1, 3, 2]
Comment

PREVIOUS NEXT
Code Example
Python :: how to make colab reload on form change 
Python :: django-admin startproject 
Python :: Using Python-docx to update cell content of a table 
Python :: python count one to ten 
Python :: matplotlib object oriented 
Python :: python parallelize for loop progressbar 
Python :: find occerences in list python 
Python :: py var to the power of 
Python :: ndarray python 
Python :: define a string in python 
Python :: megre pandas in dictionary 
Python :: python submatrix 
Python :: sqlalchemy create engine Oracle 
Python :: form field required in django views 
Python :: fetch last record from django model 
Python :: matplotlib ax.annotate color of the arrow 
Python :: python slice last 2 items of list 
Python :: every substring python 
Python :: scikit decision tree 
Python :: Using strip() method to remove the newline character from a string 
Python :: munshi premchand idgah 
Python :: find out length of a string in pixels python 
Python :: python switch 
Python :: save model with best validation loss keras 
Python :: raspberry pi python 
Python :: py environment variables register in flask 
Python :: python typewriter effect 
Python :: Return array of odd rows and even columns from array using numpy 
Python :: python remove table widget numbers 
Python :: scapy get packet source ip address python 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =