Hello and welcome back to let's code physics. This is our last episode for season one and it is our holiday special. So it looks like we had a halloween special, where I gave you the code to make a jack-o'-lantern.

Today I'll, be giving you the code to create a Christmas tree in the Python I've, set it up very similar to the code for the jack-o'-lantern, so there's. All these a preliminary stuff that's, set up so the interesting stuff for you, as the user starts at the line, labeled instructions, but basically we & # 39.

Ve got three things we can add to this Christmas tree. We can add ornaments. That's using the make or in command. We can you. We can create lights, that's using the make lights came in and we can create garland that's using the make garland command.

So the the the jacket Lantern jilda recall was written in spherical coordinates, so the all the action took place on the surface of the orange sphere. This time the Christmas tree is more of a cylinder.

So well it's, not quite a cylinder. It's, a cone, but it's closer to being a cylinder than it is being a sphere. So we're, going to be using cylindrical coordinates. So, instead of giving to angle, instead of giving a plane, angle and azimuthal angle, you're, going to give the angle around what you want, the thing to happen and the height at which you want it to happen.

And then the radius, the distance out from the central axis, is just given by the height. So let's. Take a look at what happens with the code. Is it's currently set up? I & # 39. Ve got a whole bunch of stuff commented out that we'll, be adding back in in just a second.

This is just sort of the basic tree. You get this nice green cone and then for every one of those make horn commands. You get an ornament currently there's only a few ornaments, but basically we can add more by.

Let me actually resize this guy. There we go so we can see the window there. We go so basically for every ornament. You want to add, you just add another may corn command, and basically you tell it where, in terms of the angle, you want it to go, so this is going around the tree in terms of radians.

The next argument is where you wanted to go in terms of height, that goes from 0 at the bottom to one at the top, and then this third argument gives you the gives you the radius of the ornaments of the size of the ornament and then the Last argument is the color that you wanted to have now.

You can use some of the predefined colors like colored up red, colored, yellow, colored, green or you can specify an RGB code and that's. What I've done in these last few, just to try out some of the different RGB codes.

So let's see so the top of our tree is looking a little bear up here. So let's. Maybe put this thing at about a 0.1 in terms of in terms of the rotation around the tree and let's. Put it let's, see so the highest one is at 0.

5. So this one's at point. Five, so let's, maybe put it at point. Seven. I'm. I'd like to keep them all the same radius. You can, you know, make the different radii. If you want and then for color, let's see this is RGB.

I don't have any blue up here. Yet so let's. Make this thing no red and some blue and let's, maybe put in a little bit of greens. We get a little bit of a teal going on ok cool, so we got whoops uh. I got my RGB confuse here and what that p.

0.1, this p1, there we go. The g in RGB stands for green. This one thing I've learned today. There we go there's, a bluish ornament. That looks wonderful, so we can add it another couple of ornaments, but you notice.

We had to guess there again, just like with the with the pumpkin with a jack-o'-lantern, I've added. This make grid command where it'll, put on to the tree these gridlines that you can use to figure out where your, where your positioning needs to be so let's, see I want to put one let's, Say down here in this corner, so I'm, going to say: make ornaments let's, see right around here! That's, a Phi of about one two, three four, so I think that's, something that's, reach point2, so that should be a 0.

8 it's got a height of two three four five. Six: seven, eight, nine okay. So each of these Heights is point one. So let's, give it a high 20.1 again the same radius and then a color of I see I've got red orange.

I don't. Have any yellow so let's, do color, yellow so that I don't have to embarrass myself by trying to create the RGB code for yellow there we go. We got our yellow ornament over in that corner. Just like we expected that looks, lovely doesn't it okay.

Now, of course, ornaments are not the only thing you place on a tree. We can also add Garland that's. What this make garland command does and it takes much of the same argument, so it starts out with uh.

Let me bring up the menu here. It starts out with what angle you want to start at, so this is where the garland is going to start along. The bottom of the tree d is the distance that you want between successive levels of the garland, so the Garland's going around in a spiral, so each level of the spiral is going to be separated by this distance D.

