Created
October 23, 2019 10:30
-
-
Save mekdie/51fd3987a10b8c2da0aa8b9bf168b516 to your computer and use it in GitHub Desktop.
Mcdony_PythonCode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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