RohitA
BAN USER
Comments (3)
Reputation 10
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
My 2 Cents to the question
def trim(w):
org = w
new = ""
flag = False
for i in range(0,len(org)):
if i+1 < len(org) and org[i]!= " " and org[i+1] == " ":
new+= org[i]+" "
elif org[i]!=" ":
new+=org[i]
print new
if new[-1] == " ":
final = new[:-1]
else:
final = new
return final
Comment hidden because of low score. Click to expand.
0
of 0 vote
My 2 Cents to the question
def trim(w):
org = w
new = ""
flag = False
for i in range(0,len(org)):
if i+1 < len(org) and org[i]!= " " and org[i+1] == " ":
new+= org[i]+" "
elif org[i]!=" ":
new+=org[i]
print new
if new[-1] == " ":
final = new[:-1]
else:
final = new
return final
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
- RohitA November 28, 2014