ComenzarEmpieza gratis

Appending arrays

You are once again examining your run times. Since you last looked at these values, you have been on more runs. You have also realized that you made a mistake in recording your run times previously - you accidentally added the time of your last run twice.

You want to remove this duplicated value and add your new run times to the array.

The array of your previous run times, named runtimes, and the array of your new run times, named new_runtimes, are already defined for you.

Remember that functions that end with an ! modify their arguments. Other functions will not do this.

Este ejercicio forma parte del curso

Introduction to Julia

Ver curso

Instrucciones del ejercicio

  • Use the pop!() function to remove the last value of the runtimes array to get rid of the duplicated value.
  • Use the append!() function to add your new run times to the runtimes array.

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

runtimes = [35.1, 34.0, 34.31, 32.8, 32.04, 33.66, 32.41, 32.32, 33.37, 31.4, 31.4];
new_runtimes = [30.44, 31.21, 30.38, 30.52, 30.2];

# Remove the duplicated value
duplicated_value = ____

# Append new runtimes and new_runtimes
____

println("Duplicated value $duplicated_value")
println("All run times: $runtimes")
Editar y ejecutar código