{"cells":[{"cell_type":"markdown","metadata":{"id":"hw1-00"},"source":["# Homework 1: Efficient Data Manipulation Using Numpy\n","\n","Welcome! This notebook will guide you from reading the question to submitting\n","your answer. You do not need to finish everything at once. Work from the top of\n","the notebook to the bottom, and run each code cell in order.\n","\n","## Deadline\n","\n","Thu, Oct 8, 2026 (11:00 UTC)\n","\n","## Recommended workflow\n","\n","1. Read the question and the expected input/output carefully.\n","2. Run the cells in **1. Preparation**.\n","3. Complete only the `homework()` function in **2. Your Answer**.\n","4. Run the cases in **3. Test Your Answer** and compare the results.\n","5. Copy the complete `homework()` function and submit it in Omnicampus.\n","\n","If you change your function, run its cell again before running the later cells.\n"],"id":"hw1-00"},{"cell_type":"markdown","metadata":{"id":"hw1-01"},"source":["## Question\n","\n","Implement a function that takes a 1D NumPy array of integers and returns an array containing elements that are multiples of 5 and leave a remainder of 1 when divided by 2.\n","\n","
\n","\n","**Inputs / Outputs:**
\n","\n","\n","```python\n","homework(a: np.ndarray) -> np.ndarray\n","```\n","\n","| Argument | Type | Description |\n","|---|---|---|\n","| `a` | `np.ndarray` | 1D NumPy array of integers |\n","\n","| Return | Type | Description |\n","|---|---|---|\n","| result | `np.ndarray` | Array containing elements that are both multiples of 5 and odd |\n","\n","**Example:**
\n","\n","```python\n","a = np.array([1, 5, 10, 3, 4, 25, 30])\n","result = homework(a)\n","print(result)\n","```\n","```\n","[ 5 25]\n","```\n","\n","**Submission Guidelines:**
\n","1. Import libraries\n","2. Implement `homework` that returns elements which are multiples of 5 and odd\n","3. Define a 1D NumPy array\n","4. Check output with `print`\n","\n","**Note:**
\n","- Write your solution where `# Write your answer here` appears in `homework`. (Remove `# Write your answer here` before submission.)\n","- Submit the full `homework` function in the Omnicampus homework submission page and click [Python code submission].\n","- The return value must be a numeric array.\n","- Keep everything in a single function.\n"],"id":"hw1-01"},{"cell_type":"markdown","metadata":{"id":"hw1-02"},"source":["## 1. Preparation\n","\n","Run the next two cells to import NumPy and create the example input array.\n","Imports belong in this preparation section, not inside `homework()`.\n"],"id":"hw1-02"},{"cell_type":"code","execution_count":null,"metadata":{"id":"hw1-03"},"outputs":[],"source":["# 1. Import libraries\n","import numpy as np\n"],"id":"hw1-03"},{"cell_type":"code","execution_count":null,"metadata":{"id":"hw1-04"},"outputs":[],"source":["# 2. Define a 1D NumPy array\n","a = np.array([1, 5, 10, 3, 4, 25, 30])\n"],"id":"hw1-04"},{"cell_type":"markdown","metadata":{"id":"hw1-05"},"source":["## 2. Your Answer\n","\n","Complete the `homework()` function below.\n","\n","- Keep the function name and parameters unchanged.\n","- Write your code at `# Write your answer here`.\n","- Do **not** put `import` statements, file downloads, or data-loading code\n"," inside the function.\n","- Make sure the function returns the requested result.\n","\n","The temporary value `None` only keeps the starter cell runnable. Replace it\n","with your own code before testing and submitting.\n"],"id":"hw1-05"},{"cell_type":"code","execution_count":null,"metadata":{"id":"hw1-06"},"outputs":[],"source":["def homework(a):\n"," # Write your answer here\n"," some\n"," my_result = None\n"," return my_result\n"],"id":"hw1-06"},{"cell_type":"markdown","metadata":{"id":"hw1-07"},"source":["## 3. Test Your Answer\n","\n","Run each test case after completing `homework()`. Trying more than one input\n","makes it easier to find mistakes and increases confidence in your answer.\n","\n","> **Important:** Matching all examples below does **not** guarantee a correct\n","> answer or a full score. Omnicampus uses additional grading cases that are not\n","> shown in this notebook.\n"],"id":"hw1-07"},{"cell_type":"markdown","metadata":{"id":"hw1-08"},"source":["### Test Case 1: Example from the question\n"],"id":"hw1-08"},{"cell_type":"code","execution_count":null,"metadata":{"id":"hw1-09"},"outputs":[],"source":["# Run this cell after completing homework().\n","your_answer = homework(a)\n","print(\"Your answer:\", your_answer)\n"],"id":"hw1-09"},{"cell_type":"markdown","metadata":{"id":"hw1-10"},"source":["For this example, your answer is correct if the output is:\n","\n","```text\n","[ 5 25]\n","```\n","\n","This confirms only this example. The grader will also try other arrays,\n","including arrays with negative values or no matching elements.\n"],"id":"hw1-10"},{"cell_type":"markdown","metadata":{"id":"hw1-11"},"source":["### Test Case 2: A different array\n"],"id":"hw1-11"},{"cell_type":"code","execution_count":null,"metadata":{"id":"hw1-12"},"outputs":[],"source":["case_2_input = np.array([11, 15, 20, 21, 35, 40, 45])\n","case_2_answer = homework(case_2_input)\n","print(\"Your answer:\", case_2_answer)\n"],"id":"hw1-12"},{"cell_type":"markdown","metadata":{"id":"hw1-13"},"source":["The expected output is:\n","\n","```text\n","[15 35 45]\n","```\n"],"id":"hw1-13"},{"cell_type":"markdown","metadata":{"id":"hw1-14"},"source":["### Test Case 3: No matching elements\n"],"id":"hw1-14"},{"cell_type":"code","execution_count":null,"metadata":{"id":"hw1-15"},"outputs":[],"source":["case_3_input = np.array([2, 4, 6, 8])\n","case_3_answer = homework(case_3_input)\n","print(\"Your answer:\", case_3_answer)\n"],"id":"hw1-15"},{"cell_type":"markdown","metadata":{"id":"hw1-16"},"source":["The expected output is an empty NumPy array:\n","\n","```text\n","[]\n","```\n"],"id":"hw1-16"},{"cell_type":"markdown","metadata":{"id":"hw1-17"},"source":["### Final checklist\n","\n","Before moving to Section 4, check the following:\n","\n","- You kept the function name and parameters unchanged.\n","- Your function returns the requested result.\n","- There are no `import` statements inside `homework()`.\n","- There is no file download or data-loading code inside `homework()`.\n","- You ran the `homework()` cell again after your latest edit.\n","- You compared the output of every test case with its expected result.\n"],"id":"hw1-17"},{"cell_type":"markdown","metadata":{"id":"hw1-18"},"source":["## 4. How to Submit Your Answer to Omnicampus\n"],"id":"hw1-18"},{"cell_type":"markdown","metadata":{"id":"hw1-19"},"source":["### Step 1: Copy the complete `homework()` function\n","\n","Copy from the line beginning with `def homework(...):` through\n","the final `return` line. Copy the **function itself**, not only its body.\n","\n","Do not copy import cells, data-download cells, the test-case cells that call\n","`homework()`, the final checklist, or any printed output.\n"],"id":"hw1-19"},{"cell_type":"markdown","metadata":{"id":"hw1-20"},"source":["### Step 2: Paste it into Omnicampus and submit\n","\n","Open this homework in Omnicampus, paste the complete function\n","into the answer field, and click the submit button.\n","\n","> **🔁 You can submit as many times as you need.**\n",">\n","> If your result is `0.0`, revise your `homework()` function and submit it\n","> again. You do not have to stop after your first submission.\n","\n","The submitted function must not contain library imports. The required\n","libraries are provided by the grader.\n"],"id":"hw1-20"},{"cell_type":"markdown","source":[""],"metadata":{"id":"NdShA5CApx6I"},"id":"NdShA5CApx6I"},{"cell_type":"markdown","metadata":{"id":"hw1-21"},"source":["### Step 3: Wait for and check the grading result\n","\n","Grading may take a little time. If no result appears, wait a\n","moment and reload the browser.\n","\n","- **3.0 points** means the answer is correct.\n"," - If you submit after the deadline, **2.0 points** is the maximum you can get.\n","- **0.0 points** means the answer is not correct yet.\n","- You may revise your function and submit again.\n"],"id":"hw1-21"},{"cell_type":"markdown","source":[""],"metadata":{"id":"NK62KRtuqox5"},"id":"NK62KRtuqox5"},{"cell_type":"markdown","metadata":{"id":"hw1-22"},"source":[" ### Important Notes About Grading\n","\n"," 1. **Your latest submission is your final result.**\n"," Your grade is based on the most recent submission, not the highest score.\n"," For example, if you receive `3.0` and then submit another answer that receives\n"," `0.0`, your recorded result will be `0.0`.\n","\n"," 2. **Correct submissions made during the late submission period receive a maximum of 2.0 points.**\n"," Even if your answer is correct, you cannot receive `3.0` points after the\n"," original deadline.\n","\n"," 3. **The late submission window will be open to all students, including students who have already submitted.**\n"," If your latest submission already shows `3.0`, you do not need to submit\n"," again during the late submission period. Submitting again may replace your\n"," current result.\n","\n"," Before you finish, make sure your latest submission shows the score you want\n"," to keep.\n","\n"],"id":"hw1-22"}],"metadata":{"colab":{"provenance":[]},"kernelspec":{"display_name":"3.10.5","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.10.5"},"homework_edition":"2026Sep"},"nbformat":4,"nbformat_minor":5}