Skip to content

PALINGAM (AUG17) [PYTHON] #219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed

Conversation

amitXsarkar
Copy link

@amitXsarkar amitXsarkar commented Oct 5, 2017

Fixes #212

  • Pull Request Title is of form Problem Code (Contest Code) [Language].
  • This problem already had an entry in this repository.
    • This solution is better than the one already in this repository.
  • This solution is prepared by me and not copied from anywhere else on the web.
  • I have added a copyright comment in my solution.
  • I have updated README.md file (in appropriate order).
  • I have read and followed Code Samples.
  • I understand that pull request will be closed if I failed to update it even once in a week.

@aashutoshrathi
Copy link
Member

Hi! Thanks for contributing to this repository.
Make sure you have checked points in PR correctly.

@amitXsarkar
Copy link
Author

what is travis checking and why does it fail if my code passed all test cases?

@aashutoshrathi
Copy link
Member

Add Spaces around Binary Operator.

@Monal5031
Copy link
Member

Duplicate of #200 ?

@@ -0,0 +1,37 @@
#Code Copyright: Amit Sarkar, Computer Science Engineering 2nd Year, BIT Mesra
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code does not comply to PEP8.

Origin: PEP8Bear, Section: pep8.

The issue can be fixed by applying the following patch:

--- a/tmp/tmpq19l0tf7/2017/AUG/AUG17/PALINGAM/PALINGAM.py
+++ b/tmp/tmpq19l0tf7/2017/AUG/AUG17/PALINGAM/PALINGAM.py
@@ -1,4 +1,4 @@
-#Code Copyright: Amit Sarkar, Computer Science Engineering 2nd Year, BIT Mesra
+# Code Copyright: Amit Sarkar, Computer Science Engineering 2nd Year, BIT Mesra
 t = input()
 
 while ( t > 0 ) :

a = raw_input()
b = raw_input()

na = len(a)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code does not comply to PEP8.

Origin: PEP8Bear, Section: pep8.

The issue can be fixed by applying the following patch:

--- a/tmp/tmpq19l0tf7/2017/AUG/AUG17/PALINGAM/PALINGAM.py
+++ b/tmp/tmpq19l0tf7/2017/AUG/AUG17/PALINGAM/PALINGAM.py
@@ -1,37 +1,37 @@
 #Code Copyright: Amit Sarkar, Computer Science Engineering 2nd Year, BIT Mesra
 t = input()
 
-while ( t > 0 ) :
-	a = raw_input()
-	b = raw_input()
-	
-	na = len(a)
-	nb = len(b)
-	
-	lpa = []
-	lpb = []
-	for i in range(26):
-		lpa.append(0)
-		lpb.append(0)
-	k2 = ord('a')
-	for i in range(na):
-		lpa[ ord( a[i] ) - k2 ] = lpa[ ord( a[i] ) - k2 ] + 1
-	for i in range(nb):
-		lpb[ ord( b[i] ) - k2 ] = lpb[ ord( b[i] ) - k2 ] + 1
-	flag = 0
-	c1 = 0
-	c2 = 1
-	for i in range(26):
-		if ( lpa[i] >= 2 ) and (lpb[i] == 0 ):
-			flag=1
-		if ( lpa[i] != 0 ) and ( lpb[i] == 0 ):
-			c1 = 1
-	if( c1 == 1 ):
-		for i in range(26):
-			if ( lpb[i] != 0 ) and ( lpa[i] == 0 ):
-				c2 = 0
-	if ( flag == 1 ) or ( ( c1 == 1 ) and ( c2 == 1 ) ):
-		print "A"
-	else:
-		print "B"
-	t=t-1
+while (t > 0):
+    a = raw_input()
+    b = raw_input()
+
+    na = len(a)
+    nb = len(b)
+
+    lpa = []
+    lpb = []
+    for i in range(26):
+        lpa.append(0)
+        lpb.append(0)
+    k2 = ord('a')
+    for i in range(na):
+        lpa[ord(a[i]) - k2] = lpa[ord(a[i]) - k2] + 1
+    for i in range(nb):
+        lpb[ord(b[i]) - k2] = lpb[ord(b[i]) - k2] + 1
+    flag = 0
+    c1 = 0
+    c2 = 1
+    for i in range(26):
+        if (lpa[i] >= 2) and (lpb[i] == 0):
+            flag = 1
+        if (lpa[i] != 0) and (lpb[i] == 0):
+            c1 = 1
+    if(c1 == 1):
+        for i in range(26):
+            if (lpb[i] != 0) and (lpa[i] == 0):
+                c2 = 0
+    if (flag == 1) or ((c1 == 1) and (c2 == 1)):
+        print "A"
+    else:
+        print "B"
+    t = t-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PALINGAM (AUG) [PYTHON]
3 participants