Skip to content

Artemis: Refactor: Use list comprehension for sum_range and sum_modulus#3

Open
SamSSLF wants to merge 1 commit into
mainfrom
artemis-71b95efb-4722-4791-8bd1-10ebc736c674
Open

Artemis: Refactor: Use list comprehension for sum_range and sum_modulus#3
SamSSLF wants to merge 1 commit into
mainfrom
artemis-71b95efb-4722-4791-8bd1-10ebc736c674

Conversation

@SamSSLF

@SamSSLF SamSSLF commented Mar 17, 2025

Copy link
Copy Markdown
Owner

This commit replaces the explicit loop and list appending in the sum_range and sum_modulus methods with list comprehensions. This makes the code more concise and readable. The sum_range method now calculates the sum using the expression sum([i for i in range(n)]), which generates a list of numbers from 0 to n and then sums them. Similarly, the sum_modulus method uses sum([i for i in range(n) if i % m == 0]), which generates a list of numbers from 0 to n that are divisible by m and then sums them. This change improves the readability and conciseness of the code while maintaining the functionality.

@SamSSLF SamSSLF left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

test

Comment thread src/llm_benchmark/control/single.py

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

lorem ipsum dolor sit amen

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