НачатьНачать бесплатно

Modifying arrays

You are looking at the array of students' grades once again. It has come to your attention that your own grade, which is at index 4 in the array, is not as high as it should be. It's time to write a mutating function to take care of this obvious mistake.

Это упражнение является частью курса

Introduction to Julia

Посмотреть курс

Инструкции к упражнению

  • Write a mutating function named topstudent!(), which takes an array named x as an argument and modifies the value at index 4 to "AAAA".
  • Use the function to modify the grades array grades_array.

Интерактивное практическое упражнение

Попробуйте выполнить это упражнение, дополнив этот пример кода.

# Write a grade mutating function
function ____(____)
	____ = ____
end

println("Your previous grades were $(grades_array[4])")

# Call the function on grades_array
____(____)

println("Your new grades are $(grades_array[4])")
Редактировать и запускать код