A call is going to be the color helz Lissa thats, the fancy word for whether something goes clockwise or counterclockwise, with negative 1 being counterclockwise. We can- on being clockwise and powder, the positive one being counterclockwise and then point 01, this thick here that's, the thickness of the garland itself.

So if i use this make garland command here, I get a garland of thickness point 01 relatively thick. I might decrease that one going around and it's. Just it's, just one. You know continuous loop going around.

So if I wanted to have a crisscrossing garland, I might what if I wanted to go in the opposite direction, I would make this a positive one and let's say I change this to yellow. Here we go and let's cut the thicknesses in half.

That seems a little bit thick to me. I don't know, so we should get identical to the previous one. Yep it's just going in the opposite direction, so that's, cool! Let's, see now. I am not as big a fan of Garland as I am of lights.

So let me show you what the make lights command does let's uncomment this one. So the garland makes a continuous string of these of color. The lights just adds a bunch of the make lights. Command just adds a bunch of spheres as the as the as the Christmas tree lights.

So the difference between these two is that the make garland command takes a single sphere and moves it around so that it it makes the trail going around while the make lights command just creates a bunch of spheres and it's really just using Them make ornament command.

These are the same things as the ornaments right. So personally, I'm, a bigger fan of light than garland and you can really um. You know you can add as many strings of lights as you want. I'm, going to add in a bunch of lights here by uncommon, ting, the stuff i went ahead and figured out all the numbers ahead of time.

So I'm just going to uncomment this region here and let's also turn off the grid, and this will be the this will be the final Christmas tree that we have for this video, oh yeah, that is just that is Just majestic isn't it the lights, get a little bit crowded at the top, so I may have gone overboard a little bit with the lights, but oh yeah, that is just that is gorgeous right there.

That is a sight to behold. So I invite you to take this code, you just open it using the Python I'll, have the instructions for installing the Python, as well as a link to the code in the description below? I would love to see you take.

This share us share with us the the Christmas tree you create using. You know you can share it in the comments below or you can tweet at. Let's code physics. You can also post it to our Facebook page.

The Twitter account seems to be more popular than the facebook page, so i tend to promote the twitter or more than the facebook. So, like i said earlier, this will be the last episode for season one. We got started in October and this has been a really good experience.

I want to thank all of you, our viewers and subscribers. If you are a viewer and not a subscriber, go ahead, click on the subscribe button below, if you're a subscriber, but not if you were not entirely sure how you're viewing this.

So I guess by definition you are a viewer if your subscriber not a regular viewer click on the Settings button next to the subscribe button and you can make sure to get updates on every single video that comes out and not just you know the weekly digest That YouTube sends out.

I learned a lot this season by setting up and and and starting this. This YouTube channel is definitely something I'm enjoyed. One thing I've learned - and this probably goes without saying, but I find I really love programming.

That might seem obvious since that's. What I'm, doing in front of you three times a week, but what I've learned in addition to that, because I already knew I liked programming. Otherwise I wouldn't have made the channel.

What I've learned is even if I'm, creating a code or solving a problem that I've done a hundred times before, like the Euler cromer method. I have done in-class over and over again I've done for my own simulations and grasped over and over again, and now I've done it on this channel.

You know over and over again even I'm doing something repeatedly. You know I enjoyed I like setting it up. I like seeing. Is there a different way i could set this up? Is there a different way? I could phrase what I'm doing.

Is there a different order? I could call things in a different way. I could graph it so i learned that you know i really enjoy just kind of toying around with all the different stuff. In this physics.

Programming um, I also learned I hate syncing, video and audio. So ever since I added this wonderful webcam window, I've, had to synchronize my audio in my video, because the recording lags just a little bit between between the two and I have to go in, and I have to separate the audio and video And remix the audio I mean I would do that anyway and then just ever so slightly lag the audio behind the video just a little bit in terms of the in terms of the time so that my mouth matches with the sounds that you hear most.

