diff --git a/References.ipynb b/References.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..5bb8e7ef7bbd4be05039cbc2e75d0a167239c8de --- /dev/null +++ b/References.ipynb @@ -0,0 +1,202 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 32, + "id": "fc73d74c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "('answercheck.py', <http.client.HTTPMessage at 0x7fc9a8612220>)" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "##ANSWER##\n", + "#Install answercheck in current director\n", + "from urllib.request import urlretrieve\n", + "urlretrieve('https://raw.githubusercontent.com/colbrydi/jupytercheck/master/answercheck.py', filename='answercheck.py')\n", + "##ANSWER##" + ] + }, + { + "cell_type": "markdown", + "id": "3c2a4f39", + "metadata": {}, + "source": [ + "# References\n", + "Understanding References and their purpose " + ] + }, + { + "cell_type": "markdown", + "id": "2b78245b", + "metadata": {}, + "source": [ + "Understanding the Reference: \n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "id": "71e867d9", + "metadata": {}, + "source": [ + "## Description\n", + "A reference variable is an alias, that is, another name for an already existing variable. Think of a variable name as a label attached to the variable's location in memory. You can then think of a reference as a second label attached to that memory location. Therefore, you can access the contents of the variable through either the original variable name or the reference.\n" + ] + }, + { + "cell_type": "markdown", + "id": "89c2fa92", + "metadata": {}, + "source": [ + "## Learning Goals" + ] + }, + { + "cell_type": "markdown", + "id": "58ec20e8", + "metadata": {}, + "source": [ + "## Self Assessment\n", + "\n", + "Questions that test for the learning goals and allows students to evaluate if they truly understand the topics." + ] + }, + { + "cell_type": "markdown", + "id": "0234bfdc", + "metadata": {}, + "source": [ + "✅ **<span style=\"color:red\">Question:</span>** Based on the code below what will be the output of the variable meal:\n", + "\n", + " string food = \"Pizza\";\n", + " string &meal = food; \n", + "\n", + " cout << meal;\n", + "\n", + "1. \"Pizza\"\n", + "2. \"food\"\n", + "3. nothing\n", + "4. error" + ] + }, + { + "cell_type": "markdown", + "id": "d030f312", + "metadata": {}, + "source": [ + "✅ **<span style=\"color:red\">Question:</span>** Based on the code below, what should be done to change the value of the variable GPA without changing the variable directly:\n", + "\n", + " #include <iostream>\n", + " int main(){\n", + " double GPA = 3.14;\n", + " std::cout << \"My GPA is: \" << GPA;\n", + " }\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "daaf2d04", + "metadata": {}, + "outputs": [], + "source": [ + "#Put your answer here" + ] + }, + { + "cell_type": "markdown", + "id": "5d237ca9", + "metadata": {}, + "source": [ + "## Training Materials\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "id": "21f9b14e", + "metadata": {}, + "source": [ + "Reference Variable In C++ in 6 minutes (https://youtu.be/NGKt3Xwlobg)\n", + "\n", + "References Materials (https://www.w3schools.com/cpp/cpp_references.asp)\n", + "\n", + "References Material (https://www.tutorialspoint.com/cplusplus/cpp_references.htm)" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "9cc2b34a", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "CheckWarning: passed variable is <class 'int'> and not a numpy.matrix.\n", + " Trying to convert to a array matrix using ```A = np.matrix(A)```.\n", + "\n", + "\n", + "CheckWarning: passed matrix is int64 and not <class 'numpy.float64'>...\n", + " Trying to convert to float using ```A = A.astype(float)```.\n", + "\n", + "Testing [[4.]]\n", + "Answer seems to be correct\n", + "\n" + ] + } + ], + "source": [ + "from answercheck import checkanswer\n", + "checkanswer.vector(x,'2cab95d1b144d663bad1ce5c51020ae0')" + ] + }, + { + "cell_type": "markdown", + "id": "44b461a0", + "metadata": {}, + "source": [ + "---\n", + "\n", + "Written by <<YOUR NAME HERE>>, Michigan State University \n", + "As part of the Data Science Bridge Project \n", + " \n", + "<a rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc/4.0/\"><img alt=\"Creative Commons License\" style=\"border-width:0\" src=\"https://i.creativecommons.org/l/by-nc/4.0/88x31.png\" /></a><br />This work is licensed under a <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc/4.0/\">Creative Commons Attribution-NonCommercial 4.0 International License</a>." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.8.8" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}