diff --git a/Ejercicio02.ipynb b/Ejercicio02.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..1a67d7d0fd250a3d72400dee7392e44f694596bd --- /dev/null +++ b/Ejercicio02.ipynb @@ -0,0 +1,67 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ingrese un numero:8\n", + "1 \n", + "1 1 \n", + "1 2 1 \n", + "1 3 3 1 \n", + "1 4 6 4 1 \n", + "1 5 10 10 5 1 \n", + "1 6 15 20 15 6 1 \n" + ] + } + ], + "source": [ + "def pascalCelda(fil,col):\n", + " if (col==1): return 1\n", + " if (fil==col): return 1\n", + " upIzq = pascalCelda(fil-1,col-1)\n", + " upDer = pascalCelda(fil-1,col)\n", + " return upIzq+upDer\n", + "\n", + "n=input(\"ingrese un numero:\")\n", + "for f in range(1,int(n)):\n", + " for c in range(1,f+1):\n", + " print(pascalCelda(f,c),end=\" \",sep=\" \")\n", + " print(\"\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.7.3" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}