s = input() def hashtagGen(text): s1 = s.replace(" " , "") return "#"+s1 print(hashtagGen(s)) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

s = input() def hashtagGen(text): s1 = s.replace(" " , "") return "#"+s1 print(hashtagGen(s))

Please I am stuck with this error

22nd Jun 2022, 2:12 PM
Raj Jaiswal185
8 Answers
+ 2
Raj Jaiswal185 Remove your return statement and rewrite it. I think it having some invalid characters.. edit: if not work or further... This may help you, to share links 👇 https://www.sololearn.com/post/75089/?ref=app
22nd Jun 2022, 3:26 PM
Jayakrishna 🇮🇳
+ 3
s = input() def fn(txt): s1 = txt.replace(" ", "") return '#' + s1 print(fn(s)) see s1 = txt.replace... not s.replace (parameter there, you pass the s argument to it later on when you print call) Buut for some reason, it didn't work at first when I changed your func this way. I got a new tab and did this and it worked. I don't know why.
22nd Jun 2022, 2:41 PM
Korkunç el Gato
Korkunç el Gato - avatar
+ 2
Jayakrishna🇮🇳 Thank you so much is worked 👍✨😍
22nd Jun 2022, 3:31 PM
Raj Jaiswal185
+ 1
Ok. But as already said, share code link by saving it. Identation is very important in python, that's you can't find it by above copy paste code if any.. Also share full task description.. Hashtag generator is not enough.. Python has 5+ courses.. If I am not sovled it , then I can't open it.
22nd Jun 2022, 2:39 PM
Jayakrishna 🇮🇳
+ 1
You're welcome..
22nd Jun 2022, 3:32 PM
Jayakrishna 🇮🇳
0
Save code and share link here along with clear details of your task description, doubts, error details, difficulty.. Etc,.. Code is truncated... Don't add code in question place..
22nd Jun 2022, 2:22 PM
Jayakrishna 🇮🇳
0
I want to make a hastag generator for the lesson end project and I have also tried the solution given there but it is not working
22nd Jun 2022, 2:24 PM
Raj Jaiswal185
0
We are creating our own social network application and need to have a hashtag generator program. Complete the program to output the input text starting with the hashtag (#). Also, if the user entered several words, the program should delete the spaces between them. Sample Input code sleep eat repeat Sample Output #codesleepeatrepeat Hint You can use the replace() function to replace the spaces (" ") with empty strings (""). See how it works: I don't know how to share the link of code but the course is python core lesson 34
22nd Jun 2022, 3:03 PM
Raj Jaiswal185