forked from UofT-DSI/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Assignment 2 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Assignment 2 #2
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
89ec25a
Data Type Homework
ranvikhalar 75188fc
Assignment_1 Submission
ranvikhalar 32c2b6b
Assignment_1 Submission
ranvikhalar 330944c
Assignment_1 Submission
ranvikhalar 1fc164d
Assignment_1 Submission
ranvikhalar bbb3461
Assignment_1 Submission
ranvikhalar 8e17c59
Assignment_1 Submission
ranvikhalar b065987
Assignment_1 Submission
ranvikhalar b58150e
Assignment_1 Submission
ranvikhalar aa44ca2
Assignment-2 Completed
ranvikhalar 1ba81c9
Assignment-2 Completed
ranvikhalar c0f116d
Assignment-2 Completed
ranvikhalar 1b1fc01
Assignment-2 Completed
ranvikhalar 4afa8fb
Assignment-2 Completed
ranvikhalar f1c3e63
Assignment-2 Completed
ranvikhalar 4c29e5d
Assignment-2
ranvikhalar f329736
Updated Assignment-2
ranvikhalar 9c68ed8
Original Assignment_1
ranvikhalar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,240 @@ | ||
| {"cells":[{"cell_type":"markdown","metadata":{"id":"jNAI57ELh-I8"},"source":["# Getting Started: Python Fundamentals\n","## Practice Problems"]},{"cell_type":"markdown","metadata":{"id":"5xeRB_0jiT5n"},"source":["### 1. What types are involved in the following expressions? What data type will each expression evaluate to?\n","\n","`8 * 2.5`"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":158,"status":"ok","timestamp":1667929890889,"user":{"displayName":"Kaylie Lau","userId":"01284785813595846851"},"user_tz":300},"id":"C6c48sSBOUeE","outputId":"3628ffce-faf6-4d23-daff-5e09edf76541"},"outputs":[],"source":["# Your code here"]},{"cell_type":"markdown","metadata":{"id":"4eICUfHi_Z-K"},"source":["`9 / 2`"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":43,"status":"ok","timestamp":1667929891449,"user":{"displayName":"Kaylie Lau","userId":"01284785813595846851"},"user_tz":300},"id":"QVdbNoA2OiQ_","outputId":"ab9f4fac-b1cc-4afc-cc54-10592b92abb1"},"outputs":[],"source":["# Your code here"]},{"cell_type":"markdown","metadata":{"id":"DhrJoWbj_cNe"},"source":["`9 // -2`"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":39,"status":"ok","timestamp":1667929891450,"user":{"displayName":"Kaylie Lau","userId":"01284785813595846851"},"user_tz":300},"id":"cSsGq3r0Opx6","outputId":"13df11ef-d136-4a42-884e-be1e369aae52"},"outputs":[],"source":["# Your code here"]},{"cell_type":"markdown","metadata":{"id":"lW4UnVfw_eYy"},"source":["`1.5 * 2 >= 7 - 3`"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":34,"status":"ok","timestamp":1667929891452,"user":{"displayName":"Kaylie Lau","userId":"01284785813595846851"},"user_tz":300},"id":"54N6gcNPOylS","outputId":"938208fc-c4c3-4e58-dd18-b50d3acc84d8"},"outputs":[],"source":["# Your code here"]},{"cell_type":"markdown","metadata":{"id":"5T-ytiTw-KvJ"},"source":["### 2. In which order will the expressions be evaluated.\n","\n","`6 * 3 + 7 * 4`\n","\n","\n","<details>\n"," <summary>Answer</summary>\n","\n"," `*` > `*` > `+` \n","</details>\n","\n","\n","`5 - 2 * 3 ** 4`\n","\n","<details>\n"," <summary>Answer</summary>\n","\n"," `**` > `*` > `-`\n","</details>\n","\n","`(5 - 2) * 3 ** 4`\n","\n","<details>\n"," <summary>Answer</summary>\n","\n"," `(-)` > `**` > `*` \n","</details>\n","\n","`5 + 2 >= 3 * 4`\n","\n","<details>\n"," <summary>Answer</summary>\n","\n"," `*` > `+` > `>=`\n","</details>"]}],"metadata":{"colab":{"authorship_tag":"ABX9TyMhUBNX+UP2C+YDtVSxQKBK","collapsed_sections":[],"provenance":[]},"kernelspec":{"display_name":"Python 3","name":"python3"},"language_info":{"name":"python"}},"nbformat":4,"nbformat_minor":0} | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": { | ||
| "id": "jNAI57ELh-I8" | ||
| }, | ||
| "source": [ | ||
| "# Getting Started: Python Fundamentals\n", | ||
| "## Practice Problems" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": { | ||
| "id": "5xeRB_0jiT5n" | ||
| }, | ||
| "source": [ | ||
| "### 1. What types are involved in the following expressions? What data type will each expression evaluate to?\n", | ||
| "\n", | ||
| "`8 * 2.5`" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": { | ||
| "colab": { | ||
| "base_uri": "https://localhost:8080/" | ||
| }, | ||
| "executionInfo": { | ||
| "elapsed": 158, | ||
| "status": "ok", | ||
| "timestamp": 1667929890889, | ||
| "user": { | ||
| "displayName": "Kaylie Lau", | ||
| "userId": "01284785813595846851" | ||
| }, | ||
| "user_tz": 300 | ||
| }, | ||
| "id": "C6c48sSBOUeE", | ||
| "outputId": "3628ffce-faf6-4d23-daff-5e09edf76541" | ||
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "# 8 is an integer\n", | ||
| "# 2.5 is float\n", | ||
| "# float\n", | ||
| "# 20.0" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": { | ||
| "id": "4eICUfHi_Z-K" | ||
| }, | ||
| "source": [ | ||
| "`9 / 2`" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": { | ||
| "colab": { | ||
| "base_uri": "https://localhost:8080/" | ||
| }, | ||
| "executionInfo": { | ||
| "elapsed": 43, | ||
| "status": "ok", | ||
| "timestamp": 1667929891449, | ||
| "user": { | ||
| "displayName": "Kaylie Lau", | ||
| "userId": "01284785813595846851" | ||
| }, | ||
| "user_tz": 300 | ||
| }, | ||
| "id": "QVdbNoA2OiQ_", | ||
| "outputId": "ab9f4fac-b1cc-4afc-cc54-10592b92abb1" | ||
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "# 9 is an integer\n", | ||
| "# 2 is an integer\n", | ||
| "# / is the division and gives results as float data type\n", | ||
| "# 4.5" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": { | ||
| "id": "DhrJoWbj_cNe" | ||
| }, | ||
| "source": [ | ||
| "`9 // -2`" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": { | ||
| "colab": { | ||
| "base_uri": "https://localhost:8080/" | ||
| }, | ||
| "executionInfo": { | ||
| "elapsed": 39, | ||
| "status": "ok", | ||
| "timestamp": 1667929891450, | ||
| "user": { | ||
| "displayName": "Kaylie Lau", | ||
| "userId": "01284785813595846851" | ||
| }, | ||
| "user_tz": 300 | ||
| }, | ||
| "id": "cSsGq3r0Opx6", | ||
| "outputId": "13df11ef-d136-4a42-884e-be1e369aae52" | ||
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "# 9 is an integer\n", | ||
| "# // is the floor division\n", | ||
| "# -2 is an integer\n", | ||
| "# the result will be an integer rounded down\n", | ||
| "# -5" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": { | ||
| "id": "lW4UnVfw_eYy" | ||
| }, | ||
| "source": [ | ||
| "`1.5 * 2 >= 7 - 3`" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": { | ||
| "colab": { | ||
| "base_uri": "https://localhost:8080/" | ||
| }, | ||
| "executionInfo": { | ||
| "elapsed": 34, | ||
| "status": "ok", | ||
| "timestamp": 1667929891452, | ||
| "user": { | ||
| "displayName": "Kaylie Lau", | ||
| "userId": "01284785813595846851" | ||
| }, | ||
| "user_tz": 300 | ||
| }, | ||
| "id": "54N6gcNPOylS", | ||
| "outputId": "938208fc-c4c3-4e58-dd18-b50d3acc84d8" | ||
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "# 1.5 is float\n", | ||
| "# * is multiplication\n", | ||
| "# 2, 7, 3 are integers\n", | ||
| "# >= is greater than equal to\n", | ||
| "# - substraction\n", | ||
| "# result will be Boolean (FALSE)" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": { | ||
| "id": "5T-ytiTw-KvJ" | ||
| }, | ||
| "source": [ | ||
| "### 2. In which order will the expressions be evaluated.\n", | ||
| "\n", | ||
| "`6 * 3 + 7 * 4`\n", | ||
| "\n", | ||
| "\n", | ||
| "<details>\n", | ||
| " <summary>Answer</summary>\n", | ||
| "\n", | ||
| " `*` > `*` > `+` \n", | ||
| "</details>\n", | ||
| "\n", | ||
| "\n", | ||
| "`5 - 2 * 3 ** 4`\n", | ||
| "\n", | ||
| "<details>\n", | ||
| " <summary>Answer</summary>\n", | ||
| "\n", | ||
| " `**` > `*` > `-`\n", | ||
| "</details>\n", | ||
| "\n", | ||
| "`(5 - 2) * 3 ** 4`\n", | ||
| "\n", | ||
| "<details>\n", | ||
| " <summary>Answer</summary>\n", | ||
| "\n", | ||
| " `(-)` > `**` > `*` \n", | ||
| "</details>\n", | ||
| "\n", | ||
| "`5 + 2 >= 3 * 4`\n", | ||
| "\n", | ||
| "<details>\n", | ||
| " <summary>Answer</summary>\n", | ||
| "\n", | ||
| " `*` > `+` > `>=`\n", | ||
| "</details>" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "# 6 * 3, 7 * 4, 18 + 28 \n", | ||
| "# = 46\n", | ||
| "# 3 ** 4 (81), 2 * 81 (162), 5 - 162 \n", | ||
| "# = -157\n", | ||
| "# (5-2), 3 ** 4, 3 * 81 \n", | ||
| "# = 243\n", | ||
| "# 3 * 4, 5 + 2 \n", | ||
| "# FALSE" | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "colab": { | ||
| "authorship_tag": "ABX9TyMhUBNX+UP2C+YDtVSxQKBK", | ||
| "collapsed_sections": [], | ||
| "provenance": [] | ||
| }, | ||
| "kernelspec": { | ||
| "display_name": "Python 3", | ||
| "name": "python3" | ||
| }, | ||
| "language_info": { | ||
| "name": "python" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 0 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| 0,0,1 | ||
| 0,1,2 | ||
| 0,0,0 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assignment_1.ipynb file changes should not be in assignment-2 branch.