0
Anyone explain why this is correct?
You are creating your own social network and need to turn words into hashtags. The code takes a word as input. Task Complete the hashtag() function to return the input word starting with the hashtag symbol (#). Then display the result on the screen. My code: #taking a word as input word = input() def hashtag(word): print("#"+ word) return word #display the result hashtag(word)
1 Réponse
+ 6
The reason it worked is not because you did it right but because you created a print statement with the # hashtag + word ... the return statement or in this case word had no place to return property though you called the function
word = input()
def hashtag(word):
return "#"+word
print(hashtag(word))
This is the correct way