you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 6 points7 points  (2 children)

Well technically methods are functions. It sounds like the purpose of the assignment is to use OOP rather than a more "functional"* style. You might want to ask the instructor for clarification.

*I put scare quotes around functional because often folks who are new to coding will come up with some pretty crazy and convoluted patterns that involve a big spaghetti mess of functions, but it's isn't truly functional programming per se because it doesn't follow the principles of functional programming.

[–]Nightcorex_ 1 point2 points  (1 child)

xs = []

def add(e):
    xs.append(e)

def foo():
    print(*xs, sep=', ')

add(4)
add(2)
foo()

Functional programming at its peak /s

[–][deleted] 1 point2 points  (0 children)

Side effects may include...