Bird
Raised Fist0
No-Codeknowledge~10 mins

Filtering and conditional logic in No-Code - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - Filtering and conditional logic
Start with data list
↓
Check each item
↓
Condition true?
No→Skip item
Yes↓
Keep item
↓
Move to next item
Back to Check↓
All items checked?
Yes→Filtered list ready
↩Back to Check
This flow shows how each item in a list is checked against a condition. Items that meet the condition are kept; others are skipped.
Execution Sample
No-Code
data = [5, 12, 7, 20]
filtered = []
for item in data:
  if item > 10:
    filtered.append(item)
print(filtered)
This code keeps only numbers greater than 10 from the list.
Analysis Table
StepCurrent itemCondition (item > 10)ActionFiltered list
15FalseSkip item[]
212TrueAdd to filtered[12]
37FalseSkip item[12]
420TrueAdd to filtered[12, 20]
End--All items checked[12, 20]
💡 All items checked, filtering complete.
State Tracker
VariableStartAfter 1After 2After 3After 4Final
item-512720-
filtered[][][12][12][12, 20][12, 20]
Key Insights - 2 Insights
Why is the number 5 not added to the filtered list?
Because at step 1 in the execution_table, the condition '5 > 10' is False, so the action is to skip the item.
Does the filtered list change when an item does not meet the condition?
No, as shown in steps 1 and 3, when the condition is False, the filtered list remains unchanged.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 2. What is the filtered list after adding the item?
A[7, 12]
B[5, 12]
C[12]
D[]
💡 Hint
Check the 'Filtered list' column at step 2 in the execution_table.
At which step does the condition become false for the first time?
AStep 2
BStep 1
CStep 3
DStep 4
💡 Hint
Look at the 'Condition' column in the execution_table for the first False value.
If the condition changed to 'item >= 7', what would be the filtered list after step 3?
A[12, 7]
B[12]
C[5, 12, 7]
D[7]
💡 Hint
Check which items satisfy 'item >= 7' up to step 3 in the variable_tracker.
Concept Snapshot
Filtering means checking each item in a list.
Use conditional logic to decide if an item should be kept.
If condition is true, keep the item; else skip it.
Repeat for all items to get a filtered list.
Full Transcript
Filtering and conditional logic means going through each item in a list and checking if it meets a rule. If it does, we keep it; if not, we skip it. For example, checking if numbers are greater than 10 and keeping only those. We start with an empty filtered list and add items that pass the condition. This process repeats until all items are checked, resulting in a new list with only the items that meet the condition.

Practice

(1/5)
1. What is the main purpose of filtering in data processing?
easy
A. To select only the data that meets certain conditions
B. To change all data values to uppercase
C. To add new data entries randomly
D. To delete all data permanently

Solution

  1. Step 1: Understand filtering concept

    Filtering means choosing only data that fits a rule or condition.
  2. Step 2: Match purpose with options

    Only To select only the data that meets certain conditions describes selecting data based on conditions, which is filtering.
  3. Final Answer:

    To select only the data that meets certain conditions -> Option A
  4. Quick Check:

    Filtering = selecting data by condition [OK]
Hint: Filtering means picking data that fits rules [OK]
Common Mistakes:
  • Confusing filtering with changing data values
  • Thinking filtering deletes all data
  • Assuming filtering adds random data
2. Which of the following is the correct way to write a simple IF condition in pseudocode?
easy
A. WHILE condition THEN action OTHERWISE other_action
B. WHEN condition DO action OTHERWISE other_action
C. FOR condition THEN action ELSE other_action
D. IF condition THEN action ELSE other_action

Solution

  1. Step 1: Recall IF condition syntax

    A simple IF condition uses IF, THEN, and optionally ELSE to decide actions.
  2. Step 2: Compare options to standard IF syntax

    Only IF condition THEN action ELSE other_action uses IF, THEN, ELSE correctly; others use wrong keywords.
  3. Final Answer:

    IF condition THEN action ELSE other_action -> Option D
  4. Quick Check:

    IF-THEN-ELSE syntax = IF condition THEN action ELSE other_action [OK]
Hint: IF-THEN-ELSE is the basic conditional format [OK]
Common Mistakes:
  • Using FOR or WHILE instead of IF for conditions
  • Mixing keywords like WHEN or OTHERWISE incorrectly
  • Omitting THEN or ELSE keywords
3. Given this pseudocode:
FOR each number IN [1, 2, 3, 4, 5]
IF number % 2 == 0 THEN print(number)

What will be printed?
medium
A. 1 3 5
B. 2 4
C. 1 2 3 4 5
D. No output

Solution

  1. Step 1: Understand the loop and condition

    The loop goes through numbers 1 to 5. The condition checks if number is even (number % 2 == 0).
  2. Step 2: Identify even numbers in the list

    Even numbers are 2 and 4, so only these get printed.
  3. Final Answer:

    2 4 -> Option B
  4. Quick Check:

    Even numbers printed = 2 4 [OK]
Hint: Print only numbers divisible by 2 [OK]
Common Mistakes:
  • Printing all numbers instead of only even
  • Confusing even and odd numbers
  • Thinking no output occurs
4. Find the error in this pseudocode:
IF score > 50
print('Pass')
ELSE IF score > 40
print('Retake')
medium
A. Missing THEN keyword after IF conditions
B. Incorrect use of ELSE IF instead of ELSEIF
C. Missing ELSE keyword before ELSE IF
D. No error, code is correct

Solution

  1. Step 1: Check IF condition syntax

    In pseudocode, IF conditions usually require THEN after the condition to separate it from actions.
  2. Step 2: Identify missing THEN keywords

    Both IF and ELSE IF lines lack THEN, which is needed for clarity and correctness.
  3. Final Answer:

    Missing THEN keyword after IF conditions -> Option A
  4. Quick Check:

    IF conditions need THEN keyword [OK]
Hint: IF conditions need THEN before actions [OK]
Common Mistakes:
  • Assuming ELSE IF is invalid syntax
  • Thinking ELSE must always be alone
  • Ignoring THEN keyword requirement
5. You have a list of products with prices: [{"name": "Pen", "price": 5}, {"name": "Book", "price": 15}, {"name": "Bag", "price": 25}].
Using filtering and conditional logic, which pseudocode correctly selects products priced above 10 and prints their names?
hard
A. FOR each product IN products
IF product.price == 10 THEN print(product.name)
B. FOR each product IN products
IF product.price < 10 THEN print(product.name)
C. FOR each product IN products
IF product.price > 10 THEN print(product.name)
D. FOR each product IN products
print(product.name) IF product.price > 10

Solution

  1. Step 1: Understand the filtering condition

    We want products with price greater than 10 only.
  2. Step 2: Check each option's condition

    FOR each product IN products
    IF product.price > 10 THEN print(product.name) correctly uses IF product.price > 10 to filter and print names. Others use wrong conditions or syntax.
  3. Final Answer:

    FOR each product IN products
    IF product.price > 10 THEN print(product.name)
    -> Option C
  4. Quick Check:

    Filter price > 10 and print names = FOR each product IN products
    IF product.price > 10 THEN print(product.name) [OK]
Hint: Use IF price > 10 to filter products [OK]
Common Mistakes:
  • Using wrong comparison operators (< or ==)
  • Printing all products without filtering
  • Incorrect syntax like placing IF after print
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard