Programming a Brand Name Generator in Python

In my previous article, I used an Ubuntu server on EC2 to host a virtual Python environment. This time we will do a bit more with Python.
Homebrew
Homebrew is a popular package management system for Mac. The following command will install Homebrew as seen in Image 1.
/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then, I confirmed that Homebrew was installed (Image 2).

Python3
Knowing Python3 was on my machine, I wanted to check exactly which version was running, so I ran the below command. Image 3 shows the output in Terminal.
python3 --version

For fun and to confirm everything was working, I then ran Python3 with the command python3, played with a few lines, made a “Hello World,” added 2+6, etcetera (Image 4).

I then wanted to stop working in interactive mode, so I entered quit() as seen in Image 5.

The Python interactive session that I was just in allows me to write lines of code, but when the session is closed, I lose everything that was written. Therefore it is common to write Python programs by using plain text files. As you see in Image 6, I used vim and wrote .py at the end of a file named brandnamegenerator to make a Python file rather than a standard text file.

This then brought me into text editing. I proceeded to write the following in Image 7, and saved it with :w

Now the script was ready. I ran it with the command:
python3 brandgeneratorname.py
First the question about my city came up, to which I responded “Philly.”
Then the question about my family dog came up, to which I responded “Nitro.”
Then the consequent output was: Your band name could be Philly Nitro
Image 8 shows this final, success outcome (except a typo, “band name” instead of “brand name”)

I amended the typo by re-opening brandnamegenerator.py in vim, and adding the r (Image 9).

I re-ran the script (Image 10). No more typo :)

Thanks for reading.
Credit: This exercise is inspired by Paul Zhao’s ‘Python 100 projects in 100 days — Learning Journal.’