Author Archives: Dr. Darrin

Principal Component Analysis in Python

Principal component analysis is a form of dimension reduction commonly used in statistics. By dimension reduction, it is meant to reduce the number of variables without losing too much overall information. This has the practical application of speeding up computational times if you want to run other forms of analysis such as regression but with fewer variables.

Another application of principal component analysis is for data visualization. Sometimes, you may want to reduce many variables to two in order to see subgroups in the data.

Keep in mind that in either situation PCA works better when there are high correlations among the variables. The explanation is complex but has to do with the rotation of the data which helps to separate the overlapping variance.

Prepare the Data

We will be using the pneumon dataset from the pydataset module. We want to try and explain the variance with fewer variables than in the dataset. Below is some initial code.

import pandas as pd
from sklearn.decomposition import PCA
from pydataset import data
from sklearn.preprocessing import StandardScaler
import matplotlib.pyplot as plt

Next, we will set up our dataframe. We will only take the first 200 examples from the dataset. If we take all (over 3000 examples), the visualization will be a giant blob of dotes that cannot be interpreted. We will also drop in missing values. Below is the code

df = data('pneumon')

When doing a PCA, it is important to scale the data because PCA is sensitive to this. The result of the scaling process is an array. This is a problem because the PCA function needs a dataframe. This means we have to convert the array to a dataframe. When this happens you also have to rename the columns in the new dataframe. All this is done in the code below.

scaler = StandardScaler() #instance
df_scaled = scaler.fit_transform(df) #scaled the data
df_scaled= pd.DataFrame(df_scaled) #made the dataframe
df_scaled=df_scaled.rename(index=str, columns={0: "chldage", 1: "hospital",2:"mthage",3:"urban",4:"alcohol",5:"smoke",6:"region",7:"poverty",8:"bweight",9:"race",10:"education",11:"nsibs",12:"wmonth",13:"sfmonth",14:"agepn"}) # renamed columns


We are now ready to do our analysis. We first use the PCA function to indicate how many components we want. For our first example, we will have two components. Next, you use the .fit_transform function to fit the model. Below is the code.


Now we can see the variance explained by component and the sum

Out[199]: array([0.18201588, 0.12022734])

Out[200]: 0.30224321247148167

In the first line of code, we can see that the first component explained 18% of the variance and the second explained 12%. This leads to a total of about 30%. Below is a visual of our 2 component model the color represents the race of the respondent. The three different colors represent three different races.


Our two components do a reasonable separating the data. Below is the code for making four components. We can not graph four components since our graph can only handle two but you will see that as we increase the components we also increase the variance explained.



Out[209]: array([0.18201588, 0.12022734, 0.09290502, 0.08945079])

Out[210]: 0.4845990164486457

With four components we now have almost 50% of the variance explained.


PCA is for summarising and reducing the number of variables used in an analysis or for the purposes of data visualization. Once this process is complete you can use the results to do further analysis if you desire.


Data Exploration with Python

In this post, we will explore a dataset using Python. The dataset we will use is the Ghouls, Goblins, and Ghost (GGG) dataset available at the kaggle website. The analysis will not be anything complex we will simply do the following.

  • Data preparation
  • Data  visualization
  • Descriptive statistics
  • Regression analysis

Data Preparation

The GGG dataset is fictitious data on the characteristics of spirits. Below are the modules we will use for our analysis.

import pandas as pd
import statsmodels.regression.linear_model as sm
import numpy as np

Once you download the dataset to your computer you need to load it into Python using the function. Below is the code.

df=pd.read_csv('FILE LOCATION HERE')

We store the data as “df” in the example above. Next, we will take a peek at the first few rows of data to see what we are working with.


Using the print function and accessing the first five rows reveals. It appears the first five columns are continuous data and the last two columns are categorical. The ‘id’ variable is useless for our purposes so we will remove it with the code below.


The code above uses the drop function to remove the variable ‘id’. This is all saved into the object ‘df’. In other words, we wrote over are original ‘df’.

Data Visualization

We will start with our categorical variables for the data visualization. Below is a table and a graph of the ‘color’ and ‘type’ variables.

First, we make an object called ‘spirits’ using the groupby function to organize the table by the ‘type’ variable.


Below we make a graph of the data above using the .plot function. A professional wouldn’t make this plot but we are just practicing how to code.


We now know how many ghosts, goblins and, ghouls there are in the dataset. We will now do a breakdown of ‘type’ by ‘color’ using the .crosstab function from pandas.


We will now make bar graphs of both of the categorical variables using the .plot function.


We will now turn our attention to the continuous variables. We will simply make histograms and calculate the correlation between them. First the histograms

The code is simply subset the variable you want in the brackets and then type .plot.hist() to access the histogram function. It appears that all of our data is normally distributed. Now for the correlation


Using the .corr() function has shown that there are now high correlations among the continuous variables. We will now do an analysis in which we combine the continuous and categorical variables through making boxplots

The code is redundant. We use the .boxplot() function and tell python the column which is continuous and the ‘by’ which is the categorical variable.

Descriptive Stats

We are simply going to calcualte the mean and standard deviation of the continuous variables.

Out[65]: 0.43415996604821117

Out[66]: 0.13265391313941383

Out[67]: 0.5291143100058727

Out[68]: 0.16967268504935665

Out[69]: 0.47139203219259107

Out[70]: 0.17589180837106724

The mean is calcualted with the .mean(). Standard deviation is calculated using the .std() function from the numpy package.

Multiple Regression

Our final trick is we want to explain the variable “has_soul” using the other continuous variables that are available. Below is the code

X = df[["bone_length", "rotting_flesh","hair_length"]]

y = df["has_soul"]

model = sm.OLS(y, X).fit()

In the code above we crate to new list. X contains are independent variables and y contains the dependent variable. Then we create an object called model and use the  OLS() function. We place the y and X inside the parenthesis and we then use the .fit() function as well. Below is the summary of the analysis


There is obviously a lot of information in the output. The r-square is 0.91 which is surprisingly high given that there were not high correlations in the matrix. The coefficiencies for the three independent variables are listed and all are significant. The AIC and BIC are for model comparison and do not mean much in isolation. The JB stat indicates that are distribution is not normal. Durbin watson test indicates negative autocorrelation which is important in time-series analysis.


Data exploration can be an insightful experience. Using Python, we found mant different patterns and ways to describe the data.

Logistic Regression in Python

This post will provide an example of a logistic regression analysis in Python. Logistic regression is commonly used when the dependent variable is categorical. Our goal will be to predict the gender of an example based on the other variables in the model. Below are the steps we will take to achieve this.

  1. Data preparation
  2. Model development
  3. Model testing
  4. Model evaluation

Data Preparation

The dataset we will use is the ‘Survey of Labour and Income Dynamics’ (SLID) dataset available in the pydataset module in Python. This dataset contains basic data on labor and income along with some demographic information. The initial code that we need is below.

import pandas as pd
import statsmodels.api as sm
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn import metrics
from pydataset import data

The code above loads all the modules and other tools we will need in this example. We now can load our data. In addition to loading the data, we will also look at the count and the characteristics of the variables. Below is the code.


At the top of this code, we create the ‘df’ object which contains our data from the “SLID”. Next, we used the .count() function to determine if there was any missing data and to see what variables were available. It appears that we have five variables and a lot of missing data as each variable has different amounts of data. Lastly, we used the .head() function to see what each variable contained. It appears that wages, education, and age are continuous variables well sex and language are categorical. The categorical variables will need to be converted to dummy variables as well.

The next thing we need to do is drop all the rows that are missing data since it is hard to create a model when data is missing. Below is the code and the output for this process.


In the code above, we used the .dropna() function to remove missing data. Then we used the .count() function to see how many rows remained. You can see that all the variables have the same number of rows which is important for model analysis. We will now make our dummy variables for sex and language in the code below.


Here is what we did,

  1. We used the .get_dummies function from pandas first on the sex variable. All this was stored in a new object called “dummy”
  2. We then combined the dummy and df datasets using the .concat() function. The axis =1 argument is for combing by column.
  3. We repeat steps 1 and 2 for the language variable
  4. Lastly, we used the .head() function to see the results

With this, we are ready to move to model development.

Model Development

The first thing we need to do is put all of the independent variables in one dataframe and the dependent variable in its own dataframe. Below is the code for this


Notice that we did not use every variable that was available. For the language variables, we only used “French” and “Other”. This is because when you make dummy variables you only need k-1 dummies created. Since the language variable had three categories we only need two dummy variables. Therefore, we excluded “English” because when “French” and “Other” are coded 0 it means that “English” is the characteristic of the example.

In addition, we only took “male” as our dependent variable because if “male” is set to 0 it means that example is female. We now need to create our train and test dataset. The code is below.

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=0)

We created four datasets

  • train dataset with the independent variables
  • train dataset with the dependent variable
  • test dataset with the independent variables
  • test dataset with the independent variable

The split is 70/30 with 70% being used for the training and 30% being used for testing. This is the purpose of the “test_size” argument. we used the train_test_split function to do this. We can now run our model and get the results. Below is the code.


Here is what we did

  1. We used the .Logit() function from statsmodel to create the logistic model. Notice we used only the training data.
  2. We then use the .fit() function to get the results and stored this in the result object.
  3. Lastly, we printed the results in the ‘result’ object using the .summary()

