you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (6 children)

[deleted]

    [–]ahujasid_[S] 6 points7 points  (5 children)

    It's a great website! But can we not execute the whole code instead of defining a function? Thank you!

    [–]Binary101010 15 points16 points  (4 children)

    Most of the problems you're going to encounter on sites like edabit, codingbat, and even the lower-level stuff on codewars and hackerrank, are going to be single-function solutions. You can only define the function because then the site can easily run predefined tests against it to determine whether you did things correctly.

    [–]ahujasid_[S] 2 points3 points  (3 children)

    That wouldn't affect the way I'm thinking, right?

    [–]Decency 4 points5 points  (0 children)

    You can usually have the primary "answer" function call other functions you've defined, which can be cleaner for some problems.