49
Last seen 1 day ago
Member for 10 years, 3 months, 1 day
Difficulty Normal
from Japan. hobby programmer. start Python from CheckiO.
In order to explain what is going on, I rewrote the code. I hope this may help you :-)
def time_converter(time):
# h, m = map(int, time[:-5].split(':'))
splited_time = time[:-5].split(':') # splited_time == "12:30".split(':') == ["12", "30"]
h = int(splited_time[0]) # h
More
Oh, I'm quite new in Python (one week Python coder). So, I don't know any about set. Do you have any material for learning Python set?
More
Your code is very incomplete. Because your code fails for following two example.
check_connection(('a-c', 'a-b'), 'a', 'b')
check_connection(('aa-b', ), 'a', 'b')
Unfortunately checkio tests are incomplete. So incomplete code may pass all tests. Your code treat first occurrence of fir
More
You can write more simple.
for number in key_arabic_numbers:
while arabic >= number:
arabic -= number
roman += arabic_to_roman_dict[number]
return roman
More simple
for number in key_arabic_numbers:
n, arabic = divmod(arabic, number)
rom
More
You can write more compact with **any**.
return any(i.endswith(j) for i, j in permutations(words_set, 2))
More
You can write **if word.endswith(ending) and word != ending:** in line 4.
More
Youe is_word can be written in one line :-)
def is_word(w):
return w.isalpha() and all((e in VOWELS) != (o in VOWELS) for e, o in zip(w, w[1:]))
More
I have checked your code for all 5040 case. Then 5 case need 9 steps (5293, 9204, 9214, 9241, 9431).
More
By the way, I never thanked @Splitter . Thanks to your appropriate comments, this code was created.
More
This code is faster than [previous version](http://www.checkio.org/mission/super-root/publications/Sim0000/python-3/log-then-newton/). See [Halley's method](http://en.wikipedia.org/wiki/Halley%27s_method).
More