1033 words
5 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# week 7 - Graded Assignment 7 > **Course:** Jan 2026 - Python > week 7 - Graded Assignment 7 > **Last Submitted:** You have last submitted on: 2026-04-01, 03:40 IST --- ### Question 1 Consider the below function. Select all the data processing pattern(s) found in the given function.

Visual strip

Relevant recall pieces for this note

Open gallery

week 7 - Graded Assignment 7

Course: Jan 2026 - Python
week 7 - Graded Assignment 7
Last Submitted: You have last submitted on: 2026-04-01, 03:40 IST

Question 1

Consider the below function.
python
def func(nums:list):
    return sum(num for num in nums if len(str(num))<2)
Select all the data processing pattern(s) found in the given function.
  • Aggregation
  • Filtering
  • Mapping
  • None of the above
Status: Yes, the answer is correct. Score: Score: 3
Feedback:
  • summing to give a single result
  • filtering the numbers with single digit.
Feedback: Output is the sum of single digit numbers
Accepted Answers:
Aggregation
Filtering

Question 2

Consider the below function.
python
def func(nums:list):
    return sum(num*2 for num in nums)
Select all the data processing pattern(s) found in the given function.
  • Aggregation
  • Filtering
  • Mapping
  • None of the above
Status: Yes, the answer is correct. Score: Score: 3
Feedback:
  • Summing to give single value
  • doubling each value
Feedback: Output is the sum of twice the input values.
Accepted Answers:
Aggregation
Mapping

Question 3

Consider the below function.
python
def func(nums:list):
    return "".join((str(num) for num in nums))
Select all the data processing pattern(s) found in the given function.
  • Aggregation
  • Filtering
  • Mapping
  • None of the above
Status: Yes, the answer is correct. Score: Score: 3
Feedback:
  • concatenating strings to give a final string.
  • repeating and add space to each element.
Accepted Answers:
Aggregation
Mapping

Question 4

Consider the below function.
python
def func(sentence:str):
    return next((word*2 for word in sentence.split() if 'a' in word))
Select all the data processing pattern(s) found in the given function.
  • Aggregation
  • Filtering
  • Mapping
  • None of the above
Status: Yes, the answer is correct. Score: Score: 3
Feedback/Explanation: Aggregation
Filtering
Mapping
Accepted Answers:
Aggregation
Filtering
Mapping

Question 5

Consider the below function.
python
def func(sentence:str):
    return [word*2 for word in words if 'a' in word]
Select all the data processing pattern(s) found in the given function.
  • Aggregation
  • Filtering
  • Mapping
  • None of the above
Feedback/Explanation: None of the above
Accepted Answers:
None of the above

Question 6

Consider the below function.
python
def func(sentence:str):
    return ''.join([
        chr(ord(char)+1) if char in 'aeiou' else chr(ord(char)-1)
        for char in sentence
    ])
Select all the data processing pattern(s) found in the given function.
  • Aggregation
  • Filtering
  • Mapping
  • None of the above
Status: Yes, the answer is correct. Score: Score: 3
Feedback/Explanation: Aggregation
Mapping
Accepted Answers:
Aggregation
Mapping

Question 7

Consider the below function.
python
def func(sentence:str):
    return ''.join([
        chr(ord(char)+1)
        for char in sentence
        if char in 'aeiou'
    ])
Select all the data processing pattern(s) found in the given function.
  • Aggregation
  • Filtering
  • Mapping
  • None of the above
Status: Yes, the answer is correct. Score: Score: 3
Feedback/Explanation: Aggregation
Filtering
Mapping
Accepted Answers:
Aggregation
Filtering
Mapping

Question 8

Consider the below function.
python
def func(nums:list):
  return [num*2 for num in nums]
Select all the data processing pattern(s) found in the given function.
  • Aggregation
  • Filtering
  • Mapping
  • None of the above
Status: Yes, the answer is correct. Score: Score: 3
Feedback/Explanation: Mapping
Accepted Answers:
Mapping

Question 9

Consider the below function.
python
def func(n:int):
    return [num*2 for num in range(n) if len(str(num)<2)]
Select all the data processing pattern(s) found in the given function.
  • Aggregation
  • Filtering
  • Mapping
  • None of the above
Feedback/Explanation: None of the above
Accepted Answers:
None of the above

Question 10

Consider the below function.
python
def func(n:int):
    return [
        num*2 if len(str(num))<2 else num*3
        for num in range(n)
    ]
Select all the data processing pattern(s) found in the given function.
  • Aggregation
  • Filtering
  • Mapping
  • None of the above
Status: Yes, the answer is correct. Score: Score: 3
Feedback/Explanation: Mapping
Accepted Answers:
Mapping

Question 11

Consider the below function.
python
def func(n:int):
    return [num for num in range(n) if len(str(num))<2]
Select all the data processing pattern(s) found in the given function.
  • Aggregation
  • Filtering
  • Mapping
  • None of the above
Feedback/Explanation: Filtering
Accepted Answers:
Filtering

Question 12

Consider the below function.
python
def func(n:int):
    return next((num for num in range(n) if len(str(num))<2), None)
Select all the data processing pattern(s) found in the given function.
  • Aggregation
  • Filtering
  • Mapping
  • None of the above
Status: Yes, the answer is correct. Score: Score: 3
Feedback/Explanation: Aggregation
Filtering
Accepted Answers:
Aggregation
Filtering

Question 13

Consider the below function.
python
def func(n:int):
    result = [num for num in range(n) if len(str(num))<2]
    return result[-1] if result else None
Select all the data processing pattern(s) found in the given function.
  • Aggregation
  • Filtering
  • Mapping
  • None of the above
Status: Yes, the answer is correct. Score: Score: 3
Feedback/Explanation: Aggregation
Filtering
Accepted Answers:
Aggregation
Filtering

Question 14

Consider the below function.
python
def func(nums:list):
    return min(num)
Select all the data processing pattern(s) found in the given function.
  • Aggregation
  • Filtering
  • Mapping
  • None of the above
Feedback/Explanation: None of the above
Accepted Answers:
None of the above

Question 15

Consider the below function.
python
def func(nums:list):
    return min(len(str(num)) for num in nums)
Select all the data processing pattern(s) found in the given function.
  • Aggregation
  • Filtering
  • Mapping
  • None of the above
Status: Yes, the answer is correct. Score: Score: 3
Feedback/Explanation: Aggregation
Mapping
Accepted Answers:
Aggregation
Mapping

Document Outline
Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.