Hello, I am new in python, I found this code, but I don’t understand how it prints as if you have a condition.
Pseudocode:
If the string lenght > 10 characters
replace string with FirtsCharacter + String lenght -2 + LastCharacter
else
print Original string
CODE:
for i in [0]*int(input()):
w=input();
l=len(w)-2;
print([w,w[0]+str(l) + w[-1]][l>8])
I don’t know why is set this [l>8]
print([w,w[0]+str(l) + w[-1]][l>8])
Thanks!