-
Notifications
You must be signed in to change notification settings - Fork 940
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
'Solution' #795
base: master
Are you sure you want to change the base?
'Solution' #795
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job overall! There are some minor issues that could be improved, but they don't significantly impact the functionality of your code. Keep up the good work! Remember to consider the suggestions for future improvements. 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
- З 06:00 по 11:59: 0 до сили. | ||
|
||
Повертає значення магічної сили. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring is not written in English. It's a good practice to write comments and docstrings in English, as it's the universal language of programming. This makes your code more understandable to a wider audience of developers.
|
||
Повертає значення магічної сили. | ||
""" | ||
current_hour = time.localtime().tm_hour |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are directly using the time
module to get the current time. While this is not inherently wrong, it's generally a good practice to use a more abstract way of getting the current time, such as defining a function or method for this. This makes your code easier to test, as you can mock this function or method in your tests to return a specific time.
elif 0 <= current_hour < 6: | ||
return self.base_power - 10 | ||
else: | ||
return self.base_power |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The get_power
method is a bit long and contains multiple if
and elif
statements. It's generally a good practice to avoid long methods and to limit the amount of branching in your code. One way to simplify this method would be to define a dictionary that maps time ranges to power adjustments, and then use this dictionary in the get_power
method. This would make your code shorter, easier to read, and easier to modify if the power adjustments need to be changed in the future.
в мєнє питання.
чи можу я вносити зміни до файлу тест?
в мене незручності з проходження тесту через додавання модулю таим)