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

Coding Challenge - Python solution from Zach Chan #77

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<h1 align="center">
<a href="#"><img src="README_imgs/bright_network_logo.svg" alt="UOL" width="200"></a>
<a href="#"><img src="README_imgs/google_logo.svg" alt="test" height="100"></a>
<br>
2021 Bright Network Internship
<br>
Google Youtube Coding Challenge
<br>
Challenge Completed!
</h1>

Written by [Zach CHAN](https://zachan.dev/)
(Links: [Website](https://zachan.dev/)
[LinkedIn](https://www.linkedin.com/in/zach-chan-hk/)
[Email](mailto:[email protected]))

Participant ID: [[email protected]](mailto:[email protected])

## Table of Contents

<!-- toc -->

- [Coding Challenge Introduction](#coding-challenge-introduction)
- [Programming Language Chosen](#programming-language-chosen)
- [Passed Tests Screenshot](#passed-tests-screenshot)
- [Part 1](#part-1)
- [Part 2](#part-2)
- [Part 3](#part-3)
- [Part 4](#part-4)

<!-- tocstop -->

<br />

# Coding Challenge Introduction
It is my honour to become part of the Bright Network Internship, July 2021. I have chosen to take part in Google’s Coding Challenge for Bright Network. And this is my repository for submission!

# Programming Language Chosen
Python, I used [PyCharm](https://www.jetbrains.com/pycharm/) for easier coding and debugging.

[Click to see the Python coding](./python/)

# Passed Tests Screenshot
## Part 1
![Part 1 Tests Screenshot](./python/test_results/Part_1_tests.png)

## Part 2
![Part 2 Tests Screenshot](./python/test_results/Part_2_tests.png)

## Part 3
![Part 3 Tests Screenshot](./python/test_results/Part_3_tests.png)

## Part 4
![Part 4 Tests Screenshot](./python/test_results/Part_4_tests.png)
1 change: 1 addition & 0 deletions README_imgs/bright_network_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions README_imgs/google_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions python/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Click [**here**](../README.md) to view my Submission Report
----------------------------------------------------------------

# Youtube Challenge - Python
The Python Youtube Challenge uses Python3.
The below commands use Python3 specifically, to account for users that might
Expand Down
21 changes: 21 additions & 0 deletions python/src/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ def __init__(self, video_title: str, video_id: str, video_tags: Sequence[str]):
# in case the caller changes the 'video_tags' they passed to us
self._tags = tuple(video_tags)

# custom property: flag
self._flag = None

def __str__(self):
"""Custom String Representation"""
return "{title} ({id}) [{tags}]".format(title=self._title, id=self._video_id, tags=" ".join(self._tags))

@property
def title(self) -> str:
"""Returns the title of a video."""
Expand All @@ -29,3 +36,17 @@ def video_id(self) -> str:
def tags(self) -> Sequence[str]:
"""Returns the list of tags of a video."""
return self._tags

# Custom property: flag
@property
def flag(self) -> str:
"""Returns the flag of a video."""
return self._flag

# Custom flag video method
def action_flag(self, reason):
self._flag = reason

# Custom flag removal method
def remove_flag(self):
self._flag = None
Loading