content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#!/usr/bin/env python
# encoding: utf-8
"""
entity_list.py
Created by William Makley on 2008-04-02.
Copyright (c) 2008 Tritanium Enterprises. All rights reserved.
"""
def compare_elist(e1, e2):
"""Comparison function for entities."""
sp1 = e1.sorting_priority
sp2 = e2.sorting_priority
if sp1 > sp2:
... | """
entity_list.py
Created by William Makley on 2008-04-02.
Copyright (c) 2008 Tritanium Enterprises. All rights reserved.
"""
def compare_elist(e1, e2):
"""Comparison function for entities."""
sp1 = e1.sorting_priority
sp2 = e2.sorting_priority
if sp1 > sp2:
return 1
elif sp1 == sp2:
... |
"""
This module collects all solvent subclasses for python file and information management with gromos
"""
class Solvent():
"""Solvent
This class is giving the needed solvent infofmation for gromos in an obj.
#TODO: CONFs & TOPO in data
"""
name:str = None
coord_file_path:str = Non... | """
This module collects all solvent subclasses for python file and information management with gromos
"""
class Solvent:
"""Solvent
This class is giving the needed solvent infofmation for gromos in an obj.
#TODO: CONFs & TOPO in data
"""
name: str = None
coord_file_path: str = Non... |
APP_V1 = '1.0'
APP_V2 = '2.0'
MAJOR_RELEASE_TO_VERSION = {
"1": APP_V1,
"2": APP_V2,
}
CAREPLAN_GOAL = 'careplan_goal'
CAREPLAN_TASK = 'careplan_task'
CAREPLAN_CASE_NAMES = {
CAREPLAN_GOAL: 'Goal',
CAREPLAN_TASK: 'Task'
}
CT_REQUISITION_MODE_3 = '3-step'
CT_REQUISITION_MODE_4 = '4-step'
CT_REQUISITION... | app_v1 = '1.0'
app_v2 = '2.0'
major_release_to_version = {'1': APP_V1, '2': APP_V2}
careplan_goal = 'careplan_goal'
careplan_task = 'careplan_task'
careplan_case_names = {CAREPLAN_GOAL: 'Goal', CAREPLAN_TASK: 'Task'}
ct_requisition_mode_3 = '3-step'
ct_requisition_mode_4 = '4-step'
ct_requisition_modes = [CT_REQUISITIO... |
'''4. Write a Python program to concatenate elements of a list. '''
num = ['1', '2', '3', '4', '5']
print('-'.join(num))
print(''.join(num)) | """4. Write a Python program to concatenate elements of a list. """
num = ['1', '2', '3', '4', '5']
print('-'.join(num))
print(''.join(num)) |
print ("Hello World")
n = int(input("numero: "))
print(type(n))
print(bin(3)) | print('Hello World')
n = int(input('numero: '))
print(type(n))
print(bin(3)) |
def f(arr, t):
# print(t)
N = len(arr)
x0,v0 = arr[0]
l,r = x0 - t*v0, x0 + t*v0
for i in range(1, N):
xi,vi = arr[i]
l1, r1 = xi - t*vi, xi + t*vi
if l1 < l:
(l,r), (l1,r1) = (l1,r1), (l,r)
if l1 > r:
return False
l,r = max(... | def f(arr, t):
n = len(arr)
(x0, v0) = arr[0]
(l, r) = (x0 - t * v0, x0 + t * v0)
for i in range(1, N):
(xi, vi) = arr[i]
(l1, r1) = (xi - t * vi, xi + t * vi)
if l1 < l:
((l, r), (l1, r1)) = ((l1, r1), (l, r))
if l1 > r:
return False
(l, r... |
d, m = map(int, input().split())
month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
days = ['Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday']
sumOfMonths = 0
for i in range(m - 1):
sumOfMonths += month[i]
result = sumOfMonths + d - 1
print(days[result % 7])
| (d, m) = map(int, input().split())
month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
days = ['Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday']
sum_of_months = 0
for i in range(m - 1):
sum_of_months += month[i]
result = sumOfMonths + d - 1
print(days[result % 7]) |
#
# PySNMP MIB module HM2-PLATFORM-SWITCHING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HM2-PLATFORM-SWITCHING-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:19:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint) ... |
def pytest_addoption(parser):
# Where to find curl-impersonate's binaries
parser.addoption("--install-dir", action="store", default="/usr/local")
parser.addoption("--capture-interface", action="store", default="eth0")
| def pytest_addoption(parser):
parser.addoption('--install-dir', action='store', default='/usr/local')
parser.addoption('--capture-interface', action='store', default='eth0') |
#INPUT
lines = open('input.txt').read().split()
dummy = ['forward', '5', 'down', '5', 'forward', '8', 'up', '3', 'down', '8', 'forward', '2']
#FIRST PROBLEM
def problemPart1(data):
horizontal = 0
depth = 0
for i in range(0, len(data), 2):
if data[i] == 'down':
depth += int(data[i+1])
... | lines = open('input.txt').read().split()
dummy = ['forward', '5', 'down', '5', 'forward', '8', 'up', '3', 'down', '8', 'forward', '2']
def problem_part1(data):
horizontal = 0
depth = 0
for i in range(0, len(data), 2):
if data[i] == 'down':
depth += int(data[i + 1])
elif data[i] ... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
class HlsColor:
def __init__(self, hue, luminance, saturation):
self.hue = hue
self.luminance = luminance
self.saturation = saturation
def Lighten(self, percent):
self.luminance *= (1.0 + percent)
... | class Hlscolor:
def __init__(self, hue, luminance, saturation):
self.hue = hue
self.luminance = luminance
self.saturation = saturation
def lighten(self, percent):
self.luminance *= 1.0 + percent
if self.luminance > 1.0:
self.luminance = 1.0
def darken(s... |
class DataFile:
def __init__(self, datetime, chart, datafile):
self.Datetime = datetime
self.Chart = chart
self.Datafile = datafile
return | class Datafile:
def __init__(self, datetime, chart, datafile):
self.Datetime = datetime
self.Chart = chart
self.Datafile = datafile
return |
entries = [
{
'env-title': 'atari-alien',
'env-variant': 'No-op start',
'score': 3166,
},
{
'env-title': 'atari-amidar',
'env-variant': 'No-op start',
'score': 1735,
},
{
'env-title': 'atari-assault',
'env-variant': 'No-op start',
... | entries = [{'env-title': 'atari-alien', 'env-variant': 'No-op start', 'score': 3166}, {'env-title': 'atari-amidar', 'env-variant': 'No-op start', 'score': 1735}, {'env-title': 'atari-assault', 'env-variant': 'No-op start', 'score': 7203}, {'env-title': 'atari-asterix', 'env-variant': 'No-op start', 'score': 406211}, {'... |
class XMLDeclStrip:
"""
Strip "<?xml" declarations from a stream of data.
This is an ugly work around for several problems.
1. The XML stream comes over TCP, and may be arbitrarily broken up at any
point in time.
2. The Android ATAK client sends every COT Event as a complete XML document
... | class Xmldeclstrip:
"""
Strip "<?xml" declarations from a stream of data.
This is an ugly work around for several problems.
1. The XML stream comes over TCP, and may be arbitrarily broken up at any
point in time.
2. The Android ATAK client sends every COT Event as a complete XML document
... |
def first_last6(nums):
if nums[0] == 6 or nums[-1] == 6:
return True
else:
return False
def same_first_last(nums):
if len(nums) >= 1 and nums[0] == nums[-1]:
return True
else:
return False
def make_pi():
return [3, 1, 4]
def common_end(a, b):
if a[-1] == b[-1] or a[0] == b[0]:
return ... | def first_last6(nums):
if nums[0] == 6 or nums[-1] == 6:
return True
else:
return False
def same_first_last(nums):
if len(nums) >= 1 and nums[0] == nums[-1]:
return True
else:
return False
def make_pi():
return [3, 1, 4]
def common_end(a, b):
if a[-1] == b[-1] ... |
# MenuTitle: Fix Component Order
# -*- coding: utf-8 -*-
__doc__ = """
Searches all glyphs for any component of type 'Mark' at index 0 in the components list, and moves it to the end if found.
"""
Glyphs.clearLog()
Glyphs.font.disableUpdateInterface()
def reportCorrectedComponents(gylyphName, layerName, componentNa... | __doc__ = "\nSearches all glyphs for any component of type 'Mark' at index 0 in the components list, and moves it to the end if found.\n"
Glyphs.clearLog()
Glyphs.font.disableUpdateInterface()
def report_corrected_components(gylyphName, layerName, componentName):
print('Reordered {2} on layer {1} in glyph {0}'.for... |
data_set = []
# UNix time stamp
PHASE_1 = 1341214200 # before 02-07-2012 01:00:00 PM
PHASE_2 = 1341253799 # After PHASE_1 till 02-07-2012 11:59:59 PM
PHASE_3 = 1341368999 # After PHASE_2 till 04-07-2012 07:59:59 AM
file1 = 0
file2 = 0
file3 = 0
file4 = 0
def extract_in_list():
with open("/home/darkmatter/Do... | data_set = []
phase_1 = 1341214200
phase_2 = 1341253799
phase_3 = 1341368999
file1 = 0
file2 = 0
file3 = 0
file4 = 0
def extract_in_list():
with open('/home/darkmatter/Documents/Network/data/higgs-activity_time.txt') as data_file:
for text in data_file:
text = text.strip()
data_set.... |
class Solution:
def oddCells(self, n, m, indices):
rows, cols = {}, {}
for r, c in indices:
if r in rows:
rows[r] += 1
else:
rows[r] = 1
if c in cols:
cols[c] += 1
else:
cols[c] = 1
... | class Solution:
def odd_cells(self, n, m, indices):
(rows, cols) = ({}, {})
for (r, c) in indices:
if r in rows:
rows[r] += 1
else:
rows[r] = 1
if c in cols:
cols[c] += 1
else:
cols[c] = ... |
class ZabbixError(Exception):
"""
Base zabbix error
"""
pass
| class Zabbixerror(Exception):
"""
Base zabbix error
"""
pass |
# puzzle easy // https://www.codingame.com/ide/puzzle/object-insertion
# needed values
obj, grid, start, sol= [], [], [], []
count_star = 0
# game input()
row_all, cal_all = [int(i) for i in input().split()]
for i in range(row_all): obj.append(input())
c, d = [int(i) for i in input().split()]
for i in range(c): gr... | (obj, grid, start, sol) = ([], [], [], [])
count_star = 0
(row_all, cal_all) = [int(i) for i in input().split()]
for i in range(row_all):
obj.append(input())
(c, d) = [int(i) for i in input().split()]
for i in range(c):
grid.append(input())
count_star = sum((_.count('*') for _ in obj))
def way(row_o, cal_o, ro... |
def bfs(graph, s):
explored = []
q = [s]
while q:
u = q.pop(0)
for (v, w) in [(v, w) for (v, w) in graph if v == u and w not in explored]:
explored.append(w)
q.append(w)
print(explored)
if __name__ == '__main__':
graph = [('s', 'a'), ('s', 'b'), ('a', 'c'),... | def bfs(graph, s):
explored = []
q = [s]
while q:
u = q.pop(0)
for (v, w) in [(v, w) for (v, w) in graph if v == u and w not in explored]:
explored.append(w)
q.append(w)
print(explored)
if __name__ == '__main__':
graph = [('s', 'a'), ('s', 'b'), ('a', 'c'), ('... |
class Statistics:
def __init__(self):
self.stat={
'python':0,
'sql': 0,
'django': 0,
'rest': 0,
'c++': 0,
'linux': 0,
'api': 0,
'http': 0,
'flask': 0,
'java': 0,
'git': 0,
... | class Statistics:
def __init__(self):
self.stat = {'python': 0, 'sql': 0, 'django': 0, 'rest': 0, 'c++': 0, 'linux': 0, 'api': 0, 'http': 0, 'flask': 0, 'java': 0, 'git': 0, 'javascript': 0, 'pytest': 0, 'postgresql': 0, 'oracle': 0, 'mysql': 0, 'mssql': 0}
def go_seek(self, s):
n = 0
... |
v1 = int(input('Digite um valor:'))
v2 = int(input('Digite outro valor:'))
re = (v1+v2)
print ('O valor da soma entre {} e {} tem o resultado {}!'.format(v1,v2,re))
| v1 = int(input('Digite um valor:'))
v2 = int(input('Digite outro valor:'))
re = v1 + v2
print('O valor da soma entre {} e {} tem o resultado {}!'.format(v1, v2, re)) |
class Player(object):
"""
Base class for players
"""
def __init__(self, name):
"""
:param name: player's name (str)
"""
self.name = name
def play(self, state):
"""
Human player is asked to choose a move, AI player
decides which move to play.
:param state: Current state of the game (GameState)
"... | class Player(object):
"""
Base class for players
"""
def __init__(self, name):
"""
:param name: player's name (str)
"""
self.name = name
def play(self, state):
"""
Human player is asked to choose a move, AI player
decides which move to play.
:param state: Current state... |
# Generate random rewards for each treatment
if self.action["treatment"] == "1":
self.reward["value"] = np.random.binomial(1,0.5)
else: #Treatment = 2
self.reward["value"] = np.random.binomial(1,0.3)
| if self.action['treatment'] == '1':
self.reward['value'] = np.random.binomial(1, 0.5)
else:
self.reward['value'] = np.random.binomial(1, 0.3) |
def create_matrix(size):
matrix = []
for _ in range(size):
matrix.append([x for x in input().split()])
return matrix
def find_start(matrix, size):
for r in range(size):
for c in range(size):
if matrix[r][c] == 's':
return r, c
def get_coals_count(matrix, s... | def create_matrix(size):
matrix = []
for _ in range(size):
matrix.append([x for x in input().split()])
return matrix
def find_start(matrix, size):
for r in range(size):
for c in range(size):
if matrix[r][c] == 's':
return (r, c)
def get_coals_count(matrix, s... |
"""09. Run an object detection model on your webcam
==================================================
This article will shows how to play with pre-trained object detection models by running
them directly on your webcam video stream.
.. note::
- This tutorial has only been tested in a MacOS environment
- Pyt... | """09. Run an object detection model on your webcam
==================================================
This article will shows how to play with pre-trained object detection models by running
them directly on your webcam video stream.
.. note::
- This tutorial has only been tested in a MacOS environment
- Pyt... |
# -*- coding: utf-8 -*-
def main():
a, s = map(int, input().split())
if a >= s:
print('Congratulations!')
else:
print('Enjoy another semester...')
if __name__ == '__main__':
main()
| def main():
(a, s) = map(int, input().split())
if a >= s:
print('Congratulations!')
else:
print('Enjoy another semester...')
if __name__ == '__main__':
main() |
'''
Edit the program provided so that it receives a series of numbers from the user and allows the user to press the enter
key to indicate that he or she is finished providing inputs. After the user presses the enter key,
the program should print:
The sum of the numbers
The average of the numbers
An example of the pr... | """
Edit the program provided so that it receives a series of numbers from the user and allows the user to press the enter
key to indicate that he or she is finished providing inputs. After the user presses the enter key,
the program should print:
The sum of the numbers
The average of the numbers
An example of the pr... |
# you will learn more about superclass and subclass
print("Hello let's start the class")
class parents:
var1 = "one"
var2 = "two"
class child(parents):
# var1 = "one"
# var2 = "two"
var2 = "three"
obj = parents()
cobj = child()
print(obj.var1)
print(obj.var2)
print(cobj.var1)
pri... | print("Hello let's start the class")
class Parents:
var1 = 'one'
var2 = 'two'
class Child(parents):
var2 = 'three'
obj = parents()
cobj = child()
print(obj.var1)
print(obj.var2)
print(cobj.var1)
print(cobj.var2) |
def cal(n):
k=0
while n>0:
k+=(n%10)**5
n//=10
return k
sum=0
for i in range(2,1000000):
if cal(i)==i:
sum+=i
print(sum) | def cal(n):
k = 0
while n > 0:
k += (n % 10) ** 5
n //= 10
return k
sum = 0
for i in range(2, 1000000):
if cal(i) == i:
sum += i
print(sum) |
books_file = 'books.txt'
def create_book_table():
with open(books_file, 'w') as file:
pass # just to make sure the file is there
def get_all_books():
with open(books_file, 'r') as file:
lines = [line.strip().split(',') for line in file.readlines()]
return [
{'name': line[0], 'a... | books_file = 'books.txt'
def create_book_table():
with open(books_file, 'w') as file:
pass
def get_all_books():
with open(books_file, 'r') as file:
lines = [line.strip().split(',') for line in file.readlines()]
return [{'name': line[0], 'author': line[1], 'read': line[2]} for line in lines... |
def entrance_light(payload):
jval = json.loads(payload)
if("click" in jval and jval["click"] == "single"):
if(lights["Entrance White 1"].on):
lights["Entrance White 1"].on = False
lights["Entrance White 2"].on = False
log.debug("entrance_light> off")
else:
... | def entrance_light(payload):
jval = json.loads(payload)
if 'click' in jval and jval['click'] == 'single':
if lights['Entrance White 1'].on:
lights['Entrance White 1'].on = False
lights['Entrance White 2'].on = False
log.debug('entrance_light> off')
else:
... |
class Solution:
def maxWidthRamp(self, A):
result = 0
if not A:
return result
stack = []
for i, num in enumerate(A):
if not stack or A[stack[-1]] > num:
stack.append(i)
for j in reversed(range(len(A))):
while stack and A[sta... | class Solution:
def max_width_ramp(self, A):
result = 0
if not A:
return result
stack = []
for (i, num) in enumerate(A):
if not stack or A[stack[-1]] > num:
stack.append(i)
for j in reversed(range(len(A))):
while stack and ... |
# my_list=['honda','honda','bmw','mercedes','bugatti']
# print(my_list.index('honda'))
# print(my_list[0])
# print(my_list.count('honda'))
# my_list.sort()
# print(my_list)
# my_list.pop()
# print(my_list)
# my_list=['honda','honda','bmw','mercedes','bugatti']
# copy_my_list=my_list.copy()
# print(copy_my_list)
# l... | data = ['Wt', 'Ht', 342432423424324, 5.996, 5.77778, 'Insurance_History_2', 34243242342432124545312312534534534, 'Insurance_History_4', 'Insurance_History_5', 'Insurance_History_7', 234242049004328402384023849028402348203, 55, 66, 11, 'Medical_Keyword_3', 'Medical_Keyword_4', 'Medical_Keyword_5', 'Medical_Keyword_6', 3... |
"""
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
"""
# Write your code here
s = input()
points = [(0, 0)]
x = y = 0
for... | """
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
"""
s = input()
points = [(0, 0)]
x = y = 0
for move in s:
if move ... |
class Lamp:
def __init__(self, color):
self.color=color
self.on=False
def state(self):
return "The lamp is off." if not self.on else "The lamp is on."
def toggle_switch(self):
self.on=not self.on | class Lamp:
def __init__(self, color):
self.color = color
self.on = False
def state(self):
return 'The lamp is off.' if not self.on else 'The lamp is on.'
def toggle_switch(self):
self.on = not self.on |
def test_add():
class Number:
def __add__(self, other):
return 4 + other
def __radd__(self, other):
return other + 4
a = Number()
assert 3 + a == 7
assert a + 3 == 7
def test_inheritance():
class Node(object):
def __init__(self, a, b, c):
... | def test_add():
class Number:
def __add__(self, other):
return 4 + other
def __radd__(self, other):
return other + 4
a = number()
assert 3 + a == 7
assert a + 3 == 7
def test_inheritance():
class Node(object):
def __init__(self, a, b, c):
... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def diameterOfBinaryTree(self, root: TreeNode) -> int:
_, res = self.max_depth(root)
return res
def max_depth(self, ... | class Solution:
def diameter_of_binary_tree(self, root: TreeNode) -> int:
(_, res) = self.max_depth(root)
return res
def max_depth(self, node: TreeNode) -> int:
if node is None:
return (-1, 0)
(left_depth, left_max) = self.max_depth(node.left)
(right_depth, ... |
# Copyright 2016 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# for use with servo INA adapter board. If measuring via servo V1 this can just
# be ignored. clobber_ok added if user wishes to include servo_loc.xml
#... | inline = '\n <map>\n <name>adc_mux</name>\n <doc>valid mux values for DUT\'s two banks of INA219 off PCA9540\n ADCs</doc>\n <params clobber_ok="" none="0" bank0="4" bank1="5"></params>\n </map>\n <control>\n <name>adc_mux</name>\n <doc>4 to 1 mux to steer remote i2c i2c_mux:rem to two sets of\n ... |
response = sm.sendAskYesNo("Would you like to go back to Victoria Island?")
if response:
if sm.hasQuest(38030):
sm.setQRValue(38030, "clear", False)
sm.warp(100000000, 23)
sm.dispose()
sm.warp(104020000, 0)
| response = sm.sendAskYesNo('Would you like to go back to Victoria Island?')
if response:
if sm.hasQuest(38030):
sm.setQRValue(38030, 'clear', False)
sm.warp(100000000, 23)
sm.dispose()
sm.warp(104020000, 0) |
# Write your solutions for 1.5 here!
class superheros:
def __init__(self, name, superpower, strength):
self.name = name
self.superpower = superpower
self.strength = strength
def gaya(self):
print(self.name)
| class Superheros:
def __init__(self, name, superpower, strength):
self.name = name
self.superpower = superpower
self.strength = strength
def gaya(self):
print(self.name) |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def kthSmallest(self, root: Optional[TreeNode], k: int) -> int:
ordered_list = []
def inor... | class Solution:
def kth_smallest(self, root: Optional[TreeNode], k: int) -> int:
ordered_list = []
def inorder_traverse(node):
nonlocal ordered_list
if not node:
return
if len(ordered_list) >= k:
return
inorder_travers... |
TYPE_MAP = {
0: 'bit',
1: 'u32',
2: 's32',
3: 'float',
'bit': 0,
'u32': 1,
's32': 2,
'float': 3,
}
class HalType(object):
bit = 0
u32 = 1
s32 = 2
float = 3
@classmethod
def toString(self, typ):
return TYPE_MAP[typ]
| type_map = {0: 'bit', 1: 'u32', 2: 's32', 3: 'float', 'bit': 0, 'u32': 1, 's32': 2, 'float': 3}
class Haltype(object):
bit = 0
u32 = 1
s32 = 2
float = 3
@classmethod
def to_string(self, typ):
return TYPE_MAP[typ] |
# Welcome to the interactive tutorial for PBUnit! Please read the
# descriptions and follow the instructions for each example.
#
# Let's start with writing unit tests and using Projection Boxes:
#
# 1. Edit the unit test below to use your name and initials.
# 2. Click your mouse on each line of code in the function to ... | def initials(name):
parts = name.split(' ')
letters = ''
for part in parts:
letters += part[0]
return letters
def factorial(n):
if n <= 0:
return 1
result = 1
for factor in range(2, n + 1):
result *= factor
return result
def average(nums):
total = 0
for ... |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
MMS_WORKSPACE_API_VERSION = '2018-11-19'
MMS_ROUTE_API_VERSION = 'v1.0'
MMS_SYNC_TIMEOUT_SECONDS = 80
MMS_SERVICE_VALIDATE_OPERATION... | mms_workspace_api_version = '2018-11-19'
mms_route_api_version = 'v1.0'
mms_sync_timeout_seconds = 80
mms_service_validate_operation_timeout_seconds = 30
mms_service_exist_check_sync_timeout_seconds = 5
mms_resource_check_sync_timeout_seconds = 15
supported_runtimes = {'spark-py': 'SparkPython', 'python': 'Python', 'py... |
class LinkedListTreeTraversal:
def __init__(self, data):
self.tree = data
# bfsTraversal is a recursive version of bfs traversal
def bfsTraversal(self):
root = self.tree
queue = []
path = []
if self.tree == None:
return []
queue.append(root)
... | class Linkedlisttreetraversal:
def __init__(self, data):
self.tree = data
def bfs_traversal(self):
root = self.tree
queue = []
path = []
if self.tree == None:
return []
queue.append(root)
path = self.bfsTraversalUtil(queue, path)
retu... |
#
# 258. Add Digits
#
# Q: https://leetcode.com/problems/add-digits/
# A: https://leetcode.com/problems/add-digits/discuss/756944/Javascript-Python3-C%2B%2B-1-Liners
#
# using reduce() to accumulate the digits of x
class Solution:
def addDigits(self, x: int) -> int:
return x if x < 10 else self.addDigits(r... | class Solution:
def add_digits(self, x: int) -> int:
return x if x < 10 else self.addDigits(reduce(lambda a, b: a + b, map(lambda s: int(s), str(x))))
class Solution:
def add_digits(self, x: int) -> int:
return x if x < 10 else self.addDigits(sum(map(lambda c: int(c), str(x)))) |
#!/usr/bin/env python3
class Cavern:
def __init__(self, mapstring):
self.mapstring = mapstring
self.initialize(mapstring)
def initialize(self, mapstring, elf_attack = 3):
self.walls = set()
self.units = {}
self.elf_initial = 0
for y, line in enumerate(ma... | class Cavern:
def __init__(self, mapstring):
self.mapstring = mapstring
self.initialize(mapstring)
def initialize(self, mapstring, elf_attack=3):
self.walls = set()
self.units = {}
self.elf_initial = 0
for (y, line) in enumerate(mapstring.split('\n')):
... |
ROLE_METHODS = {
'google.iam.admin.v1.CreateRole', 'google.iam.admin.v1.DeleteRole',
'google.iam.admin.v1.UpdateRole'
}
def rule(event):
return (event['resource'].get('type') == 'iam_role' and
event['protoPayload'].get('methodName') in ROLE_METHODS)
def dedup(event):
return event['resour... | role_methods = {'google.iam.admin.v1.CreateRole', 'google.iam.admin.v1.DeleteRole', 'google.iam.admin.v1.UpdateRole'}
def rule(event):
return event['resource'].get('type') == 'iam_role' and event['protoPayload'].get('methodName') in ROLE_METHODS
def dedup(event):
return event['resource'].get('labels', {}).get... |
# -*- coding: utf-8 -*-
# Common constants for submit
SUBMIT_RESPONSE_ERROR = 'CERR'
SUBMIT_RESPONSE_OK = 'OK'
SUBMIT_RESPONSE_PROTOCOL_CORRUPTED = 'PROTCOR'
| submit_response_error = 'CERR'
submit_response_ok = 'OK'
submit_response_protocol_corrupted = 'PROTCOR' |
class DateTime(object,IComparable,IFormattable,IConvertible,ISerializable,IComparable[DateTime],IEquatable[DateTime]):
"""
Represents an instant in time,typically expressed as a date and time of day.
DateTime(ticks: Int64)
DateTime(ticks: Int64,kind: DateTimeKind)
DateTime(year: int,month: int,day:... | class Datetime(object, IComparable, IFormattable, IConvertible, ISerializable, IComparable[DateTime], IEquatable[DateTime]):
"""
Represents an instant in time,typically expressed as a date and time of day.
DateTime(ticks: Int64)
DateTime(ticks: Int64,kind: DateTimeKind)
DateTime(year: int,month: int,day: ... |
text = 'shakespeare.txt'
output = 'output_file.txt'
f = open(output, 'r')
o = open(text, 'w')
for line in f:
o.write(line)
f.close()
o.close() | text = 'shakespeare.txt'
output = 'output_file.txt'
f = open(output, 'r')
o = open(text, 'w')
for line in f:
o.write(line)
f.close()
o.close() |
{
"targets": [
{
"target_name": "scsSDKTelemetry",
"sources": [ "scsSDKTelemetry.cc" ],
"cflags": ["-fexceptions"],
"cflags_cc": ["-fexceptions"]
}
]
} | {'targets': [{'target_name': 'scsSDKTelemetry', 'sources': ['scsSDKTelemetry.cc'], 'cflags': ['-fexceptions'], 'cflags_cc': ['-fexceptions']}]} |
"""
cargo-raze crate workspace functions
DO NOT EDIT! Replaced on runs of cargo-raze
"""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
def _new_http_archive(name, **kwargs):
if not native.existing_rule(name):
... | """
cargo-raze crate workspace functions
DO NOT EDIT! Replaced on runs of cargo-raze
"""
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
load('@bazel_tools//tools/build_defs/repo:git.bzl', 'new_git_repository')
def _new_http_archive(name, **kwargs):
if not native.existing_rule(name):
... |
# Flags
quiet_mode = False
no_log = False
no_cleanup = False
all_containers = False
no_confirm = False
no_backup = False
# intern Flags
keep_maintenance_mode = False
def set_flags(flags=list):
global no_confirm
global all_containers
global quiet_mode
global no_log
global no_cleanup
global no_... | quiet_mode = False
no_log = False
no_cleanup = False
all_containers = False
no_confirm = False
no_backup = False
keep_maintenance_mode = False
def set_flags(flags=list):
global no_confirm
global all_containers
global quiet_mode
global no_log
global no_cleanup
global no_backup
no_confirm = '... |
class Solution:
def solve(self, n):
# Write your code here
l = ['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'
]
s = ""
while n > 26:
j = n%26
... | class Solution:
def solve(self, n):
l = ['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']
s = ''
while n > 26:
j = n % 26
n = n // 26
s += l[j - 1]
if n <= 26:
... |
class Base:
base_url = "https://localhost"
def __init__(self, *args, **kwargs):
pass
| class Base:
base_url = 'https://localhost'
def __init__(self, *args, **kwargs):
pass |
def reward_function(params):
distance_from_center = params['distance_from_center']
progress = params['progress']
on_track = params["all_wheels_on_track"]
'''
Example that penalizes slow driving. This create a non-linear reward function so it may take longer to learn.
'''
# Calculate 3 marks... | def reward_function(params):
distance_from_center = params['distance_from_center']
progress = params['progress']
on_track = params['all_wheels_on_track']
'\n Example that penalizes slow driving. This create a non-linear reward function so it may take longer to learn.\n '
marker_1 = 0.1 * param... |
test_list = [-2, 1, 3, -6]
print(f'before', test_list)
test_list.sort(key=abs)
print(f'before', test_list) | test_list = [-2, 1, 3, -6]
print(f'before', test_list)
test_list.sort(key=abs)
print(f'before', test_list) |
class Request:
def __init__(self, req_id: int, emp_id: int, req_amount: float, req_desc: str,
req_date: str, approved: bool, mgr_message: str, reviewed: bool):
self.req_id = req_id
self.emp_id = emp_id
self.req_amount = req_amount
self.req_desc = req_desc
sel... | class Request:
def __init__(self, req_id: int, emp_id: int, req_amount: float, req_desc: str, req_date: str, approved: bool, mgr_message: str, reviewed: bool):
self.req_id = req_id
self.emp_id = emp_id
self.req_amount = req_amount
self.req_desc = req_desc
self.req_date = req... |
class OpenTokException(Exception):
"""Defines exceptions thrown by the OpenTok SDK.
"""
pass
class RequestError(OpenTokException):
"""Indicates an error during the request. Most likely an error connecting
to the OpenTok API servers. (HTTP 500 error).
"""
pass
class AuthError(OpenTokExcep... | class Opentokexception(Exception):
"""Defines exceptions thrown by the OpenTok SDK.
"""
pass
class Requesterror(OpenTokException):
"""Indicates an error during the request. Most likely an error connecting
to the OpenTok API servers. (HTTP 500 error).
"""
pass
class Autherror(OpenTokExcepti... |
def test_count_by_time_categorical(total_spent):
labels = range(2)
total_spent = total_spent.bin(2, labels=labels)
ax = total_spent.plot.count_by_time()
assert ax.get_title() == 'Label Count vs. Cutoff Times'
def test_count_by_time_continuous(total_spent):
ax = total_spent.plot.count_by_time()
... | def test_count_by_time_categorical(total_spent):
labels = range(2)
total_spent = total_spent.bin(2, labels=labels)
ax = total_spent.plot.count_by_time()
assert ax.get_title() == 'Label Count vs. Cutoff Times'
def test_count_by_time_continuous(total_spent):
ax = total_spent.plot.count_by_time()
... |
# Provides numerous
# examples of different options for exception handling
def my_function(x, y):
"""
A simple function to divide x by y
"""
print('my_function in')
solution = x / y
print('my_function out')
return solution
print('Starting')
print(my_function(6, 0))
try:
print('Bef... | def my_function(x, y):
"""
A simple function to divide x by y
"""
print('my_function in')
solution = x / y
print('my_function out')
return solution
print('Starting')
print(my_function(6, 0))
try:
print('Before my_function')
result = my_function(6, 0)
print(result)
print('Af... |
DATABASES_PATH="../tmp/storage"
CREDENTIALS_PATH_BUCKETS="../credentials/tynr/engine/bucketAccess.json"
CREDENTIALS_PATH_FIRESTORE = '../credentials/tynr/engine/firestoreServiceAccount.json'
INGESTION_COLLECTION = "tyns"
INGESTION_BATCH_LIMIT = 1000 | databases_path = '../tmp/storage'
credentials_path_buckets = '../credentials/tynr/engine/bucketAccess.json'
credentials_path_firestore = '../credentials/tynr/engine/firestoreServiceAccount.json'
ingestion_collection = 'tyns'
ingestion_batch_limit = 1000 |
MAIN_WINDOW_STYLE = """
QMainWindow {
background: white;
}
"""
BUTTON_STYLE = """
QPushButton {
background-color: transparent;
border-style:none;
}
QPushButton:hover{
background-color: qradialgradient(cx:0, cy:0, radius: 1, fx:1, fy:1, stop:0 #c0c5ce, stop:1 #a7adba);
border-style:none;
}
"""
| main_window_style = '\nQMainWindow {\n background: white;\n}\n'
button_style = '\nQPushButton {\n background-color: transparent;\n border-style:none;\n}\nQPushButton:hover{\n background-color: qradialgradient(cx:0, cy:0, radius: 1, fx:1, fy:1, stop:0 #c0c5ce, stop:1 #a7adba);\n border-style:none;\n}\n' |
__all__ = ['EXPERIMENTS']
EXPERIMENTS = ','.join([
'ig_android_sticker_search_explorations',
'android_ig_camera_ar_asset_manager_improvements_universe',
'ig_android_stories_seen_state_serialization',
'ig_stories_photo_time_duration_universe',
'ig_android_bitmap_cache_executor_size',
'ig_androi... | __all__ = ['EXPERIMENTS']
experiments = ','.join(['ig_android_sticker_search_explorations', 'android_ig_camera_ar_asset_manager_improvements_universe', 'ig_android_stories_seen_state_serialization', 'ig_stories_photo_time_duration_universe', 'ig_android_bitmap_cache_executor_size', 'ig_android_stories_music_search_type... |
# Copyright 2004 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
"""
defines types visitor class interface
"""
class type_visitor_t(object):
"""
types visitor interface
All functi... | """
defines types visitor class interface
"""
class Type_Visitor_T(object):
"""
types visitor interface
All functions within this class should be redefined in derived classes.
"""
def __init__(self):
object.__init__(self)
def visit_void(self):
raise not_implemented_error(... |
"""
Copyright 2022 Searis AS
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/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... | """
Copyright 2022 Searis AS
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/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... |
"jq_eval rule"
load("@bazel_skylib//lib:collections.bzl", "collections")
load("@bazel_skylib//lib:shell.bzl", "shell")
_DOC = "Defines a jq eval execution."
_ATTRS = {
"srcs": attr.label_list(
doc = "Files to apply filter to.",
allow_files = True,
),
"filter": attr.string(
doc = "... | """jq_eval rule"""
load('@bazel_skylib//lib:collections.bzl', 'collections')
load('@bazel_skylib//lib:shell.bzl', 'shell')
_doc = 'Defines a jq eval execution.'
_attrs = {'srcs': attr.label_list(doc='Files to apply filter to.', allow_files=True), 'filter': attr.string(doc='Filter to evaluate'), 'filter_file': attr.labe... |
#!/usr/bin/env python3
"""Codon/Amino Acid table conversion"""
codon_table = """
Isoleucine ATT ATC ATA
Leucine CTT CTC CTA CTG TTA TTG
Valine GTT GTC GTA GTG
Phenylalanine TTT TTC
Methionine ATG
Cysteine TGT TGC
Alanine GCT GCC GCA GCG
Glycine GGT GGC GGA GGG
Proline ... | """Codon/Amino Acid table conversion"""
codon_table = '\nIsoleucine ATT ATC ATA\nLeucine CTT CTC CTA CTG TTA TTG\nValine GTT GTC GTA GTG\nPhenylalanine TTT TTC\nMethionine ATG\nCysteine TGT TGC\nAlanine GCT GCC GCA GCG\nGlycine GGT GGC GGA GGG\nProline CCT CCC CCA CCG\nThreonin... |
"""
Code for computing the mean.
Using a list of tuples.
"""
def mean(l):
s=0
for i in t:
s = s +(i[0] * i[1])
return s
t = []
x= (0,0.2)
t.append(x)
t.append((137,0.55))
t.append((170,0.25))
print(t)
print(mean(t))
| """
Code for computing the mean.
Using a list of tuples.
"""
def mean(l):
s = 0
for i in t:
s = s + i[0] * i[1]
return s
t = []
x = (0, 0.2)
t.append(x)
t.append((137, 0.55))
t.append((170, 0.25))
print(t)
print(mean(t)) |
# encoding: utf-8
# Copyright 2008 California Institute of Technology. ALL RIGHTS
# RESERVED. U.S. Government Sponsorship acknowledged.
'''
Unit, functional, and other tests.
'''
| """
Unit, functional, and other tests.
""" |
#function to get a string made of its first three characters of a specified string.
# If the length of the string is less than 3 then return the original string.
def first_three(str):
return str[:3] if len(str) > 3 else str
print(first_three('ipy'))
print(first_three('python'))
print(first_three('py')) | def first_three(str):
return str[:3] if len(str) > 3 else str
print(first_three('ipy'))
print(first_three('python'))
print(first_three('py')) |
#!/usr/bin/env python
"""
Description: Fractional Backpack
args:
goods:[(price, weight)...]
capacity: the total capacity of bag
return:
num_goods: the number of each goods
val: total value of the bag
"""
def fractional_backpack(goods: list(tuple), capacity: int) -> (list, int | float):
# initiali... | """
Description: Fractional Backpack
args:
goods:[(price, weight)...]
capacity: the total capacity of bag
return:
num_goods: the number of each goods
val: total value of the bag
"""
def fractional_backpack(goods: list(tuple), capacity: int) -> (list, int | float):
num_goods = [0 for _ in range(len(... |
def factorial_digit_sum(num):
fact_total = 1
while num != 1:
fact_total *= num
num -= 1
fact_total_str = str(fact_total)
total_list = []
sum_total = 0
for i in fact_total_str:
total_list.append(i)
for i in total_list:
sum_total += int(i)
... | def factorial_digit_sum(num):
fact_total = 1
while num != 1:
fact_total *= num
num -= 1
fact_total_str = str(fact_total)
total_list = []
sum_total = 0
for i in fact_total_str:
total_list.append(i)
for i in total_list:
sum_total += int(i)
return sum_total
p... |
# This is an input class. Do not edit.
class LinkedList:
def __init__(self, value):
self.value = value
self.next = None
# O(n) time | O(n) space - where n is the number of nodes in the Linked List
def nodeSwap(head):
if head is None or head.next is None:
return head
... | class Linkedlist:
def __init__(self, value):
self.value = value
self.next = None
def node_swap(head):
if head is None or head.next is None:
return head
next_node = head.next
head.next = node_swap(head.next.next)
nextNode.next = head
return nextNode |
arrow_array = [
[[0,1,0],
[1,1,1],
[0,1,0],
[0,1,0],
[0,1,0]]
]
print(arrow_array[0][0][0]) | arrow_array = [[[0, 1, 0], [1, 1, 1], [0, 1, 0], [0, 1, 0], [0, 1, 0]]]
print(arrow_array[0][0][0]) |
TREE = "#"
def hit_test(map_, y, x, width) -> bool:
while x >= width:
x -= width
return map_[y][x] == TREE
def hit_test_map(map_, vy, vx) -> int:
height, width = len(map_), len(map_[0])
r = 0
for x, y in enumerate(range(0, height, vy)):
r += hit_test(map_, y, x * vx, width)
r... | tree = '#'
def hit_test(map_, y, x, width) -> bool:
while x >= width:
x -= width
return map_[y][x] == TREE
def hit_test_map(map_, vy, vx) -> int:
(height, width) = (len(map_), len(map_[0]))
r = 0
for (x, y) in enumerate(range(0, height, vy)):
r += hit_test(map_, y, x * vx, width)
... |
'''
Vibrator
=======
The :class:`Vibrator` provides access to public methods to use vibrator of your
device.
.. note::
On Android your app needs the VIBRATE permission to
access the vibrator.
Simple Examples
---------------
To vibrate your device::
>>> from plyer import vibrator
>>> time=2
>>> ... | """
Vibrator
=======
The :class:`Vibrator` provides access to public methods to use vibrator of your
device.
.. note::
On Android your app needs the VIBRATE permission to
access the vibrator.
Simple Examples
---------------
To vibrate your device::
>>> from plyer import vibrator
>>> time=2
>>> ... |
#
# PySNMP MIB module ONEACCESS-SYS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ONEACCESS-SYS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:34:42 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, constraints_union, value_range_constraint, single_value_constraint) ... |
# all test parameters are declared here
delay = 5 #no of seconds to wait before deciding to exit
chrome_driver_path = '/home/apalya/browsers/chromedriver2.46'
website = 'http://www.sunnxt.com'
signin_text = 'Sign In'
profile_icon_xpath = '//span[@class="icomoon icon-icn_profile"]'
signin_link_xpath = '//ul[@class="sig... | delay = 5
chrome_driver_path = '/home/apalya/browsers/chromedriver2.46'
website = 'http://www.sunnxt.com'
signin_text = 'Sign In'
profile_icon_xpath = '//span[@class="icomoon icon-icn_profile"]'
signin_link_xpath = '//ul[@class="signinicon dropdown-menu dropdown-menu-right logg"]/li/a'
signin_modal_close_xpath = '//but... |
num_usernames = int(input())
usernames = set()
for _ in range(num_usernames):
username = input()
usernames.add(username)
[print(name) for name in usernames]
| num_usernames = int(input())
usernames = set()
for _ in range(num_usernames):
username = input()
usernames.add(username)
[print(name) for name in usernames] |
"""Do not import this package.
This file is required by pylint and this docstring is required by pydocstyle.
"""
| """Do not import this package.
This file is required by pylint and this docstring is required by pydocstyle.
""" |
num = int(input())
words = []
for i in range(num):
words.append(input())
words.sort()
for word in words:
print(word) | num = int(input())
words = []
for i in range(num):
words.append(input())
words.sort()
for word in words:
print(word) |
# def make_table():
# colors_distance = {
# 'black': {'black': 0, 'brown': 0, 'beige': 0, 'gray': 0, 'white': 0, 'blue': 0,
# 'petrol': 0, 'turquoise': 0, 'green': 0,
# 'olive': 0, 'yellow': 0, 'orange': 0, 'red': 0, 'pink': 0, 'purple': 0},
# 'brown': {'black': 0... | colors_combinations = [('black', 'red', 'gray'), ('black', 'petrol', 'white'), ('brown', 'gray', 'olive'), ('brown', 'yellow', 'beige'), ('beige', 'green', 'white'), ('beige', 'orange', 'black'), ('gray', 'beige', 'white'), ('gray', 'petrol', 'white'), ('white', 'olive', 'yellow'), ('white', 'orange', 'green'), ('blue'... |
""" Client (App) Agent singleton
More description - TBD
"""
#
# Author: Eric Gustafson <eg-git@elfwerks.org> (29 Aug 2015)
#
# ############################################################
# import statement
def init_agent(**kwargs):
# opportunity for pre/post hooks.
return Agent(**kwargs)
class Agent:
... | """ Client (App) Agent singleton
More description - TBD
"""
def init_agent(**kwargs):
return agent(**kwargs)
class Agent:
def __init__(self, **kwargs):
None |
cpgf._import(None, "builtin.core");
KeyIsDown = [];
def makeMyEventReceiver(receiver) :
for i in range(irr.KEY_KEY_CODES_COUNT) :
KeyIsDown.append(False);
def OnEvent(me, event) :
if event.EventType == irr.EET_KEY_INPUT_EVENT :
KeyIsDown[event.KeyInput.Key + 1] = event.KeyInput.PressedDown;
ret... | cpgf._import(None, 'builtin.core')
key_is_down = []
def make_my_event_receiver(receiver):
for i in range(irr.KEY_KEY_CODES_COUNT):
KeyIsDown.append(False)
def on_event(me, event):
if event.EventType == irr.EET_KEY_INPUT_EVENT:
KeyIsDown[event.KeyInput.Key + 1] = event.KeyInput.Pres... |
class AttemptResults(list):
def __init__(self, tries):
return super(AttemptResults, self).extend(['ND'] * tries)
| class Attemptresults(list):
def __init__(self, tries):
return super(AttemptResults, self).extend(['ND'] * tries) |
lucky_numbers = [2, 4, 8, 1, 7, 15, 27, 25, 10]
friends = ["yacubu", "rolan", "anatol", "patrick", "jony", "bel"]
friends.extend(lucky_numbers)## take friend and value of lucky num in it
print(friends)
friends.append("toby")
friends.insert(1, "rolax")## add value at index value and all other value get push back
p... | lucky_numbers = [2, 4, 8, 1, 7, 15, 27, 25, 10]
friends = ['yacubu', 'rolan', 'anatol', 'patrick', 'jony', 'bel']
friends.extend(lucky_numbers)
print(friends)
friends.append('toby')
friends.insert(1, 'rolax')
print(friends)
friends.remove('bel')
print(friends)
print(friends.clear())
friends = ['yacubu', 'rolan', 'anato... |
# pylint: disable=missing-function-docstring, missing-module-docstring/
ai = (1,4,5)
ai[0] = 2
bi = ai[0]
ci = 2 * ai[0]
di = 2 * ai[0] + 3 * ai[1]
ei = 2 * ai[0] + bi * ai[1]
fi = ai
gi = (0,)*2
gi[:] = ai[1:]
ad = (1.,4.,5.)
ad[0] = 2.
bd = ad[0]
cd = 2. * ad[0]
dd = 2. * ad[0] + 3. * ad[1]
ed = 2. * ad[0] + bd * ad... | ai = (1, 4, 5)
ai[0] = 2
bi = ai[0]
ci = 2 * ai[0]
di = 2 * ai[0] + 3 * ai[1]
ei = 2 * ai[0] + bi * ai[1]
fi = ai
gi = (0,) * 2
gi[:] = ai[1:]
ad = (1.0, 4.0, 5.0)
ad[0] = 2.0
bd = ad[0]
cd = 2.0 * ad[0]
dd = 2.0 * ad[0] + 3.0 * ad[1]
ed = 2.0 * ad[0] + bd * ad[1]
fd = ad
gd = (0.0,) * 2
gd[:] = ad[1:] |
class IntegrationFeatureRegistry:
def __init__(self):
self.features = []
def register(self, integration_feature):
self.features.append(integration_feature)
self.features.sort(key=lambda f: f.order)
def run_pre_scan(self):
for integration in self.features:
if ... | class Integrationfeatureregistry:
def __init__(self):
self.features = []
def register(self, integration_feature):
self.features.append(integration_feature)
self.features.sort(key=lambda f: f.order)
def run_pre_scan(self):
for integration in self.features:
if in... |
names = ['Dani', 'Ale', 'E. Jose']
message = f'Hey {names[0]}, Thanks for your friendship'
print(message)
message = f'Hey {names[1]}, Thanks for your friendship'
print(message)
message = f'Hey {names[2]}, Thanks for your friendship'
print(message)
| names = ['Dani', 'Ale', 'E. Jose']
message = f'Hey {names[0]}, Thanks for your friendship'
print(message)
message = f'Hey {names[1]}, Thanks for your friendship'
print(message)
message = f'Hey {names[2]}, Thanks for your friendship'
print(message) |
infilename = input()
outfilename = input()
print(infilename,outfilename)
| infilename = input()
outfilename = input()
print(infilename, outfilename) |
class ShrinkwrapConstraint:
distance = None
project_axis = None
project_axis_space = None
project_limit = None
shrinkwrap_type = None
target = None
| class Shrinkwrapconstraint:
distance = None
project_axis = None
project_axis_space = None
project_limit = None
shrinkwrap_type = None
target = None |
"""
In this bite you learn to catch/raise exceptions.
Write a simple division function meeting the following requirements:
when denominator is 0 catch the corresponding exception and return 0.
when numerator or denominator are not of the right type reraise the
corresponding exception.
if the result of the division (... | """
In this bite you learn to catch/raise exceptions.
Write a simple division function meeting the following requirements:
when denominator is 0 catch the corresponding exception and return 0.
when numerator or denominator are not of the right type reraise the
corresponding exception.
if the result of the division (... |
# Let's say it's a wedding day, and two happy people are getting
# married.
# we have a dictionary first_family, which contains the names
# of the wife's family members. For example:
first_family = {"wife": "Janet", "wife's mother": "Katie", "wife's father": "George"}
# And a similar dictionary second_family for the... | first_family = {'wife': 'Janet', "wife's mother": 'Katie', "wife's father": 'George'}
second_family = {'husband': 'Leon', "husband's mother": 'Eva', "husband's father": 'Gaspard', "husband's sister": 'Isabelle'}
first_family = json.loads(input())
second_family = json.loads(input())
big_family = first_family
big_family.... |
class BaseBoa:
NUM_REGRESSION_MODELS_SUPPORTED = 5
reg_model_index = {0: 'dtree',
1: 'knn',
2: 'linreg',
3: 'adaboost',
4: 'rforest',
}
def __repr__(self):
return type(... | class Baseboa:
num_regression_models_supported = 5
reg_model_index = {0: 'dtree', 1: 'knn', 2: 'linreg', 3: 'adaboost', 4: 'rforest'}
def __repr__(self):
return type(self).__name__
def __len__(self):
return len(self.ladder)
def ladder(self):
return self.ladder
def opt... |
# Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implemen... | microcode = "\n\n# All the memory versions need to use LOCK, regardless of if it was set\n\ndef macroop XCHG_R_R\n{\n # Use the xor trick instead of moves to reduce register pressure.\n # This probably doesn't make much of a difference, but it's easy.\n xor reg, reg, regm\n xor regm, regm, reg\n xor reg,... |
T = int(input())
for x in range(1, T + 1):
N = int(input())
names = [input() for index in range(N)]
y = 0
previous = names[0]
for name in names[1:]:
if name < previous:
y += 1
else:
previous = name
print(f"Case #{x}: {y}", flush = True)
| t = int(input())
for x in range(1, T + 1):
n = int(input())
names = [input() for index in range(N)]
y = 0
previous = names[0]
for name in names[1:]:
if name < previous:
y += 1
else:
previous = name
print(f'Case #{x}: {y}', flush=True) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.