This was inspired by Shark Tank episode where Trisha Prabhu pitched her app 'ReThink' to stop cyber bullying. As soon as I saw it, I thought a beginner could write a simple program to mimic what she is doing.
Note: If you stumbled upon this post and are wondering what this is about, start here.
Here is the usecase:
- Program asks user for text
- User types text
- Program analyzes text and if it is offensive, asks user if she really wants to post it
- Program does not send text if user agrees it is offensive
- Program sends text if user still wants to send it, but warns user of consequences
Programming constructs used:
- User input
- String operations
- Looping
- Conditional statements
- Error handling
You can keep a list of 'offensive' words and check if text contains any of them in order to decide if the text is offensive or not.
Here is what a sample output would look like:
In the screenshot above, I have run the program several times to show the different outputs.
Bonus:
Handle upper and lower case input (Eg: Y, y, yes, Yes,YES) as seen in the example.
Handle invalid input as seen in the example.
Happy coding!
Note: If you stumbled upon this post and are wondering what this is about, start here.
Here is the usecase:
- Program asks user for text
- User types text
- Program analyzes text and if it is offensive, asks user if she really wants to post it
- Program does not send text if user agrees it is offensive
- Program sends text if user still wants to send it, but warns user of consequences
Programming constructs used:
- User input
- String operations
- Looping
- Conditional statements
- Error handling
You can keep a list of 'offensive' words and check if text contains any of them in order to decide if the text is offensive or not.
Here is what a sample output would look like:
In the screenshot above, I have run the program several times to show the different outputs.
Bonus:
Handle upper and lower case input (Eg: Y, y, yes, Yes,YES) as seen in the example.
Handle invalid input as seen in the example.
Happy coding!