30
tigerhu3180
10 27 46
4681/ 5195
Last seen 2 months ago
Member for 6 years, 2 months, 17 days
Difficulty Normal
I live in Shanghai China. I work for BI business for almost one year and I start feeling bored on this job.I am interested in Python and AI. I would like to improve my Python skill and English....also, practice my brain at all. '闻道有先后,术业有专攻。'

Best reviews / Newest reviews
groupby-flpo 2
First known this groupby function. awesome. More
Eval-Chocolater 2
case safe_code("11+##=11") the answer should be -1 not 0. (the answer cannot consist of zeros (00, 000, etc.).) More
First-colinmcnicholl 1 2
For line 26-33, we have the same idea and here is my code. {i: True if i < len(items) - 1 and items[i] < items[i + 1] else False for i in range(len(items))} # like what your 'indices' do. for local test 2, you can get this indices then get the answer without list slice. {0: True, 1: True More
First-Oleg_Domokeev 1 1
I think you can remove the function 'test' and revise the line 34 like this. if all(-180 <= el <= 180 for el in probe) and all(numpy.dot(A, probe) == b): return probe More
First-Oleg_Domokeev 1
First known the function 'takewhile' from module 'itertool'. I search it on net and it seems more memory-friendly. I like it and I will take a try if any chance. More
Reduce and Prepend-jtokaz 1 1
i am really confused with the usage of function 'reduce' and 'lambda' especially those two are mixed.... for me ,i always hard to read these exciting short code... let alone how to code them.... do you have ...some advices for me? thanks :) More
"CheckSum"-tigerhu3180
这道题的大意就是: > list1=[int(i) if i.isdigit() else ord(i)-48 for i in data if i.isdigit() or i.isalpha()][::-1] 提取参数中的数字和字母,将所有包含的字母转成ascii码并减去48,然后倒序处理 > num=sum([i*2//10+i*2%10 for i in list1[::2]])+sum(list1[1::2]) 前部分: 偶数下标的需要处理,将该数乘以2,十位数和个位数相加得到一个新数(该数乘以2 如果是个位数 就返回该数乘以2) 后部分:奇数下标的无需处理 num就是将 More
"Largest Rectangle in a Histogram"-tigerhu3180
> [1, 1, 4, 1]=>[[1], [1, 1], [1, 1, 4], [1, 1, 4, 1], [1], [1, 4], [1, 4, 1], [4], [4, 1], [1]] it works but slow for extra check More
Intersection-bryukh
set.intersection(any iterable)...so convenient More
First-CosimoOne
> return ",".join(sorted(word for word in first.split(',') if word in second.split(','))) '[]' is no need here,it's very strange. More
First-kurosawa4434
good ------------------ 原始邮件 ------------------ More
First via regex and eval-Molot 1
Impressive code for bool(eval(f'')),like it. More
First-jackleegithub
good try this p=p.replace ('.','\.').replace('*','.*').replace('?','.{1}') More
First-macfreek 1
nice comment,How do you find this pattern? mine is more complex... More
First-tigerhu3180
first known that 'textwrap' module More
For me is clear, advise how to improve myself-Rafal_Bartko 1
> if not cards: return False Why doing this? > cards.sort() Same idea with Phil15 > elif not any(i in k for k in cards): return False Hard to know your meaning...to be honest. for example cards(8, [4, 4, 5, 6, 7]) your cards:[(0,1),(1,2).....,(7,8)] your hand:[ More
First-TianPu8153
my idea is as follows : merge_intervals([(1, 4), (2, 6), (8, 10), (12, 19)]) > => [(1,2,3,4),(2,3,4,5,6),(8,9,10),(12,13,14,....,19)] #using range > => [1,2,3,4 , 2,3,4,5,6 , 8,9,10 , 12,13,...,19] #using slice > => [1,2,3,4,5,6, 8,9,10 ,12,13,14,...19] #using set > => [(1, 6), (8, 10), (12, 19 More
First-tigerhu3180
https://zh.wikipedia.org/wiki/%E9%A1%9E%E7%90%83%E9%9D%A2 More
First-TianPu8153
1. leave your annoation as possible so that we can read easily. 2. Is there any possible to have "['A','A']" situation? confusing. > > for i in crushes: > for j in net: > if i in j: > j[j.index(i)]='0' > count=net.count(['0','0']) > for i in range( More
scipy.ndimage.label, multiple BFS and itertools.permutations (clear and relatively short)-Phil15 2
Impressive for neighbors = lambda i,j: ((i+I,j+J) for I,J in {(-1,0),(1,0),(0,-1),(0,1)} if 0<=i+IMore
1
2