11
Last seen 8 years ago
Member for 9 years, 1 month, 18 days
Difficulty Normal
Where do I go to understand what the hell is happening here?
The Python docs for regex say that \w matches any alphanumeric character. Where do you define vowels???
More
A few pointers:
if len(numbers) > 0 == if numbers
You can also use pop() to return the last object in a list and delete it from the list instead of del
More
you can use
zip(*game_result)
for to transpose board and get verticals
More
WOW! Shots fired in the comments section!!!
I think clear for most people means something like this:
def find_message(text):
"""Find a secret message"""
output = ''
for l in text:
if l.isupper():
output += l
return output
Either way, I am definitely more mot
More
Why did you put the else in?
Why not:
def checkio(words):
succ = 0
for word in words.split():
succ = (succ + 1)*word.isalpha()
if succ == 3: return True
return False
More
Didnt know about endswith...
Can you explain this part:
for w in words for s in words
More
max/ min can check an iterable and return the largest/smallest number.
It doesnt have to be max(a,b).
ie max([1,2,3,4,5]) works
More
Seems longer and more complex than it needs to be.
For example, check neighbors can be done using:
for row in range(-1,2):
for col in range(-1,2):
#some code
this will allow you to check a larger area but without writing out a massive tuple manually
More
You dont need line 7:
if number%3 == 0 or number%5 == 0:
You are already checking if it is divisible by 3, divisible 5 by and both.
You can use if, elif, elif, then return
More
Maybe line 5 could be clearer as:
if len(array) == 0
Since that makes it explicit and removes any doubt about what you are looking for
More
You can get rid of line 2 and change line 5:
numOfWords += int(word in text.lower())
More