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
b11d4ea5
Commit
b11d4ea5
authored
Sep 19, 2020
by
Sanjna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload new file
parent
a5f56989
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
q5/q5.py
q5/q5.py
+27
-0
No files found.
q5/q5.py
0 → 100644
View file @
b11d4ea5
import
sys
n
=
int
(
input
())
i
=
0
#-------------------to print dict of matches
match
=
{}
while
i
!=
n
:
matchdict
=
sys
.
stdin
.
readline
()
.
strip
()[:]
i
+=
1
k
,
v
=
matchdict
.
split
(
':'
)
v
=
dict
((
x
.
strip
(),
y
.
strip
())
for
x
,
y
in
(
element
.
split
(
'-'
)
for
element
in
v
.
split
(
','
)))
match
[
k
]
=
v
print
(
match
)
#------------to print the dict of total of each player
matchlist
=
{}
for
key
,
value
in
match
.
items
():
for
k
,
v
in
value
.
items
():
matchlist
[
k
]
=
matchlist
.
get
(
k
,
0
)
+
int
(
v
)
#-------------to convert above dict in list of tuples and then to sort it
tpl
=
[(
s
,
t
)
for
s
,
t
in
matchlist
.
items
()]
tpl
.
sort
(
key
=
lambda
tup
:
tup
[
0
])
print
(
tpl
)
\ No newline at end of file
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