From 3b2efeb6586ffc37300370abe315df130ca69886 Mon Sep 17 00:00:00 2001 From: nbdsd <150229890+nbdsd@users.noreply.github.com> Date: Wed, 15 Nov 2023 17:42:01 +0900 Subject: [PATCH 1/3] =?UTF-8?q?Colaboratory=EB=A5=BC=20=ED=86=B5=ED=95=B4?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1=EB=90=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Untitled2.ipynb | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Untitled2.ipynb diff --git a/Untitled2.ipynb b/Untitled2.ipynb new file mode 100644 index 0000000..bb1a2a6 --- /dev/null +++ b/Untitled2.ipynb @@ -0,0 +1,62 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [], + "authorship_tag": "ABX9TyMlcpQhcEFUBEkAGdvBACXS", + "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": { + "id": "EZRZT21oFYC8" + }, + "outputs": [], + "source": [ + "def calculate(int_list, str_list):\n", + " for operator in prioritize_operations(str_list):\n", + " index = str_list.index(operator)\n", + " if operator in {'+', '-', '*', '/'}:\n", + " a = int_list[index]\n", + " b = int_list[index + 1]\n", + " if operator == '+':\n", + " result = a + b\n", + " elif operator == '-':\n", + " result = a - b\n", + " elif operator == '*':\n", + " result = a * b\n", + " elif operator == '/':\n", + " result = a / b\n", + " int_list[index] = result\n", + " str_list.pop(index)\n", + " int_list.pop(index + 1)\n", + "\n", + " return int_list[0]\n", + "\n", + "result = calculate_values([9, 4, 9], ['+', '*'])\n", + "print(\"Result:\", result)" + ] + } + ] +} \ No newline at end of file From 55c1d118ac939e54a47d866651174116975f7104 Mon Sep 17 00:00:00 2001 From: nbdsd <150229890+nbdsd@users.noreply.github.com> Date: Wed, 15 Nov 2023 17:55:47 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=EC=BD=94=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Untitled2.ipynb | 62 -------------------------- "\352\263\204\354\202\260\352\270\260" | 1 + 2 files changed, 1 insertion(+), 62 deletions(-) delete mode 100644 Untitled2.ipynb create mode 100644 "\352\263\204\354\202\260\352\270\260" diff --git a/Untitled2.ipynb b/Untitled2.ipynb deleted file mode 100644 index bb1a2a6..0000000 --- a/Untitled2.ipynb +++ /dev/null @@ -1,62 +0,0 @@ -{ - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "provenance": [], - "authorship_tag": "ABX9TyMlcpQhcEFUBEkAGdvBACXS", - "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": { - "id": "EZRZT21oFYC8" - }, - "outputs": [], - "source": [ - "def calculate(int_list, str_list):\n", - " for operator in prioritize_operations(str_list):\n", - " index = str_list.index(operator)\n", - " if operator in {'+', '-', '*', '/'}:\n", - " a = int_list[index]\n", - " b = int_list[index + 1]\n", - " if operator == '+':\n", - " result = a + b\n", - " elif operator == '-':\n", - " result = a - b\n", - " elif operator == '*':\n", - " result = a * b\n", - " elif operator == '/':\n", - " result = a / b\n", - " int_list[index] = result\n", - " str_list.pop(index)\n", - " int_list.pop(index + 1)\n", - "\n", - " return int_list[0]\n", - "\n", - "result = calculate_values([9, 4, 9], ['+', '*'])\n", - "print(\"Result:\", result)" - ] - } - ] -} \ No newline at end of file diff --git "a/\352\263\204\354\202\260\352\270\260" "b/\352\263\204\354\202\260\352\270\260" new file mode 100644 index 0000000..52ef897 --- /dev/null +++ "b/\352\263\204\354\202\260\352\270\260" @@ -0,0 +1 @@ +{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[{"file_id":"17kBDaMfW0o3kY1Fto8ur1H6CfOkI4ePl","timestamp":1700038079438}],"authorship_tag":"ABX9TyMlcpQhcEFUBEkAGdvBACXS"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"code","execution_count":null,"metadata":{"id":"EZRZT21oFYC8"},"outputs":[],"source":["def calculate(int_list, str_list):\n"," for operator in prioritize_operations(str_list):\n"," index = str_list.index(operator)\n"," if operator in {'+', '-', '*', '/'}:\n"," a = int_list[index]\n"," b = int_list[index + 1]\n"," if operator == '+':\n"," result = a + b\n"," elif operator == '-':\n"," result = a - b\n"," elif operator == '*':\n"," result = a * b\n"," elif operator == '/':\n"," result = a / b\n"," int_list[index] = result\n"," str_list.pop(index)\n"," int_list.pop(index + 1)\n","\n"," return int_list[0]\n","\n","result = calculate_values([9, 4, 9], ['+', '*'])\n","print(\"Result:\", result)"]}]} \ No newline at end of file From 2a13a97f97ceb20799a27dea0aaf3c142ac7de5a Mon Sep 17 00:00:00 2001 From: nbdsd <150229890+nbdsd@users.noreply.github.com> Date: Wed, 15 Nov 2023 18:06:38 +0900 Subject: [PATCH 3/3] =?UTF-8?q?Create=20=EA=B3=84=EC=82=B0=EA=B8=B0.ipynb.?= =?UTF-8?q?txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...263\204\354\202\260\352\270\260.ipynb.txt" | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 "\352\263\204\354\202\260\352\270\260.ipynb.txt" diff --git "a/\352\263\204\354\202\260\352\270\260.ipynb.txt" "b/\352\263\204\354\202\260\352\270\260.ipynb.txt" new file mode 100644 index 0000000..329868d --- /dev/null +++ "b/\352\263\204\354\202\260\352\270\260.ipynb.txt" @@ -0,0 +1,22 @@ +def calculate(int_list, str_list): + for operator in prioritize_operations(str_list): + index = str_list.index(operator) + if operator in {'+', '-', '*', '/'}: + a = int_list[index] + b = int_list[index + 1] + if operator == '+': + result = a + b + elif operator == '-': + result = a - b + elif operator == '*': + result = a * b + elif operator == '/': + result = a / b + int_list[index] = result + str_list.pop(index) + int_list.pop(index + 1) + + return int_list[0] + +result = calculate_values([9, 4, 9], ['+', '*']) +print("Result:", result) \ No newline at end of file