r/dailyprogrammer • u/jnazario 2 0 • Oct 09 '15
[Weekly #24] Mini Challenges
So this week, let's do some mini challenges. Too small for an easy but great for a mini challenge. Here is your chance to post some good warm up mini challenges. How it works. Start a new main thread in here.
if you post a challenge, here's a template from /u/lengau for anyone wanting to post challenges (you can copy/paste this text rather than having to get the source):
**[CHALLENGE NAME]** - [CHALLENGE DESCRIPTION]
**Given:** [INPUT DESCRIPTION]
**Output:** [EXPECTED OUTPUT DESCRIPTION]
**Special:** [ANY POSSIBLE SPECIAL INSTRUCTIONS]
**Challenge input:** [SAMPLE INPUT]
If you want to solve a mini challenge you reply in that thread. Simple. Keep checking back all week as people will keep posting challenges and solve the ones you want.
Please check other mini challenges before posting one to avoid duplications within a certain reason.
Many thanks to /u/hutsboR and /u/adrian17 for suggesting a return of these.
View all comments
Show parent comment
2
u/adrian17 1 4 Oct 09 '15
Very cool! Two things I would change:
find_filedoesn't convey what the function does very clearly. Maybe just change tofind_in_file?enumerate(fd.readlines()):toenumerate(fd):-readlinescan read the whole file to memory, while simple iteration will avoid that.