CHAR = '*'
def rectangle(height ,width):
"""prints a rectangle."""
for row in range(height):
for col in range(width):
print(CHAR end = '') 程序总是提醒我说end的用法是不合法的,有语法错误,怎么才是正确的用法????
print()
def square(side):
"""Prints a suqare."""
rectangle(side,side)
def triangle(height):
"""Prints a right triangle."""
for row in range(height):
for col in range(1,row +2):
print(CHAR end = '')
print()
print ("", end=" ")
试试。