There are some problems with the results. The Pseudo R-square is infinity which is usually. Also, you may have some error output about hessian inversion in your output. For these reasons, we cannot trust the results but will continue for the sake of learning.

The coefficients are clear.  Only wage, education, and age are significant. In order to determine the probability you have to take the coefficient from the model and use the .exp() function from numpy. Below are the results.

Out[107]: 1.0832870676749586

Out[108]: 0.9417645335842487

Out[109]: 0.9900498337491681

For the first value, for every unit wages increaser the probability that they are male increase 8%. For every 1 unit increase in education there probability of the person being male decrease 6%. Lastly, for every one unit increase in age the probability of the person being male decrease by 1%. Notice that we subtract 1 from the outputs to find the actual probability.

We will now move to model testing

Model Testing

To do this we first test our model with the code below


We made the result object earlier. Now we just use the .predict() function with the X_test data. Next, we need to flag examples that the model believes has a 60% chance or greater of being male. The code is below


This creates a boolean object with True and False as the output. Now we will make our confusion matrix as well as other metrics for classification.


The results speak for themselves. There are a lot of false positives if you look at the confusion matrix. In addition precision, recall, and f1 are all low. Hopefully, the coding should be clear the main point is to be sure to use the test set dependent dataset (y_test) with the flag data you made in the previous step.

We will not make the ROC curve. For a strong model, it should have a strong elbow shape while with a weak model it will be a diagonal straight line.


The first plot is of our data. The second plot is what a really bad model would look like. As you can see there is littte difference between the two. Again this is because of all the false positives we have in the model. The actual coding should be clear. fpr is the false positive rate, tpr is the true positive rate. The function is .roc_curve. Inside goes the predict vs actual test data.


This post provided a demonstration of the use of logistic regression in Python. It is necessary to follow the steps above but keep in mind that this was a demonstration and the results are dubious.

Working with a Dataframe in Python

In this post, we will learn to do some basic exploration of a dataframe in Python. Some of the task we will complete include the following…

  • Import data
  • Examine data
  • Work with strings
  • Calculating descriptive statistics

Import Data 

First, you need data, therefore, we will use the Titanic dataset, which is readily available on the internet. We will need to use the pd.read_csv() function from the pandas package. This means that we must also import pandas. Below is the code.

import pandas as pd
df=pd.read_csv('FILE LOCATION HERE')

In the code above we imported pandas as pd so we can use the functions within it. Next, we create an object called ‘df’. Inside this object, we used the pd.read_csv() function to read our file into the system. The location of the file needs to type in quotes inside the parentheses. Having completed this we can now examine the data.

Data Examination

Now we want to get an idea of the size of our dataset, any problems with missing. To determine the size we use the .shape function as shown below.

Out[33]: (891, 12)

Results indicate that we have 891 rows and 12 columns/variables. You can view the whole dataset by typing the name of the dataframe “df” and pressing enter. If you do this you may notice there are a lot of NaN values in the “Cabin” variable. To determine exactly how many we can use is.null() in combination with the values_count. variables.

True     687
False    204
Name: Cabin, dtype: int64

The code starts with the name of the dataframe. In the brackets, you put the name of the variable. After that, you put the functions you are using. Keep in mind that the order of the functions matters. You can see we have over 200 missing examples. For categorical varable, you can also see how many examples are part of each category as shown below.

S    644
C    168
Q     77
Name: Embarked, dtype: int64

This time we used our ‘Embarked’ variable. However, we need to address missing values before we can continue. To deal with this we will use the .dropna() function on the dataset. THen we will check the size of the dataframe again with the “shape” function.

Out[40]: (183, 12)

You can see our dataframe is much smaller going 891 examples to 183. We can now move to other operations such as dealing with strings.

Working with Strings

What you do with strings really depends or your goals. We are going to look at extraction, subsetting, determining the length. Our first step will be to extract the last name of the first five people. We will do this with the code below.

1 Cumings
3 Futrelle
6 McCarthy
10 Sandstrom
11 Bonnell
Name: Name, dtype: object

As you can see we got the last names of the first five examples. We did this by using the following format…

dataframe name[‘Variable Name’].function.function(‘whole word’))

.str is a function for dealing with strings in dataframes. The .extract() function does what its name implies.

If you want, you can even determine how many letters each name is. We will do this with the .str and .len() function on the first five names in the dataframe.

1 51
3 44
6 23
10 31
11 24
Name: Name, dtype: int64

Hopefully, the code is becoming easier to read and understand.


We can also calculate some descriptive statistics. We will do this for the “Fare” variable. The code is repetitive in that only the function changes so we will run all of them at once. Below we are calculating the mean, max, minimum, and standard deviation  for the price of a fare on the Titanic

Out[77]: 78.68246885245901

Out[78]: 512.32920000000001

Out[79]: 0.0

Out[80]: 76.34784270040574


This post provided you with some ways in which you can maneuver around a dataframe in Python.

Numpy Arrays in Python

In this post, we are going to explore arrays is created by the numpy package in Python. Understanding how arrays are created and manipulated is useful when you need to perform complex coding and or analysis. In particular, we will address the following,

  1. Creating and exploring arrays
  2. Math with arrays
  3. Manipulating arrays

Creating and Exploring an Array

Creating an array is simple. You need to import the numpy package and then use the np.array function to create the array. Below is the code.

import numpy as np

Making an array requires the use of square brackets. If you want multiple dimensions or columns than you must use inner square brackets. In the example above I made an array with two dimensions and each dimension has it’s own set of brackets.

Also, notice that we imported numpy as np. This is a shorthand so that we do not have to type the word numpy but only np. In addition, we now created an array with ten data points spread in two dimensions.

There are several functions you can use to get an idea of the size of a data set. Below is a list with the function and explanation.

  • .ndim = number of dimensions
  • .shape =  Shares the number of rows and columns
  • .size = Counts the number of individual data points
  • = Tells you the data structure type

Below is code that uses all four of these functions with our array.

Out[78]: 2

Out[79]: (2, 5)

Out[80]: 10
Out[81]: 'int64'

You can see we have 2 dimensions. The .shape function tells us we have 2 dimensions and 5 examples in each one. The .size function tells us we have 10 total examples (5 * 2). Lastly, the function tells us that this is an integer data type.

Math with Arrays

All mathematical operations can be performed on arrays. Below are examples of addition, subtraction, multiplication, and conditionals.

array([[ 3, 4, 5, 6, 7],
[ 8, 9, 10, 11, 12]])

array([[-1, 0, 1, 2, 3],
[ 4, 5, 6, 7, 8]])

array([[ 2, 4, 6, 8, 10],
[12, 14, 16, 18, 20]])

array([[ True, True, False, False, False],
[False, False, False, False, False]], dtype=bool)

Each number inside the example array was manipulated as indicated. For example, if we typed example + 2 all the values in the array increased by 2. Lastly, the example < 3 tells python to look inside the array and find all the values in the array that are less than 3.

Manipulating Arrays

There are also several ways you can manipulate or access data inside an array. For example, you can pull a particular element in an array by doing the following.

Out[92]: 1

The information in the brackets tells python to access the first bracket and the first number in the bracket. Recall that python starts from 0. You can also access a range of values using the colon as shown below

array([[3, 4],
[8, 9]])

In this example, the colon means take all values or dimension possible for finding numbers. This means to take columns 1 & 2. After the comma we have 2:4, this means take the 3rd and 4th value but not the 5th.

It is also possible to turn a multidimensional array into a single dimension with the .ravel() function and also to transpose with the transpose() function. Below is the code for each.

Out[97]: array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])

array([[ 1, 6],
[ 2, 7],
[ 3, 8],
[ 4, 9],
[ 5, 10]])

You can see the .ravel function made a one-dimensional array. The .transpose broke the array into several more dimensions with two numbers each.


We now have a basic understanding of how numpy array work using python. As mention before, this is valuable information to understand when trying to wrestling with different data science questions.

Lists in Python

Lists allow you to organize information. In the real world, we make list all the time to keep track of things. This same concept applies in Python when making list. A list is a sequence of stored data. By sequence, it is mean a data structure that allows multiple items to exist in a single storage unit. By making list we are explaining to the computer how to store the data in the computer’s memory.

In this post, we learn the following about list

  • How to make a list
  • Accessing items in a list
  • Looping through a list
  • Modifying a list

Making a List

Making a list is not difficult at all. To make one you first create a variable name followed by the equal sign and then place your content inside square brackets. Below is an example of two different lists.

[1, 2, 3, 4, 5] ['a', 'b', 'c', 'd', 'e']

Above we made two lists, a numeric and a character list. We then printed both. In general, you want your list to have similar items such as all numbers or all characters. This makes it easier to recall what is in them then if you mixed them. However, Python can handle mixed list as well.

Access a List

To access individual items in a list is the same as for a sting. Just employ brackets with the index that you want. Below are some examples.


Out[255]: 1

Out[256]: [1, 2, 3]

Out[257]: 'a'

Out[258]: ['a', 'b', 'c']

numList[0] gives us the first value in the list. numList[0:3] gives us the first three values. This is repeated with the alphaList as well.

Looping through a List

