-3
i=9
while i>0:
    for j in range(1,i+1):
        print(str(i)+"*"+str(j)+"="+str(i*j),end=" ")
    print("\n")
    i--

SyntaxError: multiple statements found while compiling a single statement [Real Python Rookie]

Owen Wong
  • 1
  • 2
  • `i--` is not what you'd use in Python, Python has no `--` operator. You'd use `i -= 1` instead. However, that line by itself would not throw an exception with exactly the same message. – Martijn Pieters Sep 06 '18 at 13:55
  • The error you show is actually never emitted by Python itself. What program are you using that would throw that error? Are you trying to have a shell parse this (since you are using `shell` as a tag)? – Martijn Pieters Sep 06 '18 at 13:58
  • Ah, you are pasting multiple lines directly into the IDLE console. Don't do that. Put that into a *file*, then run the file. – Martijn Pieters Sep 06 '18 at 14:00
  • Oh I see literally just starting python an hour ago Thank u so much – Owen Wong Sep 06 '18 at 14:05

1 Answers1

0

i-- doesn't work in python. -- is no existing operator. You could use i -= 1 for example.

Stef van der Zon
  • 633
  • 4
  • 13