2
you are viewing a single comment's thread
view the rest of the comments
[-] jdnewmil@lemmy.ca 1 points 1 year ago* (last edited 1 year ago)

Finish putting the + in the line and print it out again:

name = 'World'
line = '+'
for _ in name:
    line += '-'
line += '+'
print(line)
print('|' + name + '|')
print(line)

Strings also can be repeated with a * operator:

name = 'World'
line = '+' + '-'*len(name) + '+'
print(line)
print('|' + name + '|')
print(line)
this post was submitted on 03 Aug 2025
2 points (62.5% liked)

General Programming Discussion

10011 readers
1 users here now

A general programming discussion community.

Rules:

  1. Be civil.
  2. Please start discussions that spark conversation

Other communities

Systems

Functional Programming

Also related

founded 7 years ago
MODERATORS