top of page
  • Writer: VC Healy
    VC Healy
  • Jul 29, 2020
  • 1 min read

I walked away from this as I didn't see the obvious.

Sat down a few moments ago and face/palm, I forgot to return. Stupid me, as you will see I am using the number lists, these were from the pytests but if I don't return the result, the assertion is not going to be as expected.



 
 
  • Writer: VC Healy
    VC Healy
  • Jul 29, 2020
  • 1 min read

Another cracker from PyBites. Count the number of vowels in a piece of text and exchange them for an asterisk. ( Screenshot truncated)


The counting in this one took me some time to get my head around. For some reason, the initial function was always counting the wrong amount of vowels but exchanged every vowel. Then when it was counting the number of vowels correctly, a couple of the uppercase vowels were not being exchanged.


I decided to separate the two tasks into separate methods. The counter easily lent itself to a comprehension and I left the exchange of vowels with a loop.

The tests required the exchanged text to still hold the same case for each letter but the comparison against vowels was limited to lower case vowels. This required changing the case of each letter for the comparison but retain the original case for the final exchanged file.



 
 
  • Writer: VC Healy
    VC Healy
  • Jul 28, 2020
  • 1 min read

I had a little problem with this one, more to do with reading the PyTest rather than the code.

I thought the test was wanting tuples of the key, value. Where some of the values had to be tweaked. Somehow I one further read and the penny dropped.




 
 

© 2020 by Vincent Healy. Proudly created with Wix.com

bottom of page