You are on page 1of 1

1.

Variable names used and their categories (5 points)


•mass and velocity: input variables (parameters) •KE: output variable (local variable)
2. Special words used (5 points)
Def= used to define a function to create a user defined function
3.Scoping rule used in the function (static or dynamic) and one-sentence explanation of why it falls under
that rule (5 points) Static scoping (also known as lexical scoping) is used in the function. This is because
the variable KE is defined inside the function and can only be accessed within the function's scope. The
variable mass and velocity are also defined within the function's scope, as input parameters. The scoping
rules in Python are static by default, meaning that the scope of a variable is determined by the function or
block in which it is defined. In this case, the function kinetic_energy defines its own scope.

You might also like