SHARE
TWEET

python code

a guest Oct 23rd, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top