Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
698 B
4
Indexable
Never
from random import randint

study_list = [
	"Weasley",
	"Longbottom",
	"Granger",
	"Potter",
	"Weasley",
	"Malfoy",
	"Lovegood",
	"Chang",
	"Wood",
	"Zabini"
	]
	
def rand_part(participant_list):
	participant_dict = {}
	
	for item in participant_list:
		key = randint(1, 100)
		participant_dict[key] = item
	
	return participant_dict
	
def cond_det(numb_dict):
	condition_A = {}
	condition_B = {}
	
	for key in numb_dict.keys():
		if int(key) % 2 == 0:
			condition_B[key] = numb_dict[key]
		else:
			condition_A[key] = numb_dict[key]
	return condition_A, condition_B
		
numbered_participants = rand_part(study_list)

group_A, group_B = cond_det(numbered_participants)
print(group_A, "\n", group_B)