Python random.choice außer einer Option

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Python random.choice außer einer Option

by Anonymous » 02 Feb 2025, 07:26

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"} ?

Top