الله@lemmy.world to General Programming Discussion@lemmy.ml · 9 个月前Apparently this code is not good enough can someone help me?lemmy.mlimagemessage-square6linkfedilinkarrow-up15arrow-down13
arrow-up12arrow-down1imageApparently this code is not good enough can someone help me?lemmy.mlالله@lemmy.world to General Programming Discussion@lemmy.ml · 9 个月前message-square6linkfedilink
minus-squarevintageballs@feddit.orglinkfedilinkDeutscharrow-up2·9 个月前Drop the second loop entirely and just do print(line + '+') again at the end - line and lin2 contain the exact same string so it’s unnecessary to construct it twice.
minus-squareالله@lemmy.worldOPlinkfedilinkarrow-up2arrow-down1·9 个月前ohhh this is the answer i was looking for others suggested me some shit like name = “World” print(f"+‘’:-^{len(name)}}+\n{name|\n+{‘’:-^{len(name)}}+") i was confused AF
Drop the second loop entirely and just do
print(line + '+')again at the end -lineandlin2contain the exact same string so it’s unnecessary to construct it twice.ohhh this is the answer i was looking for
others suggested me some shit like
name = “World” print(f"+‘’:-^{len(name)}}+\n|\n+{‘’:-^{len(name)}}+")
i was confused AF