Skip to content

Instantly share code, notes, and snippets.

@mekdie
Created October 23, 2019 10:30
Show Gist options
  • Save mekdie/51fd3987a10b8c2da0aa8b9bf168b516 to your computer and use it in GitHub Desktop.
Save mekdie/51fd3987a10b8c2da0aa8b9bf168b516 to your computer and use it in GitHub Desktop.
Mcdony_PythonCode
arr = input("Give a list of integer seperated by a comma (ex: 1,2,3,4,5): ")
arr = arr.split(",")
for i in range (len(arr)):
arr[i] = int(arr[i])
print("List of pairs whose product is even")
for i in range (0, len(arr)):
for j in range (i + 1, len(arr)):
check = arr[i]*arr[j]
if (check % 2 == 0):
print ("[", arr[i], ",", arr[j], "]")
print("")
print("List of pairs whose sum is odd")
for i in range (0, len(arr)):
for j in range (i + 1, len(arr)):
check = arr[i]+arr[j]
if (check % 2 == 1):
print ("[", arr[i], ",", arr[j], "]")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment