M
M
Mikhail Smailovich2020-06-11 07:43:56
Python
Mikhail Smailovich, 2020-06-11 07:43:56

Given the growth of three people. It is necessary to display the message "By height" or "Not by height". Is it possible to solve this problem without ifs?

With ifs, everything is simple:

h1 = int(input())
h2 = int(input())
h3 = int(input())
if h1 <= h2 <= h3:
    print('По росту.')
else:
    print('Не по росту!')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zexer, 2020-06-11
@smi33

h1 = int(input())
h2 = int(input())
h3 = int(input())

result = ['Не по росту!', 'По росту!']
compare = h1 <= h2 <= h3
result[compare]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question