+ 3
Where i am wrong
Book titles
13 Respostas
+ 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()
+ 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()
+ 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()
+ 1
It is coming invalid syntax line 8
+ 1
paste your code here so they can help you
+ 1
Thanks but i was wrong i checked it again and i solved the puzzle
+ 1
But still i want to know where i was wrong
+ 1
Where i was wrong
+ 1
Please tell
+ 1
Thankyou guys â„ïž
+ 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()
0
Please tell
0
Tell us your problem