Page 1 of 1

Python random.choice außer einer Option

Posted: 02 Feb 2025, 07:26
by Anonymous
Ich versuche, random.choice () ein Element aus einem Wörterbuch auszuwählen. Zum Beispiel: < /p>

Code: Select all

mutationMarkers = {0: "original", 1: "point_mutation", 2: "frameshift_insertion",
3: "frameshift_deletion", 4: "copy_number_addition",
5: "copy_number_subtraction"}

mutator = choice(list(markers)) # output is 0, 1, 2, 3, 4, 5
Ist es möglich, random.choice und ignorieren {0: "Original"} ?