Coding Project

For my coding project, I decided to make somewhat of a joke. I decided to code a program that allows the user to input a number, claiming to be able to read the user’s mind, when in reality, it’s just repeating the inputted number.

Link to code

Flowchart:

1. Asks user to input a number

2. Pretends to think while displaying lines like “reading brainwaves”

3. “Guesses” the number by repeating whatever the user input

4. Asks if it was correct, and allows user to play again.

First, I imported “time” and “random” in order to be able to create delays in between messages, as well as pick random lines, which will be demonstrated shortly.

Next, I created the function “read_mind”, and added a short description.

This monstrosity of code was just my lazy attempt at making the program’s responses random. I didn’t want to figure out how to use %s and the like, so I just repeated each line a different amount of times, so that I could have rare lines like “Super rare message.”

This picks 3 lines from the line bank to display during the “loading” process.

This line is where all the magic happens, as the program repeats the inputted number to you, successfully reading your mind.

Finally, this whimsically asks the user whether or not it was right, even though it already knows. It concludes by asking the user if they would like to play again.


Comments

One response to “Coding Project”

  1. mcrompton Avatar
    mcrompton

    Good job, Josh. You’ve checked all the boxes of the assignment and had some fun doing it. Not sure that I will keep this code to amuse myself for years to come, but it did make me chuckle. Note that a flowchart is an actual graphical representation of the code that you are planning to write. You have done this in text form and I can see the expression of the codes logic so I will mark that aspect complete. I’m curious to know what your programming background was prior to this assignment. Did you have some python skills, or did you use a tutorial to learn from scratch? Please reply to my comment below.

Leave a Reply

Your email address will not be published. Required fields are marked *