mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
Modernize Python 2 code to get ready for Python 3
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from __future__ import print_function
|
||||
# Author: OMKAR PATHAK
|
||||
|
||||
# We can use Python's dictionary for constructing the graph
|
||||
@@ -15,7 +16,7 @@ class AdjacencyList(object):
|
||||
|
||||
def printList(self):
|
||||
for i in self.List:
|
||||
print(i,'->',' -> '.join([str(j) for j in self.List[i]]))
|
||||
print((i,'->',' -> '.join([str(j) for j in self.List[i]])))
|
||||
|
||||
if __name__ == '__main__':
|
||||
al = AdjacencyList()
|
||||
|
||||
@@ -12,6 +12,7 @@ Constraints
|
||||
Note: The tree input will be such that it can always be decomposed into
|
||||
components containing an even number of nodes.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
# pylint: disable=invalid-name
|
||||
from collections import defaultdict
|
||||
|
||||
@@ -66,4 +67,4 @@ if __name__ == '__main__':
|
||||
tree[u].append(v)
|
||||
tree[v].append(u)
|
||||
even_tree()
|
||||
print len(cuts) - 1
|
||||
print(len(cuts) - 1)
|
||||
|
||||
Reference in New Issue
Block a user