3

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='')
bad_coder
  • 11,289
  • 20
  • 44
  • 72
M.Ramzan
  • 317
  • 1
  • 19

1 Answers1

2

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))
bad_coder
  • 11,289
  • 20
  • 44
  • 72