Skip to content

NW|26-JUI-SDC|Ahmad Hmedan|Sprint 5 |Prep exercises - #639

Open
AhmadHmedann wants to merge 4 commits into
CodeYourFuture:mainfrom
AhmadHmedann:Sprint5
Open

NW|26-JUI-SDC|Ahmad Hmedan|Sprint 5 |Prep exercises#639
AhmadHmedann wants to merge 4 commits into
CodeYourFuture:mainfrom
AhmadHmedann:Sprint5

Conversation

@AhmadHmedann

@AhmadHmedann AhmadHmedann commented Jul 31, 2026

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

DONE

Task ID: CYF-1155

@github-actions

This comment has been minimized.

@AhmadHmedann AhmadHmedann added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 31, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 31, 2026
@AhmadHmedann AhmadHmedann changed the title NW|26-JUI-SDC|Ahmad Hmedan|Sprint 5 |Perp_exercise NW|26-JUI-SDC|Ahmad Hmedan|Sprint 5 |Perp_exercise CYF-1155 Jul 31, 2026
@github-actions

This comment has been minimized.

@AhmadHmedann AhmadHmedann changed the title NW|26-JUI-SDC|Ahmad Hmedan|Sprint 5 |Perp_exercise CYF-1155 NW|26-JUI-SDC|Ahmad Hmedan|Sprint 5 |Perp_exercise Jul 31, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@AhmadHmedann AhmadHmedann added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 31, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 31, 2026
@AhmadHmedann AhmadHmedann changed the title NW|26-JUI-SDC|Ahmad Hmedan|Sprint 5 |Perp_exercise NW|26-JUI-SDC|Ahmad Hmedan|Sprint 5 |Perp_exercise CYF-1155 - Jul 31, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@AhmadHmedann AhmadHmedann changed the title NW|26-JUI-SDC|Ahmad Hmedan|Sprint 5 |Perp_exercise CYF-1155 - NW|26-JUI-SDC|Ahmad Hmedan|Sprint 5 |Perp_exercise Jul 31, 2026
@AhmadHmedann AhmadHmedann added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 31, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 31, 2026
@github-actions

This comment has been minimized.

2 similar comments
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@illicitonion illicitonion changed the title NW|26-JUI-SDC|Ahmad Hmedan|Sprint 5 |Perp_exercise NW|26-JUI-SDC|Ahmad Hmedan|Sprint 5 |Prep exercises Aug 1, 2026
@illicitonion illicitonion added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 1, 2026
@LonMcGregor LonMcGregor added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Aug 3, 2026

@LonMcGregor LonMcGregor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good work on this, I have some comments for the laptop allocation task

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good explanations

Comment thread Perp-exercises/enum8.1.py Outdated
laptops_by_operating_system
)
if person1.preferred_operating_system != most_available_os:
print("Are you willing to accept ", most_available_os.value, "instead")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you have a question like this, what is the user expected to do? Is there some way for them to answer the question / change the outcome of the program?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thank you for the feedback, You're right_ the original version asked the question and do not let the user to respond, so it couldn't affect the program's behaviour.

I have updated the code so the user can answer Y/N, If they accept the program will assigns them a laptop with the most available OS; otherwise, it keeps their original choice or exit if there is no suitable laptops is available

Comment thread Perp-exercises/enum8.1.py Outdated
1.Ubuntu
2,Arch Linux
3.macOs""")
choice: int = int(input("Enter Your choice: "))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there any input validation here? What is the UX like if something goes wrong?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the feedback. I added a loop to validate the user's input. If the user enters an invalid choice, the program displays a message telling them they must enter a number between 1 and 3, then keeps asking until they enter a valid option. I think this provides a better user experience than letting the program continue with invalid input.

@LonMcGregor LonMcGregor removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Aug 3, 2026
@LonMcGregor LonMcGregor added the Reviewed Volunteer to add when completing a review with trainee action still to take. label Aug 3, 2026
@AhmadHmedann AhmadHmedann added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Aug 4, 2026

@LonMcGregor LonMcGregor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is better, having an input loop is much better UX. Does your input loop properly handle all possible inputs? (hint: what if I accidentally type something totally invalid?)

@LonMcGregor LonMcGregor added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 4, 2026
@AhmadHmedann

Copy link
Copy Markdown
Author

You're right. At the moment, it only handles invalid numbers outside the valid range. If the user enters something like a letter, int() raises a ValueError.
I think for better validation I should use try catch.

@AhmadHmedann AhmadHmedann added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants