diff --git a/cfu-data-types.ipynb b/cfu-data-types.ipynb index e0fee02..5d79496 100644 --- a/cfu-data-types.ipynb +++ b/cfu-data-types.ipynb @@ -49,11 +49,76 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "float" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#1\n", + "\n", + "name = input(\"Enter your name: \")\n", + "age = int(input(\"Enter your age: \"))\n", + "address = input(\"Enter your address: \")\n", + "salary = float(input(\"Enter your salary: \"))\n", + "expenses = float(input(\"Enter your expenses: \")) \n", + "\n", + "type(name)\n", + "type(age)\n", + "type(address)\n", + "type(salary)\n", + "type(expenses)\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ - "# Your code here\n" + "\n", + "savings = salary - expenses\n", + "\n", + "savings = round(savings, 1)\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "boolean_saving = savings >= 500" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "manuel who is 32 years old, and lives in Constitucion 14 has 809.7 dollars left from her salary after expenses. It is True that she has more than $500 left.\n" + ] + } + ], + "source": [ + "print(f\"{name} who is {age} years old, and lives in {address} has {savings} dollars left from her salary after expenses. It is {boolean_saving } that she has more than $500 left.\")" ] }, { @@ -85,7 +150,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -102,17 +167,144 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ - "# Your code here\n" + "poem = poem.replace(\",\", \" \")\n", + "poem = poem.replace(\".\", \" \")\n", + "poem = poem.replace(\"\\n\",\" \")\n", + "poem = poem.lower()" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'some say the world will end in fire some say in ice from what i’ve tasted of desire i hold with those who favor fire but if it had to perish twice i think i know enough of hate to say that for destruction ice is also great and would suffice python is awesome!'" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "new_poem = poem + (\"python is awesome!\")\n", + "new_poem " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "263" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len_poem = len(new_poem)\n", + "len_poem \n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['some',\n", + " 'say',\n", + " 'the',\n", + " 'world',\n", + " 'will',\n", + " 'end',\n", + " 'in',\n", + " 'fire',\n", + " 'some',\n", + " 'say',\n", + " 'in',\n", + " 'ice',\n", + " 'from',\n", + " 'what',\n", + " 'i’ve',\n", + " 'tasted',\n", + " 'of',\n", + " 'desire',\n", + " 'i',\n", + " 'hold',\n", + " 'with',\n", + " 'those',\n", + " 'who',\n", + " 'favor',\n", + " 'fire',\n", + " 'but',\n", + " 'if',\n", + " 'it',\n", + " 'had',\n", + " 'to',\n", + " 'perish',\n", + " 'twice',\n", + " 'i',\n", + " 'think',\n", + " 'i',\n", + " 'know',\n", + " 'enough',\n", + " 'of',\n", + " 'hate',\n", + " 'to',\n", + " 'say',\n", + " 'that',\n", + " 'for',\n", + " 'destruction',\n", + " 'ice',\n", + " 'is',\n", + " 'also',\n", + " 'great',\n", + " 'and',\n", + " 'would',\n", + " 'suffice',\n", + " 'python',\n", + " 'is',\n", + " 'awesome!']" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "poem_list = new_poem.split()\n", + "poem_list " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "base", "language": "python", "name": "python3" }, @@ -126,7 +318,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.13.5" } }, "nbformat": 4,