Skip to content

AssertError #6371

@MaksKamerrer

Description

@MaksKamerrer

#Task is:

Write a (pure) ‹sequence› function that calculates the value of member

⟦aₙ⟧ of the sequence described below, where ‹n› is the first parameter of this function.

The first term of the sequence, ⟦a₀⟧, is given by the parameter ‹initial›,

each other term is then determined by the sum ⟦aⱼ = ∑ᵢ₌₁ᵏ (-1)ⁱ · i · aⱼ₋₁⟧,

where ‹k› is second parameter of the ‹sequence› function.

def sequence(n, k, initial):
for i in range(n+1):
result = 1**k * (-1)**initial * initial * (n-1)
print(result)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions