actualización de ejercicios

parent fb92341b
......@@ -959,7 +959,7 @@
},
{
"cell_type": "code",
"execution_count": 46,
"execution_count": 3,
"metadata": {},
"outputs": [
{
......@@ -1007,6 +1007,34 @@
"test_list2set()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n",
"2\n",
"2\n",
"3\n",
"3\n",
"3\n",
"3\n",
"4\n",
"5\n",
"5\n"
]
}
],
"source": [
"a = [1,2,2,3,3,3,3,4,5,5]\n",
"for i in a:\n",
" print(i)"
]
},
{
"cell_type": "markdown",
"metadata": {},
......@@ -1069,44 +1097,13 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"a True\n",
"b True\n",
"c True\n",
"d True\n",
"e True\n",
"f True\n",
"g True\n",
"h True\n",
"i True\n",
"j True\n",
"k True\n",
"l True\n",
"m True\n",
"n True\n",
"ñ True\n",
"o True\n",
"p True\n",
"q True\n",
"r True\n",
"s True\n",
"t True\n",
"u True\n",
"v True\n",
"w True\n",
"x True\n",
"y True\n",
"z True\n",
"27 True\n",
"a True\n",
"b False\n",
"2 False\n",
"OK\n"
]
}
......@@ -1115,7 +1112,11 @@
"def test_pangram():\n",
" pangram = \"jovencillo emponzoñado de whisky , qué figurota exhibe !\"\n",
" nopangram = \"Agua pasa por mi casa\"\n",
" print(\"OK\" if is_pangram(pangram) and not is_pangram(nopangram) else \"KO\")\n",
" print(\"OK\" if gpangram(pangram) and not gpangram(nopangram) else \"KO\")\n",
"\n",
"def gpangram(phrase):\n",
" alphabet=\"abcdefghijklmnñopqrstuvwxyz\"\n",
" return(not(set(alphabet)-set(phrase)))\n",
"\n",
"def is_pangram(string):\n",
" alfabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'ñ', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']\n",
......@@ -1156,6 +1157,33 @@
"999999999"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"1\n",
"22\n",
"333\n",
"4444\n",
"55555\n",
"666666\n",
"7777777\n",
"88888888\n",
"999999999\n"
]
}
],
"source": [
"for i in range(10):\n",
" print(str(i)*i)"
]
},
{
"cell_type": "code",
"execution_count": null,
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment