diff --git a/M2.ipynb b/M2.ipynb new file mode 100644 index 0000000..626fa9f --- /dev/null +++ b/M2.ipynb @@ -0,0 +1,275 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [], + "authorship_tag": "ABX9TyN/wWCVE+FUdmhhJ6JB31hd", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "hsiVhIV3g2Rn", + "outputId": "1df8285f-7fd9-4a48-d960-7c4bbedde868" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "hola mundo\n" + ] + } + ], + "source": [ + "print(\"hola mundo\")" + ] + }, + { + "cell_type": "code", + "source": [ + "#aritmetica\n", + "print(1 + 2)\n", + "\n", + "#resta\n", + "print(9 - 5)\n", + "\n", + "#operacion\n", + "print(((1 + 3) * (9 - 2) / 2) ** 2)\n", + "\n", + "#multiplicacion\n", + "print(3 * 2)\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "rypU166y3qfl", + "outputId": "82c64b33-e7c0-4a76-cffc-1efb86a31b2a" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "3\n", + "4\n", + "196.0\n", + "6\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "#variable\n", + "\n", + "# Create a variable called test_var and give it a value of 4+5\n", + "test_var = 4 + 5\n", + "\n", + "# Print the value of test_var\n", + "print(test_var)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "QNwMmffb5Vsj", + "outputId": "aadf180e-5702-4c97-8462-35a541bf7acf" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "9\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "#manipulacion de variable\n", + "\n", + "# Set the value of a new variable to 3\n", + "my_var = 3\n", + "\n", + "# Print the value assigned to my_var\n", + "print(my_var)\n", + "\n", + "# Change the value of the variable to 100\n", + "my_var = 100\n", + "\n", + "# Print the new value assigned to my_var\n", + "print(my_var)\n", + "\n", + "print(my_var)\n", + "print(test_var)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "jZVbKiO45pzE", + "outputId": "e96e5d26-9ab1-4afa-bb36-edaaf8cbb33d" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "3\n", + "100\n", + "100\n", + "9\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "#incremento\n", + "\n", + "# Increase the value by 3\n", + "my_var = my_var + 3\n", + "\n", + "# Print the value assigned to my_var\n", + "print(my_var)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "3TH3n2s96KM8", + "outputId": "d589d23e-94aa-40fe-9dfb-e4379b43658a" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "103\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "#multiples variables\n", + "\n", + "# Create variables\n", + "num_years = 4\n", + "days_per_year = 365\n", + "hours_per_day = 24\n", + "mins_per_hour = 60\n", + "secs_per_min = 60\n", + "\n", + "# Calculate number of seconds in four years\n", + "total_secs = secs_per_min * mins_per_hour * hours_per_day * days_per_year * num_years\n", + "print(total_secs)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "WRvU0xrl6VSD", + "outputId": "07fa2162-476c-4522-848b-03773409ade3" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "126144000\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "#horas por dias\n", + "\n", + "print(hours_per_dy)\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 176 + }, + "id": "PR6hZx2_64IT", + "outputId": "24cf48fc-2e72-4289-d3b5-cb85ec5c9954" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "error", + "ename": "NameError", + "evalue": "name 'hours_per_dy' is not defined", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m#horas por dias\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhours_per_dy\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mNameError\u001b[0m: name 'hours_per_dy' is not defined" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "print(hours_per_day)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "8rOtd8Nx679b", + "outputId": "94f08afc-0777-42b7-d0c9-45449ccc3ffe" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "24\n" + ] + } + ] + } + ] +} \ No newline at end of file