호그와트

간단한 오름차순

영웅*^%&$ 2022. 12. 21. 19:12
728x90

#어떤 숫자들이 입력되었을 때 그게 오름차순인지 파악 

def is_ascending(numbers):
  for i in range(1, len(numbers)):
    if (numbers[i] < numbers[i-1]):
      return False
    return True

k = input()    
s = k.split()      
  
a = [] 
for nums in s:
  a.append(int(nums))

print(is_ascending(a))  

728x90