Python Challenges: Are your grades really *that* good?


English (Auto-generated)

and welcome back. So today we have a problem that some of you guys might face and some of you guys don't really care. But grades or points or whatever you call them. So you did a test you passed it. Everything is good and stuff. But you want to know if you did better than the average of your classmates, right? So what we're gonna do here is get the out of our goal here is first of all to get the average points of all of them, including ours, which aren't currently included in class points. So we're gonna have to add them at some point. And aside from that, if we did better than average, we're gonna return true and if not we're going to return false. Okay. So the first thing I want to do is when you do averages that kind of work like this where you get the sum of all the grades and then divide them by the number of students say five and then that gets you grab. Okay. Okay. So what we're gonna do first since class point is in a way of all the about the points of all the students were going to do is length len of class points and that's just gonna basically give us how many students divided by. Um, and then what we're also going to do right here is have a variable ready for some the points and right now I'm just going to equal zero. Okay, perfect. So now what we're gonna do is four points. Once again, um, this can be any name, but we just want to give us the most logical name for points in class police we wanted to do is some of the points plus equals points. Okay. Pretty self explanatory right now and now what we're gonna do is find out if it's if we did better than average or not. So this give me a sec if some of points, sorry, if some, oh, pro leagues is divided by five x 5 by length, it's greater than you're right. Mm hmm. Oh my God. My spelling is so often it okay if some points via the length is greater than your points return false because that means that you did not do better than average. Also return true. Perfect. Okay. So now we're gonna test this out really great and let's do this frank. Are you really good? And then class points array, let's do 85 75 90 and 51 of the one of them. Pretty bad. Okay. And then let's give us an egg. We should get true at this point. So we're gonna do Python three. The name of our. Are you really That good? I can get it wrong? name I apologize for that and it returns true. Now let's give it a situation where it returns false. We're gonna make this like 30 just to make sure these are pretty good grades but let's get them even higher. Just put this one at 80 and this one brandy. Okay. And now it should return false and it returns false perfectly. Um This is a pretty simple and clean way that I did it, but as always I encourage you guys to re factor or clean up as much as possible. Send them to me. I can even try to use some of the solutions, explain them in the video, however you guys want to do it and yeah, thank you so much for watching this video and to intern The next one. I hope you guys enjoyed this one.
21 Views 1 Likes 0 Comments

You got a test, did it, passed it, but did you do better than average of all your classmates scores?

Leave a comment (supports markdown format)