content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# 2019-02-18
# sentence to dictionary meaning
sentence = "It is truth universally acknowledged"
f = open('dict_test.TXT', 'r', encoding='utf-8')
dictionary = {}
for line in f:
word = line[:-1].split(" : ", 1)
dictionary.update({word[0]:word[-1]})
f.close()
print("Sentence :", sentence)
for word in senten... | sentence = 'It is truth universally acknowledged'
f = open('dict_test.TXT', 'r', encoding='utf-8')
dictionary = {}
for line in f:
word = line[:-1].split(' : ', 1)
dictionary.update({word[0]: word[-1]})
f.close()
print('Sentence :', sentence)
for word in sentence.split(' '):
print(word.lower(), ':', dictiona... |
class MultiCollector(object):
'a collector combining multiple other collectors'
def __init__(self):
self._collectors = {}
def register(self, name, collector):
self._collectors[name] = collector
def start(self):
for name in self._collectors:
self._collectors[name].... | class Multicollector(object):
"""a collector combining multiple other collectors"""
def __init__(self):
self._collectors = {}
def register(self, name, collector):
self._collectors[name] = collector
def start(self):
for name in self._collectors:
self._collectors[nam... |
# Set number of participants
num_dyads = 4
num_participants = num_dyads*2
# Create lists for iterations
participants = list(range(num_participants))
dyads = list(range(num_dyads)) | num_dyads = 4
num_participants = num_dyads * 2
participants = list(range(num_participants))
dyads = list(range(num_dyads)) |
__all__ = ['v1', 'f1', 'C1']
v1 = 18
v2 = 36
def f1():
pass
def f2():
pass
class C1(object):
pass
class C2(object):
pass
| __all__ = ['v1', 'f1', 'C1']
v1 = 18
v2 = 36
def f1():
pass
def f2():
pass
class C1(object):
pass
class C2(object):
pass |
values = {
'r': 0.000000000001
}
typers = {
'r': float
}
def setGlobal(key, value):
values[key] = value
| values = {'r': 1e-12}
typers = {'r': float}
def set_global(key, value):
values[key] = value |
class UnsupportedMethod(Exception):
def __init__(self, message, errors):
super().__init__(message)
class NoPayload(Exception):
def __init__(self):
super().__init__() | class Unsupportedmethod(Exception):
def __init__(self, message, errors):
super().__init__(message)
class Nopayload(Exception):
def __init__(self):
super().__init__() |
def print_multiplication_table(vertical_interval, horizontal_interval):
print('\t', end='')
for i in range(horizontal_interval[0], horizontal_interval[1] + 1):
print(i, end='\t')
print()
for i in range(vertical_interval[0], vertical_interval[1] + 1):
print(i, end='\t')
for j in ... | def print_multiplication_table(vertical_interval, horizontal_interval):
print('\t', end='')
for i in range(horizontal_interval[0], horizontal_interval[1] + 1):
print(i, end='\t')
print()
for i in range(vertical_interval[0], vertical_interval[1] + 1):
print(i, end='\t')
for j in r... |
class Colors:
def __init__(self):
self.color_dict = {
"ERROR": ';'.join([str(7), str(31), str(47)]),
"WARN": ';'.join([str(7), str(33), str(40)]),
"INFO": ';'.join([str(7), str(32), str(40)]),
"GENERAL": ';'.join([str(7), str(34), str(47)])
}
... | class Colors:
def __init__(self):
self.color_dict = {'ERROR': ';'.join([str(7), str(31), str(47)]), 'WARN': ';'.join([str(7), str(33), str(40)]), 'INFO': ';'.join([str(7), str(32), str(40)]), 'GENERAL': ';'.join([str(7), str(34), str(47)])}
def get_cformat(self, message_type):
return self.colo... |
def globals(request):
#import pdb
#pdb.set_trace()
data = {}
if 'menu_item' in request.session:
data['menu_item'] = request.session['menu_item']
return data
| def globals(request):
data = {}
if 'menu_item' in request.session:
data['menu_item'] = request.session['menu_item']
return data |
SQLALCHEMY_DATABASE_URI = \
'mysql+cymysql://root:00000000@localhost/ucar'
SECRET_KEY = '***'
SQLALCHEMY_TRACK_MODIFICATIONS = True
MINA_APP = {
'AppID': '***',
'AppSecret': '***'
}
| sqlalchemy_database_uri = 'mysql+cymysql://root:00000000@localhost/ucar'
secret_key = '***'
sqlalchemy_track_modifications = True
mina_app = {'AppID': '***', 'AppSecret': '***'} |
class Class:
def __init__(self, name: str):
self.name = name
class Instance:
def __init__(self, cls: Class):
self.cls = cls
self._fields = {}
def get_attr(self, name: str):
if name not in self._fields:
raise AttributeError(f"'{self.cls.name}' has no attribute {... | class Class:
def __init__(self, name: str):
self.name = name
class Instance:
def __init__(self, cls: Class):
self.cls = cls
self._fields = {}
def get_attr(self, name: str):
if name not in self._fields:
raise attribute_error(f"'{self.cls.name}' has no attribute... |
# Pell Numbers
class Pell:
def __init__(self):
self.limiter = 1000
self.numbers = [0, 1]
self.path = r'./Pell_Sequence/results.txt'
def void(self):
with open(self.path, "w+") as file:
for i in range(self.limiter):
self.numbers.append(2 * sel... | class Pell:
def __init__(self):
self.limiter = 1000
self.numbers = [0, 1]
self.path = './Pell_Sequence/results.txt'
def void(self):
with open(self.path, 'w+') as file:
for i in range(self.limiter):
self.numbers.append(2 * self.numbers[i + 1] + self.n... |
def squares(n):
i = 1
while i <= n:
yield i * i
i += 1
print(list(squares(5))) | def squares(n):
i = 1
while i <= n:
yield (i * i)
i += 1
print(list(squares(5))) |
def prod(L):
p = 1
for i in L:
p *= i
return p
| def prod(L):
p = 1
for i in L:
p *= i
return p |
# a,b = [set(input().split()) for i in range(4)][1::2]
# print ('\n'.join(sorted(a^b, key=int)))
a,b=(int(input()),input().split())
c,d=(int(input()),input().split())
x=set(b)
y=set(d)
p=y.difference(x)
q=x.difference(y)
r=p.union(q)
print ('\n'.join(sorted(r, key=int)))
| (a, b) = (int(input()), input().split())
(c, d) = (int(input()), input().split())
x = set(b)
y = set(d)
p = y.difference(x)
q = x.difference(y)
r = p.union(q)
print('\n'.join(sorted(r, key=int))) |
def f(bar):
# type: (str) -> str
return bar
f(bytearray()) | def f(bar):
return bar
f(bytearray()) |
# job_list_one_shot.py ---
#
# Filename: job_list_one_shot.py
# Author: Abhishek Udupa
# Created: Tue Jan 26 15:13:19 2016 (-0500)
#
#
# Copyright (c) 2015, Abhishek Udupa, University of Pennsylvania
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permit... | [(['python3', 'solvers.py', '--anytime', '3600', 'icfp', '../benchmarks/icfp/icfp_103_10.sl'], 'icfp_103_10-anytime', 'icfp_103_10-anytime'), (['python3', 'solvers.py', '--anytime', '3600', 'icfp', '../benchmarks/icfp/icfp_113_1000.sl'], 'icfp_113_1000-anytime', 'icfp_113_1000-anytime'), (['python3', 'solvers.py', '--a... |
class Vehicle:
''' Documentation needed here
'''
def __init__(self, numberOfTires, colorOfVehicle):
''' Documentation needed here
'''
self.numberOfTires = numberOfTires
self.colorOfVehicle = colorOfVehicle
def start(self):
''' This function starts the vehicle
'''
print("I started!")
def dr... | class Vehicle:
""" Documentation needed here
"""
def __init__(self, numberOfTires, colorOfVehicle):
""" Documentation needed here
"""
self.numberOfTires = numberOfTires
self.colorOfVehicle = colorOfVehicle
def start(self):
""" This function starts the vehicle
"""
... |
def tail(filename, n=10):
'Return the last n lines of a file'
with open(filename) as f:
return deque(f, n)
| def tail(filename, n=10):
"""Return the last n lines of a file"""
with open(filename) as f:
return deque(f, n) |
render = ez.Node()
aspect2D = ez.Node()
camera = ez.Camera(parent=render)
camera.y = -20
# Create a a model:
dirt = ez.load.texture('dirt.png')
mesh = ez.load.mesh('hex.bam')
model = ez.Model( mesh, parent=render)
model.shader = ez.load.shader('shaded.glsl')
model.set_shader_input('texture0', dirt)
# Our task functi... | render = ez.Node()
aspect2_d = ez.Node()
camera = ez.Camera(parent=render)
camera.y = -20
dirt = ez.load.texture('dirt.png')
mesh = ez.load.mesh('hex.bam')
model = ez.Model(mesh, parent=render)
model.shader = ez.load.shader('shaded.glsl')
model.set_shader_input('texture0', dirt)
def task_spin_node(node, task):
nod... |
#
# PySNMP MIB module TIMETRA-CLEAR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIMETRA-CLEAR-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:09:48 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, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint, constraints_union) ... |
n, m = map(int, input().split())
array = [input() for _ in range(n)]
k = int(input())
for row in sorted(array, key=lambda row: int(row.split()[k])):
print(row)
| (n, m) = map(int, input().split())
array = [input() for _ in range(n)]
k = int(input())
for row in sorted(array, key=lambda row: int(row.split()[k])):
print(row) |
def count(char,word):
total=0
for any in word:
if any in char:
total = total + 1
return total
result = count('a','banana')
print(result)
| def count(char, word):
total = 0
for any in word:
if any in char:
total = total + 1
return total
result = count('a', 'banana')
print(result) |
class Solution:
def canBeTypedWords(self, text: str, brokenLetters: str) -> int:
result = 0
words = text.split(" ")
set_chars = set(brokenLetters)
for i in words:
set_word = set(i)
sub = set_word - set_chars
if len(set_word) == len(sub):
... | class Solution:
def can_be_typed_words(self, text: str, brokenLetters: str) -> int:
result = 0
words = text.split(' ')
set_chars = set(brokenLetters)
for i in words:
set_word = set(i)
sub = set_word - set_chars
if len(set_word) == len(sub):
... |
#Decorator Pattern
def my_decorator(func):
def wrap_func(*args, **kwargs):
print("**********")
func(*args, **kwargs)
print("**********")
return wrap_func
@my_decorator
def hello(greeting,emoji, withLove="your love"):
print(greeting,emoji, withLove)
hello('yo yo', '<3') | def my_decorator(func):
def wrap_func(*args, **kwargs):
print('**********')
func(*args, **kwargs)
print('**********')
return wrap_func
@my_decorator
def hello(greeting, emoji, withLove='your love'):
print(greeting, emoji, withLove)
hello('yo yo', '<3') |
# Copyright (c) 2017-2018 CRS4
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribut... | confirm_actions = ('add', 'delete')
errors_message = {'MISSING_PARAM': 'Missing parameters', 'UNKNOWN_ACTION': 'Unknown action', 'INVALID_CONFIRMATION_CODE': 'Confirmation code not valid', 'INVALID_FR_STATUS': 'Invalid flow request status', 'EXPIRED_CONFIRMATION_ID': 'Confirmation code expired', 'INVALID_CONSENT_STATUS... |
class Solution:
def numJewelsInStones(self, J: str, S: str) -> int:
#map = {}
#for i in range(len(J)):
# map[J[i]] = 0
count = 0
for i in range(len(S)):
if str([S[i]][0]) in J: count +=1
return count
J = "aAB"
S = "aAAbbbb"
print(Solution().numJewelsI... | class Solution:
def num_jewels_in_stones(self, J: str, S: str) -> int:
count = 0
for i in range(len(S)):
if str([S[i]][0]) in J:
count += 1
return count
j = 'aAB'
s = 'aAAbbbb'
print(solution().numJewelsInStones(J, S)) |
n = int(input())
sum1 = 0
for i in range(1, n + 1):
if n % i == 0:
sum1 += i
print(sum1)
| n = int(input())
sum1 = 0
for i in range(1, n + 1):
if n % i == 0:
sum1 += i
print(sum1) |
def MoveManyStepsForward(numberOfSteps):
for everySingleNumberInTheRange in range(numberOfSteps):
env.step(0)
async def main():
MoveManyStepsForward(50)
await sleep()
MoveManyStepsForward(150) | def move_many_steps_forward(numberOfSteps):
for every_single_number_in_the_range in range(numberOfSteps):
env.step(0)
async def main():
move_many_steps_forward(50)
await sleep()
move_many_steps_forward(150) |
def distanceK(self, root, target, K):
conn = collections.defaultdict(list)
def connect(parent, child):
if parent and child:
conn[parent.val].append(child.val)
conn[child.val].append(parent.val)
if child.left: connect(child, child.left)
if child.right: connect(chil... | def distance_k(self, root, target, K):
conn = collections.defaultdict(list)
def connect(parent, child):
if parent and child:
conn[parent.val].append(child.val)
conn[child.val].append(parent.val)
if child.left:
connect(child, child.left)
if child.right... |
entries = [
{
'env-title': 'atari-enduro',
'score': 0.0,
},
{
'env-title': 'atari-space-invaders',
'score': 656.91,
},
{
'env-title': 'atari-qbert',
'score': 6433.38,
},
{
'env-title': 'atari-seaquest',
'score': 1065.98,
},
... | entries = [{'env-title': 'atari-enduro', 'score': 0.0}, {'env-title': 'atari-space-invaders', 'score': 656.91}, {'env-title': 'atari-qbert', 'score': 6433.38}, {'env-title': 'atari-seaquest', 'score': 1065.98}, {'env-title': 'atari-pong', 'score': 3.11}, {'env-title': 'atari-beam-rider', 'score': 1959.22}, {'env-title'... |
name = "fRoDo"
lowercase_name = name.lower()
uppercase_name = name.upper()
titlecase_name = name.title()
print(lowercase_name, uppercase_name, titlecase_name) | name = 'fRoDo'
lowercase_name = name.lower()
uppercase_name = name.upper()
titlecase_name = name.title()
print(lowercase_name, uppercase_name, titlecase_name) |
'''
priceIsRight = 15
if priceIsRight:
print("Price is too low!")
if priceIsRight:
print("Price is almost there!")
if priceIsRight:
print("Price is exactly that!")
if priceIsRight:
print("Price is too high!")
'''
priceIsRight = int(input("Enter your number: "))... | """
priceIsRight = 15
if priceIsRight:
print("Price is too low!")
if priceIsRight:
print("Price is almost there!")
if priceIsRight:
print("Price is exactly that!")
if priceIsRight:
print("Price is too high!")
"""
price_is_right = int(input('Enter your number: ')... |
# 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 ( arr1 , arr2 , m , n , x ) :
count , l , r = 0 , 0 , n - 1
while ( l < m and r >= 0 ) :
if ( ( arr1 ... | def f_gold(arr1, arr2, m, n, x):
(count, l, r) = (0, 0, n - 1)
while l < m and r >= 0:
if arr1[l] + arr2[r] == x:
l += 1
r -= 1
count += 1
elif arr1[l] + arr2[r] < x:
l += 1
else:
r -= 1
return count
if __name__ == '__main__... |
# coding: utf-8
# BlackSmith general configuration file
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Jabber server to connect
SERVER = 'example.com'
# Connecting Port
PORT = 5222
# Jabber server`s connecting Host
HOST = 'example.com'
# Using TLS (True - to enable, False - to disable)
SECURE ... | server = 'example.com'
port = 5222
host = 'example.com'
secure = True
username = 'username'
password = 'password'
resource = u'simpleApps'
default_nick = u'BlackSmith-m.1'
chat_msg_limit = 1024
priv_msg_limit = 2024
inc_msg_limit = 8960
mserve = False
boss = 'boss@example.com'
memory_limit = 49152
boss_pass = '' |
# -----------------------------------------------------------------------------
# This piece of work is inspired by Pollere' VerSec:
# https://github.com/pollere/DCT
# But this code is implemented independently without using any line of the
# original one, and released under Apache License.
#
# Copyright (C) 2019-2022 ... | lvs_grammar = '\n ?start: file_input\n\n TAG_IDENT: CNAME\n RULE_IDENT: "#" CNAME\n FN_IDENT: "$" CNAME\n\n name: "/"? component ("/" component)*\n component: STR -> component_from_str\n | TAG_IDENT -> tag_id\n | RULE_IDENT -> rule_id\n\n definition: RULE_IDENT ":" d... |
#!/usr/bin/env python
# -*- coding: utf-8; -*-
# Copyright (c) 2022 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
DEFAULT_OCI_CONFIG_FILE = "~/.oci/config"
DEFAULT_PROFILE = "DEFAULT"
DEFAULT_CONDA_PACK_FOLDER = "~/conda"
CONDA_P... | default_oci_config_file = '~/.oci/config'
default_profile = 'DEFAULT'
default_conda_pack_folder = '~/conda'
conda_pack_os_prefix_format = 'oci://<bucket>@<namespace>/<prefix>'
default_ads_config_folder = '~/.ads_ops'
ops_image_base = 'ads-operators-base'
ml_job_image = 'ml-job'
ml_job_gpu_image = 'ml-job-gpu'
ops_image... |
INPUT = ">^^v^<>v<<<v<v^>>v^^^<v<>^^><^<<^vv>>>^<<^>><vv<<v^<^^><>>><>v<><>^^<^^^<><>>vv>vv>v<<^>v<>^>v<v^<>v>><>^v<<<<v^vv^><v>v^>>>vv>v^^^<^^<>>v<^^v<>^<vv^^<^><<>^>><^<>>><><vv><>v<<<><><>v><<>^^^^v>>^>^<v<<vv^^<v<^<^>^^v^^^^^v<><^v><<><^v^>v<<>^<>^^v^<>v<v^>v>^^<vv^v><^<>^v<><^><v^><><><<<<>^vv^>^vvvvv><><^<vv^v^v>... | input = '>^^v^<>v<<<v<v^>>v^^^<v<>^^><^<<^vv>>>^<<^>><vv<<v^<^^><>>><>v<><>^^<^^^<><>>vv>vv>v<<^>v<>^>v<v^<>v>><>^v<<<<v^vv^><v>v^>>>vv>v^^^<^^<>>v<^^v<>^<vv^^<^><<>^>><^<>>><><vv><>v<<<><><>v><<>^^^^v>>^>^<v<<vv^^<v<^<^>^^v^^^^^v<><^v><<><^v^>v<<>^<>^^v^<>v<v^>v>^^<vv^v><^<>^v<><^><v^><><><<<<>^vv^>^vvvvv><><^<vv^v^v>... |
#
# PySNMP MIB module CISCO-IMAGE-UPGRADE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-IMAGE-UPGRADE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:01:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint, constraints_union) ... |
#!/opt/local/bin/python
sum_3_5 = 0
for i in range(1,1000):
if i % 3 == 0 or i % 5 == 0:
print(i)
sum_3_5 += i
print(sum_3_5)
| sum_3_5 = 0
for i in range(1, 1000):
if i % 3 == 0 or i % 5 == 0:
print(i)
sum_3_5 += i
print(sum_3_5) |
class Animal(object):
def __init__(self, name):
self.name = name
def eat(self, food):
print("%s is eating %s" % (self.name, food))
class Dog(Animal):
def fetch(self, thing):
print("%s goes after the %s" % (self.name, thing))
class Cat(Animal):
def swatstring(self):
pri... | class Animal(object):
def __init__(self, name):
self.name = name
def eat(self, food):
print('%s is eating %s' % (self.name, food))
class Dog(Animal):
def fetch(self, thing):
print('%s goes after the %s' % (self.name, thing))
class Cat(Animal):
def swatstring(self):
... |
__version__ = '0.0.1'
__url__ = 'http://github.com/blazaid/pycodes/'
__author__ = 'blazaid'
def check_ean13():
pass | __version__ = '0.0.1'
__url__ = 'http://github.com/blazaid/pycodes/'
__author__ = 'blazaid'
def check_ean13():
pass |
# List of the training runs for the different target dataset sizes
TRAINING_RUNS = [
'large_dataset/20200616_090434',
'medium_dataset/20200616_214425',
'small_dataset/20200617_143139'
]
| training_runs = ['large_dataset/20200616_090434', 'medium_dataset/20200616_214425', 'small_dataset/20200617_143139'] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 Michael Hull.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are m... | class Standardtags(object):
voltage = 'Voltage'
current_density = 'CurrentDensity'
current = 'Current'
conductance = 'Conductance'
conductance_density = 'ConductanceDensity'
state_variable = 'StateVariable'
state_time_constant = 'StateTimeConstant'
state_steady_state = 'StateSteadyState'... |
# print("{:~^45}".format(" Simple while loop "))
# i = 1
# while i<=5 :
# print(i)
# i += 1
# print("\n{:~^45}".format(" Example: sum all numbers in [1..100] "))
# i = 1
# sum = 0
# while i <= 100:
# sum += i
# i += 1
# print("sum = ", sum)
# print("\n{:~^45}".format(" Task: sum even numbers in [1..100] "))
# i ... | print('\n{:~^45}'.format('Emulate do-while loop'))
while True:
user_name = input('Enter a name (at least 3 symbols): ')
user_name_length = len(user_name)
if user_name_length > 3:
break
print('Thank you, {}!'.format(user_name)) |
aqiRanges = (0, 50, 100, 150, 200, 300, 500)
aqiDescriptions = ("Good", "Moderate", "Unhealthy for Sensitive Groups",
"Unhealthy", "Very Unhealthy", "Hazardous")
aqiDescription = ""
pm25ranges = (0, 12, 35.4, 55.4, 150.4, 250.4, 500.4)
pm10ranges = (0, 54, 154, 254, 354, 424, 604)
no2ranges = (0, ... | aqi_ranges = (0, 50, 100, 150, 200, 300, 500)
aqi_descriptions = ('Good', 'Moderate', 'Unhealthy for Sensitive Groups', 'Unhealthy', 'Very Unhealthy', 'Hazardous')
aqi_description = ''
pm25ranges = (0, 12, 35.4, 55.4, 150.4, 250.4, 500.4)
pm10ranges = (0, 54, 154, 254, 354, 424, 604)
no2ranges = (0, 53, 100, 360, 649, ... |
def test_evens():
yield check_even_cls
class Test(object):
def test_evens(self):
yield check_even_cls
class Check(object):
def __call__(self):
pass
check_even_cls = Check()
| def test_evens():
yield check_even_cls
class Test(object):
def test_evens(self):
yield check_even_cls
class Check(object):
def __call__(self):
pass
check_even_cls = check() |
def sommig(n):
result = 0
while(n>=1):
result += n
n-=1
return result
print(sommig(3))
print(sommig(8))
print(sommig(17))
print(sommig(33)) | def sommig(n):
result = 0
while n >= 1:
result += n
n -= 1
return result
print(sommig(3))
print(sommig(8))
print(sommig(17))
print(sommig(33)) |
class Job(object):
def __init__(self, server_host, job_id, train_strategy, train_model, train_model_class_name, aggregate_strategy,
distillation_alpha=None):
self.server_host = server_host
self.job_id = job_id
self.train_strategy = train_strategy
self.train_model = ... | class Job(object):
def __init__(self, server_host, job_id, train_strategy, train_model, train_model_class_name, aggregate_strategy, distillation_alpha=None):
self.server_host = server_host
self.job_id = job_id
self.train_strategy = train_strategy
self.train_model = train_model
... |
def foo(bar1, bar2, bar3,
bar4
): # FD102
return
| def foo(bar1, bar2, bar3, bar4):
return |
class Solution:
def canPermutePalindrome(self, s: str) -> bool:
wordset = set()
for c in s:
if c in wordset:
wordset.remove(c)
else:
wordset.add(c)
return len(wordset)<=1
A = Solution()
s = "aab"
print(A.canPermutePalindrome(s)) | class Solution:
def can_permute_palindrome(self, s: str) -> bool:
wordset = set()
for c in s:
if c in wordset:
wordset.remove(c)
else:
wordset.add(c)
return len(wordset) <= 1
a = solution()
s = 'aab'
print(A.canPermutePalindrome(s)) |
def get_sea_monster():
sea_monster = [
" # ",
"# ## ## ###",
" # # # # # # ",
]
return sea_monster, len(sea_monster), len(sea_monster[0])
def mark_sea_monsters_at_coord(grid, x, y):
sm, sm_y, sm_x = get_sea_monster()
for yval in range(y, y + sm_y):
for xval ... | def get_sea_monster():
sea_monster = [' # ', '# ## ## ###', ' # # # # # # ']
return (sea_monster, len(sea_monster), len(sea_monster[0]))
def mark_sea_monsters_at_coord(grid, x, y):
(sm, sm_y, sm_x) = get_sea_monster()
for yval in range(y, y + sm_y):
for xval in ... |
def check_if_multiple(test_num,list_of_multiples):
for i in list_of_multiples:
if not i:
continue
if not test_num%i:
return test_num
return 0
def sum_of_multiples(number, multiples_list = None):
multiples_list = multiples_list or [3,5]
#implicitly check if None is passed to the function
return sum(l... | def check_if_multiple(test_num, list_of_multiples):
for i in list_of_multiples:
if not i:
continue
if not test_num % i:
return test_num
return 0
def sum_of_multiples(number, multiples_list=None):
multiples_list = multiples_list or [3, 5]
return sum(list(filter(la... |
def algorithm_name(id, config):
algorithm = config['experiment.simple']['algorithm'].rsplit('.', 1)[1]
# env = config['experiment.simple']['environment'].rsplit('.', 1)[1]
tr_radius = get_setting(config, 'algorithm.subdomainbo', 'tr_radius')
beta = get_setting(config, 'model', 'beta')
tr_method = ge... | def algorithm_name(id, config):
algorithm = config['experiment.simple']['algorithm'].rsplit('.', 1)[1]
tr_radius = get_setting(config, 'algorithm.subdomainbo', 'tr_radius')
beta = get_setting(config, 'model', 'beta')
tr_method = get_setting(config, 'algorithm.subdomainbo', 'tr_method')
max_queries_t... |
'''This module contains the output formatters for pyPaSWAS'''
class DefaultFormatter(object):
'''This is the default formatter for pyPasWas.
All available formatters inherit from this formatter.
The results are parsed into a temporary file, which can be used by the main
program for permanen... | """This module contains the output formatters for pyPaSWAS"""
class Defaultformatter(object):
"""This is the default formatter for pyPasWas.
All available formatters inherit from this formatter.
The results are parsed into a temporary file, which can be used by the main
program for permanen... |
x:int = 1
o:object = None
x = o = 42
| x: int = 1
o: object = None
x = o = 42 |
m = int(input())
m = m % 1440
a = m // 60
b = m % 60
print(a, b)
| m = int(input())
m = m % 1440
a = m // 60
b = m % 60
print(a, b) |
# by Kami Bigdely
# Remove control flag
# Reference: https://stackoverflow.com/a/10140333/81306
# This code snippet reads up to the end of the file
n = 16
file = 'foobar.file'
def readfile(file, n):
with open(file, 'rb') as fp:
chunk = fp.read(n)
if chunk == '': # end of file, stop running.
... | n = 16
file = 'foobar.file'
def readfile(file, n):
with open(file, 'rb') as fp:
chunk = fp.read(n)
if chunk == '':
return
print(chunk)
readfile(file, n) |
class Solution:
def minDeletionSize(self, A: List[str]) -> int:
res = 0
for col_str in zip(*A):
if list(col_str) != sorted(col_str):
res += 1
return res
| class Solution:
def min_deletion_size(self, A: List[str]) -> int:
res = 0
for col_str in zip(*A):
if list(col_str) != sorted(col_str):
res += 1
return res |
_base_ = [
'../_base_/models/simmim_swin-base.py',
'../_base_/datasets/imagenet_simmim.py',
'../_base_/schedules/adamw_coslr-200e_in1k.py',
'../_base_/default_runtime.py',
]
# data
data = dict(samples_per_gpu=128)
# optimizer
optimizer = dict(
lr=2e-4 * 2048 / 512,
betas=(0.9, 0.999),
eps=... | _base_ = ['../_base_/models/simmim_swin-base.py', '../_base_/datasets/imagenet_simmim.py', '../_base_/schedules/adamw_coslr-200e_in1k.py', '../_base_/default_runtime.py']
data = dict(samples_per_gpu=128)
optimizer = dict(lr=0.0002 * 2048 / 512, betas=(0.9, 0.999), eps=1e-08, paramwise_options={'norm': dict(weight_decay... |
height = int(input())
for i in range(1,height+1):
for j in range(1, height+1):
if(i == height//2 or i == height or j == 1 or j == height and i >= height//2 or (j%2==1 and i<= height//2)):
print("*",end=" ")
else:
print(end=" ")
print()
# Sample Input :- 7
#... | height = int(input())
for i in range(1, height + 1):
for j in range(1, height + 1):
if i == height // 2 or i == height or j == 1 or (j == height and i >= height // 2) or (j % 2 == 1 and i <= height // 2):
print('*', end=' ')
else:
print(end=' ')
print() |
# Copyright (c) 2015-2020 Avere Systems, Inc. All Rights Reserved.
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root for license information.
__version__ = "0.5.4.3"
__version_info__ = (0, 5, 4, 3)
| __version__ = '0.5.4.3'
__version_info__ = (0, 5, 4, 3) |
house = [ ['hallway', 14.35],
['kitchen', 15.0],
['living room', 19.0],
['bedroom', 12.5],
['bathroom', 8.75] ]
# Code the for loop
for x in house:
print(str(x[0]) + ' area is ' + str(x[1]) + 'm')
| house = [['hallway', 14.35], ['kitchen', 15.0], ['living room', 19.0], ['bedroom', 12.5], ['bathroom', 8.75]]
for x in house:
print(str(x[0]) + ' area is ' + str(x[1]) + 'm') |
lst = []
num = int(input("Input the number of items: "))
for n in range(num):
# Arguments for Ordinal Numbers in a Set
ord = str(n+1)
if n == 0:
ord += "st"
elif n == 1:
ord += "nd"
elif n == 2:
ord += "rd"
else:
ord += "th"
numbers = int(input("Enter the "+ o... | lst = []
num = int(input('Input the number of items: '))
for n in range(num):
ord = str(n + 1)
if n == 0:
ord += 'st'
elif n == 1:
ord += 'nd'
elif n == 2:
ord += 'rd'
else:
ord += 'th'
numbers = int(input('Enter the ' + ord + ' value: '))
lst.append(numbers)
... |
# Author: Konrad Lindenbach <klindenb@ualberta.ca>,
# Emmanuel Odeke <odeke@ualberta.ca>
# Copyright (c) 2014
# Table name strings
MESSAGE_TABLE_KEY = "Message"
RECEIPIENT_TABLE_KEY = "Receipient"
MESSAGE_MARKER_TABLE_KEY = "MessageMarker"
MAX_NAME_LENGTH = 60 # Arbitrary value
MAX_BODY_LENGTH = 200 # Arbitr... | message_table_key = 'Message'
receipient_table_key = 'Receipient'
message_marker_table_key = 'MessageMarker'
max_name_length = 60
max_body_length = 200
max_alias_length = 60
max_token_length = 512
max_subject_length = 80
max_profile_uri_length = 400 |
CFG = {
"spatial_input": 2,
"spatial_output": 2,
"temporal_input": 8,
"temporal_output": 12,
"bins": [0, 0.01, 0.1, 1.2],
"noise_weight": [0.05, 1, 4, 8],
"noise_weight_eth": [0.175, 1.5, 4, 8],
}
| cfg = {'spatial_input': 2, 'spatial_output': 2, 'temporal_input': 8, 'temporal_output': 12, 'bins': [0, 0.01, 0.1, 1.2], 'noise_weight': [0.05, 1, 4, 8], 'noise_weight_eth': [0.175, 1.5, 4, 8]} |
def fullName(first_name, last_name):
return f'Your first name is {first_name} and last name is {last_name}'
print(fullName(first_name = 'Qaidjohar', last_name = 'Jawadwala'))
# name = fullName('Qaidjohar','Jawadwala')
# print(name) | def full_name(first_name, last_name):
return f'Your first name is {first_name} and last name is {last_name}'
print(full_name(first_name='Qaidjohar', last_name='Jawadwala')) |
iN = int(input())
a_list = list(map(int, input().split()))
multi4 = len([a for a in a_list if a % 4 == 0])
odd_num = len([a for a in a_list if a % 2 != 0])
even_num = len(a_list) - odd_num
not4 = even_num - multi4
if not4 >0 :
if odd_num <= multi4:
print("Yes")
else:
print("No")
else:
if... | i_n = int(input())
a_list = list(map(int, input().split()))
multi4 = len([a for a in a_list if a % 4 == 0])
odd_num = len([a for a in a_list if a % 2 != 0])
even_num = len(a_list) - odd_num
not4 = even_num - multi4
if not4 > 0:
if odd_num <= multi4:
print('Yes')
else:
print('No')
elif odd_num <=... |
# Time complexity: O(n^3 log n + klogk)
# Space complexity: O(k)
class Solution:
def fourSum(self, nums: List[int], target: int) -> List[List[int]]:
nums.sort()
res = []
length = len(nums)
for i in range(0, length - 3):
if i != 0 and nums[i] == nums[i - 1]:
... | class Solution:
def four_sum(self, nums: List[int], target: int) -> List[List[int]]:
nums.sort()
res = []
length = len(nums)
for i in range(0, length - 3):
if i != 0 and nums[i] == nums[i - 1]:
continue
for j in range(i + 1, length - 2):
... |
class Problem2:
def __init__(self, campoints=None, campoints_true = None, robposes=None):
self._campoints = campoints
self._robposes = robposes
self._campoints_true = campoints_true
@property
def campoints(self):
return self._campoints
@campoints.setter
def campoint... | class Problem2:
def __init__(self, campoints=None, campoints_true=None, robposes=None):
self._campoints = campoints
self._robposes = robposes
self._campoints_true = campoints_true
@property
def campoints(self):
return self._campoints
@campoints.setter
def campoints... |
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'conditions': [
['OS!="win"', {
'variables': {
'config_h_dir':
'.', # crafted for gcc/linux.
},
}, { # else, ... | {'conditions': [['OS!="win"', {'variables': {'config_h_dir': '.'}}, {'variables': {'config_h_dir': 'src/vsprojects'}, 'target_defaults': {'msvs_disabled_warnings': [4018, 4244, 4355], 'defines!': ['WIN32_LEAN_AND_MEAN']}}]], 'targets': [{'target_name': 'protobuf_lite', 'type': '<(library)', 'toolsets': ['host', 'target... |
# https://leetcode.com/problems/binary-tree-preorder-traversal
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def preorderTraversal(self, root: Optional[T... | class Solution:
def preorder_traversal(self, root: Optional[TreeNode]) -> List[int]:
if root is None:
return []
acc = [root.val]
acc.extend(self.preorderTraversal(root.left))
acc.extend(self.preorderTraversal(root.right))
return acc |
class Solution:
def get_num(self, s, start):
index = start
while index < len(s) and s[index].isdigit():
index += 1
return int(s[start:index]), index
def calculate_helper(self, s, start):
result, sign, index = 0, 1, start
operator = ['+', '-']
while ... | class Solution:
def get_num(self, s, start):
index = start
while index < len(s) and s[index].isdigit():
index += 1
return (int(s[start:index]), index)
def calculate_helper(self, s, start):
(result, sign, index) = (0, 1, start)
operator = ['+', '-']
w... |
text = "zeub"
hexa = ""
for i in text:
hexa += str(hex(ord(i)))[2:].zfill(4)
print(hexa)
hexa = "002B00330033003600380039003000300034003000300030" #YOLOO
hexa = [hexa[i:i+4] for i in range(0, len(hexa), 4)]
text=""
for i in hexa:
text+=chr(int(i, 16))
print(text) | text = 'zeub\x1a'
hexa = ''
for i in text:
hexa += str(hex(ord(i)))[2:].zfill(4)
print(hexa)
hexa = '002B00330033003600380039003000300034003000300030'
hexa = [hexa[i:i + 4] for i in range(0, len(hexa), 4)]
text = ''
for i in hexa:
text += chr(int(i, 16))
print(text) |
class Node:
def __init__(self, value: int) -> None:
self.value = value
self.left = None
self.right = None
class BinarySearchTree:
def __init__(self) -> None:
self.root = None
def insert(self, value: int) -> bool:
new_node = Node(value)
if self.root ... | class Node:
def __init__(self, value: int) -> None:
self.value = value
self.left = None
self.right = None
class Binarysearchtree:
def __init__(self) -> None:
self.root = None
def insert(self, value: int) -> bool:
new_node = node(value)
if self.root is None... |
class ArrayStack:
def __init__(self):
self.data = []
def isEmpty(self):
return len(self.data) == 0
def push(self, val):
return self.data.append(val)
def pop(self):
if self.isEmpty():
raise Empty("Stack underflow!")
return self.data.pop()
def ... | class Arraystack:
def __init__(self):
self.data = []
def is_empty(self):
return len(self.data) == 0
def push(self, val):
return self.data.append(val)
def pop(self):
if self.isEmpty():
raise empty('Stack underflow!')
return self.data.pop()
def ... |
arr = []
b = False
with open("input","r") as f:
for i in f.readlines():
arr = arr + [int(i.rstrip("\n"))]
length = len(arr)
for i in range(0,length):
for j in range(0,length):
for k in range(0,length):
if (arr[i]+arr[j]+arr[k] == 2020):
print("Result = ", arr... | arr = []
b = False
with open('input', 'r') as f:
for i in f.readlines():
arr = arr + [int(i.rstrip('\n'))]
length = len(arr)
for i in range(0, length):
for j in range(0, length):
for k in range(0, length):
if arr[i] + arr[j] + arr[k] == 2020:
print('Result = ', arr[i]... |
def classify(number):
return _classify(number) if number != 1 else 'deficient'
def _classify(number) -> str:
classif: str
aliquot: int = _aliquot(number)
if aliquot > number:
classif = 'abundant'
elif aliquot < number:
classif = 'deficient'
else:
classif = 'perfect'
... | def classify(number):
return _classify(number) if number != 1 else 'deficient'
def _classify(number) -> str:
classif: str
aliquot: int = _aliquot(number)
if aliquot > number:
classif = 'abundant'
elif aliquot < number:
classif = 'deficient'
else:
classif = 'perfect'
... |
def f(a):
a += 2
return a
b = 1
b = f(b)
print(b)
| def f(a):
a += 2
return a
b = 1
b = f(b)
print(b) |
db = "https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv"
# database file downloaded from
# https://www.weather.gov/source/gis/Shapefiles/County/c_03mr20.zip
# to get the lat and long values for US counties
dbf = "./c_03mr20.dbf"
| db = 'https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv'
dbf = './c_03mr20.dbf' |
load(
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
"action_config",
"feature",
"flag_group",
"flag_set",
"tool",
"tool_path",
"with_feature_set",
)
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
def _impl(ctx):
if (ctx.attr.cpu == "k8" and ctx.a... | load('@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl', 'action_config', 'feature', 'flag_group', 'flag_set', 'tool', 'tool_path', 'with_feature_set')
load('@bazel_tools//tools/build_defs/cc:action_names.bzl', 'ACTION_NAMES')
def _impl(ctx):
if ctx.attr.cpu == 'k8' and ctx.attr.compiler == 'clang7':
to... |
for i in range(plan_arguments['RUN_NUM']):
############################################# CC #############################################
add_test(name='cc_feature_rtest',
tags=['L10', 'cc'],
args=[' -rtlarg +uvm_set_config_int=uvm_test_top,layers,%d ' % plan_arguments['LAYER_NUM'], ge... | for i in range(plan_arguments['RUN_NUM']):
add_test(name='cc_feature_rtest', tags=['L10', 'cc'], args=[' -rtlarg +uvm_set_config_int=uvm_test_top,layers,%d ' % plan_arguments['LAYER_NUM'], get_seed_args(), DISABLE_COMPARE_ALL_UNITS_SB_ARG], module='nvdla_uvm_test', config=['nvdla_utb'], desc=' None reuse CC random ... |
'''Example test script.
Basic checks of device before processed
Input Variables:
args - arguments dictionary given to demo tester that may be used to
changed nature of test.
dev - Example device under test
name - Name of test being run.
results - Results map of all tests.
Test Specifi... | """Example test script.
Basic checks of device before processed
Input Variables:
args - arguments dictionary given to demo tester that may be used to
changed nature of test.
dev - Example device under test
name - Name of test being run.
results - Results map of all tests.
Test Specifi... |
# 3-9. Dinner Guests: Working with one of the programs from Exercises 3-4 through 3-7 (page 46),
# use len() to print a message indicating the number of people you are inviting to dinner.
guests = ['Antonio', 'Emanuel', 'Francisco']
message = "1.- Hello dear uncle " + guests[0] + ", I hope you can come this 16th for ... | guests = ['Antonio', 'Emanuel', 'Francisco']
message = '1.- Hello dear uncle ' + guests[0] + ', I hope you can come this 16th for a mexican dinner in my house.'
print(message)
message = '2.- Hi ' + guests[1] + "! The next monday we'll have a dinner, you should come here to spend time with friends for a while, also we w... |
class TierFulfillmentMessages(object):
RROR_PROCESSING_TIER_REQUEST = 'There has been an error processing the tier config request. Error description: {}'
class BasePurchaseMessages:
pass
class BaseChangeMessages:
pass
class BaseSuspendMessages:
NOTHING_TO_DO = 'Suspend method for request {} - Nothi... | class Tierfulfillmentmessages(object):
rror_processing_tier_request = 'There has been an error processing the tier config request. Error description: {}'
class Basepurchasemessages:
pass
class Basechangemessages:
pass
class Basesuspendmessages:
nothing_to_do = 'Suspend method for request {} - Nothing... |
#! /usr/bin/python
# -*- coding: iso-8859-15 -*-
n = int(input("Ingrese la cantidad de datos: "))
suma = 0
for i in range(n):
x = float(input("Ingrese el dato: "))
suma = suma + x
prom = suma / n
print("El promedio es: " ,prom) | n = int(input('Ingrese la cantidad de datos: '))
suma = 0
for i in range(n):
x = float(input('Ingrese el dato: '))
suma = suma + x
prom = suma / n
print('El promedio es: ', prom) |
N = int(input())
AS = [int(x) for x in input().split()]
ok = []
for i in range(N):
for j in range(N):
if i == j:
continue
if AS[i] % AS[j] == 0:
break
else:
ok.append(i)
print(len(ok))
| n = int(input())
as = [int(x) for x in input().split()]
ok = []
for i in range(N):
for j in range(N):
if i == j:
continue
if AS[i] % AS[j] == 0:
break
else:
ok.append(i)
print(len(ok)) |
class Point:
def __init__(self, x: int, y: int):
self.x = x
self.y = y
def getX(self) -> int:
return self.x
def getY(self) -> int:
return self.y
def setX(self, x: int) -> None:
self.x = x
def setY(self, y: int) -> None:
self.y = y
| class Point:
def __init__(self, x: int, y: int):
self.x = x
self.y = y
def get_x(self) -> int:
return self.x
def get_y(self) -> int:
return self.y
def set_x(self, x: int) -> None:
self.x = x
def set_y(self, y: int) -> None:
self.y = y |
#!/usr/bin/env python3
usb_codes = {
0x04:"aA", 0x05:"bB", 0x06:"cC", 0x07:"dD", 0x08:"eE", 0x09:"fF",
0x0A:"gG", 0x0B:"hH", 0x0C:"iI", 0x0D:"jJ", 0x0E:"kK", 0x0F:"lL",
0x10:"mM", 0x11:"nN", 0x12:"oO", 0x13:"pP", 0x14:"qQ", 0x15:"rR",
0x16:"sS", 0x17:"tT", 0x18:"uU", 0x19:"vV", 0x1A:"wW", 0x1B:"xX",
0x1... | usb_codes = {4: 'aA', 5: 'bB', 6: 'cC', 7: 'dD', 8: 'eE', 9: 'fF', 10: 'gG', 11: 'hH', 12: 'iI', 13: 'jJ', 14: 'kK', 15: 'lL', 16: 'mM', 17: 'nN', 18: 'oO', 19: 'pP', 20: 'qQ', 21: 'rR', 22: 'sS', 23: 'tT', 24: 'uU', 25: 'vV', 26: 'wW', 27: 'xX', 28: 'yY', 29: 'zZ', 30: '1!', 31: '2@', 32: '3#', 33: '4$', 34: '5%', 35:... |
class Solution:
def solve(self, matrix, target):
for r in range(len(matrix)):
for c in range(len(matrix[0])):
if r-1 >= 0: matrix[r][c] += matrix[r-1][c]
if c-1 >= 0: matrix[r][c] += matrix[r][c-1]
if r-1 >= 0 and c-1 >= 0: matrix[r][c] -= matrix[r... | class Solution:
def solve(self, matrix, target):
for r in range(len(matrix)):
for c in range(len(matrix[0])):
if r - 1 >= 0:
matrix[r][c] += matrix[r - 1][c]
if c - 1 >= 0:
matrix[r][c] += matrix[r][c - 1]
i... |
__all__ = [
'cyclic',
'dep_expander',
'dep_manager',
'logger',
'package_filter',
'package',
'parse_input',
'sat_solver_satispy',
'topo_packages',
'util'
] | __all__ = ['cyclic', 'dep_expander', 'dep_manager', 'logger', 'package_filter', 'package', 'parse_input', 'sat_solver_satispy', 'topo_packages', 'util'] |
i = 1
while i != 0:
i = int(input())
if i > 100:
break
elif i < 10:
continue
else:
print(i)
| i = 1
while i != 0:
i = int(input())
if i > 100:
break
elif i < 10:
continue
else:
print(i) |
n = int(input())
for i in range(n):
dias = 0
valor = float(input())
while valor>1:
valor = valor/2
dias += 1
print(dias, "dias") | n = int(input())
for i in range(n):
dias = 0
valor = float(input())
while valor > 1:
valor = valor / 2
dias += 1
print(dias, 'dias') |
n = int(input())
s = str(input())
removal = 0
counter = 0
for x in s:
if x != 'x':
if counter >= 3:
removal += counter - 2
counter = 0
elif x == 'x':
counter += 1
if counter >= 3:
removal += counter - 2
print(removal)
| n = int(input())
s = str(input())
removal = 0
counter = 0
for x in s:
if x != 'x':
if counter >= 3:
removal += counter - 2
counter = 0
elif x == 'x':
counter += 1
if counter >= 3:
removal += counter - 2
print(removal) |
i = 10
j = 0
while i > 2:
i = i - 1
j = j + 8 | i = 10
j = 0
while i > 2:
i = i - 1
j = j + 8 |
# LeetCode
# Level: Easy
# Date: 2021.11.17
class Solution:
def destCity(self, paths: List[List[str]]) -> str:
P = dict(paths)
PA = P.keys()
PB = P.values()
DC = PB - PA
for i in DC:
return(i) | class Solution:
def dest_city(self, paths: List[List[str]]) -> str:
p = dict(paths)
pa = P.keys()
pb = P.values()
dc = PB - PA
for i in DC:
return i |
blacklist = [
"userQED",
"GGupzHH",
"nodejs-ma",
"linxz-coder",
"teach-tian",
"kevinlens",
"Pabitra-26",
"mangalan516",
"IjtihadIslamEmon",
"marcin-majewski-sonarsource",
"LongTengDao",
"JoinsG",
"safanbd",
"aly2",
"aka434112"
"SMAKSS",
"imbereket",
... | blacklist = ['userQED', 'GGupzHH', 'nodejs-ma', 'linxz-coder', 'teach-tian', 'kevinlens', 'Pabitra-26', 'mangalan516', 'IjtihadIslamEmon', 'marcin-majewski-sonarsource', 'LongTengDao', 'JoinsG', 'safanbd', 'aly2', 'aka434112SMAKSS', 'imbereket', 'takumu1011', 'adityanjr', 'Aa115511', 'farjanaHuq', 'samxcode', 'HaiTing-... |
while True:
A,B,C=map(int,input().split())
if not A: exit()
if A+B+C<=max(A,B,C)*2: print('Invalid')
elif A==B==C: print('Equilateral')
elif True in (A==B,A==C,B==C): print('Isosceles')
else: print('Scalene') | while True:
(a, b, c) = map(int, input().split())
if not A:
exit()
if A + B + C <= max(A, B, C) * 2:
print('Invalid')
elif A == B == C:
print('Equilateral')
elif True in (A == B, A == C, B == C):
print('Isosceles')
else:
print('Scalene') |
class BigO_of_1(object):
def check_index_0_is_int(self, value_list):
if value_list[0] == int(value_list[0]):
return True
class BigO_of_N(object):
def double_values(self, value_list):
for i in range(0, len(value_list)):
value_list[i] *= 2
return value_list
class B... | class Bigo_Of_1(object):
def check_index_0_is_int(self, value_list):
if value_list[0] == int(value_list[0]):
return True
class Bigo_Of_N(object):
def double_values(self, value_list):
for i in range(0, len(value_list)):
value_list[i] *= 2
return value_list
clas... |
# Language: Python 3
if __name__ == '__main__':
s = input()
n = any(i.isalnum() for i in s)
a = any(i.isalpha() for i in s)
d = any(i.isdigit() for i in s)
l = any(i.islower() for i in s)
u = any(i.isupper() for i in s)
print(n, a, d, l, u, sep="\n") | if __name__ == '__main__':
s = input()
n = any((i.isalnum() for i in s))
a = any((i.isalpha() for i in s))
d = any((i.isdigit() for i in s))
l = any((i.islower() for i in s))
u = any((i.isupper() for i in s))
print(n, a, d, l, u, sep='\n') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.