-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquestion.py
More file actions
35 lines (28 loc) · 945 Bytes
/
question.py
File metadata and controls
35 lines (28 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 16 17:26:34 2019
@author: stanford
"""
amount = input("How many numbers do you want to input: ")
numbers = []
for i in range(0, int(amount)):
number = input("Please enter an integer: ")
numbers.append(int(number))
#with order of pair and dupicate pair
for number1 in numbers :
for number2 in numbers:
if (number1 * number2) % 2 == 0 and (number1 + number2) % 2 != 0 :
print(number1,"--", number2)
#without duplicates and order
output = []
for number1 in numbers :
for number2 in numbers:
if (number1 * number2) % 2 == 0 and (number1 + number2) % 2 != 0 and (number1,number2) not in output:
output.append((number1, number2))
for pair1 in output:
for pair2 in output:
if pair1[0] == pair2[1] and pair1[1] == pair2[0]:
output.remove(pair2)
for pair in output:
print(pair)