Compare commits

..

No commits in common. "main" and "tutorial" have entirely different histories.

24 changed files with 1 additions and 45 deletions

View File

@ -15,7 +15,7 @@ Repository for CDS-2020 Programming and Promt Engineering II
|build|Build-System, Dependencies|build: update requirements.txt|
# Codewars
|Title|Source (src/codewars/)|Test (tests/test_codewars/)|URL|
|Title|Source (src/codewars/)|Test (test/test_codewars/)|URL|
|-|-|-|-|
|Find the force of gravity between two objects|kata_force_of_gravity.py|test_force_of_gravity.py|[5b609ebc8f47bd595e000627](https://www.codewars.com/kata/5b609ebc8f47bd595e000627)|
|The Lamp: Revisited|kata_the_lamp.py|test_the_lamp.py|[570e6e32de4dc8a8340016dd](https://www.codewars.com/kata/570e6e32de4dc8a8340016dd)|
@ -31,5 +31,3 @@ Repository for CDS-2020 Programming and Promt Engineering II
|Next bigger number with the same digits|kata_next_bigger_number_same_digits.py|test_next_bigger_number_same_digits.py|[55983863da40caa2c900004e](https://www.codewars.com/kata/55983863da40caa2c900004e)|
|Snail|kata_snail.py|test_snail.py|[521c2db8ddc89b9b7a0000c1](https://www.codewars.com/kata/521c2db8ddc89b9b7a0000c1)|
|Chinese Numeral Encoder|kata_chinese_numeral_encoder.py|test_chinese_numeral_encoder.py|[52608f5345d4a19bed000b31](https://www.codewars.com/kata/52608f5345d4a19bed000b31)|
|RGB To Hex Conversion|kata_rgb_2_hex.py|test_rgb_2_hex.py|[513e08acc600c94f01000001](https://www.codewars.com/kata/513e08acc600c94f01000001)|
|Most frequently used words in a text|kata_most_words_used.py|test_most_words_used.py|[51e056fe544cf36c410000fb](https://www.codewars.com/kata/51e056fe544cf36c410000fb)|

View File

@ -1,2 +0,0 @@
def top_3_words(text):
return None

View File

@ -1,11 +0,0 @@
def rgb(r, g, b):
rgb = {"r": int(r), "g": int(g), "b": int(b)}
for decimal in rgb:
rgb[decimal] = min(255, max(rgb[decimal], 0))
rgb[decimal] = hex(rgb[decimal]).split("x")[-1]
if len(rgb[decimal]) == 1:
rgb[decimal] = "0" + rgb[decimal]
return f"{rgb['r']}{rgb['g']}{rgb['b']}".upper()

View File

@ -1,8 +0,0 @@
def load_scores(data: list[tuple[str, str | int]]) -> dict:
result = {}
for name, points in data:
result[name] = int(points)
return result
print(load_scores([("Sandro", "54"), ("Arif", "45"), ("Sidney", 89)]))

View File

@ -1,5 +0,0 @@
from src.codewars.kata_most_words_used import top_3_words
def test_top_3_words():
assert top_3_words() == 0

View File

@ -1,16 +0,0 @@
from src.codewars.kata_rgb_2_hex import rgb
import pytest
@pytest.mark.parametrize(
("r", "g", "b", "expected"),
[
(0, 0, 0, "000000"),
(1, 2, 3, "010203"),
(255, 255, 255, "FFFFFF"),
(254, 253, 252, "FEFDFC"),
(-20, 275, 125, "00FF7D"),
],
)
def test_rgb_2_hex(r, g, b, expected):
assert rgb(r, g, b) == expected