Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions kangaroo.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,14 @@
else:
print "NO"

'''
This can be done in another way too
'''
# Another way to do the same thing. This takes less lines.
posDiff=x2-x1
velDiff=v1-v2

if v1>v2 and posDiff%velDiff ==0:
print "YES"
else:
print "NO"
11 changes: 11 additions & 0 deletions triangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@
print("valid")
else:
print("invalid")

'''
We can decrease lines by just using 'or' keyword in else section.
'''

else:
if ((int(l[0])+int(l[1]))%2==0) or ((int(l[0])+int(l[1])%2==0 )) or ((int(l[0])+int(l[1])%2==0 )) or (((int(l[0])+int(l[1]))%2==0)):
print("valid")
else:
print("invalid")