Python Challenge: Social Media Pro [Solved] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Python Challenge: Social Media Pro [Solved]

In the Python Regular Expressions Special Sequences lesson there’s a challenge called Social Media Pro. Using the pattern r"#\w+" only test 4 does not pass, but its details are hidden. Anyone have any idea what this test is looking for? EDIT: For anyone who searches this problem later, I figured out that Test 4 will pass if you allow for hyphens (- symbol) to be found in the pattern. Link to challenge (only works on mobile): https://sololearn.com/coach/274/?ref=app

18th Oct 2020, 9:33 AM
Brylram
Brylram - avatar
4 Answers
+ 1
✌️
22nd Oct 2020, 3:29 AM
ɴɪᴛʜʏᴀɴᴀɴᴅᴀ
ɴɪᴛʜʏᴀɴᴀɴᴅᴀ - avatar
+ 1
import re text = input() #your code goes here #use re.findall() with r"#\w+" as the regex list = re.findall(r"#\w+", text) for i in list: print(i)
8th Feb 2022, 9:42 AM
Silvie Skalická
0
Looking for this solution as well
11th Jan 2022, 7:45 AM
André Marion
André Marion - avatar
0
Im on this one now and stuck, i cant figure out how to output the whole hashtag
13th Jan 2022, 3:22 PM
William Alley
William Alley - avatar