Sunday, August 30, 2020

write a python program drawing grid

def grid(row, col):

  """version with string concatenation"""

  sep = '\n' + '+---'*col + '+\n'

  return sep + ('|   '*col + '|' + sep)*row


print(grid(3,7))

No comments:

Post a Comment