This is the Python equivalent of the Java StringsAndThings lab exercise.
The StringsAndThings class contains 5 methods that perform various string manipulation tasks:
count_yz(input_str)- Count words ending in 'y' or 'z'remove_string(base, remove)- Remove all instances of a substringcontains_equal_number_of_is_and_not(input_str)- Check if "is" and "not" appear equallyg_is_happy(input_str)- Check if all 'g' characters have adjacent 'g' neighborscount_triple(input_str)- Count sequences of 3 identical characters
- Implement the methods in
strings_and_things.py - Run the tests with:
python -m pytest test_strings_and_things.py -vorpython test_strings_and_things.py
The test file test_strings_and_things.py contains comprehensive test cases for all methods, mirroring the Java JUnit tests.
Each method currently returns None and needs to be implemented to pass the tests.