📖 Scenario: You work in a factory that uses a SCADA system to monitor machines. Every day, you need to create reports showing how many units each machine produced during different shifts.This helps the factory manager see which machines are working well and when.
🎯 Goal: Create a simple program that stores machine production data, sets a shift time, calculates total units produced during that shift, and then prints the report.
📋 What You'll Learn
Create a dictionary called machine_production with exact machine names and units produced
Create a variable called shift with the exact value 'morning'
Calculate total units produced during the shift using a loop
Print the total units produced in the shift with a clear message
💡 Why This Matters
🌍 Real World
Factories use SCADA systems to monitor machine output and generate reports for daily and shift production. This helps managers make decisions about maintenance and staffing.
💼 Career
Understanding how to collect, process, and report production data is key for roles in industrial automation, operations, and DevOps for manufacturing systems.
Progress0 / 4 steps
1
Create machine production data
Create a dictionary called machine_production with these exact entries: 'MachineA': 120, 'MachineB': 150, 'MachineC': 100
SCADA systems
Hint
Use curly braces {} to create the dictionary and separate each machine and units with commas.
2
Set the shift variable
Create a variable called shift and set it to the string 'morning'
SCADA systems
Hint
Use simple assignment with the exact variable name shift and value 'morning'.
3
Calculate total units produced
Create a variable called total_units set to 0. Then use a for loop with variables machine and units to iterate over machine_production.items(). Inside the loop, add units to total_units
SCADA systems
Hint
Start with total_units = 0. Use a for loop with machine, units to get each machine's units. Add units to total_units inside the loop.
4
Print the total units report
Write a print statement that outputs exactly: "Total units produced during morning shift: 370"
SCADA systems
Hint
Use an f-string to include the shift and total_units variables in the printed message.
Practice
(1/5)
1. What is the main purpose of daily and shift reports in SCADA systems?
easy
A. To summarize system data for specific time periods
B. To control hardware devices directly
C. To update software automatically
D. To backup the entire system data
Solution
Step 1: Understand report function
Daily and shift reports collect and summarize data over set time periods.
Step 2: Identify main goal
The goal is to provide a clear summary of system performance and events during those periods.
Final Answer:
To summarize system data for specific time periods -> Option A
Quick Check:
Reports summarize data = D [OK]
Hint: Reports summarize data by time period, not control or backup [OK]
Common Mistakes:
Confusing reports with control commands
Thinking reports update software
Assuming reports backup data
2. Which of the following is the correct way to specify a shift report for the night shift (10 PM to 6 AM) in a SCADA report configuration?
easy
A. shift_start = '22:00'; shift_end = '06:00'
B. shift_start = '06:00'; shift_end = '22:00'
C. shift_start = '10:00'; shift_end = '18:00'
D. shift_start = '00:00'; shift_end = '08:00'
Solution
Step 1: Identify night shift hours
The night shift runs from 10 PM (22:00) to 6 AM (06:00).
Step 2: Match correct time format
shift_start = '22:00'; shift_end = '06:00' correctly sets shift_start to '22:00' and shift_end to '06:00'.
Final Answer:
shift_start = '22:00'; shift_end = '06:00' -> Option A
Quick Check:
Night shift = 22:00 to 06:00 [OK]
Hint: Night shift starts at 22:00, ends at 06:00 [OK]
Why does this code print 'Invalid shift times' even if the shift crosses midnight?
medium
A. Because shift_start and shift_end are not defined
B. Because string comparison does not handle time crossing midnight correctly
C. Because the if condition is always true
D. Because print statement is inside a comment
Solution
Step 1: Understand string comparison of times
Comparing times as strings ('22:00' > '06:00') compares lexicographically, not by clock time.
Step 2: Recognize midnight crossing issue
Times crossing midnight (e.g., '22:00' to '06:00') fail because '22:00' > '06:00' is true, but string comparison doesn't reflect time logic.
Final Answer:
Because string comparison does not handle time crossing midnight correctly -> Option B
Quick Check:
String compare ≠ time logic [OK]
Hint: String compare fails for times crossing midnight [OK]
Common Mistakes:
Assuming string compare works for times
Thinking condition is always true
Ignoring midnight crossing logic
5. You want to generate a daily report that includes total production and average temperature for each shift. Which approach best combines these requirements in a SCADA report script?
hard
A. Calculate averages first, then total production for the whole day
B. Calculate total production only and ignore temperature
C. Generate separate reports for production and temperature without combining
D. Calculate totals and averages separately for each shift, then combine results in one report
Solution
Step 1: Identify report requirements
Report must include total production and average temperature per shift.
Step 2: Choose method to combine data
Calculating totals and averages separately per shift then combining into one report meets all requirements clearly.
Final Answer:
Calculate totals and averages separately for each shift, then combine results in one report -> Option D
Quick Check:
Combine metrics per shift in one report [OK]
Hint: Calculate each metric per shift, then combine [OK]
Common Mistakes:
Ignoring temperature data
Splitting reports unnecessarily
Mixing daily and shift calculations incorrectly
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.