Skip to content

Prashely the GOAT#14

Open
Prashely wants to merge 7 commits into
micanipho:mainfrom
Prashely:main
Open

Prashely the GOAT#14
Prashely wants to merge 7 commits into
micanipho:mainfrom
Prashely:main

Conversation

@Prashely
Copy link
Copy Markdown

No description provided.

@Prashely Prashely closed this Oct 23, 2025
@Prashely Prashely reopened this Oct 23, 2025
@micanipho micanipho requested a review from Copilot October 27, 2025 14:41
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 multiple Python functions for educational purposes, focusing on functions, loops, data processing, and simple algorithms. The changes replace placeholder pass statements with working implementations across various learning outcomes.

Key Changes:

  • Implementation of 20+ functions covering mathematical operations, list processing, and string manipulation
  • Addition of a practice file demonstrating the rank_students function
  • Configuration of VS Code settings for Python unit testing

Reviewed Changes

Copilot reviewed 3 out of 10 changed files in this pull request and generated 17 comments.

File Description
tests/pycache/student_code.py Implements all function bodies replacing pass statements with working code for loops, data processing, and algorithms
practice.py Adds a practice/test file for the rank_students function
.vscode/settings.json Configures Python unit testing with unittest framework

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

"""
pass
if n < 0:
return ValueError
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 should raise ValueError, not return it. Change return ValueError to raise ValueError('n must be non-negative') or similar error message.

Suggested change
return ValueError
raise ValueError("n must be non-negative")

Copilot uses AI. Check for mistakes.
if n < 0:
return ValueError
total = 0
for i in range(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 loop uses range(n) which iterates from 0 to n-1, but the docstring specifies calculating the sum from 1 to n (inclusive). Change to range(1, n + 1) to match the specification.

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

Copilot uses AI. Check for mistakes.
Comment on lines +37 to +41
for grade in grades:
if grade >= min_pass:
return "Pass"
else:
return "False"
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 immediately after checking the first grade instead of evaluating the average of all grades. According to the docstring, it should calculate the average grade and compare it to min_pass. The return value should also be 'Fail' not 'False'.

Suggested change
for grade in grades:
if grade >= min_pass:
return "Pass"
else:
return "False"
if not grades:
return "Fail"
average = sum(grades) / len(grades)
if average >= min_pass:
return "Pass"
else:
return "Fail"

Copilot uses AI. Check for mistakes.
"""
pass

return sorted(students[1])
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.

This attempts to access index [1] on a list and sort it, which is incorrect. The function should sort the entire students list by score in descending order. Use return sorted(students, key=lambda x: x[1], reverse=True).

Suggested change
return sorted(students[1])
return sorted(students, key=lambda x: x[1], reverse=True)

Copilot uses AI. Check for mistakes.
Comment on lines +135 to 139
odd_numbers = []
for i in range(n):
if i % 2 != 0:
odd_numbers.append(i)
"""
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 implementation appears before its docstring. Move lines 135-137 to after line 147 (after the docstring). Additionally, the range should be range(1, n+1) to match the 'from 1 to n' specification in the docstring.

Copilot uses AI. Check for mistakes.
Comment on lines +396 to 397
return statistics.median(nums)
"""
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 implementation appears before its docstring, and there's a pass statement after the docstring. Move line 396 to replace line 409 (the pass statement).

Copilot uses AI. Check for mistakes.
Comment on lines +423 to 428
if len(nums) == 0:
return None
else:
nums = sorted(nums)
largest_number = nums[-1]
"""
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 implementation appears before its docstring. Move lines 423-427 to after line 436 (after the docstring).

Copilot uses AI. Check for mistakes.
Comment on lines +439 to 447
factors = []
for i in range(1, n+1):
if n % i == 0:
factors.append(i)
if len(factors) == 2:
return True
else:
return False
"""
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 implementation appears before its docstring. Move lines 439-446 to after line 455 (after the docstring).

Copilot uses AI. Check for mistakes.
Comment on lines +460 to 465
char_counter = 0

for el in word_sentence:
if el == char_count:
char_counter += 1
"""
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 implementation appears before its docstring. Move lines 460-464 to after line 474 (after the docstring).

Copilot uses AI. Check for mistakes.
Comment thread practice.py
list: A sorted list of tuples in descending order based on scores.
"""

return sorted(students)
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 sorts students by name (alphabetically) instead of by score in descending order. Use return sorted(students, key=lambda x: x[1], reverse=True) to sort by score.

Suggested change
return sorted(students)
return sorted(students, key=lambda x: x[1], reverse=True)

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