Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find the Second-Largest Number #40

Open
Mr-Glucose opened this issue Jan 4, 2025 · 0 comments
Open

Find the Second-Largest Number #40

Mr-Glucose opened this issue Jan 4, 2025 · 0 comments
Labels
code challenge Label for codes challenges good first issue Good for newcomers

Comments

@Mr-Glucose
Copy link

Description

Write a function to find the second-largest number in a list of integers. Return None if the list has fewer than two unique numbers.

Requirements

  • Input will always be a list of integers.
  • Handle cases with duplicate numbers appropriately (e.g., [4, 4, 3, 2] should return 3).

Example

find_second_largest([1, 2, 3, 4]) 
# Output: 3

find_second_largest([4, 4, 3, 2]) 
# Output: 3

find_second_largest([10]) 
# Output: None

Testing

Develop tests to validate your function. Consider:

  • Lists with duplicate values.
  • Lists with fewer than two unique numbers.
  • Large lists with mixed positive and negative integers.

Helpful Links

@Mr-Glucose Mr-Glucose added the code challenge Label for codes challenges label Jan 4, 2025
@SEMIRATESFAI SEMIRATESFAI moved this from TODO to DOING in ET6 Foundations Group 04 Jan 5, 2025
@SEMIRATESFAI SEMIRATESFAI self-assigned this Jan 5, 2025
@SEMIRATESFAI SEMIRATESFAI added the good first issue Good for newcomers label Jan 5, 2025
@SEMIRATESFAI SEMIRATESFAI moved this from DOING to TODO in ET6 Foundations Group 04 Jan 5, 2025
@SEMIRATESFAI SEMIRATESFAI removed their assignment Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code challenge Label for codes challenges good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants