5. Extra CLI Application Examples

Programming is very much an applied skill, and the general consensus is that the best way to learn to code is to write code. So we’ll cover some more examples to hopefully do just that. We’ll focus on making various CLI applications and showcase how you would expand upon them with proper git practices.

Notes

  • A focus should be made to practice good git hygiene during these examples
    • This means: small, meaningful commits that describe what is being done
  • New features should be added on a separate branch and then merged in via a github pull request
  • Make sure good code formatting is followed

Text Statistics

Basic Features:

  • Count the number of words in a given string

Advanced Features:

  • Add character count, sentence count, or paragraph count options
  • Handle edge cases like multiple spaces, punctuation, etc.

CLI Math Calculator

Basic Features:

  • Perform basic arithmetic operations (addition, subtraction, multiplication, division)

Advanced Features:

  • Allow chaining of multiple operations

Unit Converter

Basic Features:

  • Convert between units (e.g., kilometers to miles, Celsius to Fahrenheit)

Advanced Features:

  • Add support for additional units (e.g., kilograms to pounds, liters to gallons)
  • Allow conversion of multiple values at once

Math Quiz

Basic Features:

  • Generate random math questions (addition, subtraction), prompt the user for answers.

Advanced Features:

  • Add option to specify the number of questions
  • Track score (how many questions a user got right, versus wrong)
  • Set a timer for answering questions.