L
L
lightmanLP2020-06-06 16:18:16
Python
lightmanLP, 2020-06-06 16:18:16

How to beautifully synchronize three variables?

There are three variables. Two of them have the same meaning, one has some other meaning. How to set all variables to the value that occurs most often so that it is beautiful?

a = b = 1
c = 2

PS By beautiful is meant easy to read and with the least amount of action.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2020-06-06
@lightmanLP

The task is, of course, ultra-strange, but like this: It works if and only if at least two of the three variables really have the same value
a = b = c = a if a==b else c

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question