Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def verifica_ordinato(array):
- if len(array) < 2:
- return True
- for i in range(1, len(array)):
- if array[i] < array[i - 1]:
- return False
- return True
- def principale(array):
- if not verifica_ordinato(array):
- array.sort()
- f = open('input.txt', "r")
- righe = f.read().strip().split('\n')
- f.close()
- array = [int(i) for i in righe if i]
- principale(array)
- print(array)
- '''
- Esempio di input.txt:
- 3
- 67
- 3
- 8
- 89
- 64
- 34
- 54
- 76
- 1
- 98
- 7
- 4
- '''
Add Comment
Please, Sign In to add comment