Skip to content
Open
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
110 changes: 110 additions & 0 deletions codewars1.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "3bde88ef",
"metadata": {},
"source": [
"#ARRAY CODEWARS"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b290293a",
"metadata": {},
"outputs": [],
"source": [
"#ejercicio 1: \"https://www.codewars.com/kata/563089b9b7be03472d00002b/solutions/python\"\n",
"class List:\n",
" def remove_ (self, integer_list, values_list):\n",
" new_array = []\n",
" for num in integer_list:\n",
" if num not in values_list:\n",
" new_array.append(num)\n",
" return new_array"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "50549b92",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<function count_spec_digits at 0x0000027F32DD8AE0>\n"
]
}
],
"source": [
"#ejercicio 2: \"https://www.codewars.com/kata/56311e4fdd811616810000ce/solutions/python\"\n",
" def count_spec_digits(self, integers_list, digits_list):\n",
" \n",
" lista = []\n",
" \n",
" \n",
" for digit in digits_list:\n",
" count = 0\n",
" for num in integers_list:\n",
" count += str(num).count(str(digit))\n",
" lista.append((digit, count))\n",
" \n",
" return lista "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bd7f1ac1",
"metadata": {},
"outputs": [],
"source": [
"# Ejercicio 3, ordered count: \"https://www.codewars.com/kata/57a6633153ba33189e000074/solutions/python\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b0b6502d",
"metadata": {},
"outputs": [],
"source": [
"char_count = {}\n",
" \n",
" for char in input_string:\n",
" if char in char_count:\n",
" char_count[char] += 1\n",
" else:\n",
" char_count[char] = 1\n",
"\n",
" result = [(char, count) for char, count in char_count.items()]\n",
"\n",
" return result"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}