CPT Digital Portfolio Project
CPT Final Code, Video, and Code Segments for PPR
Overview
- Create Performance Task (CPT) requirements for AP Computer Science Principles
Program Code (PC)
user_input = input('Enter a number: ')
numbers = [int(user_input), 2, 3, 4]
def process_numbers(numbers, multiplier):
result = []
for num in numbers:
if num % 2 == 0:
result.append(num * multiplier)
return result
output = process_numbers(numbers, 3)
print('Processed numbers:', output)
Processed numbers: [6, 12]
Video (V)
- Needs to have input to my program, functionality shown and output
Personalized Project Reference (PPR)
Capture and paste a code segment defining a procedure with the following:
- A name and return type (if necessary)
- Parameters affecting functionality
- An algorithm with sequencing, selection, and iteration
Then capture and paste a code segment showing where the procedure is called
- How data is stored in a list and programs purpose
def calculate_average(grades):
total = sum(grades)
count = len(grades)
return total / count
grades = [85, 90, 78]
average = calculate_average(grades)
print('Average grade:', average)
Average grade: 84.33333333333333
students = ['Alice', 'Bob', 'Charlie']
for student in students:
print('Hello,', student)
Hello, Alice
Hello, Bob
Hello, Charlie