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.
이 연습은 강의의 일부입니다
Introduction to Julia
연습 안내
- Use the
pop!()function to remove the last value of theruntimesarray to get rid of the duplicated value. - Use the
append!()function to add your new run times to theruntimesarray.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
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")