NW|26-JUI-SDC|Ahmad Hmedan|Sprint 5 |Prep exercises - #639
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
LonMcGregor
left a comment
There was a problem hiding this comment.
Good work on this, I have some comments for the laptop allocation task
| laptops_by_operating_system | ||
| ) | ||
| if person1.preferred_operating_system != most_available_os: | ||
| print("Are you willing to accept ", most_available_os.value, "instead") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
| 1.Ubuntu | ||
| 2,Arch Linux | ||
| 3.macOs""") | ||
| choice: int = int(input("Enter Your choice: ")) |
There was a problem hiding this comment.
Is there any input validation here? What is the UX like if something goes wrong?
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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?)
|
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. |
Learners, PR Template
Self checklist
Changelist
DONE
Task ID: CYF-1155