+ 2

Can anyone explain why 'very' and 'long' didn't fit the width 8?. Thanks in Advance 😊

https://code.sololearn.com/cUC90PlCQBne/?ref=app

21st Sep 2021, 12:28 PM
Surya T
Surya T - avatar
7 Respuestas
+ 5
Try to place in longer words, it will break properly 👍
21st Sep 2021, 12:51 PM
Ipang
+ 2
lpang , I purposely checked using repeated words, because the repeated word doesn't fit to the width. I was confused by that.
21st Sep 2021, 1:35 PM
Surya T
Surya T - avatar
+ 2
Surya T don't forget to count the " ". If you try wrap.(string, 9) then "very very" and "very long" will wraped together.
21st Sep 2021, 1:56 PM
Coding Cat
Coding Cat - avatar
+ 2
Yes, Thanks for the answer😊
21st Sep 2021, 2:07 PM
Surya T
Surya T - avatar
+ 1
But is it clear now?
21st Sep 2021, 1:56 PM
Ipang
0
Okay bro 👌
21st Sep 2021, 2:20 PM
Ipang
0
import textwrap string = "This is very very very long long string." print(textwrap.wrap(string,9)) Use this it is showing in one line now 😅
23rd Sep 2021, 6:19 AM
VSatish
VSatish - avatar