content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# flake8: noqa
responses = {
"success": {
"status_code": 200,
"content": {
"resourceType":"Bundle",
"id":"389a548b-9c85-4491-9795-9306a957030b",
"meta":{
"lastUpdated":"2019-12-18T13:40:02.792-05:00"
},
"type":"searchset",
... | responses = {'success': {'status_code': 200, 'content': {'resourceType': 'Bundle', 'id': '389a548b-9c85-4491-9795-9306a957030b', 'meta': {'lastUpdated': '2019-12-18T13:40:02.792-05:00'}, 'type': 'searchset', 'total': 1, 'link': [{'relation': 'first', 'url': 'https://sandbox.bluebutton.cms.gov/v1/fhir/Patient?_count=10&... |
__version__ = "3.0.0-beta"
VERSION = __version__
DOMAIN = "krisinfo"
BASE_URL = "https://api.krisinformation.se/v3/"
NEWS_PARAMETER = "news?format=json"
VMAS_PARAMETER = "vmas?format=json"
LANGUAGE_PARAMETER = "&language="
USER_AGENT = "homeassistant_krisinfo/" + VERSION
| __version__ = '3.0.0-beta'
version = __version__
domain = 'krisinfo'
base_url = 'https://api.krisinformation.se/v3/'
news_parameter = 'news?format=json'
vmas_parameter = 'vmas?format=json'
language_parameter = '&language='
user_agent = 'homeassistant_krisinfo/' + VERSION |
# Road of Regrets 2 (270020200) => Resting Spot of Regret
# The One Who Walks Down the Road of Regrets2
if sm.hasQuestCompleted(3509):
sm.warp(270020210, 3)
else:
sm.chat("Those who do not have the Goddess' permission may not move against the flow of time, and will be sent back to their previous location.")
... | if sm.hasQuestCompleted(3509):
sm.warp(270020210, 3)
else:
sm.chat("Those who do not have the Goddess' permission may not move against the flow of time, and will be sent back to their previous location.")
sm.warp(270020100) |
# Collaborators (including web sites where you got help: (enter none if you didn't need help)
#
# Write a program that asks for the user's name and another piece of information.Then prints a response using both of the inputs.
x = input("What is your name?")
y = input("How old are you?")
print("Hello " + x + ", you ... | x = input('What is your name?')
y = input('How old are you?')
print('Hello ' + x + ', you are ' + y + ' years old.') |
_base_ = './upernet_vit-b16_mln_512x512_160k_ade20k.py'
model = dict(
pretrained='pretrain/deit_base_patch16_224-b5f2ef4d.pth',
backbone=dict(drop_path_rate=0.1),
)
| _base_ = './upernet_vit-b16_mln_512x512_160k_ade20k.py'
model = dict(pretrained='pretrain/deit_base_patch16_224-b5f2ef4d.pth', backbone=dict(drop_path_rate=0.1)) |
#coding=utf-8
'''
Created on 2015-10-10
@author: Devuser
'''
class Tag(object):
def __init__(self,tagid,name,color):
self.tagid=tagid
self.tagname=name
self.tagcolor=color
| """
Created on 2015-10-10
@author: Devuser
"""
class Tag(object):
def __init__(self, tagid, name, color):
self.tagid = tagid
self.tagname = name
self.tagcolor = color |
def log(str):
ENABLED = False # Set False to disable loggin
if ENABLED:
print(str) | def log(str):
enabled = False
if ENABLED:
print(str) |
# add 6 _
name = 'Mark'
align_right = f'{name:_>10}'
print(align_right)
# '______Mark' | name = 'Mark'
align_right = f'{name:_>10}'
print(align_right) |
def main(n):
ret = 1
while 1:
if n == 1:
break
n = (n // 2, 3 * n + 1)[n & 1]
ret += 1
return ret
if __name__ == '__main__':
print(main(int(input())))
| def main(n):
ret = 1
while 1:
if n == 1:
break
n = (n // 2, 3 * n + 1)[n & 1]
ret += 1
return ret
if __name__ == '__main__':
print(main(int(input()))) |
t = '########### ###########\n########## ##########\n######### #########\n######## ########\n####### #######\n###### ######\n##### #####\n#### ####\n### ###\n## ##\n# #\n \n'
d... | t = '########### ###########\n########## ##########\n######### #########\n######## ########\n####### #######\n###### ######\n##### #####\n#### ####\n### ###\n## ##\n# #\n \n'
... |
#
# PySNMP MIB module CISCO-EPM-NOTIFICATION-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-EPM-NOTIFICATION-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:40:04 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, constraints_union, value_range_constraint, value_size_constraint) ... |
'''https: // practice.geeksforgeeks.org/problems/permutations-of-a-given-string2041/1
Permutations of a given string
Basic Accuracy: 49.85 % Submissions: 31222 Points: 1
Given a string S. The task is to print all permutations of a given string.
Example 1:
Input: ABC
Output:
ABC ACB BAC BCA CAB CBA
Explanation:
Given... | """https: // practice.geeksforgeeks.org/problems/permutations-of-a-given-string2041/1
Permutations of a given string
Basic Accuracy: 49.85 % Submissions: 31222 Points: 1
Given a string S. The task is to print all permutations of a given string.
Example 1:
Input: ABC
Output:
ABC ACB BAC BCA CAB CBA
Explanation:
Given... |
s = input()
y = s[0]
w = s[2]
if int(y) > int(w):
p = 7 - int(y)
else:
p = 7 - int(w)
if p == 1:
print('1/6')
if p == 2:
print('1/3')
if p == 3:
print('1/2')
if p == 4:
print('2/3')
if p == 5:
print('5/6')
if p == 6:
print('1/1')
| s = input()
y = s[0]
w = s[2]
if int(y) > int(w):
p = 7 - int(y)
else:
p = 7 - int(w)
if p == 1:
print('1/6')
if p == 2:
print('1/3')
if p == 3:
print('1/2')
if p == 4:
print('2/3')
if p == 5:
print('5/6')
if p == 6:
print('1/1') |
'''Question 1: Given a two integer numbers return their product
and if the product is greater than 1000, then return their sum'''
num1=int(input("Enter the first no:"))
num2=int(input("Enter the second no:"))
product=num1*num2
if(product>1000):
print("sum is:",num1+num2)
else:
print("Invalid n... | """Question 1: Given a two integer numbers return their product
and if the product is greater than 1000, then return their sum"""
num1 = int(input('Enter the first no:'))
num2 = int(input('Enter the second no:'))
product = num1 * num2
if product > 1000:
print('sum is:', num1 + num2)
else:
print('Invalid numbe... |
'''
Author: Aditya Mangal
Date: 20 september,2020
Purpose: python practise problem
'''
def input_matrixes(m, n):
output = []
for i in range(m):
row = []
for j in range(n):
user_matrixes = int(input(f'Enter number on [{i}][{j}]\n'))
row.append(user_matrixes)
... | """
Author: Aditya Mangal
Date: 20 september,2020
Purpose: python practise problem
"""
def input_matrixes(m, n):
output = []
for i in range(m):
row = []
for j in range(n):
user_matrixes = int(input(f'Enter number on [{i}][{j}]\n'))
row.append(user_matrixes)
ou... |
d=int(input())
m=int(input())
n=int(input())
x=[int(z) for z in input().split(" ")]
dist_travelled=0
i=0
refuel=0
while(dist_travelled<d and i<n-1):
if(dist_travelled+m>=d):
break
if(dist_travelled+m>=x[i] and dist_travelled+m<x[i+1]):
dist_travelled=x[i]
refuel+=1
elif(dist_travelle... | d = int(input())
m = int(input())
n = int(input())
x = [int(z) for z in input().split(' ')]
dist_travelled = 0
i = 0
refuel = 0
while dist_travelled < d and i < n - 1:
if dist_travelled + m >= d:
break
if dist_travelled + m >= x[i] and dist_travelled + m < x[i + 1]:
dist_travelled = x[i]
... |
def main(j, args, params, tags, tasklet):
page = args.page
action = args.requestContext.params.get('action', 'install')
aysid = args.requestContext.params.get('aysid')
instance = args.requestContext.params.get('instance', 'main')
parent = args.requestContext.params.get('parent', '')
installedag... | def main(j, args, params, tags, tasklet):
page = args.page
action = args.requestContext.params.get('action', 'install')
aysid = args.requestContext.params.get('aysid')
instance = args.requestContext.params.get('instance', 'main')
parent = args.requestContext.params.get('parent', '')
installedage... |
class SpaceAge(object):
earth_year = 31557600
corr = {
'earth': 1,
'mercury': 0.2408467,
'venus': 0.61519726,
'mars': 1.8808158,
'jupiter': 11.862615,
'saturn': 29.447498,
'uranus': 84.016846,
'neptune': 164.79132
}
def __init__(self, seco... | class Spaceage(object):
earth_year = 31557600
corr = {'earth': 1, 'mercury': 0.2408467, 'venus': 0.61519726, 'mars': 1.8808158, 'jupiter': 11.862615, 'saturn': 29.447498, 'uranus': 84.016846, 'neptune': 164.79132}
def __init__(self, seconds):
self.seconds = seconds
def repr(self, planet=None):... |
#!/usr/bin/env python
NAME = 'Cisco ACE XML Gateway'
def is_waf(self):
if self.matchheader(('server', 'ACE XML Gateway')):
return True
return False
| name = 'Cisco ACE XML Gateway'
def is_waf(self):
if self.matchheader(('server', 'ACE XML Gateway')):
return True
return False |
# WARNING!!!
# DO NOT MODIFY THIS FILE DIRECTLY.
# TO GENERATE THIS RUN: ./updateWorkspaceSnapshots.sh
BASE_ARCHITECTURES = ["amd64"]
# Exceptions:
# - s390x doesn't have libunwind8.
# https://github.com/GoogleContainerTools/distroless/pull/612#issue-500157699
# - ppc64le doesn't have stretch security-channel.
# ... | base_architectures = ['amd64']
architectures = BASE_ARCHITECTURES
versions = [('debian11', 'bullseye')]
debian_snapshot = '20210729T144530Z'
debian_security_snapshot = '20210729T023407Z'
sha256s = {'amd64': {'debian11': {'main': 'c17bf41d0f915c55a2cc048ed6a4b87e206e4d72e310f43a41f52d83689bc31d', 'updates': 'e70a10d6f43... |
if __name__ == '__main__':
n = int(input())
if((n%2!=0)or((n>=6)and(n<=20))):
print("Weird")
else:
print("Not Weird")
| if __name__ == '__main__':
n = int(input())
if n % 2 != 0 or (n >= 6 and n <= 20):
print('Weird')
else:
print('Not Weird') |
'''
Created on Apr 4, 2021
@author: x2012x
'''
class ConductorException(Exception):
pass
class UnsupportedAction(ConductorException):
pass
class UnsupportedIntent(ConductorException):
pass
class RegistrationExists(ConductorException):
pass
class SpeakableException(ConductorException):
def __ini... | """
Created on Apr 4, 2021
@author: x2012x
"""
class Conductorexception(Exception):
pass
class Unsupportedaction(ConductorException):
pass
class Unsupportedintent(ConductorException):
pass
class Registrationexists(ConductorException):
pass
class Speakableexception(ConductorException):
def __i... |
#!/usr/bin/env python3
##################################################################################
# #
# Program purpose: Finds a replace the string "Python" with "Java" and the #
# string "Java" with "P... | def read_string(mess: str):
valid = False
user_str = ''
while not valid:
try:
user_str = input(mess).strip()
valid = True
except ValueError as ve:
print(f'[ERROR]: {ve}')
return user_str
def swap_substr(main_str: str, sub_a: str, sub_b: str):
if m... |
# question : https://quera.ir/problemset/university/296/
n = int(input())
for i in range(1, n + 1):
line = ''
for j in range(1, n + 1):
if i in [1, n]:
line += '#'
elif j in [1, n]:
line += '#'
elif i == j:
line += '#'
elif j == n - i + 1:
... | n = int(input())
for i in range(1, n + 1):
line = ''
for j in range(1, n + 1):
if i in [1, n]:
line += '#'
elif j in [1, n]:
line += '#'
elif i == j:
line += '#'
elif j == n - i + 1:
line += '#'
elif j > n - i:
i... |
categories = {
'coco': [
{"color": [220, 20, 60], "isthing": 1, "id": 1, "name": "person"},
{"color": [119, 11, 32], "isthing": 1, "id": 2, "name": "bicycle"},
{"color": [0, 0, 142], "isthing": 1, "id": 3, "name": "car"},
{"color": [0, 0, 230], "isthing": 1, "id": 4, "name": "mo... | categories = {'coco': [{'color': [220, 20, 60], 'isthing': 1, 'id': 1, 'name': 'person'}, {'color': [119, 11, 32], 'isthing': 1, 'id': 2, 'name': 'bicycle'}, {'color': [0, 0, 142], 'isthing': 1, 'id': 3, 'name': 'car'}, {'color': [0, 0, 230], 'isthing': 1, 'id': 4, 'name': 'motorcycle'}, {'color': [106, 0, 228], 'isthi... |
load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "net_gac4", "nuget_package")
def packages():
nuget_package(
name = "npgsql",
package = "npgsql",
version = "4.0.3",
# sha256 = "4e1f91eb9f0c3dfb8e029edbc325175cd202455df3641bc16155ef422b6bfd6f",
core_lib = {
"netsta... | load('@io_bazel_rules_dotnet//dotnet:defs.bzl', 'net_gac4', 'nuget_package')
def packages():
nuget_package(name='npgsql', package='npgsql', version='4.0.3', core_lib={'netstandard2.0': 'lib/netstandard2.0/Npgsql.dll'}, net_lib={'net451': 'lib/net451/Npgsql.dll'}, mono_lib='lib/net45/Npgsql.dll', core_deps={}, net_... |
aihub_dialog_datasets = {
"train": {
"clean": ["data/Training"]
}
}
librispeech_datasets = {
"train": {
"clean": ["LibriSpeech/train-clean-100", "LibriSpeech/train-clean-360"],
"other": ["LibriSpeech/train-other-500"]
},
"test": {
"clean": ["LibriSpeech/test-clean"],... | aihub_dialog_datasets = {'train': {'clean': ['data/Training']}}
librispeech_datasets = {'train': {'clean': ['LibriSpeech/train-clean-100', 'LibriSpeech/train-clean-360'], 'other': ['LibriSpeech/train-other-500']}, 'test': {'clean': ['LibriSpeech/test-clean'], 'other': ['LibriSpeech/test-other']}, 'dev': {'clean': ['Lib... |
def matrix_script():
first_multiple_input = input().split()
n = int(first_multiple_input[0])
m = int(first_multiple_input[1])
matrix = []
for _ in range(n):
matrix_item = input()
matrix.append(matrix_item)
ref = []
for i in range(m):
for ... | def matrix_script():
first_multiple_input = input().split()
n = int(first_multiple_input[0])
m = int(first_multiple_input[1])
matrix = []
for _ in range(n):
matrix_item = input()
matrix.append(matrix_item)
ref = []
for i in range(m):
for j in range(n):
ref... |
'''
from sklearn.cluster import KMeans
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import MinMaxScaler
import numpy as np
import logging
def calculate_wcss(data):
wcss = []
scaler = MinMaxScaler()
data = scaler.fit_transform(data)
for n in range(2, 21):
kmeans = ... | """
from sklearn.cluster import KMeans
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import MinMaxScaler
import numpy as np
import logging
def calculate_wcss(data):
wcss = []
scaler = MinMaxScaler()
data = scaler.fit_transform(data)
for n in range(2, 21):
kmeans = ... |
class Solution:
def maximalSquare(self, matrix: List[List[str]]) -> int:
row = len(matrix)
col = len(matrix[0])
res = 0
dp = [[0 for i in range(col+1)] for j in range(row+1)]
for i in range(1,row+1):
for j in range(1,col+1):
if matrix[i-1]... | class Solution:
def maximal_square(self, matrix: List[List[str]]) -> int:
row = len(matrix)
col = len(matrix[0])
res = 0
dp = [[0 for i in range(col + 1)] for j in range(row + 1)]
for i in range(1, row + 1):
for j in range(1, col + 1):
if matrix[i... |
class Solution:
# @param A, a list of integer
# @return an integer
def singleNumber(self, A):
return reduce(lambda x, y: x ^ y, A)
| class Solution:
def single_number(self, A):
return reduce(lambda x, y: x ^ y, A) |
# KeyPairs.py
# Pairs key name to corresponding numerical identifier
keyPairs = [("C",1),("Db/C#",2),("D",3),("Eb/D#",4),("E",5),("F",6),
("Gb/F#",7),("G",8),("Ab/G#",9),("A",10),("Bb/A#",11),("B",12)]
| key_pairs = [('C', 1), ('Db/C#', 2), ('D', 3), ('Eb/D#', 4), ('E', 5), ('F', 6), ('Gb/F#', 7), ('G', 8), ('Ab/G#', 9), ('A', 10), ('Bb/A#', 11), ('B', 12)] |
file = open('/Users/hansr/Desktop/Homo_sapiens.GRCh37.75.gtf', 'rU')
hgncfile = open('/Users/hansr/Desktop/hgnc_complete_set.txt', 'rU')
outfile = open('/Users/hansr/Desktop/EnsembleId2GeneName.csv', 'w')
id2symbol = {}
id2name = {}
for line in hgncfile:
if line.startswith('hgnc_id'):
continue
splits... | file = open('/Users/hansr/Desktop/Homo_sapiens.GRCh37.75.gtf', 'rU')
hgncfile = open('/Users/hansr/Desktop/hgnc_complete_set.txt', 'rU')
outfile = open('/Users/hansr/Desktop/EnsembleId2GeneName.csv', 'w')
id2symbol = {}
id2name = {}
for line in hgncfile:
if line.startswith('hgnc_id'):
continue
splits = ... |
{
"targets": [
{
"target_name": "action_before_build",
"type": "none",
"hard_dependency": 1,
"actions": [
{
"action_name": "build rust-native-storage library",
"inputs": [ "scripts/build_storage_lib.sh" ],
"outputs": [ "" ],
"action": ["scrip... | {'targets': [{'target_name': 'action_before_build', 'type': 'none', 'hard_dependency': 1, 'actions': [{'action_name': 'build rust-native-storage library', 'inputs': ['scripts/build_storage_lib.sh'], 'outputs': [''], 'action': ['scripts/build_storage_lib.sh']}]}, {'target_name': '<(module_name)', 'dependencies': ['actio... |
def fib(n):
a,b = 1,2
for _ in range(n-1):
a,b = b, a + b
return a
def count_basic(n):
return fib(n)
def count_multi(n,ways):
if n < 0:
return 0
elif n == 0:
return 1
elif n in ways:
return 1 + sum([count_multi(n - x, ways) for x in ways if x < n])
else:
... | def fib(n):
(a, b) = (1, 2)
for _ in range(n - 1):
(a, b) = (b, a + b)
return a
def count_basic(n):
return fib(n)
def count_multi(n, ways):
if n < 0:
return 0
elif n == 0:
return 1
elif n in ways:
return 1 + sum([count_multi(n - x, ways) for x in ways if x <... |
VAR = 42
def func():
global VAR
VAR += 1 | var = 42
def func():
global VAR
var += 1 |
''' Pseudocode
1. Start
2. Take dividend from the user
3. Take divisor from user
4. Calculate the quotient
5. Calculate the remainder
6. Disdlays quotient and remainder
7. End
'''
# Take the value of dividend
dividend = int(input('Enter the value of dividend: '))
# Take the value of the divisor
divisor = int(inp... | """ Pseudocode
1. Start
2. Take dividend from the user
3. Take divisor from user
4. Calculate the quotient
5. Calculate the remainder
6. Disdlays quotient and remainder
7. End
"""
dividend = int(input('Enter the value of dividend: '))
divisor = int(input('Enter the value of divisor: '))
q = dividend // divisor
r = ... |
def any(x) -> bool:
pass
def all(x) -> bool:
pass
def bool(x) -> bool:
pass
def bytes(x) -> Bytes:
pass
def dict() -> Dict:
pass
def dir(x) -> List[String]:
pass
def enumerate(x) -> List[Tuple[int, any]]:
pass
def float(x) -> float:
pass
def hasattr(x, name) -> bool:
pass
def hash(x) -> int:
... | def any(x) -> bool:
pass
def all(x) -> bool:
pass
def bool(x) -> bool:
pass
def bytes(x) -> Bytes:
pass
def dict() -> Dict:
pass
def dir(x) -> List[String]:
pass
def enumerate(x) -> List[Tuple[int, any]]:
pass
def float(x) -> float:
pass
def hasattr(x, name) -> bool:
pass
de... |
def parse_policy(policy):
a, b, c = policy.split()
lo, hi = a.split("-")
return (int(lo), int(hi), b[:-1], c)
def part1(pws):
return sum(1 for lo, hi, c, pw in pws if lo <= pw.count(c) <= hi)
def part2(pws):
return sum(1 for lo, hi, c, pw in pws if (pw[lo - 1] == c) != (pw[hi - 1] == c))
if __... | def parse_policy(policy):
(a, b, c) = policy.split()
(lo, hi) = a.split('-')
return (int(lo), int(hi), b[:-1], c)
def part1(pws):
return sum((1 for (lo, hi, c, pw) in pws if lo <= pw.count(c) <= hi))
def part2(pws):
return sum((1 for (lo, hi, c, pw) in pws if (pw[lo - 1] == c) != (pw[hi - 1] == c)... |
__author__ = "Liyuan Liu and Frank Xu"
__credits__ = ["Liyuan Liu", "Frank Xu", "Jingbo Shang"]
__license__ = "Apache License 2.0"
__maintainer__ = "Liyuan Liu"
__email__ = "llychinalz@gmail.com" | __author__ = 'Liyuan Liu and Frank Xu'
__credits__ = ['Liyuan Liu', 'Frank Xu', 'Jingbo Shang']
__license__ = 'Apache License 2.0'
__maintainer__ = 'Liyuan Liu'
__email__ = 'llychinalz@gmail.com' |
def convert_month_to_days(number_of_months: int) -> int:
return number_of_months * 30
def convert_week_to_days(number_of_weeks: int) -> int:
return number_of_weeks * 7
class CovidEstimator:
def __init__(self, **kwargs):
self.currently_infected: int = 0
self.currently_infected_worst_cas... | def convert_month_to_days(number_of_months: int) -> int:
return number_of_months * 30
def convert_week_to_days(number_of_weeks: int) -> int:
return number_of_weeks * 7
class Covidestimator:
def __init__(self, **kwargs):
self.currently_infected: int = 0
self.currently_infected_worst_case: ... |
class _BaseOptimizer:
def __init__(self, model, learning_rate=1e-4, reg=1e-3):
self.learning_rate = learning_rate
self.reg = reg
self.grad_tracker = {}
for idx, m in enumerate(model.modules):
self.grad_tracker[idx] = dict(dw=0, db=0)
def update(self, model):
... | class _Baseoptimizer:
def __init__(self, model, learning_rate=0.0001, reg=0.001):
self.learning_rate = learning_rate
self.reg = reg
self.grad_tracker = {}
for (idx, m) in enumerate(model.modules):
self.grad_tracker[idx] = dict(dw=0, db=0)
def update(self, model):
... |
def getOrderFromDict(d):
return RobinhoodOrder(d['symbol'],d['action'],d['shares'],d['price'],d['date'])
class RobinhoodOrder(object):
def __init__(self, symbol, action, shares, price, date):
self.symbol = symbol
self.action = action
self.shares = shares
self.price = price
... | def get_order_from_dict(d):
return robinhood_order(d['symbol'], d['action'], d['shares'], d['price'], d['date'])
class Robinhoodorder(object):
def __init__(self, symbol, action, shares, price, date):
self.symbol = symbol
self.action = action
self.shares = shares
self.price = pr... |
'''
In this little assignment you are given a string of space separated numbers,
and have to return the highest and lowest number.
Example:
high_and_low("1 2 3 4 5") # return "5 1"
high_and_low("1 2 -3 4 5") # return "5 -3"
high_and_low("1 9 3 4 -5") # return "9 -5"
Notes:
All numbers are valid Int32, no need to va... | """
In this little assignment you are given a string of space separated numbers,
and have to return the highest and lowest number.
Example:
high_and_low("1 2 3 4 5") # return "5 1"
high_and_low("1 2 -3 4 5") # return "5 -3"
high_and_low("1 9 3 4 -5") # return "9 -5"
Notes:
All numbers are valid Int32, no need to va... |
n1 = 10
n2 = 20
print(n1,n2)
n1 , n2 = n2 ,n1
print(n1,n2)
| n1 = 10
n2 = 20
print(n1, n2)
(n1, n2) = (n2, n1)
print(n1, n2) |
pizzas = ['Pizza_A', 'Pizza_B', 'Pizza_C']
for pizza in pizzas:
print(f'Gosto da {pizza}')
print('Eu realmente gosto de pizza.')
for i in range(1, 1):
print(i)
pizzas_amigos = pizzas[:]
pizzas.append('Pizza_D')
pizzas_amigos.append('Pizza_E')
for pizza in pizzas:
print(pizza)
print()
... | pizzas = ['Pizza_A', 'Pizza_B', 'Pizza_C']
for pizza in pizzas:
print(f'Gosto da {pizza}')
print('Eu realmente gosto de pizza.')
for i in range(1, 1):
print(i)
pizzas_amigos = pizzas[:]
pizzas.append('Pizza_D')
pizzas_amigos.append('Pizza_E')
for pizza in pizzas:
print(pizza)
print()
for pizza_amigo in pizz... |
liste = [1,6,9,4,5,7]
plusFort = 0
for nb in liste:
if nb>plusFort:
plusFort = nb
print("Le plus fort de la liste est {}".format(plusFort))
| liste = [1, 6, 9, 4, 5, 7]
plus_fort = 0
for nb in liste:
if nb > plusFort:
plus_fort = nb
print('Le plus fort de la liste est {}'.format(plusFort)) |
{
'targets': [{
'target_name': 'addon',
'include_dirs': [
"<!(node -e \"require('nan')\")",
'lib/kcp',
'src',
],
'sources': [
'lib/kcp/ikcp.c',
'src/utils.c',
'src/Loop.cc',
'src/SessUDP.cc',
'src/Cryptor.cc',
'src/KcpuvSess.cc',
'src/Mux.cc'... | {'targets': [{'target_name': 'addon', 'include_dirs': ['<!(node -e "require(\'nan\')")', 'lib/kcp', 'src'], 'sources': ['lib/kcp/ikcp.c', 'src/utils.c', 'src/Loop.cc', 'src/SessUDP.cc', 'src/Cryptor.cc', 'src/KcpuvSess.cc', 'src/Mux.cc', 'src/binding.cc'], 'conditions': [['OS=="win"', {'libraries': ['ws2_32.lib']}]]}]} |
# Given an integer array nums of unique elements, return all possible subsets
# (the power set).
# The solution set must not contain duplicate subsets.
# Return the solution in any order.
#
# Example 1:
# Input: nums = [1,2,3]
# Output: [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]
#
# Example 2:
# Input: nums = [0]
# Out... | class Solution_1:
def subsets(nums):
ans = [[]]
for num in nums:
ans += [x + [num] for x in ans]
return ans |
n = int(input())
a = list(map(int,input().split()))
dist = [-1] * n
dist[0] = 0
pos = [0]
for u in pos:
for v in [u - 1, u + 1, a[u] - 1]:
if v >= 0 and v < n and dist[v] == -1:
dist[v] = dist[u] + 1
pos.append(v)
print(*dist)
| n = int(input())
a = list(map(int, input().split()))
dist = [-1] * n
dist[0] = 0
pos = [0]
for u in pos:
for v in [u - 1, u + 1, a[u] - 1]:
if v >= 0 and v < n and (dist[v] == -1):
dist[v] = dist[u] + 1
pos.append(v)
print(*dist) |
def letter_count(word):
count = {}
for i in word:
count[i] = word.count(i)
return count
new = (letter_count("mehedi hasan shifat").items())
for i,j in new:
print("'{}' -> {} times".format(i,j))
print(len(new))
| def letter_count(word):
count = {}
for i in word:
count[i] = word.count(i)
return count
new = letter_count('mehedi hasan shifat').items()
for (i, j) in new:
print("'{}' -> {} times".format(i, j))
print(len(new)) |
def random_choice():
return bool(GLOBAL_UNKOWN_VAR)
def is_safe(arg):
return UNKNOWN_FUNC(arg)
def true_func():
return True
def test_basic():
s = TAINTED_STRING
if is_safe(s):
ensure_not_tainted(s)
else:
ensure_tainted(s)
if not is_safe(s):
ensure_tainted(s)
... | def random_choice():
return bool(GLOBAL_UNKOWN_VAR)
def is_safe(arg):
return unknown_func(arg)
def true_func():
return True
def test_basic():
s = TAINTED_STRING
if is_safe(s):
ensure_not_tainted(s)
else:
ensure_tainted(s)
if not is_safe(s):
ensure_tainted(s)
el... |
m = 4
b = 5
c = 6
d = 7
n = 0
d = d*d
print(d)
c = d*2 - c*2
print(c)
p = b*d+m*c
print(p)
dn = c-d
print(dn)
cn = c-m
print(cn)
d = d-dn
print(d)
c = c-n
print(c)
a = d + c
f = m + b
e = a + f
print(d,dn)
print(c,d,f)
print(m,b,p)
print(cn,dn)
print(a,e)
| m = 4
b = 5
c = 6
d = 7
n = 0
d = d * d
print(d)
c = d * 2 - c * 2
print(c)
p = b * d + m * c
print(p)
dn = c - d
print(dn)
cn = c - m
print(cn)
d = d - dn
print(d)
c = c - n
print(c)
a = d + c
f = m + b
e = a + f
print(d, dn)
print(c, d, f)
print(m, b, p)
print(cn, dn)
print(a, e) |
# Copyright (C) 2017 Udacity Inc.
# All Rights Reserved.
# Author: Brandon Kinman
##################################################################################
# UPDATED USING CLASS FROM LESSON 23 PID CONTROL
##################################################################################
class PIDControll... | class Pidcontroller:
def __init__(self, kp=0.0, ki=0.0, kd=0.0, max_windup=20, start_time=0, alpha=1.0, u_bounds=[float('-inf'), float('inf')]):
self.kp_ = float(kp)
self.ki_ = float(ki)
self.kd_ = float(kd)
self.max_windup_ = float(max_windup)
self.alpha = float(alpha)
... |
try:
while 1:
n=int(input())
k=(n-10)//9
m=n-10-9*k
print(81*(k+1)+m*(m+2)+1)
except:pass
| try:
while 1:
n = int(input())
k = (n - 10) // 9
m = n - 10 - 9 * k
print(81 * (k + 1) + m * (m + 2) + 1)
except:
pass |
def run(df, docs):
for doc in docs:
doc.start("t10 - Columns to lowercase", df)
columns = list(df.columns)
# for each column
for i in columns:
try:
# all charts to lowercase and no leading or trailing spaces
df[i] = df[i].str.lower().str.strip()
except:
... | def run(df, docs):
for doc in docs:
doc.start('t10 - Columns to lowercase', df)
columns = list(df.columns)
for i in columns:
try:
df[i] = df[i].str.lower().str.strip()
except:
continue
for doc in docs:
doc.end(df)
return df |
n = int(input())
for i in range(n):
s = int(input())
p = 0
for j in range(0, s):
p = (p * 2) + 1
print(p)
| n = int(input())
for i in range(n):
s = int(input())
p = 0
for j in range(0, s):
p = p * 2 + 1
print(p) |
#!/usr/bin/env python
#
# chemweight.py
#
#
# import re
mass = {
"H": 1.00794,
"He": 4.002602,
"Li": 6.941,
"Be": 9.012182,
"B": 10.811,
"C": 12.011,
"N": 14.00674,
"O": 15.9994,
"F": 18.9984032,
"Ne": 20.1797,
"Na": 22.989768,
"Mg": 24.3050,
"Al": 26.981539,
"Si": 28.0855,
"P": 30.... | mass = {'H': 1.00794, 'He': 4.002602, 'Li': 6.941, 'Be': 9.012182, 'B': 10.811, 'C': 12.011, 'N': 14.00674, 'O': 15.9994, 'F': 18.9984032, 'Ne': 20.1797, 'Na': 22.989768, 'Mg': 24.305, 'Al': 26.981539, 'Si': 28.0855, 'P': 30.973762, 'S': 32.066, 'Cl': 35.4527, 'Ar': 39.948, 'K': 39.0983, 'Ca': 40.078, 'Sc': 44.95591, '... |
COMPANY_NAME = "Enter the legal name of your business (not the trading name) then use 'Search Companies House'\
and select your company from the list. It will then prefill your company number and postcode."
COMPANY_WEBSITE = "Website address, where we can see your products online."
COMPANY_NUMBER = "The... | company_name = "Enter the legal name of your business (not the trading name) then use 'Search Companies House' and select your company from the list. It will then prefill your company number and postcode."
company_website = 'Website address, where we can see your products online.'
company_number = 'The 8... |
{
"targets": [
{
"target_name": "naudiodon",
"sources": [
"src/naudiodon.cc",
"src/GetDevices.cc",
"src/GetHostAPIs.cc",
"src/AudioIO.cc",
"src/PaContext.cc"
],
"include_dirs": [
"<!@(node -p \"require('node-addon-api').include\")",
"po... | {'targets': [{'target_name': 'naudiodon', 'sources': ['src/naudiodon.cc', 'src/GetDevices.cc', 'src/GetHostAPIs.cc', 'src/AudioIO.cc', 'src/PaContext.cc'], 'include_dirs': ['<!@(node -p "require(\'node-addon-api\').include")', 'portaudio/include'], 'dependencies': ['<!(node -p "require(\'node-addon-api\').gyp")'], 'con... |
#-------------------------------------------------------------------------------
# 6857
#-------------------------------------------------------------------------------
N = 600851475143
d = 3
while d * d <= N and N != 1:
while N % d == 0:
N //= d
last = d
d += 2
if N != 1:
last = N
print(last)
| n = 600851475143
d = 3
while d * d <= N and N != 1:
while N % d == 0:
n //= d
last = d
d += 2
if N != 1:
last = N
print(last) |
def doIt (func, x, y):
z = func (x, y)
return z
def add (arg1, arg2):
return arg1 + arg2
def sub (arg1, arg2):
return arg1 - arg2
print ('Addition:')
print ( doIt (add, 2, 3) ) # Passing the name of the function
# and its arguments
print ('Subtraction:')
print ( do... | def do_it(func, x, y):
z = func(x, y)
return z
def add(arg1, arg2):
return arg1 + arg2
def sub(arg1, arg2):
return arg1 - arg2
print('Addition:')
print(do_it(add, 2, 3))
print('Subtraction:')
print(do_it(sub, 2, 3)) |
list=["rayne","coder","python","c","c++","java"]
#REMOVE
list.remove("java")
print(list)
#remove BY index
list.pop(1) # 1- coder
print(list)
| list = ['rayne', 'coder', 'python', 'c', 'c++', 'java']
list.remove('java')
print(list)
list.pop(1)
print(list) |
n=int(input())
namibia=0
kenya=0
tanzania=0
ethiopia=0
zim=0
zam=0
zimzam=0
zimzamMode=False
namaVisit=False
last=''
lgo=""
for i in range(n):
go=input()
lgo=go
if last==go: continue
if go=='kenya': kenya=1
if go=='tanzania': tanzania=1
if go=='ethiopia': ethiopia=1
if go=='zambia':
if last=='zimbabwe':
z... | n = int(input())
namibia = 0
kenya = 0
tanzania = 0
ethiopia = 0
zim = 0
zam = 0
zimzam = 0
zimzam_mode = False
nama_visit = False
last = ''
lgo = ''
for i in range(n):
go = input()
lgo = go
if last == go:
continue
if go == 'kenya':
kenya = 1
if go == 'tanzania':
tanzania = 1... |
#
# PySNMP MIB module NETREALITY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETREALITY-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:10:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint) ... |
'''
Given a singly linked list, group all odd nodes together followed by the even nodes.
Please note here we are talking about the node number and not the value in the nodes.
You should try to do it in place. The program should
run in O(1) space complexity and O(nodes) time complexity.
Example 1:
Input: 1->2->3->4-... | """
Given a singly linked list, group all odd nodes together followed by the even nodes.
Please note here we are talking about the node number and not the value in the nodes.
You should try to do it in place. The program should
run in O(1) space complexity and O(nodes) time complexity.
Example 1:
Input: 1->2->3->4-... |
def num_of_factors(num):
n = 0
factor = 1
while factor * factor < num:
if num % factor == 0:
n += 1
factor += 1
if factor * factor > num:
return n * 2
else:
# perfect square
return n * 2 + 1
triangle = 0
i = 1
while True:
triangle += i
if ... | def num_of_factors(num):
n = 0
factor = 1
while factor * factor < num:
if num % factor == 0:
n += 1
factor += 1
if factor * factor > num:
return n * 2
else:
return n * 2 + 1
triangle = 0
i = 1
while True:
triangle += i
if num_of_factors(triangle) >... |
# bulk_data = []
# for row in csv_file_object:
# data_dict = {}
# for i in range(len(row)):
# data_dict[header[i]] = row[i]
# op_dict = {
# "index": {
# "_index": INDEX_NAME,
# "_type": TYPE_NAME,
# "_id": data_dict[ID_FIELD]
# }
# }
# b... | x = 10
y = 20
def a():
print(x)
x = x + 10
def b():
print(y)
print(a(), b(), x) |
class t_list():
def __init__(self, lst = []):
lst.sort()
self.lst = [[el, el] for el in lst]
def __len__ (self):
return len(self.lst)
def create(self, lst):
lst.sort()
self.lst = [[el, el] for el in lst]
def add(self, val, t):
left = 0
right = ... | class T_List:
def __init__(self, lst=[]):
lst.sort()
self.lst = [[el, el] for el in lst]
def __len__(self):
return len(self.lst)
def create(self, lst):
lst.sort()
self.lst = [[el, el] for el in lst]
def add(self, val, t):
left = 0
right = len(s... |
OperandSet = {
'Ib' : {
'16' : ( "0x10", ),
'32' : ( "0x10", ),
'64' : ( "0x20", )
},
'Eb_Gb' : {
'16' : ( "[bx+si], al", ),
'32' : ( "[eax+ebx], ch", "[ebx+ecx*4], bl", "[bx+0x10], dh"),
'64' : ( "[rax], r8b", )
... | operand_set = {'Ib': {'16': ('0x10',), '32': ('0x10',), '64': ('0x20',)}, 'Eb_Gb': {'16': ('[bx+si], al',), '32': ('[eax+ebx], ch', '[ebx+ecx*4], bl', '[bx+0x10], dh'), '64': ('[rax], r8b',)}, 'Ev_Gv': {'16': (), '32': ('[eax+0x1234], esi', '[bx+si+0x1234], esp', '[esp+0x10], ebp'), '64': ()}, 'Gb_Eb': {'16': ('al, bl'... |
def calculation(operator,n_1,n_2):
if operator == "multiply":
return n_1 * n_2
elif operator == "divide":
return n_1 // n_2
elif operator == "add":
return n_1 + n_2
elif operator == "subtract":
return n_1 - n_2
operator = input()
n_1 = int(input())
n_2 = int(input())
pr... | def calculation(operator, n_1, n_2):
if operator == 'multiply':
return n_1 * n_2
elif operator == 'divide':
return n_1 // n_2
elif operator == 'add':
return n_1 + n_2
elif operator == 'subtract':
return n_1 - n_2
operator = input()
n_1 = int(input())
n_2 = int(input())
pr... |
class Solution:
def nextGreatestLetter(self, letters: List[str], target: str) -> str:
if target >= letters[-1]: return letters[0]
left, right = 0, len(letters)
while left < right:
mid = left + (right - left) // 2
if letters[mid] <= target:
left = mid ... | class Solution:
def next_greatest_letter(self, letters: List[str], target: str) -> str:
if target >= letters[-1]:
return letters[0]
(left, right) = (0, len(letters))
while left < right:
mid = left + (right - left) // 2
if letters[mid] <= target:
... |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( keypad , n ) :
if ( not keypad or n <= 0 ) :
return 0
if ( n == 1 ) :
return 10
odd = [... | def f_gold(keypad, n):
if not keypad or n <= 0:
return 0
if n == 1:
return 10
odd = [0] * 10
even = [0] * 10
i = 0
j = 0
use_odd = 0
total_count = 0
for i in range(10):
odd[i] = 1
for j in range(2, n + 1):
use_odd = 1 - useOdd
if useOdd == ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
DENIED_ACTIONS = {
"access-analyzer:DeleteAnalyzer",
"cloudtrail:CreateTrail",
"cloudtrail:DeleteTrail",
"cloudtrail:UpdateTrail",
"cloudtrail:StopLogging",
"config:DeleteConfigRule",
"config:DeleteConfigurationRecorder",
"config:DeleteDeliv... | denied_actions = {'access-analyzer:DeleteAnalyzer', 'cloudtrail:CreateTrail', 'cloudtrail:DeleteTrail', 'cloudtrail:UpdateTrail', 'cloudtrail:StopLogging', 'config:DeleteConfigRule', 'config:DeleteConfigurationRecorder', 'config:DeleteDeliveryChannel', 'config:StopConfigurationRecorder', 'ec2:AcceptVpcPeeringConnection... |
X = int(input())
Y = int(input())
Z = int(input())
N = int(input())
result = [ [x, y, z] for x in range(X+1) for y in range(Y+1) for z in range(Z+1) if x + y + z != N ]
print(result)
| x = int(input())
y = int(input())
z = int(input())
n = int(input())
result = [[x, y, z] for x in range(X + 1) for y in range(Y + 1) for z in range(Z + 1) if x + y + z != N]
print(result) |
with open('test.txt', 'w') as file:
content = input('Write into file: ')
file.write(content)
with open('test.txt', 'a') as file:
s = ''
while s!= '@':
file.write(s)
s = input('Append into file: ')
with open('test.txt') as file:
print(file.read()) | with open('test.txt', 'w') as file:
content = input('Write into file: ')
file.write(content)
with open('test.txt', 'a') as file:
s = ''
while s != '@':
file.write(s)
s = input('Append into file: ')
with open('test.txt') as file:
print(file.read()) |
def sumofs1():
s1=0
n=int(input("enter a number:"))
for i in range(1,n+1):
s1=s1+i
print("sumofs1=",s1)
def sumofs2():
s2=0
m=int(input("enter a number:"))
for j in range(1,m+1):
s2=s2+(j*j)
print("sumofs2=",s2)
def sumofs3():
s3=0
p=int(input("enter... | def sumofs1():
s1 = 0
n = int(input('enter a number:'))
for i in range(1, n + 1):
s1 = s1 + i
print('sumofs1=', s1)
def sumofs2():
s2 = 0
m = int(input('enter a number:'))
for j in range(1, m + 1):
s2 = s2 + j * j
print('sumofs2=', s2)
def sumofs3():
s3 = 0
p = ... |
# Add your list of tweets here in this list. Make sure the messages are inside double quotes and end with a comma.
# For example: "Hello Check, my profile",
# The program will then randomly select one of the messages and post it to Twitter.
# Also if your message contains a double quote, you need to escape it with a b... | tweets = ['Hello, Check my profile', 'Great Job,', 'Cool NFTs']
accounts = {'account1': {'username': 'qbanbabee', 'password': 'CDxrRcqSHP'}, 'account2': {'username': 'r3i2x', 'password': '!seucNgU9D'}, 'account3': {'username': 'AprilThorne8', 'password': 'kfjOZcdkzVvOliv'}, 'account3': {'username': 'fitriamarthaa', 'pa... |
#!/usr/bin/env python3
types = {
"BASIC_CONSTRAINTS": {
"ca": "ca_bool_int",
"pathlen": "ASN1_INTEGER",
},
}
getter_conv_tmpl = {
"ca_bool_int": "ctx.{k} == 0xFF",
"ASN1_INTEGER": "tonumber(C.ASN1_INTEGER_get(ctx.{k}))",
}
setter_conv_tmpl = {
"ca_bool_int": '''
toset.{k} = cfg_... | types = {'BASIC_CONSTRAINTS': {'ca': 'ca_bool_int', 'pathlen': 'ASN1_INTEGER'}}
getter_conv_tmpl = {'ca_bool_int': 'ctx.{k} == 0xFF', 'ASN1_INTEGER': 'tonumber(C.ASN1_INTEGER_get(ctx.{k}))'}
setter_conv_tmpl = {'ca_bool_int': '\n toset.{k} = cfg_lower.{k} and 0xFF or 0', 'ASN1_INTEGER': '\n local {k} = cfg_lower.{k} ... |
#
# PySNMP MIB module DLINK-3100-MIR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DLINK-3100-MIR-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:48:41 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, value_range_constraint, constraints_union, constraints_intersection) ... |
def insertData(db):
db.insert("RESTRICTION",('Titanic',1997,'M','Australia'))
db.insert("RESTRICTION",('Titanic',1997,'KT','Belgium'))
db.insert("RESTRICTION",('Titanic',1997,'TE','Chile'))
db.insert("RESTRICTION",('Titanic',1997,'K-12','Finland'))
db.insert("RESTRICTION",('Titanic',1997,'U','France... | def insert_data(db):
db.insert('RESTRICTION', ('Titanic', 1997, 'M', 'Australia'))
db.insert('RESTRICTION', ('Titanic', 1997, 'KT', 'Belgium'))
db.insert('RESTRICTION', ('Titanic', 1997, 'TE', 'Chile'))
db.insert('RESTRICTION', ('Titanic', 1997, 'K-12', 'Finland'))
db.insert('RESTRICTION', ('Titanic... |
class Solution:
def assignBikes(self, W: List[List[int]], B: List[List[int]]) -> List[int]:
ans, used = [-1] * len(W), set()
for d, w, b in sorted([abs(W[i][0] - B[j][0]) + abs(W[i][1] - B[j][1]), i, j] for i in range(len(W)) for j in range(len(B))):
if ans[w] == -1 and b not in used:
... | class Solution:
def assign_bikes(self, W: List[List[int]], B: List[List[int]]) -> List[int]:
(ans, used) = ([-1] * len(W), set())
for (d, w, b) in sorted(([abs(W[i][0] - B[j][0]) + abs(W[i][1] - B[j][1]), i, j] for i in range(len(W)) for j in range(len(B)))):
if ans[w] == -1 and b not i... |
class OneLayerActiveScriptGen:
def __init__(self, args):
self.valid = args.split('|')
pass
def GenerateScript(self, arg2):
if len(self.valid) == 1:
#OK, this uses sub-layers
Script = "for (i=0;i<app.activeDocument.layers.length;i++)\n"
... | class Onelayeractivescriptgen:
def __init__(self, args):
self.valid = args.split('|')
pass
def generate_script(self, arg2):
if len(self.valid) == 1:
script = 'for (i=0;i<app.activeDocument.layers.length;i++)\n'
script += '{\n'
for vl in self.valid:
... |
def downcase_keys(dict_):
return {k.lower(): v for k, v in dict_.items()}
def assert_aws4auth_in_headers(headers):
lc_headers = downcase_keys(headers)
assert 'authorization' in lc_headers
assert 'x-amz-date' in lc_headers
assert 'x-amz-content-sha256' in lc_headers
auth_header = lc_headers.get... | def downcase_keys(dict_):
return {k.lower(): v for (k, v) in dict_.items()}
def assert_aws4auth_in_headers(headers):
lc_headers = downcase_keys(headers)
assert 'authorization' in lc_headers
assert 'x-amz-date' in lc_headers
assert 'x-amz-content-sha256' in lc_headers
auth_header = lc_headers.ge... |
class PersonError(Exception):
def __init__(self, a, b):
self.a = a
self.b = b
def print_obj(self):
print(self.a, self.b)
class Person:
def __init__(self, name: str, surname: str, age: int, gender: str):
try:
if age <= 0:
raise PersonError("Perso... | class Personerror(Exception):
def __init__(self, a, b):
self.a = a
self.b = b
def print_obj(self):
print(self.a, self.b)
class Person:
def __init__(self, name: str, surname: str, age: int, gender: str):
try:
if age <= 0:
raise person_error('Per... |
number_one = int(input("Enter a number: "))
number_two = int(input("Enter another number: "))
if (number_one > number_two):
print("Number one is greater than number two")
else:
print("Number two is greater than number one") | number_one = int(input('Enter a number: '))
number_two = int(input('Enter another number: '))
if number_one > number_two:
print('Number one is greater than number two')
else:
print('Number two is greater than number one') |
# Exercise 1: Rewrite your pay computation to give the employee 1.5 times the hourly rate for hours worked above 40 hours.
# Enter Hours: 45
# Enter Rate: 10
# Pay: 475.0
hours = int(input('Enter hours: '));
rate = float(input('Enter rate: '));
if hours > 40:
rate = rate * 1.5
pay = hours * rate;
print('Pay',pay); | hours = int(input('Enter hours: '))
rate = float(input('Enter rate: '))
if hours > 40:
rate = rate * 1.5
pay = hours * rate
print('Pay', pay) |
n = int(input())
for i in range(n,0,-1):
if n%i==0:
n=i
print(i, end=' ') | n = int(input())
for i in range(n, 0, -1):
if n % i == 0:
n = i
print(i, end=' ') |
###############################################################
# Servers
###############################################################
class ServerType(models.Model):
name = models.CharField(max_length=40, verbose_name='Nome')
type = models.CharField(max_length=40, verbose_name='Tipo')
creat... | class Servertype(models.Model):
name = models.CharField(max_length=40, verbose_name='Nome')
type = models.CharField(max_length=40, verbose_name='Tipo')
created_at = models.DateTimeField(auto_now=False, auto_now_add=True, verbose_name='Created')
updated_at = models.DateTimeField(auto_now=True, verbose_na... |
class MyClass:
def func_1(self):
return "1"
def func_2(func):
return func()
def main():
a=func_2(MyClass().func_1)
print(a)
if __name__ == '__main__':
main()
| class Myclass:
def func_1(self):
return '1'
def func_2(func):
return func()
def main():
a = func_2(my_class().func_1)
print(a)
if __name__ == '__main__':
main() |
people = ['Conrad', 'Deepak', 'Heinrich', 'Tom']
ages = [29, 30, 34, 36]
for position in range(len(people)):
person = people[position]
age = ages[position]
print(person, age)
| people = ['Conrad', 'Deepak', 'Heinrich', 'Tom']
ages = [29, 30, 34, 36]
for position in range(len(people)):
person = people[position]
age = ages[position]
print(person, age) |
income_tax=0
id = int(input("Enter Employee id: "))
basic_salary = int(input("Enter monthly gross salary: "))
allowance = int(input("Enter allowance: "))
gross_salary = basic_salary+allowance
if gross_salary<=5000:
income_tax = 0
elif gross_salary<=10000:
income_tax = 0.1 * gross_salary
elif gross_salary<=20... | income_tax = 0
id = int(input('Enter Employee id: '))
basic_salary = int(input('Enter monthly gross salary: '))
allowance = int(input('Enter allowance: '))
gross_salary = basic_salary + allowance
if gross_salary <= 5000:
income_tax = 0
elif gross_salary <= 10000:
income_tax = 0.1 * gross_salary
elif gross_salar... |
# !/usr/bin/env python3
# Author: C.K
# Email: theck17@163.com
# DateTime:2021-11-16 21:11:11
# Description:
class Solution:
def findMaxLength(self, nums: List[int]) -> int:
count = 0
result = 0
dict_seen = {0: -1}
for i in range(len(nums)):
n = nums[i]
if n =... | class Solution:
def find_max_length(self, nums: List[int]) -> int:
count = 0
result = 0
dict_seen = {0: -1}
for i in range(len(nums)):
n = nums[i]
if n == 0:
count -= 1
if n == 1:
count += 1
if count in ... |
__author__ = 'prossi'
class DISK:
def __init__(self, obj, connection):
self.__dict__ = dict(obj.attrib)
self.connection = connection
| __author__ = 'prossi'
class Disk:
def __init__(self, obj, connection):
self.__dict__ = dict(obj.attrib)
self.connection = connection |
class ResponseMaker(object):
__slot__ = ['error_verbose']
def __init__(self, error_verbose=True):
self.error_verbose = error_verbose
def get_response(self, result, request_id):
return {
"jsonrpc": "2.0",
"result": result,
"id": request_id
}
... | class Responsemaker(object):
__slot__ = ['error_verbose']
def __init__(self, error_verbose=True):
self.error_verbose = error_verbose
def get_response(self, result, request_id):
return {'jsonrpc': '2.0', 'result': result, 'id': request_id}
def get_error(self, code, message, data=None, ... |
def Sorting_array_data(A,i):
B = sorted(A, key=lambda a_entry: a_entry[i])
return B
| def sorting_array_data(A, i):
b = sorted(A, key=lambda a_entry: a_entry[i])
return B |
class Tracker(object):
def __init__(self):
self.trk = [] # currently tracked 2D Points
self.trk_i = [] # self.pts[self.trk_i] are currently tracked
self.pts = [] # list of all known object feature point positions
self.kpt = [] # corresponding image coordinates for all points
... | class Tracker(object):
def __init__(self):
self.trk = []
self.trk_i = []
self.pts = []
self.kpt = []
self.des = []
def detect(self, img):
pass
def solve(self, img, pt0, pt1, li_c):
(e, _) = find_essential_mat(...)
def track(self, img0, kpt0, de... |
# Write an efficient program to find the sum of contiguous subarray within
# a one-dimensional array of numbers which has the largest sum.
def max_sum_kadane(nums: list) -> int:
# kadane's algorithm
max_so_far = max_ending_here = 0
for value in nums:
max_ending_here = max(max_ending_here + value,... | def max_sum_kadane(nums: list) -> int:
max_so_far = max_ending_here = 0
for value in nums:
max_ending_here = max(max_ending_here + value, 0)
if max_ending_here > 0:
max_so_far = max(max_so_far, max_ending_here)
return max_so_far
def max_sum_print_subarray(nums: list) -> int:
... |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
'variables': {
'version_py_path': '<(DEPTH)/build/util/version.py',
'version_path': 'VERSION',
... | {'variables': {'chromium_code': 1, 'variables': {'version_py_path': '<(DEPTH)/build/util/version.py', 'version_path': 'VERSION'}, 'version_py_path': '<(version_py_path) -f', 'version_path': '<(version_path)'}, 'includes': ['../build/util/version.gypi'], 'targets': [{'target_name': 'cloud_print_version_resources', 'type... |
'''
Steven Kyritsis CS100
2021F Section 031 HW 08,
November 5, 2021
'''
#1
def two_words(length, first_letter):
while True:
word1 = input("Please enter a " + str(length) + "-letter word please: ")
if len(word1) == length:
break
while True:
word2 = input("Please enter a word ... | """
Steven Kyritsis CS100
2021F Section 031 HW 08,
November 5, 2021
"""
def two_words(length, first_letter):
while True:
word1 = input('Please enter a ' + str(length) + '-letter word please: ')
if len(word1) == length:
break
while True:
word2 = input('Please enter a word be... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.