content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# In and is conditional
# Is
a = None
if a is None:
print("yes")
else:
print("No")
# In
a = [45,65,6]
print(45 in a) #The Result is True
print(46 in a) #The Result is false | a = None
if a is None:
print('yes')
else:
print('No')
a = [45, 65, 6]
print(45 in a)
print(46 in a) |
"""
This package contains various types of character controllers, handling basic
control mechanics and setting up collisions for them.
"""
| """
This package contains various types of character controllers, handling basic
control mechanics and setting up collisions for them.
""" |
class Header:
"""
3.2.1 Header
Transport headers for a message.
<type name="header" class="composite" source="list" provides="section">
<descriptor name="amqp:header:list" code="0x00000000:0x00000070"/>
<field name="durable" type="boolean" default="false"/>
<field name="priority... | class Header:
"""
3.2.1 Header
Transport headers for a message.
<type name="header" class="composite" source="list" provides="section">
<descriptor name="amqp:header:list" code="0x00000000:0x00000070"/>
<field name="durable" type="boolean" default="false"/>
<field name="priority... |
"""
A. As seen in the much yellower RSMs of the SimCLR encoder trained with only
2 negative pairs used in the contrastive loss, reducing the number of
negative pairs leads to a **substantial increase in the density of high
feature similarity values** (near 1). This is quantified in the histogram,
which sho... | """
A. As seen in the much yellower RSMs of the SimCLR encoder trained with only
2 negative pairs used in the contrastive loss, reducing the number of
negative pairs leads to a **substantial increase in the density of high
feature similarity values** (near 1). This is quantified in the histogram,
which show... |
_base_ = [
'../../_base_/datasets/mmcls/cifar10_bs96_cutout.py',
'../../_base_/mmcls_runtime.py'
]
model = dict(
type='mmcls.ImageClassifier',
backbone=dict(
type='DartsBackbone',
in_channels=3,
base_channels=36,
num_layers=20,
num_nodes=4,
stem_multiplie... | _base_ = ['../../_base_/datasets/mmcls/cifar10_bs96_cutout.py', '../../_base_/mmcls_runtime.py']
model = dict(type='mmcls.ImageClassifier', backbone=dict(type='DartsBackbone', in_channels=3, base_channels=36, num_layers=20, num_nodes=4, stem_multiplier=3, auxliary=True, aux_channels=128, aux_out_channels=768, out_indic... |
x = 15 / 100
y = 949
z = x * y
print(z) | x = 15 / 100
y = 949
z = x * y
print(z) |
class characters():
def __init__(self,Id,Nombre,Status,Species,Tipo,Origen,Location,Id_locacion,Episode,Id_episodio,Url):
self._Id = Id
self._Nombre = Nombre
self._Status = Status
self._Species = Species
self._Origen = Origen
self._Tipo = Tipo
self._Locat... | class Characters:
def __init__(self, Id, Nombre, Status, Species, Tipo, Origen, Location, Id_locacion, Episode, Id_episodio, Url):
self._Id = Id
self._Nombre = Nombre
self._Status = Status
self._Species = Species
self._Origen = Origen
self._Tipo = Tipo
self._... |
def all_equal(t):
"""
True if all elements in a table are equal.
"""
return not t[0] == ' ' and t[1:] == t[:-1]
def list_not_all_none(lst):
for el in lst:
if el is not None:
return True
return False
| def all_equal(t):
"""
True if all elements in a table are equal.
"""
return not t[0] == ' ' and t[1:] == t[:-1]
def list_not_all_none(lst):
for el in lst:
if el is not None:
return True
return False |
l = [1,2,3]
def oi(x):
return x == 2
a= list(filter(oi,l))
print(a) | l = [1, 2, 3]
def oi(x):
return x == 2
a = list(filter(oi, l))
print(a) |
"""
This file is part of web2py Web Framework (Copyrighted, 2007)
Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: GPL v2
"""
class Storage(dict):
"""
A Storage object is like a dictionary except `obj.foo` can be used
in addition to `obj['foo']`.
>>> o = Storage(a=1)
... | """
This file is part of web2py Web Framework (Copyrighted, 2007)
Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: GPL v2
"""
class Storage(dict):
"""
A Storage object is like a dictionary except `obj.foo` can be used
in addition to `obj['foo']`.
>>> o = Storage(a=1)
>... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module contains project version information.
.. currentmodule:: howmanychairs.version
.. moduleauthor:: Clemens Jochum <clemens@jochum.email>
"""
__version__ = "0.0.1" #: the working version
__release__ = "0.0.1" #: the release version
| """
This module contains project version information.
.. currentmodule:: howmanychairs.version
.. moduleauthor:: Clemens Jochum <clemens@jochum.email>
"""
__version__ = '0.0.1'
__release__ = '0.0.1' |
class Solution(object):
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
pre = ""
if not strs:
return pre
for i in range(len(strs[0])):
pre = strs[0][:i + 1]
for j in range(1, len(strs)):
... | class Solution(object):
def longest_common_prefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
pre = ''
if not strs:
return pre
for i in range(len(strs[0])):
pre = strs[0][:i + 1]
for j in range(1, len(strs)):
... |
class GeneratorInterface:
def __init__(self):
self.__params = {}
def register(self, name, type_, default):
if name in self.__params:
raise ValueError(f"param {name} already registered")
self.__params[name] = (type_, default,)
return self
@property
def params... | class Generatorinterface:
def __init__(self):
self.__params = {}
def register(self, name, type_, default):
if name in self.__params:
raise value_error(f'param {name} already registered')
self.__params[name] = (type_, default)
return self
@property
def param... |
n = int(input())
ls = list(map(int, input().split()))
ls.sort(reverse=True)
alice_point = 0
bob_point = 0
for i in range(n):
if i % 2 == 0:
alice_point += ls[i]
else:
bob_point += ls[i]
difference = alice_point - bob_point
print(difference)
| n = int(input())
ls = list(map(int, input().split()))
ls.sort(reverse=True)
alice_point = 0
bob_point = 0
for i in range(n):
if i % 2 == 0:
alice_point += ls[i]
else:
bob_point += ls[i]
difference = alice_point - bob_point
print(difference) |
# no completion must happen here
class Foo:
def bar(self):
__rxo
| class Foo:
def bar(self):
__rxo |
"""Humilis plug-in to deploy an AWS API Gateway proxy to AWS Kinesis."""
__version__ = "1.3.0"
__author__ = "German Gomez-Herrero, FindHotel BV"
| """Humilis plug-in to deploy an AWS API Gateway proxy to AWS Kinesis."""
__version__ = '1.3.0'
__author__ = 'German Gomez-Herrero, FindHotel BV' |
"""
LC 76
Given a string and a pattern, find the smallest substring in the given string which has all the characters of the given pattern.
Example 1:
Input: String="aabdec", Pattern="abc"
Output: "abdec"
Explanation: The smallest substring having all characters of the pattern is "abdec"
Example 2:
Input: String="abd... | """
LC 76
Given a string and a pattern, find the smallest substring in the given string which has all the characters of the given pattern.
Example 1:
Input: String="aabdec", Pattern="abc"
Output: "abdec"
Explanation: The smallest substring having all characters of the pattern is "abdec"
Example 2:
Input: String="abd... |
"""
Data Mapper class.
"""
class DataMapperValue:
"""
Data Mapper Value.
"""
def __init__(self, param: str, default='', parser=None):
"""
Construct Data Mapper Value.
"""
self.param = param
self.default = default
self._parser = parser
def parsed(sel... | """
Data Mapper class.
"""
class Datamappervalue:
"""
Data Mapper Value.
"""
def __init__(self, param: str, default='', parser=None):
"""
Construct Data Mapper Value.
"""
self.param = param
self.default = default
self._parser = parser
def parsed(sel... |
# pop_pais = [1,3,5,4]
# pop_pais = sorted(pop_pais, reverse=True)
# print(pop_pais)
#
# pop_pais = pop_pais[:2]
# print(pop_pais)
# teste mutacao
# individuo_aux = 'abcd'
# individuo_aux = list(individuo_aux)
# print(individuo_aux)
# i_gene = 0
# individuo_aux[i_gene] = 'teste'
# print(individuo_aux)
# individuo_aux ... | print(len('1.11011010000000000000')) |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache... | """ opts.py """
config_opts = dict()
verbose_flag = False
cleaned_up_files = []
def get_heron_config():
"""
Get config opts from the global variable
:return:
"""
opt_list = []
for (key, value) in list(config_opts.items()):
opt_list.append('%s=%s' % (key, value))
all_opts = ','.join(opt_li... |
class Solution:
def countTriples(self, n):
# precompute all powers from
pows = [x ** 2 for x in range(n)]
count = 0
for i in range(3, n - 1):
si = pows[i]
for j in range(i+1, n):
# c must be integer (perfect square)
m = sqrt(si ... | class Solution:
def count_triples(self, n):
pows = [x ** 2 for x in range(n)]
count = 0
for i in range(3, n - 1):
si = pows[i]
for j in range(i + 1, n):
m = sqrt(si + pows[j])
if m > n:
if j == i + 1:
... |
# https://leetcode.com/problems/range-sum-query-immutable/
class NumArray(object):
# Runtime: 81 ms, faster than 70.94% of Python online submissions for Range Sum Query - Immutable.
# Memory Usage: 17.2 MB, less than 52.30% of Python online submissions for Range Sum Query - Immutable.
def __init__(se... | class Numarray(object):
def __init__(self, nums):
"""
:type nums: List[int]
"""
self.lookupArray = [0] * (len(nums) + 1)
for i in range(len(nums)):
self.lookupArray[i + 1] = self.lookupArray[i] + nums[i]
def sum_range(self, left, right):
"""
... |
nested1 = [['a', 'b', 'c'],['d', 'e'],['f', 'g', 'h']]
for x in nested1:
print("level1: ")
for y in x:
print(" level2: " + y)
print("\n")
nested2 = [1, 2, ['a', 'b', 'c'],['d', 'e'],['f', 'g', 'h']]
for x in nested2:
print("level1: ")
if type(x) is list:
for y in x:
pri... | nested1 = [['a', 'b', 'c'], ['d', 'e'], ['f', 'g', 'h']]
for x in nested1:
print('level1: ')
for y in x:
print(' level2: ' + y)
print('\n')
nested2 = [1, 2, ['a', 'b', 'c'], ['d', 'e'], ['f', 'g', 'h']]
for x in nested2:
print('level1: ')
if type(x) is list:
for y in x:
p... |
# 10
# 100~~01 100~~\ 100~~\ 000~0\ 0000 / 000~0001 _100__
# d000 001 d000 1000 000 0000/ 000 0000 000
# 0000__000 0000 0000 000 00/ 000 0000 000
# 1000 , 1000 1000 000 0 000 0000 000
# "00___/ "00__/ 100__/ ... | """Easy Crypt.
Easy encryption and decryption.
"""
__title__ = 'eccrypt'
__version__ = '0.0.6'
__author__ = 'Pierpaolo Rasicci'
__copyright__ = 'Copyright (c) 2017 iSar'
__license__ = 'MIT' |
def SSN():
ssndict = {}
while(True):
sname = input('Name: ')
# if no name entered print list and end.
if sname == '':
for key in ssndict:
print(key + ' has SSN ' + ssndict[key])
return
elif sname not in ssndict:
ssn ... | def ssn():
ssndict = {}
while True:
sname = input('Name: ')
if sname == '':
for key in ssndict:
print(key + ' has SSN ' + ssndict[key])
return
elif sname not in ssndict:
ssn = input('SSN for ' + sname + ': ')
ssndict[sname] ... |
def findZeroSum(arr):
length = len(arr)
if length < 3:
return []
elif length == 3:
if arr[0] + arr[1] + arr[2] == 0:
return [",".join([str(s) for s in arr])]
else:
return []
arr.sort()
results = []
for i, num in enumerate(arr[:-2]):
if i >... | def find_zero_sum(arr):
length = len(arr)
if length < 3:
return []
elif length == 3:
if arr[0] + arr[1] + arr[2] == 0:
return [','.join([str(s) for s in arr])]
else:
return []
arr.sort()
results = []
for (i, num) in enumerate(arr[:-2]):
if ... |
class ItemContainerTemplateSelector(object):
# no doc
def SelectTemplate(self,item,parentItemsControl):
""" SelectTemplate(self: ItemContainerTemplateSelector,item: object,parentItemsControl: ItemsControl) -> DataTemplate """
pass
| class Itemcontainertemplateselector(object):
def select_template(self, item, parentItemsControl):
""" SelectTemplate(self: ItemContainerTemplateSelector,item: object,parentItemsControl: ItemsControl) -> DataTemplate """
pass |
# Maximum Depth of Binary Tree
'''
Given the root of a binary tree, return its maximum depth.
A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
Example 1:
Input: root = [3,9,20,null,null,15,7]
Output: 3
Example 2:
Input: root = [1,nul... | """
Given the root of a binary tree, return its maximum depth.
A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
Example 1:
Input: root = [3,9,20,null,null,15,7]
Output: 3
Example 2:
Input: root = [1,null,2]
Output: 2
Example 3:
Input... |
A = int(input())
B = int(input())
print(A // B)
print(A / B)
| a = int(input())
b = int(input())
print(A // B)
print(A / B) |
WINDOW_SIZE = 10000
KMER_SIZE = 6
UPPER_THRESHOLD = 0.85
LOWER_THRESHOLD = 0.50
TUNE_METRIC = 1000
MINIMUM_GI_SIZE = 10000
| window_size = 10000
kmer_size = 6
upper_threshold = 0.85
lower_threshold = 0.5
tune_metric = 1000
minimum_gi_size = 10000 |
# -*- coding: utf-8 -*-
__author__ = 'yshao'
def _truncate_seq_pair(tokens_a, tokens_b, max_length):
"""Truncates a sequence pair in place to the maximum length."""
# This is a simple heuristic which will always truncate the longer sequence
# one token at a time. This makes more sense than trunca... | __author__ = 'yshao'
def _truncate_seq_pair(tokens_a, tokens_b, max_length):
"""Truncates a sequence pair in place to the maximum length."""
while True:
total_length = len(tokens_a) + len(tokens_b)
if total_length <= max_length:
break
if len(tokens_a) > len(tokens_b):
... |
'''
A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence at most once. Note that the path does not need to pass through the root.
The path sum of a path is the sum of the node's values in the path.
Given th... | """
A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence at most once. Note that the path does not need to pass through the root.
The path sum of a path is the sum of the node's values in the path.
Given th... |
S = input().strip()
L = len(S)
vowels = 'AEIOU'
score_vowels = 0
score_consonants = 0
for i in range(L):
# total sub strings which begin at this index
# As start position is fixed, only count each possibility of length.
total = L - i
if S[i] in vowels:
score_vowels = score_vowels + total
... | s = input().strip()
l = len(S)
vowels = 'AEIOU'
score_vowels = 0
score_consonants = 0
for i in range(L):
total = L - i
if S[i] in vowels:
score_vowels = score_vowels + total
else:
score_consonants = score_consonants + total
if score_consonants > score_vowels:
print('Stuart %d' % score_co... |
#! /usr/bin/env python3
# __author__ = "Praneesh Kataru"
# __credits__ = []
# __version__ = "0.1.1"
# __maintainer__ = "Praneesh Kataru"
# __email__ = "pranuvitmsse05@gmail.com"
# __status__ = "Prototype"
class UserTopicManager:
def __init__(self):
self.__topic_users_dict = dict()
... | class Usertopicmanager:
def __init__(self):
self.__topic_users_dict = dict()
self.__topic_users_dict['praneesh'] = u'com.quickstocks.publisher.praneesh'
self.__topic_users_dict['restofworld'] = u'com.quickstocks.publisher.restofworld'
def get_user_topic_endpoint(self, user_id):
... |
numbers =[7,-3,20]
def bits_war(numbers):
odd, even = "", ""
for i in numbers:
if i%2 == 1:
odd += bin(i)[2:]
else:
even += bin(i)[2:]
if int(odd, 2) > int(even, 2):
return "odds win"
elif int(even, 2) > int(odd, 2):
return "even win"
else:
... | numbers = [7, -3, 20]
def bits_war(numbers):
(odd, even) = ('', '')
for i in numbers:
if i % 2 == 1:
odd += bin(i)[2:]
else:
even += bin(i)[2:]
if int(odd, 2) > int(even, 2):
return 'odds win'
elif int(even, 2) > int(odd, 2):
return 'even win'
... |
class Entity(object):
def __init__(self, id):
self._id = id
def __eq__(self, other):
return self.id == other.id
def __ne__(self, other):
return not self == other
@property
def id(self):
return self._id
| class Entity(object):
def __init__(self, id):
self._id = id
def __eq__(self, other):
return self.id == other.id
def __ne__(self, other):
return not self == other
@property
def id(self):
return self._id |
class Solution:
def finalPrices(self, prices: List[int]) -> List[int]:
result = []
for i in range(len(prices) - 1):
dp = prices[i]
change = False
for j in range(i+1, len(prices)):
if (prices[i] - prices[j] >= 0) & (change == False):
... | class Solution:
def final_prices(self, prices: List[int]) -> List[int]:
result = []
for i in range(len(prices) - 1):
dp = prices[i]
change = False
for j in range(i + 1, len(prices)):
if (prices[i] - prices[j] >= 0) & (change == False):
... |
def main():
id = 123
print('foo', id)
main()
| def main():
id = 123
print('foo', id)
main() |
str=str(input("Enter string to check Palindrome or not :"))
rev_str=reversed(str)
if list(str)==list(rev_str):
print("Palindrome")
else:
print("Not Palindrome")
| str = str(input('Enter string to check Palindrome or not :'))
rev_str = reversed(str)
if list(str) == list(rev_str):
print('Palindrome')
else:
print('Not Palindrome') |
#
# PySNMP MIB module TUBS-NFS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TUBS-NFS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:20:38 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,... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, single_value_constraint, constraints_intersection, value_size_constraint) ... |
# fixtures.py
# Author: Thomas MINIER - MIT License 2017-2019
def index_scan_fixtures():
"""Get fixtures data for testing Index scans"""
return [
# spo
(
'http://db.uwaterloo.ca/~galuc/wsdbm/City102',
'http://www.geonames.org/ontology#parentCountry',
'http:/... | def index_scan_fixtures():
"""Get fixtures data for testing Index scans"""
return [('http://db.uwaterloo.ca/~galuc/wsdbm/City102', 'http://www.geonames.org/ontology#parentCountry', 'http://db.uwaterloo.ca/~galuc/wsdbm/Country17', [('http://db.uwaterloo.ca/~galuc/wsdbm/City102', 'http://www.geonames.org/ontology... |
DEFAULT_CHECK_COMMAND = "which"
WINDOWS_CHECK_COMMAND = "where"
TESSERACT_DATA_PATH_VAR = 'TESSDATA_PREFIX'
VALID_IMAGE_EXTENSIONS = [".jpg", ".jpeg", ".gif", ".png", ".tga", ".tif", ".bmp"]
| default_check_command = 'which'
windows_check_command = 'where'
tesseract_data_path_var = 'TESSDATA_PREFIX'
valid_image_extensions = ['.jpg', '.jpeg', '.gif', '.png', '.tga', '.tif', '.bmp'] |
# Autogenerated config.py
# Documentation:
# qute://help/configuring.html
# qute://help/settings.html
# Uncomment this to still load settings configured via autoconfig.yml
config.load_autoconfig()
# Enable JavaScript.
# Type: Bool
config.set('content.javascript.enabled', True, 'file://*')
# Enable JavaScript.
# ... | config.load_autoconfig()
config.set('content.javascript.enabled', True, 'file://*')
config.set('content.javascript.enabled', True, 'chrome://*/*')
config.set('content.javascript.enabled', True, 'qute://*/*') |
for _ in range(int(input())):
s = sorted(input())
print(("no", "yes")[len(s) == len(set(s)) == (1 + ord(s[-1]) - ord(s[0]))])
| for _ in range(int(input())):
s = sorted(input())
print(('no', 'yes')[len(s) == len(set(s)) == 1 + ord(s[-1]) - ord(s[0])]) |
class AbstractException(Exception):
"""Abstract exception to inherit from.
**Attributes**
:msg: Exception message. [str]
:desc: Exception description. [str]
"""
def __init__(self, msg, desc=None):
"""Constructor for 'AbstractException' exception.
**Args**
:... | class Abstractexception(Exception):
"""Abstract exception to inherit from.
**Attributes**
:msg: Exception message. [str]
:desc: Exception description. [str]
"""
def __init__(self, msg, desc=None):
"""Constructor for 'AbstractException' exception.
**Args**
:... |
prsnt_world_map = 0
prsnt_all_items = 1
prsnt_killcount = 2
prsnt_upgrade_troops = 3
prsnt_mini_map = 4
prsnt_game_credits = 5
prsnt_game_profile_banner_selection = 6
prsnt_game_custom_battle_designer = 7
prsnt_game_multiplayer_admin_panel = 8
prsnt_multiplayer_welcome_message = 9
prsnt_multiplayer_team_select = 10
prs... | prsnt_world_map = 0
prsnt_all_items = 1
prsnt_killcount = 2
prsnt_upgrade_troops = 3
prsnt_mini_map = 4
prsnt_game_credits = 5
prsnt_game_profile_banner_selection = 6
prsnt_game_custom_battle_designer = 7
prsnt_game_multiplayer_admin_panel = 8
prsnt_multiplayer_welcome_message = 9
prsnt_multiplayer_team_select = 10
prs... |
string = str(input("Enter the string:"))
L = len(string)
for i in range(L, 0, -1):
for j in range(L):
if string[i] == string[j]:
print("Palindrome.")
else:
print("Not Palindrome.")
| string = str(input('Enter the string:'))
l = len(string)
for i in range(L, 0, -1):
for j in range(L):
if string[i] == string[j]:
print('Palindrome.')
else:
print('Not Palindrome.') |
# You must configure these 3 values from Google APIs console
# https://code.google.com/apis/console
GOOGLE_CLIENT_ID = ""
GOOGLE_CLIENT_SECRET = ""
# the local path for the redirect URL you set in the APIs Console
GOOGLE_REDIRECT_URI = "/oauth2callback"
# Restrict logins to users from this GApps domain
GOOGLE_DOMAIN_CH... | google_client_id = ''
google_client_secret = ''
google_redirect_uri = '/oauth2callback'
google_domain_check = 'example.com'
tkt_domain = '.internal.example.com'
tkt_cookie = 'auth_pubtkt'
tkt_expiry = 86400
tkt_private_key = '/path/to/mod_auth_pubtkt/keys/privkey.pem'
tkt_public_key = '/path/to/mod_auth_pubtkt/keys/pub... |
DEFAULT_OUTPUT_FORMAT = 'msi'
class WindowsMixin:
platform = 'windows'
| default_output_format = 'msi'
class Windowsmixin:
platform = 'windows' |
largest = -1
smallest = None
largest=int(largest)
while True:
num = input("Enter a number: ")
if num == "done" : break
try:
n=int(num)
except:
print('Invalid input')
continue
if n > largest :
largest=n
if smallest is None :
smallest=n
elif n<smallest :... | largest = -1
smallest = None
largest = int(largest)
while True:
num = input('Enter a number: ')
if num == 'done':
break
try:
n = int(num)
except:
print('Invalid input')
continue
if n > largest:
largest = n
if smallest is None:
smallest = n
elif... |
"""Meta and miscellaneous rules."""
load("@bazel_skylib//rules:build_test.bzl", _build_test = "build_test")
load("@bazel_skylib//:bzl_library.bzl", _bzl_library = "bzl_library")
build_test = _build_test
bzl_library = _bzl_library
more_shards = 4
most_shards = 8
version = "//tools/bazeldefs:version"
def short_path(pa... | """Meta and miscellaneous rules."""
load('@bazel_skylib//rules:build_test.bzl', _build_test='build_test')
load('@bazel_skylib//:bzl_library.bzl', _bzl_library='bzl_library')
build_test = _build_test
bzl_library = _bzl_library
more_shards = 4
most_shards = 8
version = '//tools/bazeldefs:version'
def short_path(path):
... |
"""Package for processing Timeline project files.
Modules:
tl_file -- Provide a class for Timeline project file representation.
scene_event -- Provide a class for Timeline scene event representation.
dt_helper -- Provide helper functions for date/time processing.
tl_converter -- Provide a converter class for y... | """Package for processing Timeline project files.
Modules:
tl_file -- Provide a class for Timeline project file representation.
scene_event -- Provide a class for Timeline scene event representation.
dt_helper -- Provide helper functions for date/time processing.
tl_converter -- Provide a converter class for yWriter ... |
# -*- coding: utf-8 -*-
# (c) 2008-2010, Marcin Kasperski
"""
Embedded-id trick handling. See Topic.get_embedded_id for description
"""
PFX_EMBEDDED = "afaf"
PFX_OTHER = "bfbf"
PFX_LEN = 4
def qualify_id(id_text):
"""
Check given id_text for embedded id. Returns it if present,
otherwise ret... | """
Embedded-id trick handling. See Topic.get_embedded_id for description
"""
pfx_embedded = 'afaf'
pfx_other = 'bfbf'
pfx_len = 4
def qualify_id(id_text):
"""
Check given id_text for embedded id. Returns it if present,
otherwise return None.
"""
if id_text.startswith(PFX_EMBEDDED):
length ... |
"""
entradas:
ValorA-->int-->A
ValorB-->int-->B
ValorC-->int-->C
ValorD-->int-->D
Salidas:
valor-->str->v
"""
datos = input("Ingresar las variables A,B,C D: ").split()
a, b, c, d = datos
a = int(a)
b = int(b)
c = int(c)
d = int(d)
p = a * 1000
s = b*100
t = c*10
c = d*1
den = p+s+t+c
v = round(den, -2)
print("El valor ... | """
entradas:
ValorA-->int-->A
ValorB-->int-->B
ValorC-->int-->C
ValorD-->int-->D
Salidas:
valor-->str->v
"""
datos = input('Ingresar las variables A,B,C D: ').split()
(a, b, c, d) = datos
a = int(a)
b = int(b)
c = int(c)
d = int(d)
p = a * 1000
s = b * 100
t = c * 10
c = d * 1
den = p + s + t + c
v = round(den, -2)
pr... |
#
# @lc app=leetcode id=722 lang=python3
#
# [722] Remove Comments
#
# @lc code=start
class Solution(object):
def removeComments(self, source):
"""
:type source: List[str]
:rtype: List[str]
"""
res, buffer, block_comment_open = [], '', False
for line in source:
... | class Solution(object):
def remove_comments(self, source):
"""
:type source: List[str]
:rtype: List[str]
"""
(res, buffer, block_comment_open) = ([], '', False)
for line in source:
i = 0
while i < len(line):
char = line[i]
... |
# Copyright 2015 IBM Corp.
#
# 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. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | """Wrappers used for multiple types of PCM data."""
class Info(object):
def __init__(self, utilInfo):
self.version = utilInfo.get('version')
self.metric_type = utilInfo.get('metricType')
self.monitoring_type = utilInfo.get('monitoringType')
self.mtms = utilInfo.get('mtms')
... |
# Universal class for Place instances in Helsinki API
class Place:
def __init__(self, name='', address='', desc='', lat=0.0, lon=0.0, link=None, img_link=None):
self.name = name
self.address = address
self.desc = desc
self.lat = lat
self.lon = lon
self.open_hours = [... | class Place:
def __init__(self, name='', address='', desc='', lat=0.0, lon=0.0, link=None, img_link=None):
self.name = name
self.address = address
self.desc = desc
self.lat = lat
self.lon = lon
self.open_hours = []
self.tags = []
self.link = link
... |
#----------------------------------------------------------------------------
# Copyright (c) Kauai Labs 2015. All Rights Reserved.
#
# Created in support of Team 2465 (Kauaibots). Go Purple Wave!
#
# Open Source Software - may be modified and shared by FRC teams. Any
# modifications to this code must be accompanied b... | class Continuousangletracker:
def __init__(self):
self.last_angle = 0.0
self.zero_crossing_count = 0
self.last_rate = 0
def next_angle(self, newAngle):
adjusted_last_angle = self.last_angle + 360.0 if self.last_angle < 0.0 else self.last_angle
adjusted_curr_angle = newA... |
#
# PySNMP MIB module Unisphere-Data-ROUTER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-ROUTER-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:30:22 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, value_range_constraint, single_value_constraint, constraints_intersection) ... |
def foo():
"""
Docstring for the function
:return: int
"""
print(42)
return 42
print(42)
res = 42 | def foo():
"""
Docstring for the function
:return: int
"""
print(42)
return 42
print(42)
res = 42 |
cookies_pool = [
"JSESSIONID=36B4E30CDFE059235541CC81C91743A3; bili_jct=520c3f01daf4d9732fdeb9d95586612c; SESSDATA=4b484445%2C1616518159%2Ca3c73*91; DedeUserID=416679427; sid=7r9xx2ji; buvid3=CDCFA651-49CB-4A84-B114-D107F6AD0B2E138364infoc; DedeUserID__ckMd5=a64ed305aa816673; _uuid=A60FD75F-122D-851F-7994-2DD115831... | cookies_pool = ['JSESSIONID=36B4E30CDFE059235541CC81C91743A3; bili_jct=520c3f01daf4d9732fdeb9d95586612c; SESSDATA=4b484445%2C1616518159%2Ca3c73*91; DedeUserID=416679427; sid=7r9xx2ji; buvid3=CDCFA651-49CB-4A84-B114-D107F6AD0B2E138364infoc; DedeUserID__ckMd5=a64ed305aa816673; _uuid=A60FD75F-122D-851F-7994-2DD11583170748... |
# encoding: utf-8
# module Autodesk.Revit.DB.Macros calls itself Macros
# from RevitAPI, Version=17.0.0.0, Culture=neutral, PublicKeyToken=null
# by generator 1.145
# no doc
# no imports
# no functions
# classes
class AddInIdAttribute(Attribute, _Attribute):
"""
The custom AddInId attribute for ... | class Addinidattribute(Attribute, _Attribute):
"""
The custom AddInId attribute for Macros macros use only.
AddInIdAttribute(addInIdStr: str)
"""
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__... |
dice_progression = ["d4", "d6", "d8", "d10", "d12"]
def display_dice(val):
"""
Converts a die-level into a more friendly dice-pool
:param int val: The die-level to display
:return str: pretty-printed dice value (eg: d4)
"""
d = ""
while val > 5:
val -= 5
d += "d12 "
if ... | dice_progression = ['d4', 'd6', 'd8', 'd10', 'd12']
def display_dice(val):
"""
Converts a die-level into a more friendly dice-pool
:param int val: The die-level to display
:return str: pretty-printed dice value (eg: d4)
"""
d = ''
while val > 5:
val -= 5
d += 'd12 '
if v... |
NUM_EPOCHS = 12
BATCH_SIZE = 64
LEARNING_RATE = 0.001
N_PIXEL = 784 # 28x28 | num_epochs = 12
batch_size = 64
learning_rate = 0.001
n_pixel = 784 |
def profile(request):
"""
This context processor adds a user's userprofile to the context if a user
is logged in.
"""
#This context processor is used by the RequestContext, see the settings.py
# TEMPLATE_CONTEXT_PROCESSORS variable for the other context processors.
if request.user.is_authe... | def profile(request):
"""
This context processor adds a user's userprofile to the context if a user
is logged in.
"""
if request.user.is_authenticated():
return {'userprofile': request.user.get_profile()}
else:
return {} |
""" Python module for the grid and a position in a grid """
class Grid(object):
""" This grid represents a rectangular plateau """
def __init__(self, max_x, max_y):
""" Initialize rover """
if type(max_x) != int:
raise ValueError(u'Max coordinate for X axis is not a number ')
... | """ Python module for the grid and a position in a grid """
class Grid(object):
""" This grid represents a rectangular plateau """
def __init__(self, max_x, max_y):
""" Initialize rover """
if type(max_x) != int:
raise value_error(u'Max coordinate for X axis is not a number ')
... |
class ConsoleLogger:
def __init__(self, config):
self.interval = config['logging_interval']
def output(self, timestep, message):
if (timestep % self.interval) == 0:
print(message)
| class Consolelogger:
def __init__(self, config):
self.interval = config['logging_interval']
def output(self, timestep, message):
if timestep % self.interval == 0:
print(message) |
def result_calculator(data, multiplier):
impact = {}
# number of infected people in days from now
reported_cases = data.get('reportedCases')
impact['currentlyInfected'] = reported_cases * multiplier
total_number_of_days = data['timeToElapse']
periods_multplier = {'weeks': 7, 'months': 30}
... | def result_calculator(data, multiplier):
impact = {}
reported_cases = data.get('reportedCases')
impact['currentlyInfected'] = reported_cases * multiplier
total_number_of_days = data['timeToElapse']
periods_multplier = {'weeks': 7, 'months': 30}
if data['periodType'] in periods_multplier.keys():
... |
"""Parsers for TBGScraper."""
__all__="lxml html".split() # Laziology
# IDEA: a HTML parser via regex?
| """Parsers for TBGScraper."""
__all__ = 'lxml html'.split() |
features_all = [ #Gender
#'GENDER',
# Education
'PRESENT STATE 13-46: (016) AGE LEFT SCHOOL',
'MOCA: YEARS OF EDUCATION',
'PRESENT STATE 13-46: (017) YEARS IN FU... | features_all = ['PRESENT STATE 13-46: (016) AGE LEFT SCHOOL', 'MOCA: YEARS OF EDUCATION', 'PRESENT STATE 13-46: (017) YEARS IN FURTHER EDUCATION', 'HISTORY PATIENT 74-119: (076) HISTORY OF STROKE', 'MEDICAL ASSESSMENT V 2010: STROKE', 'HACHINSKI ISCHAEMIC: HISTORY OF STROKE', 'OPTIMA DIAGNOSES V 2010: CERBRO-VASCULAR D... |
# from https://github.com/allenai/hidden-networks
USABLE_TYPES = set([float, int])
def trim_preceding_hyphens(st):
i = 0
while st[i] == "-":
i += 1
return st[i:]
def arg_to_varname(st: str):
st = trim_preceding_hyphens(st)
st = st.replace("-", "_")
return st.split("=")[0]
def ar... | usable_types = set([float, int])
def trim_preceding_hyphens(st):
i = 0
while st[i] == '-':
i += 1
return st[i:]
def arg_to_varname(st: str):
st = trim_preceding_hyphens(st)
st = st.replace('-', '_')
return st.split('=')[0]
def argv_to_vars(argv):
var_names = []
for arg in argv... |
# Demo Python Dictionaries - Dictionary
'''
Loop Through a Dictionary
You can loop through a dictionary by using a for loop.
When looping through a dictionary, the return value are the keys of the dictionary, but there are methods to return the values as well.
'''
# Print all key names in the dictionary, one by one... | """
Loop Through a Dictionary
You can loop through a dictionary by using a for loop.
When looping through a dictionary, the return value are the keys of the dictionary, but there are methods to return the values as well.
"""
thisdict = {'brand': 'TOYOTA', 'model': 'LAND CRUISER', 'year': 2020}
print(thisdict)
for x ... |
N,K=map(int,input().split())
H=list(map(int,input().split()))
count=0
for h in H:
if h>=K:
count+=1
print(count) | (n, k) = map(int, input().split())
h = list(map(int, input().split()))
count = 0
for h in H:
if h >= K:
count += 1
print(count) |
def main():
print("\nDecimal to Roman numeral converter")
numbers = input("Number to convert: ")
numerals = {
0 : "I", # 1
1 : "V", # 5
2 : "X", # 10
3 : "L", # 50
4 : "C", # 100
5 : "D", # 500
6 : "M" # 1000
}
answer = ""
numeralpointer =... | def main():
print('\nDecimal to Roman numeral converter')
numbers = input('Number to convert: ')
numerals = {0: 'I', 1: 'V', 2: 'X', 3: 'L', 4: 'C', 5: 'D', 6: 'M'}
answer = ''
numeralpointer = 0
for number in reversed(numbers):
if int(number) < 4:
answer = int(number) * nume... |
API_FACE_UUID = "uuid"
API_FACE_USE_MODEL = "model" # for future which model to use
API_FACE_NAME = "name"
API_FACE_ENCODINGS = "encodings"
API_FACE_UNCATEGORIZED_IMAGE = "uncategorized_image"
API_FACE_CHECK_ALL = "check_all"
API_FACE_GALLERY = "gallery"
API_FACE_GALLERIES = "galleries"
API_FACE_TOLERANCE = "tolerance... | api_face_uuid = 'uuid'
api_face_use_model = 'model'
api_face_name = 'name'
api_face_encodings = 'encodings'
api_face_uncategorized_image = 'uncategorized_image'
api_face_check_all = 'check_all'
api_face_gallery = 'gallery'
api_face_galleries = 'galleries'
api_face_tolerance = 'tolerance'
api_face_found_faces = 'found_f... |
#!/usr/bin/env python
# # -*- coding: utf-8 -*-
"""
Utilities
"""
__copyright__ = 'Copyright (C) 2014-2015 by E.R. Uber'
__author__ = 'E.R. Uber (eruber@gmail.com)'
__license__ = 'ISCL'
__version__ = '0.0.0'
#-------------------------------------------------------------------------------
#-------------------... | """
Utilities
"""
__copyright__ = 'Copyright (C) 2014-2015 by E.R. Uber'
__author__ = 'E.R. Uber (eruber@gmail.com)'
__license__ = 'ISCL'
__version__ = '0.0.0'
def format_args_namespace(args, namespace_name='args'):
"""
Returns a formatted string of argparse's args namespace for easy reading
"""
pad =... |
class Val:
def __init__(self, val):
self.val = val
def __repr__(self):
return 'Val(%s)' % self.val.__repr__()
class Array:
def __init__(self, shape):
self.shape = shape
def __repr__(self):
return 'Array%s' % self.shape.__repr__()
def idl_repr(self):
s = '[... | class Val:
def __init__(self, val):
self.val = val
def __repr__(self):
return 'Val(%s)' % self.val.__repr__()
class Array:
def __init__(self, shape):
self.shape = shape
def __repr__(self):
return 'Array%s' % self.shape.__repr__()
def idl_repr(self):
s = ... |
class BulkBankValidation:
end_point = "/payout/v1/bulkValidation/bankDetails"
req_type = "POST"
def __init__(self, *args, **kwargs):
self.bulkValidationId = kwargs["bulkValidationId"]
self.entries = kwargs["entries"] | class Bulkbankvalidation:
end_point = '/payout/v1/bulkValidation/bankDetails'
req_type = 'POST'
def __init__(self, *args, **kwargs):
self.bulkValidationId = kwargs['bulkValidationId']
self.entries = kwargs['entries'] |
#
# PySNMP MIB module HP-ICF-OSPF (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-OSPF
# Produced by pysmi-0.3.4 at Wed May 1 13:34:55 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, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, constraints_union, value_size_constraint, constraints_intersection) ... |
#!/usr/bin/env python
# This script is intended to be run from within the OSCar MIDI Sysex Grammar file
currentGrammar = currentMapper.getCurrentGrammar()
multiByteID = currentGrammar.getStructureByName("Multi Byte ID")
singleByteID = currentGrammar.getStructureByName("Single Byte ID")
currentPos = currentMapper.get... | current_grammar = currentMapper.getCurrentGrammar()
multi_byte_id = currentGrammar.getStructureByName('Multi Byte ID')
single_byte_id = currentGrammar.getStructureByName('Single Byte ID')
current_pos = currentMapper.getCurrentOffset()
byte_view = currentMapper.getCurrentByteView()
byte = byteView.readByte(currentPos)
i... |
#
# @lc app=leetcode id=37 lang=python3
#
# [37] Sudoku Solver
#
# @lc code=start
class Solution:
# @param board, a 9x9 2D array
# Solve the Sudoku by modifying the input board in-place.
# Do not return any value.
def solveSudoku(self, board):
def isValid(x,y):
tmp=board[x][y]; boa... | class Solution:
def solve_sudoku(self, board):
def is_valid(x, y):
tmp = board[x][y]
board[x][y] = 'D'
for i in range(9):
if board[i][y] == tmp:
return False
for i in range(9):
if board[x][i] == tmp:
... |
""" Registry.
This implementation was borrowed from happy[1] project by Chris Rossi.
[1]: http://bitbucket.org/chrisrossi/happy
"""
__all__ = ["Registry", "SimpleAxis", "TypeAxis"]
class Registry(object):
""" Registry implementation."""
def __init__(self, *axes):
self._tree = _TreeNode()
s... | """ Registry.
This implementation was borrowed from happy[1] project by Chris Rossi.
[1]: http://bitbucket.org/chrisrossi/happy
"""
__all__ = ['Registry', 'SimpleAxis', 'TypeAxis']
class Registry(object):
""" Registry implementation."""
def __init__(self, *axes):
self._tree = __tree_node()
s... |
def search_in_list(letter, list):
answer = ["error", "correct format"]
for s in list:
if letter == s:
answer = ["ok", "correct format"]
return answer
#validates that the input have the format we want
def validate_format(card):
number = len(card)
list1 = ["2", "3", "4", "... | def search_in_list(letter, list):
answer = ['error', 'correct format']
for s in list:
if letter == s:
answer = ['ok', 'correct format']
return answer
def validate_format(card):
number = len(card)
list1 = ['2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A']
list2... |
# Uso do While
cont = 0
while cont == 100:
print(cont)
cont += 1 | cont = 0
while cont == 100:
print(cont)
cont += 1 |
class Solution:
def killProcess(self, pid, ppid, kill):
indexes, res = collections.defaultdict(list), [kill]
for i, p in enumerate(ppid):
indexes[p].append(i)
stack = [kill]
while stack:
for i in indexes[stack.pop()]:
res.append(pid[i])
... | class Solution:
def kill_process(self, pid, ppid, kill):
(indexes, res) = (collections.defaultdict(list), [kill])
for (i, p) in enumerate(ppid):
indexes[p].append(i)
stack = [kill]
while stack:
for i in indexes[stack.pop()]:
res.append(pid[i])... |
def load(h):
return ({'abbr': 192, 'code': 192, 'title': 'Reserved for local use'},
{'abbr': 193, 'code': 193, 'title': 'Reserved for local use'},
{'abbr': 194, 'code': 194, 'title': 'Reserved for local use'},
{'abbr': 195, 'code': 195, 'title': 'Reserved for local use'},
... | def load(h):
return ({'abbr': 192, 'code': 192, 'title': 'Reserved for local use'}, {'abbr': 193, 'code': 193, 'title': 'Reserved for local use'}, {'abbr': 194, 'code': 194, 'title': 'Reserved for local use'}, {'abbr': 195, 'code': 195, 'title': 'Reserved for local use'}, {'abbr': 196, 'code': 196, 'title': 'Reserv... |
"""a binary search tree, in which for every node x
and it's left and right nodes y and z, respectively.
y <= x >= z"""
class BinaryTreeNode:
"""docstring for BT Node"""
def __init__(self, data=None, left=None, right=None):
self.data = data
self.left = left
self.right = right
# TRAVERSING OPERATION
def preor... | """a binary search tree, in which for every node x
and it's left and right nodes y and z, respectively.
y <= x >= z"""
class Binarytreenode:
"""docstring for BT Node"""
def __init__(self, data=None, left=None, right=None):
self.data = data
self.left = left
self.right = right
def preo... |
"""
Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between i and j equals the distance between i and k (the order of the tuple matters).
Find the number of boomerangs. You may assume that n will be at most 500 and coordinates of points ar... | """
Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between i and j equals the distance between i and k (the order of the tuple matters).
Find the number of boomerangs. You may assume that n will be at most 500 and coordinates of points ar... |
#
# Copyright (C) 2018 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | model = model()
in0 = input('op1', 'TENSOR_FLOAT32', '{3, 1}')
weights = parameter('op2', 'TENSOR_FLOAT32', '{1, 1}', [2])
bias = parameter('b0', 'TENSOR_FLOAT32', '{1}', [4])
out0 = output('op3', 'TENSOR_FLOAT32', '{3, 1}')
act = int32_scalar('act', 0)
model = model.Operation('FULLY_CONNECTED', in0, weights, bias, act... |
class SimpleEdge():
vertex_a = None
vertex_b = None
name = None
def __init__(self, name=None, vertex_a=None, vertex_b=None):
if (name == None):
name = vertex_a.__str__() + vertex_b.__str__()
self.name = name
self.vertex_a = vertex_a
self.vertex_b = vertex_b
... | class Simpleedge:
vertex_a = None
vertex_b = None
name = None
def __init__(self, name=None, vertex_a=None, vertex_b=None):
if name == None:
name = vertex_a.__str__() + vertex_b.__str__()
self.name = name
self.vertex_a = vertex_a
self.vertex_b = vertex_b
... |
program_name = "Matheus's Calculator"
print(f'{program_name:#^30}')
numeric_operator = ''
sair = ''
while True:
try:
number_1 = float(input('Enter a number:'))
except:
print('Invalid character')
continue
try:
number_2 = float(input('Enter another number: '))
except:
... | program_name = "Matheus's Calculator"
print(f'{program_name:#^30}')
numeric_operator = ''
sair = ''
while True:
try:
number_1 = float(input('Enter a number:'))
except:
print('Invalid character')
continue
try:
number_2 = float(input('Enter another number: '))
except:
... |
class Solution:
def __init__(self):
self.xMoves = [2, 1, -1, -2, -2, -1, 1, 2]
self.yMoves = [1, 2, 2, 1, -1, -2, -2, -1]
def solveKKnight(self, N):
self.N = N
self.board = [[-1] * N for x in range(N)]
self.board[0][0] = 0
resExist = self.solveKKnightUtil(0,... | class Solution:
def __init__(self):
self.xMoves = [2, 1, -1, -2, -2, -1, 1, 2]
self.yMoves = [1, 2, 2, 1, -1, -2, -2, -1]
def solve_k_knight(self, N):
self.N = N
self.board = [[-1] * N for x in range(N)]
self.board[0][0] = 0
res_exist = self.solveKKnightUtil(0, ... |
for x in range(10):
print('from 0 to 9:')
print(x)
print('\n')
for x in range(5, 12):
print('from 5 to 11:')
print (x)
print('\n')
# 3 numbers are used to put the range and the last number signifies the amount of plus need to be added to each number
for x in range(10, 40, 5):
print('... | for x in range(10):
print('from 0 to 9:')
print(x)
print('\n')
for x in range(5, 12):
print('from 5 to 11:')
print(x)
print('\n')
for x in range(10, 40, 5):
print('from 10 to 40 in plus 5 terms:')
print(x) |
# process local states
local = range(34)
# L states
L = {"x0" : [0, 16], "x1" : [1, 17], "k0" : [22], "k1" : [23], "kf" : [30], "m0" : [4, 5, 20, 21], "m1" : [3, 5, 19, 21]}
# initial states
initial = [0, 1, 16, 17, 26, 27]
# rules
rules = []
rules.append({'idx': 0, 'from': 0, 'to': 2, 'guard': "(and (< x0 (- n t)) (<... | local = range(34)
l = {'x0': [0, 16], 'x1': [1, 17], 'k0': [22], 'k1': [23], 'kf': [30], 'm0': [4, 5, 20, 21], 'm1': [3, 5, 19, 21]}
initial = [0, 1, 16, 17, 26, 27]
rules = []
rules.append({'idx': 0, 'from': 0, 'to': 2, 'guard': '(and (< x0 (- n t)) (< x1 (- n t)))'})
rules.append({'idx': 1, 'from': 0, 'to': 3, 'guard... |
e = int(input())
set_e = set(input().split())
f = int(input())
set_f = set(input().split())
total = set_e.union(set_f)
print(len(total)) | e = int(input())
set_e = set(input().split())
f = int(input())
set_f = set(input().split())
total = set_e.union(set_f)
print(len(total)) |
class ClaseGenerica:
def __init__(self, **kwargs):
for k, v in kwargs.items():
setattr(self, k, v)
def __str__(self):
attrs = ["{}={}".format(k, v) for (k, v) in self.__dict__.items()]
classname = self.__class__.__name__
return "%s: %s" % (classname, ",".join(attrs))... | class Clasegenerica:
def __init__(self, **kwargs):
for (k, v) in kwargs.items():
setattr(self, k, v)
def __str__(self):
attrs = ['{}={}'.format(k, v) for (k, v) in self.__dict__.items()]
classname = self.__class__.__name__
return '%s: %s' % (classname, ','.join(attr... |
class ElementInfo:
def __init__(self, element, elementType, name=None, parent=None, extraOptions=None, createAfter=None, customImportPath=None):
# The actual GUI element
self.element = element
# Name of the element type
self.type = elementType
# Visible Name (Node-Name) of ... | class Elementinfo:
def __init__(self, element, elementType, name=None, parent=None, extraOptions=None, createAfter=None, customImportPath=None):
self.element = element
self.type = elementType
if name is not None:
self.name = name
else:
self.name = element.gui... |
{
"targets": [
{
"target_name": "grandiose",
"sources": [
"src/grandiose_util.cc",
"src/grandiose_find.cc",
"src/grandiose_send.cc",
"src/grandiose_receive.cc",
"src/grandiose.cc"
],
"include_dirs": [ "include" ],
'conditions': [
... | {'targets': [{'target_name': 'grandiose', 'sources': ['src/grandiose_util.cc', 'src/grandiose_find.cc', 'src/grandiose_send.cc', 'src/grandiose_receive.cc', 'src/grandiose.cc'], 'include_dirs': ['include'], 'conditions': [['OS=="win"', {'link_settings': {'libraries': ['Processing.NDI.Lib.x64.lib'], 'library_dirs': ['li... |
description = 'setup for the velocity selector'
group = 'optional'
tango_base = 'tango://phys.maria.frm2:10000/maria/'
devices = dict(
selector_speed = device('nicos.devices.tango.WindowTimeoutAO',
description = 'Selector speed control',
tangodevice = tango_base + 'selector/speed',
unit =... | description = 'setup for the velocity selector'
group = 'optional'
tango_base = 'tango://phys.maria.frm2:10000/maria/'
devices = dict(selector_speed=device('nicos.devices.tango.WindowTimeoutAO', description='Selector speed control', tangodevice=tango_base + 'selector/speed', unit='rpm', fmtstr='%.0f', warnlimits=(3100,... |
class Szopa:
pomalowaneBudynki = 0
def __init__(self, bok_a, bok_b, wys_h):
self.podstawa_a = bok_a
self.podstawa_b = bok_b
self.wysokosc_h = wys_h
Szopa.pomalowaneBudynki += 1
def Pomaluj(self):
return 2*(self.podstawa_a + self.podstawa_b) * self.wysokosc_h
szop... | class Szopa:
pomalowane_budynki = 0
def __init__(self, bok_a, bok_b, wys_h):
self.podstawa_a = bok_a
self.podstawa_b = bok_b
self.wysokosc_h = wys_h
Szopa.pomalowaneBudynki += 1
def pomaluj(self):
return 2 * (self.podstawa_a + self.podstawa_b) * self.wysokosc_h
szop... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.