I need to change the value of two random variables out of four to '—'. How do I do it with maximum effectiveness and readability? Code below is crap just for reference.
from random import choice
a = 10
b = 18
c = 15
d = 92
choice(a, b, c, d) = '—'
choice(a, b, c, d) = '—'
print(a, b, c, d)
>>> 12 — — 92
>>> — 19 — 92
>>> 10 18 — —
I've tried choice(a, b, c, d) = '—' but ofc it didn't work. There's probably a solution using list functions and methods but it's complicated and almost impossible to read, so I'm searching for an easier solution.
Aucun commentaire:
Enregistrer un commentaire