What does this error mean on hackerrank.com?

I am doing challenges on hackerrank.com in Python language and I have difficulties with understanding the error message I am receiving.

This is the code:

for i in range(1):
    in1 = int(input())
    if in1 > 1000:
        print('error')
        break
    else:
        roll1 = set(input().split())
        in2 = int(input())
    if in2 >  1000:
        print('error')
        break
    else:
        roll2 = set(input().split())
    if len(roll1.union(roll2)) > 1000:
        print('error')
        break
    else:
        print(len(roll1.union(roll2)))

This is the error I don't understand:

Runtime Error
Error (stderr)
Traceback (most recent call last):
  File "Solution.py", line 6, in <module>
  File "<string>", line 1
    1 2 3 4 5 6 7 8 9
      ^
SyntaxError: invalid syntax

This is the input:

Input (stdin)
9
1 2 3 4 5 6 7 8 9
9
10 1 2 3 11 21 55 6 8

This is expected output:

Expected Output
13

I don't expect you to solve for me this challenge. I just don't understand this error message. And it is in my previous solutions too. What it is about?

Thanks :-).

I can reproduce the error. This code produces an error in Python 2 due to input() being defined as eval(raw_input()). In Python 3, raw_input was renamed as input. Adding input = raw_input to the top of the program resolves the error. Also running the program under Python 3 does also.

You can produce the same error in both versions with the following:

>>> eval("1 2 3 4 5 6 7 8 9")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1
    1 2 3 4 5 6 7 8 9
      ^
SyntaxError: invalid syntax

The presence of File "<string>", line 1 in the traceback is a sign that the error came from a call to eval.

What does 'Insufficient Account Balance' error message mean , HackerRank for Work displays 'Insufficient Account Balance' when a recruiter has run out of test invites. If you are seeing this message HackerRank for Work displays 'Insufficient Account Balance' when a recruiter has run out of test invites. If you are seeing this message while trying to start a test attempt, you need to contact th

1 2 3 4 5 6 7 8 9 python is reading all this as string, try: listX = list(map(int, input.split()))

Use the listX where u need

The "Terminated due to timeout" status in HackerRank Tests , It could also mean that your code is running into infinite computations, has an To overcome and avoid the error, refer the HackerRank Coding� There are two possible causes of “abort called” error : * You are using a container like vector,array,stack etc. in C++ and size of the container becomes very large.

It is an error of python 2 and your code is in python 3 so make sure that u have selected python 3 in hackerrank

FAQs – HackerRank Support Center, Can I attempt Tests or solve questions on my phone? What does 'Insufficient Account Balance' error message mean? The HackerRank Test platform is at� Join over 11 million developers in solving code challenges on HackerRank, one of the best ways to prepare for programming interviews.

What does this error mean on hackerrank.com?, I can reproduce the error. This code produces an error in Python 2 due to input() being defined as eval(raw_input()) . In Python 3, raw_input� I recently made the switch from JS to Python and holy cow I love it. This is my first python project and also my first web-scraper. I'd love it if anyone could visit my github and review my code/run the project and give me any tips on better practices, optimizations I could make or any other suggestions.

What is the solution for the run time error/timeout on HackerRank in , This means your solution is not able to pass all the test case. for example if you are solving a problem in O(n^2) which can be solved in O(� Runtime errors. These errors occur when: Invalid mathematical operations are executed. For example, when you try to divide a number by zero, calculate the square root of a negative number etc.

Hackerrank runtime error. - learnpython, Runtime error means that your code may be good but for some reason at some point when You are probably dividing (while taking the modulo) by zero. HackerRank is the market-leading technical assessment and remote interview solution for hiring developers. Learn how to hire technical talent from anywhere!

Comments
  • I got the expected output. Perhaps you have an indentation problem in your original code, it's hard to say because the code here is not formatted properly.
  • Can you format your code?
  • Ok. I reformat my code. I think that could be the problem. Because I cannot find that challenge now on hackerrank.com because I abandoned it we will never find out :-p. In PyCharm this code gave me positive output so I think it is good. Thanks for the help.
  • This is a good solution. I realized that in this hackerrank.com ide I can change the compiler to Python 3. I didn't know that earlier. I also change roll1 = set(int(input().split())) to roll1 = set(input().split()) and now the challenge is accomplished. Thank you very much for help.
  • The challenge was about sets so I think it is not the case but thanks :-).
  • try changing ``` roll1 = set(input().split()) ``` to roll1 = set(int(input().split()))
  • Tried: roll1 = set(input().split()) ``` to roll1 = set(int(input().split())), still got the same error message. It is strange because in PyCharm I got positive results.