Effective PyCharm Transcripts
Chapter: The Editor
Lecture: Working with the editor demo: Listing episodes
0:00 We've come a long way with our app and we've seen some really cool features but
0:04 boy bar there more to go.
0:05 Let's keep it exploring. So over here let's come back to the top here I
0:10 realized I haven't called print header yet and then we're going to download some things.
0:14 So let's see here's our podcast downloader and there's the episode being printed out but we
0:19 don't really need to do that do we?
0:23 What we'd like to do is we would like to show the details.
0:27 So let's go over and say show titles or something like that.
0:31 Now PyCharm just like it would add download info to service.
0:35 It's going to do the same but for locally so come down here and say show
0:38 titles now this totally works. But remember my philosophy I like this high level main
0:43 function at the top so I'm gonna put this below down here.
0:48 All right so now we want to show the titles now that we've downloaded some items
0:52 that's going to mean some more functions for our service.
0:55 Let's start by getting the lowest and the highest episode number.
0:59 So we'll say I'll call this start it's going to be something will say
1:08 Something like that. And then again 'cmd+d' because I'm going to write something so similar
1:14 and max these don't exist until we hit.
1:19 'Alt+enter' and then they do and because we store this in a dictionary and the
1:25 dictionary has the ID's
1:27 right there as the episode ID's.
1:29 all we have to do is say we're going to return in this
1:32 case the min of episodes dot check out all the dictionary.
1:36 Auto complete. Fantastic what we want are the keys and same thing I want to
1:41 have basically the same functions to highlight this 'cmd+d'.
1:44 Changed the min's to max and we'll be all golden.
1:48 Be a little reformatting. Perfect.
1:52 But these are looking good and then we just want to loop over these items so
1:58 we'll say we're gonna start at the beginning range from start and this is a non
2:04 inclusive end. So I'm gonna do a plus one right there and that will give
2:08 us all the numbers from start to end.
2:10 My integers inclusive. And then I'll just get the episode we'll go to our service
2:15 and right one final function. Get details.
2:19 Passing the episode id
2:20 It doesn't exist it takes a parameter we alt to enter it now we
2:26 have a function. Get details with a guest at the parameter name.
2:30 That seems decent. And here we can just return episodes.
2:35 Get now we could it's a dictionary.
2:37 We could try it like this style episode I'd but if it's not there it's going
2:41 to crash and I'd rather return none and just say you know I got no details
2:45 so we're gonna do a get(episode_id) and I think we're about good to go
2:50 So let's just print out a couple of things.
2:53 We're going to print out a cool little f string and let me show you something
2:55 amazing about f strings and PyCharm.
2:59 Remember f strings? We go like this,
3:00 we put an F at the beginning and we say something and then we can go
3:04 right, let's see and we can put like the end or some variable in
3:08 here. So that's standard. But what's amazing is so often I'll get to this
3:14 part and realize, oh this should have been an F string back,
3:16 back, back, back back F forward,
3:18 forward forward. It's quite annoying.
3:20 So here's the cool thing come over here.
3:23 I'm going to say I would like to print out something to do with variable or
3:28 whatever. So we'll put a number and then we'll put the id out there and
3:32 let's try that type parentheses,
3:34 nothing's happening. But if I start to type it will auto complete.
3:38 If I don't pick anything, it'll just keep going as a regular string.
3:41 But if I pick out of this list,
3:43 it automatically makes it an F string.
3:45 Beautiful. What I want is id.
3:47 Now there's another thing that's not super fun notice there's no help here,
3:52 there's no information about what this is.
3:54 We'll fix that in a moment.
3:55 Okay, so this is going to be,
3:58 I think I'll say 'episode.title'.
4:01 Clean things up. We call on the show titles we are.
4:05 I think this might work. Let's give it a run.
4:08 Oh fantastic. Look at that.
4:11 How cool is that? We got it totally working.
4:13 There's all the great episodes we've done over the past five years incredible.
4:18 And Data science and Docker. But here's the episode id we parsed out here is
4:24 the here's the actual title. Maybe make a little more obvious by putting it like
4:31 uh this something like that. Fantastic little app,
4:38 cool features. We've got our F strings,
4:40 we've got creating this local function,
4:44 all kinds of good stuff. We're able to do with this part of our editor demo