+ 2
Why isn't code working
Please someone should explain to me why this code for the book titles code project in the Python core tutorial isn't working. https://code.sololearn.com/ccbKMVExDPgk/?ref=app
5 ответов
+ 3
DarkPhoenix15
else part
print(books[k][0] +
str(len(books[k].replace('\n', ''))))
+ 2
DarkPhoenix15
There might be \n at the end of last character so you should remove that
+ 2
AJ
How?
+ 2
DarkPhoenix15
first replace string using replace function then get books length
replace('\n', '')
+ 2
Thanks but I solved it. The issue was I didn't didn't properly define the if condition