diff --git a/cfu-data-types.ipynb b/cfu-data-types.ipynb index e0fee02..f6bac56 100644 --- a/cfu-data-types.ipynb +++ b/cfu-data-types.ipynb @@ -49,11 +49,42 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Enter your first_name a\n", + "Enter your age 1\n", + "Enter your address b\n", + "Enter your salary 3\n", + "Enter your expenses 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a, who is 1 years old, and lives in b has 1.0 dollars left from her salary after expenses. It is False that she has more than $500 left\n" + ] + } + ], "source": [ - "# Your code here\n" + "# Your code here\n", + "name= input(\"Enter your first_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", + "remaining_salary=round((salary-expenses),1)\n", + "\n", + "if remaining_salary>500:\n", + " is_salary_good =True\n", + "else: \n", + " is_salary_good =False\n", + "print(f\"{name}, who is {age} years old, and lives in {address} has {remaining_salary} dollars left from her salary after expenses. It is {is_salary_good} that she has more than $500 left\") \n" ] }, { @@ -85,7 +116,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 21, "metadata": {}, "outputs": [], "source": [ @@ -102,19 +133,41 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 37, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "258\n", + "['some', 'say', 'the', 'world', 'will', 'end', 'in', 'fire', 'some', 'say', 'in', 'ice', 'from', 'what', 'ive', '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!']\n" + ] + } + ], "source": [ - "# Your code here\n" + "# Your code here\n", + "import re\n", + "punctuated_poem=re.sub(r'[^\\w\\s]',\"\",poem).lower()\n", + "new_var=punctuated_poem +\" \"+\"python is awesome!\"\n", + "print(len(new_var))\n", + "poem_list=new_var.split( )\n", + "print(poem_list)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "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 +179,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.12.7" } }, "nbformat": 4,