-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Made the code Python 3 compatible #407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Not quite right... $ python2 -c "for x in 'abc': print (x),"
$ python3 -c "for x in 'abc': print (x),"
See #405 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like #405 to keep all the items on one line.
Now it works great in Python 3 but it is now a syntax error in Python 2. You need to add from __future__ import print_function at the top of the file before any other imports. |
@@ -37,7 +38,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 =" ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please delete the space... print (arr[i],end =" ") --> print(arr[i], end=" ")
print() is now a function like all other functions so it should be formatted in the same way.
@ harshildarji Do you have |
Changed two characters which were the root cause of 'SyntaxError: Non-ASCII character '\xe2' in file main.py, but no encoding declared'
@cclauss The problem was in the explanation part at the very beginning of the script. But now it's solved, so I'm merging this PR now. |
No description provided.