0

I've been given an assignment from my department and, no matter how much research I'm conducting on this, I just can't seem to come up with a code which will actually run. Here's the outline:

"""Count the e's in a string, using for loop.

Test data (you should add more):
input: 'Every e please.'  output: 5

Params: s (string)
Returns: (int) #e in s, either lowercase or uppercase
"""
enter code here

Could anyone help me out with this? Only for loops can be used to come up with a code.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
  • You should at least *attempt* your own homework before cheating on it. You might learn something! You claim to have done research, so where's your implementation? – jonrsharpe Jan 28 '17 at 23:31
  • Trust me, I've been trying for close to a week man, and I'm still stuck with the first one. I'm freaking out about it. Being a freshman who's never written a single line of code is hard. –  Jan 28 '17 at 23:46
  • a = ('E, e') for c in s: if c in a: return True return False print (eCount ('Every e please')) –  Jan 28 '17 at 23:47
  • There were other codes that I tried using, but I didn't save those. –  Jan 28 '17 at 23:48
  • Then [edit] to include that in your question. It's not clear why you thought that attempt would work; if you are stuck you should talk to the course staff, not just dump it on the internet. – jonrsharpe Jan 28 '17 at 23:49
  • @jonrsharpe was I right to dupehammer that one? – Jean-François Fabre Jan 29 '17 at 08:25

0 Answers0