Solution

1. ```
   /// Calculate the magnitude of the given vector.
   ```
2. ```
   fn magnitude(vector: &[f64; 3]) -> f64 {
   ```
3. ```
       let mut mag_squared = 0.0;
   ```
4. ```
       for coord in vector {
   ```
5. ```
           mag_squared += coord * coord;
   ```
6. ```
       }
   ```
7. ```
       mag_squared.sqrt()
   ```
8. ```
   }
   ```

10. ```
    /// Change the magnitude of the vector to 1.0 without changing its direction.
    ```
11. ```
    fn normalize(vector: &mut [f64; 3]) {
    ```
12. ```
        let mag = magnitude(vector);
    ```
13. ```
        for item in vector {
    ```
14. ```
            *item /= mag;
    ```
15. ```
        }
    ```
16. ```
    }
    ```

18. ```
    fn main() {
    ```
19. ```
        println!("Magnitude of a unit vector: {}", magnitude(&[0.0, 1.0, 0.0]));
    ```

21. ```
        let mut v = [1.0, 2.0, 9.0];
    ```
22. ```
        println!("Magnitude of {v:?}: {}", magnitude(&v));
    ```
23. ```
        normalize(&mut v);
    ```
24. ```
        println!("Magnitude of {v:?} after normalization: {}", magnitude(&v));
    ```
25. ```
    }
    ```