Writing a function for strings
In chapter 2, you wrote a script to process a student's grades. Now you have a lot of students' grades to process, so it's time to write a function for it.
For each student, you have text data that looks like this:
grades = "XXXX"
Where the letters "XXXX" are the grades for the student in mathematics, history, science, and drama, respectively.
A single string of grades named mygrades and an array of grade strings named grades_array is available in your environment.
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Introduction to Julia
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Create the get_mathgrade function
____ ____(____)
return ____
____