Help me ,i am getting unexpected output in this code[SOLVED] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

Help me ,i am getting unexpected output in this code[SOLVED]

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

10th Nov 2020, 4:46 AM
Angry Student(Docvad)
Angry Student(Docvad) - avatar
7 Answers
+ 5
The last line doesn't end in "\n".
10th Nov 2020, 4:51 AM
David Ashton
David Ashton - avatar
+ 4
Såñtösh ,it only solves the item at the end of the array. the end= " "
10th Nov 2020, 5:30 AM
Angry Student(Docvad)
Angry Student(Docvad) - avatar
+ 3
I -_- D ,when you use the readlines() it outputs ["Harry Potter /n", "The Hunger Games /n", "Pride and Prejudice/n", "Gone With The Wind",]
10th Nov 2020, 5:29 AM
Angry Student(Docvad)
Angry Student(Docvad) - avatar
+ 2
print(words[0] + str(len(words) -1),end=" ") use end=" "
10th Nov 2020, 5:06 AM
Sâñtôsh
Sâñtôsh - avatar
+ 1
how does the file itself look?
10th Nov 2020, 5:18 AM
I -_- D
I -_- D - avatar
0
Davcod okay so like they said above. the last line doesn't has a \n character. that's why the unexpected output. if you add it it should be alright. let me know after you add it.
10th Nov 2020, 5:38 AM
I -_- D
I -_- D - avatar
0
Davcod I also see that some lines has a space before the new line character and some doesn't.
10th Nov 2020, 5:40 AM
I -_- D
I -_- D - avatar