Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kurs_alx_pcz
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
kurs_alx_pcz
Commits
f30c91ba
Commit
f30c91ba
authored
Dec 01, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
magiczne metody
parent
37505baf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
grupa_szkoleniowa.py
dzien7/magiczne_metody/grupa_szkoleniowa.py
+29
-0
magiczne_metody.py
dzien7/magiczne_metody/magiczne_metody.py
+1
-0
No files found.
dzien7/magiczne_metody/grupa_szkoleniowa.py
0 → 100644
View file @
f30c91ba
class
GrupaSzkoleniowa
:
def
__init__
(
self
,
nazwa_szkolenia
):
self
.
nazwa_szkolenia
=
nazwa_szkolenia
self
.
osoby
=
set
()
def
dodaj_osobe
(
self
,
osoba
):
self
.
osoby
.
add
(
osoba
)
def
__str__
(
self
):
return
f
'Na szkoleniu {self.nazwa_szkolenia} są osoby {", ".join(self.osoby)}'
def
__add__
(
self
,
other
):
wynik
=
GrupaSzkoleniowa
(
self
.
nazwa_szkolenia
+
' i '
+
other
.
nazwa_szkolenia
)
wynik
.
osoby
=
self
.
osoby
|
other
.
osoby
return
wynik
grupa1
=
GrupaSzkoleniowa
(
'Python'
)
grupa1
.
dodaj_osobe
(
'Kasia'
)
grupa1
.
dodaj_osobe
(
'Tomek'
)
grupa2
=
GrupaSzkoleniowa
(
'Java'
)
grupa2
.
dodaj_osobe
(
'Kasia'
)
grupa2
.
dodaj_osobe
(
'Jurek'
)
print
(
grupa1
)
print
(
grupa2
)
print
(
grupa1
+
grupa2
)
dzien7/magiczne_metody/magiczne_metody.py
View file @
f30c91ba
...
...
@@ -39,3 +39,4 @@ suma = liczba1 + liczba2
print
(
'suma:'
,
suma
,
'typu'
,
type
(
suma
))
print
(
suma
==
Liczba
(
8
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment