Facebook
From kush, 5 Years ago, written in Plain Text.
This paste is a reply to lists 15 from kush - view diff
Embed
Download Paste or View Raw
Hits: 455
  1. set1=list(map(str,input().split(',')))
  2. set2=list(map(str,input().split(',')))
  3. print('choice one option 1)add 2)remove 3)difference 4)intersection ')
  4. n=int(input())
  5. print('choice one 1)set1 2)set2')
  6. p=int(input())
  7. if(n==1):
  8.     st=str(input())
  9.     if(p==1):
  10.         a=set(set1)
  11.         a.add(st)
  12.         print("set("+str(list(sorted(a)))+")")
  13.     elif(p==2):
  14.         a=set(set2)
  15.         a.add(st)
  16.         print("set("+str(list(sorted(a)))+")")
  17.     else:
  18.         print('invalid choice')
  19. elif(n==2):
  20.     st=str(input())
  21.     if(p==1):
  22.         a=set(set1)
  23.         a.remove(st)
  24.         print("set("+str(list(sorted(a)))+")")
  25.     elif(p==2):
  26.         a=set(set2)
  27.         a.remove(st)
  28.         print("set("+str(list(sorted(a)))+")")
  29.     else:
  30.         print('invalid choice')
  31. elif(n==3):
  32.     if(p==1):
  33.         a=set(set1)
  34.         b=set(set2)
  35.         c=list(sorted(a.difference(b)))
  36.         print("set("+str(c)+")")
  37.     elif(p==2):
  38.         a=set(set1)
  39.         b=set(set2)
  40.         c=list(sorted(b.difference(a)))
  41.         print("set("+str(c)+")")
  42.     else:
  43.         print('invalid choice')
  44. elif(n==4):
  45.     if(p==1):
  46.         a=set(set1)
  47.         b=set(set2)
  48.         c=list(sorted(a.intersection(b)))
  49.         print("set("+str(c)+")")
  50.     elif(p==2):
  51.         a=set(set1)
  52.         b=set(set2)
  53.         c=list(sorted(b.intersection(a)))
  54.         print("set("+str(c)+")")
  55.     else:
  56.         print('invalid choice')

Replies to lists 19 rss

Title Name Language When
variables 6 kush text 5 Years ago.