-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
4,241 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,247 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "e06e8c55-6300-414a-b248-e610342edc6e", | ||
"metadata": {}, | ||
"source": [ | ||
"# Activity 1" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "8f0211dc-fa5f-4237-93a7-75a3cf040895", | ||
"metadata": {}, | ||
"source": [ | ||
"For this activity, we will be familiarizing ourselves with creating python variables and data types. \n", | ||
"\n", | ||
"Please make sure you open this file in Jupyter Notebook or Google Colab -- you will have to either open Jupyter Notebook first or upload the file to Google Colab before being able to edit the file. \n", | ||
"\n", | ||
"Please make sure you **print your output.** You may need to use ```print``` for your output to be displayed.\n", | ||
"\n", | ||
"-----\n", | ||
"## Submission Instructions\n", | ||
"1. Upload the completed activity to the \"Activities\" folder of your GitHub Portfolio;\n", | ||
"2. Ensure your submission consists of two files: <br/>(a) one single-page reflection in markdown (e.g. `a1_reflection.md`); <br/>(b) one Jupyter notebook with completed responses to each activity step (e.g. `a1_building_blocks.ipynb`). " | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "d00e1320-3c81-497c-9ab8-c09fe0a21e26", | ||
"metadata": {}, | ||
"source": [ | ||
"## Please respond with your code in the cells." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "eda0bdc8-c7d3-4c61-abaf-1fbae7a35034", | ||
"metadata": {}, | ||
"source": [ | ||
"1. Create a variable for your first name called ```first```." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5150dcfe-7018-4c89-bb50-4c432379924d", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "c61ee004-5faf-4710-8ae6-4a752b2ad673", | ||
"metadata": {}, | ||
"source": [ | ||
"2. Create a variable for your last name called ```last```." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "9143791d-5460-41c0-9e80-3bc59318b2ec", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "1a81a966-5a53-471e-a479-78085f26ad85", | ||
"metadata": {}, | ||
"source": [ | ||
"3. Create a variable for your age called ```age```." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "d50476c7-f82c-4f8e-a20d-18f6e36de9b2", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "8b92dcfb-7784-41bc-b58d-0678d0a85258", | ||
"metadata": {}, | ||
"source": [ | ||
"4. Using the variables you have created, create a new variable ```name``` by joining your first and last names together.\n", | ||
"\n", | ||
" (Hint: To join strings, you will have to use string **concatenation**." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "d21cd5ed-26aa-4ab4-a6e7-02f992bd0119", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "cf57471f-11a9-41d9-8342-a0b5ff28b8b0", | ||
"metadata": {}, | ||
"source": [ | ||
"5. Convert the variable ```activity1 = \"WOOHOO! THIS IS MY FIRST PYTHON ACTIVITY!!\"``` to all lowercase (no capital letters) with a string method. \n", | ||
" Save this output as a new variable ```activtiy1_lower```.\n", | ||
"\n", | ||
"\n", | ||
" (Hint: To get all uppercase, the string methods is ```.upper()```." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"id": "19cf1155-0517-465f-aa6e-2b3bf0406d64", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"activity1 = \"WOOHOO! THIS IS MY FIRST PYTHON ACTIVITY!!\"\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "927c8101-95a3-4d1d-b6d9-d390b94b2ad9", | ||
"metadata": {}, | ||
"source": [ | ||
"6. What data type is the variable ```age```? Check the data type." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "02a0e871-653a-433d-bf31-8430c6c55a49", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "006b4e55-9d77-4007-86a5-e03408b737f1", | ||
"metadata": {}, | ||
"source": [ | ||
"7. What happens when you add ```10``` to your ```name```? Please demonstrate it in the cell below and provide a brief explanation for the result. " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "547478df-4528-4697-a480-80b383d6aa29", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "68e0be42-6b1c-4133-ae1f-eac4e08de48d", | ||
"metadata": {}, | ||
"source": [ | ||
"8. Explain the error below in your own words. " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"id": "db45122f-4ff2-4e3a-a360-39747ebfba26", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"ename": "SyntaxError", | ||
"evalue": "unterminated string literal (detected at line 1) (203369067.py, line 1)", | ||
"output_type": "error", | ||
"traceback": [ | ||
"\u001b[0;36m Cell \u001b[0;32mIn[8], line 1\u001b[0;36m\u001b[0m\n\u001b[0;31m print(\"Hope this goes off without a hitch!)\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m unterminated string literal (detected at line 1)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print(\"Hope this goes off without a hitch!)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "d2b9ec67-9689-4220-b8ad-7de01fb6ca33", | ||
"metadata": {}, | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "20bd577c-9c9c-4084-90c0-d1dc38f59da5", | ||
"metadata": {}, | ||
"source": [ | ||
"-------" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "0f5f0cca-38e0-4ffd-8adf-e65469913076", | ||
"metadata": {}, | ||
"source": [ | ||
"## Side quest challenge\n", | ||
"\n", | ||
"This side quest is an extra credit challenge. You can still get full credit for this activity even if you do not complete this challenge." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "6837c438-eeba-498d-9cc5-08aadf1420dc", | ||
"metadata": {}, | ||
"source": [ | ||
"Use ***f-string formatting*** to display your ```name``` and ```age``` in a sentence. \n", | ||
"\n", | ||
"Check out Kyle Bradbury and Nick Eubank's [introduction to f-strings](https://nickeubank.github.io/practicaldatascience_book/notebooks/other/fstrings.html)." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5e88c0c0-288b-4f3b-82ff-8c8582855b1d", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.5" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.