55https://open.kattis.com/problems/cold
66"""
77
8+ # for Python 3.7 - 3.9 compatibility for type hinting of class methods
89from __future__ import annotations
910
1011__author__ = "Ram Basnet"
2021
2122
2223class Solution ():
23- """ Solution class to solve the problem using Singleton pattern"""
24+ """ Solution class to solve the problem using Singleton pattern. """
2425
2526 _instance : "Solution" | None = None
2627
@@ -37,7 +38,7 @@ def __new__(cls) -> "Solution":
3738 return cls ._instance
3839
3940 def __init__ (self ) -> None :
40- """ Constructor
41+ """ Constructor.
4142 """
4243 self ._n : int = 0 # number of temperatures
4344 self ._data : str = '' # data
@@ -61,15 +62,14 @@ def read_data(self, source: Any) -> None:
6162 Args:
6263 source (Any): stdin typically for kattis problem
6364 """
64- # ignore the first line
6565 data = source .readlines ()
6666 self ._n = int (data [0 ])
6767 self ._data = data [1 ].strip ()
6868 self ._temps = [Temperature (int (i )) for i in self ._data .split ()]
6969
7070 @property
7171 def n (self ) -> int :
72- """Returns the number of temperature readings
72+ """ Returns the number of temperature readings.
7373
7474 Returns:
7575 int: number of temperature readings
@@ -78,7 +78,7 @@ def n(self) -> int:
7878
7979 @property
8080 def data (self ) -> str :
81- """ Returns the data
81+ """ Returns the data.
8282
8383 Returns:
8484 str: data
@@ -90,7 +90,6 @@ def solve(self, source: Any) -> None:
9090 """
9191 self .read_data (source )
9292 print (self .find_answer ())
93- # sys.stdout.write('1')
9493
9594 @staticmethod
9695 def main () -> None :
0 commit comments