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

Solution1 #1236

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KhrypunovMaxim
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Great job on implementing the solution! 🎉 Your code meets the task requirements and constraints effectively. While there are some minor improvements suggested, such as removing the unnecessary flag variable and adding more descriptive messages when raising exceptions, these do not impact the core functionality of your code. Keep up the good work and consider these suggestions for future enhancements! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

flag = True
if "vaccine" not in visitors.keys():
flag = False
raise NotVaccinatedError

Choose a reason for hiding this comment

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

The NotVaccinatedError should be raised with a descriptive message as per the checklist requirement. Consider using: raise NotVaccinatedError('Visitor is not vaccinated.').

expiration_date = visitors["vaccine"]["expiration_date"]
if expiration_date < today:
flag = False
raise OutdatedVaccineError

Choose a reason for hiding this comment

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

The OutdatedVaccineError should be raised with a descriptive message. Consider using: raise OutdatedVaccineError('Visitor's vaccine is outdated.').

mask = visitors.get("wearing_a_mask")
if not mask:
flag = False
raise NotWearingMaskError

Choose a reason for hiding this comment

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

The NotWearingMaskError should be raised with a descriptive message. Consider using: raise NotWearingMaskError('Visitor is not wearing a mask.').

Comment on lines +11 to +25
flag = True
if "vaccine" not in visitors.keys():
flag = False
raise NotVaccinatedError
today = datetime.date.today()
expiration_date = visitors["vaccine"]["expiration_date"]
if expiration_date < today:
flag = False
raise OutdatedVaccineError
mask = visitors.get("wearing_a_mask")
if not mask:
flag = False
raise NotWearingMaskError
if flag:
return f"Welcome to {self.name}"

Choose a reason for hiding this comment

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

The flag variable is unnecessary. The function can directly raise exceptions or return the welcome message without using this variable.

Comment on lines +7 to +19
flag = True
for friend in friends:
try:
cafe.visit_cafe(friend)
except VaccineError:
flag = False
return "All friends should be vaccinated"
except NotWearingMaskError:
counter_masks += 1
if counter_masks > 0:
return f"Friends should buy {counter_masks} masks"
if flag:
return f"Friends can go to {cafe.name}"

Choose a reason for hiding this comment

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

The flag variable is unnecessary. The function can directly return the appropriate message after checking conditions without using this variable.

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.

3 participants