-
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
1 changed file
with
282 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,282 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "view-in-github", | ||
"colab_type": "text" | ||
}, | ||
"source": [ | ||
"<a href=\"https://colab.research.google.com/github/zmuhls/ccny-data-science/blob/main/activity_1.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "e06e8c55-6300-414a-b248-e610342edc6e", | ||
"metadata": { | ||
"id": "e06e8c55-6300-414a-b248-e610342edc6e" | ||
}, | ||
"source": [ | ||
"# Activity 1" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "8f0211dc-fa5f-4237-93a7-75a3cf040895", | ||
"metadata": { | ||
"id": "8f0211dc-fa5f-4237-93a7-75a3cf040895" | ||
}, | ||
"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. In turn, make sure that you **print your output** for every response in the activity.\n", | ||
"\n", | ||
"-----\n", | ||
"## Submission Instructions\n", | ||
"1. Upload the completed activity to the \"Activities\" and \"Reflections\" folders of your GitHub portfolio;\n", | ||
"2. Ensure your submission consists of two files: (a) one reflection in markdown uploaded to \"Reflections\" (e.g. `a1_reflection.md`); and (b) one Jupyter notebook with completed responses for each step of the activity (e.g. `a1_building_blocks.ipynb`)." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "d00e1320-3c81-497c-9ab8-c09fe0a21e26", | ||
"metadata": { | ||
"id": "d00e1320-3c81-497c-9ab8-c09fe0a21e26" | ||
}, | ||
"source": [ | ||
"## Please respond with your code in the cells." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "eda0bdc8-c7d3-4c61-abaf-1fbae7a35034", | ||
"metadata": { | ||
"id": "eda0bdc8-c7d3-4c61-abaf-1fbae7a35034" | ||
}, | ||
"source": [ | ||
"1. Create a variable for your first name called ```first```." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5150dcfe-7018-4c89-bb50-4c432379924d", | ||
"metadata": { | ||
"id": "5150dcfe-7018-4c89-bb50-4c432379924d" | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "c61ee004-5faf-4710-8ae6-4a752b2ad673", | ||
"metadata": { | ||
"id": "c61ee004-5faf-4710-8ae6-4a752b2ad673" | ||
}, | ||
"source": [ | ||
"2. Create a variable for your last name called ```last```." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "9143791d-5460-41c0-9e80-3bc59318b2ec", | ||
"metadata": { | ||
"id": "9143791d-5460-41c0-9e80-3bc59318b2ec" | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "1a81a966-5a53-471e-a479-78085f26ad85", | ||
"metadata": { | ||
"id": "1a81a966-5a53-471e-a479-78085f26ad85" | ||
}, | ||
"source": [ | ||
"3. Create a variable for your age called ```age```." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "d50476c7-f82c-4f8e-a20d-18f6e36de9b2", | ||
"metadata": { | ||
"id": "d50476c7-f82c-4f8e-a20d-18f6e36de9b2" | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "8b92dcfb-7784-41bc-b58d-0678d0a85258", | ||
"metadata": { | ||
"id": "8b92dcfb-7784-41bc-b58d-0678d0a85258" | ||
}, | ||
"source": [ | ||
"4. Using the variables you have created, create a new variable ```name``` by joining your first and last names together." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "d21cd5ed-26aa-4ab4-a6e7-02f992bd0119", | ||
"metadata": { | ||
"id": "d21cd5ed-26aa-4ab4-a6e7-02f992bd0119" | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "cf57471f-11a9-41d9-8342-a0b5ff28b8b0", | ||
"metadata": { | ||
"id": "cf57471f-11a9-41d9-8342-a0b5ff28b8b0" | ||
}, | ||
"source": [ | ||
"5. Use string methods to convert the variable ```activity1 = \" THIS IS MY FIRST PYTHON ACTIVITY!! \"``` to lowercase and remove any leading or trailing white space, then print the output as a new variable: ```activity1_lower```." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "19cf1155-0517-465f-aa6e-2b3bf0406d64", | ||
"metadata": { | ||
"id": "19cf1155-0517-465f-aa6e-2b3bf0406d64" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"activity1 = \" WOOHOO! THIS IS MY FIRST PYTHON ACTIVITY!! \"\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "927c8101-95a3-4d1d-b6d9-d390b94b2ad9", | ||
"metadata": { | ||
"id": "927c8101-95a3-4d1d-b6d9-d390b94b2ad9" | ||
}, | ||
"source": [ | ||
"6. What data type is the variable ```age```? Declare the value and print the data type." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "02a0e871-653a-433d-bf31-8430c6c55a49", | ||
"metadata": { | ||
"id": "02a0e871-653a-433d-bf31-8430c6c55a49" | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "006b4e55-9d77-4007-86a5-e03408b737f1", | ||
"metadata": { | ||
"id": "006b4e55-9d77-4007-86a5-e03408b737f1" | ||
}, | ||
"source": [ | ||
"7. What happens when you add ```10``` to your ```name```? Please demonstrate it in the cell below and add an inline comment that provides a brief explanation of the result. " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "547478df-4528-4697-a480-80b383d6aa29", | ||
"metadata": { | ||
"id": "547478df-4528-4697-a480-80b383d6aa29" | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"8. Declare a variable that asks for user input, then print the variable storing their response as the output" | ||
], | ||
"metadata": { | ||
"id": "VOnDoeLieoBW" | ||
}, | ||
"id": "VOnDoeLieoBW" | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": [], | ||
"metadata": { | ||
"id": "FVPp8yrZfueN" | ||
}, | ||
"id": "FVPp8yrZfueN", | ||
"execution_count": null, | ||
"outputs": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "20bd577c-9c9c-4084-90c0-d1dc38f59da5", | ||
"metadata": { | ||
"id": "20bd577c-9c9c-4084-90c0-d1dc38f59da5" | ||
}, | ||
"source": [ | ||
"-------" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "0f5f0cca-38e0-4ffd-8adf-e65469913076", | ||
"metadata": { | ||
"id": "0f5f0cca-38e0-4ffd-8adf-e65469913076" | ||
}, | ||
"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": { | ||
"id": "6837c438-eeba-498d-9cc5-08aadf1420dc" | ||
}, | ||
"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": { | ||
"id": "5e88c0c0-288b-4f3b-82ff-8c8582855b1d" | ||
}, | ||
"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" | ||
}, | ||
"colab": { | ||
"provenance": [], | ||
"include_colab_link": true | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |