and welcome to Python for Java coders part 11. In this lesson, we'll look at classes and how to set up a class structure in Python. So first, I'm gonna take a look over here at Java. Again, I'm assuming you already know how Java works. I have created a class called Animal, and as a public class, I have a public int, a protected double, and a private string. I also have a static int, and then I have the constructor here. Again, I'm assuming you know these things. If you don't, this is not the tutorial for you. And I have a setter, a getter, and I have this other method, that a static method is to say, and I have the two string method. And I'm gonna show you how to do the equivalent code over here on Python. So basically, if you take a look down here, this is the output we're expecting, animals, three different ones. I've created just some runner code here, and I have three animals, Lucky, Gizmo, and Bella. They're three of the dogs in my life. And just basically print out some information to show how to interact with that class. So taking a look over here in Python, I'm gonna go ahead and hide this. Now real quick, if you wanna add a file to Reploit, you just click Add File, and it'll pop up, you can rename it, all that sort of thing. So I'm gonna go ahead and leave this open. I'll slide this over to give ourselves a little bit of extra room, so we can kind of see what's going on. See if I can get this over here. And my computer's not cooperating, there we go. Okay, I have to leave this open a little bit because I gotta switch back and forth between main and animal. So I'm gonna go over here to animal, and I'm gonna start making my class. I'm gonna type class animal. Now something interesting, notice how when I named my file, I kept it in lowercase, and I'm pretty sure that's the preferred way to do this. You might wanna check on that one, I'm not sure on that one. I don't do a lot of class stuff, I don't do a lot of separate file stuff in Python, so some of this a little bit, maybe a little iffy, but this'll get you through. And then I'm gonna put some blank parentheses. Note, if you are using Python 2, which you shouldn't be, you'll have to put object in here. But otherwise in Python 3, which you should be on, we don't do that. Just like everything else in Python, we use colons, we don't use curly braces. And I'm gonna make my first variable, number of animals. Again, I'm using snake casing equals zero. Now notice how I skipped these three, okay? And this is one of the differences that you'll see here in Python. Is when I create my constructor, I'm gonna put all of this into the constructor. So my constructor is not named the same as the class. So this is a big difference. So I'm gonna type def, because it's a normal function, just like anything else, a normal method. I'm gonna type not one, but two underscores, i-n-i-t, and two underscores. I'm gonna put self, and I'll explain that in a moment, and name. And again, colon, and we use the indentation. So if you look over here, we've got the class name, but here we don't do that. We just put double underscore in it and double underscore afterwards, okay? This is the constructor, this is how you build a constructor in Python. So you can see here how we've got this.name equals name. So in Python, the equivalent is self, and I also have to put self here, okay? What this tells us is that this is not a static method. It is connected to an actual object, okay? So self.name equals name, okay? So that is the basic structure of our constructor. Now, as I mentioned earlier, we didn't have these things here, but we're gonna put them in here. So I'm gonna put int age. Again, we don't have to declare types in Python, but I do have to use self, self.age equals zero in this case. Self.weight equals, say zero plus zero, we don't know it yet. And self.name, we already done self.name, okay? Now, a couple things. I'm gonna put these in this order just to make it a little bit more clear. Self.age, notice over here it is public. In Python, if we wanna make something public, we don't do anything, it's just public by default. We don't have to worry about it. Protected, to make something protected, we put one underscore before the variable name. Very interesting. Nothing after, just one before. And private is going to be two underscores. That's how we know it is public, protected, or private. Now, Python's not quite as strict as Java. You could still technically access a protected variable from outside the class, but it's not a good idea. And here in private it will shoot up an error, I believe. Now, we have this here. Now, Java already knows that this is a static variable. So we don't have to do anything special here, we just say number of animals plus plus. Python's a little different. I'm gonna have to actually type the name of the class. And remember, there is no plus plus in Python, it's plus equals one. So that is the equivalent constructor and class variable set up we have in Java versus Python. So again, just to kind of review, the instance variables are gonna be attached to each object, go inside the constructor. The constructor does not take the name of the class. Takes two underscores before and two underscores after. And then if we wanna do something with a static variable, we declare it outside of the initializer, outside of the constructor, and then we use the class name. There may be other ways to do this, but this is the way that I know how to do it. So now let's take a look at our methods. So we have public void set weight double new weight. Now, Python, we don't have to add all the public private stuff, we're just gonna do this. We're just gonna do def, it's always define, set weight. Notice I use camel casing, I use underscores, or sorry, I use snake casing and underscores, not camel casing. And new weight colon, and I just say self.weight. Oops, weight is protected, so I have to underscore equals new, oops, I screwed it up today, weight. It's hard going back and forth. Now it would work again, it's just a convention thing. Then I wanna do my getter, get weight, there's nothing inside there. I'm going to return self.self is roughly equivalent to this, so probably if you think about it as this, it'll probably help you. Now in this case, we're working on the class variable, not the instance variable. So I'm gonna, oh, I did make a mistake there, sorry, I forgot about that. I have to put self in here. You must put self. If it is dealing with an instance variable or instance method, something that is attached to an object, we gotta use self. In this case, where it isn't, we're gonna say def and increment number of animals, and we put that blank. And then what I'm gonna say here is, same thing, animal dot number of animals plus equals one. Okay, so I'm just gonna go ahead and run that and see if anything happens, see if anything errors. Okay, so far so good. And then the final thing that I wanna do here is to straight. Again, I don't need public, I'm gonna define the method. And in Python, it's not called two string, this becomes no surprise. It's double underscore, S-T-R, double underscore. And I'm gonna type self. And it works exactly the same after that. I just return what I want it to be. So I'm gonna go ahead and copy this and change it. Okay, so I'm gonna return name and I'm gonna use the curly braces. And I'm going to use format, format. And again, here you have to remember to use self.double underscore name because it's private and self.single underscore because it is protected. I'm gonna run that just to make sure there's no errors, at least compilation time, compile time errors. Okay, that's good. All right, I'm happy with that. So now let's take a look at how we're going to interact with these. Before I do that real quick, notice how this method has a double underscore before and after, as does this. These are special methods that are kind of set into Python. So this tells you this is part of kind of the base Python, I guess, way it operates. I'm not quite sure how to put it. So if you see two before and two after, that is something that is from Python. Don't mess with that. Make sure you know what you're doing. So that is our class structure. And we've got our class variables. We've got our instance variables, public, protected, and private. And then we've got some methods. Any method that deals with the instances, you're gonna need self. You'll see an error if you don't use self. And another thing, I didn't do an example here, but if, for example, you wanted this to be protected, you would just put a single underscore before it. If you want it to be private, you would put a double underscore before it. So the same thing that goes for variables goes for methods, but we'll make those all public for now. Okay, now let's take a look at our runner code and take a look at our equivalent Java runner code. If I can get that back open, files. So we go to main and we start out with print. Animals, three different ones. Okay, now I'm gonna go ahead and I'm going to make my, I'm gonna make my objects. So I'm gonna say lucky equals animal, lucky. I'm gonna say gizmo equals animal, gizmo. And I'm gonna say bella equals animal. Let's go ahead and test this and see what happens. And we're gonna get an error and I'll tell you why in a second. Okay, so you see here it says animal is not defined. You know, in Java, if they're in the same folder, everything's gonna work out just fine. Python, it's not. We need to do, we need to actually import this. So keep in mind, the name of the file is animal.py. The class is animal with a capital letter. Okay, so here we use capitals. This is called Pascal casing and we do it that way. So what we gotta do is, before we do anything, we gotta type the following. From animal, okay, because this is animal.py, import animal. That's the capital letter class name. Okay, so it's the file name minus the dot py and then the class name. Now if I run it, I've got an error because I put a semicolon at the end of this thing. Okay, there we go, and format. Yeah, I think that'll fix it. So let's go over here. Okay, so now it's working, we're not getting any errors, which is what we like to see. So I'm gonna go ahead and copy this. Save a little time for everybody. I can't have weird indentation, it's gotta match. And of course it's set weight, set weight, and set weight. And then my next part is I'm gonna go ahead and print the number of animals, print, quote, number of animals, and I'm gonna do that format. And I'm gonna do animal dot number of animals. And what I'm just gonna do is I'm gonna do the same thing I did over here in Java. I'm just gonna print, lucky. I'm gonna print gizmo, I'm gonna print bella. Let's go ahead and test that. Okay, you can see we have basically the same output. So for the escape character there, so it's working exactly the same. And then the last thing is just to show you, basically this works the same in Python. So if I wanna increment the number of animals manually, I would say animal dot increment number of animals. And then I can just go ahead and copy that and print that out again. Well, that's probably not that useful, but it does illustrate the principle. So that is basically that. Structurally, they're very similar. But as you can see, there are a few key differences in the way the languages operate. In particular, with instance variables versus static variables and static methods and all that sort of thing. How you know something as static as far as methods is in Python at least, is you look for self. If it's self, you know it's probably not what we would consider static, because you need to have some sort of object passed along with that. But what's weird, and this confused me a lot, is you'll notice here lucky dot set weight 20.5. There's only one argument here. If I look over here, there's two. This self, and this is what confuses me even to this day sometimes, comes from here. This is the self, this is the second argument. First argument, second argument. First argument, second argument. Of course, Java actually probably makes a little bit more sense the way Java does it. So don't forget the self, that's one of the things I think people miss quite often when they make that transition. And yes, but I think otherwise everything works basically the same. And again, keep in mind that we don't use public private protected keywords, we use underscores, which is kind of weird. But it works pretty well, as I must say. So that is that, I think we'll stop there. And hopefully in a future lesson, we can continue on, talk a little bit about inheritance and a couple of other bit more advanced type things, okay? Have a great day, thanks for tuning in.


