From d6501d58606936207bec8e490973644bd90e3f82 Mon Sep 17 00:00:00 2001 From: cclauss Date: Wed, 3 Oct 2018 14:19:37 +0200 Subject: [PATCH] print() is a function in Python 3 @s-sanyal Can we _please_ get Travis CI turned on so that these issues will be automatically detected before PRs are reviewed? --- data_structures/Stacks/Stock-Span-Problem.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/data_structures/Stacks/Stock-Span-Problem.py b/data_structures/Stacks/Stock-Span-Problem.py index 658ac3cbfb5e..3f475eb1c410 100644 --- a/data_structures/Stacks/Stock-Span-Problem.py +++ b/data_structures/Stacks/Stock-Span-Problem.py @@ -6,6 +6,9 @@ number of consecutive days just before the given day, for which the price of the stock on the current day is less than or equal to its price on the given day. ''' +from __future__ import print_function + + def calculateSpan(price, S): n = len(price) @@ -37,7 +40,7 @@ def calculateSpan(price, S): # A utility function to print elements of array def printArray(arr, n): for i in range(0,n): - print arr[i], + print(arr[i], end=' ') # Driver program to test above function @@ -48,4 +51,4 @@ def printArray(arr, n): calculateSpan(price, S) # Print the calculated span values -printArray(S, len(price)) \ No newline at end of file +printArray(S, len(price))