This file contains 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
var exec = require('child_process').exec; | |
var fs = require('fs'); | |
var path = require('path').resolve('.'); | |
exports.createBackup = function (credentials, options, callback) { | |
if ("dbName" in options && "path" in options) { | |
exec("pgrep mongod", function (err) { | |
if (err) { |
This file contains 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
def is_leap(year): | |
leap = True | |
if year%4 != 0 or (year%100 == 0 and year%400 != 0): | |
leap=False | |
return leap |
This file contains 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
if __name__ == '__main__': | |
n = int(input()) | |
# print(*range(1, n+1)) | |
for i in range(1, n+1): | |
print(i, end='') |
This file contains 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 sys | |
if __name__ == '__main__': | |
a = int(input()) | |
b = int(input()) | |
c = int(input()) | |
n = int(input()) | |
print([[x,y,z] for x in range(a + 1) for y in range(b + 1) for z in range(c + 1) if x + y + z != n]) |
This file contains 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 operator import itemgetter | |
if __name__ == '__main__': | |
students=[] | |
lowest_score=0; | |
for _ in range(int(input())): | |
name = input() | |
score = float(input()) | |
students.append([name, score]) | |
#get minimum value of nested list |
This file contains 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 math | |
if __name__ == '__main__': | |
n = int(input()) | |
student_marks = {} | |
for _ in range(n): | |
name, *line = input().split() | |
scores = list(map(float, line)) | |
student_marks[name] = scores | |
query_name = input() |
This file contains 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
ms = [int(x) for x in input().split()] #main_set (ms) | |
ms.sort() | |
n = int(input()) #no of sub/other lists | |
os=False | |
for i in range(n): | |
ss = [int(y) for y in input().split()] #taking other list as input | |
if len(ss) > 0 and len(ss) <= len(ms): | |
ss.sort() | |
os = set(ms).issuperset(set(ss)) | |
print(os) |
This file contains 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, m) = map(int, input().split()) #take input in n , m | |
h=0; | |
a = map(int, input().split())#take array as input | |
A = set(map(int, input().split())) #take array as input and create SET | |
B = set(map(int, input().split()))#take array as input and create SET | |
for el in a: | |
if el in A: | |
h += 1 | |
elif el in B: | |
h -= 1 |
This file contains 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
# METHOD 1 | |
n = int(input())#take input in n | |
a = set() | |
for i in range(n): | |
ci = input() | |
if ci not in a: | |
a.add(ci) | |
print(len(a)) | |
# METHOD 2 |
This file contains 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()) | |
s = set(map(int, input().split())) | |
o = int(input()) | |
for i in range(o): | |
op = input().split() | |
if(op[0] == "pop"): | |
if len(s)>0: | |
s.pop() | |
elif(op[0] == "remove"): |
OlderNewer