Skip to content

Lauren Steenkamp#10

Open
Lauren-Robyn wants to merge 2 commits into
micanipho:mainfrom
Lauren-Robyn:main
Open

Lauren Steenkamp#10
Lauren-Robyn wants to merge 2 commits into
micanipho:mainfrom
Lauren-Robyn:main

Conversation

@Lauren-Robyn
Copy link
Copy Markdown

No description provided.

@micanipho micanipho requested a review from Copilot October 27, 2025 14:39
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements several previously stubbed-out functions in student_code.py, including mathematical calculations, grade evaluation, performance analysis, and number filtering utilities.

Key Changes:

  • Implementation of mathematical functions (sum_of_squares, even_numbers, odd_numbers)
  • Implementation of grade/performance evaluation functions (evaluate_performance, calculate_cumulative_performance, analyze_improvement)
  • Addition of debug print statements at module level

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread student_code.py
else:
for i in range(1, n + 1):
total+= (i** 2)
return print(total)
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function returns the result of print(total) which is None, instead of returning the actual total value. Remove print() and return total directly to match the documented return type of int.

Suggested change
return print(total)
return total

Copilot uses AI. Check for mistakes.
Comment thread student_code.py
Comment on lines +22 to 24
print(sum_of_squares(100))


Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Module-level print statement should be removed. This creates side effects when the module is imported and is not part of the function's API.

Suggested change
print(sum_of_squares(100))
if __name__ == "__main__":
print(sum_of_squares(100))

Copilot uses AI. Check for mistakes.
Comment thread student_code.py
Comment on lines +36 to +44
grades =[80, 70, 90]
min_grade_passing = 75

total = 0
for num in grades:
total += num
average = total // len(grades)

if average < min_grade_passing:
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function parameters grades and min_pass are being overwritten with hardcoded values, making the function ignore its inputs. Remove these assignments and use the parameters directly.

Suggested change
grades =[80, 70, 90]
min_grade_passing = 75
total = 0
for num in grades:
total += num
average = total // len(grades)
if average < min_grade_passing:
total = 0
for num in grades:
total += num
average = total // len(grades)
if average < min_pass:

Copilot uses AI. Check for mistakes.
Comment thread student_code.py
total = 0
for num in grades:
total += num
average = total // len(grades)
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using integer division (//) for calculating average will truncate decimal values. Use regular division (/) to get accurate averages for grade comparison.

Suggested change
average = total // len(grades)
average = total / len(grades)

Copilot uses AI. Check for mistakes.
Comment thread student_code.py
Comment on lines +36 to +47
grades =[80, 70, 90]
min_grade_passing = 75

total = 0
for num in grades:
total += num
average = total // len(grades)

if average < min_grade_passing:
print("Fail")
else:
print("Pass")
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function prints the result instead of returning it. Replace print() calls with return statements to match the documented return type of str. Also, the hardcoded variable min_grade_passing should be replaced with the min_pass parameter.

Suggested change
grades =[80, 70, 90]
min_grade_passing = 75
total = 0
for num in grades:
total += num
average = total // len(grades)
if average < min_grade_passing:
print("Fail")
else:
print("Pass")
# grades =[80, 70, 90] # Removed hardcoded grades
# min_grade_passing = 75 # Removed hardcoded min_grade_passing
total = 0
for num in grades:
total += num
average = total // len(grades)
if average < min_pass:
return "Fail"
else:
return "Pass"

Copilot uses AI. Check for mistakes.
Comment thread student_code.py
pass
even_numbers = []

for i in range(1, n):
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The range should be range(1, n + 1) to include n itself, as the docstring states 'from 1 to n' (inclusive).

Suggested change
for i in range(1, n):
for i in range(1, n + 1):

Copilot uses AI. Check for mistakes.
Comment thread student_code.py
Comment on lines +131 to +134
print(even_numbers(20))



Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Module-level print statement should be removed. This creates side effects when the module is imported and is not part of the function's API.

Suggested change
print(even_numbers(20))
if __name__ == "__main__":
print(even_numbers(20))

Copilot uses AI. Check for mistakes.
Comment thread student_code.py
pass
odd_numbers = []

for i in range(1,n):
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The range should be range(1, n + 1) to include n itself, as the docstring states 'from 1 to n' (inclusive).

Suggested change
for i in range(1,n):
for i in range(1, n + 1):

Copilot uses AI. Check for mistakes.
Comment thread student_code.py
for i in range(1,n):
if i % 2 != 0:
odd_numbers.append(i)
return odd_numbers
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return statement is inside the loop, causing the function to return after finding the first odd number. Unindent this line to be at the same level as the for loop.

Suggested change
return odd_numbers
return odd_numbers

Copilot uses AI. Check for mistakes.
Comment thread student_code.py
Comment on lines +153 to 154
print(odd_numbers(20))

Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Module-level print statement should be removed. This creates side effects when the module is imported and is not part of the function's API.

Suggested change
print(odd_numbers(20))

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants