From c54dfca75d8fabb637d972227f28b8769f7289cf Mon Sep 17 00:00:00 2001 From: Valentin Gehrke Date: Fri, 13 Nov 2015 00:43:11 +0100 Subject: [PATCH] Updated sorting_algorithms.py to python3 --- sorting_algorithms.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sorting_algorithms.py b/sorting_algorithms.py index 6e558b0..fa17b2c 100644 --- a/sorting_algorithms.py +++ b/sorting_algorithms.py @@ -180,7 +180,7 @@ class SortTester: data = list([ randint(0, size) for i in range(0,size) ]) for algorithm in self.algorithms: - print "Testing %s..." % algorithm.__name__ + print("Testing %s..." % algorithm.__name__) inst = algorithm() c = data[:] s = inst.sort(c) @@ -206,10 +206,10 @@ def main(): size= 1000 result = SortTester(list( SortAlgorithm.__subclasses__() )).test(size=size) for cls, r in result.items(): - print "%-12s: %10d, %d compares, %d swaps" % (cls.__name__, r[0]+r[1], r[0],r[1]) + print("%-12s: %10d, %d compares, %d swaps" % (cls.__name__, r[0]+r[1], r[0],r[1])) def test(): - print HeapSort().sort([randint(0,500) for i in range(0,100)]) + print(HeapSort().sort([randint(0,500) for i in range(0,100)])) if __name__ == '__main__': main()