between the two disciplines, and there comes the concept of fusion. And fusion cannot take place in a day or two. It requires a lot of efforts, a lot of discussion, a lot of journey. And for that purpose, we need a forum. The Indian Science Communication Congress offers a forum to bring together the scientists, the journalists, the media persons, communicators, fiction writers, writers, literatures, and anyone who can contribute for the cause of science communication. Maybe a scientist, or a journalist, or a media person, or a person who is working in a bank with a science qualification, or a person working with a railway can also contribute to his or her might for science communication. So all are welcome for the common cause of bridging the gap between science and society. And I think this is the forum we have been continuing for the last nine years, and we hope to continue for the future as well, so that karma goes on to an expedition. And our idea is that every citizen of the country must have at least some common minimum knowledge of science. And that we call the minimum science, or we can term it science for all. So we are trying to define a certain level of minimum science that every Indian citizen must have, and through the mass media, be it print media, electronic media, digital media, folk media or even interactive media, we are trying to penetrate deeper into the society because media as a vehicle, media as a tool is very important for taking the message of science to the common man. Okay, vision is clear, efforts are clear, we are motivated, we are ready, but where is the problem? Why it is not taking place? What are the hurdles? Why everybody is not happy with the science coverage in media? Why everybody is still in this country, is running towards superstitious practices? Most of the people suffering from various diseases which are easily curable, more than 80% diseases are caused by unportable drinking water, everybody knows. Lacks of children, lots of common men, they are dying of petty diseases like jaundice, cholera, diarrhea, these are easily curable. Why it is not happening? What are the problems? When it comes to the science communication, only big things appear in our mind, like launch of satellite or some breakthrough or some nuclear something, something nanotechnology or something like that. But countries like India require more emphasis on the small science that is confronting to our day to day life like whatever drinking water, energy problems and so on. So, we were discussing the problems. One of the important problem is that the recognition of the field I was just discussing with Dr. Prof. Baruwa this afternoon. Those who are in science history, if they try to put their efforts for science communication or science writing or science journalism, their job is not considered to be serious. If a scientist, scientist generally expected to write a research paper, present a well researched work in the National International Conference, but when it comes to writing the newspaper, when it comes to giving a program on television, when it comes to giving a talk on radio, they are not recognized in their fraternity because that work is considered to be non-serious work. As a matter of fact, this is not the case in India. It's a world global phenomenon. It has not emerged today. Carl Sagan, a great physicist, when he started science writing or science popularization, science fiction writing, he was denied the Nobel, it is recorded, it is history. Similarly, I happen to meet a professor from France, Adoze, who won the International Kalinga Award for Science Communication by UNESCO and Kalinga Foundation of India. When I asked him, sir, when you joined the science communication business, he says after retirement, why, sir? Because now I don't want promotion. So, that is the case with the scientists. Now let us turn towards the journalists. I know many journalists in India and abroad, if they are in the main beat of journalism, main desk, they have all resources, all recognition, all power. But when it comes to science communication or science journalism, they are not recognized in their fraternity. Even I should not name a person, a person with Hindustan times, for the whole life, he worked as science journalist and he was denied his promotions. At the last warning came, you are going to be removed if you will not change your beat. Then he says, sir, what is the offer? You go to foreign beat. He happily joined that. Not happily, unhappily, but he became happy. Every month, he started going with prime minister, with some minister, some delegation. He was very happy. Every visit was able to reap him something like thousand dollars or so. Happy. Then he had to sacrifice science journalism. So these are the problems, recognition. Then another problem is language. Language of communication. Generally the scientists who are the custodians of the scientific knowledge, they tend to write research papers, which is not comprehensible to the common man. To make it comprehensible, a lot of efforts are required. Communication skills are required. Most of the scientists, they are well versed with technical communication, but when it comes to public communication of science, they feel it difficult. They find it difficult. But at the same time, when it comes to the journalist, most of the journalists, they come from non-science background, background, humanities background. They also find it difficult to understand and assimilate the scientific jargon. So there comes a great gap between the scientist and the journalist. That gap has to be braced. That is why we need a lot of science communicators and science enthusiasts all across the country. And the third problem is the local language. When it comes to communicating to the elite class, I think English is first. English is okay. But when it comes to communicating with the common man, people at the street, it becomes very difficult. So I think we have to, we need to use the local languages. Not only local language, but local dialects are required for science communication. And most of the scientists who are sitting at the ivory tower, they find it very difficult to speak in the people's language, language of the people at the street. So these are some of the problems. These are the issues which we require to discuss over here, to deliberate over here and to try to bring some, some kind of structure for where science and communication can meet together and the bridge between science and society can be created.


