The best VPN 2023

The Best VPS 2023

The Best C# Book

# Show HN PyBites Code Challenges

Thanks, creating two templates for the next challenge, a beginner and advanced one.

@gravypod, thats actually a really good point mate! The last thing we want to do is limit creativity. Do you think itd be more beneficial to just provide a blank file in the individual challenges rather than a template?

I think Ill enjoy doing this. As a teacher with less free time, these tasks seem short and will keep my brain puzzling over code without the stress of a high priority project looming in the background.

Definitely loving the feedback! Its the only way to learn!

I dont like the solution template they propose because it will likely stall users from creativly solving the problem. I also dont think this is an idomatic solution to the problem in a pythonic way.

This would be the readable perl5 solution:

Anyway Ill probably keep solving these, they are pretty fun. Ill just ignore the unit tests, it should be fine (famous last words).

If anyone is interested in something for comparison, heres what it would look like in k6 ):

(Though its more about solving puzzles than what this code challenge seems to be aiming for.)

my %scrabble_scores = ( 1 = [qw( E A O I N R T L S U )], 2 = [qw( D G )], 3 = [qw( B C M P )], 4 = [qw( F H V W Y )], 5 = [qw( K )], 8 = [qw( J X )], 10 = [qw( Q Z )]); my \$dict = usrsharedictwords; open my \$d, , \$dict or die \$dict: \$!; keys my %a = 26; ranked alphabet for my \$rank (keys %scrabble_scores) for my \$letter (@\$scrabble_scores\$rank) \$a\$letter = \$rank; my @maxscore = ( = 0); while (\$d) my \$score = 0; chomp; for my \$c (split) \$score += \$auc(\$c); @maxscore = (\$_ = \$score) if \$score \$maxscore[1]; print \$maxscore[0] = \$maxscore[1]\n;Arguable more readable than python

Hint: python -c help(max)

@js2 – that site is awesome!! A different approach to challenges for sure. Will definitely give it a look this week!

v: 1 2 3 4 5 8 10 l: \eaoinrtlsudgbcmpfhvwykjxqz d: !+,l,\:v t@*(+d@_:)t:0:dictionary.txtFirst three lines are constructing the dictionary the template in this problem hands to you, and the last line loads the file and finds the item with the maximum scrabble dictionary score.

Youre going from file-list-for loop when you can just go file-for loop.

So far Ive got a time of around 1 second on the first challenge. Its nice to be able to practice my profiling and see how low I can get it!

This was our first real attempt at an open challenge. We were wondering how best to push it. The idea behind the template was to simplify it for the newer coders, almost like a hint.

Thanks for all your inputs, we just published our 2nd challenge:http:pybit.escodechallenge02.html

Good tip, I defaulted to using sorted which is almost as fast (but not quite)

You could have optionally a file like you have. Thats perfect for beginners and how my university actually starts some homeworks. For other people it might be good to use output matching since you wont be able to make a unit test to handle every method of solving the problem.