Create and Use One-Filled Arrays with np.ones()
📖 Scenario: Imagine you are helping a factory manager who wants to track the status of machines. Each machine is either working (1) or not working (0). To start, the manager wants to create a list showing all machines are working.
🎯 Goal: You will create a one-filled array using np.ones() to represent all machines working. Then, you will set a threshold for the number of machines and finally print the array.
📋 What You'll Learn
Create a numpy array of ones with a specific size
Create a variable to hold the number of machines
Use np.ones() with the number of machines
Print the resulting array
💡 Why This Matters
🌍 Real World
One-filled arrays are useful to represent active or working states in machines, sensors, or other systems.
💼 Career
Data scientists often initialize arrays with ones to set default values or masks before processing data.
Progress0 / 4 steps