From f8236d49cbce99ebe08df4370e2019fb4bae3090 Mon Sep 17 00:00:00 2001 From: Bernardo Sulzbach Date: Mon, 7 Jul 2014 20:04:46 -0300 Subject: [PATCH] Finished --- src/further_examples/arrays_and_strings/reverse_str.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/further_examples/arrays_and_strings/reverse_str.py b/src/further_examples/arrays_and_strings/reverse_str.py index 14f4a22..e058305 100644 --- a/src/further_examples/arrays_and_strings/reverse_str.py +++ b/src/further_examples/arrays_and_strings/reverse_str.py @@ -48,7 +48,7 @@ reverse_lambda = lambda s: s[::-1] # We define some short strings to test our functions. strings = ('buffy', 'foo', 'bar') # We announce what we are doing. -print(', '.join(strings), ' should appear reversed four times if the function is working.\n') +print(', '.join(strings), ' should appear reversed if the function is working.\n') print('{:<30}:'.format('Function name'), 'benchmarking result (lower is better):') # Iterate over a tuple of functions. for function in (reverse_1, reverse_2, reverse_3, reverse_lambda): @@ -57,6 +57,5 @@ for function in (reverse_1, reverse_2, reverse_3, reverse_lambda): print("{:<30}:".format(name), timeit(name + "('string')", setup='from __main__ import ' + name)) # We print the output so that we can check if the function is working as expected. print(', '.join(map(function, strings)), '\n') -# So that the console stays open and waits the user to kill it. -from os import system -system('pause') +# We wait until the user wants to quit. +input('Press Return to quit.')