I hope it matches uh, but the the recording software I'm using does allow me to put in a delay - and I think I've - almost got the delay figured out to where I won't have to synchronize These things anymore, really hoping for that feel a wonderful Christmas present.

For me, I've, also learned. The third thing that I've learned is that the line between education and entertainment is become increasingly blurred. So, on channels like this on a let's, play channel on cgpgrey on number file computer file, all these you know sort of educational channels, and all these you know, educational podcasts that are that are out there in the internet um.

You know they are educating people and they are entertaining people, and the line between those two is becoming increasingly blurred in this in this in this world, that of the internet. That is increasingly audio-visual.

You know many of us have been around long enough to remember when the internet was mostly text and if you wanted pictures, you had to wait for it to load on your screen and just hope that nobody picked up the phone.

While you were trying to get your pictures loaded um, but I think this is, I think it's, a really good thing. You know, I think, that you know students are going to come in to high school and into college, hopefully seeing a and learning is something that they can enjoy and is something that can interest them, and I think that you know channels like this are a good Example of that, so those are the things that I & # 39.

Ve learned from this season would love to hear what you've learned from watching this season. Maybe something physics related something computer related, something just completely random. Let us know in the comments below or on twitter at let's.

Code physics would love to hear what you've learned from this experience, so this video will wrap up season 1 season 2 will begin sometime, late january, early februari and leaving that ambiguous, because i want to make sure i get some good planning and An upfront work done before before launching season 2.

In season 2, i'm, going to be taking a slightly different scheduling approach so for season one i tried to do a complete series at a time. Sometimes you know the they whoa between each other. You know a police chase took you know several weeks to complete with the video here and there.

But what I'd like to do is set up a more weekly schedule, where you can have a better idea. What to expect on mondays and wednesdays and fridays? What I'm thinking about doing now and don't hold me to this, because epiphanies have a way of happening over winter break, and so I might come up with a better idea.

But what I'm thinking about is on Mondays working my way through some in-depth, more advanced physics study. You know something i'm thinking, something quantum-mechanical, probably so something that goes a little bit deeper into physics learning.

Then then, you know turning through constant acceleration motion over and over again so Monday's would be an in-depth physics study, Wednesday & # 39. S would be trying to program something related to video game physics, something that comes up in video games.

A lot the inspiration for this channel was my brother's. Let's. Play channel Kyle blame plays. I'll leave a link to that in the description below you & # 39. Ve heard me promote that or see me promote that on Twitter, and pro hear me reference it a couple times and a lot of the fan base for this channel came from comes from the let's play community from me, posting this on reddit And a lot of people being interested in it.

Thank you to our redditors that bumped up my subscription numbers significantly within a week of the channel, launching very glad to have all of you, and so I want to pay tribute that I want to make sure to honor that you know I & # 39.

Ve got a lot of requests for how would you program this in video game or how do they do this in video game? So I want to start. You know looking at some things that are of interest in the physics world that happens in video games, so whens days would be video games.

I don't really have a good alliteration for that, except to mispronounce and call it wideo game wednesdays or video game fins days. But i'm a little bit afraid of being offensive with that. So i probably won't.

Do that and then fridays will be. I'll, keep it to some fun projects. So there's. Your litter ation there's, fun fridays fridays. I'd, like to keep it to fund projects. Things like the the red light no-win scenario.

Is there more? We can do with that? The police chase. Is there more? We can do it that you know the more. You know the sort of shorter term stuff so that, if your is, if somebody comes on new to the channel, they don't have to dive into the middle of something they can.

You know catch on and and enjoy something that lasts. You know just a couple of episodes, rather than getting involved with something that'll last several episodes, so that's. What I'm thinking about doing do, let me know your thoughts.

If there's, a problem, you'd like to see us work out or discuss, do leave a comment below or again tweet at let's code. Six would love to hear from you. Thank you so much for watching. This has been a really pleasurable experience for me, and I know for many of the viewers - and I am really looking forward to seeing what season to bring so have a wonderful holiday, enjoy your virtual Christmas tree, and I will see you next time.

Bye, bye,

OUR SOCIALS: