mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-06 02:13:15 +08:00
Simplify code by dropping support for legacy Python (#1143)
* Simplify code by dropping support for legacy Python * sort() --> sorted()
This commit is contained in:
@ -1,17 +1,16 @@
|
||||
from __future__ import print_function
|
||||
# Function to print element and NGE pair for all elements of list
|
||||
def printNGE(arr):
|
||||
|
||||
|
||||
for i in range(0, len(arr), 1):
|
||||
|
||||
|
||||
next = -1
|
||||
for j in range(i+1, len(arr), 1):
|
||||
if arr[i] < arr[j]:
|
||||
next = arr[j]
|
||||
break
|
||||
|
||||
|
||||
print(str(arr[i]) + " -- " + str(next))
|
||||
|
||||
|
||||
# Driver program to test above function
|
||||
arr = [11,13,21,3]
|
||||
printNGE(arr)
|
||||
|
Reference in New Issue
Block a user