Upload files to "HW"
This commit is contained in:
53
HW/HW.py
Normal file
53
HW/HW.py
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
## shape class
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from os import name
|
||||||
|
|
||||||
|
|
||||||
|
class Shape:
|
||||||
|
|
||||||
|
def __init__(self, name:str)-> None:
|
||||||
|
self._name: str = name
|
||||||
|
self._area: float = 0.0
|
||||||
|
|
||||||
|
|
||||||
|
def getArea(self) -> float:
|
||||||
|
return self._area
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def setArea(self)-> float:
|
||||||
|
self._area = area
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def getName(self) -> str:
|
||||||
|
self._name = name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def__eq__(self,other:Shpae) -> bool:
|
||||||
|
if not isinstance(shape):
|
||||||
|
return False
|
||||||
|
return self._name == other._name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
s1 = Shape("S1")
|
||||||
|
s2 = Shape("S2")
|
||||||
|
s3 = Shape("S3")
|
||||||
|
|
||||||
|
print(s1)
|
||||||
|
print(s2)
|
||||||
|
print(s3)
|
||||||
|
|
||||||
|
if __name__=="__main__":
|
||||||
|
main()
|
||||||
8
HW/pyvenv.cfg
Normal file
8
HW/pyvenv.cfg
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
home = /usr/local/bin
|
||||||
|
implementation = CPython
|
||||||
|
version_info = 3.14.2.final.0
|
||||||
|
virtualenv = 20.31.2
|
||||||
|
include-system-site-packages = false
|
||||||
|
base-prefix = /Library/Frameworks/Python.framework/Versions/3.14
|
||||||
|
base-exec-prefix = /Library/Frameworks/Python.framework/Versions/3.14
|
||||||
|
base-executable = /Library/Frameworks/Python.framework/Versions/3.14/bin/python3.14
|
||||||
7
HW/test.py
Normal file
7
HW/test.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
def factorial(n):
|
||||||
|
if n==0:
|
||||||
|
return 1
|
||||||
|
product = n*factorial(n-1)
|
||||||
|
return product
|
||||||
|
|
||||||
|
print(factorial(3))
|
||||||
Reference in New Issue
Block a user