Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
outLab5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sanjna
outLab5
Commits
af47c419
Commit
af47c419
authored
Sep 19, 2020
by
Sanjna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload new file
parent
112d5f08
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
q6/q6.py
q6/q6.py
+44
-0
No files found.
q6/q6.py
0 → 100644
View file @
af47c419
class
BlackMoneyHolder
:
## write your code here
def
__init__
(
self
,
name
,
accounts_info
):
self
.
name
=
name
self
.
accounts_info
=
accounts_info
if
(
type
(
self
.
name
)
!=
str
or
self
.
name
==
""
or
self
.
name
==
None
):
raise
Exception
(
'Name not String or is None or is empty'
)
if
(
type
(
self
.
accounts_info
)
!=
dict
):
raise
Exception
(
'Accounts_info not Dictionary'
)
self
.
newlist
=
sorted
(
self
.
accounts_info
.
items
())
def
update_amount
(
self
,
bnkname
,
bnkamt
):
self
.
accounts_info
.
update
({
bnkname
:
bnkamt
})
def
total_black_money
(
self
):
totamt
=
0
;
for
v
in
self
.
accounts_info
.
values
():
totamt
+=
v
return
totamt
def
__lt__
(
self
,
other
):
return
self
.
total_black_money
()
<
other
.
total_black_money
()
def
__eq__
(
self
,
other
):
return
self
.
total_black_money
()
==
other
.
total_black_money
()
def
__gt__
(
self
,
other
):
return
self
.
total_black_money
()
>
other
.
total_black_money
()
def
__str__
(
self
):
strop
=
""
for
y
in
sorted
(
self
.
accounts_info
):
strop
=
strop
+
y
+
': '
+
str
(
self
.
accounts_info
[
y
])
+
"
\n
"
return
strop
def
__len__
(
self
):
return
len
(
self
.
accounts_info
)
def
__getitem__
(
self
,
index
):
self
.
newlist
=
sorted
(
self
.
accounts_info
.
items
())
z
=
tuple
(
self
.
newlist
[
index
])
return
z
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