## Starting a Matrix in Python

I started working with a 2-dimensional array in Python with my students today. We first covered a basic table on paper with the letters of the alphabet populating the cells so they could read index coordinates.

We then moved to the problem. On the first day of this assignment, we worked to create an 11 X 4 table that holds information of the teams that formed the FIRST Tech Challenge El Dorado League of North Texas for the 2017/2018 Relic Recovery season.

26-February-2018 – Matrix Day 1 Data – Sheet1

This is a visual representation of the data we worked with today.

```w = 4
h = 11
teams = [[0 for x in range(w)] for y in range(h)]```

Here, we declared an integer variable named “w” and another named “h” and assigned the values 4 and 11 respectively. This represents the width and height of the array we are building.

On line 3, we create the array named teams and using a nested for loop, create the array that is 4 columns wide and 11 rows tall. The table is currently populated with zeros.

```teams[0][0] = "127"
teams[1][0] = "5443"
teams[2][0] = "9402"
teams[3][0] = "9403"
teams[4][0] = "10143"
teams[5][0] = "11085"
teams[6][0] = "11242"
teams[7][0] = "12645"
teams[8][0] = "12650"
teams[9][0] = "12992"
teams[10][0] = "13915"```

These lines are populating column 0 (first column) of the array with the team numbers of the 11 different FTC teams in the league. Please note that it only goes up to 10 since we start counting at 0.

```teams[0][1] = "The Fighting Pickles"
teams[1][1] = "Synergy"
teams[2][1] = "Hive of Steel"
teams[3][1] = "CyberSwarm"
teams[4][1] = "Bit & Bots"
teams[6][1] = "ERROR 451"
teams[7][1] = "S.C.R.E.W. Ups"
teams[8][1] = "Cannot Compute"
teams[9][1] = "Vindicators"
teams[10][1] = "Eagles Robotics"```

These lines are populating column 1 (second column) of the array with the team names.

