Hi, I’ve solved a new problem using Python!

Here is not necessary to check the 8 directions, we only need to check top-right diagonal, right, bottom-right diagonal and down. Then, with a while loop we check if there ir more than one equal, and if we found four equals, return True, otherwise, at the end, return False.

Here my code:

def checkio(matrix):
for row in range(len(matrix)):
for col in range(len(matrix

Hi, I’ve solved a new problem using Python!

Here I’ve used a list as a queue. Then, split the commands, and if it’s a POP, using pop() we remove the first element of the list, the index 0. At the end, return the joined elements from the list in a single string.

Hi, I’ve solved a new problem using Python!

Here, I’ve used a list like a queue. I store each new element, then, check each new one, and if it’s the opposite to the last element of the list, remove the last one in the list, otherwise, add the new one at the end of the list. At the end, only check if the list is empty or not, if it’s empty, return True, otherwise, return False.

Hi, here a new problem I’ve solved using Python!

My way:
Here is so simple like using int() method, passing the second parameter the base that we need to convert the string. I’ve used a try/except block because the problem says that if you can’t convert something, you need to return -1, then, as int() method throw an exception if it can’t convert something, I used this except block to return -1.

Hi, here a new problem I’ve solved using Python!

My way:
Here we only need the translate numbers fot the thousands, hundreds, tens and units. Then, translate the number into Roman using the thousands, hundreds, tens and units and return the string result.

TopBlogCoder Notifications

You will be able to search for some problem if you are stuck, maybe you can find your solution here!

Gmail Chat

Feel free to add me to gmail chat. We can discuss about programming there! ----- oscarbralo@gmail.com ----- And in the bottom right corner, you can follow this blog to receive by email all the new posts!