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

Solution #554

Closed
wants to merge 3 commits into from
Closed

Solution #554

wants to merge 3 commits into from

Conversation

IlyaGrynyshyn
Copy link

No description provided.

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")

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)

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
Comment on lines 10 to 17
for first_name, last_name in [
["George", "Klooney"],
["Kianu", "Reaves"],
["Scarlett", "Keegan"],
["Will", "Smith"],
["Jaden", "Smith"],
["Scarlett", "Johansson"]
]:

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()

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

Copy link

@viktoria-rybenchuk viktoria-rybenchuk left a comment

Choose a reason for hiding this comment

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

Good job!

@IlyaGrynyshyn IlyaGrynyshyn closed this by deleting the head repository Apr 9, 2024
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