This file contains hidden or 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
| from itertools import combinations | |
| s,k=input().split(' ') | |
| s=list(s) | |
| s.sort() | |
| for i in range(1,int(k)+1): | |
| for j in list(combinations(s,i)): | |
| print(*j, sep='') |
This file contains hidden or 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
| from itertools import permutations | |
| s,k = input().split(" ") | |
| per = permutations(sorted(s), int(k)) | |
| [print (*i, sep="") for i in per] |
This file contains hidden or 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
| from itertools import product | |
| A=list(map(int,input().split())) | |
| B=list(map(int,input().split())) | |
| print(*product(A,B)) | |
| ******************************************* | |
| A = map(int,raw_input().split()) |
This file contains hidden or 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
| import cmath | |
| a = complex(raw_input()) | |
| print abs(complex(a)) | |
| print cmath.phase(complex(a)) |
This file contains hidden or 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
| a = set(map(int, raw_input().split())) | |
| for i in range (int(input())): | |
| b = set(map(int, raw_input().split())) | |
| answer = set(b - a) | |
| if(len(answer)) == 0: | |
| if len(a) > len(b): | |
| ans = "True" | |
| else : ans = "False" | |
| print ans |
This file contains hidden or 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
| for i in range(int(input())): | |
| a = int(input()); A = set(input().split()) | |
| b = int(input()); B = set(input().split()) | |
| if(len(A.difference(B))==0): | |
| print("True") | |
| else: | |
| print("False") |
This file contains hidden or 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
| from collections import Counter | |
| input() | |
| print {v: k for k, v in Counter(map(int, raw_input().split())).iteritems()}[1] |
This file contains hidden or 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
| N = int(input()) | |
| A = set(map(int, input().split())) | |
| k = int(input()) | |
| for i in range(k): | |
| command = input().split() | |
| S = set(map(int, input().split())) | |
| if command[0] == 'intersection_update': | |
| A.intersection_update(S) |
This file contains hidden or 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
| a = int(input()) | |
| x = set(map(int, input().split())) | |
| b = int(input()) | |
| y = set(map(int, input().split())) | |
| z = x.symmetric_difference(y) |
This file contains hidden or 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
| a = int(input()) | |
| x = set(map(int, input().split())) | |
| b = int(input()) | |
| y = set(map(int, input().split())) | |
| z = x.difference(y) |