#WSQ11 – Go Bananas

--Originally published at マルコ

What To Do

Write a function called find_bananas which receives a single parameter called filename (a string) and returns a positive integer which is the number of times the word (string) “banana”  (or “BANANA” ) is found in the file. The banana can be any case (‘BaNana’ or ‘BANANA’ or ‘banana’, etc) and they can be “stuck together” like “banAnaBANANA” (that counts as two). Create your own test file (plain text) to check your work.

W11.1

W11.2

Featured image:

https://www.pixiv.net/member_illust.php?mode=medium&illust_id=52121901


WSQ 11 – Go Bananas

--Originally published at Programming

Hello everyone

For this week assigment we have to: Write a function called find_bananas which receives a single parameter called filename (a string) and returns a positive integer which is the number of times the word (string) “banana”  (or “BANANA” ) is found in the file. The banana can be any case (‘BaNana’ or ‘BANANA’ or ‘banana’, etc) and they can be “stuck together” like “banAnaBANANA” (that counts as two).

Here is the code:

Captura de pantalla 2017-04-27 a la(s) 13.17.14

And this is how it runs:

Captura de pantalla 2017-04-27 a la(s) 13.18.15


WSQ11 – Go Bananas

--Originally published at Elu's Blog

For this assignment, these were my instructions:

Write a function called find_bananas which receives a single parameter called filename (a string) and returns a positive integer which is the number of times the word (string) “banana”  (or “BANANA” ) is found in the file. The banana can be any case (‘BaNana’ or ‘BANANA’ or ‘banana’, etc) and they can be “stuck together” like “banAnaBANANA” (that counts as two). Create your own test file (plain text) to check your work.

This is what I came up with:

Captura de pantalla 2017-04-17 a la(s) 10.17.20.png

Captura de pantalla 2017-04-17 a la(s) 10.18.28.png

Captura de pantalla 2017-04-17 a la(s) 10.18.49.png