```teams[0][2] = "Ben Barber Innovation Academy"
teams[1][2] = "Harmony School of Innovation"
teams[2][2] = "Henderson Junior High School"
teams[3][2] = "Henderson Junior High School"
teams[4][2] = "Harmony School of Innovation"
teams[5][2] = "Mansfield High School"
teams[6][2] = "Ferris High School"
teams[7][2] = "Ferris High School"
teams[8][2] = "Ferris Junior High School"
teams[9][2] = "Italy High School"

These lines are populating column 2 (third column) of the array with the schools each team represents.

```teams[0][3] = "Mansfield, TX"
teams[1][3] = "Ft. Worth, TX"
teams[2][3] = "Stephenville, TX"
teams[3][3] = "Stephenville, TX"
teams[4][3] = "Ft. Worth, TX"
teams[5][3] = "Mansfield, TX"
teams[6][3] = "Ferris, TX"
teams[7][3] = "Ferris, TX"
teams[8][3] = "Ferris, TX"
teams[9][3] = "Italy, TX"
teams[10][3] = "Waxahachie, TX"```

These lines are populating column 3 (fourth column) of the array with the hometowns of each team.

```print(teams[0])
print(teams[1])
print(teams[2])
print(teams[3])
print(teams[4])
print(teams[5])
print(teams[6])
print(teams[7])
print(teams[8])
print(teams[9])
print(teams[10])```

These lines will print each of the 11 rows on a separate line. There is no formatting, so the output will look similar to the following:

```Python 3.6.1 (default, Dec 2015, 13:05:11)
[GCC 4.8.2] on linux
['127', 'The Fighting Pickles', 'Ben Barber Innovation Academy', 'Mansfield, TX']
['5443', 'Synergy', 'Harmony School of Innovation', 'Ft. Worth, TX']
['9402', 'Hive of Steel', 'Henderson Junior High School', 'Stephenville, TX']
['9403', 'CyberSwarm', 'Henderson Junior High School', 'Stephenville, TX']
['10143', 'Bits & Bots', 'Harmony School of Innovation', 'Ft. Worth, TX']
['11085', 'Mad Hackers', 'Mansfield High School', 'Mansfield, TX']
['11242', 'ERROR 451', 'Ferris High School', 'Ferris, TX']
['12645', 'S.C.R.E.W. Ups', 'Ferris High School', 'Ferris, TX']
['12650', 'Cannot Compute', 'Ferris Junior High School', 'Ferris, TX']
['12992', 'Vindicators', 'Italy High School', 'Italy, TX']
['13915', 'Eagles Robotics', 'Faith Family Academy', 'Waxahachie, TX']```

In the next class, we’ll discuss how to display an individual index and use concatenation to format a better output. We’ll then move into adding additional data to the existing array for each team that will involve basic math.

## CS1 07-Feb-2018 to 13-Feb-2018

#### Lesson Name:

Women Pioneers in Computer Science

#### TEKS – §126.33 (Computer Science 1):

• c.1 – Creativity and innovation. The student develops products and generates new understandings by extending existing knowledge. The student is expected to:
• c.1.C – participate in relevant, meaningful activities in the larger community and society to create electronic projects.
• c.5 – Digital citizenship. The student explores and understands safety, legal, cultural, and societal issues relating to the use of technology and information. The student is expected to:
• c.5.E – investigate how technology has changed and the social and ethical ramifications of computer usage.

#### Lesson Objectives:

1. The student will be able to identify key women pioneers in the field of Computer Science
2. The student will be able to identify the contributions of women pioneers in the field of Computer Science

#### Materials Needed:

1. Group Assignments
2. Pioneers Assigned to Research

#### Description of Lesson:

Students will be assigned to groups and each group will be assigned a woman pioneer in Computer Science to research.

Each group will have two (2) full class sessions to develop a presentation about their assigned pioneer.

The presentation can be in any media the group chooses (PowerPoint, song, round table discussion, Socratic seminar, etc…). The presentations will be conducted on the 3rd day of the project.

• Major Grade – Project Presentation

## CS1 26-Jan-2018 to 05-Feb-2018

#### Lesson Name:

Iterative Loops Project in Python

#### TEKS – §126.33 (Computer Science 1):

• c.2 – Communication and collaboration. The student communicates and collaborates with peers to contribute to his or her own learning and the learning of others. The student is expected to:
• c.2.A – create and properly display meaningful output
• c.2.D – write programs with proper programming style to enhance the readability and functionality of the code by using meaningful descriptive identifiers, internal comments, white space, spacing, indentation, and a standardized program style
• c.4 – Critical thinking, problem solving, and decision making. The student uses appropriate strategies to analyze problems and design algorithms. The student is expected to:
• c.4.E – identify reusable components from existing code
• c.4.H – identify and debug errors
• c.4.I – test program solutions with appropriate valid and invalid test data for correctness
• c.4.J – debug and solve problems using error messages, reference materials, language documentation, and effective strategies
• c.4.U – demonstrate proficiency in the use of the relational operators
• c.4.V – demonstrate proficiency in the use of the logical operators
• c.6 – Technology operations, systems, and concepts. The student understands technology concepts, systems, and operations as they apply to computer science. The student is expected to:
• c.6.O – choose, identify, and use the appropriate data types for integer, real, and Boolean data when writing program solutions
• c.6.P – demonstrate an understanding of the concept of a variable
• c.6.V – compare and contrast strongly typed and un-typed programming languages

#### Lesson Objectives:

1. The student will demonstrate mastery of for loop programming in Python.
2. The student will demonstrate mastery of do loop programming in Python.
3. The student will demonstrate mastery of do while loop programming in Python.

#### Materials Needed:

1. Repl.it Access

#### Description of Lesson:

Students will be given 5 different problems to solve involving iterative loops. Students will be given 5 class periods to develop a solution to each of the given problems.

• Minor Grade – Solution to Problem 1 (50%) & Solution to Problem 4 (50%)
• Major Grade – Solution to Problem 2 (33%), Solution to Problem 3 (33%), & Solution to Problem 5 (33%)

## CS1 24-Jan-2018

#### Lesson Name:

Programming Iterative Loops in Python

#### TEKS – §126.33 (Computer Science 1):

• c.2 – Communication and collaboration. The student communicates and collaborates with peers to contribute to his or her own learning and the learning of others. The student is expected to:
• c.2.A – create and properly display meaningful output
• c.2.D – write programs with proper programming style to enhance the readability and functionality of the code by using meaningful descriptive identifiers, internal comments, white space, spacing, indentation, and a standardized program style
• c.4 – Critical thinking, problem solving, and decision making. The student uses appropriate strategies to analyze problems and design algorithms. The student is expected to:
• c.4.E – identify reusable components from existing code
• c.4.H – identify and debug errors
• c.4.I – test program solutions with appropriate valid and invalid test data for correctness
• c.4.J – debug and solve problems using error messages, reference materials, language documentation, and effective strategies
• c.4.U – demonstrate proficiency in the use of the relational operators
• c.4.V – demonstrate proficiency in the use of the logical operators
• c.6 – Technology operations, systems, and concepts. The student understands technology concepts, systems, and operations as they apply to computer science. The student is expected to:
• c.6.O – choose, identify, and use the appropriate data types for integer, real, and Boolean data when writing program solutions
• c.6.P – demonstrate an understanding of the concept of a variable
• c.6.V – compare and contrast strongly typed and un-typed programming languages

#### Lesson Objectives:

1. The student will demonstrate mastery of for loop programming in Python.
2. The student will demonstrate mastery of do loop programming in Python.
3. The student will demonstrate mastery of do while loop programming in Python.

#### Materials Needed:

1. Repl.it Access

#### Description of Lesson:

Students will cover hands-on how to create a for, do, and do while loop in Python. Further discussion on benefits and pitfalls of each iterative looping structure will be discussed.

• Daily Grade – Guided Practice Lesson File

## CS1 22-Jan-2018

#### Lesson Name:

Iterative Loops – Hands-On

#### TEKS – §126.33 (Computer Science 1):

• c.4 – Critical thinking, problem solving, and decision making. The student uses appropriate strategies to analyze problems and design algorithms. The student is expected to:
• c.4.U – demonstrate proficiency in the use of the relational operators
• c.4.V – demonstrate proficiency in the use of the logical operators

#### Lesson Objectives:

1. The student will demonstrate an understanding of the three main iterative looping structures (do, do while, and for).

#### Materials Needed:

1. Worksheets – 2018-01-22 – Hands-On with Iterative Loops

#### Description of Lesson:

Students will be given a list of physical instructions to repeat in an iterative pattern in a do, do while, and for loop. Students will perform the physical tasks the number of times the iterative instructions provide.

Students will then complete a worksheet using Python to solve for given iterative mathematical problems enclosed in various loop structures.

• Daily Grade – Participation in Physical Iterative Loops
• Daily Grade – Iterative Mathematical Problems

## CS1 16-Jan-2018

#### Lesson Name:

Casting Variables in Python

#### TEKS – §126.33 (Computer Science 1):

• c.2 – Communication and collaboration. The student communicates and collaborates with peers to contribute to his or her own learning and the learning of others. The student is expected to:
• c.2.A – create and properly display meaningful output
• c.2.D – write programs with proper programming style to enhance the readability and functionality of the code by using meaningful descriptive identifiers, internal comments, white space, spacing, indentation, and a standardized program style
• c.4 – Critical thinking, problem solving, and decision making. The student uses appropriate strategies to analyze problems and design algorithms. The student is expected to:
• c.4.E – identify reusable components from existing code
• c.4.H – identify and debug errors
• c.4.I – test program solutions with appropriate valid and invalid test data for correctness
• c.4.J – debug and solve problems using error messages, reference materials, language documentation, and effective strategies
• c.6 – Technology operations, systems, and concepts. The student understands technology concepts, systems, and operations as they apply to computer science. The student is expected to:
• c.6.O – choose, identify, and use the appropriate data types for integer, real, and Boolean data when writing program solutions
• c.6.P – demonstrate an understanding of the concept of a variable
• c.6.V – compare and contrast strongly typed and un-typed programming languages

#### Lesson Objectives:

1. The student will demonstrate mastery of casting variables as strings in Python.
2. The student will demonstrate mastery of working with strings and substrings in Python.

#### Materials Needed:

1. Repl.it Access

#### Description of Lesson:

Students will cover hands-on how to cast basic variables in Python and when casting may be necessary.

• Daily Grade – Guided Practice Lesson File

## CS1 11-Jan-2018

#### Lesson Name:

Variables in Python

#### TEKS – §126.33 (Computer Science 1):

• c.2 – Communication and collaboration. The student communicates and collaborates with peers to contribute to his or her own learning and the learning of others. The student is expected to:
• c.2.A – create and properly display meaningful output
• c.2.D – write programs with proper programming style to enhance the readability and functionality of the code by using meaningful descriptive identifiers, internal comments, white space, spacing, indentation, and a standardized program style
• c.4 – Critical thinking, problem solving, and decision making. The student uses appropriate strategies to analyze problems and design algorithms. The student is expected to:
• c.4.E – identify reusable components from existing code
• c.4.H – identify and debug errors
• c.4.I – test program solutions with appropriate valid and invalid test data for correctness
• c.4.J – debug and solve problems using error messages, reference materials, language documentation, and effective strategies
• c.6 – Technology operations, systems, and concepts. The student understands technology concepts, systems, and operations as they apply to computer science. The student is expected to:
• c.6.O – choose, identify, and use the appropriate data types for integer, real, and Boolean data when writing program solutions
• c.6.P – demonstrate an understanding of the concept of a variable
• c.6.V – compare and contrast strongly typed and un-typed programming languages

#### Lesson Objectives:

1. The student will demonstrate mastery of the integer, string, and floating variables.
2. The student will create a basic program that utilizes each of the covered variable types.

#### Materials Needed:

1. Repl.it Access

#### Description of Lesson:

Students will cover hands-on how to create a basic application in Python that utilizes integer, float, and string variables.

Students will create their own application in Python that utilizes integer, float, and string variables correctly.