Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taking in index for both list and string #34

Open
michowler opened this issue Nov 5, 2017 · 1 comment
Open

Taking in index for both list and string #34

michowler opened this issue Nov 5, 2017 · 1 comment

Comments

@michowler
Copy link

michowler commented Nov 5, 2017

def count_elems_with_s(list_of_treasure):
    count = 0;
    for i in list_of_treasure:
        if i[0] == 's':
            count += 1;
            return count

What could be the problem? Thanks everyone!

@illya2412
Copy link

@michowler
Hi, this is how I did it.
def count_elems_with_s(list_of_treasure):
count=0
for i in list_of_treasure:
if 's' in i :
count = count + 1
return count

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants