From 6a99376bcac0197746dbebdefa476e40bdaee64b Mon Sep 17 00:00:00 2001 From: prodduturisindhurdy Date: Sat, 11 Oct 2025 13:37:26 +0100 Subject: [PATCH 1/3] lab done --- cfu-data-types.ipynb | 48 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/cfu-data-types.ipynb b/cfu-data-types.ipynb index e0fee02..042764b 100644 --- a/cfu-data-types.ipynb +++ b/cfu-data-types.ipynb @@ -49,11 +49,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Sindhu, who is 22 years old,and lives in portugal has 500.0 dollars left from her 1000 salary after expenses.It is True that she has more than $500 left.\n" + ] + } + ], "source": [ - "# Your code here\n" + "name=str(input(\"enter your name\"))\n", + "age=int(input(\"enter your age\"))\n", + "address=input(\"enter your address\")\n", + "salary=int(input(\"enter your salary\"))\n", + "expenses=float(input(\"enter your expenses\"))\n", + "remaining_salary=salary-expenses\n", + "is_salary_good=bool(remaining_salary)\n", + "round(remaining_salary)\n", + "print(f\"{name}, who is {age} years old,and lives in {address} has {remaining_salary} dollars left from her {salary} salary after expenses.It is {is_salary_good} that she has more than $500 left.\")\n" ] }, { @@ -85,7 +101,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -102,17 +118,31 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "263\n", + "['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!']\n" + ] + } + ], "source": [ - "# Your code here\n" + "result=poem.strip(\" \").lower()\n", + "string=\"python is awesome!\"\n", + "combined=result + string\n", + "print(len(combined))\n", + "poem_list=combined.split()\n", + "print(poem_list)\n" ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -126,7 +156,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.11.9" } }, "nbformat": 4, From 6ee9ee738fdfa93e1e4ad93da6c2772fb5a1dd36 Mon Sep 17 00:00:00 2001 From: prodduturisindhurdy Date: Sat, 11 Oct 2025 13:44:56 +0100 Subject: [PATCH 2/3] sloved lab --- cfu-data-types.ipynb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/cfu-data-types.ipynb b/cfu-data-types.ipynb index 042764b..1b72198 100644 --- a/cfu-data-types.ipynb +++ b/cfu-data-types.ipynb @@ -49,14 +49,14 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Sindhu, who is 22 years old,and lives in portugal has 500.0 dollars left from her 1000 salary after expenses.It is True that she has more than $500 left.\n" + "Sindhu, who is 22 years old,and lives in portugal has 1000.0 dollars left from her 1500 salary after expenses.It is True that she has more than $500 left.\n" ] } ], @@ -66,9 +66,10 @@ "address=input(\"enter your address\")\n", "salary=int(input(\"enter your salary\"))\n", "expenses=float(input(\"enter your expenses\"))\n", - "remaining_salary=salary-expenses\n", - "is_salary_good=bool(remaining_salary)\n", - "round(remaining_salary)\n", + "remaining_salary=round(salary-expenses,1)\n", + "\n", + "is_salary_good=remaining_salary >=500\n", + "\n", "print(f\"{name}, who is {age} years old,and lives in {address} has {remaining_salary} dollars left from her {salary} salary after expenses.It is {is_salary_good} that she has more than $500 left.\")\n" ] }, @@ -101,7 +102,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ @@ -118,20 +119,20 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "263\n", - "['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!']\n" + "261\n", + "['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!']\n" ] } ], "source": [ - "result=poem.strip(\" \").lower()\n", + "result=poem.lower().replace(\",\",\"\").replace(\"\\n\",\" \")\n", "string=\"python is awesome!\"\n", "combined=result + string\n", "print(len(combined))\n", From c738208637fe90254f4a7aba69f53165336142dc Mon Sep 17 00:00:00 2001 From: prodduturisindhurdy Date: Sat, 11 Oct 2025 13:50:19 +0100 Subject: [PATCH 3/3] sloved lab --- cfu-data-types.ipynb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cfu-data-types.ipynb b/cfu-data-types.ipynb index 1b72198..df5a809 100644 --- a/cfu-data-types.ipynb +++ b/cfu-data-types.ipynb @@ -119,20 +119,20 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 18, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "261\n", - "['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!']\n" + "258\n", + "['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!']\n" ] } ], "source": [ - "result=poem.lower().replace(\",\",\"\").replace(\"\\n\",\" \")\n", + "result=poem.lower().replace(\".\",\"\").replace(\",\",\"\").replace(\"'\",\"\").replace(\"\\n\",\" \")\n", "string=\"python is awesome!\"\n", "combined=result + string\n", "print(len(combined))\n",