content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# @license Apache-2.0
#
# Copyright (c) 2018 The Stdlib Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | {'includes': ['./include.gypi'], 'variables': {'addon_target_name%': 'addon', 'fortran_compiler%': 'gfortran', 'fflags': ['-std=f95', '-ffree-form', '-O3', '-Wall', '-Wextra', '-Wimplicit-interface', '-fno-underscoring', '-pedantic', '-c'], 'conditions': [['OS=="win"', {'obj': 'obj'}, {'obj': 'o'}]]}, 'targets': [{'tar... |
'''
In this module, we implement selection sort
Time complexity: O(n ^ 2)
'''
def selection_sort(arr):
'''
Sort array using selection sort
'''
for index_x in range(len(arr)):
min_index = index_x
for index_y in range(index_x + 1, len(arr)):
if arr[index_y] < arr[min_index... | """
In this module, we implement selection sort
Time complexity: O(n ^ 2)
"""
def selection_sort(arr):
"""
Sort array using selection sort
"""
for index_x in range(len(arr)):
min_index = index_x
for index_y in range(index_x + 1, len(arr)):
if arr[index_y] < arr[min_index]... |
#
# PySNMP MIB module A3COM-HUAWEI-LPBKDT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-HUAWEI-LPBKDT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 16:50:56 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (h3c_common,) = mibBuilder.importSymbols('A3COM-HUAWEI-OID-MIB', 'h3cCommon')
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_co... |
__title__ = 'https'
__author__ = 'Gloryness'
__license__ = 'MIT License'
| __title__ = 'https'
__author__ = 'Gloryness'
__license__ = 'MIT License' |
class BoundedQueue:
# Constructor, which creates a new empty queue:
def __init__(self, capacity):
assert isinstance(capacity, int), ('Error: Type error: %s' % (type(capacity)))
assert capacity >= 0, ('Error: Illegal capacity: %d' % (capacity))
self.__items = []
self.__capacity ... | class Boundedqueue:
def __init__(self, capacity):
assert isinstance(capacity, int), 'Error: Type error: %s' % type(capacity)
assert capacity >= 0, 'Error: Illegal capacity: %d' % capacity
self.__items = []
self.__capacity = capacity
def enqueue(self, item):
if len(self.... |
def answer(question):
words = question \
.rstrip("?") \
.replace("plus", "+") \
.replace("minus", "-") \
.replace("multiplied by", '*') \
.replace("divided by", "/") \
.replace("raised to the", "^") \
.split()
for i in range(len(words) - 2):
if wo... | def answer(question):
words = question.rstrip('?').replace('plus', '+').replace('minus', '-').replace('multiplied by', '*').replace('divided by', '/').replace('raised to the', '^').split()
for i in range(len(words) - 2):
if words[i] == '^' and words[i + 2] == 'power':
words[i + 2] = ''
... |
def sorted_nosize_search(listy, num):
# Adapted to work with a Python sorted
# array and handle the index error exception
exp_backoff = index = 0
limit = False
while not limit:
try:
temp = listy[index]
if temp > num:
limit = True
else:
... | def sorted_nosize_search(listy, num):
exp_backoff = index = 0
limit = False
while not limit:
try:
temp = listy[index]
if temp > num:
limit = True
else:
index = 2 ** exp_backoff
exp_backoff += 1
except IndexEr... |
class Solution:
def singleNumber(self, nums: List[int]) -> int:
counts = {}
for num in nums:
if num in counts:
counts[num] += 1
else:
counts[num] = 1
if counts[num] == 3:
counts.pop(num)
return list(counts.ke... | class Solution:
def single_number(self, nums: List[int]) -> int:
counts = {}
for num in nums:
if num in counts:
counts[num] += 1
else:
counts[num] = 1
if counts[num] == 3:
counts.pop(num)
return list(counts.... |
#
# PySNMP MIB module CXIoHardware-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXIoHardware-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:17:22 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | (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_intersection, constraints_union) ... |
# -*- coding: utf-8 -*-
# ISO 693-1 language codes from pycountry
Iso2Language = {
u'aa': u'Afar',
u'ab': u'Abkhazian',
u'af': u'Afrikaans',
u'ak': u'Akan',
u'sq': u'Albanian',
u'am': u'Amharic',
u'ar': u'Arabic',
u'an': u'Aragonese',
u'hy': u'Armenian',
u'as': u'Assamese',
u... | iso2_language = {u'aa': u'Afar', u'ab': u'Abkhazian', u'af': u'Afrikaans', u'ak': u'Akan', u'sq': u'Albanian', u'am': u'Amharic', u'ar': u'Arabic', u'an': u'Aragonese', u'hy': u'Armenian', u'as': u'Assamese', u'av': u'Avaric', u'ae': u'Avestan', u'ay': u'Aymara', u'az': u'Azerbaijani', u'ba': u'Bashkir', u'bm': u'Bamba... |
#
# PySNMP MIB module PPPOE-MGMT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PPPOE-MGMT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:41:53 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... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint) ... |
'''
digital media index:
0 - digital media id
1 - owner_id
2 - name
3 - description
4 - file_path
5 - thumbnail_path
6 - category_id
7 - media_type_id
8 - price
9 - approved
'''
##############################################
# Search logic #
######... | """
digital media index:
0 - digital media id
1 - owner_id
2 - name
3 - description
4 - file_path
5 - thumbnail_path
6 - category_id
7 - media_type_id
8 - price
9 - approved
"""
def search(conn, params):
q = q__container(conn, params)
if q.term != '':
results = t... |
def solve(*args):
min_number = min(args[0])
max_number = max(args[0])
summary = sum(args[0])
print(f'The minimum number is {min_number}')
print(f'The maximum number is {max_number}')
print(f'The sum number is: {summary}')
solve(list(map(int, input().split())))
| def solve(*args):
min_number = min(args[0])
max_number = max(args[0])
summary = sum(args[0])
print(f'The minimum number is {min_number}')
print(f'The maximum number is {max_number}')
print(f'The sum number is: {summary}')
solve(list(map(int, input().split()))) |
w, h = 4, 100
list_of_gedung = [[0 for x in range(w)] for y in range(h)]
def createVertex(upperbackleft_x, upperbackleft_y, upperbackleft_z, upperbackright_x, upperbackright_y, upperbackright_z, upperfrontleft_x, upperfrontleft_y, upperfrontleft_z, upperfrontright_x, upperfrontright_y, upperfrontright_z, underbackleft... | (w, h) = (4, 100)
list_of_gedung = [[0 for x in range(w)] for y in range(h)]
def create_vertex(upperbackleft_x, upperbackleft_y, upperbackleft_z, upperbackright_x, upperbackright_y, upperbackright_z, upperfrontleft_x, upperfrontleft_y, upperfrontleft_z, upperfrontright_x, upperfrontright_y, upperfrontright_z, underbac... |
## @file
# Module to gather dependency information for ASKAP packages
#
# @copyright (c) 2006 CSIRO
# Australia Telescope National Facility (ATNF)
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# PO Box 76, Epping NSW 1710, Australia
# atnf-enquiries@csiro.au
#
# This file is part of the ASKAP ... | class Ordereddict:
def __init__(self):
self._list = []
def __len__(self):
return len(self._list)
def __setitem__(self, key, value):
self._list.append([key, value])
def __getitem__(self, i):
found = False
for (key, value) in self.iteritems():
if key... |
## Sum of odd numbers
## 7 kyu
## https://www.codewars.com/kata/55fd2d567d94ac3bc9000064
def row_sum_odd_numbers(n):
total = 0
row_sum= 0
for i in range(n-1,0, -1):
total += i
starting_odd = total * 2 + 1
for i in range(1,n+1):
row_sum += starting_odd
starti... | def row_sum_odd_numbers(n):
total = 0
row_sum = 0
for i in range(n - 1, 0, -1):
total += i
starting_odd = total * 2 + 1
for i in range(1, n + 1):
row_sum += starting_odd
starting_odd += 2
return row_sum |
#
# PySNMP MIB module RFC1253-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RFC1253-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:00:57 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 0... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ... |
# -*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| This file is subject to the terms and conditions defined in file |
#| 'LICENSE.txt', which is part of this source code package. |
#| ... | def test_func(message):
print('Python: python function testFunc is executed!')
print('Python: The message is "', message, '"')
result = 2017
print('Python: The result should be "', result, '"')
return result |
# MIT OC - CS600 - Introduction to Computer Science and Programming
# Problem Set 1: 3 Simple Problems - Problem 1 Min Payment
# Name: Luke Young
# Collaborators: None
# Time Spent: 01:00 (hr:min)
# 2018 04 21 00:20
# Program: Finding remaining balance after minimum payment
#
# Write a program that does the followin... | balance = 0.0
apr = 0.0
min_rate = 0.0
balance = float(raw_input('What is your current Balance? '))
apr = float(raw_input('What is the annual interest rate as a decimal? '))
min_rate = float(raw_input('What is the minimum payment rate as a decimal? '))
min_pay = 0.0
principle = 0.0
pay_total = 0.0
for month in range(1,... |
getInvoiceTopLevelItems = [
{
'categoryCode': 'sov_sec_ip_addresses_priv',
'createDate': '2018-04-04T23:15:20-06:00',
'description': '64 Portable Private IP Addresses',
'id': 724951323,
'oneTimeAfterTaxAmount': '0',
'recurringAfterTaxAmount': '0',
'hostName': ... | get_invoice_top_level_items = [{'categoryCode': 'sov_sec_ip_addresses_priv', 'createDate': '2018-04-04T23:15:20-06:00', 'description': '64 Portable Private IP Addresses', 'id': 724951323, 'oneTimeAfterTaxAmount': '0', 'recurringAfterTaxAmount': '0', 'hostName': 'bleg', 'domainName': 'beh.com', 'category': {'name': 'Pri... |
#!/usr/bin/env python3
#this program will write out my full name and preferred pronouns
print("Fabian Arias, he/him/his") #print out Fabian Arias, he/him/his
| print('Fabian Arias, he/him/his') |
class Serial:
def __init__(self, port=None, baudrate=None, timeout=None):
pass
def reset_output_buffer(self):
pass
def reset_input_buffer(self):
pass
def writable(self):
return True
def write(self, bytes):
pass
def flush(self):
pass
def r... | class Serial:
def __init__(self, port=None, baudrate=None, timeout=None):
pass
def reset_output_buffer(self):
pass
def reset_input_buffer(self):
pass
def writable(self):
return True
def write(self, bytes):
pass
def flush(self):
pass
def ... |
def is_even(x):
if (x % 2 == 0):
return True
return False
print([x for x in range(100) if is_even(x)]) | def is_even(x):
if x % 2 == 0:
return True
return False
print([x for x in range(100) if is_even(x)]) |
# terrascript/data/AdrienneCohea/nomadutility.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:22:45 UTC)
__all__ = []
| __all__ = [] |
# Este es el ejercicio del grupo tercero c
# del dia 13 de septiembre de 2021
# esta linea coloca un mensaje en la consola
print("Este programa hace operaciones basicas")
num1 = 130
numero_2 = 345
suma = num1 + numero_2 # la resta se hace con el simbolo '-'
multip = num1 * numero_2 # la dicision se hace con una '/'
p... | print('Este programa hace operaciones basicas')
num1 = 130
numero_2 = 345
suma = num1 + numero_2
multip = num1 * numero_2
print('la suma es: ')
print(suma)
print('La multiplicacion da como resultado: ', multip) |
score = input('Please enter your score.')
score_float = float(score)
if (score_float >= 0.9 and score_float < 1.0) :
grade = 'A'
elif (score_float >= 0.8 and score_float < 1.0) :
grade = 'B'
elif (score_float >= 0.7 and score_float < 1.0) :
grade = 'C'
elif (score_float >= 0.6 and score_float < 1.0) :
... | score = input('Please enter your score.')
score_float = float(score)
if score_float >= 0.9 and score_float < 1.0:
grade = 'A'
elif score_float >= 0.8 and score_float < 1.0:
grade = 'B'
elif score_float >= 0.7 and score_float < 1.0:
grade = 'C'
elif score_float >= 0.6 and score_float < 1.0:
grade = 'D'
e... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
assert any(list(map(lambda x: x > 4, range(8))))
assert any(map(lambda x: x > 4, range(8)))
assert not any(list(map(lambda x: x < 0, range(8))))
assert not any((map(lambda x: x < 0, range(8))))
| assert any(list(map(lambda x: x > 4, range(8))))
assert any(map(lambda x: x > 4, range(8)))
assert not any(list(map(lambda x: x < 0, range(8))))
assert not any(map(lambda x: x < 0, range(8))) |
class User:
'''
This class generates new user instances
'''
def __init__(self, fullname, email, username, password):
self.fullname = fullname
self.email = email
self.username = username
self.password = password
user_list = []
def save_user(self):
'''
... | class User:
"""
This class generates new user instances
"""
def __init__(self, fullname, email, username, password):
self.fullname = fullname
self.email = email
self.username = username
self.password = password
user_list = []
def save_user(self):
"""
... |
class VehicleDevice:
def __init__(self, data, controller):
self._id = data['id']
self._vehicle_id = data['vehicle_id']
self._vin = data['vin']
self._state = data['state']
self._controller = controller
self.should_poll = True
def _name(self):
return 'Tesla... | class Vehicledevice:
def __init__(self, data, controller):
self._id = data['id']
self._vehicle_id = data['vehicle_id']
self._vin = data['vin']
self._state = data['state']
self._controller = controller
self.should_poll = True
def _name(self):
return 'Tesl... |
#=======================================================================================
# Open a domain template.
#=======================================================================================
selectCustomTemplate("wls/wlserver/common/templates/wls/wls.jar")
loadTemplates()
setOption('NodeManagerType','Man... | select_custom_template('wls/wlserver/common/templates/wls/wls.jar')
load_templates()
set_option('NodeManagerType', 'ManualNodeManagerSetup')
set_option('ServerStartMode', 'prod')
set_option('OverwriteDomain', 'true')
domain = cd('/')
domain.setName('demo-wls')
cd('/Servers/AdminServer')
cmo.setName('admin_server')
cmo.... |
def create_matrix(rows, columns):
result = []
for r in range(rows):
row = ["" for c in range(columns)]
result.append(row)
return result
def print_result(matrix):
for el in matrix:
print("".join(el))
rows, columns = map(int, input().split())
snake = input()
matrix = create_matri... | def create_matrix(rows, columns):
result = []
for r in range(rows):
row = ['' for c in range(columns)]
result.append(row)
return result
def print_result(matrix):
for el in matrix:
print(''.join(el))
(rows, columns) = map(int, input().split())
snake = input()
matrix = create_matr... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | const_outbound_type_load_balancer = 'loadBalancer'
const_outbound_type_user_defined_routing = 'userDefinedRouting'
const_scale_set_priority_regular = 'Regular'
const_scale_set_priority_spot = 'Spot'
const_spot_eviction_policy_delete = 'Delete'
const_spot_eviction_policy_deallocate = 'Deallocate'
const_http_application_... |
cars = 100.00 #number of cars available for the day
space_in_a_car = 4.00 #amount of space in a cars
drivers = 30.00 #number of available drivers
passengers = 90.00 #number of available passengers
cars_not_driven = cars - drivers #calculation for cars that are not used
cars_driven = drivers #calculation for cars that a... | cars = 100.0
space_in_a_car = 4.0
drivers = 30.0
passengers = 90.0
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_capacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven
print('There are', cars, 'cars available')
print('There are only', drivers, 'drivers available')... |
class Solution:
def findMaximumXOR(self, nums: List[int]) -> int:
ans = mask = 0
for x in range(32)[::-1]:
mask += 1 << x
prefixSet = set([n & mask for n in nums])
temp = ans | 1 << x
for prefix in prefixSet:
if temp ^ prefix in prefixS... | class Solution:
def find_maximum_xor(self, nums: List[int]) -> int:
ans = mask = 0
for x in range(32)[::-1]:
mask += 1 << x
prefix_set = set([n & mask for n in nums])
temp = ans | 1 << x
for prefix in prefixSet:
if temp ^ prefix in pre... |
#
# PySNMP MIB module OMNI-gx2CM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/OMNI-gx2CM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:23:48 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, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, single_value_constraint, constraints_union, constraints_intersection) ... |
str = input().strip()
n = int(input())
def check(s):
if s=='a'or s=='e' or s=='i' or s=='o' or s=='u':
return True
return False
def non_vowels(str,n):
i,index =0,0
start = 0
res = 0
non_vowels = 0
disturb_flag = True
while index<len(str):
if disturb_flag:
if not check(str[index]):
non_vowels +=... | str = input().strip()
n = int(input())
def check(s):
if s == 'a' or s == 'e' or s == 'i' or (s == 'o') or (s == 'u'):
return True
return False
def non_vowels(str, n):
(i, index) = (0, 0)
start = 0
res = 0
non_vowels = 0
disturb_flag = True
while index < len(str):
if dis... |
low = int(input())
high = int(input())
x = int(input())
#first from bottom
num = low
while num <=high:
tverrsum = sum([int(i) for i in str(num)])
if tverrsum == x:
print(num)
break
num+=1
#first from top
num = high
while num >= low:
tverrsum = sum([int(i) for i in str(num)])
if tver... | low = int(input())
high = int(input())
x = int(input())
num = low
while num <= high:
tverrsum = sum([int(i) for i in str(num)])
if tverrsum == x:
print(num)
break
num += 1
num = high
while num >= low:
tverrsum = sum([int(i) for i in str(num)])
if tverrsum == x:
print(num)
... |
print("Python Program to print the sum and average of natural numbers!")
limit = int(input("Enter the limit of numbers:"))
sumOfNumbers = (limit * (limit + 1)) / 2
averageOfNumbers = sumOfNumbers / limit
print("The sum of", limit, "natural numbers is", sumOfNumbers)
print("The Average of", limit, "natural number is", a... | print('Python Program to print the sum and average of natural numbers!')
limit = int(input('Enter the limit of numbers:'))
sum_of_numbers = limit * (limit + 1) / 2
average_of_numbers = sumOfNumbers / limit
print('The sum of', limit, 'natural numbers is', sumOfNumbers)
print('The Average of', limit, 'natural number is',... |
_base_ = [
'../_base_/datasets/s3dis_seg-3d-13class.py',
'../_base_/models/pointnet2_msg.py',
'../_base_/schedules/seg_cosine_50e.py', '../_base_/default_runtime.py'
]
# data settings
data = dict(samples_per_gpu=16)
evaluation = dict(interval=2)
# model settings
model = dict(
backbone=dict(in_channels... | _base_ = ['../_base_/datasets/s3dis_seg-3d-13class.py', '../_base_/models/pointnet2_msg.py', '../_base_/schedules/seg_cosine_50e.py', '../_base_/default_runtime.py']
data = dict(samples_per_gpu=16)
evaluation = dict(interval=2)
model = dict(backbone=dict(in_channels=9), decode_head=dict(num_classes=13, ignore_index=13,... |
string = str (input())
string_copy = string
new_string = string.replace(string[0],string[-1])
new_string = string_copy.replace(string_copy[-1],string_copy[0])
print(new_string)
| string = str(input())
string_copy = string
new_string = string.replace(string[0], string[-1])
new_string = string_copy.replace(string_copy[-1], string_copy[0])
print(new_string) |
class SetupForm(QtWidgets.QWidget):
global model
model = SetupInformation()
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setObjectName("setupDialog")
# self.resize(1754, 3000)
self.model = model | class Setupform(QtWidgets.QWidget):
global model
model = setup_information()
def __init__(self):
super().__init__()
self.initUI()
def init_ui(self):
self.setObjectName('setupDialog')
self.model = model |
def request(flow):
real_github_token = 'REPLACE_ME!'
auth_header = flow.request.headers.get('Authorization')
if auth_header:
flow.request.headers['Authorization'] = auth_header.replace('__GITHUB_TOKEN_PLACEHOLDER__', real_github_token)
def response(flow):
recording_proxy = 'http://host.docker.... | def request(flow):
real_github_token = 'REPLACE_ME!'
auth_header = flow.request.headers.get('Authorization')
if auth_header:
flow.request.headers['Authorization'] = auth_header.replace('__GITHUB_TOKEN_PLACEHOLDER__', real_github_token)
def response(flow):
recording_proxy = 'http://host.docker.i... |
TimesTable = int(input("Please Choose A Times Table To Be Quizzed On;\n1)One Times Tables\n2)Two Times Tables\n3)Three Times Tables\n4)Four Times Tables\n5)Five Times Tables\n6)Six Times Tables\n7)Seven Times Tables\n8)Eight Times Tables\n9)Nine Times Tables\n10)Ten Times Tables\n11)Eleven Times Tables\n12)Twelve Times... | times_table = int(input('Please Choose A Times Table To Be Quizzed On;\n1)One Times Tables\n2)Two Times Tables\n3)Three Times Tables\n4)Four Times Tables\n5)Five Times Tables\n6)Six Times Tables\n7)Seven Times Tables\n8)Eight Times Tables\n9)Nine Times Tables\n10)Ten Times Tables\n11)Eleven Times Tables\n12)Twelve Time... |
nums = (input("")).split()
n = int(nums[0])
m = int(nums[1])
l= int(nums[2])
list1 = []
for i in range(n):
request = (input("")).split()
request[1] = float(request[1])
request[2] = int(request[2])
request[3] = int(request[3])
request.append(i)
list1.append(request)
l... | nums = input('').split()
n = int(nums[0])
m = int(nums[1])
l = int(nums[2])
list1 = []
for i in range(n):
request = input('').split()
request[1] = float(request[1])
request[2] = int(request[2])
request[3] = int(request[3])
request.append(i)
list1.append(request)
list1.sort()
list1 = sorted(list1... |
capitals = ["Amsterdam", "Andorra la Vella", "Athens", "Berlin", "Bratislava", "Brussels", "Dublin", "Helsinki",
"Lisbon", "Ljubljana", "Luxembourg", "Madrid", "Monaco", "Nicosia", "Paris", "Riga", "Rome", "San Marino",
"Tallinn", "Valletta", "Vatican City", "Vienna", "Vilnius"]
# len_cities = l... | capitals = ['Amsterdam', 'Andorra la Vella', 'Athens', 'Berlin', 'Bratislava', 'Brussels', 'Dublin', 'Helsinki', 'Lisbon', 'Ljubljana', 'Luxembourg', 'Madrid', 'Monaco', 'Nicosia', 'Paris', 'Riga', 'Rome', 'San Marino', 'Tallinn', 'Valletta', 'Vatican City', 'Vienna', 'Vilnius']
countries = ['Netherlands', 'Andorra', '... |
CONFIG = {
'http': {
'port': 3000
},
'authentication': {
'salt_rounds': 12,
'secret': '!!! CHANGE ME !!!',
'issuer': 'example.com',
'token_expiry': '24h',
'admin_primary_email': 'admin@localhost',
'admin_default_password': 'admin'
},
'authoriza... | config = {'http': {'port': 3000}, 'authentication': {'salt_rounds': 12, 'secret': '!!! CHANGE ME !!!', 'issuer': 'example.com', 'token_expiry': '24h', 'admin_primary_email': 'admin@localhost', 'admin_default_password': 'admin'}, 'authorization': {'default_roles': ['user:read', 'user:write', 'public:read'], 'approved_ro... |
class FilePath:
regex = '[0-9]{4}'
def to_python(self, value):
return int(value)
| class Filepath:
regex = '[0-9]{4}'
def to_python(self, value):
return int(value) |
test = {'name': 'q7',
'points': 8,
'suites': [{'cases': [{'code': '>>> t = Tree (1 , [ Tree (2) , Tree (1 , [ '
'Tree (2 , [ Tree (3 , [ Tree (0)])])])])\n'
'\n'
'>>> longest_seq( t) # 1 -> 2 -> 3\n'
... | test = {'name': 'q7', 'points': 8, 'suites': [{'cases': [{'code': '>>> t = Tree (1 , [ Tree (2) , Tree (1 , [ Tree (2 , [ Tree (3 , [ Tree (0)])])])])\n\n>>> longest_seq( t) # 1 -> 2 -> 3\n3\n\n>>> t = Tree (1)\n\n>>> longest_seq( t)\n1\n'}], 'scored': True, 'setup': 'from q7 import *', 'type': 'doctest'}]} |
x = [input() for x in range(10)]
m = 0
m_index = 0
for i in range(0,10,2):
if int(x[i]) > m:
m = int(x[i])
m_index = i
print(f"a maioe nota foi de {x[m_index+1]} com {x[m_index]} pontos") | x = [input() for x in range(10)]
m = 0
m_index = 0
for i in range(0, 10, 2):
if int(x[i]) > m:
m = int(x[i])
m_index = i
print(f'a maioe nota foi de {x[m_index + 1]} com {x[m_index]} pontos') |
class Commands:
def __init__(self, arguments_commandline: list):
commands_allowed = ['compile', 'clean']
if len(arguments_commandline) > 1:
command = arguments_commandline[1]
if not command in commands_allowed:
raise Exception("You give an invalid command")... | class Commands:
def __init__(self, arguments_commandline: list):
commands_allowed = ['compile', 'clean']
if len(arguments_commandline) > 1:
command = arguments_commandline[1]
if not command in commands_allowed:
raise exception('You give an invalid command')
... |
size(200, 400)
path = BezierPath()
path.polygon((80, 28), (50, 146), (146, 152), (172, 78))
with savedState():
clipPath(path)
scale(200/512)
image("../images/drawbot.png", (0, 0))
translate(0, 200)
with savedState():
scale(200/512)
image("../images/drawbot.png", (0, 0))
| size(200, 400)
path = bezier_path()
path.polygon((80, 28), (50, 146), (146, 152), (172, 78))
with saved_state():
clip_path(path)
scale(200 / 512)
image('../images/drawbot.png', (0, 0))
translate(0, 200)
with saved_state():
scale(200 / 512)
image('../images/drawbot.png', (0, 0)) |
with open("input.txt", "r") as input_file:
lines = input_file.readlines()
reports = [int(line, 2) for line in lines]
counts = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for report in reports:
i = 0
num_of_bits = len(counts)
while i < num_of_bits:
counts[num_of_bits-1-i] += report >> i & 1
... | with open('input.txt', 'r') as input_file:
lines = input_file.readlines()
reports = [int(line, 2) for line in lines]
counts = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for report in reports:
i = 0
num_of_bits = len(counts)
while i < num_of_bits:
counts[num_of_bits - 1 - i] += report >> i & 1
... |
class Template:
model_owner = "model_owner"
detail_view = "detail_view"
detail_view_u = "detail_view_u"
detail_view_d = "detail_view_d"
detail_view_ud = "detail_view_ud"
all_objects_view = "all_objects_view"
filter_objects_view = "filter_objects_view"
user_register_view = "user_register_... | class Template:
model_owner = 'model_owner'
detail_view = 'detail_view'
detail_view_u = 'detail_view_u'
detail_view_d = 'detail_view_d'
detail_view_ud = 'detail_view_ud'
all_objects_view = 'all_objects_view'
filter_objects_view = 'filter_objects_view'
user_register_view = 'user_register_... |
#Write a function called num_factors. num_factors should
#have one parameter, an integer. num_factors should count
#how many factors the number has and return that count as
#an integer
#
#A number is a factor of another number if it divides
#evenly into that number. For example, 3 is a factor of 6,
#but 4 is not... | def num_factors(num):
count = 0
for i in range(2, num):
if num % i == 0:
count += 1
return count
print(num_factors(5))
print(num_factors(6))
print(num_factors(97))
print(num_factors(105))
print(num_factors(999)) |
#
# Created on Sat Apr 25 2020
#
# Title: Leetcode - Jump Game
#
# Author: Vatsal Mistry
# Web: mistryvatsal.github.io
#
# Approach will be to traverse array in reverse, maintain last_optimum_pos
# and check whether last_optimum_pos is at the 0 index
class Solution:
def canJump(self, nums):
N = len(nums)... | class Solution:
def can_jump(self, nums):
n = len(nums)
last_optimum_pos = N - 1
for i in range(N - 1, -1, -1):
if i + nums[i] >= last_optimum_pos:
last_optimum_pos = i
return last_optimum_pos == 0 |
while True:
n = int(input())
if n == 0:
break
ans = 0
for i in range(n):
flag = True
s = input()
for j in range(len(s)):
if s[j] == ' ' and ans <= j:
flag = False
ans = j
break
if flag and ans < len(s):
... | while True:
n = int(input())
if n == 0:
break
ans = 0
for i in range(n):
flag = True
s = input()
for j in range(len(s)):
if s[j] == ' ' and ans <= j:
flag = False
ans = j
break
if flag and ans < len(s):
... |
# Shopping Options
# https://aonecode.com/amazon-online-assessment-shopping-options
def getNumberOfOptions(priceOfJeans, priceOfShoes, priceOfSkirts, priceOfTops, dollars):
if not priceOfJeans or not priceOfShoes or not priceOfSkirts or not priceOfTops:
return 0
js = []
for i in range(len(priceO... | def get_number_of_options(priceOfJeans, priceOfShoes, priceOfSkirts, priceOfTops, dollars):
if not priceOfJeans or not priceOfShoes or (not priceOfSkirts) or (not priceOfTops):
return 0
js = []
for i in range(len(priceOfJeans)):
for j in range(len(priceOfShoes)):
js.append(priceO... |
_base_ = [
'_base_/datasets/cxr14_bs16.py',
'_base_/models/resnet50_cxr14.py',
'_base_/schedules/cxr14_bs16_ep20.py',
'_base_/default_runtime.py'
] | _base_ = ['_base_/datasets/cxr14_bs16.py', '_base_/models/resnet50_cxr14.py', '_base_/schedules/cxr14_bs16_ep20.py', '_base_/default_runtime.py'] |
#encoding:utf-8
# Write here subreddit name. Like this one for /r/BigAnimeTiddies.
subreddit = 'BigAnimeTiddies'
# This is for your public telegram channel.
t_channel = '@r_BigAnimeTiddies'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| subreddit = 'BigAnimeTiddies'
t_channel = '@r_BigAnimeTiddies'
def send_post(submission, r2t):
return r2t.send_simple(submission) |
def rest():
i01.setHeadSpeed(1.0,1.0)
i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
#atach
i01.head.neck.attach()
i01.head.rothead.attach()
i01.rightHand.attach()
i01.rightArm.shoulder.attach()
i01.rightArm.omoplate.attach()
i01.rightArm.bicep.a... | def rest():
i01.setHeadSpeed(1.0, 1.0)
i01.setHandSpeed('right', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed('right', 1.0, 1.0, 1.0, 1.0)
i01.head.neck.attach()
i01.head.rothead.attach()
i01.rightHand.attach()
i01.rightArm.shoulder.attach()
i01.rightArm.omoplate.attach()
i01.rightA... |
#!/usr/bin/python3
for i in range(-10,-100,-30):
print(i)
print(i) | for i in range(-10, -100, -30):
print(i)
print(i) |
def test_index(client):
r = client.get("/")
assert r.status_code == 200
def test_paper_page(client):
r = client.get("/paper/1812.35598")
assert r.status_code == 200 | def test_index(client):
r = client.get('/')
assert r.status_code == 200
def test_paper_page(client):
r = client.get('/paper/1812.35598')
assert r.status_code == 200 |
class Node:
def __init__(self, data=None):
self.__data=data
self.__next=None
@property
def data(self):
return self.__data
@data.setter
def data(self, data):
self.__data=data
@property
def next(self):
return self.__next
@next.setter
... | class Node:
def __init__(self, data=None):
self.__data = data
self.__next = None
@property
def data(self):
return self.__data
@data.setter
def data(self, data):
self.__data = data
@property
def next(self):
return self.__next
@next.setter
d... |
def pkgs_raw(packages):
pkgs_raw_str = ""
for package in packages:
pkgs_raw_str += str(package) + "\n"
print(pkgs_raw_str)
def pkgs_traits(packages, traits_to_print):
pkgs_traits_str = ""
for package in packages:
pkgs_traits_str += "\n"
for trait in traits_to_print:
... | def pkgs_raw(packages):
pkgs_raw_str = ''
for package in packages:
pkgs_raw_str += str(package) + '\n'
print(pkgs_raw_str)
def pkgs_traits(packages, traits_to_print):
pkgs_traits_str = ''
for package in packages:
pkgs_traits_str += '\n'
for trait in traits_to_print:
... |
webgui = Runtime.create("webgui","WebGui")
# if you don't want the browser to
# autostart to homepage
#
# webgui.autoStartBrowser(false)
# set a different port number to listen to
# default is 8888
# webgui.setPort(7777)
# on startup the webgui will look for a "resources"
# directory (may change in the future)
# st... | webgui = Runtime.create('webgui', 'WebGui')
webgui.startService() |
class Solution:
max_time = 0
def numOfMinutes(self, n: int, headID: int, manager: List[int], informTime: List[int]) -> int:
global max_time
max_time=0
def dfs(adj,node,path_sum):
global max_time
if adj.get(node)==None:
max_time=max(max_time,path_... | class Solution:
max_time = 0
def num_of_minutes(self, n: int, headID: int, manager: List[int], informTime: List[int]) -> int:
global max_time
max_time = 0
def dfs(adj, node, path_sum):
global max_time
if adj.get(node) == None:
max_time = max(max_... |
def z_inicial(lista):
cont=0
if len(lista) == 0:
return
else:
for i in range(len(lista)):
if lista[i][0] == "z" or lista[i][0] == "Z":
cont+=1
return cont
lista=input().split()
print(z_inicial(lista))
| def z_inicial(lista):
cont = 0
if len(lista) == 0:
return
else:
for i in range(len(lista)):
if lista[i][0] == 'z' or lista[i][0] == 'Z':
cont += 1
return cont
lista = input().split()
print(z_inicial(lista)) |
''' Problem # 3
Write a program that takes the salary and grade from user.
It then adds 50% bonus if the grade is greater tha 15.
It adds 25% bonus if the grade is 15 or less and then it should display the salary
Pseudocode
1. Start
2. Take the salary and grade from the user
3. If the grade is greater than 15
th... | """ Problem # 3
Write a program that takes the salary and grade from user.
It then adds 50% bonus if the grade is greater tha 15.
It adds 25% bonus if the grade is 15 or less and then it should display the salary
Pseudocode
1. Start
2. Take the salary and grade from the user
3. If the grade is greater than 15
th... |
## 1. Overview ##
f = open("movie_metadata.csv", 'r')
movie_metadata = f.read()
movie_metadata = movie_metadata.split('\n')
movie_data = []
for element in movie_metadata:
row = element.split(',')
movie_data.append(row)
print(movie_data[:5])
## 3. Writing Our Own Functions ##
def first_elts(nested_lists):
... | f = open('movie_metadata.csv', 'r')
movie_metadata = f.read()
movie_metadata = movie_metadata.split('\n')
movie_data = []
for element in movie_metadata:
row = element.split(',')
movie_data.append(row)
print(movie_data[:5])
def first_elts(nested_lists):
list_heads = []
for n_list in nested_lists:
... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | manifest = {'Name': 'temp_sensor_status_transition_monitor', 'Description': 'Network Analytics Agent Script to monitorstatus transitions of all temperature sensors', 'Version': '1.0', 'Author': 'Aruba Networks'}
class Policy(NAE):
def __init__(self):
self.variables['sensors_list'] = ''
uri1 = '/re... |
#gwang_01.py
j = 0
for i in range (1000):
if (i % 3) == 0 or (i%5) == 0: j+=i
j
| j = 0
for i in range(1000):
if i % 3 == 0 or i % 5 == 0:
j += i
j |
dp = [0 for i in range(301)];stair = [0 for i in range(301)]
n = int(input())
for i in range(n): stair[i] = int(input())
dp[0] = stair[0];dp[1] = stair[0]+stair[1];dp[2] = max(stair[0]+stair[2],stair[1]+stair[2])
for i in range(3,n): dp[i] = max(dp[i-2]+stair[i],dp[i-3]+stair[i-1]+stair[i])
print(dp[n-1]) | dp = [0 for i in range(301)]
stair = [0 for i in range(301)]
n = int(input())
for i in range(n):
stair[i] = int(input())
dp[0] = stair[0]
dp[1] = stair[0] + stair[1]
dp[2] = max(stair[0] + stair[2], stair[1] + stair[2])
for i in range(3, n):
dp[i] = max(dp[i - 2] + stair[i], dp[i - 3] + stair[i - 1] + stair[i])... |
def read_only_properties(*args):
def class_rebuilder(cls):
def __setattr__(self, key, value):
if key in args and key in self.__dict__:
raise AttributeError("Can't modify %s" % key)
else:
super().__setattr__(key, value)
cls.__setattr__ = __seta... | def read_only_properties(*args):
def class_rebuilder(cls):
def __setattr__(self, key, value):
if key in args and key in self.__dict__:
raise attribute_error("Can't modify %s" % key)
else:
super().__setattr__(key, value)
cls.__setattr__ = __se... |
# Copyright (c) 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,
},
'targets': [
{
'target_name': 'gfx_geometry',
'type': '<(component)',
'dependenci... | {'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'gfx_geometry', 'type': '<(component)', 'dependencies': ['<(DEPTH)/base/base.gyp:base'], 'defines': ['GFX_IMPLEMENTATION'], 'sources': ['geometry/box_f.cc', 'geometry/box_f.h', 'geometry/cubic_bezier.h', 'geometry/cubic_bezier.cc', 'geometry/insets.cc', 'g... |
#!/usr/bin/env python3
# ex6: String and Text
# Assign the string with 10 replacing the formatting character to variable 'x'
x = "There are %d types of people." % 10
# Assign the string with "binary" to variable 'binary'
binary = "binary"
# Assign the string with "don't" to variable 'do_not'
do_not = "don't"
# Ass... | x = 'There are %d types of people.' % 10
binary = 'binary'
do_not = "don't"
y = 'Those who know %s and those who %s.' % (binary, do_not)
print(x)
print(y)
print('I said %r.' % x)
print("I also said: '%s'." % y)
hilarious = False
joke_evaluation = "Isn't that joke so funny?! %r"
print(joke_evaluation % hilarious)
w = 'T... |
class QolsysException(Exception):
pass
class QolsysGwConfigIncomplete(QolsysException):
pass
class QolsysGwConfigError(QolsysException):
pass
class UnableToParseEventException(QolsysException):
pass
class UnknownQolsysControlException(QolsysException):
pass
class UnknownQolsysEventException(Qol... | class Qolsysexception(Exception):
pass
class Qolsysgwconfigincomplete(QolsysException):
pass
class Qolsysgwconfigerror(QolsysException):
pass
class Unabletoparseeventexception(QolsysException):
pass
class Unknownqolsyscontrolexception(QolsysException):
pass
class Unknownqolsyseventexception(Qol... |
## 3. Read the File Into a String ##
f = open("dq_unisex_names.csv", 'r')
names = f.read();
## 4. Convert the String to a List ##
f = open('dq_unisex_names.csv', 'r')
names = f.read()
names_list = names.split('\n')
first_five = names_list[0:5]
print(first_five)
## 5. Convert the List of Strings to a List of Lists ... | f = open('dq_unisex_names.csv', 'r')
names = f.read()
f = open('dq_unisex_names.csv', 'r')
names = f.read()
names_list = names.split('\n')
first_five = names_list[0:5]
print(first_five)
f = open('dq_unisex_names.csv', 'r')
names = f.read()
names_list = names.split('\n')
nested_list = []
for name in names_list:
nest... |
def main():
x_coords = []
x_lines = ["side 1 G", "side 1 5", "side 1 10", "side 1 15", "side 1 20", "side 1 25", "side 1 30", "side 1 35",
"side 1 40", "side 1 45", "50", "side 2 45", "side 2 40", "side 2 35", "side 2 30", "side 2 25",
"side 2 20", "side 2 15", "side 2 10", "si... | def main():
x_coords = []
x_lines = ['side 1 G', 'side 1 5', 'side 1 10', 'side 1 15', 'side 1 20', 'side 1 25', 'side 1 30', 'side 1 35', 'side 1 40', 'side 1 45', '50', 'side 2 45', 'side 2 40', 'side 2 35', 'side 2 30', 'side 2 25', 'side 2 20', 'side 2 15', 'side 2 10', 'side 2 5', 'side 2 G']
for (i, l... |
def main():
arr = []
while True:
arr.append(1)
if len(arr) >= 10:
break
return None
if __name__ == "__main__":
main()
| def main():
arr = []
while True:
arr.append(1)
if len(arr) >= 10:
break
return None
if __name__ == '__main__':
main() |
enums = {
'AcpAmplitudeCorrectionType': {
'values': [
{
'documentation': {
'description': ' All the frequency bins in the spectrum are compensated with a single external attenuation value that corresponds to the RF center frequency.'
},
... | enums = {'AcpAmplitudeCorrectionType': {'values': [{'documentation': {'description': ' All the frequency bins in the spectrum are compensated with a single external attenuation value that corresponds to the RF center frequency.'}, 'name': 'RF_CENTER_FREQUENCY', 'value': 0}, {'documentation': {'description': ' An indivi... |
for letra in 'Laiana Nardi':
print(letra)
print("For loop letra!")
for contador in range(2,8):
print(contador)
print("For Loop contador!")
friends = ['John','Terry','Eric','Michael','George']
# for friend in friends:
# print(friend)
for index in range(len(friends)):
print(friends[index])
for friend... | for letra in 'Laiana Nardi':
print(letra)
print('For loop letra!')
for contador in range(2, 8):
print(contador)
print('For Loop contador!')
friends = ['John', 'Terry', 'Eric', 'Michael', 'George']
for index in range(len(friends)):
print(friends[index])
for friend in friends:
if friend == 'Eric':
... |
num = int(input())
def ListOfNum(num):
L = []
while num != 0:
x = num%10
num = num//10
L.append(x)
return L
def Multiply(L):
result = 1
for i in L:
result = result *i
return result
L = ListOfNum(num) #L = [2,6,8]
result = 0
while len(L) > 1:
re... | num = int(input())
def list_of_num(num):
l = []
while num != 0:
x = num % 10
num = num // 10
L.append(x)
return L
def multiply(L):
result = 1
for i in L:
result = result * i
return result
l = list_of_num(num)
result = 0
while len(L) > 1:
result += 1
x = ... |
l=[]
fo=open("EnglishWords.txt","r")
st=fo.read()
st=st.split()
for line in st:
if line[0]=='t':
l.append(line)
print(len(l))
| l = []
fo = open('EnglishWords.txt', 'r')
st = fo.read()
st = st.split()
for line in st:
if line[0] == 't':
l.append(line)
print(len(l)) |
#!/usr/bin/python3
#-- Use pprint module..
x=[[1,2,3,4],[11,22,33,44],[111,222,333,444]]
#-- Use printf style formatting..
x = 22/7
#-- Write some multivariate for loops..
for x,y in [[1,2]]:
print('x',x,'y',y)
for x in enumerate(range(5)):
print('x',x)
#-- Compute diagonal sums with lambdas..
m=[
[ 5,... | x = [[1, 2, 3, 4], [11, 22, 33, 44], [111, 222, 333, 444]]
x = 22 / 7
for (x, y) in [[1, 2]]:
print('x', x, 'y', y)
for x in enumerate(range(5)):
print('x', x)
m = [[5, 2, 3, 4, 1], [10, 40, 30, 20, 50], [100, 200, 300, 400, 500], [1001, 4000, 3000, 2000, 5000], [50000, 20000, 30000, 40000, 10000]]
m = 8
n = 9 |
# -*- coding: utf-8 -*-
class ExampleLibraryException(Exception):
'''It is a good practice to throw library specific exceptions so
that you know where the exception is comming'''
pass
class ExampleLibrary(object):
'''Libraries should be documented according to Robot Framework User Guide'''
def li... | class Examplelibraryexception(Exception):
"""It is a good practice to throw library specific exceptions so
that you know where the exception is comming"""
pass
class Examplelibrary(object):
"""Libraries should be documented according to Robot Framework User Guide"""
def library_keyword(self):
... |
def getNumericVal(number):
if number == 1:
return 3
elif number == 2:
return 3
elif number == 3:
return 5
elif number == 4:
return 4
elif number == 5:
return 4
elif number == 6:
return 3
elif number == 7:
return 5
elif number... | def get_numeric_val(number):
if number == 1:
return 3
elif number == 2:
return 3
elif number == 3:
return 5
elif number == 4:
return 4
elif number == 5:
return 4
elif number == 6:
return 3
elif number == 7:
return 5
elif number == 8... |
class BaseError(Exception):
pass
class RecordNotFound(BaseError):
pass
| class Baseerror(Exception):
pass
class Recordnotfound(BaseError):
pass |
class ArmatureActuator:
bone = None
constraint = None
influence = None
mode = None
secondary_target = None
target = None
weight = None
| class Armatureactuator:
bone = None
constraint = None
influence = None
mode = None
secondary_target = None
target = None
weight = None |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]:
cur = dummy = ListNode()
while l... | class Solution:
def merge_two_lists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]:
cur = dummy = list_node()
while list1 and list2:
if list1.val < list2.val:
cur.next = list1
(list1, cur) = (list1.next, list1)
... |
file_name = "nameslist.txt"
names_list = open(file_name, "rt").read().splitlines(False)
print(names_list)
names_count = {}
for name in names_list:
if name not in names_count:
names_count[name] = 0
names_count[name] += 1
print(names_count) | file_name = 'nameslist.txt'
names_list = open(file_name, 'rt').read().splitlines(False)
print(names_list)
names_count = {}
for name in names_list:
if name not in names_count:
names_count[name] = 0
names_count[name] += 1
print(names_count) |
n, d = map(int,input().split())
l=[]
for i in range(n):
l1=list(map(int,input().split()))
l.append(l1)
l=sorted(l)
i, j, ans, s = 0, 0, 0, 0
while j<n:
if l[i][0]+d > l[j][0]:
s+=l[j][1]
j+=1
else:
s-=l[i][1]
i+=1
ans=max(ans,s)
print(ans) | (n, d) = map(int, input().split())
l = []
for i in range(n):
l1 = list(map(int, input().split()))
l.append(l1)
l = sorted(l)
(i, j, ans, s) = (0, 0, 0, 0)
while j < n:
if l[i][0] + d > l[j][0]:
s += l[j][1]
j += 1
else:
s -= l[i][1]
i += 1
ans = max(ans, s)
print(ans) |
class Atom:
def __init__(self):
pass
def __repr__(self):
raise NotImplementedError()
class Tmp(Atom):
__slots__ = ['tmp_idx']
def __init__(self, tmp_idx):
super(Tmp, self).__init__()
self.tmp_idx = tmp_idx
def __repr__(self):
return "<Tmp %d>" % self.tmp... | class Atom:
def __init__(self):
pass
def __repr__(self):
raise not_implemented_error()
class Tmp(Atom):
__slots__ = ['tmp_idx']
def __init__(self, tmp_idx):
super(Tmp, self).__init__()
self.tmp_idx = tmp_idx
def __repr__(self):
return '<Tmp %d>' % self.tm... |
# Utilities and color maps for plotting
# Colours from https://s-rip.ees.hokudai.ac.jp/mediawiki/index.php/Notes_for_Authors
reanalysis_color = {
'MERRA2' :'#e21f26',
'MERRA' :'#f69999',
'ERAI' :'#295f8a',
'ERA5' :'#5f98c6',
'ERA40' :'#afcbe3',
'JRA55' :'#723b7a',
'JRA55C' :'#... | reanalysis_color = {'MERRA2': '#e21f26', 'MERRA': '#f69999', 'ERAI': '#295f8a', 'ERA5': '#5f98c6', 'ERA40': '#afcbe3', 'JRA55': '#723b7a', 'JRA55C': '#ad71b5', 'JRA25': '#d6b8da', 'NCEP1': '#f57e20', 'NCEP2': '#fdbf6e', '20CRV2C': '#ec008c', '20CRV2': '#f799D1', 'CERA20C': '#00aeef', 'ERA20C': '#60c8e8', 'CFSR': '#34a0... |
# maximum_subarray_sum.py
# https://www.codewars.com/kata/54521e9ec8e60bc4de000d6c
def max_sequence(arr):
if len(arr) == 0:
return 0
all_elements_negative = True
for item in arr:
if item > 0:
all_elements_negative = False
break
if all_elements_negative:
... | def max_sequence(arr):
if len(arr) == 0:
return 0
all_elements_negative = True
for item in arr:
if item > 0:
all_elements_negative = False
break
if all_elements_negative:
return 0
maximum_sum = max(arr)
current_sum = 0
max_subarray = []
for... |
x = int(input())
y = float(input())
gasto = x / y
print('{:.3f} km/l'.format(gasto))
| x = int(input())
y = float(input())
gasto = x / y
print('{:.3f} km/l'.format(gasto)) |
# Created by MechAviv
# ID :: [931050000]
# Hidden Street : Extraction Room 1
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.setStandAloneMode(True)
def failMessage(crack):
sm.chatScript("Tap the Control Key repeatedly to break the wall.")
sm.showEffec... | sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.setStandAloneMode(True)
def fail_message(crack):
sm.chatScript('Tap the Control Key repeatedly to break the wall.')
sm.showEffect('Effect/Direction6.img/effect/tuto/guide1/0', 3000, 0, -100, 20, 0, False,... |
class HTTPError(Exception):
pass
class VersionSpecificationError(Exception):
pass
| class Httperror(Exception):
pass
class Versionspecificationerror(Exception):
pass |
# -*- coding: utf-8 -*-
'''
Splunk User State Module
.. versionadded:: 2016.3.0.
This state is used to ensure presence of users in splunk.
.. code-block:: yaml
ensure example test user 1:
splunk.present:
- name: 'Example TestUser1'
- email: example@domain.com
'''
def __virtual_... | """
Splunk User State Module
.. versionadded:: 2016.3.0.
This state is used to ensure presence of users in splunk.
.. code-block:: yaml
ensure example test user 1:
splunk.present:
- name: 'Example TestUser1'
- email: example@domain.com
"""
def __virtual__():
"""
Only loa... |
#!/usr/bin/env python
#fn: copy.py
# write specifi contents of alignment_py.py to blast_py.py
INPUT = open('alignment_py.py','r')
OUTPUT = open('blast_py.py','a')
lnum = 0
for line in INPUT:
lnum += 1
line = line.strip('\n')
if lnum > 6 and lnum < 138:
OUTPUT.write(line+'\n')
| input = open('alignment_py.py', 'r')
output = open('blast_py.py', 'a')
lnum = 0
for line in INPUT:
lnum += 1
line = line.strip('\n')
if lnum > 6 and lnum < 138:
OUTPUT.write(line + '\n') |
__author__ = 'sanyi'
class IpsetError(Exception):
pass
class IpsetNotFound(Exception):
pass
class IpsetNoRights(Exception):
pass
class IpsetInvalidResponse(Exception):
pass
class IpsetCommandHangs(Exception):
pass
class IpsetSetNotFound(Exception):
pass
class IpsetEntryNotFound(Exc... | __author__ = 'sanyi'
class Ipseterror(Exception):
pass
class Ipsetnotfound(Exception):
pass
class Ipsetnorights(Exception):
pass
class Ipsetinvalidresponse(Exception):
pass
class Ipsetcommandhangs(Exception):
pass
class Ipsetsetnotfound(Exception):
pass
class Ipsetentrynotfound(Exception)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.