File "C:\Users\Administrator\Desktop\樱花树.py", line 5 def tree(n, l); ^ SyntaxError: invalid syntax
时间: 2024-05-06 15:20:43 浏览: 27
invalid syntax 是一个 Python 的语法错误
There is a syntax error in the code. The semicolon after the parameter "l" in the function definition should be replaced with a colon.
Corrected code:
```
def tree(n, l):
for i in range(1, n + 1):
print(" " * (n - i) + "*" * (i * 2 - 1))
for j in range(l):
print(" " * (n - 1) + "| |")
```
阅读全文