Day 22: Monkey Market

Megathread guidelines

  • Keep top level comments as only solutions, if you want to say something other than a solution put it in a new post. (replies to comments can be whatever)
  • You can send code in code blocks by using three backticks, the code, and then three backticks or use something such as https://topaz.github.io/paste/ if you prefer sending it through a URL

FAQ

  • @Acters@lemmy.world
    link
    fedilink
    1
    edit-2
    5 days ago

    you have a point to call name it something else, but lazy to do that. should I simply call it solve() maybe, that would work fine.
    I do want to note that having it return a value is not unheard of, it is just part of being lazy with the naming of the functions.
    I definitely would not have the code outside of main() be included in the main function as it is just something to grab the input pass it to the solver function( main in this case, but as you noted should be called something else ) and print out the results. if you imported it as a module, then you can call main() with any input and get back the results to do whatever you want with. Just something I think makes the code better to look at and use.

    While doing this is highly unnecessary for these challenge, I wish to keep a little bit of proper syntax than just writing the script with everything at the top level. It feels dirty.

    Coding in notepad was a bit brutal, but I stuck with notepad for years and never really cared because I copy pasta quite a bit from documentation or what not.(now a days, gpt helps me fix my shit code, now that hallucinations are reduced decently) even with VSCode, I don’t pay attention to many of its features. I still kinda treat it as a text editor, but extra nagging on top.(nagging is a positive I guess, but I am an ape who gives little fucks) I do like VSCode having a workspace explorer on the side. I dislike needing to alt-tab to various open file explorer windows. Having tabs for open files is really nice, too.

    VSCode is nice, and running my Qwen-coder-1.5B locally is neat for helping somethings out. Not like I rely on it for helping with coding, but rather use it for comments or sometimes I stop to think or sometimes the autocomplete is updated in realtime while I am typing. really neat stuff, I think running locally is better than copilot because of it just being more real-time than the latency with interacting with MS servers. though I do think about all the random power it is using and extra waste heat from me constantly typing and it having to constantly keep up with the new context.

    The quality took a little hit with the smaller model than just copilot, but so far it is not bad at all for things I expect it to help with. It definitely is capable of helping out. I do get annoyed when the autocomplete tries too hard to help by generating a lot more stuff that I don’t want.(even if the first part of what it generated is what I wanted but the rest is not) thankfully, that is not too often.
    I give the local llm is helping with 70% of the comments and 15% of the code on average but it is not too consistent for the code.
    For python, there is not enough syntax overhead to worry about and the autocomplete isn’t needed as much.

    • @CameronDev@programming.devOPM
      link
      fedilink
      15 days ago

      Its normal for main to return a value, its just usually a status thing, rather than actual data. But given python doesn’t really treat main as anything special, it hardly matters