+ 3

Where i am wrong

Book titles

22nd Nov 2020, 9:37 AM
Thakkar Heer
Thakkar Heer - avatar
13 Respuestas
+ 1
file = open("/usercode/files/books.txt", "r") #your code goes here mylist=[] i=0 for word in file: mylist .append(word) for x in my list: first_letter=mylist[i][0] if i+1==len(mylist): no_char=str(len(mylist[i])) else: no_char=str(len(mylist[i])-1) print(first_letter+no_char) i+=1 file.close()
22nd Nov 2020, 9:44 AM
Thakkar Heer
Thakkar Heer - avatar
+ 10
# THAKKAR HEER here is your solution # There was a space between my and list at line 8. # At line 9 there was indentation error. Just add a space there. # I have fixed all the bugs just copy this code and paste it. # your code below file = open("/usercode/files/books.txt", "r") #your code goes here mylist=[] i=0 for word in file: mylist .append(word) for x in mylist: first_letter=mylist[i][0] if i+1==len(mylist): no_char=str(len(mylist[i])) else: no_char=str(len(mylist[i])-1) print(first_letter+no_char) i+=1 file.close()
22nd Nov 2020, 9:49 AM
ツSampriya😘ツ
ツSampriya😘ツ - avatar
+ 3
actually this look much better and simpler file = open("/usercode/files/books.txt", "r") #your code goes here for l in (file.readlines()): line = l.rstrip("\n") print(line[0]+str(len(line))) file.close()
22nd Nov 2020, 9:54 AM
Med Amine Fh
Med Amine Fh - avatar
+ 1
It is coming invalid syntax line 8
22nd Nov 2020, 9:41 AM
Thakkar Heer
Thakkar Heer - avatar
+ 1
paste your code here so they can help you
22nd Nov 2020, 9:42 AM
Med Amine Fh
Med Amine Fh - avatar
+ 1
Thanks but i was wrong i checked it again and i solved the puzzle
22nd Nov 2020, 9:43 AM
Thakkar Heer
Thakkar Heer - avatar
+ 1
But still i want to know where i was wrong
22nd Nov 2020, 9:44 AM
Thakkar Heer
Thakkar Heer - avatar
+ 1
Where i was wrong
22nd Nov 2020, 9:44 AM
Thakkar Heer
Thakkar Heer - avatar
+ 1
Please tell
22nd Nov 2020, 9:44 AM
Thakkar Heer
Thakkar Heer - avatar
+ 1
Thankyou guys ♥️
22nd Nov 2020, 10:44 AM
Thakkar Heer
Thakkar Heer - avatar
+ 1
BOOK TITLE file = open("/usercode/files/books.txt", "r") #your code goes here for l in (file.readlines()): line = l.rstrip("\n") print(line[0]+str(len(line))) file.close()
23rd Nov 2020, 7:09 PM
Sunthari
Sunthari - avatar
0
Please tell
22nd Nov 2020, 9:37 AM
Thakkar Heer
Thakkar Heer - avatar
0
Tell us your problem
22nd Nov 2020, 9:40 AM
Med Amine Fh
Med Amine Fh - avatar