From c1b970d8cf33fcac9091ef2701893b7b7209045f Mon Sep 17 00:00:00 2001 From: foux98 <156951108+foux98@users.noreply.github.com> Date: Sun, 9 Jun 2024 19:06:09 +0200 Subject: [PATCH] [lab_oop] Juanma Pardo --- README.md.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 README.md.md diff --git a/README.md.md b/README.md.md new file mode 100644 index 0000000..22b79db --- /dev/null +++ b/README.md.md @@ -0,0 +1,51 @@ +**Kata**: + +https://www.codewars.com/kata/51e0007c1f9378fa810002a9/train/python + +Remove All The Marked Elements of a List + + def remove_(self, integer_list, values_list): + return [x for x in integer_list if x not in values_list] + + +```python +https://www.codewars.com/kata/56311e4fdd811616810000ce/train/python +``` + +#Method For Counting Total Occurence Of Specific Digits + +class List: + def count_spec_digits(self, integers_list, digits_list): + + digit_freq = {digit: 0 for digit in digits_list} + + + for num in integers_list: + + num_str = str(abs(num)) + + for digit in digits_list: + digit_freq[digit] += num_str.count(str(digit)) + + + result = [(digit, digit_freq[digit]) for digit in digits_list] + + return result + +#Ordered Count of Characters + +https://www.codewars.com/kata/ordered-count-of-characters + +def ordered_count(inp): + + char_count = {} + + + for char in inp: + + char_count[char] = char_count.get(char, 0) + 1 + + + result = [(char, count) for char, count in char_count.items()] + + return result