content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# TODO: this may want to move to Invoke if we can find a use for it there too?
# Or make it _more_ narrowly focused and stay here?
class NothingToDo(Exception):
pass
class GroupException(Exception):
"""
Lightweight exception wrapper for `.GroupResult` when one contains errors.
.. versionadded:: 2.0
... | class Nothingtodo(Exception):
pass
class Groupexception(Exception):
"""
Lightweight exception wrapper for `.GroupResult` when one contains errors.
.. versionadded:: 2.0
"""
def __init__(self, result):
self.result = result |
class Button(object):
def __init__(self, url, label, get=''):
self.url = url
self.label = label
self.get = get
| class Button(object):
def __init__(self, url, label, get=''):
self.url = url
self.label = label
self.get = get |
class Solution:
def getFormattedEMail(self, email):
userName, domain = email.split('@')
if '+' in userName:
userName = userName.split('+')[0]
if '.' in userName:
userName = ''.join(userName.split('.'))
return userName + '@' + domain
def numUniqueEmail... | class Solution:
def get_formatted_e_mail(self, email):
(user_name, domain) = email.split('@')
if '+' in userName:
user_name = userName.split('+')[0]
if '.' in userName:
user_name = ''.join(userName.split('.'))
return userName + '@' + domain
def num_uniqu... |
class SendResult:
def __init__(self, result={}):
self.successful = result.get('code', None) == '200'
self.message_id = result.get('message_id', None)
| class Sendresult:
def __init__(self, result={}):
self.successful = result.get('code', None) == '200'
self.message_id = result.get('message_id', None) |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 3 10:27:50 2018
@author: James Jiang
"""
all_lines = [line.rstrip('\n') for line in open('Data.txt')]
def has_two_pairs(string):
for i in range(len(string) - 1):
pair = string[i:i + 2]
if (pair in string[:i]) or (pair in string[i + 2:]):
... | """
Created on Wed Jan 3 10:27:50 2018
@author: James Jiang
"""
all_lines = [line.rstrip('\n') for line in open('Data.txt')]
def has_two_pairs(string):
for i in range(len(string) - 1):
pair = string[i:i + 2]
if pair in string[:i] or pair in string[i + 2:]:
return True
else:
... |
########################################################
# Copyright (c) 2015-2017 by European Commission. #
# All Rights Reserved. #
########################################################
extends("BaseKPI.py")
"""
Transmission usage (%)
----------------------
Indexed by
* sco... | extends('BaseKPI.py')
'\nTransmission usage (%)\n----------------------\n\nIndexed by\n\t* scope\n\t* delivery point (dummy)\n\t* energy\n\t* test case\n\t* transmission \n\nThe instant transmission usage of an interconnection is the ratio of electricity or gas flowing through the transmission over its capacity.\nThe K... |
"""Dummy SMTP API."""
class SMTP_dummy(object): # pylint: disable=useless-object-inheritance
# pylint: disable=invalid-name, no-self-use
"""Dummy SMTP API."""
# Class variables track member function calls for later checking.
msg_from = None
msg_to = None
msg = None
def login(self, login... | """Dummy SMTP API."""
class Smtp_Dummy(object):
"""Dummy SMTP API."""
msg_from = None
msg_to = None
msg = None
def login(self, login, password):
"""Do nothing."""
def sendmail(self, msg_from, msg_to, msg):
"""Remember the recipients."""
SMTP_dummy.msg_from = msg_from
... |
""" MECHANICAL PARAMETERS """
s0_step_per_rev = 27106
s1_step_per_rev = 27106
pitch_travel_rads = 0.5
yaw_travel_rads = 1.2
pitch_center_rads = 0.21
yaw_center_rads = 0.59
default_vel_radps = 2.5
default_accel_radps2 = 20
trigger_min_pwm = 40
trigger_max_pwm = 120
trigger_hold_s = 0.5
""" PI PINOUTS """
half_press... | """ MECHANICAL PARAMETERS """
s0_step_per_rev = 27106
s1_step_per_rev = 27106
pitch_travel_rads = 0.5
yaw_travel_rads = 1.2
pitch_center_rads = 0.21
yaw_center_rads = 0.59
default_vel_radps = 2.5
default_accel_radps2 = 20
trigger_min_pwm = 40
trigger_max_pwm = 120
trigger_hold_s = 0.5
' PI PINOUTS '
half_press_index = ... |
def square_of_number():
number = "179"
number_for_sum = "179"
for i in range (49):
number = number + number_for_sum
number = int(number)
number = number ** 2
print(number)
square_of_number()
| def square_of_number():
number = '179'
number_for_sum = '179'
for i in range(49):
number = number + number_for_sum
number = int(number)
number = number ** 2
print(number)
square_of_number() |
'''
Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string "".
Example 1:
Input: strs = ["flower","flow","flight"]
Output: "fl"
Constraints:
1 <= strs.length <= 200
0 <= strs[i].length <= 200
strs[i] consists of only lower-case En... | """
Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string "".
Example 1:
Input: strs = ["flower","flow","flight"]
Output: "fl"
Constraints:
1 <= strs.length <= 200
0 <= strs[i].length <= 200
strs[i] consists of only lower-case En... |
aeki_config = {
"AEKI_HOST": "localhost", # rename to hostname for cgi if you like
"IOT_HOST":"localhost" # assumes iot test device is also on local host
}
| aeki_config = {'AEKI_HOST': 'localhost', 'IOT_HOST': 'localhost'} |
def is_divisible(number):
divisible = [num for num in range(2, 11) if number % num == 0]
return True if divisible else False
start = int(input())
end = int(input())
print([int(_) for _ in range(start, end + 1) if is_divisible(_)])
| def is_divisible(number):
divisible = [num for num in range(2, 11) if number % num == 0]
return True if divisible else False
start = int(input())
end = int(input())
print([int(_) for _ in range(start, end + 1) if is_divisible(_)]) |
"""""
Path to the Image Dataset directories
"""""
TR_IMG_DIR = './WORKSPACE/DATASET/annotation/'
GT_IMG_DIR = './WORKSPACE/DATASET/annotation/'
"""""
Path to Numpy Video directories
"""""
TR_VID_DIR = './WORKSPACE/DATA/TR_DATA/'
GT_VID_DIR = './WORKSPACE/DATA/GT_DATA/'
"""""
Path to Numpy batches directories
""""... | """""
Path to the Image Dataset directories
"""
tr_img_dir = './WORKSPACE/DATASET/annotation/'
gt_img_dir = './WORKSPACE/DATASET/annotation/'
'""\nPath to Numpy Video directories\n'
tr_vid_dir = './WORKSPACE/DATA/TR_DATA/'
gt_vid_dir = './WORKSPACE/DATA/GT_DATA/'
'""\nPath to Numpy batches directories \n'
tr_vgg_dir =... |
"""
Quality Control Tools | Cannlytics
Author: Keegan Skeate <keegan@cannlytics.com>
Created: 2/6/2021
Updated: 6/23/2021
License: MIT License <https://opensource.org/licenses/MIT>
Perform various quality control checks and analyses to ensure
that your laboratory is operating as desired.
TODO:
- Trend an... | """
Quality Control Tools | Cannlytics
Author: Keegan Skeate <keegan@cannlytics.com>
Created: 2/6/2021
Updated: 6/23/2021
License: MIT License <https://opensource.org/licenses/MIT>
Perform various quality control checks and analyses to ensure
that your laboratory is operating as desired.
TODO:
- Trend an... |
# Goal:
#
# Find the sums of subsections of an array
# Change an element of the array and don't recalculate everything
if __name__ == '__main__':
arr = [1,2,3,4,5]
print('here') | if __name__ == '__main__':
arr = [1, 2, 3, 4, 5]
print('here') |
"""
# Definition for a Node.
class Node:
def __init__(self, val = 0, neighbors = None):
self.val = val
self.neighbors = neighbors if neighbors is not None else []
"""
class Solution:
dairy = {}
def cloneGraph(self, node: 'Node') -> 'Node':
if not node:
return None
... | """
# Definition for a Node.
class Node:
def __init__(self, val = 0, neighbors = None):
self.val = val
self.neighbors = neighbors if neighbors is not None else []
"""
class Solution:
dairy = {}
def clone_graph(self, node: 'Node') -> 'Node':
if not node:
return None
... |
inputFile = "day6/day6_1_input.txt"
# https://adventofcode.com/2021/day/6
if __name__ == '__main__':
print("Lanternfish")
with open(inputFile, "r") as f:
fishArray = [int(num) for num in f.read().strip().split(",")]
# for part2... not needed to read array again from file
origFishArray = fishA... | input_file = 'day6/day6_1_input.txt'
if __name__ == '__main__':
print('Lanternfish')
with open(inputFile, 'r') as f:
fish_array = [int(num) for num in f.read().strip().split(',')]
orig_fish_array = fishArray.copy()
nb_days = 1
while nbDays <= 80:
for index in range(0, len(fishArray))... |
INITIAL = 'INITIAL'
CONNECTING = 'CONNECTING'
ESTABLISHED = 'ESTABLISHED'
ACCEPTED = 'ACCEPTED'
DECLINED = 'DECLINED'
ENDED = 'ENDED'
ERROR = 'ERROR'
| initial = 'INITIAL'
connecting = 'CONNECTING'
established = 'ESTABLISHED'
accepted = 'ACCEPTED'
declined = 'DECLINED'
ended = 'ENDED'
error = 'ERROR' |
# Static data class for character stats
class Zhongli:
level = 90
talentLevel = 8
# Base stat values
baseHP = 14695
baseATK = 251
baseCritRATE = 0.05
baseCritDMG = 0.5
# Ability MVs and frame counts
class Normal: # Normal attack spear kick hop combo
frames = 140
#m... | class Zhongli:
level = 90
talent_level = 8
base_hp = 14695
base_atk = 251
base_crit_rate = 0.05
base_crit_dmg = 0.5
class Normal:
frames = 140
mv = 0.5653 + 0.5723 + 0.7087 + 0.7889 + 4 * 0.1975
hits = 8
rotations = (720 - 100 - 140) / 140
hp_conv = 0... |
# Copyright 2018 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | """ML METADATA Data Validation external dependencies that can be loaded in WORKSPACE files.
"""
load('//ml_metadata:mysql_configure.bzl', 'mysql_configure')
def ml_metadata_workspace():
"""All ML Metadata external dependencies."""
mysql_configure() |
class Environment(object):
def ask(self, prompt, default=None, starting=None):
pass
def ask_values(self, prompt, values, default=None, starting=None):
pass
def ask_directory(self, prompt, default=None, starting=None):
pass
def ask_completion(self, prompt, values, starting=Non... | class Environment(object):
def ask(self, prompt, default=None, starting=None):
pass
def ask_values(self, prompt, values, default=None, starting=None):
pass
def ask_directory(self, prompt, default=None, starting=None):
pass
def ask_completion(self, prompt, values, starting=Non... |
x = float(input("Enter Number: "))
if(x % 2) == 0 and x > 0:
print("The number you entered is positive and even.")
elif(x % 2) == 0 and x < 0:
print("The number you entered is negative and even.")
elif(x % 2) != 0 and x > 0:
print("The number you entered is positive and odd.")
elif(x % 2) != 0 and x < 0:
... | x = float(input('Enter Number: '))
if x % 2 == 0 and x > 0:
print('The number you entered is positive and even.')
elif x % 2 == 0 and x < 0:
print('The number you entered is negative and even.')
elif x % 2 != 0 and x > 0:
print('The number you entered is positive and odd.')
elif x % 2 != 0 and x < 0:
pr... |
"""
AiiDA Plugin Template
Adapt this template for your own needs.
"""
__version__ = '0.3.4'
| """
AiiDA Plugin Template
Adapt this template for your own needs.
"""
__version__ = '0.3.4' |
#Ask user for name
name = input("What is your name?: ")
#Ask user for the age
age = input("How old are you? ")
#Ask user for city
city = input("What city do you live in? ")
#Ask user what they enjoy
hobbies = input("What are your hobbies?, What do you love doing? ")
#Create output text using placeholders to concat... | name = input('What is your name?: ')
age = input('How old are you? ')
city = input('What city do you live in? ')
hobbies = input('What are your hobbies?, What do you love doing? ')
string = 'Your name is {} and you are {} years old. You live in {} and you love {}'
output = string.format(name, age, city, hobbies)
print(... |
class Info:
"""
Allows to print out information about the application.
"""
def commands():
print('''Main modules:
imu | Inertial Measurement Unit (GPS, gyro, accelerometer)
gps | GPS
gyro | Gyroscope
accel | Accelerometer
... | class Info:
"""
Allows to print out information about the application.
"""
def commands():
print('Main modules:\n imu | Inertial Measurement Unit (GPS, gyro, accelerometer)\n gps | GPS \n gyro | Gyroscope \n accel | Accelerometer\n fu... |
def second_task(**context):
print("This is ----------- task 2")
return "hoge======"
def third_task(**context):
output = context["task_instance"].xcom_pull(task_ids="python_task_2")
print("This is ----------- task 3")
return "This is the result : " + output
| def second_task(**context):
print('This is ----------- task 2')
return 'hoge======'
def third_task(**context):
output = context['task_instance'].xcom_pull(task_ids='python_task_2')
print('This is ----------- task 3')
return 'This is the result : ' + output |
""" MARKDOWN
---
YamlDesc: CONTENT-ARTICLE
Title: python builtin class attributes
MetaDescription: python object oriented programming class builtin attributes __doc__, __name__, __module__, __bases__ example code, tutorials
MetaKeywords: python object oriented programming class builtin attributes __doc__, __name__, __m... | """ MARKDOWN
---
YamlDesc: CONTENT-ARTICLE
Title: python builtin class attributes
MetaDescription: python object oriented programming class builtin attributes __doc__, __name__, __module__, __bases__ example code, tutorials
MetaKeywords: python object oriented programming class builtin attributes __doc__, __name__, __m... |
'''
Source : https://leetcode.com/problems/maximum-depth-of-binary-tree/
Author : Yuan Wang
Date : 2018-07-21
/**********************************************************************************
*Given a binary tree, find its maximum depth.
*
*The maximum depth is the number of nodes along the longest path from the ... | """
Source : https://leetcode.com/problems/maximum-depth-of-binary-tree/
Author : Yuan Wang
Date : 2018-07-21
/**********************************************************************************
*Given a binary tree, find its maximum depth.
*
*The maximum depth is the number of nodes along the longest path from the ... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
========================
SBPy Vega Sources Module
========================
Descriptions of source Vega spectra.
"""
# Parameters passed to Vega.from_file. 'filename' is a URL. After
# adding spectra here update __init__.py docstring and
# docs/sbpy... | """
========================
SBPy Vega Sources Module
========================
Descriptions of source Vega spectra.
"""
available = ['Bohlin2014']
bohlin2014 = {'filename': 'alpha_lyr_stis_008-edit.fits', 'description': 'Spectrum of Bohlin 2014', 'bibcode': '2014AJ....147..127B'} |
def divide_by_four(input_number):
return input_number/4
result = divide_by_four(16)
# result now holds 4
print("16 divided by 4 is " + str(result) + "!")
result2 = divide_by_four(result)
print(str(result) + " divided by 4 is " + str(result2) + "!")
def calculate_age(current_year, birth_year):
age = current_yea... | def divide_by_four(input_number):
return input_number / 4
result = divide_by_four(16)
print('16 divided by 4 is ' + str(result) + '!')
result2 = divide_by_four(result)
print(str(result) + ' divided by 4 is ' + str(result2) + '!')
def calculate_age(current_year, birth_year):
age = current_year - birth_year
... |
#####################
### Base classes. ###
#####################
class barrier:
synonyms = ["wall"]
m_description = "There is a barrier in the way."
def __init__(self, passable=False):
self.passable = passable
def __str__(self):
return self.m_description
def ... | class Barrier:
synonyms = ['wall']
m_description = 'There is a barrier in the way.'
def __init__(self, passable=False):
self.passable = passable
def __str__(self):
return self.m_description
def __repr__(self):
return self.synonyms[0]
class Passage(barrier):
synonyms =... |
g1 = "#5d9e6d"
g2 = "#549464"
g3 = "#498758"
g4 = "#3d784b"
b1 = "#5f7ab8"
b2 = "#5a70a3"
b3 = "#4d67a3"
r4 = "#262626"
w1 = "#f0f0f0"
w2 = "#d9d9d9"
w3 = "#e6e6e6"
r1 = "#707070"
r2 = "#595959"
r3 = "#404040"
r4 = "#262626"
l1 = "#d95757"
l2 = "#d99457"
l3 = "#d97857"
v1 = "#664f47"
v2 = "#4a3d39"
v3 = "#382f2c"
v4 = ... | g1 = '#5d9e6d'
g2 = '#549464'
g3 = '#498758'
g4 = '#3d784b'
b1 = '#5f7ab8'
b2 = '#5a70a3'
b3 = '#4d67a3'
r4 = '#262626'
w1 = '#f0f0f0'
w2 = '#d9d9d9'
w3 = '#e6e6e6'
r1 = '#707070'
r2 = '#595959'
r3 = '#404040'
r4 = '#262626'
l1 = '#d95757'
l2 = '#d99457'
l3 = '#d97857'
v1 = '#664f47'
v2 = '#4a3d39'
v3 = '#382f2c'
v4 = ... |
description = 'Some kind of SKF chopper'
pv_root = 'LabS-Embla:Chop-Drv-0601:'
devices = dict(
skf_drive_temp=device('nicos.devices.epics.pva.EpicsReadable',
description='Drive temperature',
readpv='{}DrvTmp_Stat'.format(pv_root),
monitor=True,
),
skf_motor_temp=device('nicos.devic... | description = 'Some kind of SKF chopper'
pv_root = 'LabS-Embla:Chop-Drv-0601:'
devices = dict(skf_drive_temp=device('nicos.devices.epics.pva.EpicsReadable', description='Drive temperature', readpv='{}DrvTmp_Stat'.format(pv_root), monitor=True), skf_motor_temp=device('nicos.devices.epics.pva.EpicsReadable', description=... |
class BaseSelector:
def __init__(self):
pass
def select_model(self, X, y,
total_time,
learners=None,
metric=None,
save_directory=None):
"""
Find the best model with its hyperparameters from the autotf's... | class Baseselector:
def __init__(self):
pass
def select_model(self, X, y, total_time, learners=None, metric=None, save_directory=None):
"""
Find the best model with its hyperparameters from the autotf's model zool
Parameters
----------
X: array-like or sparse m... |
# Given a list x of length n, a number to be inserted into the list and a position where to insert the number
# return the new list
# e.g given [2, 3, 6, 7], num=8 and position=2, return [2, 3, 8, 6, 7]
# for more info on this quiz, go to this url: http://www.programmr.com/insertion-specified-position-array-0
def ins... | def insert_into_list(arr, num, position):
b = arr[:position] + [num] + arr[position:]
return b
if __name__ == '__main__':
print(insert_into_list([1, 2, 3, 4], 5, 4)) |
"""This module contains exceptions defined for Rhasspy Desktop Satellite."""
class RDSatelliteServerError(Exception):
"""Base class for exceptions raised by Rhasspy Desktop Satellite code.
By catching this exception type, you catch all exceptions that are
defined by the Hermes Audio Server code."""
cla... | """This module contains exceptions defined for Rhasspy Desktop Satellite."""
class Rdsatelliteservererror(Exception):
"""Base class for exceptions raised by Rhasspy Desktop Satellite code.
By catching this exception type, you catch all exceptions that are
defined by the Hermes Audio Server code."""
class... |
# Implementor
class drawing_api:
def draw_circle(self, x, y, radius):
pass
# ConcreteImplementor 1/2
class drawing_api1(drawing_api):
def draw_circle(self, x, y, radius):
print('API1.circle at %f:%f radius %f' % (x, y, radius))
# ConcreteImplementor 2/2
class drawing_api2(drawing_api):
d... | class Drawing_Api:
def draw_circle(self, x, y, radius):
pass
class Drawing_Api1(drawing_api):
def draw_circle(self, x, y, radius):
print('API1.circle at %f:%f radius %f' % (x, y, radius))
class Drawing_Api2(drawing_api):
def draw_circle(self, x, y, radius):
print('API2.circle at... |
class Solution:
# @param {integer} k
# @param {integer} n
# @return {integer[][]}
def combinationSum3(self, k, n):
nums = range(1, 10)
self.results = []
self.combination(nums, n, k, 0, [])
return self.results
def combination(self, nums, target, k, start, result):
... | class Solution:
def combination_sum3(self, k, n):
nums = range(1, 10)
self.results = []
self.combination(nums, n, k, 0, [])
return self.results
def combination(self, nums, target, k, start, result):
if k <= 0:
return
elif k == 1:
for i in... |
X = int(input())
Y = int(input())
soma = 0
if X > Y:
troca = Y
Y = X
X = troca
sam = X
while sam <= Y:
if sam%13 != 0:
soma = soma + sam
sam += 1
print(soma)
| x = int(input())
y = int(input())
soma = 0
if X > Y:
troca = Y
y = X
x = troca
sam = X
while sam <= Y:
if sam % 13 != 0:
soma = soma + sam
sam += 1
print(soma) |
pMMO_dna_seq = 'ATGAAAACTATTAAAGATAGAATTGCTAAATGGTCTGCTATTGGTTTGTTGTCTGCTGTTGCTGCTACTGCTTTTTATGCTCCATCTGCTTCTGCTCATGGTGAAAAATCTCAAGCTGCTTTTATGAGAATGAGGACTATTCATTGGTATGACTTATCTTGGTCTAAGGAAAAGGTTAAAATAAACGAAACTGTTGAGATTAAAGGTAAATTTCATGTTTTTGAAGGTTGGCCTGAAACTGTTGATGAACCTGATGTTGCTTTTTTGAATGTTGGTATGCCTGGTCCTGTTTTTATTAGAAAAG... | p_mmo_dna_seq = 'ATGAAAACTATTAAAGATAGAATTGCTAAATGGTCTGCTATTGGTTTGTTGTCTGCTGTTGCTGCTACTGCTTTTTATGCTCCATCTGCTTCTGCTCATGGTGAAAAATCTCAAGCTGCTTTTATGAGAATGAGGACTATTCATTGGTATGACTTATCTTGGTCTAAGGAAAAGGTTAAAATAAACGAAACTGTTGAGATTAAAGGTAAATTTCATGTTTTTGAAGGTTGGCCTGAAACTGTTGATGAACCTGATGTTGCTTTTTTGAATGTTGGTATGCCTGGTCCTGTTTTTATTAGAAAA... |
"""MEF Eline Exceptions."""
class MEFELineException(Exception):
"""MEF Eline Base Exception."""
class EVCException(MEFELineException):
"""EVC Exception."""
class ValidationException(EVCException):
"""Exception for validation errors."""
class FlowModException(MEFELineException):
"""Exception for ... | """MEF Eline Exceptions."""
class Mefelineexception(Exception):
"""MEF Eline Base Exception."""
class Evcexception(MEFELineException):
"""EVC Exception."""
class Validationexception(EVCException):
"""Exception for validation errors."""
class Flowmodexception(MEFELineException):
"""Exception for Flow... |
# Copyright (c) 2021 homuler
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
"""Proto compiler
Macro for generating C# source files corresponding to .proto files
"""
def csharp_proto_src(name, proto_src, deps):
"... | """Proto compiler
Macro for generating C# source files corresponding to .proto files
"""
def csharp_proto_src(name, proto_src, deps):
"""Generate C# source code for *.proto
Args:
name: target name
deps: label list of dependent targets
proto_src: target .proto file path
"""
base_name... |
c = int(input('digite o primeiro numero: '))
b = int(input('digite o segundo numero: '))
a = int(input('digite o terceiro numero: '))
cores= {'vermelho': '\033[0;31m',
'azul' : '\033[1;34m',
'zero': '\033[m' }
# qual o maior
maior = a
if b > c and b > a:
maior = b
if c > b and c > a:
maior = c
p... | c = int(input('digite o primeiro numero: '))
b = int(input('digite o segundo numero: '))
a = int(input('digite o terceiro numero: '))
cores = {'vermelho': '\x1b[0;31m', 'azul': '\x1b[1;34m', 'zero': '\x1b[m'}
maior = a
if b > c and b > a:
maior = b
if c > b and c > a:
maior = c
print('O maior valor foi {}{}{}'.... |
"""
A website requires the users to input username and password to register. Write a program to check the validity of password input by users.
"""
"""Question 18
Level 3
Question:
A website requires the users to input username and password to register. Write a program to check the validity of password input by users.
... | """
A website requires the users to input username and password to register. Write a program to check the validity of password input by users.
"""
'Question 18\nLevel 3\nQuestion:\nA website requires the users to input username and password to register. Write a program to check the validity of password input by users.\... |
class ACCOUNTS():
def __init__(self):
self.CodeChef = {
"username": "username",
"password": "password"
}
self.Hackerrank = {
"username": "username",
"password": "password",
"tracks": ["python"]
# Available (... | class Accounts:
def __init__(self):
self.CodeChef = {'username': 'username', 'password': 'password'}
self.Hackerrank = {'username': 'username', 'password': 'password', 'tracks': ['python']}
def get_accounts(self):
return vars(self) |
# TODO: implement a page_parser that uses nlp and stats to get a good read of a file.
class page_parser(object):
"""
a multi purpose parser that can read these file types
"""
def __init__(self):
pass
| class Page_Parser(object):
"""
a multi purpose parser that can read these file types
"""
def __init__(self):
pass |
# Source and destination file names.
test_source = "data/math.txt"
test_destination = "math_output_html.html"
# Keyword parameters passed to publish_file.
reader_name = "standalone"
parser_name = "rst"
writer_name = "html"
# Extra setting
settings_overrides['math_output'] = 'HTML'
settings_overrides['stylesheet_path... | test_source = 'data/math.txt'
test_destination = 'math_output_html.html'
reader_name = 'standalone'
parser_name = 'rst'
writer_name = 'html'
settings_overrides['math_output'] = 'HTML'
settings_overrides['stylesheet_path'] = '../docutils/writers/html4css1/html4css1.css, ../docutils/writers/html4css1/math.css ' |
'''
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.
Note:
The number of elements initialized in nums1 and nums2 are m and n respectively.
You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional elements from nums2.
Ex... | """
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.
Note:
The number of elements initialized in nums1 and nums2 are m and n respectively.
You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional elements from nums2.
Ex... |
def test_valid(cldf_dataset, cldf_logger):
assert cldf_dataset.validate(log=cldf_logger)
def test_parameters(cldf_dataset):
assert len(list(cldf_dataset["ParameterTable"])) == 100
def test_languages(cldf_dataset):
assert len(list(cldf_dataset["LanguageTable"])) > 4000
| def test_valid(cldf_dataset, cldf_logger):
assert cldf_dataset.validate(log=cldf_logger)
def test_parameters(cldf_dataset):
assert len(list(cldf_dataset['ParameterTable'])) == 100
def test_languages(cldf_dataset):
assert len(list(cldf_dataset['LanguageTable'])) > 4000 |
description = 'setup for the status monitor'
group = 'special'
_expcolumn = Column(
Block('Experiment', [
BlockRow(
# Field(name='Proposal', key='exp/proposal', width=7),
# Field(name='Title', key='exp/title', width=20,
# istext=True, maxlen=20),
Field(name... | description = 'setup for the status monitor'
group = 'special'
_expcolumn = column(block('Experiment', [block_row(field(name='Current status', key='exp/action', width=40, istext=True, maxlen=40), field(name='Data file', key='exp/lastpoint'))]))
_sampletable = column(block('Sample table', [block_row(field(dev='omgs')), ... |
"""Bazel rules and macros for running tsec over a ng_module or ts_library."""
load("@npm//@bazel/typescript/internal:ts_config.bzl", "TsConfigInfo")
load("@build_bazel_rules_nodejs//:providers.bzl", "DeclarationInfo")
load("@npm//tsec:index.bzl", _tsec_test = "tsec_test")
TsecTsconfigInfo = provider(fields = ["src", ... | """Bazel rules and macros for running tsec over a ng_module or ts_library."""
load('@npm//@bazel/typescript/internal:ts_config.bzl', 'TsConfigInfo')
load('@build_bazel_rules_nodejs//:providers.bzl', 'DeclarationInfo')
load('@npm//tsec:index.bzl', _tsec_test='tsec_test')
tsec_tsconfig_info = provider(fields=['src', 'exe... |
def shellSort(alist):
gap = len(alist) // 2
while gap > 0:
for i in range(gap, len(alist)):
val = alist[i]
j = i
while j >= gap and alist[j - gap] > val:
alist[j] = alist[j - gap]
j -= gap
alist[j] = val
gap //= 2
| def shell_sort(alist):
gap = len(alist) // 2
while gap > 0:
for i in range(gap, len(alist)):
val = alist[i]
j = i
while j >= gap and alist[j - gap] > val:
alist[j] = alist[j - gap]
j -= gap
alist[j] = val
gap //= 2 |
#############################################################################
#
#
# Module of BFA that manages server statistics in realtime
#
#
#############################################################################
""" This module implements the real-time logging of in-game statistics specifically for one curre... | """ This module implements the real-time logging of in-game statistics specifically for one current bf checkpoint.
Dependencies:
None
note:: Author(s): Mitch last-check: 08.07.2021 """
def __preload__(forClient: bool=True):
pass
def __postload__(forClient: bool=True):
pass
class Realt... |
#!/usr/bin/env python3
def foo():
a = 10
# infer that b is an int
b = a
assert b == 10
print(b)
if __name__ == "__main__":
foo()
| def foo():
a = 10
b = a
assert b == 10
print(b)
if __name__ == '__main__':
foo() |
x="There are %d types of people."%10
binary="binary"
do_not="don't"
y="Those who know %s and those who %s."%(binary,do_not)
print(x)
print(y)
print("I said: '%s'."%y)
hilarious=False
joke_evaluation="Isn't that joke so funny?! %r"
print (joke_evaluation % hilarious)
w="This is the left side of ..."
e="a string with a r... | x = 'There are %d types of people.' % 10
binary = 'binary'
do_not = "don't"
y = 'Those who know %s and those who %s.' % (binary, do_not)
print(x)
print(y)
print("I said: '%s'." % y)
hilarious = False
joke_evaluation = "Isn't that joke so funny?! %r"
print(joke_evaluation % hilarious)
w = 'This is the left side of ...'
... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Spyder Project Contributors
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
ANSI_COLORS ... | ansi_colors = {'emacs': {'black': '#000000', 'red': '#800000', 'green': '#005100', 'yellow': '#abab67', 'blue': '#151d51', 'magenta': '#510051', 'cyan': '#105151', 'white': '#ffffff', 'brightBlack': '#555555', 'brightRed': '#c80000', 'brightGreen': '#00aa00', 'brightYellow': '#cbcb7b', 'brightBlue': '#3c51e8', 'brightM... |
def printVal(state, name):
val = state[name]
print("%s:" % state.fuzzy_names[name], val)
def print_all(state):
printVal(state, "var_default")
printVal(state, "var_default_override")
printVal(state, "var_default_override_twice")
printVal(state, "var_default_override_twice_and_cli")
def regis... | def print_val(state, name):
val = state[name]
print('%s:' % state.fuzzy_names[name], val)
def print_all(state):
print_val(state, 'var_default')
print_val(state, 'var_default_override')
print_val(state, 'var_default_override_twice')
print_val(state, 'var_default_override_twice_and_cli')
def reg... |
class AbstractException(Exception):
"""Abstract exception for project"""
def __init__(self, code, message):
"""
Constructor
:param int code: error code
:param str message: error message
"""
self._code = code
self._message = message
@property
def... | class Abstractexception(Exception):
"""Abstract exception for project"""
def __init__(self, code, message):
"""
Constructor
:param int code: error code
:param str message: error message
"""
self._code = code
self._message = message
@property
def... |
"""
https://leetcode.com/problems/rectangle-overlap/
A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bottom-left corner, and (x2, y2) are the coordinates of its top-right corner.
Two rectangles overlap if the area of their intersection is positive. To be clear, two rec... | """
https://leetcode.com/problems/rectangle-overlap/
A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bottom-left corner, and (x2, y2) are the coordinates of its top-right corner.
Two rectangles overlap if the area of their intersection is positive. To be clear, two rec... |
class Node():
def __init__(self,data):
self.data=data
self.ref=None
class LinkedList():
def __init__(self):
self.head=None
def Print_ll(self):
n=self.head
if n is None:
print("LinkedList is empty")
else:
while n is not None:
... | class Node:
def __init__(self, data):
self.data = data
self.ref = None
class Linkedlist:
def __init__(self):
self.head = None
def print_ll(self):
n = self.head
if n is None:
print('LinkedList is empty')
else:
while n is not None:
... |
#!/usr/bin/env python3
#encoding=utf-8
#------------------------------------------------
# Usage: python3 3-desc-state-inst.py
# Description: descriptor for attribute intercept
#------------------------------------------------
class InstState: # Using instance state, (object) in 2.X
def __get__(self, inst... | class Inststate:
def __get__(self, instance, owner):
print('InstState get')
return instance._X * 10
def __set__(self, instance, value):
print('InstState set')
instance._X = value
class Calcattrs:
x = inst_state()
y = 3
def __init__(self):
self._X = 2
... |
bind = "0.0.0.0:5000"
backlog = 2048
workers = 1
worker_class = "sync"
threads = 16
spew = False
reload = True
loglevel = "debug"
| bind = '0.0.0.0:5000'
backlog = 2048
workers = 1
worker_class = 'sync'
threads = 16
spew = False
reload = True
loglevel = 'debug' |
for t in range(int(input())):
n=int(input())
if n%2==0:
print(int(n/2-1))
else:
print(int(n//2)) | for t in range(int(input())):
n = int(input())
if n % 2 == 0:
print(int(n / 2 - 1))
else:
print(int(n // 2)) |
value1 = int(input()); value2 = value1//100
if value1 % 2==0 and value2 % 2==0:
print("Even")
elif value1 % 2==0 and value2 % 2==1:
print("Even Odd")
elif value1 % 2==1 and value2 % 2==1:
print("Odd")
elif value1 % 2==1 and value2 % 2==0:
print("Odd Even")
| value1 = int(input())
value2 = value1 // 100
if value1 % 2 == 0 and value2 % 2 == 0:
print('Even')
elif value1 % 2 == 0 and value2 % 2 == 1:
print('Even Odd')
elif value1 % 2 == 1 and value2 % 2 == 1:
print('Odd')
elif value1 % 2 == 1 and value2 % 2 == 0:
print('Odd Even') |
class Solution:
def lemonadeChange(self, bills: List[int]) -> bool:
money = [0, 0, 0]
for x in bills:
if x == 5:
money[0] += 1
if x == 10:
if money[0] >= 1:
money[1] += 1
money[0] -= 1
... | class Solution:
def lemonade_change(self, bills: List[int]) -> bool:
money = [0, 0, 0]
for x in bills:
if x == 5:
money[0] += 1
if x == 10:
if money[0] >= 1:
money[1] += 1
money[0] -= 1
e... |
config = {}
with open("config.txt", "r") as f:
lines = f.readlines()
for line in lines:
key, value = line.split("=")
value = value.replace("\n", "")
config[key] = value
print(f"Added key {key} with value {value}")
user_key = input("Which key would you like to see? ")
if user_ke... | config = {}
with open('config.txt', 'r') as f:
lines = f.readlines()
for line in lines:
(key, value) = line.split('=')
value = value.replace('\n', '')
config[key] = value
print(f'Added key {key} with value {value}')
user_key = input('Which key would you like to see? ')
if user_ke... |
# A little bit of molecular biology
# Codons are non-overlapping triplets of nucleotides.
# ATG CCC CTG GTA ... - this corresponds to four codons; spaces added for emphasis
# The start codon is 'ATG'
# Stop codons can be 'TGA' , 'TAA', or 'TAG', but they must be 'in frame' with the start codon. The first stop codon ... | dna = 'GGGATGTTTGGGCCCTACGGGCCCTGATCGGCT'
def start_codon_index(seq):
start_idx = seq.find('ATG')
return start_idx
def stop_codon_index(seq, start_codon):
stop_idx = -1
codon_length = 3
search_start = start_codon + codon_length
search_stop = len(seq)
for i in range(search_start, search_sto... |
# REMISS
for i in range(int(input())):
A,B = map(int,input().split())
if A>B: print(str(A) + " " + str(A+B))
else: print(str(B) + " " + str(A+B)) | for i in range(int(input())):
(a, b) = map(int, input().split())
if A > B:
print(str(A) + ' ' + str(A + B))
else:
print(str(B) + ' ' + str(A + B)) |
#!/usr/bin/env python3
def hello(**kwargs):
print(f'Hello')
if __name__ == '__main__':
hello(hello())
| def hello(**kwargs):
print(f'Hello')
if __name__ == '__main__':
hello(hello()) |
#!/usr/bin/env python3
with open("dnsservers.txt", "r") as dnsfile:
for svr in dnsfile:
svr = svr.rstrip('\n')
if svr.endswith('org'):
with open("org-domain.txt", "a") as srvfile:
srvfile.write(svr + "\n")
elif svr.endswith('com'):
with open("com-dom... | with open('dnsservers.txt', 'r') as dnsfile:
for svr in dnsfile:
svr = svr.rstrip('\n')
if svr.endswith('org'):
with open('org-domain.txt', 'a') as srvfile:
srvfile.write(svr + '\n')
elif svr.endswith('com'):
with open('com-domain.txt', 'a') as srvfile... |
class Solution:
def sumOfLeftLeaves(self, root: TreeNode) -> int:
if not root:
return 0
res = 0
q = deque([root])
while q:
node = q.popleft()
if node.left:
if not node.left.left and not node.left.right:
res += no... | class Solution:
def sum_of_left_leaves(self, root: TreeNode) -> int:
if not root:
return 0
res = 0
q = deque([root])
while q:
node = q.popleft()
if node.left:
if not node.left.left and (not node.left.right):
res... |
"""
Sponge Knowledge Base
Remote API security
"""
def configureAccessService():
# Configure the RoleBasedAccessService.
# Simple access configuration: role -> knowledge base names regexps.
remoteApiServer.accessService.addRolesToKb({ "ROLE_ADMIN":[".*"], "ROLE_ANONYMOUS":["boot", "python"]})
# Simple... | """
Sponge Knowledge Base
Remote API security
"""
def configure_access_service():
remoteApiServer.accessService.addRolesToKb({'ROLE_ADMIN': ['.*'], 'ROLE_ANONYMOUS': ['boot', 'python']})
remoteApiServer.accessService.addRolesToSendEvent({'ROLE_ADMIN': ['.*'], 'ROLE_ANONYMOUS': []})
remoteApiServer.accessSe... |
'''
Given a string s, the power of the string is the maximum length of a non-empty substring that contains only one unique character.
Return the power of the string.
Example 1:
Input: s = "leetcode"
Output: 2
Explanation: The substring "ee" is of length 2 with the character 'e' only.
Example 2:
Input: s = "abbcccddd... | """
Given a string s, the power of the string is the maximum length of a non-empty substring that contains only one unique character.
Return the power of the string.
Example 1:
Input: s = "leetcode"
Output: 2
Explanation: The substring "ee" is of length 2 with the character 'e' only.
Example 2:
Input: s = "abbcccddd... |
MAP_HEIGHT_MIN = 20
MAP_HEIGHT_MAX = 50
MAP_WIDTH_MIN = 20
MAP_WIDTH_MAX = 50
MAP_KARBONITE_MIN = 0
MAP_KARBONITE_MAX = 50
ASTEROID_ROUND_MIN = 10
ASTEROID_ROUND_MAX = 20
ASTEROID_KARB_MIN = 20
ASTEROID_KARB_MAX = 100
ORBIT_FLIGHT_MIN = 50
ORBIT_FLIGHT_MAX = 200
ROUND_LIMIT = 1000
def validate_map_dims(h, w):
ret... | map_height_min = 20
map_height_max = 50
map_width_min = 20
map_width_max = 50
map_karbonite_min = 0
map_karbonite_max = 50
asteroid_round_min = 10
asteroid_round_max = 20
asteroid_karb_min = 20
asteroid_karb_max = 100
orbit_flight_min = 50
orbit_flight_max = 200
round_limit = 1000
def validate_map_dims(h, w):
retu... |
string = input().split(", ")
beggars = int(input())
beggars_list = []
for x in range(0, beggars):
temp = string[x::beggars]
for j in range(0, len(temp)):
temp[j] = int(temp[j])
beggars_list.append(sum(temp))
print(beggars_list) | string = input().split(', ')
beggars = int(input())
beggars_list = []
for x in range(0, beggars):
temp = string[x::beggars]
for j in range(0, len(temp)):
temp[j] = int(temp[j])
beggars_list.append(sum(temp))
print(beggars_list) |
# python to locate 1 in a 2D array
#below save it into a dictionary
# python to locate 1 in a 2D array
def check_zero(array1):
d = {}
print("array index zeros at:")
for i in range(len(array1)):
index = [k for k, v in enumerate(array1[i]) if v == 0]
d[i] = index
#print(i, index)
... | def check_zero(array1):
d = {}
print('array index zeros at:')
for i in range(len(array1)):
index = [k for (k, v) in enumerate(array1[i]) if v == 0]
d[i] = index
return d
array1 = [[1, 1, 0, 0], [0, 0, 1, 1], [0, 1, 0, 1]]
array2 = [[1, 1, 0, 0, 0], [0, 0, 1, 1, 0], [0, 0, 1, 0, 1]]
print... |
name = "Sharalanda"
age = 10
hobbies = ["draw", "swim", "dance"]
address = {"city": "Sebastopol", "Post Code": 1234, "country": "Enchantia"}
print("My name is", name)
print("I am", age, "years old")
print("My favourite hobbie is", hobbies[0])
print("I live in", address["city"])
| name = 'Sharalanda'
age = 10
hobbies = ['draw', 'swim', 'dance']
address = {'city': 'Sebastopol', 'Post Code': 1234, 'country': 'Enchantia'}
print('My name is', name)
print('I am', age, 'years old')
print('My favourite hobbie is', hobbies[0])
print('I live in', address['city']) |
class Solution(object):
def threeConsecutiveOdds(self, arr):
"""
:type arr: List[int]
:rtype: bool
"""
odds = 0
for a in arr:
if a % 2 == 1:
odds += 1
if odds >= 3:
return True
else:
... | class Solution(object):
def three_consecutive_odds(self, arr):
"""
:type arr: List[int]
:rtype: bool
"""
odds = 0
for a in arr:
if a % 2 == 1:
odds += 1
if odds >= 3:
return True
else:
... |
# Copyright (c) 2018 Javier M. Mellid <jmunhoz@igalia.com>
#
# 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, modif... | class S3Owner:
def __init__(self, xid, display_name, id):
self.xid = xid
self.display_name = display_name
self.id = id
def __str__(self):
return '{} - {} - {}'.format(self.xid, self.display_name, self.id)
class S3Object:
pass
class S3Version(S3Object):
xid = 0
las... |
#Create a list using []
a = [1,2,3,7,66]
#print the list using print() function
print(a)
#Access using index using a[0], a[1], ....
print(a[2])
#Changing the value of the list
a[0] = 777
print(a)
#We can create a list with items of different type
b = [77,"Root",False,6.9]
print(b)
#List Slicing
friends = ["Root","... | a = [1, 2, 3, 7, 66]
print(a)
print(a[2])
a[0] = 777
print(a)
b = [77, 'Root', False, 6.9]
print(b)
friends = ['Root', 'Groot', 'Sam', 'Alex', 99]
print(friends[0:3])
print(friends[-4:]) |
singular = [
'this','as','is','thesis','hypothesis','less','obvious','us','yes','cos',
'always','perhaps','alias','plus','apropos',
'was','its','bus','his','is','us',
'this','thus','axis','bias','minus','basis',
'praxis','status','modulus','analysis',
'aparatus'
]
invariable = [ #frozen_li... | singular = ['this', 'as', 'is', 'thesis', 'hypothesis', 'less', 'obvious', 'us', 'yes', 'cos', 'always', 'perhaps', 'alias', 'plus', 'apropos', 'was', 'its', 'bus', 'his', 'is', 'us', 'this', 'thus', 'axis', 'bias', 'minus', 'basis', 'praxis', 'status', 'modulus', 'analysis', 'aparatus']
invariable = ['a', 'an', 'all',... |
class Solution(object):
def summaryRanges(self, nums):
"""
:type nums: List[int]
:rtype: List[str]
"""
range_list = []
for i in range(len(nums)):
if i > 0 and nums[i - 1] + 1 == nums[i]:
range_list[-1][1] = nums[i]
else:
... | class Solution(object):
def summary_ranges(self, nums):
"""
:type nums: List[int]
:rtype: List[str]
"""
range_list = []
for i in range(len(nums)):
if i > 0 and nums[i - 1] + 1 == nums[i]:
range_list[-1][1] = nums[i]
else:
... |
class Config:
"""
General configuration parent class
"""
pass
api_key = 'a493e30f11b147d0ba67b15ca60c5e4c'
SECRET_KEY = '1234567890'
class ProdConfig(Config):
"""
Production
"""
pass
class DevConfig(Config):
"""
development
"""
DEBUG = True
| class Config:
"""
General configuration parent class
"""
pass
api_key = 'a493e30f11b147d0ba67b15ca60c5e4c'
secret_key = '1234567890'
class Prodconfig(Config):
"""
Production
"""
pass
class Devconfig(Config):
"""
development
"""
debug = True |
""" Technically, a every problem is a program; but not every program is a
problem.
This distinction only really matters if we introduce nodes for For loops
and whatnot.
Then the problem has 'program-like' constructs.
"""
| """ Technically, a every problem is a program; but not every program is a
problem.
This distinction only really matters if we introduce nodes for For loops
and whatnot.
Then the problem has 'program-like' constructs.
""" |
"""
taskmaster.example
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
def get_jobs(last=0):
# last_job would be sent if state was resumed
# from a previous run
for i in xrange(last, 20000):
yield i
def handle_job(i):
pass
... | """
taskmaster.example
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
def get_jobs(last=0):
for i in xrange(last, 20000):
yield i
def handle_job(i):
pass |
#
# PySNMP MIB module JUNIPER-MOBILE-GATEWAY-SGW-GTP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/JUNIPER-MOBILE-GATEWAY-SGW-GTP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:00:25 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint, constraints_union) ... |
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
BAZEL_INSTALLER = struct(
revision = "4.0.0",
sha256 = "bd7a3a583a18640f58308c26e654239d412adaa833b6b6a7b57a216ab62fabc2",
)
DEBS_TARBALL = struct(
revision = "1608132805",
sha256 = "7ed2d4869f19c11d8c39345bd75f908a51410bf4e512e9fc368ad... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_file')
bazel_installer = struct(revision='4.0.0', sha256='bd7a3a583a18640f58308c26e654239d412adaa833b6b6a7b57a216ab62fabc2')
debs_tarball = struct(revision='1608132805', sha256='7ed2d4869f19c11d8c39345bd75f908a51410bf4e512e9fc368ad0c2bbf43e28')
def deps():
... |
if __name__ == '__main__':
n = int(input())
s = set()
for i in range (n):
s.add(input())
print((len(s)))
| if __name__ == '__main__':
n = int(input())
s = set()
for i in range(n):
s.add(input())
print(len(s)) |
"""
Functions to anglicize integers in the range 1..19
This is a simple example for now. We will see a more complex
version of this later.
Author: Walker M. White
Date: March 30, 2019
"""
def anglicize(n):
"""
Returns: English equiv of n.
Parameter: the integer to anglicize
Precondition: n in 1.... | """
Functions to anglicize integers in the range 1..19
This is a simple example for now. We will see a more complex
version of this later.
Author: Walker M. White
Date: March 30, 2019
"""
def anglicize(n):
"""
Returns: English equiv of n.
Parameter: the integer to anglicize
Precondition: n in 1..... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def distanceK(self, root, target, K):
"""
:type root: TreeNode
:type target: TreeNode
:type K: int
... | class Solution:
def distance_k(self, root, target, K):
"""
:type root: TreeNode
:type target: TreeNode
:type K: int
:rtype: List[int]
""" |
# -*- coding:utf-8 -*-
# @Time:2020/6/15 11:38
# @Author:TimVan
# @File:leetcode.py
# @Software:PyCharm
# Definition for singly-linked list.
# for j in range(10, 5, -1):
# print(j)
print('a'.find(' '))
| print('a'.find(' ')) |
arguments = ["self", "info", "args"]
helpstring = "lurk"
minlevel = 3
def main(connection, info, args) :
"""Deops and voices the sender"""
connection.rawsend("MODE %s -o+v %s %s\n" % (info["channel"], info["sender"], info["sender"]))
| arguments = ['self', 'info', 'args']
helpstring = 'lurk'
minlevel = 3
def main(connection, info, args):
"""Deops and voices the sender"""
connection.rawsend('MODE %s -o+v %s %s\n' % (info['channel'], info['sender'], info['sender'])) |
def main():
a = ["a", 1, "5", 2.3, 1.2j]
some_condition = True
for x in a:
# If it's all isinstance, we can use a type switch
if isinstance(x, (str, float)):
print("String or float!")
elif isinstance(x, int):
print("Integer!")
else:
print("... | def main():
a = ['a', 1, '5', 2.3, 1.2j]
some_condition = True
for x in a:
if isinstance(x, (str, float)):
print('String or float!')
elif isinstance(x, int):
print('Integer!')
else:
print('Dunno!')
print(':)')
if isinstance(x, s... |
"""
Created By: Alex J. Gatz
Date: 06/07/2018
This is some code playing with the usage of a python
"Generator" which is really very cool. Another use case
I want to play with is properly ordering installation of
packages to ensure that if there are dependencies that they are installed in the proper order.
Created a... | """
Created By: Alex J. Gatz
Date: 06/07/2018
This is some code playing with the usage of a python
"Generator" which is really very cool. Another use case
I want to play with is properly ordering installation of
packages to ensure that if there are dependencies that they are installed in the proper order.
Created a... |
___assertIs(isinstance(True, bool), True)
___assertIs(isinstance(False, bool), True)
___assertIs(isinstance(True, int), True)
___assertIs(isinstance(False, int), True)
___assertIs(isinstance(1, bool), False)
___assertIs(isinstance(0, bool), False)
| ___assert_is(isinstance(True, bool), True)
___assert_is(isinstance(False, bool), True)
___assert_is(isinstance(True, int), True)
___assert_is(isinstance(False, int), True)
___assert_is(isinstance(1, bool), False)
___assert_is(isinstance(0, bool), False) |
# -*- coding: utf-8 -*-
"""Top-level package for stocks."""
__author__ = """Jianye Xu"""
__email__ = 'jianye.xu.stats@gmail.com'
__version__ = '0.1.0'
| """Top-level package for stocks."""
__author__ = 'Jianye Xu'
__email__ = 'jianye.xu.stats@gmail.com'
__version__ = '0.1.0' |
"""
Replace With Alphabet Position
Welcome.
In this kata you are required to, given a string, replace every letter with its position in the alphabet.
If anything in the text isn't a letter, ignore it and don't return it.
"a" = 1, "b" = 2, etc.
Example
alphabet_position("The sunset sets at twelve o' clock.")
Should... | """
Replace With Alphabet Position
Welcome.
In this kata you are required to, given a string, replace every letter with its position in the alphabet.
If anything in the text isn't a letter, ignore it and don't return it.
"a" = 1, "b" = 2, etc.
Example
alphabet_position("The sunset sets at twelve o' clock.")
Should... |
# Copyright (c) 2013 Huan Do, http://huan.do
class Declaration(object):
def __init__(self, name):
self.name = name
self.delete = False
self._conditional = None
@property
def conditional(self):
assert self._conditional is not None
return self.delete or self._conditio... | class Declaration(object):
def __init__(self, name):
self.name = name
self.delete = False
self._conditional = None
@property
def conditional(self):
assert self._conditional is not None
return self.delete or self._conditional
def generator():
_ = '_'
while T... |
"""
3.Question 3
In this programming problem you'll code up Prim's minimum spanning tree algorithm.
This file (edges.txt) describes an undirected graph with integer edge costs. It has the format
[number_of_nodes] [number_of_edges]
[one_node_of_edge_1] [other_node_of_edge_1] [edge_1_cost]
[one_node_of_edge... | """
3.Question 3
In this programming problem you'll code up Prim's minimum spanning tree algorithm.
This file (edges.txt) describes an undirected graph with integer edge costs. It has the format
[number_of_nodes] [number_of_edges]
[one_node_of_edge_1] [other_node_of_edge_1] [edge_1_cost]
[one_node_of_edge_2] [other... |
description = 'Verify the user can add an action to the teardown'
pages = ['common',
'index',
'tests',
'test_builder']
def setup(data):
common.access_golem(data.env.url, data.env.admin)
index.create_access_project('test')
common.navigate_menu('Tests')
tests.create_access_ra... | description = 'Verify the user can add an action to the teardown'
pages = ['common', 'index', 'tests', 'test_builder']
def setup(data):
common.access_golem(data.env.url, data.env.admin)
index.create_access_project('test')
common.navigate_menu('Tests')
tests.create_access_random_test()
def test(data):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.