Skip to content
Snippets Groups Projects

Adding Pointers

Merged batista6 requested to merge JVBranch into main
1 file
+ 113
0
Compare changes
  • Side-by-side
  • Inline
References.ipynb 0 → 100644
+ 113
0
%% Cell type:code id:fc73d74c tags:
``` python
##ANSWER##
#Install answercheck in current director
from urllib.request import urlretrieve
urlretrieve('https://raw.githubusercontent.com/colbrydi/jupytercheck/master/answercheck.py', filename='answercheck.py')
##ANSWER##
```
%% Output
('answercheck.py', <http.client.HTTPMessage at 0x7fc9a8612220>)
%% Cell type:markdown id:3c2a4f39 tags:
# References
Understanding References and their purpose
%% Cell type:markdown id:2b78245b tags:
Understanding the Reference:
![Captain America Meme - Image found in Google Images from Know Your Meme](https://i.kym-cdn.com/entries/icons/mobile/000/017/204/CaptainAmerica1_zps8c295f96.jpg)
%% Cell type:markdown id:71e867d9 tags:
## Description
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.
%% Cell type:markdown id:89c2fa92 tags:
## Learning Goals
%% Cell type:markdown id:58ec20e8 tags:
## Self Assessment
Questions that test for the learning goals and allows students to evaluate if they truly understand the topics.
%% Cell type:markdown id:0234bfdc tags:
&#9989; **<span style="color:red">Question:</span>** Based on the code below what will be the output of the variable meal:
string food = "Pizza";
string &meal = food;
cout << meal;
1. "Pizza"
2. "food"
3. nothing
4. error
%% Cell type:markdown id:d030f312 tags:
&#9989; **<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:
#include <iostream>
int main(){
double GPA = 3.14;
std::cout << "My GPA is: " << GPA;
}
%% Cell type:code id:daaf2d04 tags:
``` python
#Put your answer here
```
%% Cell type:markdown id:5d237ca9 tags:
## Training Materials
%% Cell type:markdown id:21f9b14e tags:
Reference Variable In C++ in 6 minutes (https://youtu.be/NGKt3Xwlobg)
References Materials (https://www.w3schools.com/cpp/cpp_references.asp)
References Material (https://www.tutorialspoint.com/cplusplus/cpp_references.htm)
%% Cell type:code id:9cc2b34a tags:
``` python
from answercheck import checkanswer
checkanswer.vector(x,'2cab95d1b144d663bad1ce5c51020ae0')
```
%% Output
CheckWarning: passed variable is <class 'int'> and not a numpy.matrix.
Trying to convert to a array matrix using ```A = np.matrix(A)```.
CheckWarning: passed matrix is int64 and not <class 'numpy.float64'>...
Trying to convert to float using ```A = A.astype(float)```.
Testing [[4.]]
Answer seems to be correct
%% Cell type:markdown id:44b461a0 tags:
---
Written by <<YOUR NAME HERE>>, Michigan State University
As part of the Data Science Bridge Project
<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>.
Loading