content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class DeprecatedKeywords:
def deprecated_library_keyword(self):
"""*DEPRECATED* Use keyword `Not Deprecated With Doc` instead!
Some more doc here. Ignore this in the warning.
"""
pass
def deprecated_library_keyword_with_multiline_message(self):
"""*DEPRECATED* Multilin... | class Deprecatedkeywords:
def deprecated_library_keyword(self):
"""*DEPRECATED* Use keyword `Not Deprecated With Doc` instead!
Some more doc here. Ignore this in the warning.
"""
pass
def deprecated_library_keyword_with_multiline_message(self):
"""*DEPRECATED* Multilin... |
word_to_remove = input()
sequence = input()
while word_to_remove in sequence:
sequence = sequence.replace(word_to_remove, '')
print(sequence)
| word_to_remove = input()
sequence = input()
while word_to_remove in sequence:
sequence = sequence.replace(word_to_remove, '')
print(sequence) |
connection_properties = {
'host': 'localhost',
'port': 3306,
'user': 'username',
'password': 'examplepassword',
'db': 'smartmeter',
'charset': 'utf8mb4'
} | connection_properties = {'host': 'localhost', 'port': 3306, 'user': 'username', 'password': 'examplepassword', 'db': 'smartmeter', 'charset': 'utf8mb4'} |
'''
Common used functions
'''
def length(chain):
aas = ['GLY', 'ALA', 'VAL', 'LEU', 'ILE', 'SER', 'THR', 'ASN', 'GLN',
'PHE', 'TYR', 'TRP', 'CYS', 'MET', 'PRO', 'ASP', 'GLU', 'LYS',
'ARG', 'HIS']
counter = 0
for res in chain.child_list:
if aas.count(res.resname):
... | """
Common used functions
"""
def length(chain):
aas = ['GLY', 'ALA', 'VAL', 'LEU', 'ILE', 'SER', 'THR', 'ASN', 'GLN', 'PHE', 'TYR', 'TRP', 'CYS', 'MET', 'PRO', 'ASP', 'GLU', 'LYS', 'ARG', 'HIS']
counter = 0
for res in chain.child_list:
if aas.count(res.resname):
counter += 1
re... |
# 05/04/2017
def bowl_score(sheet):
total = 0
score = lambda x: 10 if x[1] == '/' else 20 if x == 'XX' else sum([int(n) for n in x])
next_ball = lambda x: 10 if x == 'X' else int(x[0])
next_2_balls = lambda x, y: 10 + next_ball(y[0]) if x == 'X' else score(x[0:2])
frames = sheet.replace('-', '0').... | def bowl_score(sheet):
total = 0
score = lambda x: 10 if x[1] == '/' else 20 if x == 'XX' else sum([int(n) for n in x])
next_ball = lambda x: 10 if x == 'X' else int(x[0])
next_2_balls = lambda x, y: 10 + next_ball(y[0]) if x == 'X' else score(x[0:2])
frames = sheet.replace('-', '0').split()
for... |
# -*- coding: utf-8 -*-
"""
pepipost
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""
class CreateSubaccount(object):
"""Implementation of the 'Create subaccount' model.
CreateSubaccount modal
Attributes:
username (string): provide a ... | """
pepipost
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""
class Createsubaccount(object):
"""Implementation of the 'Create subaccount' model.
CreateSubaccount modal
Attributes:
username (string): provide a username for the subaccount
email (... |
class AeroDB(object):
def __init__(self, aerodb=None, cal=1, area=None):
if isinstance(aerodb, AeroDB):
self.clone(aerodb)
else:
self.clear()
if cal is None and area is None:
raise ValueError("Provide at least one of caliber and area as dimensiona... | class Aerodb(object):
def __init__(self, aerodb=None, cal=1, area=None):
if isinstance(aerodb, AeroDB):
self.clone(aerodb)
else:
self.clear()
if cal is None and area is None:
raise value_error('Provide at least one of caliber and area as dimensional input... |
class Token(object):
def __init__(self, cell, railroad):
self.cell = cell
self.railroad = railroad
class Station(Token):
pass
class PrivateCompanyToken(Token):
@staticmethod
def place(name, cell, railroad, properties):
if railroad.is_removed:
raise ValueError(f"A re... | class Token(object):
def __init__(self, cell, railroad):
self.cell = cell
self.railroad = railroad
class Station(Token):
pass
class Privatecompanytoken(Token):
@staticmethod
def place(name, cell, railroad, properties):
if railroad.is_removed:
raise value_error(f"A... |
# coding: utf-8
# In[ ]:
#Exist Database
database={"log_in":{"User_ID":[100,101,102,103,104,105], "Password":
["@Tanmoy*1234","@Tarpan*1234","@Sagnik*1234","@Nikita*1234"
"@Pritam*1234","@Gautamee*1234"],"Name":["Tanmoy","Tarpan"
,"Sagnik","Nikita","Pr... | database = {'log_in': {'User_ID': [100, 101, 102, 103, 104, 105], 'Password': ['@Tanmoy*1234', '@Tarpan*1234', '@Sagnik*1234', '@Nikita*1234@Pritam*1234', '@Gautamee*1234'], 'Name': ['Tanmoy', 'Tarpan', 'Sagnik', 'Nikita', 'Pritam', 'Gautamee']}}
qu = input('do you have any account : \n')
if qu in ('Yes', 'yes', 'YES')... |
filters = \
('+ c ESI Full ms [300.00-2000.00]',
'+ c ESI Full ms [400.00-2000.00]',
'+ c d Full ms2 400.31@cid45.00 [100.00-815.00]',
'+ c d Full ms2 401.39@cid45.00 [100.00-815.00]',
'+ c d Full ms2 406.73@cid45.00 [100.00-825.00]',
'+ c d Full ms2 408.00@cid45.00 [100.00-830.00]',
'+ c d Full ms2 412.90@cid45.... | filters = ('+ c ESI Full ms [300.00-2000.00]', '+ c ESI Full ms [400.00-2000.00]', '+ c d Full ms2 400.31@cid45.00 [100.00-815.00]', '+ c d Full ms2 401.39@cid45.00 [100.00-815.00]', '+ c d Full ms2 406.73@cid45.00 [100.00-825.00]', '+ c d Full ms2 408.00@cid45.00 [100.00-830.00]', '+ c d Full ms2 412.90@cid45.00 [100.... |
num = 9669
s = str(num)
max = num
x = num
for i in s:
if (i == '6'):
s = s.replace(i, '9', 1)
if (int(s) > max):
max = int(s)
s = str(x)
else:
s = str(x)
elif ( i == '9'):
s =s.replace(i, '6', 1)
if (int(s) > max):
max = i... | num = 9669
s = str(num)
max = num
x = num
for i in s:
if i == '6':
s = s.replace(i, '9', 1)
if int(s) > max:
max = int(s)
s = str(x)
else:
s = str(x)
elif i == '9':
s = s.replace(i, '6', 1)
if int(s) > max:
max = int(s)
... |
class ImageFormatConverter(TypeConverter):
"""
System.Drawing.ImageFormatConverter is a class that can be used to convert System.Drawing.Imaging.ImageFormat objects from one data type to another. Access this class through the System.ComponentModel.TypeDescriptor object.
ImageFormatConverter()
"""
... | class Imageformatconverter(TypeConverter):
"""
System.Drawing.ImageFormatConverter is a class that can be used to convert System.Drawing.Imaging.ImageFormat objects from one data type to another. Access this class through the System.ComponentModel.TypeDescriptor object.
ImageFormatConverter()
"""
def ca... |
# coding=utf-8
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------... | class Destination:
def __init__(self, destination: dict):
self.id = destination.get('id')
self.display_name = destination.get('displayName')
self.type = destination.get('type')
self.authorization = destination.get('authorization')
self.status = destination.get('status')
... |
"""
The structure of Segment Tree is a binary tree which each node has two attributes start and end denote an segment /
interval.
start and end are both integers, they should be assigned in following rules:
The root's start and end is given by build method.
The left child of node A has start=A.left, end=(A.left + A.r... | """
The structure of Segment Tree is a binary tree which each node has two attributes start and end denote an segment /
interval.
start and end are both integers, they should be assigned in following rules:
The root's start and end is given by build method.
The left child of node A has start=A.left, end=(A.left + A.r... |
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
def mkdir(tmp_path, *parts):
path = tmp_path.joinpath(*parts)
if not path.exists():
path.mkdir(parents=True)
return path
| def mkdir(tmp_path, *parts):
path = tmp_path.joinpath(*parts)
if not path.exists():
path.mkdir(parents=True)
return path |
expected_output = {
"fpc-information": {
"fpc": {
"pic-detail": {
"pic-slot": "0",
"pic-type": "2X100GE CFP2 OTN",
"pic-version": "1.19",
"port-information": {
"port": [
... | expected_output = {'fpc-information': {'fpc': {'pic-detail': {'pic-slot': '0', 'pic-type': '2X100GE CFP2 OTN', 'pic-version': '1.19', 'port-information': {'port': [{'cable-type': '100GBASE LR4', 'fiber-mode': 'SM', 'port-number': '0', 'sfp-vendor-fw-ver': '1.5', 'sfp-vendor-name': 'FINISAR CORP.', 'sfp-vendor-pno': 'FT... |
#!/usr/bin/python3
"""defining read_file function"""
def read_file(filename=""):
"""reads filename with utf-8"""
with open(filename, encoding='utf-8') as f:
print(f.read(), end="")
| """defining read_file function"""
def read_file(filename=''):
"""reads filename with utf-8"""
with open(filename, encoding='utf-8') as f:
print(f.read(), end='') |
# $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ #
# $$$$$$$$$$ Type Casting - DataType COnversion $$$$$$$$$$ #
# $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ #
# First Method
print('Salary Calculator!')
hour = input('Hour in Week: ')
hour = int(hour)
salary = input('Salary per Hour: ')
salary = i... | print('Salary Calculator!')
hour = input('Hour in Week: ')
hour = int(hour)
salary = input('Salary per Hour: ')
salary = int(salary)
print(hour * salary)
print('Salary Calculator!')
hour = int(input('Hour in Week: '))
salary = int(input('Salary per Hour: '))
print(hour * salary)
print('Salary Calculator!')
hour = input... |
css = [
{"selector": "table, th, td", "props": [("border", "0")]},
{
"selector": "thead th",
"props": [
("padding", "10px 3px"),
("border-bottom", "1px solid black"),
("text-align", "right"),
],
},
{"selector": "td", "props": [("padding", "3px"... | css = [{'selector': 'table, th, td', 'props': [('border', '0')]}, {'selector': 'thead th', 'props': [('padding', '10px 3px'), ('border-bottom', '1px solid black'), ('text-align', 'right')]}, {'selector': 'td', 'props': [('padding', '3px')]}, {'selector': '.row_heading', 'props': [('padding-right', '3px')]}]
css_typ = [... |
#
# PySNMP MIB module JNX-MPLS-TE-P2MP-STD-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/JNX-MPLS-TE-P2MP-STD-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:58:39 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint) ... |
#Last Updated: 1/20/17
class CachedTeamData(object):
def __init__(self, teamNumber):
super(CachedTeamData, self).__init__()
self.number = teamNumber
self.completedTIMDs = []
class CachedCompetitionData(object):
def __init__(self):
super(CachedCompetitionData, self).__init__()
self.teamsWithMatchesCompleted... | class Cachedteamdata(object):
def __init__(self, teamNumber):
super(CachedTeamData, self).__init__()
self.number = teamNumber
self.completedTIMDs = []
class Cachedcompetitiondata(object):
def __init__(self):
super(CachedCompetitionData, self).__init__()
self.teamsWithM... |
(10 ** 2)[::-5]
(10 ** 2)[5]
(10 ** 2)(5)
(10 ** 2).foo
-(10 ** 2)
+(10 ** 2)
~(10 ** 2)
5 ** 10 ** 2
(10 ** 2) ** 5
5 * 10 ** 2
10 ** 2 * 5
5 / 10 ** 2
10 ** 2 / 5
5 // 10 ** 2
10 ** 2 // 5
5 + 10 ** 2
10 ** 2 + 5
10 ** 2 - 5
5 - 10 ** 2
5 >> 10 ** 2
10 ** 2 << 5
5 & 10 ** 2
10 ** 2 & 5
5 ^ 10 ** 2
10 ** 2 ^... | (10 ** 2)[::-5]
(10 ** 2)[5]
(10 ** 2)(5)
(10 ** 2).foo
-10 ** 2
+10 ** 2
~10 ** 2
5 ** 10 ** 2
(10 ** 2) ** 5
5 * 10 ** 2
10 ** 2 * 5
5 / 10 ** 2
10 ** 2 / 5
5 // 10 ** 2
10 ** 2 // 5
5 + 10 ** 2
10 ** 2 + 5
10 ** 2 - 5
5 - 10 ** 2
5 >> 10 ** 2
10 ** 2 << 5
5 & 10 ** 2
10 ** 2 & 5
5 ^ 10 ** 2
10 ** 2 ^ 5
5 | 10 ** 2
1... |
# http://www.lintcode.com/en/problem/find-the-missing-number/
class Solution:
# @param nums: a list of integers
# @return: an integer
def findMissing(self, nums):
return sum(range(len(nums)+1)) - sum(nums)
| class Solution:
def find_missing(self, nums):
return sum(range(len(nums) + 1)) - sum(nums) |
"""683. Word Break III
"""
class Solution:
"""
@param s: A string
@param dict: A set of word
@return: the number of possible sentences.
"""
def wordBreak3(self, s, dict):
# Write your code here
## Practice:
lower_dict = set()
for word in dict:
lower_di... | """683. Word Break III
"""
class Solution:
"""
@param s: A string
@param dict: A set of word
@return: the number of possible sentences.
"""
def word_break3(self, s, dict):
lower_dict = set()
for word in dict:
lower_dict.add(word.lower())
memo = {}
s ... |
first_rect = input().split()
for x in range(len(first_rect)):
first_rect[x] = int(first_rect[x])
second_rect = input().split()
for x in range(len(second_rect)):
second_rect[x] = int(second_rect[x])
x_list = [first_rect[0], first_rect[2], second_rect[0], second_rect[2]]
y_list = [first_rect[1], first_... | first_rect = input().split()
for x in range(len(first_rect)):
first_rect[x] = int(first_rect[x])
second_rect = input().split()
for x in range(len(second_rect)):
second_rect[x] = int(second_rect[x])
x_list = [first_rect[0], first_rect[2], second_rect[0], second_rect[2]]
y_list = [first_rect[1], first_rect[3], se... |
'''
Contains dicts of links for use in prempy
'''
scorespro = {
"epl": {
"_l_name":"https://www.scorespro.com/soccer/england/premier-league/",
"_l_name_r":"https://www.scorespro.com/soccer/england/premier-league/results/",
"_l_name_f":"https://www.scorespro.com/soccer/england/premier-league/fixtures/",
"_l_na... | """
Contains dicts of links for use in prempy
"""
scorespro = {'epl': {'_l_name': 'https://www.scorespro.com/soccer/england/premier-league/', '_l_name_r': 'https://www.scorespro.com/soccer/england/premier-league/results/', '_l_name_f': 'https://www.scorespro.com/soccer/england/premier-league/fixtures/', '_l_name_t': 'h... |
# Creating a cyclic sort function
def cyclic_sort(a):
i=0
while(i<len(a)):
if(a[i]!=i+1):
index=a[i]-1
x=a[i]
a[i]=a[index];
a[index]=x;
else:
i+=1
return a
list1 = [4,5,6,2,1,7,3]
print("The... | def cyclic_sort(a):
i = 0
while i < len(a):
if a[i] != i + 1:
index = a[i] - 1
x = a[i]
a[i] = a[index]
a[index] = x
else:
i += 1
return a
list1 = [4, 5, 6, 2, 1, 7, 3]
print('The unsorted list is: ', list1)
print('The sorted list i... |
n = int(input())
contador = 3
c2 = 0
c3 = 1
print(f'{c2}, {c3}', end='')
while n >= contador:
c4 = c2 + c3
print(f',', end=' ')
print(f'{c4}', end='')
c2 = c3
c3 = c4
contador += 1
| n = int(input())
contador = 3
c2 = 0
c3 = 1
print(f'{c2}, {c3}', end='')
while n >= contador:
c4 = c2 + c3
print(f',', end=' ')
print(f'{c4}', end='')
c2 = c3
c3 = c4
contador += 1 |
# A simple calculator - Y1, group D, MEET Project
# Author: Tamar Shabtai
# This function adds two numbers
def add(x, y):
return x + y
# This function subtracts two numbers
def subtract(x, y):
return x - y
# This function multiplies two numbers
def multiply(x, y):
return x * y
# This function divides ... | def add(x, y):
return x + y
def subtract(x, y):
return x - y
def multiply(x, y):
return x * y
def divide(x, y):
return x / y
def power(x, y):
return x ** y
def modulo(x, y):
return x % y
def add_to_history(num1, num2, operator, result):
hist_str = str(num1) + ' ' + operator + ' ' + str... |
num = int(input("Enter the nmber.\n"))
f = 1
print("Factors :")
for i in range(1 , num+1):
if(num%i) == 0:
print(i)
print("Factorial:")
for j in range(1 , num+1):
f = f*j;
print(f)
| num = int(input('Enter the nmber.\n'))
f = 1
print('Factors :')
for i in range(1, num + 1):
if num % i == 0:
print(i)
print('Factorial:')
for j in range(1, num + 1):
f = f * j
print(f) |
def union (setA = '', setB = ''):
print('union')
pass
def intersection ():
print('intersection')
pass
def difference ():
print('difference')
pass | def union(setA='', setB=''):
print('union')
pass
def intersection():
print('intersection')
pass
def difference():
print('difference')
pass |
# -*- coding: utf-8 -*-
EMPTY_QUESTIONS="""
{
"total": 0,
"page": 1,
"pagesize": 1,
"questions": []
}
"""
EMPTY_ANSWERS="""
{
"total": 0,
"page": 1,
"pagesize": 1,
"answers": []
}
"""
QUESTION="""
{
"total": 1,
"page": 1,
"pagesize": 1,
"questions": [
{
"tags": [
"c#",
... | empty_questions = '\n{\n "total": 0,\n "page": 1,\n "pagesize": 1,\n "questions": []\n}\n'
empty_answers = '\n{\n "total": 0,\n "page": 1,\n "pagesize": 1,\n "answers": []\n}\n'
question = '\n{\n "total": 1,\n "page": 1,\n "pagesize": 1,\n "questions": [\n {\n "tags": [\n "c#",\n "date... |
L = [
1, 2, 3, 4, 5, 6, 7, 8, 9
]
def split_list(a_list):
half = len(a_list)//2
return a_list[:half], a_list[half:]
B, C = split_list(L)
print (B)
print (C) | l = [1, 2, 3, 4, 5, 6, 7, 8, 9]
def split_list(a_list):
half = len(a_list) // 2
return (a_list[:half], a_list[half:])
(b, c) = split_list(L)
print(B)
print(C) |
thisdict = {
"brand":"Ford",
"model":"Mustang",
"year":1964
}
del thisdict
print(thisdict) #Error
| thisdict = {'brand': 'Ford', 'model': 'Mustang', 'year': 1964}
del thisdict
print(thisdict) |
def parse_cls_ind(clsind_path):
with open(clsind_path) as cls_ind:
cls_dic = {}
for line in cls_ind:
label, cls_name = line.split(',')
cls_dic[cls_name.strip()] = int(label)
cls_dic[int(label)] = cls_name.strip()
return cls_dic | def parse_cls_ind(clsind_path):
with open(clsind_path) as cls_ind:
cls_dic = {}
for line in cls_ind:
(label, cls_name) = line.split(',')
cls_dic[cls_name.strip()] = int(label)
cls_dic[int(label)] = cls_name.strip()
return cls_dic |
def delKlinkers(woord):
'This returns a given word without vowels'
result = ''
for char in woord: # loop
if char not in 'aeiou':
result = result + char
return result # returns result to variable result
delKlinkers('Achraf')
| def del_klinkers(woord):
"""This returns a given word without vowels"""
result = ''
for char in woord:
if char not in 'aeiou':
result = result + char
return result
del_klinkers('Achraf') |
''' Problem Statemenr : Python program to segregate even and odd nodes in a Linked List
Complexity : O(n)'''
head = None # head of list
# Node class
class Node:
# Function to initialise the node object
def __init__(self, data):
self.data = data # Assign data
self.next =None
def segregateEvenOdd():
g... | """ Problem Statemenr : Python program to segregate even and odd nodes in a Linked List
Complexity : O(n)"""
head = None
class Node:
def __init__(self, data):
self.data = data
self.next = None
def segregate_even_odd():
global head
end = head
prev = None
curr = head
while end.n... |
"""InnovAnon Inc. Proprietary"""
class Euclid:
# l[h] = l[k] * a + r
# l[h] = l[k] ** a * r
def __init__ (self, quotient, remainder, iszero):
self.quotient = quotient
self.remainder = remainder
self.iszero = iszero
def euclid (self, a, b):
"""https://plus.maths.org/content/music-and-euclids-algorithm... | """InnovAnon Inc. Proprietary"""
class Euclid:
def __init__(self, quotient, remainder, iszero):
self.quotient = quotient
self.remainder = remainder
self.iszero = iszero
def euclid(self, a, b):
"""https://plus.maths.org/content/music-and-euclids-algorithm"""
q = self.qu... |
"""
Decorators
-> Modify or enhance an existing function in a non-intrusive and maintainable way
-> Implemented as a callable that accepts a callable and returns a callable
-> "A function accepting a function an returning a function"
"""
"""
Summary:
-> Decorators modify existing callables extrinsically
-> Apply decor... | """
Decorators
-> Modify or enhance an existing function in a non-intrusive and maintainable way
-> Implemented as a callable that accepts a callable and returns a callable
-> "A function accepting a function an returning a function"
"""
'\nSummary:\n-> Decorators modify existing callables extrinsically\n-> Apply decor... |
ies = []
ies.append({ "ie_type" : "Node ID", "ie_value" : "Node ID", "presence" : "M", "instance" : "0", "comment" : "This IE shall contain the unique identifier of the sending Node."})
ies.append({ "ie_type" : "Node Report Type", "ie_value" : "Node Report Type", "presence" : "M", "instance" : "0", "comment" : "This IE... | ies = []
ies.append({'ie_type': 'Node ID', 'ie_value': 'Node ID', 'presence': 'M', 'instance': '0', 'comment': 'This IE shall contain the unique identifier of the sending Node.'})
ies.append({'ie_type': 'Node Report Type', 'ie_value': 'Node Report Type', 'presence': 'M', 'instance': '0', 'comment': 'This IE shall indic... |
'''
Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.
Examples:
s = "leetcode"
return 0.
s = "loveleetcode",
return 2.
'''
class Solution(object):
def firstUniqChar(self, s):
"""
:type s: str
:rtype: int
"""
... | """
Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.
Examples:
s = "leetcode"
return 0.
s = "loveleetcode",
return 2.
"""
class Solution(object):
def first_uniq_char(self, s):
"""
:type s: str
:rtype: int
"... |
def get_unique_username():
id = 0
base_string = "locust_username_"
while True:
id = id + 1
yield base_string + str(id)
def get_unique_email():
id = 0
base_string = "locust@email_"
while True:
id = id + 1
yield base_string + str(id)
def get_unique_password():
... | def get_unique_username():
id = 0
base_string = 'locust_username_'
while True:
id = id + 1
yield (base_string + str(id))
def get_unique_email():
id = 0
base_string = 'locust@email_'
while True:
id = id + 1
yield (base_string + str(id))
def get_unique_password():... |
def predict_boxes_connect(heatmap,T,threshold=0.9):
'''
This function takes heatmap and returns the bounding boxes and associated
confidence scores.
'''
'''
BEGIN YOUR CODE
'''
temp_h=int(T.shape[0]//2)
temp_w=int(T.shape[1]//2)
print(temp_h)
origin_map = np.copy(heatmap)
def explore(i,j,cnt):
if hea... | def predict_boxes_connect(heatmap, T, threshold=0.9):
"""
This function takes heatmap and returns the bounding boxes and associated
confidence scores.
"""
'\n\tBEGIN YOUR CODE\n\t'
temp_h = int(T.shape[0] // 2)
temp_w = int(T.shape[1] // 2)
print(temp_h)
origin_map = np.copy(heatmap)
def... |
def remainder(a,b):
if a==0 or b ==0:
if a > b:
if b ==0:
return None
else:
return a % b
elif b > a:
if a ==0:
return None
else:
return b % a
elif a > b:
return a%b
else:
... | def remainder(a, b):
if a == 0 or b == 0:
if a > b:
if b == 0:
return None
else:
return a % b
elif b > a:
if a == 0:
return None
else:
return b % a
elif a > b:
return a % b
... |
output_fname = raw_input("Enter the output filename: ")
search_text = raw_input("Enter the inclusion text: ")
f = open("features.tsv","r")
included_lines = []
for line in f.readlines():
if search_text in line:
included_lines.append(line)
print("found lines: %d" % len(included_lines))
outf = open(output_fname, "w... | output_fname = raw_input('Enter the output filename: ')
search_text = raw_input('Enter the inclusion text: ')
f = open('features.tsv', 'r')
included_lines = []
for line in f.readlines():
if search_text in line:
included_lines.append(line)
print('found lines: %d' % len(included_lines))
outf = open(output_fna... |
def parse (input):
decoded_input = input.decode()
decoded_input = decoded_input.split('\n')
destination = decoded_input[-1]
decoded_input = decoded_input[0:len(decoded_input)-1]
time_consider = decoded_input[0].split(',')[2]
visited_nodes = []
for i in decoded_input:
visited_nodes.ap... | def parse(input):
decoded_input = input.decode()
decoded_input = decoded_input.split('\n')
destination = decoded_input[-1]
decoded_input = decoded_input[0:len(decoded_input) - 1]
time_consider = decoded_input[0].split(',')[2]
visited_nodes = []
for i in decoded_input:
visited_nodes.a... |
# Attributes on the fly
class User:
pass
user_1 = User()
user_1.username = "Chandra"
user_2 = User()
user_2
# NOTE 1 : You can define "object" attributes on the fly
print(user_1.username)
# AttributeError: 'User' object has no attribute 'username'
# print(user_2.username)
# Class Attributes
class Person:
... | class User:
pass
user_1 = user()
user_1.username = 'Chandra'
user_2 = user()
user_2
print(user_1.username)
class Person:
count_male = 0
def __init__(self, is_male):
if is_male:
Person.count_male += 1
chandra = person(True)
sireesha = person(False)
print(Person.count_male)
mohan = perso... |
# -*- coding: utf-8 -*-
#
# pyDFTD3 -- Python implementation of Grimme's D3 dispersion correction.
# Copyright (C) 2020 Rob Paton and contributors.
#
# This file is part of pyDFTD3.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (th... | """Becke-Johnson damping parameters. last updated 1.5 years ago"""
bj_parms = {'B2PLYP': [0.64, 0.3065, 0.9147, 5.057], 'B3LYP': [1, 0.3981, 1.9889, 4.4211], 'B97D': [1, 0.5545, 2.2609, 3.2297], 'BLYP': [1, 0.4298, 2.6996, 4.2359], 'BP86': [1, 0.3946, 3.2822, 4.8516], 'DSDBLYP': [0.5, 0, 0.213, 6.0519], 'PBE0': [1, 0.4... |
class BaseView(object):
def get_table(self):
return {
"headings": self.get_headings(),
"body": self.get_rows(),
}
# Type
def get_column_type(self, column):
return "plain"
def get_row_type(self, row):
return "plain"
# Heading
def get_head... | class Baseview(object):
def get_table(self):
return {'headings': self.get_headings(), 'body': self.get_rows()}
def get_column_type(self, column):
return 'plain'
def get_row_type(self, row):
return 'plain'
def get_headings(self):
return [self.get_heading(i) for i in ra... |
##parameters=
##title=Manage filter cookie
##
REQUEST=context.REQUEST
if REQUEST.get('clear_view_filter', 0):
context.clearCookie()
REQUEST.set('folderfilter', '')
REQUEST.set('close_filter_form', '1')
elif REQUEST.get('set_view_filter', 0):
filter=context.encodeFolderFilter(REQUEST)
REQUEST.RESPONS... | request = context.REQUEST
if REQUEST.get('clear_view_filter', 0):
context.clearCookie()
REQUEST.set('folderfilter', '')
REQUEST.set('close_filter_form', '1')
elif REQUEST.get('set_view_filter', 0):
filter = context.encodeFolderFilter(REQUEST)
REQUEST.RESPONSE.setCookie('folderfilter', filter, path='... |
class User:
def __init__(self,uid,name,surname,email,password,card_number,certificate):
self.uid=uid
self.name=name
self.surname=surname
self.email=email
self.certificate=certificate
self.password=password
self.card_number=card_number
| class User:
def __init__(self, uid, name, surname, email, password, card_number, certificate):
self.uid = uid
self.name = name
self.surname = surname
self.email = email
self.certificate = certificate
self.password = password
self.card_number = card_number |
"""
helpers
"""
def square(x):
"""square()"""
return x * x
| """
helpers
"""
def square(x):
"""square()"""
return x * x |
class AverageDeviationAnomalyClass:
def __init__(self, conf, confa):
self.confObj = conf
self.confaObj = confa
# init global vars
# init global vars
self.sql = conf.sql
self.cur = conf.db.cursor()
self.gl = conf.Global
# define transactions data... | class Averagedeviationanomalyclass:
def __init__(self, conf, confa):
self.confObj = conf
self.confaObj = confa
self.sql = conf.sql
self.cur = conf.db.cursor()
self.gl = conf.Global
self.transactionsData = {}
self.transactionsDataSums = {}
self.transac... |
# -*- coding: utf-8 -*-
known_chains = {
"BTS": {
"chain_id": "4018d7844c78f6a6c41c6a552b898022310fc5dec06da467ee7905a8dad512c8",
"core_symbol": "BTS",
"prefix": "BTS",
},
"TEST": {
"chain_id": "39f5e2ede1f8bc1a3a54a7914414e3779e33193f1f5693510e73cb7a87617447",
"core_... | known_chains = {'BTS': {'chain_id': '4018d7844c78f6a6c41c6a552b898022310fc5dec06da467ee7905a8dad512c8', 'core_symbol': 'BTS', 'prefix': 'BTS'}, 'TEST': {'chain_id': '39f5e2ede1f8bc1a3a54a7914414e3779e33193f1f5693510e73cb7a87617447', 'core_symbol': 'TEST', 'prefix': 'TEST'}, 'DNATESTNET': {'chain_id': '93b266081a68bea38... |
city = input()
sales = float(input())
commision = 0
if city == 'Sofia':
if 0 <= sales <= 500:
commision = 0.05
elif 500 < sales <= 1000:
commision = 0.07
elif 1000 < sales <= 10000:
commision = 0.08
elif sales > 10000:
commision = 0.12
elif city == 'Varna':
if 0 <= s... | city = input()
sales = float(input())
commision = 0
if city == 'Sofia':
if 0 <= sales <= 500:
commision = 0.05
elif 500 < sales <= 1000:
commision = 0.07
elif 1000 < sales <= 10000:
commision = 0.08
elif sales > 10000:
commision = 0.12
elif city == 'Varna':
if 0 <= sa... |
__metaclass__ = type
class Filter_node:
def __init__(self, struc=None, config=None, save=None, debug=None):
self.myInfo = "Filter Node"
self.struc = str(struc)
self.save = str(save)
self.config = str(config)
self.debug = debug
self.nodeNum = -1
self.nodeList... | __metaclass__ = type
class Filter_Node:
def __init__(self, struc=None, config=None, save=None, debug=None):
self.myInfo = 'Filter Node'
self.struc = str(struc)
self.save = str(save)
self.config = str(config)
self.debug = debug
self.nodeNum = -1
self.nodeList... |
class ThumbnailCacheContext(object):
""" Lazy computation of of images as thumbnails.
DEPRICATED
Just pass a list of uuids corresponding to the images. Then compute images
flagged as dirty and give them back to the context. thumbs_list will be
populated on contex exit
"""
def __init__(s... | class Thumbnailcachecontext(object):
""" Lazy computation of of images as thumbnails.
DEPRICATED
Just pass a list of uuids corresponding to the images. Then compute images
flagged as dirty and give them back to the context. thumbs_list will be
populated on contex exit
"""
def __init__(se... |
FF = 'ff'
ONGOING = 'normal'
FINISHED = 'finished'
CHEATED = 'cheated'
| ff = 'ff'
ongoing = 'normal'
finished = 'finished'
cheated = 'cheated' |
"""
DAY 32 : Multiply two strings.
https://www.geeksforgeeks.org/multiply-large-numbers-represented-as-strings/
QUESTION : Given two numbers as stings s1 and s2. Calculate their Product.
Expected Time Complexity: O(n1* n2)
Expected Auxiliary Space: O(n1 + n2)
where n1 and n2 are sizes of strings s1 and s2 res... | """
DAY 32 : Multiply two strings.
https://www.geeksforgeeks.org/multiply-large-numbers-represented-as-strings/
QUESTION : Given two numbers as stings s1 and s2. Calculate their Product.
Expected Time Complexity: O(n1* n2)
Expected Auxiliary Space: O(n1 + n2)
where n1 and n2 are sizes of strings s1 and s2 respectivel... |
"""
https://leetcode.com/problems/climbing-stairs/
Difficulty: Easy
"""
class Solution:
@staticmethod
def climb_stairs(n: int) -> int:
paths = {0: 1, 1: 1, 2: 2}
for i in range(3, n + 1):
paths[i] = paths[i - 1] + paths[i - 2]
return paths[n]
| """
https://leetcode.com/problems/climbing-stairs/
Difficulty: Easy
"""
class Solution:
@staticmethod
def climb_stairs(n: int) -> int:
paths = {0: 1, 1: 1, 2: 2}
for i in range(3, n + 1):
paths[i] = paths[i - 1] + paths[i - 2]
return paths[n] |
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def printLinkedList(l: ListNode) -> None:
if l:
print(l.val, end=" ")
nextNode = l.next
while nextNode:
print(nextNode.val, end=" ")
nextNode = nextNode.next
... | class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def print_linked_list(l: ListNode) -> None:
if l:
print(l.val, end=' ')
next_node = l.next
while nextNode:
print(nextNode.val, end=' ')
next_node = nextNode.nex... |
# encoding: utf-8
class _ServiceRegistry(object):
def __init__(self):
self.services = {}
def get(self, name):
"""
Return the handler for the given name. Raises `KeyError` if
the handler does not exist.
"""
return self.services[name]
def register(self, servi... | class _Serviceregistry(object):
def __init__(self):
self.services = {}
def get(self, name):
"""
Return the handler for the given name. Raises `KeyError` if
the handler does not exist.
"""
return self.services[name]
def register(self, service):
"""
... |
class Solution:
def rearrangeBarcodes(self, barcodes: List[int]) -> List[int]:
cnt = collections.Counter(barcodes).most_common()[::-1]
ref = [val for val, t in cnt for _ in range(t)]
for i in range(0, len(barcodes), 2):
barcodes[i] = ref.pop()
for i in range(1, len(barcod... | class Solution:
def rearrange_barcodes(self, barcodes: List[int]) -> List[int]:
cnt = collections.Counter(barcodes).most_common()[::-1]
ref = [val for (val, t) in cnt for _ in range(t)]
for i in range(0, len(barcodes), 2):
barcodes[i] = ref.pop()
for i in range(1, len(ba... |
'''
Elections are in progress!
Given an array of the numbers of votes given to each of the candidates so far, and an integer k equal to the number of voters who haven't cast their vote yet, find the number of candidates who still have a chance to win the election.
The winner of the election must secure strictly more ... | """
Elections are in progress!
Given an array of the numbers of votes given to each of the candidates so far, and an integer k equal to the number of voters who haven't cast their vote yet, find the number of candidates who still have a chance to win the election.
The winner of the election must secure strictly more ... |
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def append(self, node):
if self.head == None:
self.head = node
else:
cur = self.head
# go till end
... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def append(self, node):
if self.head == None:
self.head = node
else:
cur = self.head
while cur.next !... |
# continue vs break vs pass
print('for continue function')
# continue is used for skipping outpot
for letter in range(5):
if letter == 3:
continue
print ('hi', letter)
print ('for pass function')
# pass is used to skip variable/print definition
for letter in range(5):
pass
print('for brea... | print('for continue function')
for letter in range(5):
if letter == 3:
continue
print('hi', letter)
print('for pass function')
for letter in range(5):
pass
print('for break function')
for letter in range(5):
if letter == 3:
break
print('hi', letter) |
WoqlSelect = {
"jsonObj": {
"@type": "woql:Select",
"woql:variable_list": [
{
"@type": "woql:VariableListElement",
"woql:variable_name": {"@value": "V1", "@type": "xsd:string"},
"woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0}... | woql_select = {'jsonObj': {'@type': 'woql:Select', 'woql:variable_list': [{'@type': 'woql:VariableListElement', 'woql:variable_name': {'@value': 'V1', '@type': 'xsd:string'}, 'woql:index': {'@type': 'xsd:nonNegativeInteger', '@value': 0}}], 'woql:query': {'@type': 'woql:Triple', 'woql:subject': {'@type': 'woql:Node', '... |
#author: <Samaiya Howard>
# date: <7/1/21>
# --------------- Section 1 --------------- #
# ---------- Integers and Floats ---------- #
# you may use floats or integers for these operations, it is at your discretion
# addition
# instructions
# 1 - create a print statement that prints the sum of two numbers
# ... | print(25 + 74)
print(43 + 82 + 1)
print(-2 + -73)
print()
print(15 - 23)
print(79 - 13 - 3)
print(-3 - -17)
print()
print(5 * 4)
print(100 / 5)
print(100 * 25 / 5)
print()
print(134 // 7)
print()
print(6 ** 7)
print()
print(97 % 5)
print()
print('Samaiya' + 'Howard')
print('dogs' + 'horses' + 'seals' + 'cats' + 'seals'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
username = 'admin'
password = 'admin'
tenant_name = 'admin'
admin_auth_url = 'http://controller:35357/'
auth_url = 'http://controller:5000/' # discover api version
auth_url_v2 = 'http://controller:5000/v2.0/'
auth_url_v3 = 'http://controller:5000/v3/'
glance_url = 'http:/... | username = 'admin'
password = 'admin'
tenant_name = 'admin'
admin_auth_url = 'http://controller:35357/'
auth_url = 'http://controller:5000/'
auth_url_v2 = 'http://controller:5000/v2.0/'
auth_url_v3 = 'http://controller:5000/v3/'
glance_url = 'http://controller:9292/'
nova_url = 'http://controller:8774/'
nova_url_v2 = '... |
print('Hello, chap3, sec1.')
pub = dict()
pub['author'] = 'John F. Nash'
pub['title'] = 'Equilibrium points in n-person games'
pub['journal'] = 'PNAS'
pub['year'] = '1950' | print('Hello, chap3, sec1.')
pub = dict()
pub['author'] = 'John F. Nash'
pub['title'] = 'Equilibrium points in n-person games'
pub['journal'] = 'PNAS'
pub['year'] = '1950' |
def p(a,n):
a.sort()
s=0
for i in range(n):
s+=a[i]
a.append(s)
print(max(a))
t=int(input())
n,m,a=[],[],[]
for i in range(t):
n.append(list(map(int,(input()).strip().split(' '))))
a.append(list(map(int,(input()).strip().split(' ')))[:n[i][0]])
for i in range(t):
... | def p(a, n):
a.sort()
s = 0
for i in range(n):
s += a[i]
a.append(s)
print(max(a))
t = int(input())
(n, m, a) = ([], [], [])
for i in range(t):
n.append(list(map(int, input().strip().split(' '))))
a.append(list(map(int, input().strip().split(' ')))[:n[i][0]])
for i in range(t):
p... |
class Init:
def __init__(self):
return
def phone(self, phone: int) -> int:
try:
phstr = str(phone)
step = int(phstr[0])
for x in range(len(phstr)):
if not x + 1 == len(phstr):
step = (step ** int(phstr[x + 1]) // int(phstr... | class Init:
def __init__(self):
return
def phone(self, phone: int) -> int:
try:
phstr = str(phone)
step = int(phstr[0])
for x in range(len(phstr)):
if not x + 1 == len(phstr):
step = step ** int(phstr[x + 1]) // int(phstr[... |
def min_of_maxes(nums,k):
count = 0
highest = None
lowest = None
for i in nums:
count += 1
if highest == None:
highest = i
if i > highest:
highest = i
if count == k:
if lowest == None:
lowest = highest
if highest < lowest:
lowest = highest
high... | def min_of_maxes(nums, k):
count = 0
highest = None
lowest = None
for i in nums:
count += 1
if highest == None:
highest = i
if i > highest:
highest = i
if count == k:
if lowest == None:
lowest = highest
if hi... |
class AuthenticationError(Exception):
pass
class APICallError(Exception):
pass | class Authenticationerror(Exception):
pass
class Apicallerror(Exception):
pass |
def test_species_del(neuron_instance):
"""Test deleting an uninitialized species does not raise any error or
exceptions.
"""
h, rxd, data, save_path = neuron_instance
soma = h.Section(name="soma")
cyt = rxd.Region([soma])
c = rxd.Species(cyt)
try:
c.__del__()
except:
... | def test_species_del(neuron_instance):
"""Test deleting an uninitialized species does not raise any error or
exceptions.
"""
(h, rxd, data, save_path) = neuron_instance
soma = h.Section(name='soma')
cyt = rxd.Region([soma])
c = rxd.Species(cyt)
try:
c.__del__()
except:
... |
# 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
# Recursive
def isUnivalTree(root: TreeNode) -> bool:
def compare_value(cur_root: TreeNode, previous_root: int) -> bool:
if n... | class Treenode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
def is_unival_tree(root: TreeNode) -> bool:
def compare_value(cur_root: TreeNode, previous_root: int) -> bool:
if not cur_root:
return True
... |
class LookAhead():
"""
Look ahead iterator. Look ahead using `.peek`.
"""
_NONE = object()
def __init__(self, iterable):
self._it = iter(iterable)
self._set_peek()
def __iter__(self):
return self
def __next__(self):
ret = self.peek
self._set_peek()
... | class Lookahead:
"""
Look ahead iterator. Look ahead using `.peek`.
"""
_none = object()
def __init__(self, iterable):
self._it = iter(iterable)
self._set_peek()
def __iter__(self):
return self
def __next__(self):
ret = self.peek
self._set_peek()
... |
## Colm Higgins
## This program will ask the user to input a string and prints
## every second letter in reverse order
# input sentence
x = input("Please type a sentence of your choice: ")
# print input removing every 2nd letter and reversed
# [::2] is every 2nd letter and putting a - before will reverse it.
# Shor... | x = input('Please type a sentence of your choice: ')
print('The sentence you typed removing every second letter and reversed is:\n {}'.format(x[::-2])) |
'''
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
You are given a target value to search. If found in the array return its index, otherwise return -1.
You may assume no duplicate exists in the array.
'''
class Solution:
# @param A, a li... | """
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
You are given a target value to search. If found in the array return its index, otherwise return -1.
You may assume no duplicate exists in the array.
"""
class Solution:
def search(self... |
# coding: utf-8
google_10000_path = '/home/pj/datum/GraduationProject/dataset/google-10000-english/google-10000-english.txt'
google_1000 = open(google_10000_path, 'r')
def read_google_10000_english(num):
"""
get diff word from google 10000 english database
:params num: word's number wanting to use
"... | google_10000_path = '/home/pj/datum/GraduationProject/dataset/google-10000-english/google-10000-english.txt'
google_1000 = open(google_10000_path, 'r')
def read_google_10000_english(num):
"""
get diff word from google 10000 english database
:params num: word's number wanting to use
"""
if not isins... |
# Title : Nato Phonetic Expansion
# Author : Kiran raj R.
# Date : 17:10:2020
persons = {'John': {'Age': '55', 'Gender': 'Male'},
'Toney': {'Age': '23', 'Gender': 'Male'},
'Karin': {'Age': '42', 'Gender': 'Female'},
'Cathie': {'Age': '29', 'Gender': 'Female'},
'Rosalba': ... | persons = {'John': {'Age': '55', 'Gender': 'Male'}, 'Toney': {'Age': '23', 'Gender': 'Male'}, 'Karin': {'Age': '42', 'Gender': 'Female'}, 'Cathie': {'Age': '29', 'Gender': 'Female'}, 'Rosalba': {'Age': '12', 'Gender': 'Female'}, 'Nina': {'Age': '50', 'Gender': 'Female'}, 'Burton': {'Age': '16', 'Gender': 'Male'}, 'Joey... |
class NoneType(object):
def __new__(self, *args):
return None
def __init__(self, *args):
pass
def __bool__(self):
return False
def __str__(self):
return "None"
___assign("%NoneType", NoneType)
| class Nonetype(object):
def __new__(self, *args):
return None
def __init__(self, *args):
pass
def __bool__(self):
return False
def __str__(self):
return 'None'
___assign('%NoneType', NoneType) |
# -*- coding: utf-8 -*-
DESC = "cloudaudit-2019-03-19"
INFO = {
"StartLogging": {
"params": [
{
"name": "AuditName",
"desc": "Tracking set name"
}
],
"desc": "This API is used to enable a tracking set."
},
"GetAttributeKey": {
"params": [
{
"name": "Websit... | desc = 'cloudaudit-2019-03-19'
info = {'StartLogging': {'params': [{'name': 'AuditName', 'desc': 'Tracking set name'}], 'desc': 'This API is used to enable a tracking set.'}, 'GetAttributeKey': {'params': [{'name': 'WebsiteType', 'desc': 'Website type. Value range: zh, en. Default value: zh'}], 'desc': 'This API is use... |
# test basic async for execution
# example taken from PEP0492
class AsyncIteratorWrapper:
def __init__(self, obj):
print('init')
self._it = iter(obj)
async def __aiter__(self):
print('aiter')
return self
async def __anext__(self):
print('anext')
try:
... | class Asynciteratorwrapper:
def __init__(self, obj):
print('init')
self._it = iter(obj)
async def __aiter__(self):
print('aiter')
return self
async def __anext__(self):
print('anext')
try:
value = next(self._it)
except StopIteration:
... |
# -*- coding: utf-8 -*-
# see LICENSE.rst
"""Test `~astronat.utils.data`."""
# __all__ = [
# # modules
# "",
# # functions
# "",
# # other
# "",
# ]
##############################################################################
# IMPORTS
# BUILT IN
# THIRD PARTY
# PROJECT-SPECIFIC
#####... | """Test `~astronat.utils.data`.""" |
INPUT_RANGE = [382345, 843167]
if __name__ == "__main__":
count = 0
for num in range(INPUT_RANGE[0], INPUT_RANGE[1]):
d1 = num // 100000
d2 = (num // 10000) % 10
d3 = (num // 1000) % 10
d4 = (num // 100) % 10
d5 = (num // 10) % 10
d6 = num % 10
... | input_range = [382345, 843167]
if __name__ == '__main__':
count = 0
for num in range(INPUT_RANGE[0], INPUT_RANGE[1]):
d1 = num // 100000
d2 = num // 10000 % 10
d3 = num // 1000 % 10
d4 = num // 100 % 10
d5 = num // 10 % 10
d6 = num % 10
if d1 <= d2 <= d3 <... |
#
# @lc app=leetcode.cn id=15 lang=python3
#
# [15] 3sum
#
None
# @lc code=end | None |
# -*- coding: utf-8 -*-
__version__ = '0.4.4.4'
request_post_identifier = 'current_aldryn_blog_entry'
app_title = 'News' | __version__ = '0.4.4.4'
request_post_identifier = 'current_aldryn_blog_entry'
app_title = 'News' |
'''
URL: https://leetcode.com/problems/set-matrix-zeroes
Time complexity: O(n^2)
Space complexity: O(1)
'''
class Solution:
def setZeroes(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
row_zero = Fals... | """
URL: https://leetcode.com/problems/set-matrix-zeroes
Time complexity: O(n^2)
Space complexity: O(1)
"""
class Solution:
def set_zeroes(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
row_zero = Fa... |
# Time: O(k * C(n, k))
# Space: O(k)
# 77
# Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.
#
# For example,
# If n = 4 and k = 2, a solution is:
#
# [
# [2,4],
# [3,4],
# [2,3],
# [1,2],
# [1,3],
# [1,4],
# ]
class Solution(object):
def combine(self, n, k): ... | class Solution(object):
def combine(self, n, k):
"""
:type n: int
:type k: int
:rtype: List[List[int]]
"""
def backtrack(start, cur):
if len(cur) == k:
ans.append(cur[:])
return
for i in range(start, n + 1):
... |
# each user has his own credentials file. Do not share this with other users.
username = "synqs_test" # Put here your username
password = "Cm2TXfRmXennMQ5" # and the pwd
| username = 'synqs_test'
password = 'Cm2TXfRmXennMQ5' |
#
# PySNMP MIB module POLYCOM-VIDEO-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/POLYCOM-VIDEO-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:32:27 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')
(value_range_constraint, single_value_constraint, constraints_union, constraints_intersection, value_size_constraint) ... |
def netmiko_copy(device, source='', destination='', ckwargs={}, **kwargs):
# Example of a copy subtask
if source and destination:
command = f'copy {source} {destination}'
# For Cisco as long "file prompt" is either alert or noisy this should work
# if "file prompt" is quiet tr... | def netmiko_copy(device, source='', destination='', ckwargs={}, **kwargs):
if source and destination:
command = f'copy {source} {destination}'
output = device['nc'].send_command_timing(command)
if 'Address or name' or 'Source filename' in output:
output += '\n'
output... |
n = int(input("Enter the lowe limit : "))
m = int(input("Enter the upper limit : "))
print("The prime numbers between" , n , "and" , m, "are")
for i in range(n,m,1):
a = 0
for j in range (1,i+1,1):
if (i%j==0):
a = a+ 1
if (a==2):
print(j) | n = int(input('Enter the lowe limit : '))
m = int(input('Enter the upper limit : '))
print('The prime numbers between', n, 'and', m, 'are')
for i in range(n, m, 1):
a = 0
for j in range(1, i + 1, 1):
if i % j == 0:
a = a + 1
if a == 2:
print(j) |
rootDir = 'd:/projects/astronomy/gaia_dr2/'
fp = open(rootDir+'output/release/ranges.csv','r')
regions = set()
region_count = {}
line = fp.readline()
while len(line) != 0:
bits = line.strip().split(',')
if len(bits) > 1:
region,count = bits
regions.add(region)
line = fp.readline()
fp.clo... | root_dir = 'd:/projects/astronomy/gaia_dr2/'
fp = open(rootDir + 'output/release/ranges.csv', 'r')
regions = set()
region_count = {}
line = fp.readline()
while len(line) != 0:
bits = line.strip().split(',')
if len(bits) > 1:
(region, count) = bits
regions.add(region)
line = fp.readline()
fp.... |
#! python
# Problem # : 231A
# Created on : 2019-01-14 21:19:31
def Main():
n = int(input())
cnt = 0
for i in range(0, n):
if sum(list(map(int, input().split(' ')))) > 1:
cnt += 1
else:
print(cnt)
if __name__ == '__main__':
Main()
| def main():
n = int(input())
cnt = 0
for i in range(0, n):
if sum(list(map(int, input().split(' ')))) > 1:
cnt += 1
else:
print(cnt)
if __name__ == '__main__':
main() |
def longestCommonSubstr(self, S1, S2, n, m):
# code here
dp=[[0 for j in range(m+1)]for i in range(n+1)]
for i in range(1,n+1):
for j in range(1,m+1):
if S1[i-1]==S2[j-1]:
dp[i][j]=1+dp[i-1][j-1]
else:
dp[i][j]=0... | def longest_common_substr(self, S1, S2, n, m):
dp = [[0 for j in range(m + 1)] for i in range(n + 1)]
for i in range(1, n + 1):
for j in range(1, m + 1):
if S1[i - 1] == S2[j - 1]:
dp[i][j] = 1 + dp[i - 1][j - 1]
else:
dp[i][j] = 0
mx = 0
f... |
class NonGameScreen:
def __init__(self, screen):
self.screen = screen
def draw_text(self, text, font, color, cntr):
phrase = font.render(text, 0, color)
phrase_rect = phrase.get_rect(center=cntr)
self.screen.blit(phrase, phrase_rect)
| class Nongamescreen:
def __init__(self, screen):
self.screen = screen
def draw_text(self, text, font, color, cntr):
phrase = font.render(text, 0, color)
phrase_rect = phrase.get_rect(center=cntr)
self.screen.blit(phrase, phrase_rect) |
x = 50
y =2
dolar = 5.63
real = 1
tem_cafe = True
tem_pao = False
print(x + y)
print(x - y)
print(x * y)
print(x / y)
print(x ** y)
print(x // y)
print(x % y)
print(not tem_cafe)
print(tem_cafe or tem_pao)
print(tem_cafe and tem_pao)
print(dolar > real)
print(dolar < real)
print(dolar >= real)
print(dolar <= real)
prin... | x = 50
y = 2
dolar = 5.63
real = 1
tem_cafe = True
tem_pao = False
print(x + y)
print(x - y)
print(x * y)
print(x / y)
print(x ** y)
print(x // y)
print(x % y)
print(not tem_cafe)
print(tem_cafe or tem_pao)
print(tem_cafe and tem_pao)
print(dolar > real)
print(dolar < real)
print(dolar >= real)
print(dolar <= real)
pri... |
# -*- coding: utf-8 -*-
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License MIT (https://opensource.org/licenses/MIT).
def migrate(cr, version):
# Add temporary credit product column
cr.execute("ALTER TABLE product_template ADD temporary_credit_product int")
# S... | def migrate(cr, version):
cr.execute('ALTER TABLE product_template ADD temporary_credit_product int')
cr.execute('SELECT id FROM account_journal WHERE account_journal.debt is true')
journal_id = cr.fetchone()
if journal_id:
cr.execute('UPDATE product_template SET temporary_credit_product=%s WHER... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.