Skip to content

Instantly share code, notes, and snippets.

@FerdinaKusumah
Created December 5, 2019 01:28
Show Gist options
  • Save FerdinaKusumah/d5b88a8a0b98f7880f4755d94279f851 to your computer and use it in GitHub Desktop.
Save FerdinaKusumah/d5b88a8a0b98f7880f4755d94279f851 to your computer and use it in GitHub Desktop.
Chain Comparison
"""Chain comparison"""
min_num = 5
max_num = 10
search = 3
is_middle = search < min_num < max_num
is_name = search == 3 < min_num < max_num
print("is number {} in middle {} and {} ? {}".format(search, min_num, max_num, is_middle))
# is number 3 in middle 5 and 10 ? True
print("is number {} is same with 3 and in middle {} and {} ? {}".format(search, 3, min_num, max_num, is_middle))
# is number 3 is same with 3 and in middle 3 and 5 ? 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment