content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
__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') |
# -*- coding: utf-8 -*-
"""
plastiqpublicapi
This file was automatically generated by APIMATIC v3.0 (
https://www.apimatic.io ).
"""
class ClientSecretsResponse(object):
"""Implementation of the 'Client Secrets Response' model.
TODO: type model description here.
Attributes:
... | """
plastiqpublicapi
This file was automatically generated by APIMATIC v3.0 (
https://www.apimatic.io ).
"""
class Clientsecretsresponse(object):
"""Implementation of the 'Client Secrets Response' model.
TODO: type model description here.
Attributes:
client_secret (string): Client Secret return... |
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) |
class MojUser:
"""
Authenticated user, similar to the Django one.
The built-in Django `AbstractBaseUser` sadly depends on a few tables and
cannot be used without a datbase so we had to create a custom one.
"""
def __init__(self, pk, token, user_data):
self.pk = pk
self.is_activ... | class Mojuser:
"""
Authenticated user, similar to the Django one.
The built-in Django `AbstractBaseUser` sadly depends on a few tables and
cannot be used without a datbase so we had to create a custom one.
"""
def __init__(self, pk, token, user_data):
self.pk = pk
self.is_activ... |
"""Create a Character Generator for Fallout 4."""
# print("You awake from 200 years in deep freeze. The wasteland awaits you.")
# name = input("What's your name? ")
# gender = input("What's your gender? ")
# points = 21
# attributes = ("Strength", "Perception", "Endurance", "Charisma", "Intelligence", "Agility", "Luck... | """Create a Character Generator for Fallout 4."""
def create_character():
"""Set up the character creation method."""
attribute = input('\nwhich attribute? S. P. E. C. I. A. L.?').upper()
if attribute in my_character.keys():
amount = int(input('By how much?'))
if amount > my_character['poin... |
# -*- coding: utf-8 -*-
"""
foo
"""
bah = 1
| """
foo
"""
bah = 1 |
"""
Projections
To add a custom projection, create a method accepting (x, y, z) Cartesian coordinates and add an entry to the
parse_projection method
"""
def parse_projection(name: str):
if name == "standard":
return standard_proj
raise ValueError("Unknown projection")
def standard_proj(x, y, z):
... | """
Projections
To add a custom projection, create a method accepting (x, y, z) Cartesian coordinates and add an entry to the
parse_projection method
"""
def parse_projection(name: str):
if name == 'standard':
return standard_proj
raise value_error('Unknown projection')
def standard_proj(x, y, z):
... |
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-... |
"""
The Stock module is responsible for Stock management.
It includes models for:
- StockLocation
- StockItem
- StockItemTracking
"""
| """
The Stock module is responsible for Stock management.
It includes models for:
- StockLocation
- StockItem
- StockItemTracking
""" |
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... |
class EmptyStackException(Exception):
pass
class Node:
def __init__(self, value=None):
self.value = value
self.next = None
class Stack:
def __init__(self, node=None):
self.top = node
def push(self, value):
if not self.top:
self.top = Node(value)
else:
node = Node(value)
... | class Emptystackexception(Exception):
pass
class Node:
def __init__(self, value=None):
self.value = value
self.next = None
class Stack:
def __init__(self, node=None):
self.top = node
def push(self, value):
if not self.top:
self.top = node(value)
e... |
# 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') |
with open("input", 'r') as f:
lines = f.readlines()
# lines = [x.strip("\n") for x in lines]
lines.append("\n")
total = 0
answers = set()
for line in lines:
if line == "\n":
total += len(answers)
answers = set()
else:
for letter in line.strip("\n"):
answers.add(letter)
print("Total: {}".format(total))
| with open('input', 'r') as f:
lines = f.readlines()
lines.append('\n')
total = 0
answers = set()
for line in lines:
if line == '\n':
total += len(answers)
answers = set()
else:
for letter in line.strip('\n'):
answers.add(letter)
print('Total: {}'.format(total)) |
#pass is just a placeholder which does nothing
def func():
pass
for i in [1,2,3,4,5]:
pass | def func():
pass
for i in [1, 2, 3, 4, 5]:
pass |
del_items(0x800A0E8C)
SetType(0x800A0E8C, "void VID_OpenModule__Fv()")
del_items(0x800A0F4C)
SetType(0x800A0F4C, "void InitScreens__Fv()")
del_items(0x800A103C)
SetType(0x800A103C, "void MEM_SetupMem__Fv()")
del_items(0x800A1068)
SetType(0x800A1068, "void SetupWorkRam__Fv()")
del_items(0x800A10F8)
SetType(0x800A10F8, "... | del_items(2148142732)
set_type(2148142732, 'void VID_OpenModule__Fv()')
del_items(2148142924)
set_type(2148142924, 'void InitScreens__Fv()')
del_items(2148143164)
set_type(2148143164, 'void MEM_SetupMem__Fv()')
del_items(2148143208)
set_type(2148143208, 'void SetupWorkRam__Fv()')
del_items(2148143352)
set_type(21481433... |
def mergeSort(a, temp, leftStart, rightEnd):
if(leftStart >= rightEnd):
return
middle = int((leftStart + rightEnd) / 2)
mergeSort(a, temp, leftStart, middle)
mergeSort(a, temp, middle + 1, rightEnd)
merge(a, temp, leftStart, middle, rightEnd)
return
def merge(a, temp, leftStart, middle... | def merge_sort(a, temp, leftStart, rightEnd):
if leftStart >= rightEnd:
return
middle = int((leftStart + rightEnd) / 2)
merge_sort(a, temp, leftStart, middle)
merge_sort(a, temp, middle + 1, rightEnd)
merge(a, temp, leftStart, middle, rightEnd)
return
def merge(a, temp, leftStart, middl... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
"""Amazon Textract + LayoutLM model training and inference code package for SageMaker
Why the extra level of nesting? Because the src folder (even if __init__ is present) is not loaded
as a Python module during traini... | """Amazon Textract + LayoutLM model training and inference code package for SageMaker
Why the extra level of nesting? Because the src folder (even if __init__ is present) is not loaded
as a Python module during training, but rather as the working directory. This requires a different
import syntax for top-level files/f... |
def ans(n):
global fib
for i in range(1,99):
if fib[i]==n: return n
if fib[i+1]>n: return ans(n-fib[i])
fib=[1]*100
for i in range(2,100):
fib[i]=fib[i-1]+fib[i-2]
n=int(input())
print(ans(n)) | def ans(n):
global fib
for i in range(1, 99):
if fib[i] == n:
return n
if fib[i + 1] > n:
return ans(n - fib[i])
fib = [1] * 100
for i in range(2, 100):
fib[i] = fib[i - 1] + fib[i - 2]
n = int(input())
print(ans(n)) |
#
# This file contains the Python code from Program 7.23 of
# "Data Structures and Algorithms
# with Object-Oriented Design Patterns in Python"
# by Bruno R. Preiss.
#
# Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved.
#
# http://www.brpreiss.com/books/opus7/programs/pgm07_23.txt
#
class SortedList(O... | class Sortedlist(OrderedList):
def __init__(self):
super(SortedList, self).__init__() |
'''Program to read a number and check whether it is duck number or not.
Hint: A duck number is a number which has zeros present in it, but no zero present in the begining of the number.
Input Format
a number from the user
Constraints
n>=0
Output Format
Yes or No
Sample Input 0
123
Sample Output 0
No
Sample Inp... | """Program to read a number and check whether it is duck number or not.
Hint: A duck number is a number which has zeros present in it, but no zero present in the begining of the number.
Input Format
a number from the user
Constraints
n>=0
Output Format
Yes or No
Sample Input 0
123
Sample Output 0
No
Sample Inp... |
consumer_key = "TSKf1HtYKBsnYU9qfpvbRJkxo"
consumer_secret = "Y5lH7u6MDu5DjV5hUxEkwUpPwugYvEuqfpqyvP7y5ulen9XUML"
access_token = '115029611-4TampaXbxHmUHcpK5Cll8h7rioP80SJMNneZiYCN'
access_secret = 'wx4iaVvgvY5ZknCn6bOiKFiTzAU62R5PXC8b29RC6alwU'
| consumer_key = 'TSKf1HtYKBsnYU9qfpvbRJkxo'
consumer_secret = 'Y5lH7u6MDu5DjV5hUxEkwUpPwugYvEuqfpqyvP7y5ulen9XUML'
access_token = '115029611-4TampaXbxHmUHcpK5Cll8h7rioP80SJMNneZiYCN'
access_secret = 'wx4iaVvgvY5ZknCn6bOiKFiTzAU62R5PXC8b29RC6alwU' |
# Breadth First Search and Depth First Search
class BinarySearchTree:
def __init__(self):
self.root = None
# Insert a new node
def insert(self, value):
new_node = {
'value': value,
'left': None,
'right': None
}
if not self.root:
... | class Binarysearchtree:
def __init__(self):
self.root = None
def insert(self, value):
new_node = {'value': value, 'left': None, 'right': None}
if not self.root:
self.root = new_node
else:
current_node = self.root
while True:
i... |
#!/usr/bin/env python3
#encoding=utf-8
#-------------------------------------------------
# Usage: python3 factory.py
# Description: factory function
#-------------------------------------------------
def factory(aClass, *pargs, **kargs): # Varargs tuple, dict
return aClass(*pargs, **kargs) # Call aClass ... | def factory(aClass, *pargs, **kargs):
return a_class(*pargs, **kargs)
class Spam:
def doit(self, message):
print(message)
class Person:
def __init__(self, name, job=None):
self.name = name
self.job = job
if __name__ == '__main__':
object1 = factory(Spam)
object2 = factory... |
"""
Entradas:
Cantidad de naranjas ---> int ---> X
precio por docena--->float--->Y
valor venta--->float--->K
Salidas:
numero de docenas--->float--->docena
costo--->float--->precio
ganancia--->float--->ganancia
porcentaje ganancia--->float--->porcentaje
"""
X = int ( input ( "Numero de naranjas: " ))
Y = float ( input (... | """
Entradas:
Cantidad de naranjas ---> int ---> X
precio por docena--->float--->Y
valor venta--->float--->K
Salidas:
numero de docenas--->float--->docena
costo--->float--->precio
ganancia--->float--->ganancia
porcentaje ganancia--->float--->porcentaje
"""
x = int(input('Numero de naranjas: '))
y = float(input('Valor p... |
with open('input', 'r') as file:
aim = 0
horizontal = 0
depth = 0
simple_depth=0
for line in file:
[com, n] = line.split(' ')
n = int(n)
if com == 'forward':
horizontal += n
depth += aim * n
elif com == 'down':
aim += n
... | with open('input', 'r') as file:
aim = 0
horizontal = 0
depth = 0
simple_depth = 0
for line in file:
[com, n] = line.split(' ')
n = int(n)
if com == 'forward':
horizontal += n
depth += aim * n
elif com == 'down':
aim += n
... |
class Solution:
# 1st solution
# O(n) time | O(n) space
def reverseWords(self, s: str) -> str:
lst = []
start = 0
for i in range(len(s)):
if s[i] == " ":
self.reverse(lst, start, i - 1)
start = i + 1
lst.append(s[i])
sel... | class Solution:
def reverse_words(self, s: str) -> str:
lst = []
start = 0
for i in range(len(s)):
if s[i] == ' ':
self.reverse(lst, start, i - 1)
start = i + 1
lst.append(s[i])
self.reverse(lst, start, len(s) - 1)
retu... |
class Solution:
def containsDuplicate(self, nums: [int]) -> bool:
return len(nums) != len(set(nums))
s = Solution()
print(s.containsDuplicate([1,2,3,1])) | class Solution:
def contains_duplicate(self, nums: [int]) -> bool:
return len(nums) != len(set(nums))
s = solution()
print(s.containsDuplicate([1, 2, 3, 1])) |
# Problem:
# Write a program that introduces hours and minutes of 24 hours a day and calculates how much time it will take
# after 15 minutes. The result is printed in hh: mm format.
# Hours are always between 0 and 23 minutes are always between 0 and 59.
# Hours are written in one or two digits. Minutes are always wri... | hours = int(input())
minutes = int(input())
minutes += 15
if minutes >= 60:
minutes %= 60
hours += 1
if hours >= 24:
hours -= 24
if minutes <= 9:
print(f'{hours}:0{minutes}')
else:
print(f'{hours}:{minutes}')
elif minutes <= 9:
print(f'{hours}:0{mi... |
class Solution:
"""
@param n: an integer
@return: the number of '1's in the first N number in the magical string S
"""
def magicalString(self, n):
# write your code here
if n == 0:
return 0
seed = list('122')
count = 1
i = 2
while len(seed... | class Solution:
"""
@param n: an integer
@return: the number of '1's in the first N number in the magical string S
"""
def magical_string(self, n):
if n == 0:
return 0
seed = list('122')
count = 1
i = 2
while len(seed) < n:
num = int(... |
class Link:
def __init__(self, val, next=None):
self.val = val
self.next = next
def __repr__(self):
if not self.next:
return f"Link({self.val})"
return f"Link({self.val}, {self.next})"
def merge_k_linked_lists(linked_lists):
'''
Merge k sorted linked lists ... | class Link:
def __init__(self, val, next=None):
self.val = val
self.next = next
def __repr__(self):
if not self.next:
return f'Link({self.val})'
return f'Link({self.val}, {self.next})'
def merge_k_linked_lists(linked_lists):
"""
Merge k sorted linked lists ... |
"""
Variable Scope.
Variables have a global or local "scope".
For example, variables declared within either the
setup() or draw() functions may be only used in these
functions. Global variables, variables declared outside
of setup() and draw(), may be used anywhere within the program.
If a local variable is declared... | """
Variable Scope.
Variables have a global or local "scope".
For example, variables declared within either the
setup() or draw() functions may be only used in these
functions. Global variables, variables declared outside
of setup() and draw(), may be used anywhere within the program.
If a local variable is declared... |
__all__ = [
"ffn",
"rbfn",
"ffn_bn",
"ffn_ace",
"ffn_lae",
"ffn_bn_vat",
"ffn_vat",
"cnn",
"vae1",
"cvae",
"draw_at_lstm1",
"draw_at_lstm2",
"draw_lstm1",
"draw_sgru1",
"lm_lstm",
"lm_lstm_bn",
"lm_gru",
"lm_draw"
]
| __all__ = ['ffn', 'rbfn', 'ffn_bn', 'ffn_ace', 'ffn_lae', 'ffn_bn_vat', 'ffn_vat', 'cnn', 'vae1', 'cvae', 'draw_at_lstm1', 'draw_at_lstm2', 'draw_lstm1', 'draw_sgru1', 'lm_lstm', 'lm_lstm_bn', 'lm_gru', 'lm_draw'] |
'''
num1=1
num2=1
num3=num1+num2
print(num3)
sum=num1+num2+num3
for i in range(1,18,1):
num1=num2
num2=num3
num3=num1+num2
if num3%2==0:
print(num3)
'''
'''
for i in range(1,101):
if 100%i==0:
print(i)
'''
num1=int(input("Please input a number: "))
for i in range(1,num1+1):
if... | """
num1=1
num2=1
num3=num1+num2
print(num3)
sum=num1+num2+num3
for i in range(1,18,1):
num1=num2
num2=num3
num3=num1+num2
if num3%2==0:
print(num3)
"""
'\nfor i in range(1,101):\n if 100%i==0:\n print(i)\n'
num1 = int(input('Please input a number: '))
for i in range(1, num1 + 1):
... |
l = {}
for _ in range(int(input())):
s = input().split()
l[s[0]] = sum([float(a) for a in s[1:]])/(len(s)-1)
print('%.2f' % l[input()]) | l = {}
for _ in range(int(input())):
s = input().split()
l[s[0]] = sum([float(a) for a in s[1:]]) / (len(s) - 1)
print('%.2f' % l[input()]) |
"""
The module identify pull-up method refactoring opportunities in Java projects
"""
# Todo: Implementing a decent pull-up method identification algorithm.
| """
The module identify pull-up method refactoring opportunities in Java projects
""" |
BOT_NAME = 'p5_downloader_middleware_handson'
SPIDER_MODULES = ['p5_downloader_middleware_handson.spiders']
NEWSPIDER_MODULE = 'p5_downloader_middleware_handson.spiders'
ROBOTSTXT_OBEY = True
DOWNLOADER_MIDDLEWARES = {
'p5_downloader_middleware_handson.middlewares.SeleniumDownloaderMiddleware': 543,
}
SELENIUM_E... | bot_name = 'p5_downloader_middleware_handson'
spider_modules = ['p5_downloader_middleware_handson.spiders']
newspider_module = 'p5_downloader_middleware_handson.spiders'
robotstxt_obey = True
downloader_middlewares = {'p5_downloader_middleware_handson.middlewares.SeleniumDownloaderMiddleware': 543}
selenium_enabled = T... |
#!/usr/bin/env python3
# Nick Stucchi
# 03/23/2017
# Filter out words and replace with dashes
def replaceWord(sentence, word):
wordList = sentence.split()
newSentence = []
for w in wordList:
if w == word:
newSentence.append("-" * len(word))
else:
newSentence.append(... | def replace_word(sentence, word):
word_list = sentence.split()
new_sentence = []
for w in wordList:
if w == word:
newSentence.append('-' * len(word))
else:
newSentence.append(w)
return ' '.join(newSentence)
def main():
sentence = input('Enter a sentence: ')
... |
"""THIS FILE IS AUTO-GENERATED BY SETUP.PY."""
name = "popmon"
version = "0.3.12"
full_version = "0.3.12"
release = True
| """THIS FILE IS AUTO-GENERATED BY SETUP.PY."""
name = 'popmon'
version = '0.3.12'
full_version = '0.3.12'
release = True |
"""Settings for testing emencia.django.newsletter"""
SITE_ID = 1
USE_I18N = False
ROOT_URLCONF = 'emencia.django.newsletter.urls'
DATABASES = {'default': {'NAME': 'newsletter_tests.db',
'ENGINE': 'django.db.backends.sqlite3'}}
INSTALLED_APPS = ['django.contrib.contenttypes',
... | """Settings for testing emencia.django.newsletter"""
site_id = 1
use_i18_n = False
root_urlconf = 'emencia.django.newsletter.urls'
databases = {'default': {'NAME': 'newsletter_tests.db', 'ENGINE': 'django.db.backends.sqlite3'}}
installed_apps = ['django.contrib.contenttypes', 'django.contrib.sites', 'django.contrib.aut... |
#
# @lc app=leetcode id=647 lang=python3
#
# [647] Palindromic Substrings
#
# @lc code=start
class Solution:
def countSubstrings(self, s: str) -> int:
"""Find number of palindromic strings in s
Args:
s (str): String to analyze
Returns:
int: Count of palindromes
... | class Solution:
def count_substrings(self, s: str) -> int:
"""Find number of palindromic strings in s
Args:
s (str): String to analyze
Returns:
int: Count of palindromes
"""
palindromes = 0
for i in range(len(s)):
(left, right) =... |
"""
LC 6001
Return the rearranged number with minimal value.
Note that the sign of the number does not change after rearranging the digits.
Example 1:
Input: num = 310
Output: 103
Explanation: The possible arrangements for the digits of 310 are 013, 031, 103, 130, 301, 310.
The arrangement with the ... | """
LC 6001
Return the rearranged number with minimal value.
Note that the sign of the number does not change after rearranging the digits.
Example 1:
Input: num = 310
Output: 103
Explanation: The possible arrangements for the digits of 310 are 013, 031, 103, 130, 301, 310.
The arrangement with the smallest valu... |
EF_UUID_NAME = "__specialEF__float32_UUID"
EF_ORDERBY_NAME = "__specialEF__int32_dayDiff"
EF_PREDICTION_NAME = "__specialEF__float32_predictions"
EF_DUMMY_GROUP_COLUMN_NAME = "__specialEF__dummy_group"
HMF_MEMMAP_MAP_NAME = "__specialHMF__memmapMap"
HMF_GROUPBY_NAME = "__specialHMF__groupByNumericEncoder"
| ef_uuid_name = '__specialEF__float32_UUID'
ef_orderby_name = '__specialEF__int32_dayDiff'
ef_prediction_name = '__specialEF__float32_predictions'
ef_dummy_group_column_name = '__specialEF__dummy_group'
hmf_memmap_map_name = '__specialHMF__memmapMap'
hmf_groupby_name = '__specialHMF__groupByNumericEncoder' |
SERVICES = [
'UserService',
'ProjectService',
'NotifyService',
'AlocateService',
'ApiGateway',
'Frontend'
]
METRICS = [
'files',
'functions',
'complexity',
'coverage',
'ncloc',
'comment_lines_density',
'duplicated_lines_density',
'security_rating',
'tests',
... | services = ['UserService', 'ProjectService', 'NotifyService', 'AlocateService', 'ApiGateway', 'Frontend']
metrics = ['files', 'functions', 'complexity', 'coverage', 'ncloc', 'comment_lines_density', 'duplicated_lines_density', 'security_rating', 'tests', 'test_success_density', 'test_execution_time', 'reliability_ratin... |
# sAsync:
# An enhancement to the SQLAlchemy package that provides persistent
# item-value stores, arrays, and dictionaries, and an access broker for
# conveniently managing database access, table setup, and
# transactions. Everything can be run in an asynchronous fashion using
# the Twisted framework and its deferred ... | """
Errors relating to database access
"""
class Asyncerror(Exception):
"""
The requested action is incompatible with asynchronous operations.
"""
class Transactionerror(Exception):
"""
An exception was raised while trying to run a transaction.
"""
class Databaseerror(Exception):
"""
... |
class Vocab:
# pylint: disable=invalid-name,too-many-instance-attributes
ROOT = '<ROOT>'
SPECIAL_TOKENS = ('<PAD>', '<ROOT>', '<UNK>')
def __init__(self, min_count=None):
self._counts = {}
self._pretrained = set([])
self.min_count = min_count
self.size = 3
def idx(... | class Vocab:
root = '<ROOT>'
special_tokens = ('<PAD>', '<ROOT>', '<UNK>')
def __init__(self, min_count=None):
self._counts = {}
self._pretrained = set([])
self.min_count = min_count
self.size = 3
def idx(self, token):
if token not in self._vocab:
re... |
#
# PySNMP MIB module Wellfleet-FNTS-ATM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-FNTS-ATM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:33:28 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_union, constraints_intersection, single_value_constraint) ... |
class Middleware:
def __init__(self, context_manager, server_middleware):
"""
:param BaseMiddleware Your custom middleware
:param package Middleware from the middleware package
"""
self._service = context_manager
self._middleware = server_middleware.get_hooks_service_... | class Middleware:
def __init__(self, context_manager, server_middleware):
"""
:param BaseMiddleware Your custom middleware
:param package Middleware from the middleware package
"""
self._service = context_manager
self._middleware = server_middleware.get_hooks_service... |
routers = dict(
# base router
BASE=dict(
default_application='projeto',
applications=['projeto', 'admin',]
),
projeto=dict(
default_controller='initial',
default_function='principal',
controllers=['initial', 'manager'],
functions=['home', 'contact', 'about', 'user', '... | routers = dict(BASE=dict(default_application='projeto', applications=['projeto', 'admin']), projeto=dict(default_controller='initial', default_function='principal', controllers=['initial', 'manager'], functions=['home', 'contact', 'about', 'user', 'download', 'account', 'register', 'login', 'exemplo', 'teste1', 'teste2... |
class Coffee:
coffeecupcounter =0
def __init__(self, themilk, thesugar, thecoffeemate):
self.milk = themilk
self.sugar = thesugar
self.coffeemate = thecoffeemate
Coffee.coffeecupcounter=Coffee.coffeecupcounter+1
print(f'You now have your coffee with {self.milk} milk, {s... | class Coffee:
coffeecupcounter = 0
def __init__(self, themilk, thesugar, thecoffeemate):
self.milk = themilk
self.sugar = thesugar
self.coffeemate = thecoffeemate
Coffee.coffeecupcounter = Coffee.coffeecupcounter + 1
print(f'You now have your coffee with {self.milk} milk... |
class Solution:
def threeSumMulti(self, arr, target):
c = Counter(arr)
ans, M = 0, 10**9 + 7
for i, j in permutations(c, 2):
if i < j < target - i - j:
ans += c[i]*c[j]*c[target - i - j]
for i in c:
if 3*i != target:
ans += c[i... | class Solution:
def three_sum_multi(self, arr, target):
c = counter(arr)
(ans, m) = (0, 10 ** 9 + 7)
for (i, j) in permutations(c, 2):
if i < j < target - i - j:
ans += c[i] * c[j] * c[target - i - j]
for i in c:
if 3 * i != target:
... |
"""
Program Description :
List appender is a simple program that allows you to append data, either a single word or a sequence of words,
to a list. To stop adding elements, type !quit. It helps create lists easily when the number of elements
is a lot.
"""
def List_appender():
print("Start entering data to be appen... | """
Program Description :
List appender is a simple program that allows you to append data, either a single word or a sequence of words,
to a list. To stop adding elements, type !quit. It helps create lists easily when the number of elements
is a lot.
"""
def list_appender():
print('Start entering data to be appe... |
'''
Created on Jun 4, 2018
@author: nishant.sethi
'''
class Node:
def __init__(self, data):
self.left = None
self.right = None
self.data = data
def insert(self, data):
# Compare the new value with the parent node
if self.data:
if data < self.... | """
Created on Jun 4, 2018
@author: nishant.sethi
"""
class Node:
def __init__(self, data):
self.left = None
self.right = None
self.data = data
def insert(self, data):
if self.data:
if data < self.data:
if self.left is None:
sel... |
name = input("Enter file:")
if len(name) < 1:
name = "mbox-short.txt"
handle = open(name)
hist=dict()
for line in handle:
if line.startswith('From:'):
words=line.split()
if words[1] not in hist:
hist[words[1]]=1
else:
hist[words[1]]=hist[words[1]]+1
#print(hist)
n... | name = input('Enter file:')
if len(name) < 1:
name = 'mbox-short.txt'
handle = open(name)
hist = dict()
for line in handle:
if line.startswith('From:'):
words = line.split()
if words[1] not in hist:
hist[words[1]] = 1
else:
hist[words[1]] = hist[words[1]] + 1
nome... |
maior = 0
menor = 0
totalPessoas = 10
for pessoa in range(1, 11):
idade = int(input("Digite a idade: "))
if idade >= 18:
maior += 1
else:
menor += 1
print("Quantidade de pessoas maior de idade: ", maior)
print("Quantidade de pessoas menor de idade: ", menor)
print("Porcentagem de pessoas menores de idad... | maior = 0
menor = 0
total_pessoas = 10
for pessoa in range(1, 11):
idade = int(input('Digite a idade: '))
if idade >= 18:
maior += 1
else:
menor += 1
print('Quantidade de pessoas maior de idade: ', maior)
print('Quantidade de pessoas menor de idade: ', menor)
print('Porcentagem de pessoas me... |
"""Dataset representation of fMRI data."""
class DatasetFMRI(object):
"""docstring for DatasetFMRI."""
def __init__(self):
"""Init."""
pass
| """Dataset representation of fMRI data."""
class Datasetfmri(object):
"""docstring for DatasetFMRI."""
def __init__(self):
"""Init."""
pass |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | class Platformioexception(Exception):
message = None
def __str__(self):
if self.MESSAGE:
return self.MESSAGE.format(*self.args)
return super().__str__()
class Returnerrorcode(PlatformioException):
message = '{0}'
class Minitermexception(PlatformioException):
pass
class Us... |
#
# PySNMP MIB module A3COM-HUAWEI-IFQOS2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-HUAWEI-IFQOS2-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 16:50:28 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (h3c_common,) = mibBuilder.importSymbols('A3COM-HUAWEI-OID-MIB', 'h3cCommon')
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_c... |
"""
Given head which is a reference node to a singly-linked list. The value of each node in the
linked list is either 0 or 1. The linked list holds the binary representation of a number.
Return the decimal value of the number in the linked list.
Example 1:
https://assets.leetcode.com/uploads/2019/12/05/graph-1.png
... | """
Given head which is a reference node to a singly-linked list. The value of each node in the
linked list is either 0 or 1. The linked list holds the binary representation of a number.
Return the decimal value of the number in the linked list.
Example 1:
https://assets.leetcode.com/uploads/2019/12/05/graph-1.png
... |
lines = [line.strip() for line in open("input.txt", 'r') if line.strip() != ""]
startingNumbers = [int(i) for i in lines[0].split(",")]
##########################################
# PART 1 #
##########################################
def part1(startingNumbers, target):
i = 0
la... | lines = [line.strip() for line in open('input.txt', 'r') if line.strip() != '']
starting_numbers = [int(i) for i in lines[0].split(',')]
def part1(startingNumbers, target):
i = 0
last_number = -1
history = {}
for n in startingNumbers:
if n not in history:
history[n] = []
his... |
def load(h):
return ({'abbr': 'Reserved', 'code': 0, 'title': 'RESERVED Reserved Reserved'},
{'abbr': 'pres', 'code': 1, 'title': 'PRES Pressure Pa'},
{'abbr': 'msl', 'code': 2, 'title': 'MSL Mean sea level pressure Pa'},
{'abbr': 'ptend', 'code': 3, 'title': 'PTEND Pressure tend... | def load(h):
return ({'abbr': 'Reserved', 'code': 0, 'title': 'RESERVED Reserved Reserved'}, {'abbr': 'pres', 'code': 1, 'title': 'PRES Pressure Pa'}, {'abbr': 'msl', 'code': 2, 'title': 'MSL Mean sea level pressure Pa'}, {'abbr': 'ptend', 'code': 3, 'title': 'PTEND Pressure tendency Pa s**-1'}, {'abbr': 'pv', 'cod... |
def printom(str):
return f"ye hath mujhe {str}"
def add(n1, n2):
return n1 + n2 + 5
print("and the name is", __name__)
if __name__ == '__main__':
print(printom("de de thakur"))
o = add(4, 6)
print(o)
| def printom(str):
return f'ye hath mujhe {str}'
def add(n1, n2):
return n1 + n2 + 5
print('and the name is', __name__)
if __name__ == '__main__':
print(printom('de de thakur'))
o = add(4, 6)
print(o) |
# Class to test the GrapherWindow Class
class GrapherTester:
def __init__(self):
subject = Grapher()
testFileName = 'TestData.csv'
testStockName = 'Test Stock'
testGenerateGraphWithAllPositiveNumbers(testFileName, testStockName)
def createTestData(xAxis, yAxis):
# Genera... | class Graphertester:
def __init__(self):
subject = grapher()
test_file_name = 'TestData.csv'
test_stock_name = 'Test Stock'
test_generate_graph_with_all_positive_numbers(testFileName, testStockName)
def create_test_data(xAxis, yAxis):
plot_data = {'X-Axis': xAxis, 'Y-Ax... |
#!/usr/bin/env python
# encoding: utf-8
"""
populate_next_right_pointers.py
Created by Shengwei on 2014-07-27.
"""
# https://oj.leetcode.com/problems/populating-next-right-pointers-in-each-node/
# tags: medium, tree, pointer, recursion
"""Given a binary tree
struct TreeLinkNode {
TreeLinkNode *left;
... | """
populate_next_right_pointers.py
Created by Shengwei on 2014-07-27.
"""
'Given a binary tree\n\n struct TreeLinkNode {\n TreeLinkNode *left;\n TreeLinkNode *right;\n TreeLinkNode *next;\n }\nPopulate each next pointer to point to its next right node. If there is no next right node, the next poi... |
class Policy:
def select_edge(self, board_state, score=None, opp_score=None):
raise NotImplementedError
| class Policy:
def select_edge(self, board_state, score=None, opp_score=None):
raise NotImplementedError |
"""
This module implements the helm toolchain rule.
"""
HelmInfo = provider(
doc = "Information on Helm command line tool",
fields = {
"tool": "Target pointing to Helm executable",
"cmd": "File pointing to Helm executable"
}
)
def _helm_toolchain_impl(ctx):
toolchain_info = platform_co... | """
This module implements the helm toolchain rule.
"""
helm_info = provider(doc='Information on Helm command line tool', fields={'tool': 'Target pointing to Helm executable', 'cmd': 'File pointing to Helm executable'})
def _helm_toolchain_impl(ctx):
toolchain_info = platform_common.ToolchainInfo(helminfo=helm_inf... |
class ChocolateBoiler:
unique_instance = None
def __new__(cls, *args, **kwargs):
if not cls.unique_instance:
cls.unique_instance = super().__new__(cls, *args, **kwargs)
return cls.unique_instance
def __init__(self):
self.empty = True
self.boiled = False
def... | class Chocolateboiler:
unique_instance = None
def __new__(cls, *args, **kwargs):
if not cls.unique_instance:
cls.unique_instance = super().__new__(cls, *args, **kwargs)
return cls.unique_instance
def __init__(self):
self.empty = True
self.boiled = False
def... |
class Solution:
def numRescueBoats(self, people, limit):
"""
:type people: List[int]
:type limit: int
:rtype: int
"""
people.sort()
l, r, cnt = 0, len(people) - 1, 0
saved = 0
while saved < len(people):
if people[r] + people[l] <= l... | class Solution:
def num_rescue_boats(self, people, limit):
"""
:type people: List[int]
:type limit: int
:rtype: int
"""
people.sort()
(l, r, cnt) = (0, len(people) - 1, 0)
saved = 0
while saved < len(people):
if people[r] + people[... |
inpu = """4
aba
baba
aba
xzxb
3
aba
xzxb
ab
"""
inp = """100
lekgdisnsbfdzpqlkg
eagemhdygyv
jwvwwnrhuai
urcadmrwlqe
mpgqsvxrijpombyv
mpgqsvxrijpombyv
urcadmrwlqe
mpgqsvxrijpombyv
eagemhdygyv
eagemhdygyv
jwvwwnrhuai
urcadmrwlqe
jwvwwnrhuai
kvugevicpsdf
kvugevicpsdf
mpgqsvxrijpombyv
urcadmrwlqe
mpgqsvxrijpombyv
exdafbno... | inpu = '4\naba\nbaba\naba\nxzxb\n3\naba\nxzxb\nab\n'
inp = '100\nlekgdisnsbfdzpqlkg\neagemhdygyv\njwvwwnrhuai\nurcadmrwlqe\nmpgqsvxrijpombyv\nmpgqsvxrijpombyv\nurcadmrwlqe\nmpgqsvxrijpombyv\neagemhdygyv\neagemhdygyv\njwvwwnrhuai\nurcadmrwlqe\njwvwwnrhuai\nkvugevicpsdf\nkvugevicpsdf\nmpgqsvxrijpombyv\nurcadmrwlqe\nmpgqs... |
class StartUploadEvent(object):
"""Event dispatched when an upload starts"""
def __init__(self, filepath, upload_file_rank, files_to_upload):
"""
Constructor
:param str filepath: file which starts to be uploaded
:param int upload_file_rank: rank of the file in upload queue
... | class Startuploadevent(object):
"""Event dispatched when an upload starts"""
def __init__(self, filepath, upload_file_rank, files_to_upload):
"""
Constructor
:param str filepath: file which starts to be uploaded
:param int upload_file_rank: rank of the file in upload queue
... |
class Solution:
def minAvailableDuration(self, slots1: List[List[int]], slots2: List[List[int]], duration: int) -> List[int]:
timeslots = list(filter(lambda x: x[1] - x[0] >= duration, slots1 + slots2))
heapq.heapify(timeslots)
while len(timeslots) > 1:
start1, end1 = heapq.heapp... | class Solution:
def min_available_duration(self, slots1: List[List[int]], slots2: List[List[int]], duration: int) -> List[int]:
timeslots = list(filter(lambda x: x[1] - x[0] >= duration, slots1 + slots2))
heapq.heapify(timeslots)
while len(timeslots) > 1:
(start1, end1) = heapq.... |
someParameters = input("Please Enter some parameters: ")
def createList(*someParameters):
paramList = []
for add in someParameters:
paramList.append(add)
print(paramList)
return paramList
createList(someParameters)
| some_parameters = input('Please Enter some parameters: ')
def create_list(*someParameters):
param_list = []
for add in someParameters:
paramList.append(add)
print(paramList)
return paramList
create_list(someParameters) |
"""
Write a program that first takes the year, month (as integer), and day of the user's birth date from console.
Then, calculate and print on which day of the year the user has been born.
You can assume user will enter a valid value for all inputs.
Example:
Enter your birth year: 1998
Enter your birth month as integer... | """
Write a program that first takes the year, month (as integer), and day of the user's birth date from console.
Then, calculate and print on which day of the year the user has been born.
You can assume user will enter a valid value for all inputs.
Example:
Enter your birth year: 1998
Enter your birth month as integer... |
def first_repeating(n,arr):
#initialize with the minimum index possible
Min = -1
#create a empty dictionary
newSet = dict()
# tranversing the array elments from end
for x in range(n - 1, -1, -1):
#check if the element is already present in the dictionary
#then up... | def first_repeating(n, arr):
min = -1
new_set = dict()
for x in range(n - 1, -1, -1):
if arr[x] in newSet.keys():
min = x
else:
newSet[arr[x]] = 1
if Min != -1:
print('The first repeating element is', arr[Min])
else:
print('There are no repeati... |
SECRET_KEY = 'testing'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.staticfiles',
'django.contrib.sessions',
'c... | secret_key = 'testing'
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}}
installed_apps = ['django.contrib.contenttypes', 'django.contrib.auth', 'django.contrib.admin', 'django.contrib.staticfiles', 'django.contrib.sessions', 'cruditor']
root_urlconf = 'django.contrib.staticfiles.url... |
class Drawable():
def draw(self, screen):
pass
def blit(self, screen):
pass | class Drawable:
def draw(self, screen):
pass
def blit(self, screen):
pass |
# Arke
# User-configurable settings.
# Dirty little seeekrits...
SECRET_KEY='much_sekrit_such_secure_wow'
# Database
# See http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html#database-urls
# With DEBUG defined, this is ignored and a SQLite DB in the root folder is used instead.
# SQLite is probably not the best f... | secret_key = 'much_sekrit_such_secure_wow'
db_url = 'sqlite:///arke.db'
debug = True |
class TrieNode:
def __init__(self, c=None, end=False):
self.c = c
self.children = {}
self.end = end
class Trie:
def __init__(self):
"""
Initialize your data structure here.
"""
self.root = TrieNode('')
def insert(self, word: str) -> None:
... | class Trienode:
def __init__(self, c=None, end=False):
self.c = c
self.children = {}
self.end = end
class Trie:
def __init__(self):
"""
Initialize your data structure here.
"""
self.root = trie_node('')
def insert(self, word: str) -> None:
... |
def n_choose_m_iterator(N, M, startpoint=None):
if startpoint is None:
subscripts = list(range(M))
else:
subscripts = copy.deepcopy(startpoint)
while True:
yield subscripts
off = M - 1
while off > -1:
rev_off = M - off
if subscripts[off] < N ... | def n_choose_m_iterator(N, M, startpoint=None):
if startpoint is None:
subscripts = list(range(M))
else:
subscripts = copy.deepcopy(startpoint)
while True:
yield subscripts
off = M - 1
while off > -1:
rev_off = M - off
if subscripts[off] < N - ... |
#Author wangheng
class Solution:
def isNStraightHand(self, hand, W):
c = collections.Counter(hand)
for i in sorted(c):
if c[i] > 0:
for j in range(W)[::-1]:
c[i + j] -= c[i]
if c[i + j] < 0:
return False
... | class Solution:
def is_n_straight_hand(self, hand, W):
c = collections.Counter(hand)
for i in sorted(c):
if c[i] > 0:
for j in range(W)[::-1]:
c[i + j] -= c[i]
if c[i + j] < 0:
return False
return Tr... |
class EnumMeta(type):
base = False
def __new__(cls, name, bases, kw):
klass = type.__new__(cls, name, bases, kw)
if not EnumMeta.base:
EnumMeta.base = True
return klass
return klass()
class Enum(metaclass=EnumMeta):
def __getitem__(self, key):
if isinstance(key, int):
for k in dir(self):
if len... | class Enummeta(type):
base = False
def __new__(cls, name, bases, kw):
klass = type.__new__(cls, name, bases, kw)
if not EnumMeta.base:
EnumMeta.base = True
return klass
return klass()
class Enum(metaclass=EnumMeta):
def __getitem__(self, key):
if is... |
#
#.. create syth_test.geo file form this file
#
# python3 mkSyntheticGeoData2D.py test
#
#.. create 3D mesh syth_testmesh.msh
#
# gmsh -3 -format msh2 -o syth_testmesh.msh syth_test.geo
#
#.. run for synthetic data
#
# python3 mkSyntheticData2D.py -s synth -g -m test
#
# creating test_grav.nc and test_mag.... | project = 'test'
km = 1000.0
gravfile = project + '_grav1Noise.nc'
magfile = project + '_mag1Noise.nc'
data_ref_x = 0.0
data_ref_y = 0.0
data_height_above_ground = 0 * km
l_data_y = 40 * km
l_data_x = 70 * km
data_num_x = 141
data_num_y = 81
data_mesh_size_vertical = 0.5 * km
core_thickness = 60 * km
air_layer_thicknes... |
class Item:
def __init__(self, id, quantity, price):
self.__product_id = id
self.__quantity = quantity
self.__price = price
def update_quantity(self, quantity):
None
class ShoppingCart:
def __init__(self):
self.__items = []
def add_item(self, item):
None
def remove_item(self, item... | class Item:
def __init__(self, id, quantity, price):
self.__product_id = id
self.__quantity = quantity
self.__price = price
def update_quantity(self, quantity):
None
class Shoppingcart:
def __init__(self):
self.__items = []
def add_item(self, item):
N... |
class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
if not nums:
return -1
lo = 0
hi = len(nums)-1
old_size = len(nums)
# if not rotated
if nums[lo] <= nums[hi]:
return self.binary_search(nums,lo,hi+1,target)
else:
# ext... | class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
if not nums:
return -1
lo = 0
hi = len(nums) - 1
old_size = len(nums)
if nums[lo] <= nums[hi]:
return self.binary_searc... |
a = [1,2,3]
print(a)
a.append(5)
print(a)
list1=[1,2,3,4,5]
list2=['rambutan','langsa','salak','durian','apel']
list1.extend(list2)
c = [1,2,3]
print(c)
c.insert(0,12)
print(c)
### Perbedaan antara fungsi Append,extend,dan insert
# append berfungsi untuk menambahkan elemen ke daftar
# extend berfungsi untuk memp... | a = [1, 2, 3]
print(a)
a.append(5)
print(a)
list1 = [1, 2, 3, 4, 5]
list2 = ['rambutan', 'langsa', 'salak', 'durian', 'apel']
list1.extend(list2)
c = [1, 2, 3]
print(c)
c.insert(0, 12)
print(c)
def reverse(string):
reverse_string = ''
for i in string:
reverse_string = i + reversed_string
print('rev... |
# 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 averageOfLevels(self, root: TreeNode) -> List[float]:
queue, levelsData, result = deque([(root, ... | class Solution:
def average_of_levels(self, root: TreeNode) -> List[float]:
(queue, levels_data, result) = (deque([(root, 0)]), defaultdict(lambda : (0, 0)), [])
while queue:
(node, level) = queue.popleft()
if node:
(current_sum, current_count) = levelsData[l... |
af = list(b"\x13\x13\x11\x17\x12\x1d\x48\x45\x45\x41\x0b\x26\x2c\x42\x5f\x09\x0b\x5f\x6c\x3d\x56\x56\x1b\x54\x5f\x41\x45\x29\x3c\x0b\x5c\x58\x00\x5f\x5d\x09\x54\x6c\x2a\x40\x06\x06\x6a\x27\x48\x42\x5f\x4b\x56\x42\x2d\x2c\x43\x5d\x5e\x6c\x2d\x41\x07\x47\x43\x5e\x31\x6b\x5a\x0a\x3b\x6e\x1c\x49\x54\x5e\x1a\x2b\x34\x05\x5e... | af = list(b"\x13\x13\x11\x17\x12\x1dHEEA\x0b&,B_\t\x0b_l=VV\x1bT_AE)<\x0b\\X\x00_]\tTl*@\x06\x06j'HB_KVB-,C]^l-A\x07GC^1kZ\n;n\x1cIT^\x1a+4\x05^G((\x1f\x11&;\x07P\x04\x06\x04\r\x0b\x05\x03Hw\n")
flag = 'r'
char = 'r'
for stuff in af:
flag += chr(ord(char) ^ stuff)
char = flag[-1]
print(flag) |
I = input("Enter the string: ")
S = I.upper()
freq = {}
for i in I:
if i != " ":
if i in freq:
freq[i] += 1
else:
freq[i] = 1
print(freq)
| i = input('Enter the string: ')
s = I.upper()
freq = {}
for i in I:
if i != ' ':
if i in freq:
freq[i] += 1
else:
freq[i] = 1
print(freq) |
class Solution(object):
def threeSum(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
nums.sort()
res = []
for i,a in enumerate(nums):
# If same as the previous value just continue, already checked
if i>0 and a == nu... | class Solution(object):
def three_sum(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
nums.sort()
res = []
for (i, a) in enumerate(nums):
if i > 0 and a == nums[i - 1]:
continue
(l, r) = (i + 1, len(n... |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 24 22:12:02 2021
@author: Abeg
"""
#all symmetric pair of an array
def symmetricpair(pairs):
s=set()
for (x,y) in pairs:
s.add((x,y))
if (y,x) in s:
print((x,y),"|",((y,x)))
pairs=[(11,20),(30,40),(5,10),(40,30),(10,5)]
print(symmetricpai... | """
Created on Wed Mar 24 22:12:02 2021
@author: Abeg
"""
def symmetricpair(pairs):
s = set()
for (x, y) in pairs:
s.add((x, y))
if (y, x) in s:
print((x, y), '|', (y, x))
pairs = [(11, 20), (30, 40), (5, 10), (40, 30), (10, 5)]
print(symmetricpair(pairs), end='')
n = int(input('en... |
# exc. 7.2.4
def seven_boom(end_number):
my_list = []
for i in range(0, end_number + 1):
s = str(i)
if '7' in s or i % 7 == 0:
my_list += ['BOOM']
else:
my_list += [i]
print(my_list)
def main():
end_number = 17
seven_bo... | def seven_boom(end_number):
my_list = []
for i in range(0, end_number + 1):
s = str(i)
if '7' in s or i % 7 == 0:
my_list += ['BOOM']
else:
my_list += [i]
print(my_list)
def main():
end_number = 17
seven_boom(end_number)
if __name__ == '__main__':
... |
"""Format a number with grouped thousands.
Number will be formatted with a comma separator between every group of thousands.
Source: cup
"""
# Implementation author: cup
# Created on 2018-09-17T20:09:08.888749Z
# Last modified on 2018-09-17T20:09:08.888749Z
# Version 1
print("f'{1000:,}'")
| """Format a number with grouped thousands.
Number will be formatted with a comma separator between every group of thousands.
Source: cup
"""
print("f'{1000:,}'") |
def main():
# input
N, K = map(int, input().split())
# compute
def twoN(a: int):
if a%200 == 0:
a = int(a/200)
else:
a = int(str(a) + "200")
return a
for i in range(K):
N = twoN(N)
# output
print(N)
if __name__ == '__main_... | def main():
(n, k) = map(int, input().split())
def two_n(a: int):
if a % 200 == 0:
a = int(a / 200)
else:
a = int(str(a) + '200')
return a
for i in range(K):
n = two_n(N)
print(N)
if __name__ == '__main__':
main() |
def increment_by_one(x):
return x + 1
def test_increment_by_one():
assert increment_by_one(3) == 4
| def increment_by_one(x):
return x + 1
def test_increment_by_one():
assert increment_by_one(3) == 4 |
class CTDConfig(object):
def __init__(self, createStationPlot,
createTSPlot,
createContourPlot,
createTimeseriesPlot,
binDataWriteToNetCDF,
describeStation,
createHistoricalTimeseries,
showSta... | class Ctdconfig(object):
def __init__(self, createStationPlot, createTSPlot, createContourPlot, createTimeseriesPlot, binDataWriteToNetCDF, describeStation, createHistoricalTimeseries, showStats, plotStationMap, tempName, saltName, oxName, ftuName, oxsatName, refdate, selected_depths, write_to_excel, survey=None, ... |
class Solution:
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
i, j = 0, 0
for i, n in enumerate(nums):
a = target - n
# print('i = ',i,'n = ',n)
# print('a = ',a)
... | class Solution:
def two_sum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
(i, j) = (0, 0)
for (i, n) in enumerate(nums):
a = target - n
for (j, m) in enumerate(nums[i + 1:], start=i + 1):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.