Ad
  • Custom User Avatar

    Thanks for your thoughts and ideas! The short answer is yes, it can be.

    If you read the wiki article linked, you'll see a couple examples where you have more specific notation for variables with multiple subsets. For example, arru8NumberList is an array of unsigned 8-bit integers ("arru8"). The problem I found when trying to make more detailed implementation is that it either becomes very repetative, (e.g. one massive function with 50 if conditions) and the actual difficulty comes in writing tests for the function. I think ultimately, the actual fun and interesting part of the challenge is condensed into the code I've written.

    I've given it some more thought, and I think something that could be more fun would be setting up other conditions for the prefixes, and checking if the value inside of the variable meets the conditions for the given prefix.

    input: var='arru8NumberList', val=[300, 301, 302...] output: False
    
    input: var='arru8NumberList', val=[0, 1, 2, ... 255] output: True
    

    That's a bad example for python, but the point is still the same. For a challenge like that, you'll still have to check the type() the way I was, but you'll have to actually use other logic to return True/False

  • Custom User Avatar

    Good contribution! However, you declared the parameter food_source as a string and later pass an interger as a value in the tests. Perhaps you should declare food_source as Any if you want it to be "any" type of datatype?