WEBVTT

00:00:00.000 --> 00:00:02.880 align:middle line:90%
[SQUEAKING]

00:00:02.880 --> 00:00:04.320 align:middle line:90%
[RUSTLING]

00:00:04.320 --> 00:00:07.200 align:middle line:90%
[CLICKING]

00:00:07.200 --> 00:00:09.927 align:middle line:90%


00:00:09.927 --> 00:00:11.510 align:middle line:84%
MICHAEL SCOTT ASATO
CUTHBERT: Hello, I

00:00:11.510 --> 00:00:16.200 align:middle line:84%
want to give a sense of how some
problem sets are going to work

00:00:16.200 --> 00:00:17.760 align:middle line:90%
or the majority of the time.

00:00:17.760 --> 00:00:22.550 align:middle line:84%
Generally speaking, you'll be
given some instructions on what

00:00:22.550 --> 00:00:25.580 align:middle line:84%
to do like, write a routine
that takes a string representing

00:00:25.580 --> 00:00:28.530 align:middle line:84%
an enharmonic with
minus sign for flats--

00:00:28.530 --> 00:00:31.640 align:middle line:84%
we'll talk about that in a bit
--and number sign for sharps

00:00:31.640 --> 00:00:35.540 align:middle line:84%
and return a new string
that is an enharmonic--

00:00:35.540 --> 00:00:38.120 align:middle line:84%
you're not allowed to
change it, but I can here.

00:00:38.120 --> 00:00:42.090 align:middle line:84%
That is an enharmonic
of the pitch.

00:00:42.090 --> 00:00:44.130 align:middle line:84%
You will be given
valid input only.

00:00:44.130 --> 00:00:48.770 align:middle line:84%
I will always tell if you have
to check for invalid input.

00:00:48.770 --> 00:00:50.910 align:middle line:84%
If there's more than
one valid enharmonic,

00:00:50.910 --> 00:00:53.670 align:middle line:84%
you can give any enharmonic
up to double flats or sharps.

00:00:53.670 --> 00:00:59.330 align:middle line:84%
Then below, you're going to be
given the name of the routine

00:00:59.330 --> 00:01:01.490 align:middle line:84%
that you're going to
need to write, along

00:01:01.490 --> 00:01:07.280 align:middle line:84%
with usually the name of a
variable that you should use

00:01:07.280 --> 00:01:10.190 align:middle line:84%
and the type, if you haven't
looked at Python typing,

00:01:10.190 --> 00:01:14.855 align:middle line:84%
this can be really
exciting, and what's output.

00:01:14.855 --> 00:01:19.170 align:middle line:84%
At this point, you need
to define the routine.

00:01:19.170 --> 00:01:22.640 align:middle line:84%
Quite often, you can
take some of the language

00:01:22.640 --> 00:01:25.160 align:middle line:84%
from above but make
it in your own words

00:01:25.160 --> 00:01:28.580 align:middle line:90%
and to see what happens.

00:01:28.580 --> 00:01:32.930 align:middle line:84%
But put it in the active
voice, takes in a string

00:01:32.930 --> 00:01:35.750 align:middle line:90%
representing a pitch--

00:01:35.750 --> 00:01:38.690 align:middle line:84%
sorry, I should say
representing a pitch earlier

00:01:38.690 --> 00:01:48.130 align:middle line:84%
--and returns a valid
enharmonic for it.

00:01:48.130 --> 00:01:51.260 align:middle line:90%


00:01:51.260 --> 00:01:55.070 align:middle line:84%
If there's specific
things that constrain

00:01:55.070 --> 00:01:58.440 align:middle line:84%
what the valid input might be,
I'll tend to write it here,

00:01:58.440 --> 00:02:00.980 align:middle line:90%
or you should be writing it in.

00:02:00.980 --> 00:02:05.790 align:middle line:84%
We write for humans to read, not
just for computers to process.

00:02:05.790 --> 00:02:07.730 align:middle line:84%
So it's always going
to be important

00:02:07.730 --> 00:02:13.940 align:middle line:84%
that your code be documented
and that your variable names be

00:02:13.940 --> 00:02:16.620 align:middle line:84%
things that humans
can understand.

00:02:16.620 --> 00:02:21.660 align:middle line:84%
OK, so then you can go
ahead and write your code.

00:02:21.660 --> 00:02:24.720 align:middle line:84%
And if you're a
not-so-great programmer,

00:02:24.720 --> 00:02:32.480 align:middle line:84%
maybe you'll start with if
enharmonis_in is E flat--

00:02:32.480 --> 00:02:38.300 align:middle line:84%
we're going to use minus signs
for flat --return D sharp,

00:02:38.300 --> 00:02:40.800 align:middle line:90%
otherwise, return C sharp.

00:02:40.800 --> 00:02:47.270 align:middle line:84%
And at least maybe it'll get
it right sometimes, great.

00:02:47.270 --> 00:02:52.470 align:middle line:84%
Now, I will sometimes give
you one or two test cases.

00:02:52.470 --> 00:03:00.980 align:middle line:84%
So maybe I'll say, assert
flip_enharmonic E flat

00:03:00.980 --> 00:03:03.920 align:middle line:90%
equals G sharp.

00:03:03.920 --> 00:03:06.500 align:middle line:90%
And you see that that works.

00:03:06.500 --> 00:03:11.810 align:middle line:84%
Maybe, if I'm very nice,
I'll give you two of them.

00:03:11.810 --> 00:03:14.780 align:middle line:84%
Up, and you can see
that doesn't work.

00:03:14.780 --> 00:03:23.110 align:middle line:84%
I am not going to give you all
of the interesting and fun test

00:03:23.110 --> 00:03:23.990 align:middle line:90%
cases.

00:03:23.990 --> 00:03:27.230 align:middle line:84%
Part of the thought
process of this class,

00:03:27.230 --> 00:03:29.470 align:middle line:84%
part of why you get
Humanities credit,

00:03:29.470 --> 00:03:32.660 align:middle line:84%
is that you need to
be thinking about,

00:03:32.660 --> 00:03:34.280 align:middle line:90%
well, what are the weird cases?

00:03:34.280 --> 00:03:37.550 align:middle line:84%
OK, I can put in if
it's this, it's E flat.

00:03:37.550 --> 00:03:40.930 align:middle line:84%
And if it's D sharp,
it's E flat, and so on.

00:03:40.930 --> 00:03:46.933 align:middle line:84%
Oh, but maybe I need to
make sure that this works.

00:03:46.933 --> 00:03:49.750 align:middle line:90%


00:03:49.750 --> 00:03:58.090 align:middle line:84%
Or maybe I need to make
sure that that works,

00:03:58.090 --> 00:04:00.790 align:middle line:84%
or at least that it's
a valued answer, huh.

00:04:00.790 --> 00:04:05.500 align:middle line:84%
And so part of what
you need to do,

00:04:05.500 --> 00:04:09.075 align:middle line:84%
is be thinking about how
do we write test code, what

00:04:09.075 --> 00:04:11.200 align:middle line:84%
are the test cases that
Professor Cuthbert is going

00:04:11.200 --> 00:04:15.920 align:middle line:84%
to be putting in, such that it's
going to challenge how I write?

00:04:15.920 --> 00:04:21.010 align:middle line:84%
You'll probably need to
rewrite your code as you go.

00:04:21.010 --> 00:04:23.490 align:middle line:90%
Great, let's get started.

00:04:23.490 --> 00:04:26.000 align:middle line:90%