PyVerse icon indicating copy to clipboard operation
PyVerse copied to clipboard

πŸ§‘β€πŸ’»: Refactor if-elif to match-case in main menu (Python 3.10+)

Open gargi612 opened this issue 5 months ago β€’ 5 comments

Title

Refactor if-elif to match-case in main menu (Python 3.10+) in Anime_manga_tracker from beginners project

Enhancement Aim

Currently, the main menu logic in main() uses multiple if-elif statements to handle user choices. Since Python 3.10+, match-case can be used as a cleaner and more modern alternative to simplify this logic.

Benefits

  • Improves readability and maintainability
  • Makes use of modern Python syntax
  • Cleaner control flow

Changes

Refactor the main if-elif structure to use match-case, like:

match choice:
    case '1':
        ...
    case '2':
        ...
    case _:
        print("Invalid choice")


### Screenshots πŸ“·

_No response_

### Guidelines

- [x] I have read the guidelines
- [ ] I have the link to my latest merged PR

### Full Name

Gargi Meena 

### Participant Role

GSSOC 25 contributor

gargi612 avatar Jul 23 '25 12:07 gargi612

πŸ™Œ Thank you for bringing this issue to our attention! We appreciate your input and will investigate it as soon as possible.

Feel free to join our community on Discord to discuss more!

github-actions[bot] avatar Jul 23 '25 12:07 github-actions[bot]

Hi! I've completed the requested changes and submitted the PR. Kindly add the appropriate labels/tags (e.g., "GSSOC25", "Level", etc.) to the issue for proper tracking. Thank you! πŸ™πŸ˜Š

nikhil123421 avatar Jul 23 '25 14:07 nikhil123421

Hi! I've completed the requested changes and submitted the PR. Kindly add the appropriate labels/tags (e.g., "GSSOC25", "Level", etc.) to the issue for proper tracking. Thank you! πŸ™πŸ˜Š

Hi @nikhil123421 i appreciate the work you have done by submitting the PR, but you can only raise the PR if the issue has been assigned to you. So for that note I am closing your PR.

UTSAVS26 avatar Jul 25 '25 05:07 UTSAVS26

Hi! I've completed the requested changes and submitted the PR #1482 . Kindly check ,Thank you!

gargi612 avatar Jul 25 '25 15:07 gargi612

Hi! I've completed the requested changes and submitted the PR #1487 . Kindly check ,Thank you!

gargi612 avatar Jul 26 '25 09:07 gargi612