Advertisement
Guest User

python code

a guest
Oct 23rd, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. listempt = []
  2. while True:
  3.     x = input("Do you want to add more numbers? y/n: ")
  4.     if x== 'y':
  5.         number = input("the list is :")
  6.         listempt.append(int(number))
  7.         continue
  8.     else:
  9.         break
  10. tuplelist = []
  11. for i in range(len(listempt)):
  12.     for j in range(i+1,len(listempt)):
  13.         if (listempt[i] + listempt[j]) % 2 != 0 and (listempt[i] * listempt[j]) % 2 == 0:
  14.             tuplelist.append((listempt[i], listempt[j]))
  15. print("The list of tuple pair whose sum is an odd number and product is an even number is :", tuplelist)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement