21
Pavel
https://pavelmorava.com/
Last seen 11 months ago
Member for 10 years, 6 months, 16 days
Difficulty Normal
Author of Sovereign
https://www.royalroad.com/fiction/26615/sovereign
My blog
https://pavelmorava.com/
* in this case, for key parameter is lambda preferred,
* nevertheless, in case you had prepared dedicated function on advance, you should not have diminish your effort by naming it so vaguely as you did.
More
#data = data.sort(key = data["price"])
It doesnt work this way. You need key=lambda x: x["price"]
More
Never solve programatically something you can solve using mathematically. :)
More
You may find useful *set*.
len(set("abcd")) == len("abcd") #{'d', 'a', 'c', 'b'}
while
len(set("aaaa")) != len("abcd") # {'a'}
More
I like your solution except for one thing. You are way too talkative
fr = c(f, *args, **kwargs)
gr = c(g, *args, **kwargs)
actually,
fr, gr = map(lambda h: c(h, *args, **kwargs), (f,g))
will make you noble and silent man.
PS: Just kidding :) Nice one.
More
You should not used \ to break code into more lines.
Just use () like this:
return ("FizzBuzz
...
...
...)
It is safer and simpler.
More
Instead your:
for i in range(len(matrix)):
for j in range(len(matrix)):
...
you can use product from itertools
from itertools import product
for i,j in product(range(len(matrix))):
...
Hope it helps
Subject: [CheckiO] Your random review: Weak Point
More
What is this special case?
if numbers == [-10,-1,-1,-10]:
return -2
Subject: [CheckiO] Your random review: Stair steps:Uncategorized:54466
More
It is a small thing but what about to revert your code like this to make your code clearer?
for move in moves:
xi, yi = x + move[0], y + move[1]
if (xi, yi) == b:
return len(path)
if all(0 < xi < 9, 0 < yi
More
Hi,
you solutions is really really wet :)
Consider this
JUMPING = {
(3,8) : (-2,1),
(2,7): (-1,2),
....
}
def jump_targets(field):
...
x,y = JUMPING[col, row]
targets.append(back_translation[x]+str(y))
r
More
Well done!
Subject: [CheckiO] Your random review: Simple hashlib:Uncategorized:53547
More
Yeah,
what programming language did you come from?
Are you sure you need globals? Programming with side effect is generally frowned upon.
do_way(first,emptymatrix) ???
What about to pass values you need via return and not to share them via globals?
But I like your style :) I would ne
More
Nice,
but of course you might use:
return (max(args) - min(args)) if args else 0
Subject: [CheckiO] Your random review: The Most Numbers:Clear:52939
More
Nicely named variables, just few quick hints to shorten your code:
you can use:
for i, current in enumerate(phrase):
and you can write:
indexesToSkip += [i+1, i+2]
Hope it helps.
Subject: [CheckiO] Your random review: Bird Language:Uncategorized:52447
More
Just one hint. Try this one:
sample = "This is sample Text Sample"
result = {char:sample.count(char) for
char in sample.lower() if
char.isalpha()}
or check Counter from collections :)
Subject: [CheckiO] Your random review: The Most Wanted
More
What about something like this:
def gcd(a,b):
a,b = sorted((a,b), reverse = True)
return gcd(b, a%b) if a%b else b
I hope I made no mistake. No guarantee without running the code :)
And of course you should try :)
import gcd from fractions
Subject: [CheckiO] Your rand
More
Good work. But you dont need to convert your numbers to string in this task.
PS: I když já to udělal taky :)
More
You should change your category to Creative :) Well, it is overcomplicated. But nice :)
More