Skip to content

Excessive Repetition #714

Description

@1chooo

Descriptions

There is excessive repetition in the code descriptions.

This project seems to have been unmaintained for a long time, but there are still many people actively discussing it. Therefore, I would like to raise some issues that I have seen and discuss them with everyone. Currently, there are several spelling errors in the code, but the more serious issue is the excessive duplication of code. Therefore, I made some modifications, and the following is my code. Everyone is welcome to discuss it together.

Modified

title = "Office Hour"
print(title)

message = "Office hour are from 9:00 am to 9:00 pm."
print(message)

timezones = {
    "Portland": {1: "closed", 2: "closed", 3: "closed", 4: "closed", 5: "closed", 
                 6: "closed", 7: "closed", 8: "open", 9: "closed", 10: "closed", 
                 11: "closed", 12: "closed"},
    "New York": {1: "closed", 2: "closed", 3: "open", 4: "closed", 5: "closed", 
                 6: "closed", 7: "closed", 8: "closed", 9: "closed", 10: "closed", 
                 11: "closed", 12: "closed"},
    "London":   {1: "closed", 2: "closed", 3: "closed", 4: "closed", 5: "open", 
                 6: "closed", 7: "closed", 8: "closed", 9: "closed", 10: "closed", 
                 11: "closed", 12: "closed"}
}

def checkBranch(city, timezone):
    status = timezones[city][timezone]
    print(f"The {city} branch is {status}")

checkBranch("Portland", 8)
checkBranch("New York", 3)
checkBranch("London", 5)

If there were any problems, please feel free to DM me.

BR,
@1chooo

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions