diff --git a/cfu-data-types.ipynb b/cfu-data-types.ipynb index e0fee02..d227c22 100644 --- a/cfu-data-types.ipynb +++ b/cfu-data-types.ipynb @@ -49,11 +49,48 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The history saving thread hit an unexpected error (OperationalError('attempt to write a readonly database')).History will not be written to the database.\n" + ] + }, + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Please, enter your name: Patricia\n", + "Please, enter your age: 23\n", + "Please, enter your address: Barcelona\n", + "Please, enter your salary: 67882.3\n", + "Please, enter your expenses: 928.9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Patricia, who is 23 years old, and lives in Barcelona has 66953.4 dollars left from her salary after expenses. It is True that she has more than $500 left.\n" + ] + } + ], "source": [ - "# Your code here\n" + "name= input(\"Please, enter your name: \")\n", + "age= int(input(\"Please, enter your age: \"))\n", + "address= input(\"Please, enter your address: \")\n", + "salary= float(input(\"Please, enter your salary: \"))\n", + "expenses= float(input(\"Please, enter your expenses: \"))\n", + "\n", + "savings= round(salary - expenses,1)\n", + "savings\n", + "\n", + "enough_salary = savings >= 500\n", + "\n", + "print(f\"{name}, who is {age} years old, and lives in {address} has {savings} dollars left from her salary after expenses. It is {enough_salary} that she has more than $500 left.\")" ] }, { @@ -85,7 +122,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -102,19 +139,143 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": {}, - "outputs": [], + "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'" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Your code here\n", + "result = poem.replace(\".\", \"\").replace(\",\", \"\").lower().replace(\"\\n\", \" \")\n", + "result" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "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 sufficepython is awesome!'" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "new_result= result + \"python is awesome!\"\n", + "new_result" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "258\n" + ] + } + ], + "source": [ + "print(len(new_result))" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "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", + " 'sufficepython',\n", + " 'is',\n", + " 'awesome!']" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# Your code here\n" + "poem_list= new_result.rsplit()\n", + "poem_list" ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python [conda env:base] *", "language": "python", - "name": "python3" + "name": "conda-base-py" }, "language_info": { "codemirror_mode": { @@ -126,7 +287,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.13.5" } }, "nbformat": 4,