+ 4
Is there any other method to do it?
I have made a simple program to remove spaces from a string in python. But I want to know is there any other method to do it. Please let me know is there any other method to do it. https://code.sololearn.com/ca8domPwiGm1/?ref=app
3 Answers
+ 8
st=input()
st=st.replace(" ","")
print (st)
+ 3
Yup but without using any built in methods
str=""
for j in i:
if j!=" ":
str+=j
print(str)
+ 2
Yes there are đ
1- with replace method:
txt = input(
clean_txt = i.replace(" ", "")
2- without built in method:
txt = str(input())
for i in range(len(txt)):
char = txt[i]
if char != " ":
clean_txt += char
This is what I know may be there is a better way to do itđ€·ââïž.