Issue
This is an answer for a question in hacker rank Python challenges. I am using Python 3.0. It works fine on their web site, but it shows an error in my PyCharm IDE as:
"End of statement expected".
if __name__ == '__main__':
n = int(input())
print(*range(1, n+1), sep='', end='')
Solution
May be Your PyCharm IDE using Python 2.x. In Python 2.x this line print(*range(1, n+1), sep='', end='')
is not correct syntactically.
This code will work for you in Python 2.x
if __name__ == '__main__':
n = int(input())
list=range(1, n+1)
print ''.join(map(str, list))
Answered By - user4963716
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.