A list can be looped through as well. Below is a simple example.

for item in numList :

for item in alphaList :


By making the two for loops above we are able to print all of the items inside each list.

Modifying List

There are several functions for modifying lists. Below are a few

The append() function as a new item to the list


[1, 2, 3, 4, 5, 9]
['a', 'b', 'c', 'd', 'e', 'h']

You can see our lists new have one new member each at the end.

You can also remove the last member of a list with the pop() function.

[1, 2, 3, 4, 5]
['a', 'b', 'c', 'd', 'e']

By using the pop() function we have returned our lists back to there original size.

Another trick is to merge lists together with the extend() function. For this, we will merge the same list with its self. This will cause the list to have duplicates of all of its original values.


[1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
['a', 'b', 'c', 'd', 'e', 'a', 'b', 'c', 'd', 'e']

All the values in each list have been duplicated. Finally, you can sort a list using the sort() function.

[1, 1, 2, 2, 3, 3, 4, 4, 5, 5]
['a', 'a', 'b', 'b', 'c', 'c', 'd', 'd', 'e', 'e']

Now all the numbers and letters are sorted.


THere is way more that could be done with lists. However, the purpose here was just to cover some of the basic ways that list can be used in Python.

Z-Scores and Inferential Stats in Python

In this post, we will look at some ways to calculate some inferential statistics in Python. We are mainly going to focus on z-scores and one/two-tailed test.

We will begin by import some needed packages and then we will make some data and plot it.  Below is the code and plot

import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as stats


We create an object called “quizscore” which contains as you can tell quiz scores. In line four in the code above, we used the .random.normal function from the numpy package to create some random data. This function has 3 arguments in it, the first is the mean of the distribution, next is the standard deviation, and the last is the sample size. After this is the code for the histogram which uses the .hist function from the matplotlib.pyplot package.


Z-Scores are a measure of how far a data point is from the mean. In the code below, we calculate the first five z-scores of our “quizscore” dataset.

Out[127]: array([ 0.54362001, 1.56135871, -0.36924596, 0.53182556, -0.06014972])

In the output, you can see that the first number in the dataset is 0.54 standard deviations above the mean. Remember, our standard deviation was set to 9 so this means the score for the first quiz was about 73. We confirm this with the code below.

Out[129]: 72.851341820695538

Fairly close, another question we can answer is what is the probability that someone got a score that was 1.5 standard deviations or higher on the quiz (about a score of 82). Below is the code followed by the answer.

Out[132]: 0.066807201268858085

In the code above we subtract 1 from our code. The code uses the .cdf function. Inside the function, we put our z-score of 1.5. The answer is 0.066 or 6% of the scores have a Z-score of 1.5 or higher or a quiz score of around 82 or higher.

We can also determine what is the cutoff point for a certain high score. For us, we want to know what the cutoff for the top 15% of quiz scores. Below is the code.

Out[136]: 1.0364333894937898

(1.03 * quizscore.std()) +quizscore.mean()
Out[137]: 77.748927759179054

In the code above, first we had to convert the percentage to a z-score and this is done with the .ppf function. The 85 percentile is equivalent to a Z-score of about 1. Next, we multiplied the z-score by the standard deviation of the quizscore and added the mean of the quizscore to this to get our final answer of 77.74. This means that a score of 77.74 and above is within the top 15%.

One & Two-Tailed Test

A one-tail test is used to compare the sample mean to a population mean. Another way to look at this is to convert a z-score to a p-value. What is happening here is you create a region in your distribution in which scores are considered unusual. For a one-tail test, this is the top 5%. For example, let’s say you want to know the probability that someone got a score of 92 or higher on the quiz. This can be solved with the following code.

Out[138]: 0.0072370644085374414

Here is what we did

  1. We create an object called “quizZ” which took our specific score of 92 subtracted the mean of “quizscore” and divided it by the standard deviation of “quizscore”. This becomes the z-score for the value 92.
  2. We then subtract one from this while using the .cdf function
  3. The output indicates that there is less than a 1% chance that someone got a score of 92% or higher.

In this example our sample mean was small (only 1) but the concept remains the same.

A two-tailed test is the same concept except that the rejections regions are on both sides of the distribution and divide in half. This means that the top 2.5% and bottom 2.5% are now considered unusual scores. As an example, if the average score on the quiz is 75 with a standard deviation of 5 and we want to see if our class mean of 67 is different. We can use the following code to answer this.

Out[160]: 0.063688920253590395

You can see that the probability of our class is not unusual as it is above the cutoff of 5% indicating no difference. This means that if 75 is the center of our distribution the quiz score of 67 would be within 2 standard deviations of the mean.


In this post, we explored some of the ways you can do inferential statistics with Python. Whatever you want to know can be calculated by knowing a few lines of code.

Working with Strings in Python

It is somewhat difficult to define a string. In some ways, a string is text such as what is found in a book or even in this blog.  Strings are made up of characters such as letters and even symbols such as %#&@**. However, the computer does not use these characters but converts them to numbers for processing.

In this post, we will learn some of the basics of working with strings in Python. This post could go on forever in terms of what you can do with text so we will only address the following concepts

  • Finding individual characters
  • Modifying text

Finding Individual Characters

Finding individual characters in a string is simple. You simply need to type the variable name and after the name use brackets and put the number of the location of the character in the string. Below is an example

example="Educational Research Techniques"


As you can see, we created a variable called “example” the content of “example” is the string “Educational Research Techniques”. To access the first letter we use the “print” function, type the name of the variable and inside brackets put the letter 0 for the first position in the string. This gives us the letter E. Remeber that Python starts from the number 0 and not 1.

If you want to start from the end of the string and go backward you simply use negative numbers instead of positive as in the example below.

example="Educational Research Techniques"

You can also get a range of characters.

example="Educational Research Techniques"

The code above is telling python to take from position 0 to 4 but not including 5.

You can do even more creative things such as pick characters from different spots to create new words

example="Educational Research Techniques"
print(example[0:2] + example[20:25])
Ed Tech

Modifying Strings

It is also possible to modify the text in the string such as making all letters upper or lower case as shown below.


'educational research techniques'

The upper() function capitalizes and the lower() function make small case.

It is also possible to count the length of a string and swap the case with the len() and swapcase() functions respectively.



Python allows you to count how many times a character appears using the count() function. You can also use the replace() to find characters and change them.


'Educational Rqsqarch Tqchniquqs'

As you can see, the lower case letter ‘e’ appears four times. In the second line, python replaces all the lower case ‘e’s with the letter ‘q’.


Of course, there is so much more than we could do with strings. However, this post provides an introduction to what is possible.

Friedrich Fröbel

Friedrich Fröbel (1782-1852) was an influential German teacher of the 18th and 19th centuries. This post will take a look at his life and views on education.


Frobel was the son of a clergyman. At an early age, his mother dies and Frobel moves to live with his uncle at the age of ten after his father remarried. As a child, Frobel developed a lifelong love of nature, which would manifest itself in many ways.

Despite being one of the most influential educators of all-time Frobel was seen as a lazy student by his teachers. By 15, Frobel was working as an apprentice to a forest manager. However, the forest manager was not much of a teacher and had little interest in helping Frobel. This compelled Frobel to study all of the forest manager’s books on his own which allowed him to develop an extensive knowledge of plants.

In 1799m Frobel goes to college and studies science, finance, history, and architecture. After completing school he worked as an architect but was not happy with his job. At the suggestion of a friend, Frobel tried teaching and immediately fell in love with it.

From 1808-1810, Frobel was under the guidance of John Pestalozzi and studied at Pestalozzi’s school. This experience had a deep impact on Frobel’s views on education and help to shape his approach towards his innovation in education know as the kindergarten.


Frobel focused heavily on early childhood education and developed the idea of the kindergarten or “child’s garden”. Frobel created the kindergarten to help mothers with the training and teaching of their small children.

In the kindergarten, the play of the student was systematized and serves as preparation for regular school. The children learn through there play various concepts that will help them in the future.

It can not be understated how influential kindergarten has been. Virtually every state in America offers some form of kindergarten and the majority require it. Frobel has made a strong mark in his work in early childhood education.

Frobel believed that early education was critical and should follow the natural development of the child. He agreed with Pestalozzi that education needs to address physical and spiritual needs.

One point of departure between Frobel and Pestalozzi is in regards to early childhood education. Frobel supported early school training outside the home while Pestalozzi was not as enthusiastic. In many ways, Frobel brought Pestalozzi’s ideas down to the youngest of students.


Frobel mark in educational history is assured as the founder of the concept of kindergarten that is still used to this day. All though there have been changes in early childhood education as the younger ages have become more academic. The idea of kindergarten is still there at least in name throughout the world.

Introducing Google Classroom

Google Classroom is yet another player in the learning management system industry. This platform provides most of the basics that are expected in a lms.  This post is not a critique of Google Classroom. Rather, the focus here is on how to use it. It is better for you to decide for yourself about the quality of Google Classroom.

In this post, we will learn how to set up a class in order to prepare the learning experience.

Before we begin it is assumed that you have a Gmail account as this is needed to access Google Classroom. In addition, this demonstration is from an individual account and not through the institutional account that a school would set up with Google if they adopted tGoogle Classroom.

Creating a Google Class

Once you are logged in to your Gmail account you can access Google Classroom by clicking on the little gray squares in the upper right-hand corner of your browser. Doing so will show the following.


In the example above, Google Classroom is the icon in the bottom row in the middle. When you click on it you will see the following.


You might see a screen before this asking if you are a student or teacher. In the screen above, Google tells you where to click to make your first class. Therefore, click on the plus sign and click on “create class” and you will see the following.


Click on the box which promises Google you will only use your classroom with adults. After this, you will see a dialog box where you can give your class a name as shown below.


Give your course a name and click “create”. Then you will see the following.

1.pngThere is a lot of information here. The name of the class is at the top followed by the name of the teacher below. In the middle of the page, you have something called the “stream”. This is where most of the action happens in terms of posting assignments, leading discussions, and making announcements. To the left are some options for dealing with the stream, a calendar, and a way to organize information in the stream by topic.

The topic feature is valuable because it allows you to organize information in a way similar to topics in Moodle. When creating an activity just be sure to assign it to a topic so students can see expectations for that week’s work. This will be explained more in the future.

One thing that was not mentioned was the tabs at the very top of the screen.


We started in the “stream” tab. If you click on the “students” tab you will see the following.


The “invite students” button allows you to add students by typing their email. To the left, you have the class code. This is the code people need in order to add your course.

If you click on the “about” tab you will see the following.


Here you can access the drive where all files are saved, the class calendar, your Google calendar, and even invite teachers. In the middle, you can edit the information about the course as well as additional materials that the students will need. This page is useful because it is not dynamic like the stream page. Posted files staying easy to find when using the “about” page.


Google Classroom is not extremely difficult to learn. You can set-up a course with minimal computer knowledge in less than 20 minutes. The process shared hear was simply the development of a course. In a future post, we will look at how setup teaching activities and other components of a balanced learning experience.

while statements and Nested for loops in Python

When you are unsure how much data your application may need to process it is probably appropriate to use a while statements. The while statement we keep processing until it runs out of items to process. If you remember with a traditional for loop the limit is preset by the data structure you are analyzing.

Nested for loops is another concept we will look at. They are useful when it is unclear what the conditions of execution should be.

Since they can go on forever it is possible with a while statement to create an endless loop. This is a loop that never stops processing. This will essentially crash most computers and should naturally be avoided. To avoid this you need set the environment, state the while statement, and update the condition of the environment. Below is a simple example of this.


  1. In line 1, we have the environment for the condition which is a variable called “number” set to 0.
  2. Line 2 is the while statement which states that as long as “number” is less than 10 do the following.
  3. In line 3 the variable “number” is printed.
  4. In line 4, after “number” is printed the number 2 is added to the current value
  5. This takes place until the variable “number” is equal to ten.

Below is what the output looks like if you ran this


You can see that we start with 0. This is because we set the variable “number” originally to 0. Then the value increases by just as in line 4 of the code above.

Nested for Loops

Just as with functions you can also have nested for loops. This is a loop within a loop. Below is a simple example.


  1. Lines 1-2 as for input and you can type whatever you want
  2. Line 3-4 is the first for loop at it process whatever your input is from line 1. The final result is that the loop prints this
  3. Line 5-6 are the second for loop and simply processes whatever you inputted in line 2. This loop simply prints the input from line 2.

Here is what the output would look like


You can see that the loops took turns. The first loop ran its first letter them then the second loop ran everything. Then the first loop ran its second letter and the second loop ran everything again. Therefore, nested for loops affects the timing of when the code is ran.


This post looked at the use of while statements and for loops. while statements are useful when you do not know how long you may need to process data. for loops allow you to run complex looping in which you are trying to do multiple tasks.

Pestalozzi His life and Views on Education

John Pestalozzi (1746-1827) is one of the most influential educators of the most influential educators of the early 19th century and still one of the most influential educators today. This post will examine his life and his views on education.


Pestalozzi was born Zurich, Switzerland in 1746. His father died when he was a child and Pestalozzi was raised by his mother. As a student, Pestalozzi showed no signs of greatness and his teachers accuse d him of being lazy.

Despite this, Pestalozzi goes to college to studying theology before switching to law. After completing school he tried to be a farmer but failed. After his farming venture folded did he turn to teaching by starting his own school.

Teaching during the 18th-19th century was mostly an unappreciated experience. The teachers normally lacked training and were poorly paid. In addition, many leaders did not want the general public to be educated because they believed that educated people were harder to control.

Knowing or experience all this Pestalozzi started his school anyway only for it to fail as well. The main benefit of this experience was that He discovered his love for teaching.

In 1798, Pestalozzi moves to Stanze to care for 80 orphans who had suffered from war. He ran the entire operation by himself with only help from the children. Unfortunately, he had to leave less than a year later and spends several years as an assistant teacher.

In 1805, Pestalozzi starts his second school. This school was by far more successful than his first attempt and became a leader in innovative education in Europe at the time. All the students and teachers lived, ate, and study together. This operation lasted 20 before infighting finally destroyed it. Two years later in 1827, Pestalozzi died.

Educational Views

Pestalozzi views were not so much radical as they were distinct in focusing on the individual development of the child. Teaching should follow the natural progression of the child. In addition, students learn best through repetition and learning by doing.

Combing repetition with learning by doing means that a child should do it over and over again until they are comfortable. Again, it is natural for many children to learn this way. The teacher encourages this by supporting or scaffolding the learning experience of the student

Children should be taught the literal before the abstract because this is appropriate for their senses. This also leads to inductive teaching in many instances but not necessarily always.

Pestalozzi also emphasized that human nature consisted of the physical and moral capabilities. Pestalozzi was a Christian and was convinced that a child must learn more than academics but also develop a sense of right and wrong as prescribed by religion.


Pestalozzi work continues to impact teaching today. Almost every teaching education program talks about his work in one way or another. His philosophy of the whole child approach is a summary of what many believe education should be.

for Loops in Python

The use of for loops are valuable when you need your application to do a repetitive task. Once the task is completed there is some sort of output that is returned. Understanding how to create a for loop is a critical step in utilizing the Python language.

Making for loops

Here is the basic syntax for a for loop

for item in data:
  do something

The word “for” indicates a for loop. The word “item” is an iteration variable. An iteration variable is a variable that changes value each time the loop goes through the data. It takes on the current value that is being analyzed for whatever purpose the loop has. You can name the iteration variable anything you want but a general rule is to use names that make sense for the context. Otherwise, nobody else will be able to understand your code.

After the colon is where you find “do something” here you put the command for whatever the loop is supposed to do. Below is an actual example of the use of the for loop.


Here is what happened

  1. At the top, we have our for loop. The iterator variable is “letter” and we are looping through the data of the string “education”.
  2. The next line is the action the for loop will perform. Essentially, the loop will pull each later from the string “education” and insert them one at a time into the phrase “Give me an”,. Notice how the word “letter” is at the end of our print statement. This the iteration variable that changes each time our for loop goes through the string “education.
  3. The output is several print statements each containing a different letter from the string “education”

for loops with Breaks

Breaks are used to provide conditions in which the loop will stop. In the example below, we add some code to our cheer that allows you to enter your own cheer. However, the church must be less than 10 letters otherwise you get a message that word is too long. Below is the code


Here is what it does.

  1. In line 1, you provide a word as indicated by the instructions in the parentheses.
  2. Line 2 is the for loop. letter is the iteration variable for our word in “Value”
  3. Line 3 is the if statement. The strong on “Value” is checked to make sure it is 10 characters or less.
  4. In line 4, if “Value” is greater than 10 characters you get the message that the cheer is too long.
  5. Line 5 is the break which stops the loop from continuing.
  6. In line 6, if the word is less than 10 characters you get the cheer with each letter.

Below is the output with less than 10 characters


Here is the output with more than 10 characters


Continue and for loop

The continue clause allows you to check the data and only process it based on certain conditions. In the code below, we are going to change our cheer code so that it removes spaces when making the cheer.


The code is mostly the same with a few exceptions

  • The if statement looks for blank spaces and these are left out of the cheer.
  • The continue clause tells python to keep going
  • Finally, the cheer is given

Below is what the output looks like if you ran this code


You can see that I put many blank spaces in-between the letters but these do not appear in the code. This is because of the continue clause.


for loops are a basic yet powerful tool of programming. In Python, for loops are used for the same reason as other languages and that is for completing repetitive tasks. The examples, here provide some simple ways in which this can be done.

August Francke and Education

August Francke (1663-1727) was a Protestant minister in Germany during the 17th and 18th century. His influence on education was distinct in that he brought a distinct theological view to education. This post will examine his life and views on education.


Born in Germany in 1663 Francke studied the sciences, languages, philosophy, and theology at university. His primary complaint about his theological studies was that he understood what he studied but that he did not have a corresponding experience in his heart. In other words, Francke wanted an emotional experience about the theological concept he studied.

This search for an emotional heartfelt experience led Francke to become sympathetic towards pietism. Pietism was a theological movement that believed protestants should replace the dead orthodoxy of scholastic theology with an emotional or theology of the heart. In many ways, this was exactly what Francke was looking for and he embraces this immediately.

Around the same time circa 1687, Francke starts a school but soon leaves to become a professor at the University of Halle in 1691. It was while working at Halle that Francke reached out to the poor. Initially, his ministry was simple Bible studies. However, with time Francke and his people opened several schools and other institutions to support the poor in Germany. All this was done while he still taught at the university.

Educational Views

Francke believed that education should be linked with the future vocation of the student. This in stark contrast to the generalized education that is common in most countries today. Students destined for trades should have different education form students who are going to be merchants.

With his focus on the emotions, Francke had a lot to say in particular about classroom management. For example, he stated that a teacher should never discipline in anger. This may be because the children will think that discipline is about how people feel rather than right or wrong.

The teacher also needs to maintain discipline without being harsh and severe. Of course, this is easier said then done but it still needs to be said. On the other hand, a teacher also needs to avoid the other extreme of being too nice as this is equally detrimental. Again, this is easier said than done.

Lastly, Francke counsels teachers that they must be sure that they are not the source of the students’ behavior problems. In other words, the teacher’s poor management should not be the source of the misbehavior in a classroom. Misbehavior should originate from the student and not because of an inconsistent teacher.


Francke was a man who was looking for an emotional experience to support his theological knowledge. In reality, what he was looking for was the practical application of his theological knowledge. This is said because as Francke helped people according to his religion he also experience the emotional satisfaction he so desperately needed.

Solving a System of Non-Linear Equations

Solving a system of non-linear equations means that at least one of the equations is not linear. For example, if one equation has an exponent it may be a parabola or a circle. With this no shape that is not linear it involves slightly different expectations.

Solving a system of non-linear equations is similar to solving a system with linear equations with one difference. The difference is that with nonlinear equations you can have more than one solution. What this means is that the lines that are the equations can intersect in more than one place. However, it is also possible they do not intersect. How many solutions depends on the lines involved.

For example, if one equation is a circle/parabola and the other is a line there can be 0-2 solutions. If one equation makes a circle and the other makes a parabola there can be up to 4 solutions. Two circles or two parabolas can make a multitude of solutions

The steps for solving a nonlinear system are the same. Therefore, in this post, we will demonstrate how to solve a system of non-linear equations using the substitution and elimination methods.


The substitution method is when we plug one equation into the variable of the other equation. Below is our system of equations.


The first thing to notice is that the top equation would make a circle if you graphed it. That is why this is a non-linear system. To solve we take the second equation and substitute it for y. Below we find the values for x


Now we complete the system by finding the values for y.


THerefore are ordered pairs are (0, -3) and (1,0). These are the two points at which the equations intersect if you were to graph them.


Elimination involves making the coefficients of one of the variables opposite so that when they are added together they cancel each other out. By removing one variable you can easily solve for the other. Below is the system of equation we want to solve.


The top equation makes a circle while the bottom one makes a parabola. This means that we can have as many as four solutions for this system. To solve this system we will multiply the bottom equation by -1. This will allow us to remove the x variable and then solve for y. Below are the steps.


Now we simply solve for y.


Now we can take these values for y to solve for x.


The order pairs are as follows

  • (-2,0)
  • (2,0)
  •   (√3, -1)
  • (-√3, -1)


From this, you can see that non-linear equations can be solved using the same approaches. Understanding this is key to many other fields of math such as data science and machine learning.

elif Clause and Nested Statements in Python

This post will provide a brief introduction into the use of the elif clause and nested statements in Python.

elif Clause

The elif clause is used to add an additional set of conditions to an if statement. If you have ever used some sort of menu on a computer in which you had to make several choices it is possible that an elif clause was involved in the code.

The syntax for the elif clause is the same as for the if statement. Below is a simple example that employs the elif clause.


Here is what this code does.

  1. In lines 1-3, I print three lines of code at the beginning. These are the choices available to the user.
  2. In line 4, the “pick” variable stores whatever number the user inputs through the “input” function. It must be an integer which is why I used the “int” function
  3. In line 5 we begin the if statement. If the “pick” variable is set to 1 you can see the printout in line 6.
  4. In lines 7 and 8 we use the elif clause. The settings are mostly the same as in the if statement in line 5 except the “pick” variable is set to different numbers with different outputs.
  5. Lastly, in line 11 we have the else clause. If for any reason the person picks something besides 1,2 or 3 this message will appear.

What this code means in simple English is this

  • If the pick is 1 then print “dogs are your favorite animal”
  • or else if the pick is 2 then print “cats are your favorite animal”
  • or else if the pick is 3 then print “rabbits are your favorite animal”
  • else print “I do not understand your choice”

Here is what the code looks like when you run it


As a note, if you type in a letter or string you will get an error message. This is because our code is not sophisticated enough to deal with non-integers at this point.

Nested Statements

Just like with functions which can be nested so can decision statements by nesting inside each other. To put this simply the conditions set by the first if statement can potentially affect the second condition. This is explained better with an example.


Here is what is happening in the code above.

  1. In lines 1 and 2 the user has to pick numbers that are saved in the variables “num1” and “num2.”
  2. Line 3 and 4 are the if statements. Line 3 and line 9 are the outer if statement and line 4-8 are the inner if statement.
  3. Line 3 shares that “num1” must be between 1 and 10.
  4. Line 4 shares that “num2” must be between 1 and 10.
  5. Line 5 is the results of the inner if statement. The results are printed using the “.format” method where the {0} and {1} are the variables “num1” and “num2”. After the comma is what is done to the variables, they are simply added together.
  6. Line 8 is the else clause. If someone types something different form a number between 1-10 for the second number they will see this message
  7. Line 9 is the else clause for the outer if statement. This is only seen if a value different from 1-10 is inputted.

If you run the code here is what it should look like



The elif clause and nested decision statements are additional tools that can be used to empower your applications. This is some of the most basic ideas in using a language such as Python.

Life and Educational Views of John Locke

John Locke (1632-1704) was an influential philosopher during the 17th century. Locke also had some significant views on education. This post will look at Locke’s life and his positions on education.


Locke was born in 1632 in England. He went to college at Oxford and graduated in 1655. During, his university studies Locke developed a negative attitude toward the scholastic approach to education with its heavy emphasis on rote memorization. This experience would help to shape his educational views later in life.

After completing his bachelors, Locke attended medical school. Locke was not interested so much in being a doctor as in taking better care of his own health which he had problems with. After completing medical school, Locke work as a tutor to the son of an influential nobleman.

Due to the political actions of Locke’s boss he had to leave England for a time. However,  when a new king ascended the throne in England Locke was able to return. Upon returning Locke writes one of his most famous works “Essay Concerning Human Understanding” as well as other important works.

With his return to England, Locke actually worked for the government that used to be suspicious of him. He continued to serve until his health failed him and  he died in 1704.

Educational Views

Locke primarily had a practical view of education. The learning of a student should be focused on practical. Today it is tempting to spread a child across many subjects and electives but this was not what Locke supported. Education should be simplified and to the point

Locke did not hold that education should only be academic. Reading and writing are important but they were not everything in his view. This was in stark contrast to his scholastic education experience were academics is everything.

Locke believes that character development was the ultimate purpose of education. Understanding right from wrong and showing integrity were much more important than academic prowess.

Due to his medical training, Locke also supported the idea of an education that caters to the needs of the body. Fresh air, exercise, sleep, and a plain diet were critical to successful education.

Temperance was also another key item of success as the workload of the child should be adjusted to individual needs and not all the same. For Locke, a standardized education is insensible and treats children as objects rather than as living creatures. The teacher’s job is to study the child and find what is appropriate for them.

Locke also had much to say about language. He boldly claimed that the learning of Latin was overrated and really an activity for the upper class and not really for everybody. Locke also said that the best way to learn a language was through practice and not through the study of theoretical rules of language use.  In many ways here, Locke is laying the foundation for modern beliefs in TESOL.


John Locke was a highly influential philosopher of the 17th century who had unique views on education at his time. His ideas on wholistic education are still relevant today and his thoughts on language acquisition are perhaps the main view in that discipline today.

Life and Educational Views of John Comenius

John Comenius (1592-1670) was a Czech educator who has had a tremendous influence on education. This post will take a look at his life and educational philosophy.


Comenius was born in 1592. Early in life lost his parents and was raised by guardians. Due to this chaos, there were some delays in Comenius education as he did not study Latin until he was 16, which was considered late during this time.

Comenius late exposure to Latin allowed him to observe with a critical eye how it was taught compared to if he had studied as an uncritical small child. This would lay the foundation for his views towards language teaching and education in general.

Comenius would later go on to college and would graduate and take the position of minister in his church. These first few years were peaceful as he would work and marry. In addition, Comenius continues to nourish his views on education. However, were would soon break out and Comenius would lose all of his property in the process.

From here, Comenius goes fully into education and teaches and writes. Comenius would work in several countries writing about education as well as teaching. He focused a great deal on reforming how language was taught in particular Latin. In addition, he produced several highly influential books such as”The Gate of Tongues Unlocked” which may be one of the first language teaching books ever and “Didactic Magna” which may be one of the first books on teaching methods. In 1670, Comenius died at the age of 77.

Educational Views

Comenius believed that education should not only improve the main but should be focused on the development of the whole man which means physical, mental, and social development. The teaching should be inductive and based on examples. this means that you teach by using examples and have the students make conclusions.

The focus on inductive teaching and observation made Comenius critical of rote memorizing. Instead, understanding should be the primary goal. Lastly, Comenius was a support that everyone should be educated and not just males. This idea was somewhat ahead of its time.

Comenius is most famous for proposing grade levels. His system had four levels.

  1. Level 1 Domestic school-Home with mother
  2. Level Proper School-Basic reading and writing
  3. Latin School-College Preparation
  4. University

Comenius also had views on specifically teaching language. He supported teaching the mother tongue first until mastery. His point was that comprehension of the language must move in step with the tongue.  Comenius claimed there was no benefit to teaching a language without understanding. Of course, this is in strong contrast to Audiolingualism which is a strong support of nonsense repetition.

He also believed that learning by doing was the most appropriate way to learn a language. After the students do it you can teach them the rules. This allows the students to build on their strengths.


The life work of Comenius is an example of practical Reformation of educations. Many of his ideas and views are still influencing education to this day.

Logical Flow in Python

Applications often have to make decisions and to do this they need a set of conditions to him them decide what to do. Python, like all programming languages, has tools that allow the application to execute various actions based on conditions. In this post, we will look at the use of if statements.

If Statement Define

An if statement is a statement used in Python that determines when an action should happen. At a minimum, an if statement should have two parts to it. The first part is the condition and the second part is the action that Python performs if the condition is true. Below is what this looks like


This is not the most beautiful code but this is the minimum for a if statement in Python.

If Statement 

Below is the actual application of the use of an if statement

if number ==5:

In the code above we created a variable called number and set its value to 5. Then we created the if statement by setting the condition as “if number equals 5” the action for this being true was prin the string “correct”, which Python does at the bottom.

Notice the double equal sign used in the if statement. The double equal sign is used for relational equality while the single equal sign is used for assigning values to variables. Also, notice the colon at the end of the if statement. This must be there in order to complete the code.

There is no limit to the number of tasks an if statement can perform. In to code above the, if statement only printed “Correct” however, we can put many more print functions or other actions as shown below.

if number ==5:

All that is new above is that we have two print statements that were executed because the if statement was true.

Multiple Comparisons

In the code above python only had to worry about whether number equaled 5. However, we can have Python make multiple comparisons as well below is an example.

if (number>0) and (number<10):

Now for the print functions to execute the number has to be greater than 0 but less than 10. If you change the number to something less than 0 or greater than 10 nothing will happen when you run the code because the conditions were not met. In addition, if you type in a letter like ‘a’ you will get an error message because Python is anticipating a number and not a string.

If Else Statements

The use of an else clause in an if statement allows for an alternative task to be executed if the first conditions in the if statement are not met. This allows the application to do something when the conditions are not met rather than leaving a blank screen. Below we modify our code in the previous example slightly so that something happens because of the else clause in the if statement.

if (number>0) and (number<10):
 print("Number is out of range")
Number is out of range

In this code above we did the following

  1. we set our number to 15
  2. We created an if statement that searches for a number greater than 0 and less than 10.
  3. If the conditions in step 2 are true we print the two statements
  4. If the conditions in step 2 are not met we print the statement after the else clause
  5. Our number was 15 so Python printed the statement after the else clause

It can get much more complicated and powerful than this but I think this is clear and enough for now.


This post provided an introduction to the if statement in Python. THe if statement will execute a command based on one or more conditions. You must be careful with the syntax. Lastly, you can also include an alternative task with the else clause if the conditions are not met.

Wolfgang Ratich

Wolfgang Ratich (1571 – 1635)was a practitioner of education during the 17th century. His work during his lifetime was mostly a failure but time was a better judge of his practical insights into education. In addition, Ratich was an early influence on Comenius who was one of the greatest educators of all time.

Ratich studied philosophy and theology at university with the goal of becoming a preacher. However, a speech impediment put an early end to his career in ministry. This led him to try teaching as his career.

Views on Education

Ratich quickly formed strong views on education. He believed that children should study their mother tongue first before learning about others, which is an idea that is still supported to this day.

Teaching should also be inductive in nature which means that the students learn from examples and experience first and use these experiences to form conclusions. This was radical at the time because most believe that learning involved making grand conclusions first and finding support for them which is called deductive thinking.

Ratich also despised rote learning as intellectual harmful to students. He preferred to allow a child to learn according to nature. This idea was further spelled out in the work of Piaget and Kohlberg who stressed development in young children.

Language Teaching MEthod

Ratich method for teaching English was methodical, to say the least. His method included about 6 steps.

  1. Teach the alphabet
  2. Form words and syllables
  3. Teacher reads a book out loud to the class with students following along
  4. Students take turns reading parts of a chapter from the book the teacher read
  5. Teacher teaches grammar
  6. Students identify grammatical examples of the English terms in the book

It’s rather amazing this system worked. However, it was ahead of its time. Unfortunately, the results were mixed but maybe not for the method but rather because of the teacher


After several years of trying Ratch was finally allowed to put his ideas into practice at a school. With his thoughts on education and detailed method results were assumed o be coming. However, the school was a failure. This is due primarily to the poor people skills of Ratich

Ratich alienated everyone with his personality and stubbornness. He was rude and considered arrogant. Even Ratich’s religion was a point of contention as Ratich was Lutheran and he was living and working among Calvinist. Eventually, Ratich irritated the prince and was thrown in prison for a while before leaving.


Ratich in many had the right ideas and wrong personality. His ideas were revolutionary and in many ways laid the foundation for ideas in TESOL such as inductive learning, the use of authentic reading etc. Ratich only problem was Ratich which may be one of the lessons a young Comenius learned when he visited Ratich’s school.

Making Functions in Python

Efficiency is important when writing code. Why would you type something a second time if you do not have to? One way coders save time, reduce error, and make their code easier to read is through the use of functions.

Functions are a way of storing code so that it can be reused without having to retype or code it again. By saving a piece of reusable code as a function you only have to call the function in order to use it again. This improves efficiency and reliability of your code. Functions simply take an input, rearrange the input however it is supposed to, and provide an output. In this post, we will look at how to make a function using Python.

Simple Function

A function requires the minimum information

  • A name
  • Determines if any requirements (arguments) are needed
  • The actual action the function is supposed to do to the input

We will now make a simple function as shown in the code below.

def example():
     print("My first function")

In the code above we have the three pieces of information.

  • The name of the function is “example” and you set the name using the “def” command.
  • There are no requirements or arguments in this function. This is why the parentheses are empty. This will make more sense later.
  • What this function does is use the “print” function to print the string “My first function”

We will now use the function by calling it in the example below.

My first function

As you can see, when we call the function it simply prints the string. This function is not that impressive but it shows you how functions work.

Functions with Arguments

Arguments are found with the parentheses of a function. They are placeholders for information that you must supply in order for the function to work. Below is an example.

def example(info):

Now our “example” function has a required argument called “info” we must always put something in place of this for the function to run. Below is an example of us calling the “example” function with a string in place of the argument  “info”.

example("My second function")
My second function

You can see that the function simply printed what we placed in the paratheses. If we had left the parentheses empty we would have gotten an error message. You can try that yourself.

You can assign a default value to your argument. This is useful if people do not provide their own value. Below we create the same function but with a default value for the argument.

def example(info="You forgot to give a value"):

We will now call it but we will not include the argument

You forgot to give a value

return and print

When creating functions, it is common to have to decide when to use the “return” or “print” function. Below are some guidelines

  • Print is for people. If a person only needs to see the output without any other execution the print is a good choice.
  • Return is appropriate when sending the data back to the caller for additional execution. For example, using one function before using a second function

If you take any of the examples and use “return” instead of “print” they will still work so the difference between “return” and “print” depends on the ultimate purpose of the application.


Functions play a critical role in making useful applications. This is due to their ability to save time for coders. THere are several concepts to keep in mind when developing functions. Understanding these ideas is important for future success.

Melancthon Life & Educatioal Views

This post will take a brief look at the life and educational views of Philip Melancthon (1497-1560) a highly influential protestant reformer in Germany.

Life of Melacthon

Melanchthon was considered by many to be a highly gifted prodigy. In addition to his mother tongue of German, Melanchthon was a master of Greek and Latin to a level that astonished his teachers.

In 1512, at the age of 15, Melanchthon did not start college, rather he would finish college. This means that he probably started university studies at 11-12 years of age. He was also supposed to receive his master degree but the university may him wait because of his age.

In 1518, Melancthon begins teaching and of course, was a phenomenal teacher. His primary field was theology and Greek but he was formidable in other areas as well. It was at this point in his life that Melancthon would become friends with Martin Luther, the reformer.

Melancthon was also a prodigious writer of books. He wrote on various subjects including Greek, Latin, ethics, logic, rhetoric, physics, and theology. Some of the textbooks he wrote were so good that they were used for almost 100 years. A feat that is impossible to with the speed at which new knowledge now develops.

Views on Education

Melancthon believed in leading by example and that attitude was contagious. Target students to study teacher needed to have energy and enthusiasm for the subject. Melancthon was a voracious student and at times this infected his students as well.

Melancthon also developed what is now known as the “Saxony Plan.”  This plan was a brief philosophy of education with three tenets.

  1. Teachers should not teach children several languages at the same time. This is overwhelming for the child. Instruction in Germany should first be focused on Latin.
  2. Teachers should not teach too many subjects. This also is damaging to the student.
  3. Development of different levels or classes should be used. Melancthon, in particular, believed that there should be three grades or classes for young students.
    • LEvel 1-Teaches reading, writing, arithmetic and basic concepts from the Bible
    • Level 2-Adds Latin  grammar and continues bible instruction
    • Level 3-More Latin along with rhetoric, logic, and classes were now taught in Latin

Looking back, these ideas do not seem revolutionary, however, at the time these were ground-breaking concepts. Melancthon was reacting to common teaching habits of the time. In other words, it was common to teach children several languages at once, to focus on too many subjects, and to not have the students organized into groups based on ability.


Melancthon provides us with a look at a reformer of education during the protestant reformation. His work as a teacher and scholar is second to none. In addition, his ideas on education help to rectify many problems in German education at the time.

Educational Views of Michel Montaigne

By the 16th century, the Renaissance was in full swing, the Protestant Reformation had already been around for over a generation and people had serious doubts about the intellectual and spiritual grip the Church had on society. Since the Church also controlled education people began to question these methods. As this wave of humanism swept Europe.

It was during this time of doubt and skepticism that Michel Montaigne (1533-1592) arrived on the scene. Montaigne was not so much an educator as he was a person who had a strong opinion of how education should be. He also knew how to write witty insightful essays on the subject of education along with other subjects of his interest. This post will take a brief look at his life and educational philosophy

Montaigne’s Life

Montaigne was born into a well to do family in France in 1533. He was natural brilliant and was able to speak Latin, in addition to his mother tongue of French by the age of six. Yes, Montaigne was brilliant but he also had a German tutor who did not know French and used Latin to communicate with the child.

By 13, Montaigne had finished college. He turned his attention to politics and was a member of parliament by the age of 20. Soon after, he became mayor of his 20. Despite what looked to be a brilliant political future Montaigne left politics after becoming Mayor to live a life of quietness. Since he was already well off he did not need to endure the rigors of financial gain and power to maintain his livelihood.

It was in this semi-retirement that Montaigne began writing his famous humanistic “Essays” on various subjects. In fact, Montaigne was one of the first people to popularize the idea of an essay, which is now standard practice in school today. Our attention will be on his views on education.

Views on Education

Montaigne views on education were almost a reaction against Church views on education. Montaigne believed in a wholistic education of the man and not to divide him into pieces. He also criticized the study of Latin and Greek because he supported the development of the mother tongue first. This debate over mother tongue use is a recurring theme in early language education.

Montaigne also criticized the study of the classics as it did not prepare students for practical life but rather bade them conceited. Another target of criticism was the teaching methods of the day, which were often lecture-style. Montaigne views this pouring knowledge into the mind and not useful for the student.

Montaigne supported a more interactional approach to teaching in which the students and teacher take turns talking and listening. THrough action came understanding in his opinion.

Finally, Montaigne was a critic of corporal punishment. He viewed almost as if one was training an animal rather than a person. Again most of these criticisms were of common practices in education at that time period and the education was mostly controlled by the church.


Montaigne was a theoretician on education but not much of a practitioner. His experience as a student led him to write strong reactionary criticisms against education. In spite of his lack of practical experience Montaigne’s thoughts are highly insightful and somewhat applicable to this day.

Common Data Types in Python

All programming languages have a way of storing certain types of information in variables. Certain data types or needed for one situation and different data types for another. It is important to know the differences in the data types otherwise serious problems could arise when developing an application. In this post, we will look at some of the more commonly used data types in Python.

Making Variables

It is first important to understand how to make a variable in Python. It is not that complicated. The format is the following

variable name =  data inside the variable

You simply type a name, use the equal sign, and then include the data to be saved in the variable. Below is an example where I save the number 3 inside a variable called “example”


The “print” function was used to display the contents of the “example” variable.

Numeric Types

There are two commonly used numeric data types in Python and they are integers and floating point values.


Integers are simply whole positive or negative numbers. To specifically save a number as an integer you place the number inside the “int” before saving as a variable as in the example below.



You can check the data type by using the “type” function on your variable. This is shown below.

Out[17]: int

The results are “int” which stands for integer.

Floating-Point Types

Floating-point numbers are numbers with decimals. If your number includes a decimal it will automatically be stored as a floating type. If your number is a whole number and you want to save it as a floating type you need to use the “float” function when storing the data. Below are examples of both

#This is an example of a float number



#This is an example of converting a whole number to a floating point



Floating points can store exponent numbers using scientific notation. Floating point numbers are used because decimals are part of the real world. The downside is they use a lot of memory compared to integers.

Other Types

We will look at two additional data types and they are boolean and string.


A boolean variable only has two possible values which are True or False. This seems useless but it is powerful when it is time to have your application do things based on conditions. You are not really limited to True or False you can also type in mathematical expressions that Python evaluates. Below are some examples.

#Variable set to True



#Variable set to True after evaluting an expression




A string is a variable that contains text. The text is always enclosed in quotations and can be numbers, text, or a combination of both.

example="ERT is an awesome blog"

ERT is an awesome blog


Programming is essentially about rearranging data for various purposes. Therefore, it only makes sense that there would be different ways to store data. This post provides some common forms in which data can manifest itself while using Python.

Luther and Educational Reform

Martin Luther (1483-1546) is best known for his religious work as one of the main catalysts for the Protestant Reformation. However, Luther was also a powerful influence on education during his lifetime. This post will take a look at Luther’s early life and his contributions to education

Early Life

Luther was born during the late 15th century. His father was a tough miner with a severe disciplinarian streak. You would think that this would be a disaster but rather the harsh discipline gave Luther a toughness that would come in handy when standing alone for his beliefs.

Upon reaching adulthood Luther studied law as his father diseased for him to become a lawyer. However, Luther decided instead to become a monk much to the consternation of his father.

As a monk, Luther was a diligent student and studied for several additional degrees. Eventually, he was given an opportunity to visit Rome which was the headquarters of his church. However, Luther saw things there that troubled him and in many laid the foundation for his doubt in the direction of his church.

Eventually, Luther had a serious issue with several church doctrines. This motivated him to nail his 95 theses onto the door of a church in 1517. This act was a challenge to defend the statements in the theses and was actually a common behavior among the scholarly community at the time.

For the next several years it was a back forth intellectual battle with the church. A common pattern was the church would use some sort of psychological torture such as the eternal damnation of his soul and Luther would ask for biblical evidence which was normally not given. Finally, in 1521 at the Diet of Worms, Luther was forced to flee for his life and the Protestant Reformation had in many was begun.

Views on Education

Luther’s views on education would not be considered radical or innovative today but they were during his lifetime. For our purposes, we will look at three tenets of Luther’s position on education

  • People should be educated so they can read the scriptures
  • Men and women should receive an education
  • Education  should benefit the church and state

People Should be Educated so they Can Read the Scriptures

The thought that everyone should be educated was rather radical. By education, we mean developing literacy skills and not some form of vocational training. Education was primarily for those who needed it which was normally the clergy, merchants, and some of the nobility.

If everyone was able to read it would significantly weaken the churches position to control spiritual ideas and the state’s ability to maintain secular control, which is one reason why widespread literacy was uncommon. Luther’s call for universal education would not truly be repeated until Horace Mann and the common school. movement.

The idea of universal literacy also held with it a sense of personal responsibility. No one could rely on another to understand scripture. Everyone needs to know how to read and interpret scripture for themselves.

Men and Women Should be Educated

The second point is related to the first. Luther said that everyone should be educated he truly meant everyone. This means men and women should learn literacy. The women could not hide behind the man for her spiritual development but needed to read for herself.

Again the idea of women education was controversial at the time. The Greeks believed that educating women was embarrassing although this view was not shared by all in any manner.

WOmen were not only educated for spiritual reasons but also so they could manage the household as well. Therefore, there was a spiritual and a practical purpose to the education of women for Luther

Education Benefits the Church and the State

Although it was mentioned that education had been neglected to maintain the power of the church and state. For Luther, educated citizens would be of a greater benefit to the church and state.

The rationale is that the church would receive ministers, teachers, pastors, etc. and the state would receive future civil servants. Therefore, education would not tear down society but would rather build it up.


Luther was primarily a reformer but also was a powerful force in education. His plea for the development of education in Germany led to the construction of schools all over the Protestant controlled parts of Germany. His work was of such importance that he has been viewed as one of the leading educational reformers of the 16th century.

Logarithmic Models

A logarithm is the inverse of exponentiation. Depending on the situation one form is better than the other. This post will explore logarithms in greater detail.

Converting Between Exponential and Logarithmic Form

There are times when it is necessary to convert an expression from exponential to logarithmic and vice versa. Below is an example of who the expression is rearranged form logarithm to exponential.


The simplest way to explain I think is as follows

  • for the logarithm, the exponent (y) and the base (a) are on opposite sides of the equal sign
  • For the exponent form, the exponent (y) and base (a) are on the same side of the equal sign.

Here is an example using actual numbers1.png

As you can see the exponent 3 and the base 2 are on opposite sides of the equal sign for the logarithmic form but er together for the exponential form.

When the base is e (Euler’s Number) it is known as a natural logarithmic function. e is the base rate growth of a continual process. The application of this is limitless. When the base is ten it is called a common logarithmic function.

Logarithmic Model Example

Below is an example of the application of logarithmic models

Exposure to noise above 120 dB can cause immediate pain and damage long-term exposure can lead to hearing loss. What aris the decimal level of a tv with an intensity of 10^1 watts per square inch. 

First, we need the equation for calculating the decibel level.


Now we plug in the information into the word problem for I and solve


Our tv is dangerously loud and should include a warning message.  We dropped the negative sign because you cannot have negative decibel level.


Logarithms are another way to express exponential information and vice versa. It is the situation that determines which to use and the process of concert an expression from one to another is rather simple. In terms of solving actual problems, it is a matter of plugging numbers into an equation and allowing the calculator to work that allows you to find the answer.

Education During the Reformation

By the 16th century, Europe was facing some major challenges to the established order of doing things. Some of the causes of the upheaval are less obvious than others.

For example, the invention of gunpowder made knights useless. This was significant because now any common soldier could be more efficient and useful in battle than a knight that took over ten years to train. This weakened the prestige of the nobility at least temporarily while adjustments were made within the second estate and led to a growth in the prestige of the third estate who were adept at using guns.

The church was also facing majors issues. After holding power for almost 1000 years people began to chaff at the religious power of Europe. There was a revival in learning that what aggressively attacked by monks, who attacked the study of biblical languages accusing this as the source of all heresies.

The scholars of the day mock religion as a superstition. Furthermore, the church was accused of corruption and for abusing power. The scholars or humanists called for a return to the Greek and Romans classics, which was the prevailing worldview before the ascension of Catholicism.

Out of the chaos sprang the protestant reformation which rejects the teachings of the medieval church. The Protestants did not only have a different view on religion but also on how to educate as we shall see.

Protestant Views of Education

A major tenet of Protestantism that influenced their view on education was the idea of personal responsibility. What this meant was that people needed to study for themselves and not just listen to the teacher. In a spiritual sense that meant reading the Bible for one’s self. In an educational sense, it meant confirming authority with personal observation and study.

Out of this first principal springs two other principles which are education that matches an individual’s interest and the study of nature. Protestants believed that education should support the natural interest and ablities of a person rather than the interest of the church.

This was and still is a radical idea. Most education today is about the student adjusting themselves to various standards and benchmarks developed by the government. Protestants challenged this view and said education should match the talents of the child. If a child shows interest in woodworking teach this to him. If he shows interest in agriculture teach that to him.

To be fair, attempts have been made in education to “meet the needs” of the child and to differentiate instruction. However, these goals are made in order to take a previously determined curriculum and make it palpable to the student rather than designing something specifically for the individual student. The point is that a child is more than a cog in a machine to be trained as a screwdriver or hammer but rather an individual whose value is priceless.

Protestants also support the study of nature. Be actually observing nature it reduced a great deal of the superstition of the time. At one point, the religious power of Europe forbade the study of human anatomy through the performing autopsies. In addition, Galileo was in serious trouble for denying the geocentric model of the solar system. Such restrictions stalled science for years and were removed through Protestantism.


The destabilization that marks the reformation marks a major break in history. With the decline of the church came the rise of the common man to a position of independent thought and action. These ideas of personal responsibility came from the growing influence of Protestants in the world.

Secular Education During the Middle Ages

The Middle Ages (500-1500 CE) is often viewed as a low point in the world of education. This was a time a strong superstition among people and a lack of scientific progress.

The European world was divided into three classes or estates which were the Priest, Nobility, and lastly, everyone else. These were the three estates. The Priestly estate held significant power over the other two estates. The priests would use the psychological terror of removal from having access to the sacraments of the church to maintain power.

When an individual was denied the sacraments it was called excommunication, when a region loss access to the sacraments it was called an interdict, final if an entire province or kingdom was denied the sacraments war was then declared and this was called a crusade.

There were two common forms of education below the university and these were the Knightly schools and the Burgher schools.

Knightly Schools

Knightly schools trained boys to become knights. The training was divided into 3 segments of seven years each. The first segment was from 0-7 years of age under the care of the mother. From ages 7-14, the boy would live with another knight perhaps as a page. The third stage from 14-21 had the boy serving as a squire. At the age of 21, a young man was declared a knight.

The subjects taught in the KNightly practicum focused on the physical, artistic, and strategic. Music, chess, manners, poetry, and military training were all part of the curriculum. There was almost no intellectual training but an obsession with practical learning.

Burgher Schools

Burgher Schools were for tradesmen and artisans and provided a basic education. The subject taught included reading, writing, and arithmetic as well as geography, history, natural science, and Latin.

THere was a constant power struggle between commoners and the priest for control of these schools. Locals wanted to control these schools themselves. However, technically only the church had permission to teach. This resulted in alternating back and forth in terms of control.

Teachers in these schools were paid almost nothing and traveled from school to school as vagrants. Teaching was not seen as a noble profession at this time thus having a powerful effect on the quantity and quality of education.


Education in the Middle Ages was designed to meet the needs of the three estates. People would often attend school corresponding to their rank in society. This system had an air of stability until rapid social changes brought about the decline of this system.

Expontial Models

There are times when we want to understand growth that is not constant. An example of this would be the growth of a virus. As time goes by the virus growth rate increases more and more. Another example would be in the world of finance when we are dealing with interest.

In situations like the ones mentioned above, it is critical to understand the use and application of exponential models. This post will go through examples of the use of exponential models.

Finance Example

One common exponential model in finance is for compounded interest. The equation is as follows…


Below is a simple word problem that calls for this equation

You invest $10,000 in a mutual fund to prepare for retirement. The interest rate is 5% compounded monthly, how much will be in the account when you plan to retire in 25 years. 

Below is what we now

  • balance = ?
  • principal = $10,000
  • rate = 0.05
  • years=  25
  • times in year = 12 * 25 = 300

Now, we simply plug this information into the equatiom to get the answer.


The answer is shown above. The initial investment would grow to almost $35,000 dollars over 25 years.

Continuous Growth

In some fields, such as the life sciences, you want to now the growth of a virus or bacteria. Unlike in finance where the balance grows several times a year,  a bacteria is growing continuously. This leads to a slightly different exponential model as shown below.


e is an irrational number that serves as the base. With this information, we can address the problem below

A student starts their experiment with 10 bacteria. He knows the bacteria grow 100% every hour. He will come back and check in 12 hours. How many bacteria will he find?

Here is what we know

  • final size =?
  • initial size = 10
  • rate = 1/hour
  • time = 12

We plug this into the equation to get the answer


As you can see, the growth of the bacteria is almost incomprehensible in such a short time. This is the power of exponential growth.


Exponential models provide another way to find answers to questions people have. Whether the growth is over a certain number of times or continuously the model can be adjusted to deal with either of this situations.

Monastic Schools

During the early Middle Ages (500-1000 CE) monastic schools began to take shape and heavily influence education. Their influence was felt for over a millennia providing education directly or indirectly to a countless number of people.


The monastic schools grew out of the philosophy of Asceticism. Asceticism is the belief in a life of severe self-denial from the viewpoint that the body was evil. Practitioners of asceticism would forego marriage, financial gain, and most earthly pursuits, in order to focus on spiritual development usually in isolation. This a strong reaction to the non-Christian world’s focus on eating a drinking

There were two common ways to follow Asceticism. Hermits would often live in nearly complete isolation to pursue spiritual development. Monks, on the other hand, practice asceticism as well but would stay near communities of people in order to provide spiritual care for others. In addition, monks would live together in monasteries to support and encourage each other. Of course, at least in the past, monks were only men. Women could become nuns if they desired to live in similar conditions among women.

The largest order of monks was the Bendectin Order. The monasteries served as an asylum for the oppressed, as a missionary station, and most importantly as a preserver of knowledge.


The curriculum of the monastic schools consisted of the 7 liberal arts. These seven subjects can be broken into two categories, which are the trivium and the quadrivium.

The Trivium consisted of three subjects which were Latin, logic, and rhetoric. Latin was the lingua Franca of the Chuch at the time so its grammar was taught extensively. Logic was derived from the ideas of Aristotle and included deductive and inductive reasoning. Rhetoric is another term for public speaking and this was studied for the purpose of developing communication skills.

The quadrivium consisted of four subjects which were arithmetic, geometry, astronomy, and music. Many of the subjects are not studied as they are today. Arithematic study the mysterious or gnostic properties of numbers. Geometry was studied superficial and of little use. Astronomy was treated almost the same as astrology.

However, music was studied for the purpose of worship. The chants that the monks sang came to be called Gregorian chants named after Pope Gregory who had the chants codified. This is some of the earliest written version of western music. The notational system was different from modern notation using four lines instead of five and use squares instead of ovals to indicate notes.

The significance of Gregorian chants cannot be overestimated as they laid the foundation for modern music. Chants in the halls of monasteries provided the beginnings of most music found today.


Radical views in terms of the body led to the idea of asceticism. From this focus on self-denial comes the idea of living among like-minded people in monasteries. While in monasteries the monks would pursue education for personal development. This led to the liberal arts curriculum that is still used in part to this day.