Now You Code 3: Twitter Hastag Detector

Let's use Python's built-in string functions to help us write a program to detect Twitter hashtags in text. Here's how it should work:

Example Run 1:

Enter Tweet: You got a 50 on the exam? #iamsad for you!
Hashtag: #iamsad

Example Run 2:

Enter Tweet: #lol too funny #joke #haha
Hashtag: #lol
Hashtag: #joke
Hashtag: #haha

Example Run 3:

Enter Tweet: Happy birthday @mafudge
Hashtag: none

Your approach should be to split the text into words and for each word look for the hashtag # at the start of the word.

Step 1: Problem Analysis Program

Inputs:

Outputs:

Algorithm (Steps in Program):


In [2]:
## Step 2: todo write code for full problem

Step 3: Questions

  1. What happens when the hashtag is not in the beginning of the word? ex. it wights 64# that's #heavy? Is this a problem?

Answer:

  1. Describe an approach for refactoring this code to use a function? What would the arguments and return values be? (Don't refactor the code, just describe your approach!)

Answer:

  1. Is there a way to write this program without a loop?

Answer:

Step 4: Reflection

Reflect upon your experience completing this assignment. This should be a personal narrative, in your own voice, and cite specifics relevant to the activity as to help the grader understand how you arrived at the code you submitted. Things to consider touching upon: Elaborate on the process itself. Did your original problem analysis work as designed? How many iterations did you go through before you arrived at the solution? Where did you struggle along the way and how did you overcome it? What did you learn from completing the assignment? What do you need to work on to get better? What was most valuable and least valuable about this exercise? Do you have any suggestions for improvements?

To make a good reflection, you should journal your thoughts, questions and comments while you complete the exercise.

Keep your response to between 100 and 250 words.

--== Double-click then Write Your Reflection Below Here ==--


In [ ]:
# RUN THIS CODE CELL TO TURN IN YOUR WORK!
from ist256.submission import Submission
Submission().submit()