content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class JustCounter:
__secretCount = 0
publicCount = 0
def count(self):
self.__secretCount += 1
self.publicCount += 1
print(self.__secretCount)
counter = JustCounter()
counter.count()
counter.count()
print(counter.publicCount)
print(counter.__secretCount)
| class Justcounter:
__secret_count = 0
public_count = 0
def count(self):
self.__secretCount += 1
self.publicCount += 1
print(self.__secretCount)
counter = just_counter()
counter.count()
counter.count()
print(counter.publicCount)
print(counter.__secretCount) |
# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidato... | auth_password_validators = [{'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'}, {'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'}, {'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator'}, {'NAME': 'django.contrib.auth.password_validation.Num... |
class Solution:
def simplifyPath(self, path: str) -> str:
spath = path.split('/')
result = []
for i in range(len(spath)):
if spath[i] == '' or spath[i] == '.' or (spath[i] == '..' and len(result) == 0):
continue
elif spath[i] == '..' and len(... | class Solution:
def simplify_path(self, path: str) -> str:
spath = path.split('/')
result = []
for i in range(len(spath)):
if spath[i] == '' or spath[i] == '.' or (spath[i] == '..' and len(result) == 0):
continue
elif spath[i] == '..' and len(result) ... |
# fig_supp_steady_pn_lognorm_syn.py ---
# Author: Subhasis Ray
# Created: Fri Mar 15 16:04:34 2019 (-0400)
# Last-Updated: Fri Mar 15 16:05:11 2019 (-0400)
# By: Subhasis Ray
# Version: $Id$
# Code:
jid = '22251511'
#
# fig_supp_steady_pn_lognorm_syn.py ends here
| jid = '22251511' |
# -*- coding: utf-8 -*-
__author__ = 'Amit Arora'
__email__ = 'aa1603@georgetown.edu'
__version__ = '0.1.0'
| __author__ = 'Amit Arora'
__email__ = 'aa1603@georgetown.edu'
__version__ = '0.1.0' |
class Solution:
def addStrings(self, num1: str, num2: str) -> str:
nums1 = list(num1)
nums2 = list(num2)
res, carry = [], 0
while nums1 or nums2:
n1 = n2 = 0
if nums1:
n1 = ord(nums1.pop()) - ord("0")
if nums2:
n2 =... | class Solution:
def add_strings(self, num1: str, num2: str) -> str:
nums1 = list(num1)
nums2 = list(num2)
(res, carry) = ([], 0)
while nums1 or nums2:
n1 = n2 = 0
if nums1:
n1 = ord(nums1.pop()) - ord('0')
if nums2:
... |
Alcool=0
Gasolina=0
Diesel=0
numero=0
while True:
numero=int(input())
if(numero==1):
Alcool+=1
if(numero==2):
Gasolina+=1
if(numero==3):
Diesel+=1
if(numero==4):
break
print('MUITO OBRIGADO')
print(f'Alcool: {Alcool}')
print(f'Gasolina: {Gasolina}')
print(f'Diesel: {D... | alcool = 0
gasolina = 0
diesel = 0
numero = 0
while True:
numero = int(input())
if numero == 1:
alcool += 1
if numero == 2:
gasolina += 1
if numero == 3:
diesel += 1
if numero == 4:
break
print('MUITO OBRIGADO')
print(f'Alcool: {Alcool}')
print(f'Gasolina: {Gasolina}'... |
#!/usr/bin/python
class GrabzItScrape:
def __init__(self, identifier, name, status, nextRun, results):
self.ID = identifier
self.Name = name
self.Status = status
self.NextRun = nextRun
self.Results = results
| class Grabzitscrape:
def __init__(self, identifier, name, status, nextRun, results):
self.ID = identifier
self.Name = name
self.Status = status
self.NextRun = nextRun
self.Results = results |
# -*- coding: utf-8 -*-
def main():
s = input()
n = len(s)
k = int(input())
if k > n:
print(0)
else:
ans = set()
for i in range(n - k + 1):
ans.add(s[i:i + k])
print(len(ans))
if __name__ == '__main__':
main()
| def main():
s = input()
n = len(s)
k = int(input())
if k > n:
print(0)
else:
ans = set()
for i in range(n - k + 1):
ans.add(s[i:i + k])
print(len(ans))
if __name__ == '__main__':
main() |
nome = input ("colocar nome do cliente:")
preco = float (input ("colocar preco:"))
quantidade = float (input ("colocar a contidade:"))
valor_total = (quantidade) * (preco)
print("Senhor %s seus produtos totalizam R$ %.2f reais."%(nome,valor_total)) | nome = input('colocar nome do cliente:')
preco = float(input('colocar preco:'))
quantidade = float(input('colocar a contidade:'))
valor_total = quantidade * preco
print('Senhor %s seus produtos totalizam R$ %.2f reais.' % (nome, valor_total)) |
class Celsius:
def __init__(self, temperature=0):
self.temperature = temperature
def to_fahrenheit(self):
return (self.temperature * 1.8) + 32
@property
def temperature(self):
print(f"Getting value: {self.__temperature}")
return self.__temperature # private attribute = ... | class Celsius:
def __init__(self, temperature=0):
self.temperature = temperature
def to_fahrenheit(self):
return self.temperature * 1.8 + 32
@property
def temperature(self):
print(f'Getting value: {self.__temperature}')
return self.__temperature
@temperature.sette... |
# Created by MechAviv
# Map ID :: 807040000
# Momijigaoka : Unfamiliar Hillside
if "1" not in sm.getQRValue(57375) and sm.getChr().getJob() == 4001:
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.sendDelay(1000)
sm.levelUntil(10)
sm.cr... | if '1' not in sm.getQRValue(57375) and sm.getChr().getJob() == 4001:
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.sendDelay(1000)
sm.levelUntil(10)
sm.createQuestWithQRValue(57375, '1')
sm.removeSkill(40010001)
sm.setJob(4100)... |
age=input("How old are you?")
height=input("How tall are you?")
weight=input("How much do you weigh?")
print("So, you're %r old, %r tall and %r heavy." %(age,height,weight))
| age = input('How old are you?')
height = input('How tall are you?')
weight = input('How much do you weigh?')
print("So, you're %r old, %r tall and %r heavy." % (age, height, weight)) |
#!/usr/bin/python3
__author__ = 'Alan Au'
__date__ = '2017-12-13'
'''
--- Day 10: Knot Hash ---
You come across some programs that are trying to implement a software emulation of a hash based on knot-tying. The hash these programs are implementing isn't very strong, but you decide to help them anyway. You make a me... | __author__ = 'Alan Au'
__date__ = '2017-12-13'
"\n--- Day 10: Knot Hash ---\n\nYou come across some programs that are trying to implement a software emulation of a hash based on knot-tying. The hash these programs are implementing isn't very strong, but you decide to help them anyway. You make a mental note to remind t... |
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
d = {}
for i, x in enumerate(nums):
if target - x in d:
return [i, d[target - x]]
d[x] = i
return []
| class Solution:
def two_sum(self, nums: List[int], target: int) -> List[int]:
d = {}
for (i, x) in enumerate(nums):
if target - x in d:
return [i, d[target - x]]
d[x] = i
return [] |
class Person:
def __init__(self, name, money):
self.name = name
self.money = money
@property
def money(self):
print("money getter executed")
return self.__money
@money.setter
def money(self, money):
print("setter executed")
if money < 0:
... | class Person:
def __init__(self, name, money):
self.name = name
self.money = money
@property
def money(self):
print('money getter executed')
return self.__money
@money.setter
def money(self, money):
print('setter executed')
if money < 0:
... |
# Lab 26
#!/usr/bin/env python3
def main():
round = 0
answer = ' '
while round < 3 and answer.lower() != "brian":
round += 1
print('Finish the movie title, "Monty Python\'s The Life of ______"')
answer = input("Your answer --> ")
if answer.lower() == "brian":
pr... | def main():
round = 0
answer = ' '
while round < 3 and answer.lower() != 'brian':
round += 1
print('Finish the movie title, "Monty Python\'s The Life of ______"')
answer = input('Your answer --> ')
if answer.lower() == 'brian':
print('Correct')
break
... |
config = {
'username': "", # Robinhood credentials
'password': "",
'trades_enabled': False, # if False, just collect data
'simulate_api_calls': False, # if enabled, just pretend to connect to Robinhood
'ticker_list': { # list of coin ticker pairs Kraken/Robinhood (XETHZUSD/ETH, etc) - https://api.k... | config = {'username': '', 'password': '', 'trades_enabled': False, 'simulate_api_calls': False, 'ticker_list': {'XETHZUSD': 'ETH'}, 'trade_signals': {'buy': 'sma_rsi_threshold', 'sell': 'above_buy'}, 'moving_average_periods': {'sma_fast': 12, 'sma_slow': 48, 'ema_fast': 12, 'ema_slow': 48, 'macd_fast': 12, 'macd_slow':... |
# %% [279. Perfect Squares](https://leetcode.com/problems/perfect-squares/)
class Solution:
def numSquares(self, n: int) -> int:
return numSquares(n, math.floor(math.sqrt(n)))
@functools.lru_cache(None)
def numSquares(n, m):
if n <= 0 or not m:
return 2 ** 31 if n else 0
return min(numSqua... | class Solution:
def num_squares(self, n: int) -> int:
return num_squares(n, math.floor(math.sqrt(n)))
@functools.lru_cache(None)
def num_squares(n, m):
if n <= 0 or not m:
return 2 ** 31 if n else 0
return min(num_squares(n - m * m, m) + 1, num_squares(n, m - 1)) |
class Service:
def __init__(self):
self.ver = '/api/nutanix/v3/'
@property
def name(self):
return self.ver
| class Service:
def __init__(self):
self.ver = '/api/nutanix/v3/'
@property
def name(self):
return self.ver |
# https://leetcode.com/problems/word-search
class Solution:
def __init__(self):
self.ans = False
def backtrack(self, current_length, visited, y, x, board, word):
if self.ans:
return
if current_length == len(word):
self.ans = True
return
next... | class Solution:
def __init__(self):
self.ans = False
def backtrack(self, current_length, visited, y, x, board, word):
if self.ans:
return
if current_length == len(word):
self.ans = True
return
nexts = [(y + 1, x), (y - 1, x), (y, x + 1), (y, ... |
a = 1
b = 2
c = 3
print("hello python")
| a = 1
b = 2
c = 3
print('hello python') |
# -*- coding: utf-8 -*-
name = 'usd_katana'
version = '0.8.2'
requires = [
'usd-0.8.2'
]
build_requires = [
'cmake-3.2',
]
variants = [['platform-linux', 'arch-x86_64', 'katana-2.5.4'],
['platform-linux', 'arch-x86_64', 'katana-2.6.4']]
def commands():
env.KATANA_RESOURCES.append('{this.r... | name = 'usd_katana'
version = '0.8.2'
requires = ['usd-0.8.2']
build_requires = ['cmake-3.2']
variants = [['platform-linux', 'arch-x86_64', 'katana-2.5.4'], ['platform-linux', 'arch-x86_64', 'katana-2.6.4']]
def commands():
env.KATANA_RESOURCES.append('{this.root}/third_party/katana/plugin')
env.KATANA_POST_PY... |
class PMS_base(object):
history_number = 2 # image history number
jobs = 4 # thread or process number
max_iter_number = 400 # 'control the max iteration number for trainning')
paths_number = 4 # 'number of paths in each rollout')
max_path_length = 200 # 'timesteps in each path')
batch_siz... | class Pms_Base(object):
history_number = 2
jobs = 4
max_iter_number = 400
paths_number = 4
max_path_length = 200
batch_size = 100
max_kl = 0.01
gae_lambda = 1.0
subsample_factor = 0.05
cg_damping = 0.001
discount = 0.99
cg_iters = 20
deviation = 0.1
render = False... |
def labyrinth(levels, orcs_first, L):
if levels == 1:
return orcs_first
return min(labyrinth(levels - 1, orcs_first, L) ** 2, labyrinth(levels - 1, orcs_first, L) + L)
print(labyrinth(int(input()), int(input()), int(input())))
| def labyrinth(levels, orcs_first, L):
if levels == 1:
return orcs_first
return min(labyrinth(levels - 1, orcs_first, L) ** 2, labyrinth(levels - 1, orcs_first, L) + L)
print(labyrinth(int(input()), int(input()), int(input()))) |
_base_ = [
'../_base_/models/mask_rcnn_r50_fpn.py',
'../_base_/datasets/cityscapes_instance.py', '../_base_/default_runtime.py'
]
model = dict(
pretrained=None,
roi_head=dict(
bbox_head=dict(
type='Shared2FCBBoxHead',
in_channels=256,
fc_out_channels=1024,
... | _base_ = ['../_base_/models/mask_rcnn_r50_fpn.py', '../_base_/datasets/cityscapes_instance.py', '../_base_/default_runtime.py']
model = dict(pretrained=None, roi_head=dict(bbox_head=dict(type='Shared2FCBBoxHead', in_channels=256, fc_out_channels=1024, roi_feat_size=7, num_classes=8, bbox_coder=dict(type='DeltaXYWHBBoxC... |
#!/usr/bin/python3
for tens in range(0, 9):
for ones in range(tens + 1, 10):
if tens != 8:
print("{}{}, ".format(tens, ones), end='')
print("89")
| for tens in range(0, 9):
for ones in range(tens + 1, 10):
if tens != 8:
print('{}{}, '.format(tens, ones), end='')
print('89') |
# ==================================================================================================
# Copyright 2014 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | def sizeof_fmt(num):
for x in ('', 'KB', 'MB', 'GB'):
if num < 1024.0:
if x == '':
return '%d%s' % (num, x)
else:
return '%3.1f%s' % (num, x)
num /= 1024.0
return '%3.1f%s' % (num, 'TB')
class Counters(object):
all = -1
writes = 0
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Silvio Peroni <essepuntato@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted, provided that the above copyright notice
# and this permission notice appear in all copies.
#
# THE SOFTWARE I... | def f(mat_string):
c = 0
lst = list()
for chr in mat_string:
n = int(chr)
lst.append(n)
if n / 2 != n // 2:
c = c + 1
return g(lst, c)
def g(mat_list, c):
if c <= 0 or len(mat_list) == 0:
return 0
else:
v = 0
result = list()
fo... |
class A:
def __init__(self):
self.A_NEW_NAME = 1
def _foo(self):
pass
a_class = A()
a_class._foo()
print(a_class.A_NEW_NAME)
| class A:
def __init__(self):
self.A_NEW_NAME = 1
def _foo(self):
pass
a_class = a()
a_class._foo()
print(a_class.A_NEW_NAME) |
# Constants used for creating the Filesets.
FILESETS_ENTRY_GROUP_NAME_COLUMN_LABEL = 'entry_group_name'
FILESETS_ENTRY_GROUP_DISPLAY_NAME_COLUMN_LABEL = 'entry_group_display_name'
FILESETS_ENTRY_GROUP_DESCRIPTION_COLUMN_LABEL = 'entry_group_description'
FILESETS_ENTRY_ID_COLUMN_LABEL = 'entry_id'
FILESETS_ENTRY_DISPLAY... | filesets_entry_group_name_column_label = 'entry_group_name'
filesets_entry_group_display_name_column_label = 'entry_group_display_name'
filesets_entry_group_description_column_label = 'entry_group_description'
filesets_entry_id_column_label = 'entry_id'
filesets_entry_display_name_column_label = 'entry_display_name'
fi... |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... | power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres... |
__all__ = [
'phone_regex'
]
phone_regex = r'^010[-\s]??\d{3,4}[-\s]??\d{4}$'
| __all__ = ['phone_regex']
phone_regex = '^010[-\\s]??\\d{3,4}[-\\s]??\\d{4}$' |
def insertion(array):
for i in range(1, len(array)):
j = i -1
while array[j] > array[j+1] and j >= 0:
array[j], array[j+1] = array[j+1], array[j]
j-=1
return array
print (insertion([7, 8, 5, 4, 9, 2])) | def insertion(array):
for i in range(1, len(array)):
j = i - 1
while array[j] > array[j + 1] and j >= 0:
(array[j], array[j + 1]) = (array[j + 1], array[j])
j -= 1
return array
print(insertion([7, 8, 5, 4, 9, 2])) |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Kevin Subileau (@ksubileau)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = r'''
---
module: win_rds_rap
short_description: Manage Resource Authorization Policies (RAP) on a Remote Desktop Gat... | documentation = '\n---\nmodule: win_rds_rap\nshort_description: Manage Resource Authorization Policies (RAP) on a Remote Desktop Gateway server\ndescription:\n - Creates, removes and configures a Remote Desktop resource authorization policy (RD RAP).\n - A RD RAP allows you to specify the network resources (computers... |
name = 'causalml'
__version__ = '0.11.1'
__all__ = ['dataset',
'features',
'feature_selection',
'inference',
'match',
'metrics',
'optimize',
'propensity']
| name = 'causalml'
__version__ = '0.11.1'
__all__ = ['dataset', 'features', 'feature_selection', 'inference', 'match', 'metrics', 'optimize', 'propensity'] |
# ************************************************************************* #
# Author: Pawel Rosikiewicz #
# Copyrith: IT IS NOT ALLOWED TO COPY OR TO DISTRIBUTE #
# these file without written #
#... | """THIS FILE CONTAINS ONLY ONE VARIABLE, A BASEDIRECTORY, THAT ALLOWS MANAGING FILE DIRECTORIESS TO ALL FILES USED BY PROJECT SOFTWARE AND SCRIPTS"""
basedir = '/Users/pawel/Desktop/Activities/005__COURSES/000__EPFLext_ADSML/Module 5 __ CAPSTONE PROJECT/skin_cancer_detection' |
#
# PySNMP MIB module ASANTE-SWITCH-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASANTE-SWITCH-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:09:56 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint, constraints_union) ... |
# Okta codility challenge
def solution(A, Y):
# write your code in Python 3.6
clientTimestamps = {}
clients = []
resultMap = {}
result = []
for cur in A:
client = cur.split(' ')[0]
timestamp = cur.split(' ')[1]
if client not in clientTimestamps:
clients.ap... | def solution(A, Y):
client_timestamps = {}
clients = []
result_map = {}
result = []
for cur in A:
client = cur.split(' ')[0]
timestamp = cur.split(' ')[1]
if client not in clientTimestamps:
clients.append(client)
clientTimestamps[client] = list([timest... |
class Circle:
__pi = 3.14
def __init__(self, diameter):
self.radius = diameter / 2
self.diameter = diameter
def calculate_circumference(self):
return self.diameter * self.__pi
def calculate_area(self):
radius = self.diameter / 2
return radius * radius * self.__... | class Circle:
__pi = 3.14
def __init__(self, diameter):
self.radius = diameter / 2
self.diameter = diameter
def calculate_circumference(self):
return self.diameter * self.__pi
def calculate_area(self):
radius = self.diameter / 2
return radius * radius * self.__... |
permissions = [
'accessapproval.requests.approve',
'accessapproval.requests.dismiss',
'accessapproval.requests.get',
'accessapproval.requests.list',
'accessapproval.settings.get',
'accessapproval.settings.update',
'androidmanagement.enterprises.manage',
'appengine.applications.create',
'appengine.applications.... | permissions = ['accessapproval.requests.approve', 'accessapproval.requests.dismiss', 'accessapproval.requests.get', 'accessapproval.requests.list', 'accessapproval.settings.get', 'accessapproval.settings.update', 'androidmanagement.enterprises.manage', 'appengine.applications.create', 'appengine.applications.get', 'app... |
ALL_BLUE_MOUNTAINS_SERVICES = range(9833, 9848)
INBOUND_BLUE_MOUNTAINS_SERVICES = (9833, 9835, 9838, 9840, 9841, 9843, 9844,
9847)
YELLOW_LINE_SERVICES = [9901, 9903, 9904, 9906, 9908, 9909, 9911, 9964, 9965,
9966, 9967, 9968, 9969, 9972, 9973, 9974]
# 9847 has... | all_blue_mountains_services = range(9833, 9848)
inbound_blue_mountains_services = (9833, 9835, 9838, 9840, 9841, 9843, 9844, 9847)
yellow_line_services = [9901, 9903, 9904, 9906, 9908, 9909, 9911, 9964, 9965, 9966, 9967, 9968, 9969, 9972, 9973, 9974]
test_services = (9843,)
lithgow_to_central_origins = ('Lithgow Statio... |
study_name = 'mperf'
# Sampling frequency
SAMPLING_FREQ_RIP = 21.33
SAMPLING_FREQ_MOTIONSENSE_ACCEL = 25
SAMPLING_FREQ_MOTIONSENSE_GYRO = 25
# MACD (moving average convergence divergence) related threshold
FAST_MOVING_AVG_SIZE = 13
SLOW_MOVING_AVG_SIZE = 131
# FAST_MOVING_AVG_SIZE = 20
# SLOW_MOVING_AVG_SIZE = 205
#... | study_name = 'mperf'
sampling_freq_rip = 21.33
sampling_freq_motionsense_accel = 25
sampling_freq_motionsense_gyro = 25
fast_moving_avg_size = 13
slow_moving_avg_size = 131
min_roll = -20
max_roll = 65
min_pitch = -125
max_pitch = -40
min_mshrv_accel = -2.5
max_mshrv_accel = 2.5
min_mshrv_gyro = -250
max_mshrv_gyro = 2... |
x = y = 1
print(x,y)
x = y = z = 1
print(x,y,z)
| x = y = 1
print(x, y)
x = y = z = 1
print(x, y, z) |
#-*- coding: utf-8 -*-
# Let's start with lists
spam = ["eggs", 7.12345] # This is a list, a comma-separated sequence of values between square brackets
print(spam)
print(type(spam))
eggs = [spam,
1.2345,
"fooo"] # No problem with multi-line declaration
print(eggs)
#========... | spam = ['eggs', 7.12345]
print(spam)
print(type(spam))
eggs = [spam, 1.2345, 'fooo']
print(eggs)
spam = ['eggs']
print(spam)
spam = []
print(spam)
spam = ('eggs', 7.12345)
print(spam)
print(type(spam))
eggs = (spam, 1.2345, 'fooo')
print(eggs)
spam = ['1st', '2nd', '3rd', '4th', '5th']
eggs = (spam, 1.2345, 'fooo')
pri... |
#define a dictionary data structure
#dictionaries have key:valyue pairs for the elements
example_dict = {
"class" : "ASTR 119",
"prof" : "Brant",
"awesomeness" : 10
}
print ("The type of example_dict is ", type(example_dict))
#get value via key
course = example_dict["class"]
print(course)
example_dict["awesomene... | example_dict = {'class': 'ASTR 119', 'prof': 'Brant', 'awesomeness': 10}
print('The type of example_dict is ', type(example_dict))
course = example_dict['class']
print(course)
example_dict['awesomeness'] += 1
print(example_dict)
for x in example_dict.key():
print(x, example_dict[x]) |
## @ GpioDataConfig.py
# This is a Gpio config script for Slim Bootloader
#
# Copyright (c) 2020, Intel Corporation. All rights reserved. <BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
#
# The index for a group has to match implementation
# in a platform specific Gpio library.
#
grp_info_lp = {
# Grp ... | grp_info_lp = {'GPP_B': [0], 'GPP_T': [1], 'GPP_A': [2], 'GPP_R': [3], 'GPP_S': [5], 'GPP_H': [6], 'GPP_D': [7], 'GPP_U': [8], 'GPP_C': [10], 'GPP_F': [11], 'GPP_E': [12]}
grp_info_h = {'GPP_A': [1], 'GPP_R': [2], 'GPP_B': [3], 'GPP_D': [4], 'GPP_C': [5], 'GPP_S': [6], 'GPP_G': [7], 'GPP_E': [9], 'GPP_F': [10], 'GPP_H'... |
class Solution:
def flipAndInvertImage(self, A: [[int]]) -> [[int]]:
for row in A :
left, right = 0 , len(row) -1
while left < right :
if row[left] == row[right] :
row[left] ^= 1
row[right] ^= 1
left += 1
... | class Solution:
def flip_and_invert_image(self, A: [[int]]) -> [[int]]:
for row in A:
(left, right) = (0, len(row) - 1)
while left < right:
if row[left] == row[right]:
row[left] ^= 1
row[right] ^= 1
left += 1
... |
def read_input():
with open("input.txt", "r") as file:
d = [c[2:].split("..") for c in file.read()[13:].split(", ")]
return [int(i) for s in d for i in s]
def bruteforce(y_v, x_v, b):
x,y = 0,0
while True:
x+=x_v
y+=y_v
if b[0] <= x <= b[1] and b[2] <= y <= b[3]:
... | def read_input():
with open('input.txt', 'r') as file:
d = [c[2:].split('..') for c in file.read()[13:].split(', ')]
return [int(i) for s in d for i in s]
def bruteforce(y_v, x_v, b):
(x, y) = (0, 0)
while True:
x += x_v
y += y_v
if b[0] <= x <= b[1] and b[2] <= y <=... |
#!/usr/bin/python
# Filename: ex_global.py
x = 50
def func():
global x
print('x is ', x)
x = 2
print('Changed local x to ', x)
func()
print('Value of x is ', x)
| x = 50
def func():
global x
print('x is ', x)
x = 2
print('Changed local x to ', x)
func()
print('Value of x is ', x) |
class RUNLOG:
class STATUS:
SUCCESS = "SUCCESS"
PENDING = "PENDING"
RUNNING = "RUNNING"
FAILURE = "FAILURE"
WARNING = "WARNING"
ERROR = "ERROR"
APPROVAL = "APPROVAL"
APPROVAL_FAILED = "APPROVAL_FAILED"
ABORTED = "ABORTED"
ABORTING = "AB... | class Runlog:
class Status:
success = 'SUCCESS'
pending = 'PENDING'
running = 'RUNNING'
failure = 'FAILURE'
warning = 'WARNING'
error = 'ERROR'
approval = 'APPROVAL'
approval_failed = 'APPROVAL_FAILED'
aborted = 'ABORTED'
aborting = 'A... |
l=int(input("enter length: "))
b=int(input("enter breath: "))
area=l*b
perimeter=2*(l+b)
print(area)
print(perimeter)
| l = int(input('enter length: '))
b = int(input('enter breath: '))
area = l * b
perimeter = 2 * (l + b)
print(area)
print(perimeter) |
# Simple Math Libraries
def add(*nums):
number = 0
for num in nums:
number += num
return number
def sub(*nums):
number = 0
for num in nums:
number -= num
return number
def multiply(*nums):
number = 1
for num in nums:
number *= num
retu... | def add(*nums):
number = 0
for num in nums:
number += num
return number
def sub(*nums):
number = 0
for num in nums:
number -= num
return number
def multiply(*nums):
number = 1
for num in nums:
number *= num
return number
def square(num):
return num ** 2... |
#!/usr/bin/env python
# coding: utf-8
def countAnswers(__values):
batchComplete = False
answerCount = 0
answerDict = {}
for answers in __values:
for answer in answers:
answerDict[answer] = 1
if answers == '':
batchComplete = True
if batchComplete:
... | def count_answers(__values):
batch_complete = False
answer_count = 0
answer_dict = {}
for answers in __values:
for answer in answers:
answerDict[answer] = 1
if answers == '':
batch_complete = True
if batchComplete:
answer_count += len(answerDic... |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"from matplotlib import style\n",
"style.use('fivethirtyeight')\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count":... | {'cells': [{'cell_type': 'code', 'execution_count': 1, 'metadata': {}, 'outputs': [], 'source': ['%matplotlib inline\n', 'from matplotlib import style\n', "style.use('fivethirtyeight')\n", 'import matplotlib.pyplot as plt']}, {'cell_type': 'code', 'execution_count': 2, 'metadata': {}, 'outputs': [], 'source': ['import ... |
#!/usr/bin/env python3
class ObjInfo(dict):
def __init__(self): #, pre_id, name, letter, expire_state, id):
self.side_id_name = ['front', 'back', 'left_side', 'right_side', 'bottom', 'side_id5', 'side_id6', 'side_id7', 'side_id8', 'side_id9']
self.obj = {
# predefined merchandise infor... | class Objinfo(dict):
def __init__(self):
self.side_id_name = ['front', 'back', 'left_side', 'right_side', 'bottom', 'side_id5', 'side_id6', 'side_id7', 'side_id8', 'side_id9']
self.obj = {'pre_id': None, 'name': '', 'letter': '', 'expired': '', 'id': None, 'side_id': '', 'pos': None, 'vector': None... |
# Version number as Major.Minor.Patch
# The version modification must respect the following rules:
# Major should be incremented in case there is a breaking change. (eg: 2.5.8 -> 3.0.0)
# Minor should be incremented in case there is an enhancement. (eg: 2.5.8 -> 2.6.0)
# Patch should be incremented in case there is a b... | __version__ = '3.3.1' |
# https://codeforces.com/problemset/problem/427/A
n = int(input())
events = [int(x) for x in input().split()]
counter = 0
free_officer = 0
for event in events:
free_officer += event
if free_officer < 0:
counter += 1
free_officer = 0
print(counter)
| n = int(input())
events = [int(x) for x in input().split()]
counter = 0
free_officer = 0
for event in events:
free_officer += event
if free_officer < 0:
counter += 1
free_officer = 0
print(counter) |
class Menu:
def __init__(self, options: list):
self.options = options
def printMenu(self):
print(' [ Main Menu ] ')
for i in range(len(self.options)):
print((i + 1), '::', self.options[i])
def getMenuInput(self, waitValidated: bool):
returnValue = -2
... | class Menu:
def __init__(self, options: list):
self.options = options
def print_menu(self):
print(' [ Main Menu ] ')
for i in range(len(self.options)):
print(i + 1, '::', self.options[i])
def get_menu_input(self, waitValidated: bool):
return_value = -2
... |
# python DDP_moco_ccrop.py path/to/this/config
# model
dim = 128
model = dict(type='ResNet', depth=18, num_classes=dim, maxpool=False)
moco = dict(dim=dim, K=65536, m=0.999, T=0.20, mlp=True)
loss = dict(type='CrossEntropyLoss')
# data
root = '/path/to/your/dataset'
mean = (0.4914, 0.4822, 0.4465)
std = (0.2023, 0.19... | dim = 128
model = dict(type='ResNet', depth=18, num_classes=dim, maxpool=False)
moco = dict(dim=dim, K=65536, m=0.999, T=0.2, mlp=True)
loss = dict(type='CrossEntropyLoss')
root = '/path/to/your/dataset'
mean = (0.4914, 0.4822, 0.4465)
std = (0.2023, 0.1994, 0.201)
batch_size = 512
num_workers = 4
data = dict(train=dic... |
#@liveupdate("globalClassMethod", "svc.debug::debugSvc", "OnRemoteExec")
def OnRemoteExec(self, signedCode):
eve.Message("CustomNotify", {"notify": "OnRemoteExec called"})
# No need to check if we're a client!
code = marshal.loads(signedCode)
self._Exec(code, {})
| def on_remote_exec(self, signedCode):
eve.Message('CustomNotify', {'notify': 'OnRemoteExec called'})
code = marshal.loads(signedCode)
self._Exec(code, {}) |
#frase = 'Curso em video python'
#print(frase[:13])
#frase = ' Curso em video python '
#print(len(frase.strip()))
#frase = 'Curso em Video Python'
#print(frase.replace('Python', 'Android'))
#frase ='Curso em Video Python'
#print('Curso' in frase)
frase = 'Curso em Vidio Python'
dividido = frase.split()
print(di... | frase = 'Curso em Vidio Python'
dividido = frase.split()
print(dividido[0]) |
#
# PySNMP MIB module CISCO-GPRS-L2RLY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-GPRS-L2RLY-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:42:06 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, single_value_constraint, constraints_intersection, value_size_constraint) ... |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = ()
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/tmp/locality.db'
}
}
TIME_ZONE = "UTC"
LANGUAGE_CODE = "en-us"
SITE_ID = 1
USE_I18N = True
USE_L10N = True
MEDIA_ROOT = ''
MEDIA_URL = ''
STATIC_ROOT = ''
STATIC_URL = '... | debug = True
template_debug = DEBUG
admins = ()
managers = ADMINS
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': '/tmp/locality.db'}}
time_zone = 'UTC'
language_code = 'en-us'
site_id = 1
use_i18_n = True
use_l10_n = True
media_root = ''
media_url = ''
static_root = ''
static_url = '/static/'
... |
#program to convert a list of tuples into a dictionary.
#create a list
l = [("x", 1), ("x", 2), ("x", 3), ("y", 1), ("y", 2), ("z", 1)]
d = {}
for a, b in l:
d.setdefault(a, []).append(b)
print (d) | l = [('x', 1), ('x', 2), ('x', 3), ('y', 1), ('y', 2), ('z', 1)]
d = {}
for (a, b) in l:
d.setdefault(a, []).append(b)
print(d) |
floor_number = int(input())
room_number = int(input())
for floor in range(floor_number, 0, -1):
if floor == floor_number:
result = [f'L{floor}{room}' for room in range(room_number)]
print(' '.join(result))
continue
if floor % 2 == 0:
result = [f'O{floor}{room}' for ... | floor_number = int(input())
room_number = int(input())
for floor in range(floor_number, 0, -1):
if floor == floor_number:
result = [f'L{floor}{room}' for room in range(room_number)]
print(' '.join(result))
continue
if floor % 2 == 0:
result = [f'O{floor}{room}' for room in range(... |
class User:
last_name = ''
first_name = ''
email = ''
def authenticate(self):
# some logic to authenticate should be added here, currently it does nothing
# e.g. we can access the attributes of the object to authenticate via email
# address. Here, we just print it out instead ... | class User:
last_name = ''
first_name = ''
email = ''
def authenticate(self):
print('logging in user ' + self.first_name + ' ' + self.last_name + ' with email address ' + self.email)
def set_name(self, fn, ln):
self.last_name = ln
self.first_name = fn
def set_email(sel... |
grid = [
[ 8, 2,22,97,38,15, 0,40, 0,75, 4, 5, 7,78,52,12,50,77,91, 8],
[49,49,99,40,17,81,18,57,60,87,17,40,98,43,69,48, 4,56,62, 0],
[81,49,31,73,55,79,14,29,93,71,40,67,53,88,30, 3,49,13,36,65],
[52,70,95,23, 4,60,11,42,69,24,68,56, 1,32,56,71,37, 2,36,91],
[22,31,16,71,51,67,63,89,41,92,36,54,22,40,40,28,66,33... | grid = [[8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8], [49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0], [81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65], [52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, 36, 91]... |
class Aluno():
def __init__(self):
self.nome = "Pinguim"
self.rg = 1234567891011
self.curso = "missanga"
def printa(self):
print("nome = ",self.nome)
print("rg = ",self.rg)
print("curso = ",self.curso)
Aluno = Aluno()
Aluno.printa() | class Aluno:
def __init__(self):
self.nome = 'Pinguim'
self.rg = 1234567891011
self.curso = 'missanga'
def printa(self):
print('nome = ', self.nome)
print('rg = ', self.rg)
print('curso = ', self.curso)
aluno = aluno()
Aluno.printa() |
class RedisList:
def __init__(self, redis, key, converter, content=None):
self.key_ = key
self.redis_ = redis
self.converter_ = converter
if content:
self.reset(content)
def __len__(self):
return self.redis_.llen(self.key_)
def __getitem__(self, index):... | class Redislist:
def __init__(self, redis, key, converter, content=None):
self.key_ = key
self.redis_ = redis
self.converter_ = converter
if content:
self.reset(content)
def __len__(self):
return self.redis_.llen(self.key_)
def __getitem__(self, index):... |
#
# PySNMP MIB module NTPv4-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NTPv4-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:15:56 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, 09:23... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, constraints_intersection, value_range_constraint, single_value_constraint) ... |
def average_discount(list_of_changes):
total = 0
count = 0
for change in list_of_changes:
if change < 0:
total += (- change)
count += 1
return round((total / count), 2)
def calculate_discount_averages(x):
result=[]
for i in x:
try:
... | def average_discount(list_of_changes):
total = 0
count = 0
for change in list_of_changes:
if change < 0:
total += -change
count += 1
return round(total / count, 2)
def calculate_discount_averages(x):
result = []
for i in x:
try:
y = average_di... |
n = int(input())
even_ones = set()
odd_ones = set()
index = 0
sum_of_chars = 0
for _ in range(n):
name = input()
index += 1
for char in name:
sum_of_chars += int(ord(char))
sum_of_chars //= index
if sum_of_chars % 2 == 0:
even_ones.add(sum_of_chars)
else:
odd_ones.add(s... | n = int(input())
even_ones = set()
odd_ones = set()
index = 0
sum_of_chars = 0
for _ in range(n):
name = input()
index += 1
for char in name:
sum_of_chars += int(ord(char))
sum_of_chars //= index
if sum_of_chars % 2 == 0:
even_ones.add(sum_of_chars)
else:
odd_ones.add(sum... |
# configs
config_path = './config/config.yaml'
# urls
base_url = 'https://www.finanzen.net/index/'
ext_urls = {
'DAX' : 'dax/30-werte',
'TECDAX' : 'tecdax/werte',
'DOW JONES' : 'dow_jones/werte',
'MDAX' : 'mdax/werte',
'SDAX' : 'sdax/werte',
'S&P... | config_path = './config/config.yaml'
base_url = 'https://www.finanzen.net/index/'
ext_urls = {'DAX': 'dax/30-werte', 'TECDAX': 'tecdax/werte', 'DOW JONES': 'dow_jones/werte', 'MDAX': 'mdax/werte', 'SDAX': 'sdax/werte', 'S&P500': 's&p_500/werte', 'NASDAQ100': 'nasdaq_100/werte', 'EUROSTOXX': 'euro_stoxx_50/werte', 'SMI'... |
n = int(input("Enter Number:"))
sum = 0
while(n != 0):
sum += n % 10
n //= 10 #floor division
print(sum)
| n = int(input('Enter Number:'))
sum = 0
while n != 0:
sum += n % 10
n //= 10
print(sum) |
# Interactive Coding Exercise 2
# Solution - Wrapped the input on line 4 in an int().
year = int(input("Which year do you want to check?"))
if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
print("Leap year.")
else:
print("Not leap year.")
else:
print("Leap year.")
else:
print("N... | year = int(input('Which year do you want to check?'))
if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
print('Leap year.')
else:
print('Not leap year.')
else:
print('Leap year.')
else:
print('Not leap year.') |
class CPP:
@staticmethod
def __protection_exception(prop):
raise Exception(f'Can not modify constant property: {prop}')
@staticmethod
def protect(obj, prop):
setattr(obj.__class__, prop, property(
lambda self: getattr(self, '_'+prop),
lambda self, value: CPP.__pr... | class Cpp:
@staticmethod
def __protection_exception(prop):
raise exception(f'Can not modify constant property: {prop}')
@staticmethod
def protect(obj, prop):
setattr(obj.__class__, prop, property(lambda self: getattr(self, '_' + prop), lambda self, value: CPP.__protection_exception(pro... |
class User:
def __init__(self, username, password):
self.name = username
self.password = password
def login(self):
return
def logout(self):
return
| class User:
def __init__(self, username, password):
self.name = username
self.password = password
def login(self):
return
def logout(self):
return |
def is_valid(s):
stack = []
for i in range(len(s)):
if s[i] == "(" or s[i] == "[" or s[i] == "{":
stack.append(s[i])
else:
if len(stack) == 0:
return False
if s[i] == ")" and stack[-1] != "(":
return False
if s[i] =... | def is_valid(s):
stack = []
for i in range(len(s)):
if s[i] == '(' or s[i] == '[' or s[i] == '{':
stack.append(s[i])
else:
if len(stack) == 0:
return False
if s[i] == ')' and stack[-1] != '(':
return False
if s[i] ==... |
#W.A.P TO TAKE INPUT FROM USER (empid,name,salary) AND PRINT EMPLOYEE DETAILS
emp=int(input('Enter employee ID:'))
name=input('Enter your name:')
sal=int(input('Enter your annual salary:'))
print('Employee Details --> \n Employee ID:',emp,'\n Name:',name,'\n Annual Salary:',sal)
| emp = int(input('Enter employee ID:'))
name = input('Enter your name:')
sal = int(input('Enter your annual salary:'))
print('Employee Details --> \n Employee ID:', emp, '\n Name:', name, '\n Annual Salary:', sal) |
def main():
def findMin(x):
minNum = x[0]
for i in x:
if minNum > i:
minNum = i
return minNum
print(findMin([0,1,2,3,4,5,-3,24,-56])) # = -56
if __name__ == '__main__':
main()
| def main():
def find_min(x):
min_num = x[0]
for i in x:
if minNum > i:
min_num = i
return minNum
print(find_min([0, 1, 2, 3, 4, 5, -3, 24, -56]))
if __name__ == '__main__':
main() |
a = 'some_string'
b = 'some' + '_' + 'string'
c = 'somestring'
print(id(a))
print(id(b))
print(id(c))
| a = 'some_string'
b = 'some' + '_' + 'string'
c = 'somestring'
print(id(a))
print(id(b))
print(id(c)) |
# Copyright 2019, A10 Networks
#
# 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 law or a... | loadbalancers_list = 'loadbalancers_list'
vrid_list = 'vrid_list'
set_thunder_update_at = 'set-thunder-update-at'
set_thunder_backup_update_at = 'set-thunder-backup-update-at'
member_count_ip = 'member_count_ip'
member_count_ip_port_protocol = 'member_count_ip_port_protocol'
pool_count_ip = 'pool_count_ip'
write_mem_sh... |
lots_of_numbers = range(-1000, 1000)
the_same_numbers = range(-1000, 1000)
same_numbers = (
i
for i, j in zip(lots_of_numbers, the_same_numbers)
if i is j
)
print(*same_numbers, sep=", ")
| lots_of_numbers = range(-1000, 1000)
the_same_numbers = range(-1000, 1000)
same_numbers = (i for (i, j) in zip(lots_of_numbers, the_same_numbers) if i is j)
print(*same_numbers, sep=', ') |
class Config:
BOT_TOKEN = '' # from @botfather
APP_ID = '' # from https://my.telegram.org/apps
API_HASH = '' # from https://my.telegram.org/apps
API_KEY = '' # from https://mixdrop.co
API_EMA... | class Config:
bot_token = ''
app_id = ''
api_hash = ''
api_key = ''
api_email = ''
auth_users = [694380168] |
debug = True
run = {
"echo": True
}
| debug = True
run = {'echo': True} |
age = float(input())
gender = input()
if gender =="m":
if age >= 16:
print("Mr.")
else:
print("Master")
if gender == "f":
if age >= 16:
print("Ms.")
else:
print("Miss")
| age = float(input())
gender = input()
if gender == 'm':
if age >= 16:
print('Mr.')
else:
print('Master')
if gender == 'f':
if age >= 16:
print('Ms.')
else:
print('Miss') |
T = int(input())
if 1 <= T <= 100:
for i in range(T):
N = int(input())
a = []
for j in range(N - 1):
l = int(input())
if l <= N:
a.append(l)
for k in range(1, N + 1):
if k not in a:
print(k)
| t = int(input())
if 1 <= T <= 100:
for i in range(T):
n = int(input())
a = []
for j in range(N - 1):
l = int(input())
if l <= N:
a.append(l)
for k in range(1, N + 1):
if k not in a:
print(k) |
#
# PySNMP MIB module ALCATEL-IND1-IGMP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-IGMP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:17:51 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (softent_ind1_igmp,) = mibBuilder.importSymbols('ALCATEL-IND1-BASE', 'softentIND1Igmp')
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, valu... |
def vector_bits2int(arr):
n = arr.shape[0] # number of columns
a = arr[0] << n - 1
for j in range(1, n):
# "overlay" with the shifted bits of the next column
a |= arr[j] << n - 1 - j
return a
| def vector_bits2int(arr):
n = arr.shape[0]
a = arr[0] << n - 1
for j in range(1, n):
a |= arr[j] << n - 1 - j
return a |
#! /usr/bin/env python3
def func1():
x = set([1,2,3,4])
y = set([3,4,5,6,7])
z = frozenset([4,5])
print(x)
print(y)
x.add(5)
x.remove(3)
print(x)
print("x|y=", x | y) # x U y
print("x.union(y)=", x.union(y))
print("x&y=", x & y) # x ~U y
print("x.intersection(y)=", x.intersection(y))
prin... | def func1():
x = set([1, 2, 3, 4])
y = set([3, 4, 5, 6, 7])
z = frozenset([4, 5])
print(x)
print(y)
x.add(5)
x.remove(3)
print(x)
print('x|y=', x | y)
print('x.union(y)=', x.union(y))
print('x&y=', x & y)
print('x.intersection(y)=', x.intersection(y))
print('x-y=', x ... |
size = 21
array = [[0 for i in range(size)] for j in range(size)]
for i in range(size):
array[0][i] = 1
array[i][0] = 1
for i in range(1,size):
for j in range(1,size):
array[i][j] = array[i-1][j] + array[i][j-1]
print(array[size-1][size-1])
| size = 21
array = [[0 for i in range(size)] for j in range(size)]
for i in range(size):
array[0][i] = 1
array[i][0] = 1
for i in range(1, size):
for j in range(1, size):
array[i][j] = array[i - 1][j] + array[i][j - 1]
print(array[size - 1][size - 1]) |
def peak(arr, low, high):
n = len(arr)
while low <= high:
mid = low + (high - low) / 2
mid = int(mid)
if (mid == 0 or arr[mid-1] <= arr[mid]) and (mid == n-1 or arr[mid+1] <= arr[mid]):
return(arr[mid])
elif mid > 0 and arr[mid-1] > arr[mid]:
... | def peak(arr, low, high):
n = len(arr)
while low <= high:
mid = low + (high - low) / 2
mid = int(mid)
if (mid == 0 or arr[mid - 1] <= arr[mid]) and (mid == n - 1 or arr[mid + 1] <= arr[mid]):
return arr[mid]
elif mid > 0 and arr[mid - 1] > arr[mid]:
high =... |
# Copyright 2019 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | def main(client, routine_id):
routine = client.get_routine(routine_id)
routine.body = 'x * 4'
routine = client.update_routine(routine, ['body', 'arguments', 'language', 'type_', 'return_type'])
return routine |
def vsota(mat1, mat2):
vsota = []
for i in range(len(mat1)):
nova_vrsta = []
for j in range(len(mat1[0])):
nova_vrsta.append((mat1[i][j] + mat2[i][j]))
vsota.append(nova_vrsta)
return vsota
def razlika(mat1, mat2):
razlika = []
for i in range(len(mat1)):
... | def vsota(mat1, mat2):
vsota = []
for i in range(len(mat1)):
nova_vrsta = []
for j in range(len(mat1[0])):
nova_vrsta.append(mat1[i][j] + mat2[i][j])
vsota.append(nova_vrsta)
return vsota
def razlika(mat1, mat2):
razlika = []
for i in range(len(mat1)):
no... |
# Testing configurations
config = {}
training_opt = {}
training_opt['dataset'] = 'iNaturalist18'
training_opt['log_dir'] = './logs/iNaturalist18'
training_opt['num_classes'] = 8142
training_opt['batch_size'] = 64
training_opt['num_workers'] = 8
training_opt['num_epochs'] = 90
training_opt['display_step'] = 10
training... | config = {}
training_opt = {}
training_opt['dataset'] = 'iNaturalist18'
training_opt['log_dir'] = './logs/iNaturalist18'
training_opt['num_classes'] = 8142
training_opt['batch_size'] = 64
training_opt['num_workers'] = 8
training_opt['num_epochs'] = 90
training_opt['display_step'] = 10
training_opt['feature_dim'] = 2048... |
TESTING = True
POSTGRESQL_DATABASE_URI = ""
URLS = 'app.urls'
| testing = True
postgresql_database_uri = ''
urls = 'app.urls' |
text = input()
cipher = []
for char in text:
new_char = chr(ord(char) + 3)
cipher.append(new_char)
print(''.join(cipher))
| text = input()
cipher = []
for char in text:
new_char = chr(ord(char) + 3)
cipher.append(new_char)
print(''.join(cipher)) |
a, b, c = map(int, input().split())
if c - b <= 0:
result = -1
else:
result = a // (c - b)
result += 1
print(result)
| (a, b, c) = map(int, input().split())
if c - b <= 0:
result = -1
else:
result = a // (c - b)
result += 1
print(result) |
def checkPassword(data):
return (data["password"][data["pos1"] - 1] == data["char"]) != (data["password"][data["pos2"] -1 ] == data["char"])
passwords = []
with open("./2/input.txt") as inputFile:
for line in inputFile:
tokens = line.split(" ")
minMax = tokens[0].split("-")
data = {
"pos1": int(minMax[0]),
... | def check_password(data):
return (data['password'][data['pos1'] - 1] == data['char']) != (data['password'][data['pos2'] - 1] == data['char'])
passwords = []
with open('./2/input.txt') as input_file:
for line in inputFile:
tokens = line.split(' ')
min_max = tokens[0].split('-')
data = {'p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.