content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Pizza:
name = "Unknown"
def __init__(self) -> None:
pass
def __str__(self) -> str:
return f"{self.name} Pizza"
class NormalPizza(Pizza):
def __init__(self) -> None:
super().__init__()
self.name = "Normal"
class CheesePizza(Pizza):
def __init__(self) -> Non... | class Pizza:
name = 'Unknown'
def __init__(self) -> None:
pass
def __str__(self) -> str:
return f'{self.name} Pizza'
class Normalpizza(Pizza):
def __init__(self) -> None:
super().__init__()
self.name = 'Normal'
class Cheesepizza(Pizza):
def __init__(self) -> Non... |
# -*- coding: UTF-8 -*-
logger.info("Loading 1 objects to table cal_calendar...")
# fields: id, name, description, color
loader.save(create_cal_calendar(1,['General', 'Allgemein', 'G\xe9n\xe9ral'],u'',1))
loader.flush_deferred_objects()
| logger.info('Loading 1 objects to table cal_calendar...')
loader.save(create_cal_calendar(1, ['General', 'Allgemein', 'Général'], u'', 1))
loader.flush_deferred_objects() |
class Solution:
def isValid(self, s: str) -> bool:
pairs = {'(': ')', '[': ']', '{': '}'}
stack = []
for p in s:
if p in pairs:
stack.append(p)
else:
if not stack or p != pairs[stack.pop()]:
return False
re... | class Solution:
def is_valid(self, s: str) -> bool:
pairs = {'(': ')', '[': ']', '{': '}'}
stack = []
for p in s:
if p in pairs:
stack.append(p)
elif not stack or p != pairs[stack.pop()]:
return False
return stack == [] |
# :information_source: Already implemented via statistics.mean. statistics.mean takes an array as an argument whereas this function takes variadic arguments.
# Returns the average of two or more numbers.
#Takes the sum of all the args and divides it by len(args). The second argument 0.0 in sum is to handle floating p... | def average(*args):
return sum(args, 0.0) / len(args) |
vl=input().split()
A=int(vl[0])
B=int(vl[1])
if A==B:
print("Nao sao Multiplos")
elif A%B==0 or B%A==0:
print("Sao Multiplos")
else:
print("Nao sao Multiplos")
| vl = input().split()
a = int(vl[0])
b = int(vl[1])
if A == B:
print('Nao sao Multiplos')
elif A % B == 0 or B % A == 0:
print('Sao Multiplos')
else:
print('Nao sao Multiplos') |
configs = {
'debug': True,
'db': {
'host': '127.0.0.1',
'port': 3306,
'user': 'www',
'password': 'www',
'db': 'router_scan'
},
'session': {
'secret': 'RouterScan'
}
} | configs = {'debug': True, 'db': {'host': '127.0.0.1', 'port': 3306, 'user': 'www', 'password': 'www', 'db': 'router_scan'}, 'session': {'secret': 'RouterScan'}} |
def print_formatted(number):
l = len(str(bin(number)[2:]))
for i in range(1,number+1):
print(str(i).rjust(l) + ' ' + oct(i)[2:].rjust(l) + ' '
+ hex(i)[2:].upper().rjust(l) + ' ' + bin(i)[2:].rjust(l))
| def print_formatted(number):
l = len(str(bin(number)[2:]))
for i in range(1, number + 1):
print(str(i).rjust(l) + ' ' + oct(i)[2:].rjust(l) + ' ' + hex(i)[2:].upper().rjust(l) + ' ' + bin(i)[2:].rjust(l)) |
# -*- coding: utf-8 -*-
class Main:
LIST_OF_IDS = []
RANDOM_MUSIC_LIST = []
SONG_TIME_NOW = "00:00"
LIST_OF_PLAY = {"classes": []}
PLAYER_SETTINGS = {"play": 0, "cycle": False, "random_song": False}
PAST_SONG = {"class": None, "song_id": None, "past_lib": None, "lib_now": None}
S... | class Main:
list_of_ids = []
random_music_list = []
song_time_now = '00:00'
list_of_play = {'classes': []}
player_settings = {'play': 0, 'cycle': False, 'random_song': False}
past_song = {'class': None, 'song_id': None, 'past_lib': None, 'lib_now': None}
song_play_now = {'name': '', 'author'... |
#this file provides a list of file names for mini examples
miniExamplesFileList = ['ObjectMassPoint.py',
'ObjectMassPoint2D.py',
'ObjectMass1D.py',
'ObjectRotationalMass1D.py',
'ObjectRigidBody2D.py',
'ObjectGenericODE2.py',
'ObjectConnectorSpringDamper.py',
'ObjectConnectorCartesianSpringDamper.py',
'ObjectConnectorC... | mini_examples_file_list = ['ObjectMassPoint.py', 'ObjectMassPoint2D.py', 'ObjectMass1D.py', 'ObjectRotationalMass1D.py', 'ObjectRigidBody2D.py', 'ObjectGenericODE2.py', 'ObjectConnectorSpringDamper.py', 'ObjectConnectorCartesianSpringDamper.py', 'ObjectConnectorCoordinateSpringDamper.py', 'ObjectConnectorDistance.py', ... |
pkgname = "qrencode"
pkgver = "4.1.1"
pkgrel = 0
build_style = "gnu_configure"
configure_args = ["--with-tests"]
hostmakedepends = ["pkgconf"]
makedepends = ["libpng-devel"]
pkgdesc = "Library for encoding QR codes"
maintainer = "q66 <q66@chimera-linux.org>"
license = "LGPL-2.1-or-later"
url = "https://fukuchi.org/work... | pkgname = 'qrencode'
pkgver = '4.1.1'
pkgrel = 0
build_style = 'gnu_configure'
configure_args = ['--with-tests']
hostmakedepends = ['pkgconf']
makedepends = ['libpng-devel']
pkgdesc = 'Library for encoding QR codes'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'LGPL-2.1-or-later'
url = 'https://fukuchi.org/work... |
#
# PySNMP MIB module CISCO-NS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-NS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:37:23 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,... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint, constraints_union) ... |
s = "abacaba"
length = 1
while s[0:length] != s:
length = length + 1
length == 7
| s = 'abacaba'
length = 1
while s[0:length] != s:
length = length + 1
length == 7 |
class GenericMeta(type):
def __getitem__(self, args):
pass
class Generic(object):
__metaclass__ = GenericMeta
| class Genericmeta(type):
def __getitem__(self, args):
pass
class Generic(object):
__metaclass__ = GenericMeta |
a = int(input())
if a % 7 == 0 :
print("multiple")
else :
print("not multiple")
| a = int(input())
if a % 7 == 0:
print('multiple')
else:
print('not multiple') |
#Tuplas
a = 10
b = 5
print(a)
(a,b) = (b,a)
print(a) #Cambio los valores con las tuplas | a = 10
b = 5
print(a)
(a, b) = (b, a)
print(a) |
class Solution:
def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool:
degree = [0]*numCourses
courseDic = [[] for i in range(numCourses)]
for i, j in prerequisites:
courseDic[j].append(i)
degree[i] += 1
dfs = [i for i in range(numCourse... | class Solution:
def can_finish(self, numCourses: int, prerequisites: List[List[int]]) -> bool:
degree = [0] * numCourses
course_dic = [[] for i in range(numCourses)]
for (i, j) in prerequisites:
courseDic[j].append(i)
degree[i] += 1
dfs = [i for i in range(nu... |
class RetsError(RuntimeError):
pass
class RetsClientError(RetsError):
pass
class RetsParseError(RetsClientError):
pass
class RetsResponseError(RetsClientError):
def __init__(self, content: str, headers: dict):
super().__init__('Unexpected response from RETS')
self.content = conte... | class Retserror(RuntimeError):
pass
class Retsclienterror(RetsError):
pass
class Retsparseerror(RetsClientError):
pass
class Retsresponseerror(RetsClientError):
def __init__(self, content: str, headers: dict):
super().__init__('Unexpected response from RETS')
self.content = content
... |
n,l,r,x=map(int,input().split())
num=list(map(int,input().split()))
ans=0
for i in range(2**n):
st=bin(i)[2:]
st='0'*(n-len(st))+st
if st.count('1')>=2:
pt=[]
for i in range(len(st)):
if st[i]=='1':
pt.append(num[i])
if sum(pt)<=r and sum(pt)>=l and max(pt... | (n, l, r, x) = map(int, input().split())
num = list(map(int, input().split()))
ans = 0
for i in range(2 ** n):
st = bin(i)[2:]
st = '0' * (n - len(st)) + st
if st.count('1') >= 2:
pt = []
for i in range(len(st)):
if st[i] == '1':
pt.append(num[i])
if sum(p... |
RUTA_CANCIONES = "D:/proyectos/cocid/cocid_practica_semanal/semana3/canciones/"
CANCIONES = {
1: "Get_Back.txt",
2: "Hey_Jude.txt",
3: "Let_It_Be.txt",
4: "She _Loves_You.txt"
}
| ruta_canciones = 'D:/proyectos/cocid/cocid_practica_semanal/semana3/canciones/'
canciones = {1: 'Get_Back.txt', 2: 'Hey_Jude.txt', 3: 'Let_It_Be.txt', 4: 'She _Loves_You.txt'} |
kitReportMQHost = '***'
kitReportMQPort = 5672
kitReportMQUsername = '***'
kitReportMQPassword = '***'
kitReportMQQueueName = '***'
kitReportMQHeartBeat = 20
kitGitHost = '***'
kitGitUser = '***'
kitDBPort = 3306
kitDBHost = "***"
kitDBName = "***"
kitDBUsername = "***"
kitDBPassword = "***" | kit_report_mq_host = '***'
kit_report_mq_port = 5672
kit_report_mq_username = '***'
kit_report_mq_password = '***'
kit_report_mq_queue_name = '***'
kit_report_mq_heart_beat = 20
kit_git_host = '***'
kit_git_user = '***'
kit_db_port = 3306
kit_db_host = '***'
kit_db_name = '***'
kit_db_username = '***'
kit_db_password =... |
def validate_fit_event_struct(fitEvent, tester):
tester.assertTrue(hasattr(fitEvent, 'df'))
tester.assertTrue(hasattr(fitEvent, 'spec'))
tester.assertTrue(hasattr(fitEvent, 'model'))
tester.assertTrue(hasattr(fitEvent, 'featureColumns'))
tester.assertTrue(hasattr(fitEvent, 'predictionColumns'))
... | def validate_fit_event_struct(fitEvent, tester):
tester.assertTrue(hasattr(fitEvent, 'df'))
tester.assertTrue(hasattr(fitEvent, 'spec'))
tester.assertTrue(hasattr(fitEvent, 'model'))
tester.assertTrue(hasattr(fitEvent, 'featureColumns'))
tester.assertTrue(hasattr(fitEvent, 'predictionColumns'))
... |
class JumpHistory(object):
def __init__(self):
self._history = [ ]
self._pos = 0
def __len__(self):
return len(self._history)
def jump_to(self, addr):
if self._pos != len(self._history) - 1:
self.trim()
if not self._history or self._history[-1] != ad... | class Jumphistory(object):
def __init__(self):
self._history = []
self._pos = 0
def __len__(self):
return len(self._history)
def jump_to(self, addr):
if self._pos != len(self._history) - 1:
self.trim()
if not self._history or self._history[-1] != addr:
... |
# Given a string s, find the longest palindromic substring in s
# --- Example
# Input: "babad"
# Output: "bab"
# Note: "aba" is also a valid answer.
# Time: O(n^2) | Space: O(1)
# Time complexity: O(n^2) Since expanding a palindrome around its center could take up to O(n), and we do this for each character.
class Sol... | class Solution:
def longest_palindrome(self, s):
res = ''
for i in range(len(s)):
current = self.expand_around_middle(s, i - 1, i + 1)
in_between = self.expand_around_middle(s, i, i + 1)
res = max(res, current, in_between, key=len)
return res
def exp... |
def res(x):
a=[]
i=1
for c in x:
a.append(c+i)
i+=1
return a
n=int(input())
x=list(map(int,input().split()))
x.sort(reverse=True)
a=res(x)
print(max(a)+1)
| def res(x):
a = []
i = 1
for c in x:
a.append(c + i)
i += 1
return a
n = int(input())
x = list(map(int, input().split()))
x.sort(reverse=True)
a = res(x)
print(max(a) + 1) |
# B_R_R
# M_S_A_W
def fibonacci(num):
if num==0:
return 0
elif num==1:
return 1
else:
return fibonacci(num-1)+fibonacci(num-2)
inp_val=int(input("How many numbers: "))
i=1
while i<inp_val:
fibValue=fibonacci(i)
print(fibValue)
i+=1
print("All Done")
| def fibonacci(num):
if num == 0:
return 0
elif num == 1:
return 1
else:
return fibonacci(num - 1) + fibonacci(num - 2)
inp_val = int(input('How many numbers: '))
i = 1
while i < inp_val:
fib_value = fibonacci(i)
print(fibValue)
i += 1
print('All Done') |
num = [0 for n in range(4)]
for i in range(4):
num[i] = int(input(""))
failed = False
if (num[0] == 8 or num[0] == 9) and (num[3] == 8 or num[3] == 9) and (num[1] == num[2]):
print("ignore")
else:
print("answer") | num = [0 for n in range(4)]
for i in range(4):
num[i] = int(input(''))
failed = False
if (num[0] == 8 or num[0] == 9) and (num[3] == 8 or num[3] == 9) and (num[1] == num[2]):
print('ignore')
else:
print('answer') |
'''
05 - Regression plot parameters
Seaborn's regression plot supports several parameters that can be
used to configure the plots and drive more insight into the data.
For the next exercise, we can look at the relationship between tuition
and the percent of students that receive Pell grants. A Pell grant is
... | """
05 - Regression plot parameters
Seaborn's regression plot supports several parameters that can be
used to configure the plots and drive more insight into the data.
For the next exercise, we can look at the relationship between tuition
and the percent of students that receive Pell grants. A Pell grant is
... |
# coding: utf-8
class Confirm(object):
def __init__(self, assume_yes=False):
self.assume_yes = assume_yes
def ask(self):
if self.assume_yes:
return True
message = '\n==> Press "Y" to confirm, or anything else to abort: '
confirmation = input(message)
retur... | class Confirm(object):
def __init__(self, assume_yes=False):
self.assume_yes = assume_yes
def ask(self):
if self.assume_yes:
return True
message = '\n==> Press "Y" to confirm, or anything else to abort: '
confirmation = input(message)
return True if str(conf... |
class Node:
def __init__(self, value=None, next_node=None):
self.value = value
self.next = next_node
def add_node(self, node):
self.next = node
def remove_next_node(self):
self.next = None
def add_value(self, value):
self.value = value
| class Node:
def __init__(self, value=None, next_node=None):
self.value = value
self.next = next_node
def add_node(self, node):
self.next = node
def remove_next_node(self):
self.next = None
def add_value(self, value):
self.value = value |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( num ) :
length = len ( num )
if ( length == 1 and num [ 0 ] == '0' ) :
return True
if ( length ... | def f_gold(num):
length = len(num)
if length == 1 and num[0] == '0':
return True
if length % 3 == 1:
num = str(num) + '00'
length += 2
elif length % 3 == 2:
num = str(num) + '0'
length += 1
sum = 0
p = 1
for i in range(length - 1, -1, -1):
grou... |
s = 0
f1 = 1
f2 = 2
f_old = f1
f_new = f1
while f_new < 4000000:
if f_new % 2 == 0:
s += f_new
f_new_temp = f_new
f_new = f_new_temp + f_old
f_old = f_new_temp
print(s) | s = 0
f1 = 1
f2 = 2
f_old = f1
f_new = f1
while f_new < 4000000:
if f_new % 2 == 0:
s += f_new
f_new_temp = f_new
f_new = f_new_temp + f_old
f_old = f_new_temp
print(s) |
# https://leetcode.com/problems/count-of-smaller-numbers-after-self/discuss/445769/merge-sort-CLEAR-simple-EXPLANATION-with-EXAMPLES-O(n-lg-n)
class Solution:
def countSmaller(self, nums: List[int]) -> List[int]:
def mergeAndCount(arr, start, end, result):
if start >= end:
re... | class Solution:
def count_smaller(self, nums: List[int]) -> List[int]:
def merge_and_count(arr, start, end, result):
if start >= end:
return
mid = (start + end) // 2
merge_and_count(arr, start, mid, result)
merge_and_count(arr, mid + 1, end, ... |
class Solution:
def leastBricks(self, wall: List[List[int]]) -> int:
gaps = defaultdict(int)
for row in wall:
position = 0
for brick in row[:-1]:
position += brick
gaps[position] += 1
fewestCrossings = len(wall)
if len(gaps) > 0... | class Solution:
def least_bricks(self, wall: List[List[int]]) -> int:
gaps = defaultdict(int)
for row in wall:
position = 0
for brick in row[:-1]:
position += brick
gaps[position] += 1
fewest_crossings = len(wall)
if len(gaps) ... |
# python3
n, m = map(int, input().split())
edges = [ list(map(int, input().split())) for i in range(m) ]
# This solution prints a simple satisfiable formula
# and passes about half of the tests.
# Change this function to solve the problem.
def printEquisatisfiableSatFormula():
print("3 2")
print("1 2 0")
p... | (n, m) = map(int, input().split())
edges = [list(map(int, input().split())) for i in range(m)]
def print_equisatisfiable_sat_formula():
print('3 2')
print('1 2 0')
print('-1 -2 0')
print('1 -2 0')
print_equisatisfiable_sat_formula() |
SINE = 0
SQUARE = 1
TRI = 2
UP = 3
DOWN = 4
ARB0 = 100
ARB1 = 101
ARB2 = 102
ARB3 = 103
ARB4 = 104
ARB5 = 105
ARB6 = 106
ARB7 = 107
ARB8 = 108
ARB9 = 109
ARB10 = 110
ARB11 = 111
ARB12 = 112
ARB13 = 113
ARB14 = 114
ARB15 = 115
| sine = 0
square = 1
tri = 2
up = 3
down = 4
arb0 = 100
arb1 = 101
arb2 = 102
arb3 = 103
arb4 = 104
arb5 = 105
arb6 = 106
arb7 = 107
arb8 = 108
arb9 = 109
arb10 = 110
arb11 = 111
arb12 = 112
arb13 = 113
arb14 = 114
arb15 = 115 |
N = int(input())
if N <= 999:
print('ABC')
else:
print('ABD')
| n = int(input())
if N <= 999:
print('ABC')
else:
print('ABD') |
class DtoObject(dict):
@property
def __dict__(self):
return {k: v for k, v in self.items()}
| class Dtoobject(dict):
@property
def __dict__(self):
return {k: v for (k, v) in self.items()} |
expected_output = {
"TenGigabitEthernet1/0/2":{
"port_channel":{
"port_channel_member": False
},
"enabled": True,
"line_protocol":"up",
"oper_status":"up",
"connected": True,
"suspended": False,
"err_disabled": False,
"type":"Ten Gigabit Ethernet",
... | expected_output = {'TenGigabitEthernet1/0/2': {'port_channel': {'port_channel_member': False}, 'enabled': True, 'line_protocol': 'up', 'oper_status': 'up', 'connected': True, 'suspended': False, 'err_disabled': False, 'type': 'Ten Gigabit Ethernet', 'mac_address': '682c.7b3f.f002', 'phys_address': '682c.7b3f.f002', 'de... |
#!/usr/bin/env python
names = ('ff','ff','sfs','fdfs')
for name in names:
print(name)
lll = list(range(5))
print(lll)
sum =0
for l in lll:
sum+=l
print(sum)
| names = ('ff', 'ff', 'sfs', 'fdfs')
for name in names:
print(name)
lll = list(range(5))
print(lll)
sum = 0
for l in lll:
sum += l
print(sum) |
#!/usr/bin/env python3
# Copyright 2009-2017 BHG http://bw.org/
class Aluno:
estuda = "digita os codigos"
boceja = "aaaaahhhh"
def estuda(self):
print(self.estuda)
def boceja(self):
print(self.boceja)
def main():
joao = Aluno()
joao.estuda()
joao.bocej... | class Aluno:
estuda = 'digita os codigos'
boceja = 'aaaaahhhh'
def estuda(self):
print(self.estuda)
def boceja(self):
print(self.boceja)
def main():
joao = aluno()
joao.estuda()
joao.boceja()
if __name__ == '__main__':
main() |
__project__ = 'Synerty Peek'
__copyright__ = '2016, Synerty'
__author__ = 'Synerty'
__version__ = '1.0.0'
| __project__ = 'Synerty Peek'
__copyright__ = '2016, Synerty'
__author__ = 'Synerty'
__version__ = '1.0.0' |
def primesieve(a,n):
global m
N=n
n+=5
prime=[0 for i in range(n+1)]
p=2
while(p*p<=n):
if(prime[p]==0):
for i in range(p*p,n,p):
prime[i]=1
p+=1
c=0
for i in range(a,N+1):
if prime[i]==0:
m.append(i)
c+=1
re... | def primesieve(a, n):
global m
n = n
n += 5
prime = [0 for i in range(n + 1)]
p = 2
while p * p <= n:
if prime[p] == 0:
for i in range(p * p, n, p):
prime[i] = 1
p += 1
c = 0
for i in range(a, N + 1):
if prime[i] == 0:
m.app... |
#
# PySNMP MIB module HIRSCHMANN-DVMRP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HIRSCHMANN-DVMRP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:30:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, constraints_intersection, single_value_constraint, value_size_constraint) ... |
r = int(input())
pi = 3.14159
v = (4/3) *pi * (r ** 3)
print("VOLUME = {0:.3f}".format(v))
| r = int(input())
pi = 3.14159
v = 4 / 3 * pi * r ** 3
print('VOLUME = {0:.3f}'.format(v)) |
expected_output = {
"interfaces": {
"Port-channel1": {
"name": "Port-channel1",
"protocol": "lacp",
"members": {
"GigabitEthernet2": {
"interface": "GigabitEthernet2",
"counters": {
"lacp_in_p... | expected_output = {'interfaces': {'Port-channel1': {'name': 'Port-channel1', 'protocol': 'lacp', 'members': {'GigabitEthernet2': {'interface': 'GigabitEthernet2', 'counters': {'lacp_in_pkts': 22, 'lacp_out_pkts': 27, 'marker_in_pkts': 0, 'marker_out_pkts': 0, 'lacp_pkts': 0, 'marker_response_in_pkts': 0, 'marker_respon... |
#
# ***** ALERTA SERVER DEFAULT SETTINGS -- DO NOT MODIFY THIS FILE *****
#
# To override these settings use /etc/alertad.conf or the contents of the
# configuration file set by the environment variable ALERTA_SVR_CONF_FILE.
#
# Further information on settings can be found at http://docs.alerta.io
DEBUG = False
LOGGE... | debug = False
logger_name = 'alerta'
log_file = None
secret_key = 'changeme'
query_limit = 10000
history_limit = 1000
mongo_host = 'localhost'
mongo_port = 27017
mongo_database = 'monitoring'
mongo_replset = None
mongo_username = 'alerta'
mongo_password = None
auth_required = False
admin_users = []
customer_views = Fal... |
c_player_version_path = '/v1/player/versionInfo'
c_casino_version_path = '/v1/casino/versionInfo'
c_not_ready = 'not_ready_0'
# frontend
c_frontend_src_em = 'EM_FE'
c_frontend_src_operator = 'operator_FE'
# update time
c_job_interval_minutes = 30
c_json_key_operator_group = 'Operator Group'
c_redis_key_operator_g... | c_player_version_path = '/v1/player/versionInfo'
c_casino_version_path = '/v1/casino/versionInfo'
c_not_ready = 'not_ready_0'
c_frontend_src_em = 'EM_FE'
c_frontend_src_operator = 'operator_FE'
c_job_interval_minutes = 30
c_json_key_operator_group = 'Operator Group'
c_redis_key_operator_group = 'operatorGroup'
c_json_k... |
'''A program to distribute candy to boys with array rating
each boy will get one more candy than the boy with less rating than him
example:[0,1,6] will return
1+2+3=6
[1,1,1,2,3,2+10]
=>1+1+1+2+2+3+4
'''
def distr(A:list):
A= sorted(A)
no_candy=1
the_boy=0
total_candy=0
for boy in A:
... | """A program to distribute candy to boys with array rating
each boy will get one more candy than the boy with less rating than him
example:[0,1,6] will return
1+2+3=6
[1,1,1,2,3,2+10]
=>1+1+1+2+2+3+4
"""
def distr(A: list):
a = sorted(A)
no_candy = 1
the_boy = 0
total_candy = 0
for boy in A:
... |
# Definition for a Node.
class Node:
def __init__(self, x: int, next: "Node" = None, random: "Node" = None):
self.val = int(x)
self.next = next
self.random = random
class Solution:
def copyRandomList(self, head: "Node") -> "Node":
if not head:
return None
no... | class Node:
def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None):
self.val = int(x)
self.next = next
self.random = random
class Solution:
def copy_random_list(self, head: 'Node') -> 'Node':
if not head:
return None
node = head
d = {}
... |
# All things for a HAP characteristic.
class HAP_FORMAT:
BOOL = 'bool'
INT = 'int'
FLOAT = 'float'
STRING = 'string'
ARRAY = 'array'
DICTIONARY = 'dictionary'
UINT8 = 'uint8'
UINT16 = 'uint16'
UINT32 = 'uint32'
UINT64 = 'uint64'
DATA = 'data'
TLV8 = 'tlv8'
NUMERIC = (INT, FLOAT,... | class Hap_Format:
bool = 'bool'
int = 'int'
float = 'float'
string = 'string'
array = 'array'
dictionary = 'dictionary'
uint8 = 'uint8'
uint16 = 'uint16'
uint32 = 'uint32'
uint64 = 'uint64'
data = 'data'
tlv8 = 'tlv8'
numeric = (INT, FLOAT, UINT8, UINT16, UINT32, UINT... |
'''from rasa.core.agent import Agent
from rasa.utils.endpoints import EndpointConfig
import asyncio
import logging
logger = logging.getLogger("app.main")
class RasaAgent():
def __init__(self, **kwargs):
self.model_name = kwargs.get('model')
self.response = None
self.message = None
... | """from rasa.core.agent import Agent
from rasa.utils.endpoints import EndpointConfig
import asyncio
import logging
logger = logging.getLogger("app.main")
class RasaAgent():
def __init__(self, **kwargs):
self.model_name = kwargs.get('model')
self.response = None
self.message = None
... |
# https://www.codewars.com/kata/5667e8f4e3f572a8f2000039/train/python
#Take each letters index
#Add to string each letters multiplied by its index (first letter must be uppercase and others lowercase)
#Add - between each set
def accum(s):
accummedStr=s[0].upper()
for i in range(1,len(s)): accummedStr+="-"+s[i... | def accum(s):
accummed_str = s[0].upper()
for i in range(1, len(s)):
accummed_str += '-' + s[i].upper() + s[i].lower() * i
return accummedStr |
with open('test.txt', 'r+') as f:
f.seek(15)
print(f.readline())
with open('test.txt') as f:
data = []
for d in f:
data.append(d)
print(data) | with open('test.txt', 'r+') as f:
f.seek(15)
print(f.readline())
with open('test.txt') as f:
data = []
for d in f:
data.append(d)
print(data) |
def move_zeros_to_left(A):
if len(A) < 1: return
lengthA = len(A)
write_index = lengthA - 1
read_index = lengthA - 1
while(read_index >= 0):
if A[read_index] != 0:
A[write_index] = A[read_index]
write_index -= 1
read_index -= 1
while (write_index >= 0)... | def move_zeros_to_left(A):
if len(A) < 1:
return
length_a = len(A)
write_index = lengthA - 1
read_index = lengthA - 1
while read_index >= 0:
if A[read_index] != 0:
A[write_index] = A[read_index]
write_index -= 1
read_index -= 1
while write_index >=... |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
INSTALLED_APPS=[
'tests',
]
DEBUG = False
SITE_ID = 1 | databases = {'default': {'ENGINE': 'django.db.backends.sqlite3'}}
installed_apps = ['tests']
debug = False
site_id = 1 |
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
c = 0
for i in range(0,n,2):
c = c + a[i+1]-a[i]
print(c)
| n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
c = 0
for i in range(0, n, 2):
c = c + a[i + 1] - a[i]
print(c) |
# Do not edit the class below except
# for the breadthFirstSearch method.
# Feel free to add new properties
# and methods to the class.
class Node:
def __init__(self, name):
self.children = []
self.name = name
def addChild(self, name):
self.children.append(Node(name))
return sel... | class Node:
def __init__(self, name):
self.children = []
self.name = name
def add_child(self, name):
self.children.append(node(name))
return self
def breadth_first_search(self, array):
queue = [self]
while len(queue) > 0:
cur_node = queue.pop(0)... |
confThreshold= 0.5
nmsThreshold = 0.4
inpWidth = 416
inpHeight = 416
classesFile = "coco.names"
classes = None
with open(classesFile,"rt") as f:
classes = f.read().rstrip("\n").split("\n")
print(classes) | conf_threshold = 0.5
nms_threshold = 0.4
inp_width = 416
inp_height = 416
classes_file = 'coco.names'
classes = None
with open(classesFile, 'rt') as f:
classes = f.read().rstrip('\n').split('\n')
print(classes) |
#!/usr/bin/python
# height2.py
print ('Height: %.2f %s' % (172.3, 'cm'))
print ('Height: {0:.2f} {1:s}'.format(172.3, 'cm'))
| print('Height: %.2f %s' % (172.3, 'cm'))
print('Height: {0:.2f} {1:s}'.format(172.3, 'cm')) |
#
# PySNMP MIB module EFM-CU-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/EFM-CU-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:11:39 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52)
#
( OctetS... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, single_value_constraint, value_size_constraint, value_range_constraint) ... |
# (c) 2021 Leon Luithlen
# This code is licensed under MIT license
def strongly_typed(*args, **kwargs):
stargs = args
stkwargs = kwargs
def type_strongly(func):
def wrapper(*args, **kwargs):
for arg, type_ in zip(args, stargs):
assert isinstance(arg,type_), f"{arg} should be of type {type_}"
for kw, a... | def strongly_typed(*args, **kwargs):
stargs = args
stkwargs = kwargs
def type_strongly(func):
def wrapper(*args, **kwargs):
for (arg, type_) in zip(args, stargs):
assert isinstance(arg, type_), f'{arg} should be of type {type_}'
for (kw, arg) in kwargs.items... |
'''
A string with parentheses is well bracketed if all parentheses are matched: every opening bracket has a matching closing bracket and vice versa.
Write a Python function wellbracketed(s) that takes a string s containing parentheses and returns True if s is well bracketed and False otherwise.
Hint: Keep track of the ... | """
A string with parentheses is well bracketed if all parentheses are matched: every opening bracket has a matching closing bracket and vice versa.
Write a Python function wellbracketed(s) that takes a string s containing parentheses and returns True if s is well bracketed and False otherwise.
Hint: Keep track of the ... |
PLURAL_KEYS = (
"view",
"measure",
"dimension",
"dimension_group",
"filter",
"access_filter",
"bind_filters",
"map_layer",
"parameter",
"set",
"column",
"derived_column",
"include",
"explore",
"link",
"when",
"allowed_value",
"named_value_format",
... | plural_keys = ('view', 'measure', 'dimension', 'dimension_group', 'filter', 'access_filter', 'bind_filters', 'map_layer', 'parameter', 'set', 'column', 'derived_column', 'include', 'explore', 'link', 'when', 'allowed_value', 'named_value_format', 'join', 'datagroup', 'access_grant', 'sql_step', 'sql_where', 'action', '... |
A = 26
MOD = 1_000_000_007
def shortPalindrome(s):
c1 = [0] * A
c2 = [[0] * A for _ in range(A)]
c3 = [0] * A
res = 0
for i in (ord(c) - 97 for c in s):
res = (res + c3[i]) % MOD
for j in range(A):
c3[j] += c2[j][i]
for j in range(A):
c2[... | a = 26
mod = 1000000007
def short_palindrome(s):
c1 = [0] * A
c2 = [[0] * A for _ in range(A)]
c3 = [0] * A
res = 0
for i in (ord(c) - 97 for c in s):
res = (res + c3[i]) % MOD
for j in range(A):
c3[j] += c2[j][i]
for j in range(A):
c2[j][i] += c1[j]
... |
class Solution:
def isPalindrome(self, x: int) -> bool:
i = 0
str_x = str(x)
n = len(str_x)
while i < n-i-1:
if str_x[i] != str_x[n-i-1]:
return False
i += 1
return True | class Solution:
def is_palindrome(self, x: int) -> bool:
i = 0
str_x = str(x)
n = len(str_x)
while i < n - i - 1:
if str_x[i] != str_x[n - i - 1]:
return False
i += 1
return True |
class Solution:
def getSkyline(self, buildings: [[int]]) -> [[int]]:
if not buildings:
return []
if len(buildings) == 1:
return [[buildings[0][0], buildings[0][2]], [buildings[0][1], 0]]
mid = len(buildings) // 2
left = self.getSkyline(buildings[:mid])
... | class Solution:
def get_skyline(self, buildings: [[int]]) -> [[int]]:
if not buildings:
return []
if len(buildings) == 1:
return [[buildings[0][0], buildings[0][2]], [buildings[0][1], 0]]
mid = len(buildings) // 2
left = self.getSkyline(buildings[:mid])
... |
class Node (object):
def __init__(self, leaf, num_spaces=4):
self.name = leaf[0]
self.num_spaces = num_spaces
leaves = leaf[1:]
if len(leaves):
self.leaves = [Node(leaves, num_spaces)]
else:
self.leaves = None
# Returns true when the leaves are a... | class Node(object):
def __init__(self, leaf, num_spaces=4):
self.name = leaf[0]
self.num_spaces = num_spaces
leaves = leaf[1:]
if len(leaves):
self.leaves = [node(leaves, num_spaces)]
else:
self.leaves = None
def add(self, leaves):
if lea... |
# isr1.py - Timer to activate units in a cycle
# The 7-segment units are controlled one-by one in a cycle, using a timer interrupt for consistent light output.
# Model 1: every timer interrupt, the control switches from one unit to the next.
# User configuration
framebuf = "ABCD" # User configuration: desir... | framebuf = 'ABCD'
timer_ms = 5
unitcount = 4
assert TIMER_MS >= 1
assert TIMER_MS * UNITCOUNT <= 20
assert UNITCOUNT == len(framebuf)
_unit = UNITCOUNT - 1
_rows = '?'
_column = '?'
_unitlog = ''
_rowslog = ''
_columnlog = ''
def log(sep=None):
global _unitlog, _rowslog, _columnlog
global _slot, _unit, _rows, ... |
letters = {}
for c in input():
if c in letters:
letters[c] += 1
else:
letters[c] = 1
max_double = max(letters.values())
if max_double == 1:
print(len(letters))
for l in letters:
print(l)
exit(0)
if list(letters.values()).count(max_double) == 1:
print(1)
for l, k in... | letters = {}
for c in input():
if c in letters:
letters[c] += 1
else:
letters[c] = 1
max_double = max(letters.values())
if max_double == 1:
print(len(letters))
for l in letters:
print(l)
exit(0)
if list(letters.values()).count(max_double) == 1:
print(1)
for (l, k) in ... |
#Generate Christmas Tree Pattern
# Generating Triangle Shape
def triangleShape(n):
for i in range(n):
for j in range(n-i):
print(' ', end=' ')
for k in range(2*i+1):
print('*',end=' ')
print()
# Generating Pole Shape
def poleShape(n):
for i in range(n):
... | def triangle_shape(n):
for i in range(n):
for j in range(n - i):
print(' ', end=' ')
for k in range(2 * i + 1):
print('*', end=' ')
print()
def pole_shape(n):
for i in range(n):
for j in range(n - 1):
print(' ', end=' ')
print('* * *')... |
# check if a number is odd or even
num = int(input("Enter a number: "))
if num%2: # note that it is not checked with ==; result of %2 is 0 or 1 which can be translated as False or True
print("The number is odd")
else:
print("The number is even") | num = int(input('Enter a number: '))
if num % 2:
print('The number is odd')
else:
print('The number is even') |
# zwei 06/16/2014
# inspired by sympy.utilities.iterables.kbins.partition()
def partition(lista, bins):
# EnricoGiampieri's partition generator from
# http://stackoverflow.com/questions/13131491/
# partition-n-items-into-k-bins-in-python-lazily
if len(lista) == 1 or bins == 1:
yield [lista]
... | def partition(lista, bins):
if len(lista) == 1 or bins == 1:
yield [lista]
elif len(lista) > 1 and bins > 1:
for i in range(1, len(lista)):
for part in partition(lista[i:], bins - 1):
if len([lista[:i]] + part) == bins:
yield ([lista[:i]] + part)
f... |
class Solution:
def romanToInt(self, s: str) -> int:
roman = {'I': 1,'V': 5,'X': 10, 'L': 50,'C': 100,'D': 500,'M': 1000}
exception = {'IV': 4,'IX': 9,'XL': 40,'XC': 90,'CD': 400,'CM': 900}
intnum = 0
for exc in exception:
if exc in s:
intnum = intnum + e... | class Solution:
def roman_to_int(self, s: str) -> int:
roman = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
exception = {'IV': 4, 'IX': 9, 'XL': 40, 'XC': 90, 'CD': 400, 'CM': 900}
intnum = 0
for exc in exception:
if exc in s:
intnum ... |
class Simbolo:
def __init__(self,tipo,nombre,posicion,ambito,dimensiones=0):
self.tipo=tipo
self.nombre=nombre
self.posicion=posicion
self.ambito=ambito
self.dimensiones=dimensiones | class Simbolo:
def __init__(self, tipo, nombre, posicion, ambito, dimensiones=0):
self.tipo = tipo
self.nombre = nombre
self.posicion = posicion
self.ambito = ambito
self.dimensiones = dimensiones |
pytest_plugins = [
'aioclustermanager.tests.fixtures'
]
| pytest_plugins = ['aioclustermanager.tests.fixtures'] |
# URI Online Judge 1117
nota1, nota2 = -1, -1
continuar = 1
while continuar == 1:
nota1, nota2 = -1, -1
while nota1 < 0 or nota1 > 10:
nota1 = float(input())
if nota1 < 0 or nota1 > 10:
print("nota invalida")
while nota2 < 0 or nota2 > 10:
nota2 = float(input())
... | (nota1, nota2) = (-1, -1)
continuar = 1
while continuar == 1:
(nota1, nota2) = (-1, -1)
while nota1 < 0 or nota1 > 10:
nota1 = float(input())
if nota1 < 0 or nota1 > 10:
print('nota invalida')
while nota2 < 0 or nota2 > 10:
nota2 = float(input())
if nota2 < 0 or n... |
result = set()
for *features, label in DATA[1:]:
species = label.pop()
if species.endswith(SUFFIXES):
result.add(species)
| result = set()
for (*features, label) in DATA[1:]:
species = label.pop()
if species.endswith(SUFFIXES):
result.add(species) |
# Work out the first ten digits of the sum of
# the following one-hundred 50-digit numbers.
num_str = "37107287533902102798797998220837590246510135740250\
46376937677490009712648124896970078050417018260538\
74324986199524741059474233309513058123726617309629\
91942213363574161572522430563301811072406154908250\
23067588... | num_str = '371072875339021027987979982208375902465101357402504637693767749000971264812489697007805041701826053874324986199524741059474233309513058123726617309629919422133635741615725224305633018110724061549082502306758820753934617117198031042104751377806324667689261670696623633820136378418383684178734361726757281128798... |
class Out():
def __init__(self):
self.log_level = 0
def print(self, msg):
print(msg)
def log(self, level, msg):
if level >= self.log_level:
return
else:
output = ""
if level == 1:
output = "[VERBOSE] "
elif le... | class Out:
def __init__(self):
self.log_level = 0
def print(self, msg):
print(msg)
def log(self, level, msg):
if level >= self.log_level:
return
else:
output = ''
if level == 1:
output = '[VERBOSE] '
elif leve... |
number_of_test_cases = int(input().strip())
for _ in range(number_of_test_cases):
try:
a, b = map(int, input().strip().split(" "))
print(a // b)
except Exception as e:
print("Error Code:", e)
| number_of_test_cases = int(input().strip())
for _ in range(number_of_test_cases):
try:
(a, b) = map(int, input().strip().split(' '))
print(a // b)
except Exception as e:
print('Error Code:', e) |
# TODO
# Have not even started one bit but easy once get the other part done
# https://bsmg.wiki/mapping/map-format.html#events-2
# Get the Melograph
# Translate the graph to the events
# Write the results to the file
# Onset Can create a idea of where to put the beats
# https://librosa.org/doc/latest/generated/lib... | """
You may be wondering, how do we manage to incentivize more creative mapping? Rather than just placing events based on time and location, we run a multitude of different checks to decide on where to place our events.
Beats with a high pace (more than 1 block per beat) receive a red center light, beats with a medium... |
class GroupHelper:
def __init__(self,app):
self.app = app
def return_to_group_page(self):
wd = self.app.wd
wd.find_element_by_link_text("group page").click()
def creator(self, group):
wd = self.app.wd
# open_gp
wd.find_element_by_link_text("groups").click()
# init_group_creator
wd.find_element_by_... | class Grouphelper:
def __init__(self, app):
self.app = app
def return_to_group_page(self):
wd = self.app.wd
wd.find_element_by_link_text('group page').click()
def creator(self, group):
wd = self.app.wd
wd.find_element_by_link_text('groups').click()
wd.find_... |
class category(object):
def __init__(self, id=None, account=None, name=None,
description=None, parent=None,
selectable=True, active=True):
self.id = id
self.account = account
self.name = name
self.description = description
self.parent = parent
self.selectable = s... | class Category(object):
def __init__(self, id=None, account=None, name=None, description=None, parent=None, selectable=True, active=True):
self.id = id
self.account = account
self.name = name
self.description = description
self.parent = parent
self.selectable = selec... |
#Project Euler Problem-52
#Author Tushar Gayan
def f(num_1,num_2): #Checks same digit
num_list_1 = [int(i) for i in str(num_1)]
num_list_2 = [int(i) for i in str(num_2)]
num_list_1.sort();num_list_2.sort()
if num_list_1 == num_list_2:
return True
else:
return False
n = 1
while f(n... | def f(num_1, num_2):
num_list_1 = [int(i) for i in str(num_1)]
num_list_2 = [int(i) for i in str(num_2)]
num_list_1.sort()
num_list_2.sort()
if num_list_1 == num_list_2:
return True
else:
return False
n = 1
while f(n, 2 * n) != True or f(2 * n, 3 * n) != True or f(3 * n, 4 * n) !... |
# problem : https://leetcode.com/problems/coin-change-2/
# time complexity : O(NM)
# algorithm : DP
class Solution:
def change(self, amount: int, coins: List[int]) -> int:
if amount == 0 and len(coins) == 0:
return 1
dp = [[0] * (amount + 1)] * (len(coins) + 1)
for coinInd in ra... | class Solution:
def change(self, amount: int, coins: List[int]) -> int:
if amount == 0 and len(coins) == 0:
return 1
dp = [[0] * (amount + 1)] * (len(coins) + 1)
for coin_ind in range(len(coins)):
coin = coins[coinInd]
prev = dp[coinInd]
now =... |
def main():
with open("day1/input.dat") as f:
expenses = [int(n) for n in f.readlines()]
result = None
for a in expenses:
for b in expenses:
if a + b == 2020:
result = a*b
break
return result
if __name__ == "__main__":
print(main()) | def main():
with open('day1/input.dat') as f:
expenses = [int(n) for n in f.readlines()]
result = None
for a in expenses:
for b in expenses:
if a + b == 2020:
result = a * b
break
return result
if __name__ == '__main__':
print(main()) |
d = {
'name': 'setayesh',
'last_name': 'pasanadideh',
'age': 14,
'b_p': 'tehran',
'p': print,
'wear_glass': False
}
print(d)
print(d['last_name'])
d['p']( 'amirreza') | d = {'name': 'setayesh', 'last_name': 'pasanadideh', 'age': 14, 'b_p': 'tehran', 'p': print, 'wear_glass': False}
print(d)
print(d['last_name'])
d['p']('amirreza') |
COCO_PERSON_SKELETON = [[2, 3], [3,4], [4, 5], [2, 6], [6,7], [7,8], [2,1]]
COCO_KEYPOINTS = [
'nose', # 1
'left_eye', # 2
'right_eye', # 3
'left_ear', # 4
'right_ear', # 5
'left_shoulder', # 6
'right_shoulder', # 7
'left_elbow', # 8
... | coco_person_skeleton = [[2, 3], [3, 4], [4, 5], [2, 6], [6, 7], [7, 8], [2, 1]]
coco_keypoints = ['nose', 'left_eye', 'right_eye', 'left_ear', 'right_ear', 'left_shoulder', 'right_shoulder', 'left_elbow', 'right_elbow', 'left_wrist', 'right_wrist', 'left_hip', 'right_hip', 'left_knee', 'right_knee', 'left_ankle', 'righ... |
class StaticConnection():
def __init__(self, src, dst, bandwidth, delay, loss):
self.src = src
self.dst = dst
self.bandwidth = bandwidth
self.delay = delay
self.loss = loss | class Staticconnection:
def __init__(self, src, dst, bandwidth, delay, loss):
self.src = src
self.dst = dst
self.bandwidth = bandwidth
self.delay = delay
self.loss = loss |
{
'conditions' : [
[ 'skia_os != "ios"', {
'error': '<!(set GYP_DEFINES=\"skia_os=\'ios\'\")'
}],
],
'targets': [
{
'target_name': 'SimpleiOSApp',
'type': 'executable',
'mac_bundle' : 1,
'include_dirs' : [
'../experimental/iOSSampleApp/Shared',
],
'sou... | {'conditions': [['skia_os != "ios"', {'error': '<!(set GYP_DEFINES="skia_os=\'ios\'")'}]], 'targets': [{'target_name': 'SimpleiOSApp', 'type': 'executable', 'mac_bundle': 1, 'include_dirs': ['../experimental/iOSSampleApp/Shared'], 'sources': ['../src/views/ios/SkOSWindow_iOS.mm', '../src/views/mac/SkEventNotifier.h', '... |
vogais = {
'a': 0,
'e': 0,
'i': 0,
'o': 0,
'u': 0
}
texto = str(input('insira um texto: ')).strip().lower()
for letra in texto:
if letra in 'a':
vogais['a'] += 1
elif letra in 'e':
vogais['e'] += 1
elif letra in 'i':
vogais['i'] += 1
elif letra in 'o':
... | vogais = {'a': 0, 'e': 0, 'i': 0, 'o': 0, 'u': 0}
texto = str(input('insira um texto: ')).strip().lower()
for letra in texto:
if letra in 'a':
vogais['a'] += 1
elif letra in 'e':
vogais['e'] += 1
elif letra in 'i':
vogais['i'] += 1
elif letra in 'o':
vogais['o'] += 1
... |
alien_0 = {'color': 'green', 'points': 5} #create a dictionary
print(alien_0['color'])
print(alien_0['points'])
new_points = alien_0['points']
print("You just earned " + str(new_points) + " points!")
print(alien_0)
alien_0['x_position'] = 0 # add to the dictionary
alien_0['y_position'] = 25 # add to the dictionary
... | alien_0 = {'color': 'green', 'points': 5}
print(alien_0['color'])
print(alien_0['points'])
new_points = alien_0['points']
print('You just earned ' + str(new_points) + ' points!')
print(alien_0)
alien_0['x_position'] = 0
alien_0['y_position'] = 25
print(alien_0)
alien_0 = {}
alien_0['color'] = 'green'
alien_0['points'] ... |
class SETTINGS:
__slots__ = ("TOKEN","DB_NAME")
def __init__(self):
self.TOKEN = '415193750:AAFNBxqmF5ow24TwzuJlzYKpYSPmt_K5p_A'
self.DB_NAME = 'vk2tl.db'
| class Settings:
__slots__ = ('TOKEN', 'DB_NAME')
def __init__(self):
self.TOKEN = '415193750:AAFNBxqmF5ow24TwzuJlzYKpYSPmt_K5p_A'
self.DB_NAME = 'vk2tl.db' |
###############################################################################
#
# $Id$
#
###############################################################################
__all__ = ["client","constants","file_list","enq_message","messages","md_client","mw_client","pe_client"]
| __all__ = ['client', 'constants', 'file_list', 'enq_message', 'messages', 'md_client', 'mw_client', 'pe_client'] |
class Node(object):
def __init__(self, id):
self.id = id
self.vec = []
self.neighbours = []
def add_neighbour(self, node_id):
self.neighbours.append(node_id)
class Graph(object):
def __init__(self):
# id -> node
self.nodes = {}
self.edges = []
... | class Node(object):
def __init__(self, id):
self.id = id
self.vec = []
self.neighbours = []
def add_neighbour(self, node_id):
self.neighbours.append(node_id)
class Graph(object):
def __init__(self):
self.nodes = {}
self.edges = []
def add_node(self, n... |
n = int(input())
matrix = [[int(n) for n in input().split(", ")] for _ in range(n)]
flat_matrix = [number for row in matrix for number in row]
print(flat_matrix)
| n = int(input())
matrix = [[int(n) for n in input().split(', ')] for _ in range(n)]
flat_matrix = [number for row in matrix for number in row]
print(flat_matrix) |
INTENT = "intent"
INTENTS = "intents"
ENTITIES = "entities"
UTTERANCES = "utterances"
USE_SYNONYMS = "use_synonyms"
SYNONYMS = "synonyms"
DATA = "data"
VALUE = "value"
TEXT = "text"
ENTITY = "entity"
SLOT_NAME = "slot_name"
TRUE_POSITIVE = "true_positive"
FALSE_POSITIVE = "false_positive"
FALSE_NEGATIVE = "false_negati... | intent = 'intent'
intents = 'intents'
entities = 'entities'
utterances = 'utterances'
use_synonyms = 'use_synonyms'
synonyms = 'synonyms'
data = 'data'
value = 'value'
text = 'text'
entity = 'entity'
slot_name = 'slot_name'
true_positive = 'true_positive'
false_positive = 'false_positive'
false_negative = 'false_negati... |
def to_hex(hh: bytes, for_c=False):
hex_values = ("{:02x}".format(c) for c in hh)
if for_c:
return "{" + ", ".join("0x{}".format(x) for x in hex_values) + "}"
else:
return " ".join(hex_values)
| def to_hex(hh: bytes, for_c=False):
hex_values = ('{:02x}'.format(c) for c in hh)
if for_c:
return '{' + ', '.join(('0x{}'.format(x) for x in hex_values)) + '}'
else:
return ' '.join(hex_values) |
IP =input("enter your ip address ")
count_seg = 0
len_seg = 0
i = ''
for i in range(0,len(IP)):
if(IP[i] =='.'):
print("segment {} contain {} characters".format(count_seg+1,len_seg))
count_seg += 1
len_seg = 0
else:
len_seg +=1
if i != "." :
print("segment... | ip = input('enter your ip address ')
count_seg = 0
len_seg = 0
i = ''
for i in range(0, len(IP)):
if IP[i] == '.':
print('segment {} contain {} characters'.format(count_seg + 1, len_seg))
count_seg += 1
len_seg = 0
else:
len_seg += 1
if i != '.':
print('segment {} contain {} ... |
numero=int(input("Digite numero: "))
if(numero%2==0):
print("el numero es par")
else:
print("el numero es impar")
| numero = int(input('Digite numero: '))
if numero % 2 == 0:
print('el numero es par')
else:
print('el numero es impar') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.