Python Challenge - Balance

Implementation

This program’s purpose is to determine if a user-supplied string was balanced or not. Essentially, it should determine if the user-supplied string contained the same amount of x characters as it does y characters. For example:

"xxxyyy" -> True
"xxxxyyy" -> False

This Python program:

  • Accepts user input in the form of a standard string
  • Loops through string and counts number of x and y characters
  • Compares them
  • Returns True if the counts are equal, False if they are not
Written on December 11, 2019