This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
//-------------------- ABSTRACT INTERFACES -------------------- | |
type WaterAbsorber interface { | |
Pour(num int) | |
TotalLiquid() int | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from dataclasses import dataclass | |
from typing import List | |
@dataclass | |
class Item: | |
id: int | |
name: str |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add(x=None): | |
if x is None: | |
return getattr(add, 'result', 0) | |
else: | |
if hasattr(add, 'result'): | |
add.result += x | |
else: | |
setattr(add, 'result', x) | |
return add |