What's wrong in this code.. I need to print only string not #string but it prints including # | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's wrong in this code.. I need to print only string not #string but it prints including #

String = " hello my name is selva and I'm working in #Google and my friend's are working in #Amazon and #Flipkart " ans = String. split() for i in ans: if "#" in i: print (i)

2nd Aug 2021, 2:55 PM
SelvaKumar
2 Answers
+ 9
print (i[1:])
2nd Aug 2021, 2:59 PM
Simba
Simba - avatar
+ 1
SelvaKumar How about this one? :- print(input().replace("#", "")) # Hope this helps
3rd Aug 2021, 7:26 AM
Calvin Thomas
Calvin Thomas - avatar