Under the Nigeria Centre for Disease Control has reported 64 new coronavirus cases in eight states and the FCT. Kaduna State led the chart for Tuesday with 23 new infections. This is of course higher than the 52 cases recorded a day earlier, raising the total infections in the country to 212,829. Eight new deaths were also recorded, bringing the death toll to 2,914, but more than 204,000 recoveries have been recorded to date.


It's the $60 million question. How does a teacher know when a student is ready to move from a surface learning approach to enacting deep learning strategies? The ability to self-regulate is key. Self-regulated learning refers to an independent and self-motivated process of acquiring knowledge and skills. Research suggests that students learn best when they have the ability to self-regulate. In fact, the degree to which students become self-regulators of their own learning influences academic success at school. These maturational changes are most prominent in the brain's frontal lobes which have long been associated with executive function. The executive functioning system is the control system of the brain that is responsible for regulating behavior and directing and controlling thinking activity to enable effective problem solving in both learning and social contexts. These skills enable us to stay focused, remember instructions, make plans, control impulses, and take on multiple tasks successfully. These skills depend on three types of brain function which are highly interrelated and which draw on elements of the other. Working memory. We can think of this as the engine of the attention control system. It controls our ability to retain and work with pieces of information over a short amount of time. If a learner has poor working memory function, the learner will have difficulty sustaining attention, will be susceptible to distraction, and will have difficulty performing other executive functions. These skills are crucial for learning and development and successfully negotiating social and educational contexts. They provide the link between early school achievement and social, emotional and moral development. When remaining focused is not important to the task at hand, the executive functioning system goes into standby. Mental flexibility is another brain function which determines our ability to sustain or shift our attention to different demands. Self-control is the ability to set priorities, resist impulsive responses, and monitor incorrect performance. We aren't born with these skills, but we can develop them with the right amount of nurturing and exposure. For young children, being in environments that provide the scaffolding of these skills is essential to healthy development. Both parents and teachers can establish routines, model appropriate social behavior, demonstrate supportive and reliable relationships. It is also important for children to have opportunities to exercise these developing skills through activities that foster creative play and social connection. Young children who do not have opportunities to use and strengthen these skills naturally fail to become proficient. Those who have problems staying focused and resisting distractions can only display difficulties in school but also have trouble following directions generally, and this extends into their adolescent and adult years. Studying, maintaining friendships, sustaining employment, or managing difficult situations will provide challenges. Although we are not born with these skills, we can first see signs of them around age two. By age three, most children can complete tasks that involve following two rules or actions and make deliberate choices. Five-year-olds have the ability to shift their attention from one rule to another and the capacity to block inappropriate responses. It is especially interesting to note that by age seven, some of the capabilities underlying executive function show distinct similarities to those in adulthood. As learners progress through the teenage and adolescent periods, they further develop self-control by switching between a central focus and peripheral stimuli and successfully adapt to changing rules in different contexts. But self-motivation tends to decrease with age. Since motivation is an important factor in self-regulation, this may be why early-to-mid adolescence is a period of vulnerability to problems with self-regulation. Gender differences in the skills for self-regulation are also apparent in school-age children. Girls have been found to be more conscientious, self-disciplined, have higher levels of academic self-efficacy, and more able to self-regulate than boys. Typically, girls are less impulsive and more capable of regulating their emotional expression. This influences the classroom dynamic as girls are consistently perceived by teachers as being more self-controlled and self-disciplined than boys. Gender aside, we do know that self-regulated learners display several features in their work. They develop their own goals and choose learning strategies to meet these goals. They employ techniques to monitor and evaluate their progress and modify their learning when necessary. They have the ability to self-regulate their behaviour, thoughts and emotions, which leads to sustained focus and attention. This includes being able to slow or impede behaviour, thoughts and emotions which do not contribute to learning. We know that motivation is a key sustainer of self-regulated learning, and with maturity comes a greater ability to self-regulate. However, being a self-regulated learner is somewhat influenced by the extent of external regulation by others, particularly in the classroom. The learning may be occurring in relation to predetermined goals set by the teacher, external examination of work and progress, and established learning strategies. Italy's first female doctor, Maria Montessori, developed an educational approach based on a constructivist model in the late 1800s. She recognised that self-regulation is an important indicator of healthy child development and that it could be enhanced over time. Her philosophy and methodology has strong foundations in children's self-regulation and independence. Students exercise a large degree of choice in Montessori classrooms, balanced with a degree of task structure. Developmentally appropriate materials are placed around the classroom for a variety of hands-on tasks which encourage planning and organisational skills, flow and concentration and task persistence. In noting children's capacity for being absorbed in a task or in a flow state, large periods of time are provided for children to develop sustained concentration and attention, which are important components of self-regulation. External rewards are not a feature of the Montessori approach. Instead, children in Montessori classrooms are intrinsically motivated to learn through the completion of the activities, filling a sense of pride, ownership and accomplishment. In working with older students and adults, Manik Burkhart's three-layered model of self-regulated learning examines three levels of self-regulation. Gertz, Net and Hall describe the regulation of processing modes as the level that focuses on the learner's ability to self-regulate according to desired learning outcomes and choosing the most appropriate learning strategies. The regulation of the learning process level relates to overall metacognitive processes and the coordination of cognitive strategies, including planning and monitoring. The outer level relates to regulation of the self, including the ability to choose current and future activities and to remain motivated when competing influences intervene. Burkhart suggests that successful self-regulation is dependent on competency in these three levels. The ability to be a self-regulated, independent and flexible learner in today's fast-paced, globalised and knowledge-based world is essential. Although some students exhibit difficulty with self-regulation, teachers can employ some very useful strategies to assist with developing independent learners. Firstly, teachers can assist students to set realistic yet challenging goals, encourage students to be cognizant of their own behaviour by observing and recording themselves for reflection, provide a range of instructions that students can give to themselves during the learning process, and model how to evaluate achievement and modify strategies and goals if necessary. Teachers should also provide frequent opportunities for students to practice self-regulating strategies and solve interpersonal problems. It's also important for teachers to improve their students' attentional readiness through techniques such as breathing and mindfulness. All of these strategies will lead to self-regulated deep learners in our classrooms.