Skip to content

Instantly share code, notes, and snippets.

@Kcrong
Created April 16, 2018 06:16
Show Gist options
  • Save Kcrong/dfbd66f5cf0242539faf8ad4c826d627 to your computer and use it in GitHub Desktop.
Save Kcrong/dfbd66f5cf0242539faf8ad4c826d627 to your computer and use it in GitHub Desktop.
세 수를 받고, 대소 관계를 >, ==, < 등의 기호로 보여주는 코드
ai = input('num 1: ')
bi = input('num 2: ')
ci = input('num 3: ')
inp = sorted([ai, bi, ci])
operators = ['>', '==', '<']
def exp_c(a, b, op):
return eval("{} {} {}".format(a, op, b))
for i in range(len(inp) - 1):
print(inp[i], end=' ')
for op_ in operators:
if exp_c(inp[i], inp[i + 1], op_):
print(op_, end=' ')
print(inp[-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment