Class

Homework 4

Create weather forecast Using weather data from KMA, write a code to produce weather outlook/statement that looks like the section, “Detailed Forecast” in NWS. Pick a region you want to make forecast. In addition to max/min temperature, please add a statement that compares it with the climatological values. Try to create your own class to do this job. Turn in the python file or jupyter notebook file by next Thursday. »

Introduction to Object

Python is an object oriented programming language. In fact, almost everything in Python is an object. Then what is an object? An object is a variable that has attached to it both data (attributes) and functions designed to act on that data (methods). So what does this mean? The key idea of objects is that variables shouldn’t be thought of as having only values (and type), but rather they should be thought of entities that can have any number of other things “attached” to them. »

Defining class

“Classes provide a means of bundling data and functionality together.” (from the Python documentation) We can define our own type of object by creating a new class that can carry attributes and methods to maintaining and modifying its state. When we define a new variable, we actually create a new instance of a class. For example, typing a = 'hello' creates an instance of a predefined string class. Likewise, we can create a new class instance that has the format of the class we defined. »