content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#
# PySNMP MIB module Webio-Digital-MIB-US (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Webio-Digital-MIB-US
# Produced by pysmi-0.3.4 at Mon Apr 29 21:32:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint) ... |
raspberry = True
display_device = "/dev/fb1"
mouse_device = "/dev/input/event0"
mouse_driver = "TSLIB"
if raspberry:
mouse_type = "pitft_touchscreen"
touch_xmin = 345
touch_xmax = 3715
touch_ymin = 184
touch_ymax = 3853
else:
mouse_type = "pygame"
if raspberry:
screen_fullscreen = True
els... | raspberry = True
display_device = '/dev/fb1'
mouse_device = '/dev/input/event0'
mouse_driver = 'TSLIB'
if raspberry:
mouse_type = 'pitft_touchscreen'
touch_xmin = 345
touch_xmax = 3715
touch_ymin = 184
touch_ymax = 3853
else:
mouse_type = 'pygame'
if raspberry:
screen_fullscreen = True
else:... |
# Copyright 2017 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.
def CheckChangeOnUpload(*args):
return _CommonChecks(*args)
def CheckChangeOnCommit(*args):
return _CommonChecks(*args)
def _CommonChecks(input_api,... | def check_change_on_upload(*args):
return __common_checks(*args)
def check_change_on_commit(*args):
return __common_checks(*args)
def __common_checks(input_api, output_api):
cwd = input_api.PresubmitLocalPath()
path = input_api.os_path
files = [path.basename(f.LocalPath()) for f in input_api.Affec... |
messages = ["<b>Shoulder-arm stretch</b>Time to do Shoulder arm stretch, keep one arm horizontally stretched in front of your chest. Push this arm with your other arm towards you until you feel a mild tension in your shoulder. Hold this position briefly, and repeat the exercise for your other arm. Don't do this more th... | messages = ["<b>Shoulder-arm stretch</b>Time to do Shoulder arm stretch, keep one arm horizontally stretched in front of your chest. Push this arm with your other arm towards you until you feel a mild tension in your shoulder. Hold this position briefly, and repeat the exercise for your other arm. Don't do this more th... |
myfile=open('country.txt')
print(myfile.read())
myfile.close()
#with open('country.txt',mode='r') as myfile:
# print(myfile.read())
with open('country.txt',mode='a') as f:
print(f.write("'IN':'INDIAN'"))
| myfile = open('country.txt')
print(myfile.read())
myfile.close()
with open('country.txt', mode='a') as f:
print(f.write("'IN':'INDIAN'")) |
# -*- coding: utf-8 -*-
"""
FIXME
"""
| """
FIXME
""" |
class Solution:
def skipAndClose(self, startIndex, step, count):
"""
:type startIndex: int
:type step: int
:type count: int
:rtype: List[int]
"""
inputArray = list(range(1, count+1))
itemLeft = 0
result = []
while(len(inputArray) > 0... | class Solution:
def skip_and_close(self, startIndex, step, count):
"""
:type startIndex: int
:type step: int
:type count: int
:rtype: List[int]
"""
input_array = list(range(1, count + 1))
item_left = 0
result = []
while len(inputArray)... |
L_af = "af" # Afrikaans
L_am = "am" # Amharic
L_ar = "ar" # Arabic
L_az = "az" # Azerbaijani
L_be = "be" # Belarusian
L_bg = "bg" # Bulgarian
L_bn = "bn" # Bengali
L_bs = "bs" # Bosnian
L_ca = "ca" # Catalan
L_ceb = "ceb" # Chechen
L_co = "co" # Corsican
L... | l_af = 'af'
l_am = 'am'
l_ar = 'ar'
l_az = 'az'
l_be = 'be'
l_bg = 'bg'
l_bn = 'bn'
l_bs = 'bs'
l_ca = 'ca'
l_ceb = 'ceb'
l_co = 'co'
l_cs = 'cs'
l_cy = 'cy'
l_da = 'da'
l_de = 'de'
l_el = 'el'
l_en = 'en'
l_eo = 'eo'
l_es = 'es'
l_et = 'et'
l_eu = 'eu'
l_fa = 'fa'
l_fi = 'fi'
l_fr = 'fr'
l_fy = 'fy'
l_ga = 'ga'
l_gd =... |
km = float(input('Quantos Km percorrido: '))
diaria = int(input('Quantos dias alugado: '))
total = (diaria * 60) + (km * .15)
print(f'Foram percorridos {km}km e {diaria} diarias, total de R${total:.2f}')
| km = float(input('Quantos Km percorrido: '))
diaria = int(input('Quantos dias alugado: '))
total = diaria * 60 + km * 0.15
print(f'Foram percorridos {km}km e {diaria} diarias, total de R${total:.2f}') |
n = int(input())
phonebook=dict()
for _ in range(n):
q = list(map(str,list(input().split())))
name = q[0]
phone = int(q[1])
phonebook[name]=phone
try:
while True:
query = input()
if query!="":
if query in phonebook:
st = query+'='+str(phonebook[query])
... | n = int(input())
phonebook = dict()
for _ in range(n):
q = list(map(str, list(input().split())))
name = q[0]
phone = int(q[1])
phonebook[name] = phone
try:
while True:
query = input()
if query != '':
if query in phonebook:
st = query + '=' + str(phonebook[... |
__author__ = 'deadblue'
mime_types = {
'svg': 'image/svg+xml',
'png': 'image/png',
'webp': 'image/webp'
} | __author__ = 'deadblue'
mime_types = {'svg': 'image/svg+xml', 'png': 'image/png', 'webp': 'image/webp'} |
#
# PySNMP MIB module MSSSERVER8260-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MSSSERVER8260-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:15:54 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, constraints_intersection, value_range_constraint, single_value_constraint) ... |
nums = map(float, input().split())
count_values = {}
for num in nums:
if num not in count_values:
count_values[num] = 0
count_values[num] += 1
for key, value in count_values.items():
print(f"{key} - {value} times")
| nums = map(float, input().split())
count_values = {}
for num in nums:
if num not in count_values:
count_values[num] = 0
count_values[num] += 1
for (key, value) in count_values.items():
print(f'{key} - {value} times') |
def get_ranges(data):
# create a list of all valid ranges
list_of_ranges = {}
for line in data:
if line == "":
break
l = []
key = line.split(":")[0]
line = line.split()
lower, upper = line[-1].split("-")
l.append((int(lower), int(upper)))
l... | def get_ranges(data):
list_of_ranges = {}
for line in data:
if line == '':
break
l = []
key = line.split(':')[0]
line = line.split()
(lower, upper) = line[-1].split('-')
l.append((int(lower), int(upper)))
(lower, upper) = line[-3].split('-')
... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "... | def generate_ros_package_names(name):
names = [name, name.replace('_', '-'), name.replace('-', '_')]
for distro in ['kinetic', 'indigo']:
names.extend([name.replace('ros-%s-' % (distro,), ''), name.replace('ros-%s-' % (distro,), '').replace('-', '_')])
return set(names) |
########################
#### Initialisation ####
########################
input_ex1 = []
with open("inputs/day5_1.txt") as inputfile:
for line in inputfile.readlines():
input_ex1.append(int(line.strip()))
########################
#### Part one ####
########################
sample_input = [0,
... | input_ex1 = []
with open('inputs/day5_1.txt') as inputfile:
for line in inputfile.readlines():
input_ex1.append(int(line.strip()))
sample_input = [0, 3, 0, 1, -3]
input_data = input_ex1[:]
new_index = 0
steps = 0
while True:
try:
instruction = input_data[newIndex]
input_data[newIndex] +=... |
'''
Probem Task : This program will return number of solutions to quadratic equation.
Problem Link : https://edabit.com/challenge/o2AKq4xy3nfZabKXL
'''
def solutions(a,b,c):
if ((b**2 - 4*a*c) > 0):
return 2
elif ((b**2 - 4*a*c)==0):
return 1
else:
return 0
if __name__ == ... | """
Probem Task : This program will return number of solutions to quadratic equation.
Problem Link : https://edabit.com/challenge/o2AKq4xy3nfZabKXL
"""
def solutions(a, b, c):
if b ** 2 - 4 * a * c > 0:
return 2
elif b ** 2 - 4 * a * c == 0:
return 1
else:
return 0
if __nam... |
"""
For extracting parameters from a dictionary of substance properties.
"""
class MissingParameterError(Exception):
"""Raised when a parameter of a substance is required but not supplied."""
def __init__(self, substance, parameter):
self.substance = substance
self.parameter = parameter
... | """
For extracting parameters from a dictionary of substance properties.
"""
class Missingparametererror(Exception):
"""Raised when a parameter of a substance is required but not supplied."""
def __init__(self, substance, parameter):
self.substance = substance
self.parameter = parameter
... |
# -*- coding: utf-8 -*-
n = int(input())
p, q, r, s, x, y = map(int, input().split())
i, j = map(int, input().split())
res = 0
for k in range(1, n + 1):
res += ((p * i + q * k) % x) * ((r * k + s * j) % y)
print(res) | n = int(input())
(p, q, r, s, x, y) = map(int, input().split())
(i, j) = map(int, input().split())
res = 0
for k in range(1, n + 1):
res += (p * i + q * k) % x * ((r * k + s * j) % y)
print(res) |
# encoding: utf-8
# module time
# from (built-in)
# by generator 1.145
"""
This module provides various functions to manipulate time values.
There are two standard representations of time. One is the number
of seconds since the Epoch, in UTC (a.k.a. GMT). It may be an integer
or a floating point number (to represent... | """
This module provides various functions to manipulate time values.
There are two standard representations of time. One is the number
of seconds since the Epoch, in UTC (a.k.a. GMT). It may be an integer
or a floating point number (to represent fractions of seconds).
The Epoch is system-defined; on Unix, it is gen... |
"""
PyLHC
~~~~~~~~~~~~~~~~
PyLHC is a script collection for the optics measurements and corrections group (OMC) at CERN.
:copyright: pyLHC/OMC-Team working group.
:license: MIT, see the LICENSE.md file for details.
"""
__title__ = "pylhc"
__description__ = "An accelerator physics script collection for the OMC team at... | """
PyLHC
~~~~~~~~~~~~~~~~
PyLHC is a script collection for the optics measurements and corrections group (OMC) at CERN.
:copyright: pyLHC/OMC-Team working group.
:license: MIT, see the LICENSE.md file for details.
"""
__title__ = 'pylhc'
__description__ = 'An accelerator physics script collection for the OMC team at... |
class Solution(object):
def maximumGap(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
length = len(nums)
if length < 2:
return 0
bound_x = min(nums)
bound_y = max(nums)
bucket_range = max(1, int((bound_y - bound_x - 1) / (le... | class Solution(object):
def maximum_gap(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
length = len(nums)
if length < 2:
return 0
bound_x = min(nums)
bound_y = max(nums)
bucket_range = max(1, int((bound_y - bound_x - 1) / (... |
duo_prim = {
"NRES": {"NRES", "GRU-CC", "POA", "HMB", "DS-XX"},
"GRU-CC": {"GRU-CC", "POA", "HMB", "DS-XX"},
"HMB": {"HMB", "DS-XX"},
"POA": {"POA"},
"DS-XX": {"DS-XX"},
}
duo_sec = {
"GSO",
"RUO",
"RS-XX",
"NMDS",
"GS-XX",
"NPU",
"PUB",
"COL-XX",
"IRB",
"TS-... | duo_prim = {'NRES': {'NRES', 'GRU-CC', 'POA', 'HMB', 'DS-XX'}, 'GRU-CC': {'GRU-CC', 'POA', 'HMB', 'DS-XX'}, 'HMB': {'HMB', 'DS-XX'}, 'POA': {'POA'}, 'DS-XX': {'DS-XX'}}
duo_sec = {'GSO', 'RUO', 'RS-XX', 'NMDS', 'GS-XX', 'NPU', 'PUB', 'COL-XX', 'IRB', 'TS-XX', 'COST', 'DSM'}
adam_main_mapped_to_duo = {'NRES': 'NRES', 'G... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 3 19:19:34 2019
@author: sercangul
"""
N = map(int,input().split())
A = list(map(int, input().strip().split(' ')))
mean = sum(A)/len(A)
i=0
X=0
while i<len(A):
X = X + ((A[i] - mean)**2)
i = i+1
STD = (X/len(A)) ** (0.5)
print(round((STD... | """
Created on Mon Jun 3 19:19:34 2019
@author: sercangul
"""
n = map(int, input().split())
a = list(map(int, input().strip().split(' ')))
mean = sum(A) / len(A)
i = 0
x = 0
while i < len(A):
x = X + (A[i] - mean) ** 2
i = i + 1
std = (X / len(A)) ** 0.5
print(round(STD, 1)) |
class Enemy:
def __init__(self, name, health, damage):
self.name = name
self.health = health
self.damage = damage
def isActive(self):
return self.health > 0
class KillerJackal(Enemy):
def __init__(self):
super().__init__(name="Killer-Jackal", health=30, damage=50)
... | class Enemy:
def __init__(self, name, health, damage):
self.name = name
self.health = health
self.damage = damage
def is_active(self):
return self.health > 0
class Killerjackal(Enemy):
def __init__(self):
super().__init__(name='Killer-Jackal', health=30, damage=50... |
superbowl_wins = [
['1', 'Pittsburgh', '6'],
['2', 'Dallas', '5'],
['3', 'Paris', '16'],
['4', 'Wembo CLub', '25'],
]
for row in superbowl_wins:
print (row[1] + " had " + row[2] + " wins")
print("========================")
for row in superbowl_wins:
for el in row:
print (el)
print('')
| superbowl_wins = [['1', 'Pittsburgh', '6'], ['2', 'Dallas', '5'], ['3', 'Paris', '16'], ['4', 'Wembo CLub', '25']]
for row in superbowl_wins:
print(row[1] + ' had ' + row[2] + ' wins')
print('========================')
for row in superbowl_wins:
for el in row:
print(el)
print('') |
"""557. Reverse Words in a String III
https://leetcode.com/problems/reverse-words-in-a-string-iii/
Given a string, you need to reverse the order of characters in each word
within a sentence while still preserving whitespace and initial word order.
Example 1:
Input: "Let's take LeetCode contest"
Output: "s'teL ekat e... | """557. Reverse Words in a String III
https://leetcode.com/problems/reverse-words-in-a-string-iii/
Given a string, you need to reverse the order of characters in each word
within a sentence while still preserving whitespace and initial word order.
Example 1:
Input: "Let's take LeetCode contest"
Output: "s'teL ekat e... |
class Solution:
def twoSum(self, numbers: List[int], target: int) -> List[int]:
left, right = 0, len(numbers) - 1
while left <= right:
sum = numbers[left] + numbers[right]
if sum == target:
return [left + 1, right + 1]
elif sum < target:
... | class Solution:
def two_sum(self, numbers: List[int], target: int) -> List[int]:
(left, right) = (0, len(numbers) - 1)
while left <= right:
sum = numbers[left] + numbers[right]
if sum == target:
return [left + 1, right + 1]
elif sum < target:
... |
# int()
# float()
# str()
# bool()
number_input = input("number: ")
print(type(number_input))
number_input = int(number_input)
print(type(number_input))
# Falsy Values
print(bool(0))
print(bool(0.0))
print(bool(''))
print(bool(()))
print(bool([]))
print(bool({}))
print(bool(set()))
print(bool(complex()))
print(bool(... | number_input = input('number: ')
print(type(number_input))
number_input = int(number_input)
print(type(number_input))
print(bool(0))
print(bool(0.0))
print(bool(''))
print(bool(()))
print(bool([]))
print(bool({}))
print(bool(set()))
print(bool(complex()))
print(bool(range()))
print(bool(False))
print(bool(None))
print(... |
def surrender():
i01.setHandSpeed("left", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed("right", 0.75, 0.85, 0.95, 0.85)
i01.setArmSpeed("left", 0.75, 0.85, 0.95, 0.85)
i01.setHeadSpeed(0.65, 0.65)
i01.moveHead(90,90)
i01.moveArm("left",90,139,15,79)... | def surrender():
i01.setHandSpeed('left', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
i01.setHandSpeed('right', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed('right', 0.75, 0.85, 0.95, 0.85)
i01.setArmSpeed('left', 0.75, 0.85, 0.95, 0.85)
i01.setHeadSpeed(0.65, 0.65)
i01.moveHead(90, 90)
i01.moveArm('left... |
'''
Created on June 5, 2012
@author: Jason Huang
'''
'''
Question 1 / 1.
There are N objects kept in a row. The ith object is at position x_i. You want to partition them into K groups. You want to move all objects belonging to the same group to the same position. Objects in two different groups may be placed ... | """
Created on June 5, 2012
@author: Jason Huang
"""
'\nQuestion 1 / 1.\nThere are N objects kept in a row. The ith object is at position x_i. You want to partition them into K groups. You want to move all objects belonging to the same group to the same position. Objects in two different groups may be placed at the sa... |
class URLS():
BASE_URL = "http://automationpractice.com/index.php"
CONTACT_PAGE_URL = 'http://automationpractice.com/index.php?controller=contact'
LOGIN_PAGE_URL = 'http://automationpractice.com/index.php?controller=authentication&back=my-account'
REGISTRATION_PAGE_URL = 'http://automationpractice.com/i... | class Urls:
base_url = 'http://automationpractice.com/index.php'
contact_page_url = 'http://automationpractice.com/index.php?controller=contact'
login_page_url = 'http://automationpractice.com/index.php?controller=authentication&back=my-account'
registration_page_url = 'http://automationpractice.com/ind... |
#
# PySNMP MIB module APPIAN-STRATUM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/APPIAN-STRATUM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:23:58 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (ac_chassis_current_time, ac_chassis_ring_id) = mibBuilder.importSymbols('APPIAN-CHASSIS-MIB', 'acChassisCurrentTime', 'acChassisRingId')
(ac_osap, ac_op_status, ac_node_id) = mibBuilder.importSymbols('APPIAN-SMI-MIB', 'acOsap', 'AcOpStatus', 'AcNodeId')
(object_identifier, octet_string, integer) = mibBuilder.importSym... |
class Solution:
def majorityElement(self, nums):
c1, c2, cnt1, cnt2 = 0, 1, 0, 0
for num in nums:
if num == c1:
cnt1 += 1
elif num == c2:
cnt2 += 1
elif not cnt1:
c1, cnt1 = num, 1
elif not cnt2:
... | class Solution:
def majority_element(self, nums):
(c1, c2, cnt1, cnt2) = (0, 1, 0, 0)
for num in nums:
if num == c1:
cnt1 += 1
elif num == c2:
cnt2 += 1
elif not cnt1:
(c1, cnt1) = (num, 1)
elif not cnt2... |
#!/usr/bin/env python3
""" Field identifying and parsing.
The contents of this module allow the specifcation of formats of arrays
of bytes (similar to the python's struct module), but with more
granularity.
Each field basically has two properties: a name and a size (in bytes).
Each field has ba... | """ Field identifying and parsing.
The contents of this module allow the specifcation of formats of arrays
of bytes (similar to the python's struct module), but with more
granularity.
Each field basically has two properties: a name and a size (in bytes).
Each field has basically two methods: pac... |
class Node:
# Each node is a tree
def __init__(self, value):
self.data = value
self.right = None
self.left = None
def insert(self, value):
if self.data:
if value < self.data:
if self.left is None:
self.left = Node(value)
... | class Node:
def __init__(self, value):
self.data = value
self.right = None
self.left = None
def insert(self, value):
if self.data:
if value < self.data:
if self.left is None:
self.left = node(value)
else:
... |
'''
Statement
Chess knight can move to a square that is two squares away horizontally and one square vertically, or two squares vertically and one square horizontally. The complete move therefore looks like the letter L. Given two different squares of the chessboard, determine whether a knight can go from the first squ... | """
Statement
Chess knight can move to a square that is two squares away horizontally and one square vertically, or two squares vertically and one square horizontally. The complete move therefore looks like the letter L. Given two different squares of the chessboard, determine whether a knight can go from the first squ... |
def strAppend(suffix):
return lambda x : x + suffix
| def str_append(suffix):
return lambda x: x + suffix |
numerals = {
"I": 1,
"IV": 4,
"V": 5,
"IX": 9,
"X": 10,
"XL": 40,
"L": 50,
"XC": 90,
"C": 100,
"CD": 400,
"D": 500,
"CM": 900,
"M": 1000
}
def checkio(inp, output=""):
next = max([e for e in numerals if numerals[e]<=inp], key=lambda x: numerals[x])
output = o... | numerals = {'I': 1, 'IV': 4, 'V': 5, 'IX': 9, 'X': 10, 'XL': 40, 'L': 50, 'XC': 90, 'C': 100, 'CD': 400, 'D': 500, 'CM': 900, 'M': 1000}
def checkio(inp, output=''):
next = max([e for e in numerals if numerals[e] <= inp], key=lambda x: numerals[x])
output = output + next
inp = inp - numerals[next]
if i... |
root_folder = '/var/www/'
charset = '<meta charset="utf-8">'
def application(env, start_response):
scripts = open(root_folder+'scripts.js', 'r').read()
forms = open(root_folder+'forms.html', 'r').read()
if env['REQUEST_METHOD'] == 'POST':
if env.get('CONTENT_LENGTH'): env_len = int(env.get('CONTENT_... | root_folder = '/var/www/'
charset = '<meta charset="utf-8">'
def application(env, start_response):
scripts = open(root_folder + 'scripts.js', 'r').read()
forms = open(root_folder + 'forms.html', 'r').read()
if env['REQUEST_METHOD'] == 'POST':
if env.get('CONTENT_LENGTH'):
env_len = int(... |
class Solution:
def crackSafe(self, n: int, k: int) -> str:
# worst case k ** n
def dfs(cur, seen, total):
if len(seen) == total:
return cur
for i in range(k):
temp = cur[-n + 1: ] + str(i) if n != 1 else str(i)
if temp not in s... | class Solution:
def crack_safe(self, n: int, k: int) -> str:
def dfs(cur, seen, total):
if len(seen) == total:
return cur
for i in range(k):
temp = cur[-n + 1:] + str(i) if n != 1 else str(i)
if temp not in seen:
s... |
LANGUAGES = ['Auto', 'Afrikaans', 'Albanian', 'Amharic', 'Arabic', 'Armenian', 'Azerbaijani', 'Basque', 'Belarusian', 'Bengali',
'Bosnian', 'Bulgarian', 'Catalan', 'Cebuano', 'Chichewa', 'Chinese (Simplified)', 'Chinese (Traditional)', 'Corsican',
'Croatian', 'Czech', 'Danish', 'Dutch', 'English', 'Esperanto'... | languages = ['Auto', 'Afrikaans', 'Albanian', 'Amharic', 'Arabic', 'Armenian', 'Azerbaijani', 'Basque', 'Belarusian', 'Bengali', 'Bosnian', 'Bulgarian', 'Catalan', 'Cebuano', 'Chichewa', 'Chinese (Simplified)', 'Chinese (Traditional)', 'Corsican', 'Croatian', 'Czech', 'Danish', 'Dutch', 'English', 'Esperanto', 'Estonia... |
class Validator(object):
"""
Create the Validator instance to register config. You can either pass a flask application in directly
here to register this extension with the flask app, or call init_app after creating
this object (in a factory pattern).
:param app: A flask application
"""
def _... | class Validator(object):
"""
Create the Validator instance to register config. You can either pass a flask application in directly
here to register this extension with the flask app, or call init_app after creating
this object (in a factory pattern).
:param app: A flask application
"""
def ... |
# -*- coding: utf-8 -*-
"""
@author: Hareem Akram
"""
# [Reddit credentials]
c_id = 'client id from https://www.reddit.com/prefs/apps'
secret = 'client secret from https://www.reddit.com/prefs/apps'
agent = 'osint project'
usr = 'reddit username'
pwd = 'reddit password'
# [Twitter credentials]
# apply for developer ... | """
@author: Hareem Akram
"""
c_id = 'client id from https://www.reddit.com/prefs/apps'
secret = 'client secret from https://www.reddit.com/prefs/apps'
agent = 'osint project'
usr = 'reddit username'
pwd = 'reddit password'
bearer_token = 'bearer token'
consumer_key = 'consumer key'
consumer_secret = 'consumer secret'... |
n = int(input())
if n%2!=0:
print('Weird')
elif 2<n<=5 and n%2==0:
print('Not Weird')
elif 6<n<=20 and n%2==0:
print('Weird')
elif n>20 and n%2==0:
print('Not Weird') | n = int(input())
if n % 2 != 0:
print('Weird')
elif 2 < n <= 5 and n % 2 == 0:
print('Not Weird')
elif 6 < n <= 20 and n % 2 == 0:
print('Weird')
elif n > 20 and n % 2 == 0:
print('Not Weird') |
expected_output = {
"interface": {
"FastEthernet2/1/1.2": {
"ethernet_vlan": {2: {"status": "up"}},
"status": "up",
"destination_address": {
"10.2.2.2": {
"default_path": "active",
"imposed_label_stack": "{16}",
... | expected_output = {'interface': {'FastEthernet2/1/1.2': {'ethernet_vlan': {2: {'status': 'up'}}, 'status': 'up', 'destination_address': {'10.2.2.2': {'default_path': 'active', 'imposed_label_stack': '{16}', 'next_hop': 'point2point', 'output_interface': 'Serial2/0/2', 'tunnel_label': 'imp-null', 'vc_id': {'1002': {'vc_... |
class merfishParams:
"""
An object that contains input variables.
"""
def __init__(self, **arguments):
for (arg, val) in arguments.items():
setattr(self, arg, val)
def to_string(self):
return ("\n".join(["%s = %s" % (str(key), str(val)) \
for (key, va... | class Merfishparams:
"""
An object that contains input variables.
"""
def __init__(self, **arguments):
for (arg, val) in arguments.items():
setattr(self, arg, val)
def to_string(self):
return '\n'.join(['%s = %s' % (str(key), str(val)) for (key, val) in self.__dict__.it... |
class InvalidResponseException(Exception):
def __init__(self, message):
self.message = f'Request was not success: {message}'
super()
| class Invalidresponseexception(Exception):
def __init__(self, message):
self.message = f'Request was not success: {message}'
super() |
# Contents:
# Ahoy! (or Should I Say Ahoyay!)
# Input!
# Check Yourself!
# Check Yourself... Some More
# Ay B C
# Word Up
# Move it on Back
# Ending Up
# Testing, Testing, is This Thing On?
print("### Ahoy! (or Should I Say Ahoyay!) ###")
print("Pig Latin")
print("### Input! ###")
original = input("Enter a word: ")
... | print('### Ahoy! (or Should I Say Ahoyay!) ###')
print('Pig Latin')
print('### Input! ###')
original = input('Enter a word: ')
print('### Check Yourself! ###')
print('### Check Yourself... Some More ###')
print('### Ay B C ###')
pyg = 'ay'
print('### Word Up ###')
print('### Move it on Back ###')
print('### Ending Up #... |
class ContactList():
def __init__(self, names):
"""
names is a list of strings.
"""
self.names = names
def __hash__(self):
"""Conceptually we want to hash the set of names. Since set
type is mutable it cannot be hashed so we use a frozenset
"""
return hash(frozenset(self.names... | class Contactlist:
def __init__(self, names):
"""
names is a list of strings.
"""
self.names = names
def __hash__(self):
"""Conceptually we want to hash the set of names. Since set
type is mutable it cannot be hashed so we use a frozenset
"""
return hash(froz... |
# Write a programme to find sum of cubes of first n natural numbers.
n = int(input('Input : '))
sumofcubes = sum([x*x*x for x in [*range(1, n+1)]])
print('Output: ', sumofcubes)
| n = int(input('Input : '))
sumofcubes = sum([x * x * x for x in [*range(1, n + 1)]])
print('Output: ', sumofcubes) |
Bin_Base=['0','1']
Oct_Base=['0', '1', '2', '3', '4', '5', '6', '7']
Hex_Base=['0', '1', '2', '3', '4', '5', '6', '7','8','9','A','B','C','D','E','F']
def BinTesting(n):
n=str(n)
for digit in n:
if digit in Bin_Base:
continue
else:
return False
return True
def OctTest... | bin__base = ['0', '1']
oct__base = ['0', '1', '2', '3', '4', '5', '6', '7']
hex__base = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
def bin_testing(n):
n = str(n)
for digit in n:
if digit in Bin_Base:
continue
else:
return False
r... |
class Payment:
"""
Payment class
"""
def __init__(self,date, perceptions:dict=None, deductions:dict=None):
self._date = date
self.perceptions = perceptions
self.deductions = deductions
def __str__(self):
ret = f"""
Date: {self.date}
Total Perceptio... | class Payment:
"""
Payment class
"""
def __init__(self, date, perceptions: dict=None, deductions: dict=None):
self._date = date
self.perceptions = perceptions
self.deductions = deductions
def __str__(self):
ret = f'\n Date: {self.date}\n Total Percep... |
def minmax_decision(state):
def max_value(state):
if is_terminal(state):
return utility_of(state)
v = -infinity
for (a, s) in successors_of(state):
v = max(v, min_value(s))
print('V: ' + str(v))
return v
def min_value(state):
if is_termina... | def minmax_decision(state):
def max_value(state):
if is_terminal(state):
return utility_of(state)
v = -infinity
for (a, s) in successors_of(state):
v = max(v, min_value(s))
print('V: ' + str(v))
return v
def min_value(state):
if is_termin... |
### tutorzzz
tutorzzzURL = 'https://tutorzzz.com/tutorzzz/orders/assignList'
tutorzzzCookie = 'SESSION_TUTOR=581fb89c-88c6-4942-a735-d082bf1a29db'
tutorzzzReqBody = {"pageNumber":1,"pageSize":20,"sortField":"id","order":"desc"}
openIDList = ['ouZ_Ys2FvyLlOk9o-B8oZOnme5n4', 'ouZ_Ys2uzq8fijTerZziXI69jVVY']
appID = 'wxe... | tutorzzz_url = 'https://tutorzzz.com/tutorzzz/orders/assignList'
tutorzzz_cookie = 'SESSION_TUTOR=581fb89c-88c6-4942-a735-d082bf1a29db'
tutorzzz_req_body = {'pageNumber': 1, 'pageSize': 20, 'sortField': 'id', 'order': 'desc'}
open_id_list = ['ouZ_Ys2FvyLlOk9o-B8oZOnme5n4', 'ouZ_Ys2uzq8fijTerZziXI69jVVY']
app_id = 'wxe7... |
"""
Exceptions for psz.
You can stringify these exceptions to get a message about the error type and
whatver extra string arguments that were passed in when the object was created.
"""
class PszError(Exception):
_msg = ''
def __str__(self):
s = []
if self._msg:
s.append(self._msg)... | """
Exceptions for psz.
You can stringify these exceptions to get a message about the error type and
whatver extra string arguments that were passed in when the object was created.
"""
class Pszerror(Exception):
_msg = ''
def __str__(self):
s = []
if self._msg:
s.append(self._msg)... |
# -*- python -*-
load("@drake//tools/workspace:execute.bzl", "path", "which")
def _impl(repository_ctx):
command = repository_ctx.attr.command
additional_paths = repository_ctx.attr.additional_search_paths
found_command = which(repository_ctx, command, additional_paths)
if found_command:
repos... | load('@drake//tools/workspace:execute.bzl', 'path', 'which')
def _impl(repository_ctx):
command = repository_ctx.attr.command
additional_paths = repository_ctx.attr.additional_search_paths
found_command = which(repository_ctx, command, additional_paths)
if found_command:
repository_ctx.symlink(... |
def loadfile(name):
numbers = []
f = open(name, "r")
for x in f:
for number in x.split(","):
number = int(number)
numbers.append(number)
return numbers
def caculateTravelLinear(numbers, endpoint):
travel = 0
for number in numbers:
distance = endpoint - nu... | def loadfile(name):
numbers = []
f = open(name, 'r')
for x in f:
for number in x.split(','):
number = int(number)
numbers.append(number)
return numbers
def caculate_travel_linear(numbers, endpoint):
travel = 0
for number in numbers:
distance = endpoint - ... |
#!/usr/bin/env python3
def import_input(path):
with open(path, encoding='utf-8') as infile:
return [int(n) for n in infile.read().split()]
banks = import_input("input.txt")
class Redistributor:
def __init__(self, banks):
self._banks = banks
def redistribute(self, i):
blocks = s... | def import_input(path):
with open(path, encoding='utf-8') as infile:
return [int(n) for n in infile.read().split()]
banks = import_input('input.txt')
class Redistributor:
def __init__(self, banks):
self._banks = banks
def redistribute(self, i):
blocks = self._banks[i]
self... |
"""
Tracebacks: <<< __traceback__ >>>
-> Attribute on an exception object that holds a reference to the traceback object
-> traceback: Standard library module containing functions for working with traceback objects.
"""
"""
More Traceback Functions
-> There are many more functions in the traceback module
-> format_tb... | """
Tracebacks: <<< __traceback__ >>>
-> Attribute on an exception object that holds a reference to the traceback object
-> traceback: Standard library module containing functions for working with traceback objects.
"""
'\nMore Traceback Functions\n-> There are many more functions in the traceback module\n-> format_tb... |
class ClientData:
"""
Class contains user info
"""
data = {}
| class Clientdata:
"""
Class contains user info
"""
data = {} |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def middleNode(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
counter = 1
curnode = head
while c... | class Solution:
def middle_node(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
counter = 1
curnode = head
while curnode.next is not None:
counter = counter + 1
curnode = curnode.next
counter = counter // 2
r... |
# https://leetcode.com/problems/search-a-2d-matrix
'''
Runtime Complexity: O(logNM)
Space Complexity: O(1)
'''
def search_matrix(matrix, target):
rows, columns = len(matrix), len(matrix[0])
start, end = 0, rows * columns - 1
while start <= end:
middle = (start + end) // 2
number = matrix[... | """
Runtime Complexity: O(logNM)
Space Complexity: O(1)
"""
def search_matrix(matrix, target):
(rows, columns) = (len(matrix), len(matrix[0]))
(start, end) = (0, rows * columns - 1)
while start <= end:
middle = (start + end) // 2
number = matrix[middle // columns][middle % columns]
... |
class PaginatorFactory(object):
def __init__(self, http_client):
self.http_client = http_client
def make(self, uri, data=None, union_key=None):
return Paginator(self.http_client, uri, data, union_key)
class Paginator(object):
def __init__(self, http_client, uri, data=None, union_key=None)... | class Paginatorfactory(object):
def __init__(self, http_client):
self.http_client = http_client
def make(self, uri, data=None, union_key=None):
return paginator(self.http_client, uri, data, union_key)
class Paginator(object):
def __init__(self, http_client, uri, data=None, union_key=None... |
def suppress_value(valuein: int, rc: str = "*", upper: int = 100000000) -> str:
"""
Suppress values less than or equal to 7, round all non-national values.
This function suppresses value if it is less than or equal to 7.
If value is 0 then it will remain as 0.
If value is at national level it will ... | def suppress_value(valuein: int, rc: str='*', upper: int=100000000) -> str:
"""
Suppress values less than or equal to 7, round all non-national values.
This function suppresses value if it is less than or equal to 7.
If value is 0 then it will remain as 0.
If value is at national level it will rema... |
# Time: 93 ms
# Memory: 12 KB
n = int(input())
apy = list(map(int, input().split()))
apx = list(map(int, input().split()))
apset = set(apy[1:] + apx[1:])
# n*(n+1)//2 is 1 + 2 + 3... n
# https://en.wikipedia.org/wiki/1_%2B_2_%2B_3_%2B_4_%2B_%E2%8B%AF
if sum(apset) == n*(n+1)//2:
print('I become the guy.')
else:
print... | n = int(input())
apy = list(map(int, input().split()))
apx = list(map(int, input().split()))
apset = set(apy[1:] + apx[1:])
if sum(apset) == n * (n + 1) // 2:
print('I become the guy.')
else:
print('Oh, my keyboard!') |
class Solution(object):
def isBadVersion(self, num):
return True
def firstBadVersion(self, n):
left, right = 1, n
while left <= right:
mid = left + (right - left)/2
if self.isBadVersion(mid):
right = mid - 1
else:
left ... | class Solution(object):
def is_bad_version(self, num):
return True
def first_bad_version(self, n):
(left, right) = (1, n)
while left <= right:
mid = left + (right - left) / 2
if self.isBadVersion(mid):
right = mid - 1
else:
... |
#mengubah atau konversi tipe data
data = 20
print(data)
#konversi ke float
dataFloat = float(data)
print(dataFloat)
print(type(dataFloat))
#konversi sting
dataStr = str(data)
print(dataStr)
print(type(dataStr))
| data = 20
print(data)
data_float = float(data)
print(dataFloat)
print(type(dataFloat))
data_str = str(data)
print(dataStr)
print(type(dataStr)) |
"""Object Oriented Programming Examples - Sprint 1, Module 2"""
# import pandas as pd
#
# class MyDataFrame(pd.DataFrame):
# def num_cells(self):
# return self.shape[0] * self.shape[1] # num cells of df
class BareMinimumClass:
pass
class Complex:
def __init__(self, real, imaginary):
"""
... | """Object Oriented Programming Examples - Sprint 1, Module 2"""
class Bareminimumclass:
pass
class Complex:
def __init__(self, real, imaginary):
"""
Constructor for Complex Numbers.
Complex numbers have a real part, and imaginary part
"""
self.r = real
self.i =... |
#Solution 1
def search_and_insert(nums, target):
for i in range(0, len(nums)):
if target == nums[i]:
return i
elif target <nums[i]:
return i
return i+1
#Solution 2
def search_and_insert2(nums, target):
start_index = 0
half_index = len(nums)//2
end_index = len(nums)
while True:
... | def search_and_insert(nums, target):
for i in range(0, len(nums)):
if target == nums[i]:
return i
elif target < nums[i]:
return i
return i + 1
def search_and_insert2(nums, target):
start_index = 0
half_index = len(nums) // 2
end_index = len(nums)
while Tr... |
# MIT License
# (C) Copyright 2021 Hewlett Packard Enterprise Development LP.
#
# regions : Set or get regions and region appliance associations
def get_all_regions(self) -> dict:
"""Get all regions
.. list-table::
:header-rows: 1
* - Swagger Section
- Method
- Endpoint
... | def get_all_regions(self) -> dict:
"""Get all regions
.. list-table::
:header-rows: 1
* - Swagger Section
- Method
- Endpoint
* - regions
- GET
- /regions
:return: Returns dictionary of configured regions
:rtype: dict
"""
return ... |
t = int(input())
answer = []
for a in range(t):
n = int(input())
if(n%4 == 0):
answer.append("YES")
else:
answer.append("NO")
for b in answer:
print(b)
| t = int(input())
answer = []
for a in range(t):
n = int(input())
if n % 4 == 0:
answer.append('YES')
else:
answer.append('NO')
for b in answer:
print(b) |
"""
Copyright (C) 2014 Maruf Maniruzzaman
Website: http://cosmosframework.com
Author: Maruf Maniruzzaman
License :: OSI Approved :: MIT License
"""
PASSWORD_HMAC_SIGNATURE = "hmac:"
PASSWORD_COLUMN_NAME = "password"
USERNAME_COLUMN_NAME = "username"
USER_COOKIE_NAME = "usersecret"
USER_PLAINTEXT_COOKIE_NAME = "use... | """
Copyright (C) 2014 Maruf Maniruzzaman
Website: http://cosmosframework.com
Author: Maruf Maniruzzaman
License :: OSI Approved :: MIT License
"""
password_hmac_signature = 'hmac:'
password_column_name = 'password'
username_column_name = 'username'
user_cookie_name = 'usersecret'
user_plaintext_cookie_name = 'user... |
class Params:
"""
Validating input parameters and building jsons for chart init
-----
Attributes:
obj: a Chart object whose attributes will be checked and built by BuilderParams.
"""
def __init__(self,
obj):
"""
"""
self.obj = obj
def valid(... | class Params:
"""
Validating input parameters and building jsons for chart init
-----
Attributes:
obj: a Chart object whose attributes will be checked and built by BuilderParams.
"""
def __init__(self, obj):
"""
"""
self.obj = obj
def valid(self):
"""
... |
# when creating a function it can return nothing or it can return a value like so
# the return value can be any data type you wish including custom class you've made (see Object-oriented-programming file 1)
#main return nothing
def main():
result = sum(1, 5)
print(result)
# sum returns a inter or float depeni... | def main():
result = sum(1, 5)
print(result)
def sum(*argv):
total = 0
for arg in argv:
total += arg
return total
if __name__ == '__main__':
main() |
"""
Find the total area covered by two rectilinear rectangles in a 2D plane.
Each rectangle is defined by its bottom left corner and top right corner as
shown in the figure.
![Example layout]
(https://leetcode.com/static/images/problemset/rectangle_area.png)
Assume that the total area is never beyond the maximum pos... | """
Find the total area covered by two rectilinear rectangles in a 2D plane.
Each rectangle is defined by its bottom left corner and top right corner as
shown in the figure.
![Example layout]
(https://leetcode.com/static/images/problemset/rectangle_area.png)
Assume that the total area is never beyond the maximum pos... |
"""
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of
every node never differ by more than 1.
"""
__author__ = 'Danyang'
# Definition for a binary tree node
class TreeNode:
def __i... | """
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of
every node never differ by more than 1.
"""
__author__ = 'Danyang'
class Treenode:
def __init__(self, x):
self.val = x
... |
class Airport:
def __init__(self, code, lat, lng, airportName):
self.code = code
self.lat = lat
self.lng = lng
self.name = airportName
self.flightCategory = None
self.isCalculated = False
| class Airport:
def __init__(self, code, lat, lng, airportName):
self.code = code
self.lat = lat
self.lng = lng
self.name = airportName
self.flightCategory = None
self.isCalculated = False |
def gcd(a,b = None):
if b != None:
if a % b == 0:
return b
else:
return gcd( b, a % b)
else:
for i in range(len(a)):
a[0] = gcd(a[0],a[i])
return a[0]
print(gcd([18,12, 6]))
print(gcd(9, 12)) | def gcd(a, b=None):
if b != None:
if a % b == 0:
return b
else:
return gcd(b, a % b)
else:
for i in range(len(a)):
a[0] = gcd(a[0], a[i])
return a[0]
print(gcd([18, 12, 6]))
print(gcd(9, 12)) |
#!/usr/bin/env python3
# Copyright 20
# Python provides the open() function for opening file
# open() opens the file in read-only default mode.
def main():
# open the file - open() returns a file object. It takes the file name and opens that file and returns
# a file object. The file object itself is a iterato... | def main():
f = open('lines.txt', 'w')
for line in f:
print(line.rstrip())
if __name__ == '__main__':
main() |
#{
#Driver Code Starts
#Initial Template for Python 3
# } Driver Code Ends
#User function Template for python3
# Function to count even and odd
# c_e : variable to store even count
# c_o : variable to store odd count
def count_even_odd(n, arr):
c_e = 0
c_o = 0
pair = list()
# your cod... | def count_even_odd(n, arr):
c_e = 0
c_o = 0
pair = list()
for i in range(0, n):
if arr[i] % 2 == 0:
c_e += 1
else:
c_o += 1
pair.append(c_e)
pair.append(c_o)
return pair
def main():
testcases = int(input())
while testcases > 0:
size_ar... |
print('''
Exponent code
Exponent code
''')
print('''
def answer2(number, power):
result=1
for index in range(power):
result=result * number
return result
print(answer2(3,2))
''')
print('''
''')
def answer2(number, power):
result=1
for index in range(power):
result=... | print('\nExponent code\nExponent code\n')
print('\ndef answer2(number, power):\n result=1\n for index in range(power):\n result=result * number\n return result\nprint(answer2(3,2))\n')
print('\n\n')
def answer2(number, power):
result = 1
for index in range(power):
result = result * numb... |
"""
Part and parcel of daily life?
lol why the fuck only got 2 spaces per indent
"""
def projector():
"""9 per cohort class"""
switch_on = "Nope. Please call tech support"
raise Exception(switch_on)
def fire_alarm():
'''random'''
for _ in range(10):
print("Ladies and gentlemen, it was a false alarm. I ... | """
Part and parcel of daily life?
lol why the fuck only got 2 spaces per indent
"""
def projector():
"""9 per cohort class"""
switch_on = 'Nope. Please call tech support'
raise exception(switch_on)
def fire_alarm():
"""random"""
for _ in range(10):
print('Ladies and gentlemen, it was a fa... |
def intersect(nums1, nums2):
"""
Given two arrays, write a function to compute their intersection.
:param nums1: list
:param nums2: list
:return: list
"""
nums1, nums2 = sorted(nums1), sorted(nums2)
pt1 = pt2 = 0
res = []
while True:
try:
if nums1[pt1] > num... | def intersect(nums1, nums2):
"""
Given two arrays, write a function to compute their intersection.
:param nums1: list
:param nums2: list
:return: list
"""
(nums1, nums2) = (sorted(nums1), sorted(nums2))
pt1 = pt2 = 0
res = []
while True:
try:
if nums1[pt1] > n... |
# test output stream only
print('begin')
for i in range(1, 5): # CHANGED FROM 20 TO 1,5
print('Spam!' * i)
print('end') | print('begin')
for i in range(1, 5):
print('Spam!' * i)
print('end') |
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def glm_repository():
maybe(
http_archive,
name = "glm",
urls = [
"https://github.com/g-truc/glm/archive/6ad79aae3eb5bf809c30bf1168171e9e55857e45.z... | load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe')
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def glm_repository():
maybe(http_archive, name='glm', urls=['https://github.com/g-truc/glm/archive/6ad79aae3eb5bf809c30bf1168171e9e55857e45.zip'], sha256='9a147a2b58df9fc30ec494468f6b... |
## -*- encoding: utf-8 -*-
"""
This file (./sol/nonlinear_doctest.sage) was *autogenerated* from ./sol/nonlinear.tex,
with sagetex.sty version 2011/05/27 v2.3.1.
It contains the contents of all the sageexample environments from this file.
You should be able to doctest this file with:
sage -t ./sol/nonlinear_doctest.sag... | """
This file (./sol/nonlinear_doctest.sage) was *autogenerated* from ./sol/nonlinear.tex,
with sagetex.sty version 2011/05/27 v2.3.1.
It contains the contents of all the sageexample environments from this file.
You should be able to doctest this file with:
sage -t ./sol/nonlinear_doctest.sage
It is always safe to dele... |
min_computer_fish_size = 0.25
max_computer_fish_size = 3.7
min_computer_fish_speed = 100
max_computer_fish_speed = 500
player_fish_speed = 400
player_start_size = min_computer_fish_size*1.2
player_win_size = max_computer_fish_size*1.2
player_start_size_acceleration_time_constant = 0.13
player_final_size_acceleration_... | min_computer_fish_size = 0.25
max_computer_fish_size = 3.7
min_computer_fish_speed = 100
max_computer_fish_speed = 500
player_fish_speed = 400
player_start_size = min_computer_fish_size * 1.2
player_win_size = max_computer_fish_size * 1.2
player_start_size_acceleration_time_constant = 0.13
player_final_size_acceleratio... |
#
# PySNMP MIB module CISCO-COMMON-ROLES-EXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-COMMON-ROLES-EXT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:36:18 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) ... |
# coding=utf-8
# python3
# https://leetcode.com/problems/combination-sum/
class Solution(object):
def combinationSum(self, candidates, target):
"""
:type candidates: List[int]
:type target: int
:rtype: List[List[int]]
"""
res = []
candidates.sort()
se... | class Solution(object):
def combination_sum(self, candidates, target):
"""
:type candidates: List[int]
:type target: int
:rtype: List[List[int]]
"""
res = []
candidates.sort()
self.dfs(candidates, target, 0, res, [])
return res
def dfs(se... |
class ServerCommands(dict):
def __init__(self):
super().__init__()
self.update({
'!connect': 'on_client_connect',
'!disconnect': 'on_client_disconnect'
})
def register_command(self, command, callback_name):
self[command] = callback_name
def remove_co... | class Servercommands(dict):
def __init__(self):
super().__init__()
self.update({'!connect': 'on_client_connect', '!disconnect': 'on_client_disconnect'})
def register_command(self, command, callback_name):
self[command] = callback_name
def remove_command(self, command):
try... |
# Get input
N, M = map(int, input().split()) # N - the number of restaurants, M - the number of pho restaurants
pho = list(map(int, input().split())) # A list of the pho restaurants
phos = [False for x in range(N)]
leaves = [True for x in range(N)]
paths = [[] for x in range(N)]
nodes = [False for x in range(N)]
tota... | (n, m) = map(int, input().split())
pho = list(map(int, input().split()))
phos = [False for x in range(N)]
leaves = [True for x in range(N)]
paths = [[] for x in range(N)]
nodes = [False for x in range(N)]
total = 0
ind = [x for x in range(N)]
dists = [1 for x in range(N)]
maxdist = 0
def mark(curr, prev):
if phos[... |
#entrada
while True:
n = int(input())
if n == 0:
break
for i in range(0, n):
planeta, anoRecebida, tempo = str(input()).split()
anoRecebida = int(anoRecebida)
tempo = int(tempo)
#processamento
if i == 0:
primeira = anoRecebida - tempo
... | while True:
n = int(input())
if n == 0:
break
for i in range(0, n):
(planeta, ano_recebida, tempo) = str(input()).split()
ano_recebida = int(anoRecebida)
tempo = int(tempo)
if i == 0:
primeira = anoRecebida - tempo
first_planet = planeta
... |
#
# PySNMP MIB module CISCO-WAN-CES-PORT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-WAN-CES-PORT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:20:20 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint) ... |
class ScopeError(Exception):
pass
class ScopeFormatError(ScopeError):
pass
class PendingExperimentsError(ValueError):
pass
class MissingArchivePathError(FileNotFoundError):
pass
class AsymmetricCorrelationError(ValueError):
"""Two conflicting values are given for correlation of two parameters."""
class ... | class Scopeerror(Exception):
pass
class Scopeformaterror(ScopeError):
pass
class Pendingexperimentserror(ValueError):
pass
class Missingarchivepatherror(FileNotFoundError):
pass
class Asymmetriccorrelationerror(ValueError):
"""Two conflicting values are given for correlation of two parameters.""... |
class Frame:
def __init__(self, resume: int, store: int, locals_: list, arguments: list):
self.stack = []
self.locals = []
for i in range(len(locals_)):
self.locals.append(locals_[i])
if len(arguments) > i:
self.locals[i] == arguments[i]
self.a... | class Frame:
def __init__(self, resume: int, store: int, locals_: list, arguments: list):
self.stack = []
self.locals = []
for i in range(len(locals_)):
self.locals.append(locals_[i])
if len(arguments) > i:
self.locals[i] == arguments[i]
self.... |
#will ask the user for their age and then it will
#tell them how many months that age equals to
user_age = input("Enter your age : ")
years = int(user_age)
months = years * 12
print(f"Your age, {years}, equals to {months} months.")
| user_age = input('Enter your age : ')
years = int(user_age)
months = years * 12
print(f'Your age, {years}, equals to {months} months.') |
a = [_.split('\t') for _ in open('a.txt', 'r').read().split('\n')]
b = [_.split('\t') for _ in open('b.txt', 'r').read().split('\n')]
for _ in range(len(a)):
for a_, b_ in zip(a[_], b[_]):
print(a_, b_, end='\t', sep='\t')
print('') | a = [_.split('\t') for _ in open('a.txt', 'r').read().split('\n')]
b = [_.split('\t') for _ in open('b.txt', 'r').read().split('\n')]
for _ in range(len(a)):
for (a_, b_) in zip(a[_], b[_]):
print(a_, b_, end='\t', sep='\t')
print('') |
#function -->mehgiclude sebuah nilai didalam fungsi
def input_barang(nama,harga):
print("Nama Barang:", nama)
print("Harga Barang", harga)
a=input("masukan nama barang:")
b=input("masukan harga barang")
input_barang(a,b)
| def input_barang(nama, harga):
print('Nama Barang:', nama)
print('Harga Barang', harga)
a = input('masukan nama barang:')
b = input('masukan harga barang')
input_barang(a, b) |
#!/usr/bin/python3
class Bash_DB:
def __init(self, Parent):
self.Controller = Parent
def Create_DB(self, DB_Type):
if DB_Type.DB_Stack == "LAMP":
self.Controller.Bash_Script.subprocess.call("./Sensor_Database/LAMP_Server/LAMP_Setup.sh")
| class Bash_Db:
def __init(self, Parent):
self.Controller = Parent
def create_db(self, DB_Type):
if DB_Type.DB_Stack == 'LAMP':
self.Controller.Bash_Script.subprocess.call('./Sensor_Database/LAMP_Server/LAMP_Setup.sh') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.