Question
Creates a function called zacatel that has as parameters a list of numbers x and a z number. The function you must return the value
Creates a function called zacatel that has as parameters a list of numbers x and a z number. The function you must return the value of S that is calculated using the formula: In this expression, p represents the last position in the x-y list, in general xi represents the number i in the list position. a. (25 points) Creates a version of the function where a for loop is used to calculate S. b. (25 points) Creates a version of the function where a while loop is used to calculate S. c. (25 points) Run the program manually ("hand simulation" or desktop test) using the values given below. Assume that z has a value of 0.6443 and that x has a value of [3, 9, 9]. Present in detail as I arrive at your final reply. In your final answer, include up to 4 numbers after the decimal point
Crea una funcin llamada zacatel que tenga como parmetros una lista de nmeros xy un nmero z. La funcin debe devolver ("return") el valor de S que es calculado usando la frmula: 1 S = z+ +1 Xi - 1 i=0 En esta expresin, p representa la ltima posicin de la lista x y, en general x representa el nmero que se encuentra en la posicin i de la lista. a. (25 puntos) Crea una versin de la funcin en donde se use un for loop para calcular S. b. (25 puntos) Crea una versin de la funcin en donde se use un while loop para calcular S. C. (25 puntos) Ejecuta el programa manualmente ("hand simulation" o prueba de escritorio) usando los valores dados a continuacin. Suponga que z tiene un valor de 0.6443 y que x tiene un valor de [3, 9,9]. Presente detalladamente como llego a su contestacin final. En su contestacin final, incluya hasta 4 nmeros despues del punto decimalStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started