الله@lemmy.world to General Programming Discussion@lemmy.ml · 7 months agoApparently this code is not good enough can someone help me?lemmy.mlimagemessage-square7linkfedilinkarrow-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 · 7 months agomessage-square7linkfedilink
minus-squarevintageballs@feddit.orglinkfedilinkDeutscharrow-up2·edit-27 months agoDrop 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-up1·7 months agoohhh 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