+ 1

Help me please with this task

" We are building a social networking application and we need a hashtag generator program. Write a program to display the entered text with a hashtag (#). If the user enters several words, the program should remove the spaces between them. Input example code sleep eat repeat Output example #codesleepeatrepeat Advice You can use the replace () function to replace spaces ("") with empty strings (""). " I understood return, but i don't understand how write code to this task, help me, pls

29th Aug 2021, 8:34 AM
Dmitriy Fursenko
Dmitriy Fursenko - avatar
5 ответов
+ 5
Rushikesh , you are showing a really nice code to help someone solving a task. we all appreciate this very much!  (this is my personal statement - but it is not to criticize someone !!) but there is an issue by giving a ready solution, when the op has not done and shown his attempt first. as a part of the community i believe that learning by doing is more helpful, than just using a ready-mad solution. we should act more as a mentor.  it is a very successful way when we are giving hints and help, so that the op is able to solve his task by himself. it would be great if you are going to help us to keep sololearn what it is: ▪︎a unique place to learn (we are a "self" learning platform!) ▪︎an absolutely great community that is willing to help other people  ▪︎a great resource of people which has an unbelievable knowledge in coding and a long lasting experience ▪︎a place to meet people and to discuss with them all the possible points of view thanks for your understanding
29th Aug 2021, 10:18 AM
Lothar
Lothar - avatar
+ 2
it's simple; You have to print user's input replacing spaces with empty strings then add a '#' in the beginning. Eg. inp = input("Enter text: ") inp = inp.replace(" ", "") inp = "#"+inp print(inp)
29th Aug 2021, 9:55 AM
Sousou
Sousou - avatar
0
As sl said Remove spaces with replace method then put # as the first letter see how i solved the problem https://code.sololearn.com/c6RDAH363n0T/?ref=app
29th Aug 2021, 8:48 AM
Vtec Fan
Vtec Fan - avatar
0
Lothar ok got it
29th Aug 2021, 10:25 AM
Vtec Fan
Vtec Fan - avatar
0
U can use replace() to replace " " Space With "" Empty To do so wrtie X.replace(string to be replaced, string in place of removed one) Text = "anything there is" Tex = text.Replace(" ", "") Print("#" + tex)
31st Aug 2021, 4:37 AM
Utkarsh Gautam