Collecting hashtags

Write code · Basic · §3.3 Working with strings

Complete the function solution, which returns a list of the hashtags in the post text text, in the order they appear.

A hashtag is a whole word that starts with # and is at least 2 characters long. Words are separated by a single space.

If the same hashtag appears more than once, include it only once, at the place where it first appears. Uppercase and lowercase letters are treated as different characters.

Function

solution(text)

Constraints

Examples

textresult
'today #python study #AI #python'['#python', '#AI']
'a post with no hashtags'[]

Starter code

def solution(text):
    answer = []
    return answer

Solve this problem in your browser

Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.