Unit 6-04
Learning Outcome
Learning Outcome
At the end of this lesson, you will be able to:
- understand and use a structure with an Enumerated Type
Review
Review
- Structures
Lesson
Lesson
- go over Representing and Sorting Data, Chapter 6
- Computer Based Problem Solving
- "Enumerated Types inside ADT"
- go over Enums in ADT example from below
# Created by: Mr. Coxall
# Created on: Nov 2017
# Created for: ICS3U
# This program is an example of a structure with an enum
from enum import Enum
# an enumerated type of genders
Gender = Enum('Male', 'Female', 'Other')
class Student():
def __init__(self, first_name, last_name, gender, grade):
self.first_name = first_name
self.last_name = last_name
self.gender = gender
self.grade = grade
a_single_student = Student('Patrick', 'Coxall', Gender.Male, 13)
print (a_single_student.first_name + ' ' + str(a_single_student.grade) + ' ' + str(a_single_student.gender))
Activity
Activity
- null
Daily Assignment
Daily Assignment
- use your "Canada Post" program from last time and this time include "Enumerated Types" for:
- Street Type (just include your favorite five types)
- Provinces (include all 13, 2 character names)
Extra
Extra
- work on weekly assignment
Homework!
Homework!
- read over Representing and Sorting Data, Chapter 6
- Computer Based Problem Solving
- "An Array (or List) of ADTs"