Saturday, March 9, 2019

codingdirectional: Return a list of divisible numbers

It seems like I am still thinking about what is the new application to create for the next project so I think I will solve a few more easy questions from the Codewars website. All the questions that I am looking at will be simple because I don’t want to spend too much time each day just to solve hard question. OK, let us get to work.

Given a list of numbers as the first parameter and the divisor as the second parameter, create a method which will return a list of numbers that can be divided by the divisor. Below is the solution to that question!

def divisible_by(numbers, divisor):

    divisible_list = []
    for item in numbers:
        if(item % divisor == 0):
            divisible_list.append(item)
    return divisible_list

I will solve a few more questions before start a new python project.

Do you want me to solve question or to create a brand new project?

Leave your comment below this post, if you want me to solve python problem instead of starting a new project then I think I will just concentrate on solving the python related problem in this website because I have already started a new project on another website and that will be a little bit too much for me to handle.



from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...