Skip to content
Snippets Groups Projects
Commit 12dde6f1 authored by Edmond Anderson's avatar Edmond Anderson
Browse files
parents 1ee79d15 1ff20b4b
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
%% 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>.
This diff is collapsed.
%% Cell type:markdown id:950c4fef tags:
# Whitespace Sensitivity
%% Cell type:markdown id:019e60ef tags:
Short Title: Indentation
%% Cell type:markdown id:c61cba51 tags:
# Description
%% Cell type:markdown id:55abe61f tags:
Whitespaces or indedentation act as the spaces at the very start or inside of a code for enhanced readibility in Python. It is used to designate a block of code inside of a program. Any code without indentation or white space is attached to a specific source file. Whitespaces tend to be sensitive due to their ability to completely effect the possibilities of an output of a code or interpretation of a statement ultimately causing an error to pop up.
It is important to understand, whitespace must always be consistant throughout code. So if a programmer starts with 5 spaces, 5 space must be used throughout the remainder of the block of code or else a syntax error will not allow the code to be ran.
%% Cell type:markdown id:f8796bb7 tags:
# Examples
%% Cell type:markdown id:410f3f67 tags:
'' - space
/t - tab
%% Cell type:markdown id:880c1d84 tags:
# Learning Materials
%% Cell type:code id:dfad44a7 tags:
``` python
from IPython.display import YouTubeVideo
YouTubeVideo("vgefSv5k-o4",width=640,height=360, cc_load_policy=True)
```
%% Output
<IPython.lib.display.YouTubeVideo at 0x7ff3796ec7c0>
%% Cell type:markdown id:50fdb729 tags:
10 minutes
%% Cell type:markdown id:4ae1c549 tags:
# Self-Assessment
%% Cell type:markdown id:a2e5459e tags:
Create a code that tests whitespace values.
%% Cell type:code id:80ee2cd9 tags:
``` python
#Put your answer here
# import string
import string
# An input string.
Sentence = "What time does lunch begin at Shaw?"
for i in Sentence:
# determines if whitespace is found in code
if i in string.whitespace:
# Prints the number of whitespace values and its characters
print("printable Value is: " + i)
```
%% Output
printable Value is:
printable Value is:
printable Value is:
printable Value is:
printable Value is:
printable Value is:
%% Cell type:code id:351205d1 tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment