Ad
  • Custom User Avatar
  • Default User Avatar

    Thank you, this was very helpful for us beginners. I didn't know what objects and attributes were. Your comment above helped me alot.

  • Default User Avatar

    Thank you so much for the hint on default value it helped alot.

    I also struggled alot because I thought that ball type was a function instead of an argument.

    Thank god I passed this.

  • Custom User Avatar

    I'm assuming your __init__ method looks like __init__(self, Type): ...
    Type here is a positional argument, meaning the caller must supply it. However, in the description, it states If no arguments are given, ball objects should instantiate with a "ball type" of "regular.". This should be a hint to you that a default argument is expected, i.e. the caller should be able to call your function (or class in this case, which is what __init__ does) without an argument, and the default gets supplied in this case.
    You need to write your function in such a way that the caller can omit "type" and deal with that case accordingly. I'd recommend reading up on python grammar for function definitions: https://docs.python.org/3.6/reference/compound_stmts.html#function
    That said, use lower case for variable and parameter names, and also don't use names like "type" that are already part of python's built-ins, because you can overshadow those built ins that way, which is not what you usually want to do.

  • Default User Avatar

    Hi I am new to coding. I am attempting this because it is 8kyu. However I am facing great difficulty attempting this question. I kept facing this error: TypeError: init() missing 1 required positional argument:"Type"

    I tried to google, I saw results telling ppl to call variable with class(). However I am not sure how does it apply to my case. Maybe I am totally off from what I am thinking. So I tried follow line by line what seemed like a working example. But it still doesn't work.

    Can someone give me a hint on how this should work here.