Note that there are some explanatory texts on larger screens.

plurals
  1. POraw_input() invalid syntax
    primarykey
    data
    text
    <p>I want to input a string of five numbers with spaces between them and use <code>raw_input()</code> for it. However the second item(the portion that's between the first and second spaces) is claimed to be a <code>syntax error</code>. Code below:</p> <pre><code>#class for final output - used as an ad hoc static string class StatString: outstring = "" #function to check if Boom or Trach or both def BoomTrach(num,B,T): Boom = False Trach = False temp = num while temp != 0: if num % B == 0: Boom == True break if (temp % 10) % B == 0: Boom = True break temp = (temp - temp % 10) / 10 temp = num while temp != 0: if num % T == 0: Trach = True break if (temp % 10) % T == 0: Trach = True break temp = (temp - temp % 10) / 10 if Boom and Trach: herestring.outstring = herestring.outstring + "Boom-Trach" elif Boom: herestring.outstring = herestring.outstring + "Boom" elif Trach: herestring.outstring = herestring.outstring + "Trach" else: herestring.outstring = herestring.outstring + str(num) #start of "main" portion def main(): inS = raw_input() &lt;&lt;&lt;--- Input here arr = inS.split(' ') X = int(arr[0]) Y = int(arr[1]) CountFrom = int(arr[2]) jump = int(arr[3]) CountUntil = int(arr[4]) #variable for error check error = False #checking for errors if X &lt; 1 or X &gt; 9 or Y &lt; 1 or Y &gt; 9: print "X and Y must be between 1 and 9" error = True if jump == 0: print "jump cannot be 0" error = True elif (CountUntil - CountFrom) % jump != 0: print "cannot jump from %d to %d",CountFrom,CountUntil error = True if error: exit() if CountFrom &lt; 0 and CountUntil &lt; 0 and jump &gt; 0: jump = jump * (-1) herestring = StatString() while CountFrom != CountUntil: BoomTrach(CountFrom,X,Y) CountFrom = CountFrom + jump if(CountFrom != CountUntil): herestring.outstring = herestring.outstring + "," print herestring.outstring </code></pre> <p>error message: (the second 1 was marked as the source of the error)</p> <pre><code>&gt;&gt;&gt; 1 1 1 1 1 SyntaxError: invalid syntax &gt;&gt;&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload