content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Solution:
"""
@param A: An array of Integer
@return: an integer
"""
def longestIncreasingContinuousSubsequence(self, A):
n = len(A)
if n < 2:
return n
longest = 0
conti = 1
for i in range(1, n):
if A[i] > A[i - 1]:
... | class Solution:
"""
@param A: An array of Integer
@return: an integer
"""
def longest_increasing_continuous_subsequence(self, A):
n = len(A)
if n < 2:
return n
longest = 0
conti = 1
for i in range(1, n):
if A[i] > A[i - 1]:
... |
LMS8001_REGDESC="""
REGBANK ChipConfig 0x000X
REGBANK BiasLDOConfig 0x001X
REGBANK Channel_A 0b00010000000XXXXX
REGBANK Channel_B 0b00010000001XXXXX
REGBANK Channel_C 0b00010000010XXXXX
REGBANK Channel_D 0b00010000011XXXXX
REGBANK HLMIXA 0x200X
REGBANK HLMIXB 0x201X
REGBANK HLMIXC 0x202X
REGBANK HLMIXD 0x203X
REGBANK... | lms8001_regdesc = '\n\nREGBANK ChipConfig 0x000X\nREGBANK BiasLDOConfig 0x001X\nREGBANK Channel_A 0b00010000000XXXXX\nREGBANK Channel_B 0b00010000001XXXXX\nREGBANK Channel_C 0b00010000010XXXXX\nREGBANK Channel_D 0b00010000011XXXXX\nREGBANK HLMIXA 0x200X\nREGBANK HLMIXB 0x201X\nREGBANK HLMIXC 0x202X\nREGBANK HLMIXD 0x20... |
km=float(input('Quantos km percorridos: '))
d = float(input('Quantos dias alugado: '))
pago = (d * 60) + (km * 0.15)
print('o total a pagar: r$ {} '.format(pago))
| km = float(input('Quantos km percorridos: '))
d = float(input('Quantos dias alugado: '))
pago = d * 60 + km * 0.15
print('o total a pagar: r$ {} '.format(pago)) |
username ="username" #your reddit username
password = "password" #your reddit password
client_id = "personal use script" #your personal use script
client_secret = "secret" #your secret
| username = 'username'
password = 'password'
client_id = 'personal use script'
client_secret = 'secret' |
# Solution for day2 of advent of code
origValues = list(map(int, open('day2/input.txt').readline().rstrip().split(',')))
print(origValues)
def getOpCode(values, codeAndArgumentWidth, numberOfCodesEvaluated):
currentOpCodeIndex = getCurrentOpCodeIndex(values, codeAndArgumentWidth, numberOfCodesEvaluated)
retu... | orig_values = list(map(int, open('day2/input.txt').readline().rstrip().split(',')))
print(origValues)
def get_op_code(values, codeAndArgumentWidth, numberOfCodesEvaluated):
current_op_code_index = get_current_op_code_index(values, codeAndArgumentWidth, numberOfCodesEvaluated)
return int(values[currentOpCodeInd... |
site = 'ftp.skilldrick.co.uk'
webRoot = '/public_html'
localDir = '.' #by default use current directory
remoteDir = 'tmpl'
ignoreDirs = ['.git', 'fancybox', 'safeinc']
ignoreFileSuffixes = ['.py', '.pyc', '~', '#', '.swp',
'.gitignore', '.lastrun',
'Makefile', '.bat', 'Thumb... | site = 'ftp.skilldrick.co.uk'
web_root = '/public_html'
local_dir = '.'
remote_dir = 'tmpl'
ignore_dirs = ['.git', 'fancybox', 'safeinc']
ignore_file_suffixes = ['.py', '.pyc', '~', '#', '.swp', '.gitignore', '.lastrun', 'Makefile', '.bat', 'Thumbs.db', 'README.markdown'] |
async def m001_initial(db):
"""
Initial lnurlpos table.
"""
await db.execute(
f"""
CREATE TABLE lnurlpos.lnurlposs (
id TEXT NOT NULL PRIMARY KEY,
key TEXT NOT NULL,
title TEXT NOT NULL,
wallet TEXT NOT NULL,
currency TEXT NOT ... | async def m001_initial(db):
"""
Initial lnurlpos table.
"""
await db.execute(f'\n CREATE TABLE lnurlpos.lnurlposs (\n id TEXT NOT NULL PRIMARY KEY,\n key TEXT NOT NULL,\n title TEXT NOT NULL,\n wallet TEXT NOT NULL,\n currency TEXT NOT NULL,\... |
class Node:
def __init__(self, data):
self.data = data
self.next = None
class CircularLinkedList:
def __init__(self):
self.head = None
self.tail = None
self.length = 0
def append(self, data):
new_node = Node(data)
if not self.head:
self.... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Circularlinkedlist:
def __init__(self):
self.head = None
self.tail = None
self.length = 0
def append(self, data):
new_node = node(data)
if not self.head:
self... |
n = 8
if n%2==0 and (n in range(2,6) or n>20 ):
print ("Not Weird")
else:
print ("Weird") | n = 8
if n % 2 == 0 and (n in range(2, 6) or n > 20):
print('Not Weird')
else:
print('Weird') |
routes = Blueprint("routes", __name__, template_folder="templates")
if not os.path.exists(os.path.dirname(recipyGui.config.get("tinydb"))):
os.mkdir(os.path.dirname(recipyGui.config.get("tinydb")))
@recipyGui.route("/")
def index():
form = SearchForm()
query = request.args.get("query", "").strip()
escaped_query = r... | routes = blueprint('routes', __name__, template_folder='templates')
if not os.path.exists(os.path.dirname(recipyGui.config.get('tinydb'))):
os.mkdir(os.path.dirname(recipyGui.config.get('tinydb')))
@recipyGui.route('/')
def index():
form = search_form()
query = request.args.get('query', '').strip()
esc... |
class Solution:
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> Optional[ListNode]:
a = headA
b = headB
while a != b:
if a: a = a.next
else: a = headB
if b: b = b.next
else: b = headA
return a | class Solution:
def get_intersection_node(self, headA: ListNode, headB: ListNode) -> Optional[ListNode]:
a = headA
b = headB
while a != b:
if a:
a = a.next
else:
a = headB
if b:
b = b.next
else:
... |
def reformat(string):
string = string.replace('-', '').replace('(', '').replace(')', '')
return string[-10:] if len(string) > 7 else '495' + string[-7:]
n = 4
notes = [input() for i in range(n)]
for note in notes[1:]:
print('YES' if reformat(notes[0]) == reformat(note) else 'NO')
| def reformat(string):
string = string.replace('-', '').replace('(', '').replace(')', '')
return string[-10:] if len(string) > 7 else '495' + string[-7:]
n = 4
notes = [input() for i in range(n)]
for note in notes[1:]:
print('YES' if reformat(notes[0]) == reformat(note) else 'NO') |
class SQLiteQueryResultSpy(object):
def __init__(self, row_count, lazy_result):
self.row_count = row_count
self.number_of_elements = row_count
self.lazy_result = lazy_result
@property
def rowcount(self):
return self.row_count
def fetchone(self):
self.number_of_e... | class Sqlitequeryresultspy(object):
def __init__(self, row_count, lazy_result):
self.row_count = row_count
self.number_of_elements = row_count
self.lazy_result = lazy_result
@property
def rowcount(self):
return self.row_count
def fetchone(self):
self.number_of_... |
def odeeuler(F,x0,y0,h,N):
x = x0
y = y0
for i in range(1,N+1):
y += h*F(x,y)
x += h
return y
| def odeeuler(F, x0, y0, h, N):
x = x0
y = y0
for i in range(1, N + 1):
y += h * f(x, y)
x += h
return y |
"""Functions to get all the book's information."""
def get_title(soup_object: object) -> str:
"""Return book title."""
return soup_object.find("h1").text
def get_universal_product_code(product_information_table: list) -> str:
"""Return book UPC."""
return product_information_table[0].text
def get_... | """Functions to get all the book's information."""
def get_title(soup_object: object) -> str:
"""Return book title."""
return soup_object.find('h1').text
def get_universal_product_code(product_information_table: list) -> str:
"""Return book UPC."""
return product_information_table[0].text
def get_pri... |
REQUEST_LAUNCH_MSG = "Hello, I'm Otto Investment bot, I' here to inform you about your investments. Do you want me to tell you a report on your portfolio? Or maybe information about specific stock? "
REQUEST_LAUNCH_REPROMPT = "Go on, tell me what can I do for you."
REQUEST_END_MSG = "Bye bye. "
# General
INTENT_GENER... | request_launch_msg = "Hello, I'm Otto Investment bot, I' here to inform you about your investments. Do you want me to tell you a report on your portfolio? Or maybe information about specific stock? "
request_launch_reprompt = 'Go on, tell me what can I do for you.'
request_end_msg = 'Bye bye. '
intent_general_ok = 'Ok ... |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 13 20:04:51 2021
@author: Charissa
"""
'''
==================================
Queue
==================================
'''
class QNode:
def __init__(self, data):
self.data = data
self.next = None
class Queue:
def __ini... | """
Created on Sat Feb 13 20:04:51 2021
@author: Charissa
"""
'\n==================================\nQueue\n==================================\n'
class Qnode:
def __init__(self, data):
self.data = data
self.next = None
class Queue:
def __init__(self):
self.front = None
self.... |
# A string index should always be within range
s = "Hello"
print(s[5]) # Syntax error - valid indices for s are 0-4
| s = 'Hello'
print(s[5]) |
#!/anaconda3/bin/python3.6
# coding=utf-8
if __name__ == "__main__":
print("suppliermgr package") | if __name__ == '__main__':
print('suppliermgr package') |
# encoding: utf-8
# Copyright 2008 California Institute of Technology. ALL RIGHTS
# RESERVED. U.S. Government Sponsorship acknowledged.
'''
EDRN RDF Service: unit and functional tests.
''' | """
EDRN RDF Service: unit and functional tests.
""" |
with open("input.txt") as input_file:
lines = input_file.readlines()
fish = [int(n) for n in lines[0].split(",")]
print(fish)
for _ in range(80):
fish = [f-1 for f in fish]
zeroes = fish.count(-1)
for i, f in enumerate(fish):
if f == -1:
fish[i] = 6
fish.extend([8]*zeroes)
pri... | with open('input.txt') as input_file:
lines = input_file.readlines()
fish = [int(n) for n in lines[0].split(',')]
print(fish)
for _ in range(80):
fish = [f - 1 for f in fish]
zeroes = fish.count(-1)
for (i, f) in enumerate(fish):
if f == -1:
fish[i] = 6
fish.extend([8] * zeroes)
... |
def test_first(setup_teardown):
text_logo = setup_teardown.find_element_by_id('logo').text
assert text_logo == 'Your Store'
| def test_first(setup_teardown):
text_logo = setup_teardown.find_element_by_id('logo').text
assert text_logo == 'Your Store' |
def calculaMulta (velocidade):
if velocidade > 50 and velocidade < 55:
return 230
elif velocidade > 55 and velocidade <= 60:
return 340
elif velocidade > 60:
valor = (velocidade-50) * 19.28
return valor
else:
return 0
vel = int(input("Informe a v... | def calcula_multa(velocidade):
if velocidade > 50 and velocidade < 55:
return 230
elif velocidade > 55 and velocidade <= 60:
return 340
elif velocidade > 60:
valor = (velocidade - 50) * 19.28
return valor
else:
return 0
vel = int(input('Informe a velocidade :'))
p... |
class Solution:
def removeElement(self, nums: List[int], val: int) -> int:
for numbers in range(len(nums)):
if val not in nums:
break
if len(nums) == 0:
return 0
else:
nums.remove(val)
print(len(nums))
... | class Solution:
def remove_element(self, nums: List[int], val: int) -> int:
for numbers in range(len(nums)):
if val not in nums:
break
if len(nums) == 0:
return 0
else:
nums.remove(val)
print(len(nums))
prin... |
"""
The RequestSupplement object that will get injected on marketplace requests
"""
class RequestSupplement(object):
# adding some duplicate fields keyed to more consistent python naming and
# more understandable naming in some cases. You're free to use whichever
# you want.
EXTRAS = {
'port... | """
The RequestSupplement object that will get injected on marketplace requests
"""
class Requestsupplement(object):
extras = {'portal_id': 'hub_id', 'app_pageUrl': 'local_url', 'app_callbackUrl': 'local_base_url', 'app_canvasUrl': 'base_url'}
def __init__(self, request):
super(RequestSupplement, self... |
# import matplotlib.pyplot as plt
# Menge an Werten
zahlen = "1203456708948673516874354531568764645"
# Initialisieren der Histogramm Variable
histogramm = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for index in range(len(zahlen)):
histogramm[int(zahlen[index])] += 1
# plt.hist(histogramm, bins = 9)
# plt.show()
for i in r... | zahlen = '1203456708948673516874354531568764645'
histogramm = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for index in range(len(zahlen)):
histogramm[int(zahlen[index])] += 1
for i in range(0, 10):
print('Die Zahl', i, 'kommt', histogramm[i], 'Mal vor.') |
#!/usr/bin/env pytho
codigo = {
'A': '.-', 'B': '-...', 'C': '-.-.',
'D': '-..', 'E': '.', 'F': '..-.',
'G': '--.', 'H': '....', 'I': '..',
'J': '.---', 'K': '-.-', 'L': '.-..',
'M': '--', 'N': '-.', 'O': '---',
'P': '.--.', 'Q': '--.-', 'R': '.-.',
... | codigo = {'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-', 'Y': '-.--', 'Z': '-... |
class Cloth:
def __init__(self, name, shop_url, available, brand_logo, price, img_url):
self.name = name
self.shop_url = shop_url
self.available = available
self.brand_logo = brand_logo
self.price = price
self.img_url = img_url
def __str__(self):
print('N... | class Cloth:
def __init__(self, name, shop_url, available, brand_logo, price, img_url):
self.name = name
self.shop_url = shop_url
self.available = available
self.brand_logo = brand_logo
self.price = price
self.img_url = img_url
def __str__(self):
print('... |
#!/usr/bin/env python3
"""
The marketing team is spending way too much time typing in hashtags.
Let's help them with our own Hashtag Generator!
Here's the deal:
It must start with a hashtag (#).
All words must have their first letter capitalized.
If the final result is longer than 140 chars it must return... | """
The marketing team is spending way too much time typing in hashtags.
Let's help them with our own Hashtag Generator!
Here's the deal:
It must start with a hashtag (#).
All words must have their first letter capitalized.
If the final result is longer than 140 chars it must return false.
If the inpu... |
def pickingNumbers(a):
solution = 0
for num1 in a:
if a.count(num1) + a.count(num1 + 1) > solution:
solution = a.count(num1) + a.count(num1 + 1)
return solution | def picking_numbers(a):
solution = 0
for num1 in a:
if a.count(num1) + a.count(num1 + 1) > solution:
solution = a.count(num1) + a.count(num1 + 1)
return solution |
# while loops
def nearest_square(limit):
number = 0
while (number+1) ** 2 < limit:
number += 1
return number ** 2
test1 = nearest_square(40)
print("expected result: 36, actual result: {}".format(test1))
# black jack
card_deck = [4, 11, 8, 5, 13, 2, 8, 10]
hand = []
while sum(hand) <= 21:
hand.a... | def nearest_square(limit):
number = 0
while (number + 1) ** 2 < limit:
number += 1
return number ** 2
test1 = nearest_square(40)
print('expected result: 36, actual result: {}'.format(test1))
card_deck = [4, 11, 8, 5, 13, 2, 8, 10]
hand = []
while sum(hand) <= 21:
hand.append(card_deck.pop())
pri... |
A_1,B_1 = input().split(" ")
a = int(A_1)
b = int(B_1)
if a > b:
horas = (24-a) + b
print("O JOGO DUROU %i HORA(S)"%(horas))
elif a == b:
print("O JOGO DUROU 24 HORA(S)")
else:
horas = b - a
print("O JOGO DUROU %i HORA(S)"%(horas))
| (a_1, b_1) = input().split(' ')
a = int(A_1)
b = int(B_1)
if a > b:
horas = 24 - a + b
print('O JOGO DUROU %i HORA(S)' % horas)
elif a == b:
print('O JOGO DUROU 24 HORA(S)')
else:
horas = b - a
print('O JOGO DUROU %i HORA(S)' % horas) |
"""Example of comments within the Hello World package
This is a further elaboration of the docstring. Here, you can
define the details and steps appropriate for the situation.
Code tells you how. Comments tell you why.
args:
name (int): a description of the parameter
name (str): a description of the paramete... | """Example of comments within the Hello World package
This is a further elaboration of the docstring. Here, you can
define the details and steps appropriate for the situation.
Code tells you how. Comments tell you why.
args:
name (int): a description of the parameter
name (str): a description of the paramete... |
# https://app.codesignal.com/arcade/code-arcade/well-of-integration/QmK8kHTyKqh8xDoZk
def threeSplit(numbers):
# From a list of numbers, cut into three pieces such that each
# piece contains an integer, and the sum of integers in each
# piece is the same.
# We know that the total sum of elements in the arr... | def three_split(numbers):
total = sum(numbers)
third = total / 3
start_count = 0
acum_sum = 0
result = 0
for idx in range(len(numbers) - 1):
acum_sum += numbers[idx]
if acum_sum == 2 * third and start_count > 0:
result += start_count
if acum_sum == third:
... |
def comparator(predicate):
"""Makes a comparator function out of a function that reports whether the first
element is less than the second"""
return lambda a, b: predicate(a, b) * -1 + predicate(b, a) * 1
| def comparator(predicate):
"""Makes a comparator function out of a function that reports whether the first
element is less than the second"""
return lambda a, b: predicate(a, b) * -1 + predicate(b, a) * 1 |
# https://stackoverflow.com/questions/14485255/vertical-sum-in-a-given-binary-tree
# https://codereview.stackexchange.com/questions/151208/vertical-sum-in-a-given-binary-tree
d = {}
def traverse(node, hd):
if not node:
return
if not hd in d:
d[hd] = 0
d[hd] = d[hd] + node.value
traverse(node.left, h... | d = {}
def traverse(node, hd):
if not node:
return
if not hd in d:
d[hd] = 0
d[hd] = d[hd] + node.value
traverse(node.left, hd - 1)
traverse(node.right, hd + 1)
class Node:
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
... |
conf_my_cnf_xenial = """[mysqld]
bind-address = 0.0.0.0
default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
innodb_autoinc_lock_mode=2
innodb_flush_log_at_trx_commit=0
innodb_buffer_pool_size=122M
# MariaDB Galera Cluster in Xenial... | conf_my_cnf_xenial = '[mysqld]\nbind-address = 0.0.0.0\ndefault-storage-engine = innodb\ninnodb_file_per_table\nmax_connections = 4096\ncollation-server = utf8_general_ci\ncharacter-set-server = utf8\ninnodb_autoinc_lock_mode=2\ninnodb_flush_log_at_trx_commit=0\ninnodb_buffer_pool_size=122M\n\n# MariaDB Galera Cluster ... |
def elevadorLotado(paradas, capacidade):
energiaGasta = 0
while paradas:
ultimo = paradas[-1]
energiaGasta += 2*ultimo
paradas = paradas[:-capacidade]
return energiaGasta
testes = int(input())
for x in range(testes):
NCM = input().split()
capacidade = int(NCM[1])
destinhos = list(map... | def elevador_lotado(paradas, capacidade):
energia_gasta = 0
while paradas:
ultimo = paradas[-1]
energia_gasta += 2 * ultimo
paradas = paradas[:-capacidade]
return energiaGasta
testes = int(input())
for x in range(testes):
ncm = input().split()
capacidade = int(NCM[1])
des... |
with open('EN_op_1_57X32A15_31.csv','r') as csvfile:
reader = csv.reader(csvfile)
for row in reader:
print(row[1])
| with open('EN_op_1_57X32A15_31.csv', 'r') as csvfile:
reader = csv.reader(csvfile)
for row in reader:
print(row[1]) |
class Blosum62:
"""Score matrix BLOSUM62"""
def __init__(self):
self.blosum62 = {
'A': {'A': 4, 'R':-1, 'N':-2, 'D':-2, 'C': 0, 'Q':-1, 'E':-1, 'G': 0, 'H':-2, 'I':-1, 'L':-1, 'K':-1, 'M':-1, 'F':-2, 'P':-1, 'S': 1, 'T': 0, 'W':-3, 'Y':-2, 'V': 0, 'B':-2, 'Z':-1, 'X': 0, '-':-4},
... | class Blosum62:
"""Score matrix BLOSUM62"""
def __init__(self):
self.blosum62 = {'A': {'A': 4, 'R': -1, 'N': -2, 'D': -2, 'C': 0, 'Q': -1, 'E': -1, 'G': 0, 'H': -2, 'I': -1, 'L': -1, 'K': -1, 'M': -1, 'F': -2, 'P': -1, 'S': 1, 'T': 0, 'W': -3, 'Y': -2, 'V': 0, 'B': -2, 'Z': -1, 'X': 0, '-': -4}, 'R': {... |
chars = {
'A': ['010',
'101',
'111',
'101',
'101'],
'B': ['110',
'101',
'111',
'101',
'110'],
'C': ['011',
'100',
'100',
'100',
'011'],
'D': ['110',
'101',
'101',
'101',
'110'],
'E': ['111',
'100',
'111',
... | chars = {'A': ['010', '101', '111', '101', '101'], 'B': ['110', '101', '111', '101', '110'], 'C': ['011', '100', '100', '100', '011'], 'D': ['110', '101', '101', '101', '110'], 'E': ['111', '100', '111', '100', '111'], 'F': ['111', '100', '111', '100', '100'], 'G': ['0111', '1000', '1011', '1001', '0110'], 'H': ['101',... |
SAGA_ENABLED = 1
MIN_DETECTED_FACE_WIDTH = 20
MIN_DETECTED_FACE_HEIGHT = 20
PICKLE_FILES_DIR = "/app/facenet/resources/output"
MODEL_FILES_DIR = "/app/facenet/resources/model"
UPLOAD_DIR = "/app/resources/images/"
# PICKLE_FILES_DIR = '/Users/ashishgupta/git/uPresent/face-recognition/resources/output'
# MODEL_FILES_DIR... | saga_enabled = 1
min_detected_face_width = 20
min_detected_face_height = 20
pickle_files_dir = '/app/facenet/resources/output'
model_files_dir = '/app/facenet/resources/model'
upload_dir = '/app/resources/images/' |
"""
VIS_LR
Visualization tools for learning rate stuff
Stefan Wong 2019
"""
def plot_lr_vs_acc(ax, lr_data, acc_data, **kwargs):
title = kwargs.pop('title', 'Learning Rate vs. Accuracy')
if len(lr_data) != len(acc_data):
plot_len = min([len(lr_data), len(acc_data)])
else:
plot_len = len(... | """
VIS_LR
Visualization tools for learning rate stuff
Stefan Wong 2019
"""
def plot_lr_vs_acc(ax, lr_data, acc_data, **kwargs):
title = kwargs.pop('title', 'Learning Rate vs. Accuracy')
if len(lr_data) != len(acc_data):
plot_len = min([len(lr_data), len(acc_data)])
else:
plot_len = len(lr... |
class Contact:
def __init__(self, first_name: str, second_name: str, phone_number: str):
self._first_name = first_name
self._second_name = second_name
self._phone_number = phone_number
@property
def first_name(self):
return self._first_name
@property
def second_name... | class Contact:
def __init__(self, first_name: str, second_name: str, phone_number: str):
self._first_name = first_name
self._second_name = second_name
self._phone_number = phone_number
@property
def first_name(self):
return self._first_name
@property
def second_nam... |
def answer(l):
res = 0
length = len(l)
for x in xrange(length):
left = 0
right = 0
for i in xrange(x):
if not (l[x] % l[i]):
left = left + 1
for i in xrange(x + 1, length):
if not (l[i] % l[x]):
right = right + 1
... | def answer(l):
res = 0
length = len(l)
for x in xrange(length):
left = 0
right = 0
for i in xrange(x):
if not l[x] % l[i]:
left = left + 1
for i in xrange(x + 1, length):
if not l[i] % l[x]:
right = right + 1
res... |
# NOTE: The sitename and dataname corresponding to the observation are 'y' by default
# Any latents that are not population level
model_constants = {
'arm.anova_radon_nopred': {
'population_effects':{'mu_a', 'sigma_a', 'sigma_y'},
'ylims':(1000, 5000),
'ylims_zoomed':(1000, 1200)
},
... | model_constants = {'arm.anova_radon_nopred': {'population_effects': {'mu_a', 'sigma_a', 'sigma_y'}, 'ylims': (1000, 5000), 'ylims_zoomed': (1000, 1200)}, 'arm.anova_radon_nopred_chr': {'population_effects': {'sigma_a', 'sigma_y', 'mu_a'}, 'ylims': (1000, 5000), 'ylims_zoomed': (1000, 1200)}, 'arm.congress': {'populatio... |
def addStrings(num1: str, num2: str) -> str:
i, j = len(num1) - 1, len(num2) - 1
tmp = 0
result = ""
while i >= 0 or j >= 0:
if i >= 0:
tmp += int(num1[i])
i -= 1
if j >= 0:
tmp += int(num2[j])
j -= 1
result = str(tmp % 10) + result... | def add_strings(num1: str, num2: str) -> str:
(i, j) = (len(num1) - 1, len(num2) - 1)
tmp = 0
result = ''
while i >= 0 or j >= 0:
if i >= 0:
tmp += int(num1[i])
i -= 1
if j >= 0:
tmp += int(num2[j])
j -= 1
result = str(tmp % 10) + r... |
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param A: a list of integer
@return: a tree node
"""
def sortedArrayToBST(self, A):
# write your code here
if len(A) == 0... | """
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param A: a list of integer
@return: a tree node
"""
def sorted_array_to_bst(self, A):
if len(A) == 0:
return None
... |
intin = int(input())
if intin == 2:
print("NO")
elif intin%2==0:
if intin%4==0:
print("YES")
elif (intin-2)%4==0:
print("YES")
else:
print("NO")
else:
print("NO") | intin = int(input())
if intin == 2:
print('NO')
elif intin % 2 == 0:
if intin % 4 == 0:
print('YES')
elif (intin - 2) % 4 == 0:
print('YES')
else:
print('NO')
else:
print('NO') |
def rgb(r, g, b):
s=""
if r>255:
r=255
elif g>255:
g=255
elif b>255:
b=255
if r<0:
r=0
elif g<0:
g=0
elif b<0:
b=0
r='{0:x}'.format(r)
g='{0:x}'.format(g)
b='{0:x}'.format(b)
if int(r,16)<=15 and int(r,16)>=0:
r='0'+r
... | def rgb(r, g, b):
s = ''
if r > 255:
r = 255
elif g > 255:
g = 255
elif b > 255:
b = 255
if r < 0:
r = 0
elif g < 0:
g = 0
elif b < 0:
b = 0
r = '{0:x}'.format(r)
g = '{0:x}'.format(g)
b = '{0:x}'.format(b)
if int(r, 16) <= 15 a... |
# https://www.reddit.com/r/dailyprogrammer/comments/1ystvb/022414_challenge_149_easy_disemvoweler/
def disem(str):
result = ''
rem_vowels = ''
vowels = 'aeiou'
for c in str:
if c not in vowels and not c.isspace():
result += c
elif not c.isspace():
rem_vowels += c... | def disem(str):
result = ''
rem_vowels = ''
vowels = 'aeiou'
for c in str:
if c not in vowels and (not c.isspace()):
result += c
elif not c.isspace():
rem_vowels += c
print(result + '\n' + rem_vowels)
def main():
phrase = input('\nPlease enter a line: ')
... |
'''
@description 2019/09/22 20:53
'''
| """
@description 2019/09/22 20:53
""" |
def setup():
size (500,500)
background (100)
smooth()
noLoop()
strokeWeight(15)
str(100)
def draw ():
fill (250)
rect (100,100, 100,100)
fill (50)
rect (200,200, 50,100)
| def setup():
size(500, 500)
background(100)
smooth()
no_loop()
stroke_weight(15)
str(100)
def draw():
fill(250)
rect(100, 100, 100, 100)
fill(50)
rect(200, 200, 50, 100) |
#Write a function that accepts a 2D list of integers and returns the maximum EVEN value for the entire list.
#You can assume that the number of columns in each row is the same.
#Your function should return None if the list is empty or all the numbers in the 2D list are odd.
#Do NOT use python's built in max() functi... | def even_empty_odd(list2d):
len_list = 0
even_numbers = []
odd_numbers = []
count = 0
for list_number in list2d:
len_list += len(list_number)
if len_list == 0:
return None
else:
for list_number in list2d:
for number in list_number:
if numbe... |
class PolicyOwner(basestring):
"""
cluster-admin|vserver-admin
Possible values:
<ul>
<li> "cluster_admin" ,
<li> "vserver_admin"
</ul>
"""
@staticmethod
def get_api_name():
return "policy-owner"
| class Policyowner(basestring):
"""
cluster-admin|vserver-admin
Possible values:
<ul>
<li> "cluster_admin" ,
<li> "vserver_admin"
</ul>
"""
@staticmethod
def get_api_name():
return 'policy-owner' |
""" HealthDES - A python library to support discrete event simulation in health and social care """
class ResourceBase:
# TODO: Build out the do and query functions for person, activity and resource objects.
# Need to create dictionary of actions and parameters.
# Subclassing allows dictionary of actions... | """ HealthDES - A python library to support discrete event simulation in health and social care """
class Resourcebase:
def do(self, action, **kwargs):
""" Perform an action on the person """
pass
def query(self, param):
""" Get a parameter from the person."""
pass |
### assuming you have Google Chrome installed...
## remember `pip3 install -r setup.py` before trying any scrapers in this dir
# have a nice day
selenium
chromedriver
requests
| selenium
chromedriver
requests |
class Power:
def __init__(self, power_id, name, amount):
self.power_id = power_id
self.power_name = name
self.amount = amount
@classmethod
def from_json(cls, json_object):
return cls(json_object["id"], json_object["name"], json_object["amount"])
def __eq__(self, other)... | class Power:
def __init__(self, power_id, name, amount):
self.power_id = power_id
self.power_name = name
self.amount = amount
@classmethod
def from_json(cls, json_object):
return cls(json_object['id'], json_object['name'], json_object['amount'])
def __eq__(self, other)... |
DB_PORT=5432
DB_USERNAME="postgres"
DB_PASSWORD="password"
DB_HOST="127.0.0.1"
DB_DATABASE="eventtriggertest"
| db_port = 5432
db_username = 'postgres'
db_password = 'password'
db_host = '127.0.0.1'
db_database = 'eventtriggertest' |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 14 20:07:55 2018
@author: vegetto
"""
# Local versus Global
def local():
# m doesn't belong to the scope defined by the local function so Python will keep looking into the next enclosing scope. m is finally found in the global scope
print(m, 'printing from the l... | """
Created on Wed Mar 14 20:07:55 2018
@author: vegetto
"""
def local():
print(m, 'printing from the local scope')
m = 5
print(m, 'printing from the global scope')
local() |
class WindowNeighbor:
"""The window class for finding the
neighbor pixels around the center"""
def __init__(self, width, center, image):
# center is a list of [row, col, Y_intensity]
self.center = [center[0], center[1], image[center][0]]
self.width = width
self.neighbors... | class Windowneighbor:
"""The window class for finding the
neighbor pixels around the center"""
def __init__(self, width, center, image):
self.center = [center[0], center[1], image[center][0]]
self.width = width
self.neighbors = None
self.find_neighbors(image)
self.me... |
class Solution(object):
def findLengthOfLCIS(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
start = 0
prev = None
m = 0
for i, n in enumerate(nums):
if prev is not None:
if n <= prev:
start = i
... | class Solution(object):
def find_length_of_lcis(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
start = 0
prev = None
m = 0
for (i, n) in enumerate(nums):
if prev is not None:
if n <= prev:
start ... |
setting = {
'file': './data/crime2010_2018.csv',
'limit': 10000,
'source': [0,1,2,3,7,8,10,11,14,16,23,5,25],
'vars': {
0 : 'num',
1 : 'date_reported',
2:'date_occured',
3:'time_occured',
7:'crime_code',
8:'crime_desc',
10:'victim_age',
11:... | setting = {'file': './data/crime2010_2018.csv', 'limit': 10000, 'source': [0, 1, 2, 3, 7, 8, 10, 11, 14, 16, 23, 5, 25], 'vars': {0: 'num', 1: 'date_reported', 2: 'date_occured', 3: 'time_occured', 7: 'crime_code', 8: 'crime_desc', 10: 'victim_age', 11: 'victim_sex', 14: 'premise_desc', 16: 'weapon', 23: 'address', 5: ... |
'''from axju.core.tools import SmartCLI
from axju.worker.git import GitWorker
def main():
cli = SmartCLI(GitWorker)
cli.run()
if __name__ == '__main__':
main()
'''
| """from axju.core.tools import SmartCLI
from axju.worker.git import GitWorker
def main():
cli = SmartCLI(GitWorker)
cli.run()
if __name__ == '__main__':
main()
""" |
# -*- coding: utf-8 -*-
class PaytabsApiError(Exception):
"""Exception raised when an a RequestHandler indicates the request failed.
Attributes:
code -- the error code returned from the API
msg_english -- explanation of the error
"""
def __init__(self, code, message):
... | class Paytabsapierror(Exception):
"""Exception raised when an a RequestHandler indicates the request failed.
Attributes:
code -- the error code returned from the API
msg_english -- explanation of the error
"""
def __init__(self, code, message):
self.code = code
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Michael Eaton <meaton@iforium.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Li... | ansible_metadata = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'}
documentation = "\n---\nmodule: win_firewall\nversion_added: '2.4'\nshort_description: Enable or disable the Windows Firewall\ndescription:\n- Enable or Disable Windows Firewall profiles.\noptions:\n profiles:\n descr... |
"""Top-level package for siphr."""
__author__ = """Shamindra Shrotriya"""
__email__ = "shamindra.shrotriya@gmail.com"
__version__ = "0.1.0"
| """Top-level package for siphr."""
__author__ = 'Shamindra Shrotriya'
__email__ = 'shamindra.shrotriya@gmail.com'
__version__ = '0.1.0' |
class ActivityBar:
"""
Content settings for the activity bar.
"""
def __init__(self, id: str, title: str, icon: str) -> None:
self.id = id
self.title = title
self.icon = icon
class StaticWebview:
"""
Content settings for a Static Webview.
"""
d... | class Activitybar:
"""
Content settings for the activity bar.
"""
def __init__(self, id: str, title: str, icon: str) -> None:
self.id = id
self.title = title
self.icon = icon
class Staticwebview:
"""
Content settings for a Static Webview.
"""
def __init__(self,... |
load("//webgen:webgen.bzl", "erb_file", "js_file", "scss_file", "website")
def page(name, file, out=None, data=False, math=False, plot=False):
extra_templates = []
if data: extra_templates.append("template/data.html")
if math: extra_templates.append("template/mathjax.html")
if plot: extra_templates.app... | load('//webgen:webgen.bzl', 'erb_file', 'js_file', 'scss_file', 'website')
def page(name, file, out=None, data=False, math=False, plot=False):
extra_templates = []
if data:
extra_templates.append('template/data.html')
if math:
extra_templates.append('template/mathjax.html')
if plot:
... |
class Solution:
def uniquePaths(self, m, n):
"""
:type m: int
:type n: int
:rtype: int
"""
return int(math.factorial(m+n-2)/ (math.factorial(m-1)* math.factorial(n-1)))
| class Solution:
def unique_paths(self, m, n):
"""
:type m: int
:type n: int
:rtype: int
"""
return int(math.factorial(m + n - 2) / (math.factorial(m - 1) * math.factorial(n - 1))) |
def two_finger_sort(arr, brr):
"""
The two_finger_sort() is a function that takes two sorted lists as input
parameters and returns a single sorted list.
Its time complexity is O(n), but it also needs extra space to store the new
sorted list.
Explanation : arr = [1, 2, 34, 56], brr = [3, 5]... | def two_finger_sort(arr, brr):
"""
The two_finger_sort() is a function that takes two sorted lists as input
parameters and returns a single sorted list.
Its time complexity is O(n), but it also needs extra space to store the new
sorted list.
Explanation : arr = [1, 2, 34, 56], brr = [3, 5], crr ... |
#data kualitatif
a = "the dogis hungry. The cat is bored. the snack is awake."
s = a.split(".")
print(s)
print(s[0])
print(s[1])
print(s[2])
| a = 'the dogis hungry. The cat is bored. the snack is awake.'
s = a.split('.')
print(s)
print(s[0])
print(s[1])
print(s[2]) |
'''
Completion sample module
'''
def func_module_level(i, a='foo'):
'some docu'
return i * a
class ModClass:
''' some inner namespace class'''
@classmethod
def class_level_func(cls, boolean=True):
return boolean
class NestedClass:
''' some inner namespace class'''
@c... | """
Completion sample module
"""
def func_module_level(i, a='foo'):
"""some docu"""
return i * a
class Modclass:
""" some inner namespace class"""
@classmethod
def class_level_func(cls, boolean=True):
return boolean
class Nestedclass:
""" some inner namespace class"""
... |
N = int(input())
A = int(input())
for a in range(A+1):
for j in range(21):
if a + 500 * j == N:
print("Yes")
exit()
print("No")
| n = int(input())
a = int(input())
for a in range(A + 1):
for j in range(21):
if a + 500 * j == N:
print('Yes')
exit()
print('No') |
# ----------------------------------------------------------------
# Copyright 2016 Cisco Systems
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... | """ service.py
The base Service class.
"""
class Service(object):
""" Base service class which can be extended for different ways of communicating to remote server """
def operate_on_object_or_dictionary(self, entity, function, args):
result = None
if isinstance(entity, dict):
... |
# Scrapy settings for uefispider project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'uefispider'
SPIDER_MODULES = ['uefispider.spiders']
NEWSPIDER_MODULE = '... | bot_name = 'uefispider'
spider_modules = ['uefispider.spiders']
newspider_module = 'uefispider.spiders'
user_agent = 'uefispider (+https://github.com/theopolis/uefi-spider)'
item_pipelines = {'uefispider.pipelines.UefispiderPipeline': 1}
cookies_debug = True |
class Solution:
def baseNeg2(self, N: int) -> str:
if N == 0:
return "0"
nums = []
while N != 0:
r = N % (-2)
N //= (-2)
if r < 0:
r += 2
N += 1
nums.append(r)
return ''.join(map(str, nums[::-... | class Solution:
def base_neg2(self, N: int) -> str:
if N == 0:
return '0'
nums = []
while N != 0:
r = N % -2
n //= -2
if r < 0:
r += 2
n += 1
nums.append(r)
return ''.join(map(str, nums[::-1]... |
# This file contains the different states of the api
class Config(object):
DEBUG = False
SQLALCHEMY_DATABASE_URI = 'sqlite:///database.db'
SQLALCHEMY_TRACK_MODIFICATIONS = False
class Production(Config):
DEBUG = False
class DevelopmentConfig(Config):
DEBUG = True | class Config(object):
debug = False
sqlalchemy_database_uri = 'sqlite:///database.db'
sqlalchemy_track_modifications = False
class Production(Config):
debug = False
class Developmentconfig(Config):
debug = True |
class Node(object):
def __init__(self, item):
self.data = item
self.left = None
self.right = None
def BTToDLLUtil(root):
if root is None:
return root
if root.left:
left = BTToDLLUtil(root.left)
while left.right:
left = left.right
... | class Node(object):
def __init__(self, item):
self.data = item
self.left = None
self.right = None
def bt_to_dll_util(root):
if root is None:
return root
if root.left:
left = bt_to_dll_util(root.left)
while left.right:
left = left.right
le... |
#!/usr/bin/env python
print('nihao')
| print('nihao') |
def friend_find(line):
check=[i for i,j in enumerate(line) if j=="red"]
total=0
for i in check:
if i>=2 and line[i-1]=="blue" and line[i-2]=="blue":
total+=1
elif (i>=1 and i<=len(line)-2) and line[i-1]=="blue" and line[i+1]=="blue":
total+=1
elif (i<=len(line... | def friend_find(line):
check = [i for (i, j) in enumerate(line) if j == 'red']
total = 0
for i in check:
if i >= 2 and line[i - 1] == 'blue' and (line[i - 2] == 'blue'):
total += 1
elif (i >= 1 and i <= len(line) - 2) and line[i - 1] == 'blue' and (line[i + 1] == 'blue'):
... |
# _*_ coding: utf-8 _*_
#
# Package: bookstore.src.core.validator
__all__ = ["validators"]
| __all__ = ['validators'] |
sanitizedLines = []
with open("diff.txt") as f:
for line in f:
sanitizedLines.append("https://interclip.app/" + line.strip())
print(str(sanitizedLines))
| sanitized_lines = []
with open('diff.txt') as f:
for line in f:
sanitizedLines.append('https://interclip.app/' + line.strip())
print(str(sanitizedLines)) |
#
# chmod this file securely and be sure to remove the default users
#
users = {
"frodo" : "1ring",
"yossarian" : "catch22",
"ayla" : "jondalar",
}
| users = {'frodo': '1ring', 'yossarian': 'catch22', 'ayla': 'jondalar'} |
def calcMul(items):
mulTotal = 1
for i in items:
mulTotal *= i
return mulTotal
print("The multiple is: ",calcMul([10,20,30])) | def calc_mul(items):
mul_total = 1
for i in items:
mul_total *= i
return mulTotal
print('The multiple is: ', calc_mul([10, 20, 30])) |
def validate_contract_create(request, **kwargs):
if request.validated['auction'].status not in ['active.qualification', 'active.awarded']:
request.errors.add('body', 'data',
'Can\'t add contract in current ({}) auction status'.format(request.validated['auction'].status))
... | def validate_contract_create(request, **kwargs):
if request.validated['auction'].status not in ['active.qualification', 'active.awarded']:
request.errors.add('body', 'data', "Can't add contract in current ({}) auction status".format(request.validated['auction'].status))
request.errors.status = 403
... |
"""Constants for Skoda Connect library."""
BASE_SESSION = 'https://msg.volkswagen.de'
BASE_AUTH = 'https://identity.vwgroup.io'
BRAND = 'VW'
COUNTRY = 'DE'
# Data used in communication
CLIENT = {
'Legacy': {
'CLIENT_ID': '9496332b-ea03-4091-a224-8c746b885068%40apps_vw-dilab_com', # client id for VW... | """Constants for Skoda Connect library."""
base_session = 'https://msg.volkswagen.de'
base_auth = 'https://identity.vwgroup.io'
brand = 'VW'
country = 'DE'
client = {'Legacy': {'CLIENT_ID': '9496332b-ea03-4091-a224-8c746b885068%40apps_vw-dilab_com', 'SCOPE': 'openid mbb profile cars address email birthdate nickname pho... |
class User:
def __init__(self, userName, firstName, lastName, passportNumber, address1, address2, zipCode):
self.userName = userName
self.firstName = firstName
self.lastName = lastName
self.passportNumber = passportNumber
self.address1 = address1
self.address2 = addre... | class User:
def __init__(self, userName, firstName, lastName, passportNumber, address1, address2, zipCode):
self.userName = userName
self.firstName = firstName
self.lastName = lastName
self.passportNumber = passportNumber
self.address1 = address1
self.address2 = addr... |
# pylint: skip-file
# pylint: disable=too-many-instance-attributes
class VMInstance(GCPResource):
'''Object to represent a gcp instance'''
resource_type = "compute.v1.instance"
# pylint: disable=too-many-arguments
def __init__(self,
rname,
project,
z... | class Vminstance(GCPResource):
"""Object to represent a gcp instance"""
resource_type = 'compute.v1.instance'
def __init__(self, rname, project, zone, machine_type, metadata, tags, disks, network_interfaces, service_accounts=None):
"""constructor for gcp resource"""
super(VMInstance, self).... |
#
# Variables:
# - Surname: String
# - SurnameLength, NextCodeNumber, CustomerID, i: Integer
# - NextChar: Char
#
Surname = input("Enter your surname: ")
SurnameLength = len(Surname)
CustomerID = 0
for i in range(0, SurnameLength):
NextChar = Surname[i]
NextCodeNumber = ord(NextChar)
CustomerID = C... | surname = input('Enter your surname: ')
surname_length = len(Surname)
customer_id = 0
for i in range(0, SurnameLength):
next_char = Surname[i]
next_code_number = ord(NextChar)
customer_id = CustomerID + NextCodeNumber
print('Customer ID is ', CustomerID) |
class EmptyType(object):
"""A sentinel value when nothing is returned from the database"""
def __new__(cls):
return Empty
def __reduce__(self):
return EmptyType, ()
def __bool__(self):
return False
def __repr__(self):
return 'Empty'
Empty = object.__new__(EmptyT... | class Emptytype(object):
"""A sentinel value when nothing is returned from the database"""
def __new__(cls):
return Empty
def __reduce__(self):
return (EmptyType, ())
def __bool__(self):
return False
def __repr__(self):
return 'Empty'
empty = object.__new__(EmptyT... |
class classproperty(object):
'''Implements both @property and @classmethod behavior.'''
def __init__(self, getter):
self.getter = getter
def __get__(self, instance, owner):
return self.getter(instance) if instance else self.getter(owner)
| class Classproperty(object):
"""Implements both @property and @classmethod behavior."""
def __init__(self, getter):
self.getter = getter
def __get__(self, instance, owner):
return self.getter(instance) if instance else self.getter(owner) |
def is_empty(text):
if text in [None,'']:
return True
return False
| def is_empty(text):
if text in [None, '']:
return True
return False |
mysql_config = {
'user': 'USER',
'password': 'PASSWORD',
'host': 'HOST',
'port': 3306,
'charset': 'utf8mb4',
'database': 'DATABASE',
'raise_on_warnings': False,
'use_pure': False,
} | mysql_config = {'user': 'USER', 'password': 'PASSWORD', 'host': 'HOST', 'port': 3306, 'charset': 'utf8mb4', 'database': 'DATABASE', 'raise_on_warnings': False, 'use_pure': False} |
class Preprocess_Data:
"""this class converts the integer date time values to the python datetime string format"""
def __init__(self, data_dict):
self.data_dict = data_dict
def preprocess(self):
from_year = self.data_dict["fromYr"]
from_month = self.data_dict["fromMth"]
to_... | class Preprocess_Data:
"""this class converts the integer date time values to the python datetime string format"""
def __init__(self, data_dict):
self.data_dict = data_dict
def preprocess(self):
from_year = self.data_dict['fromYr']
from_month = self.data_dict['fromMth']
to_... |
#!/usr/bin/env python3
"""Global color definitions.
"""
BLUE_BACKGROUND: int = 20
GREEN_BACKGROUND: int = 30
RED_BACKGROUND: int = 5
WHITE: int = 0
YELLOW_BACKGROUND: int = 186
| """Global color definitions.
"""
blue_background: int = 20
green_background: int = 30
red_background: int = 5
white: int = 0
yellow_background: int = 186 |
movie = {"title": "padmavati", "director": "Bhansali","year": "2018", "rating": "4.5"}
print(movie)
print(movie['year'])
movie['year'] = 2019 #update data.
print(movie['year'])
print('-' * 20)
for x in movie:
print(x) #this print key.
print(movie[x]) #this print value at key.
print('-' *... | movie = {'title': 'padmavati', 'director': 'Bhansali', 'year': '2018', 'rating': '4.5'}
print(movie)
print(movie['year'])
movie['year'] = 2019
print(movie['year'])
print('-' * 20)
for x in movie:
print(x)
print(movie[x])
print('-' * 20)
movie = {}
movie['title'] = 'Manikarnika'
movie['Director'] = 'kangana ... |
def comb(m, s):
if m == 1: return [[x] for x in s]
if m == len(s): return [s]
return [s[:1] + a for a in comb(m-1, s[1:])] + comb(m, s[1:])
| def comb(m, s):
if m == 1:
return [[x] for x in s]
if m == len(s):
return [s]
return [s[:1] + a for a in comb(m - 1, s[1:])] + comb(m, s[1:]) |
n, x = map(int, input().split())
mark_sheet = []
for _ in range(x):
mark_sheet.append( map(float, input().split()) )
for i in zip(*mark_sheet):
print( sum(i)/len(i) ) | (n, x) = map(int, input().split())
mark_sheet = []
for _ in range(x):
mark_sheet.append(map(float, input().split()))
for i in zip(*mark_sheet):
print(sum(i) / len(i)) |
__name__ = "lbry"
__version__ = "0.42.1"
version = tuple(__version__.split('.'))
| __name__ = 'lbry'
__version__ = '0.42.1'
version = tuple(__version__.split('.')) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.