+ 1

Python 35.2 hashtag generator

Getting a lot of python work in today! If someone could help me figure out where my code went wrong that would be great! The SoloLearn material is great but they don’t teach how to handle input in the lessons groups often, then tell us to do all input stuff with it in their challenge problems. Tough sometimes, like this! The input is a word or string and it removes spaces and prefixes with a hashtag. How can I fix my code to do that? https://code.sololearn.com/cPRDt8HQR46M/?ref=app

23rd Jan 2021, 6:34 PM
Steve Barone
Steve Barone - avatar
6 Antworten
+ 6
Steve Barone Return text1 or do like this s = input() def hashtagGen(text): #your code goes here return ("#" + text.replace(" ", "")) print(hashtagGen(s))
23rd Jan 2021, 7:00 PM
A͢J
A͢J - avatar
+ 3
Your function does not return text1, that's why there is no output.
23rd Jan 2021, 6:38 PM
Lisa
Lisa - avatar
+ 1
ah thanks Lisa, the simple mistakes always seem to get ya! I Am AJ ! appreciate the input, i will try your method as well!
26th Jan 2021, 2:55 AM
Steve Barone
Steve Barone - avatar
0
I do not understand the logic behind the answer to this question. I also think the question is extremely poorly worded relative to the content that proceeded it. The designers are making the assumption that the student is able to "try" every exercise and complete every practice. Not all of us can afford to pay-to-play.
28th Sep 2021, 8:02 PM
Beckie Rich
0
s = input() def hashtagGen(text): #your code goes here tws = text.replace(" ", "") tws2 = "#" + tws return tws2 print(hashtagGen(s)) Ask if u need help!
17th Nov 2021, 8:53 AM
Stefan Bartl
Stefan Bartl - avatar