-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 #554
Solution #554
Conversation
main.py
Outdated
Actor.objects.create(first_name="Scarlett", last_name="Keegan") | ||
Actor.objects.create(first_name="Will", last_name="Smith") | ||
Actor.objects.create(first_name="Jaden", last_name="Smith") | ||
Actor.objects.create(first_name="Scarlett", last_name="Johansson") |
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.
use a for loop to avoid code duplication
main.py
Outdated
|
||
|
||
def main() -> QuerySet: | ||
pass | ||
for genre in ["Western", "Action", "Dramma"]: | ||
Genre.objects.create(name=genre) |
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.
add a blank line between two logical parts of the code, you can simply insert a blank line to visually separate the sections.
main.py
Outdated
for first_name, last_name in [ | ||
["George", "Klooney"], | ||
["Kianu", "Reaves"], | ||
["Scarlett", "Keegan"], | ||
["Will", "Smith"], | ||
["Jaden", "Smith"], | ||
["Scarlett", "Johansson"] | ||
]: |
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.
To make the code more readable, you can save the list of first and last names in a variable and then use a for loop with that variable
last_name="Reaves" | ||
).update(first_name="Keanu", last_name="Reeves") | ||
Genre.objects.filter(name="Action").delete() | ||
Actor.objects.filter(first_name="Scarlett").delete() |
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.
Add a blank line to separate sections of your code for readability
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.
Good job!
No description provided.