49
Last seen 2 hours ago
Member for 10 years, 3 months, 3 days
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
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
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
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
You can calculate answer x = (280*a + 441*b + 288*c) % 504, where a = x % 9, b = x % 8, c = x % 7.
More
You can write **if word.endswith(ending) and word != ending:** in line 4.
More
You can write diff = date(\*date1) - date(\*date2). See [tutorial](https://docs.python.org/3/tutorial/controlflow.html#unpacking-argument-lists).
More
By the way, I never thanked @Splitter . Thanks to your appropriate comments, this code was created.
More
You can write
how_deep = lambda s: 1 + max((how_deep(e) for e in s), default=0) if isinstance(s, tuple) else 0
or
how_deep = lambda s: 1 + max(map(how_deep, s), default=0) if isinstance(s, tuple) else 0
More
I try your code. I found a problem your code fail. The correct answer is 3, but your code returns 4. See attached picture.
({1, 2}, {1, 3}, {1, 5}, {2, 3}, {2, 4}, {4, 6}, {5, 6})
More