content stringlengths 7 1.05M |
|---|
"""
PyCrypto has an own secure random function "Crypto.Random.random"
but it does not use a seed value as expected by rule 6
"""
|
"""
This module contains shared functions for testing
As it does not begin with "test", it will not be detected by the
auto-discovery of Pytest.
"""
def assert_pyspark_df_equal(actual_df, expected_df):
"""
Tests if two DataFrames are equal. Adapted from code originally
written by Dave Greasley (ht... |
"""
Put here common independent stuff,
such as utilities, management commands, etc.,
what can not belong to any app.
DO NOT let this package to be dump of ugly code.
Putting code here, you rather make an exception,
than an ordinary core organization.
""" |
class input_format():
def __init__(self,format_tag):
self.tag = format_tag
def print_sample_input(self):
if self.tag =='FCC_BCC_Edge_Ternary':
print('''
Sample JSON for using pseudo-ternary predictions of solid solution strength by Curtin edge dislocation model.
--... |
# After closing time, the store manager would like to know how much business was
# transacted during the day. Modify the CashRegister class to enable this functionality.
# Supply methods getSalesTotal and getSalesCount to get the total amount of all sales
# and the number of sales. Supply a method resetSales that reset... |
class opcode(object):
nul = 1
hello = 2
rhello = 130
get = 160
rget = 161
|
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 4 21:10:59 2018
@author: User
"""
def username():
first = 'arvind' #input('firstname')
last = 'KARIR' # input('lastname')
(yob) = str(1234) #int( input('yob') )
yob = yob[:3]
last = last[-4:]
print(first[:1].lower()+last.upper()+... |
questions = open('youtube_chat.txt', 'r').readlines()
with open('question_dataset.txt', 'w+') as file:
for s in set(questions):
print(s.rstrip()[1:-1], file=file)
|
A = 'avalue'
B = {
'key' : 'value'
}
C = ['array'] |
CARGO = "Cargo"
COMPOSER = "Composer"
GO = "Go"
MAVEN = "Maven"
NPM = "npm"
NUGET = "NuGet"
PYPI = PIP = "pip"
RUBYGEMS = "RubyGems"
ecosystems = [CARGO, COMPOSER, GO, MAVEN, NPM, NUGET, PYPI, RUBYGEMS]
|
# CPU: 0.08 s
n_villagers = int(input())
villagers = {key: set() for key in range(1, n_villagers + 1)}
song_counter = 0
for _ in range(int(input())):
_, *participants = map(int, input().split())
if 1 in participants:
song_counter += 1
for participant in participants:
villagers[participant].add(song_counter)
e... |
# Given an n x n array, return the array elements arranged from outermost elements to the middle element, traveling clockwise.
def snail(array):
snail_array = []
while len(array) > 0:
snail_array.extend(array.pop(0))
length_array = len(array)
for i in range(length_array):
... |
class NodeRegistry:
def __init__(self):
self.nodes = set()
def register(self, *nodes: List[Type[Node]]):
self.nodes.update(nodes)
def pipeline_factory(self, pipeline_spec):
"""Construct a pipeline according to the spec.
"""
...
@staticmethod
def _port_to_tu... |
db_config = {
'user': '##username##',
'passwd': '##password##',
'host': '##host##',
'db': 'employees',
} |
class Solution(object):
def reachNumber(self, target):
"""
:type target: int
:rtype: int
"""
target = abs(target)
n = int((target * 2) ** 0.5)
steps = n * (n+1) // 2
while steps < target or (steps - target) % 2:
n += 1
steps += ... |
a="J`e^\x1cf_l]_WiUa\x12UQ]\x0esdj^hp\x1a\\mZ_\x15hT`XQ]\x0eumrrg\x1bg^fZ[\\U[\x12aU]gea_o]i\x1a<gm_Y!$+\x11iPOh-\x1e?pr\x1am``i\x15]f\x12j_d` ej^c\x1b4\x19;K<GoV&c#Ng0tp\\o.f_W+dYS'^h$ha_bs`-Zn-f^*cq!\x12=_eS sml\x1cn_^\x18`j\x15Vhf\x11]PYe\x1fwlqm\x1afaeZ\x15[_ah\x10d^"
b=""
for i in range(len(a)):
print(a[i])
... |
""" Defines the dataset configuration class for csv, libsvm, arff data formats
Dataset configuration object contains information for reading and preprocessing the dataset file """
class CsvConfig:
""" Dataset configuration class for CSV data format """
dataset_filetype = 'csv'
def __init__(self, sep=',',... |
real = float(input("Quanto tinheito você tem? R$ "))
us = real / 3.78
ca = real / 2.85
eu = real / 4.31
lb = real / 4.98
au = real / 2.71
ps = real / 0.0983
print("R$ {:.2f} reais equivale a: \n\nUS$ {:.2f} dólares americanos \nCAD$ {:.2f} dólares canadenses \n€$ {:.2f} euros \n£$ {:.2f} libras \nAUD$ {:.2f} dólares au... |
factor = int(input())
count = int(input())
list = []
counter = factor
for _ in range(count):
list.append(counter)
counter += factor
print(list) |
# 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 isSameTree(self, p: _TreeNode, q: _TreeNode) -> bool:
# If both are none, the nodes are the same.
... |
"""Top-level package for DRF Compose."""
__author__ = """Sotunde Abiodun"""
__email__ = "sotundeabiodun00@gmail.com"
__version__ = "0.1.1"
|
# Based on https://github.com/zricethezav/gitleaks/blob/6f5ad9dc0b385c872f652324188ce91da7157c7c/test_data/test_repos/test_dir_1/server.test2.py
# Do not hard code credentials
client = boto3.client(
's3',
# Hard coded strings as credentials, not recommended.
aws_access_key_id='AKIAIO5FODNN7EXAMPLE',
aws... |
"""
Bisect Squares.
Given two squares on a two-dimensional plane, find
a line that would cut these two squares in half. Assume
that the top and the bottom sides of the square run
parallel to the x-axis.
"""
class BisectSquares():
class Square():
class Line():
def __init_... |
def find_range_values(curr_range):
return list(map(int, curr_range.split(",")))
def find_set(curr_range):
start_value, end_value = find_range_values(curr_range)
curr_set = set(range(start_value, end_value + 1))
return curr_set
def find_longest_intersection(n):
longest_intersection = set()
... |
# Complete solution
# https://leetcode.com/problems/remove-sub-folders-from-the-filesystem/discuss/409028/JavaPython-3-3-methods-from-O(n-*-(logn-%2B-m-2))-to-O(n-*-m)-w-brief-explanation-and-analysis.
# use startswith
class Solution:
def removeSubfolders(self, folder: List[str]) -> List[str]:
"""
So... |
#!/usr/bin/python
# -*-coding:utf-8 -*
nb_coup = 8
name_score_file = "scores"
word = [
"banane",
"pomme",
"poire",
"tomate",
"ananas",
"prune",
"fraise",
"rhubarbe",
"cerise",
"kiwi",
"abricot",
"amande",
"figue",
"framboise",
"melon",
"brugnon",
"c... |
CKAN_ROOT = "https://data.wprdc.org/"
API_PATH = "api/3/action/"
SQL_SEARCH_ENDPOINT = "datastore_search_sql"
API_URL = CKAN_ROOT + API_PATH + SQL_SEARCH_ENDPOINT
|
"""Role testing files using testinfra"""
def test_daemon_config(host):
"""Check docker daemon config"""
f = host.file("/etc/docker/daemon.json")
assert f.is_file
assert f.user == "root"
assert f.group == "root"
config = (
"{\n"
" \"live-restore\": true,\n"
" \"log-dr... |
# variables 3
a = "abc"
print("a:", a, type(a))
a = 3
print("a:", a, type(a))
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright 2020, Yutong Xie, UIUC.
Using Greedy Algorithm to solve balloon burst problem.
'''
class Solution(object):
def findMinArrowShots(self, points):
"""
:type points: List[List[int]]
:rtype: int
"""
if not point... |
# String
nombre = "Uriel"
apellido = 'Rdguez'
## Contatenar (unir dos texto)
nombre + ' ' + apellido
## Se puede multiplar un estring con un número entero
nombre * 4 # 'Uriel Uriel Uriel Uriel'
# Float
numero_decimal = 3.4
#Boolean
es_estudiante = True # True
es_estudiante = True # False |
num = int(input("Digite um número para seu fatorial ser calculado: "))
m = num
fat = 1
print('Calculando {}! = '.format(num), end='')
while m > 0:
print(' {} '.format(m), end='')
print(' x ' if m > 1 else ' = ', end='')
fat *= m
m -= 1
print('{}'.format(fat)) |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@license:
'''
SPELL=u'tiānfǔ'
CN=u'天府'
NAME=u'tianfu13'
CHANNEL='lung'
CHANNEL_FULLNAME='LungChannelofHand-Taiyin'
SEQ='LU3'
if __name__ == '__main__':
pass
|
def put_languages(self, root):
if hasattr(self, "languages") and self.languages:
lang_string = ",".join(["/".join(x) for x in self.languages])
root.attrib["languages"] = lang_string
def put_address(self, root):
if self.address:
if isinstance(self.address, str):
root.attrib... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""RackTablesDB - a python library to access the racktables database.
"""
__author__ = "John van Zantvoort"
__email__ = "john.van.zantvoort@snow.nl"
__license__ = "The MIT License (MIT)"
__version__ = "1.0.1"
|
# n = nums.length
# time = 0(n)
# space = O(1)
class Solution:
def maxSubArray(self, nums: List[int]) -> int:
ret = max(nums)
sub_sum = 0
for num in nums:
sub_sum = max(0, sub_sum) + num
ret = max(ret, sub_sum)
return ret
|
# -*- coding: utf-8 -*-
# @Time: 2020/7/16 16:28
# @Author: GraceKoo
# @File: interview_14.py
# @Desc: https://www.nowcoder.com/practice/529d3ae5a407492994ad2a246518148a?tpId=13&rp=1&ru=%2Fta%2Fcoding-interviews&qr
# u=%2Fta%2Fcoding-interviews%2Fquestion-ranking
class Solution:
def FindKthToTail(self, head, k):
... |
class Heroes3(object):
def __init__(self):
super(Heroes3, self).__init__()
self._army_size = {
"Few" : (1, 4),
"Several" : (5, 9),
"Pack" : (10, 19),
"Lots" : (20, 49),
"Horde" : (50, 100),
"Throng" : (100, 249),
"Sw... |
"""
572
subtree of another tree
easy
Given the roots of two binary trees root and subRoot, return true if
there is a subtree of root with the same structure and node values of
subRoot and false otherwise.
A subtree of a binary tree tree is a tree that consists of a node in
tree and all of this node's descendants. The... |
count = int(input())
for i in range(count):
k = int(input())
n = int(input())
people = [j for j in range(1,n+1)]
for x in range (k):
for v in range(n-1):
people[v+1] += people[v]
print(people[-1])
|
class Solution:
def canPlaceFlowers(self, flowerbed, n):
"""
:type flowerbed: List[int]
:type n: int
:rtype: bool
"""
num=n
if len(flowerbed)<=1:
if (num==1 and flowerbed==[0]) or (num==0):
return True
else:
... |
class Solution:
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums) <= 2:
return len(nums)
i, j = 2, 2
while i < len(nums):
if not (nums[j-1] == nums[j-2] == nums[i]):
nums[j] = num... |
"""Project exceptions"""
class ProjectImportError (Exception):
"""Failure to import a project from a repository."""
pass
|
""" Remote repositories, used by this project itself """
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def repositories():
_all_content = """filegroup(name = "all", srcs = glob(["**"]), visibility = ["//visibility:public"])"""
http_archive(
name = "bazel_skylib",
sha256... |
"""Patch Server for Jamf Pro"""
__title__ = "Patch Server"
__version__ = "2020.10.02"
__author__ = "Bryson Tyrrell"
|
def goTo(logic, x, y):
hero.moveXY(x, y)
hero.say(logic)
hero.moveXY(26, 16);
a = hero.findNearestFriend().getSecretA()
b = hero.findNearestFriend().getSecretB()
c = hero.findNearestFriend().getSecretC()
goTo(a and b or c, 25, 26)
goTo((a or b) and c, 26, 32)
goTo((a or c) and (b or c), 35, 32)
go... |
def afl(x):
"""
If no 'l' key is included, add a list of None's the same length as key 'a'.
"""
if 'l' in x:
return x
else:
x.update({'l': ['']*len(x['a'])})
return x
class V1:
def __init__(self,version='std',**kwargs):
self.version=version
@property
def doms(self):
return {'uc': 'qD', 'currapp': 'q... |
# http://code.activestate.com/recipes/119466-dijkstras-algorithm-for-shortest-paths/
"""
G = {'s':{'u':10, 'x':5},
'u':{'v':1, 'x':2},
'v':{'y':4},
'x':{'u':3, 'v':9, 'y':2},
'y':{'s':7, 'v':6}}
"""
def graph_to_dot(G):
s = """digraph G {\nnode [width=.3,height=.3,shape=octagon,style=filled,colo... |
def print_array(array):
for i in array:
print(i, end=" ")
print("")
def bubble_sort(array):
for i in range(len(array)):
swapped = False
for j in range(0, len(array)-i-1):
if array[j] >= array[j+1]:
tmp = array[j+1]
array[j+1] = array[j]
... |
class Solution:
def findAnagrams(self, s: str, p: str) -> List[int]:
size_s = len(s)
size_p = len(p)
counter1 = collections.defaultdict(int)
counter2 = collections.defaultdict(int)
ans = []
for c in p:
counter2[c] += 1
for c in s[:size_p-1]... |
'''
We have an array A of integers, and an array queries of queries.
For the i-th query val = queries[i][0], index = queries[i][1], we add val to A[index]. Then, the answer to the i-th query is the sum of the even values of A.
(Here, the given index = queries[i][1] is a 0-based index, and each query permanently modi... |
'''
Created on Oct 3, 2015
@author: bcy-3
'''
|
app_name = "pusta2"
prefix_url = "pusta2"
static_files = {
'js': {
'pusta2/js/': ['main.js', ]
},
'css': {
'pusta2/css/': ['main.css', ]
},
'html': {
'pusta2/html/': ['index.html', ]
}
}
permissions = {
"edit": "Editing actualy nothing.",
"sample1": "sample1longve... |
"""This problem was asked by Facebook.
We have some historical clickstream data gathered from our site anonymously using cookies.
The histories contain URLs that users have visited in chronological order.
Write a function that takes two users' browsing histories as input and returns the longest
contiguous sequence ... |
#TODO: Complete os espaços em branco com uma possível solução para o problema.
X = int(input())
Y = int(input())
if (Y > X):
for i in range(X + 1, Y ):
if ( i % 5 == 2) or ( i % 5 == 3):
print(i)
elif (X > Y):
for i in range(Y + 1, X ):
if (i % 5 == 2) or ( i % 5 == 3):
... |
input = open('input.txt', 'r').read().split("\n")
preamble_length = 25
invalid = 0
for i in range(preamble_length, len(input)):
current = int(input[i])
found = False
for j in range(i - preamble_length, i):
for k in range (j + 1, i):
sum = int(input[j]) + int(input[k])
if sum == current:
found = True
i... |
x,y = map(float, input().split())
if (x == y == 0):
print("Origem")
elif (y == 0):
print("Eixo X")
elif (x == 0):
print("Eixo Y")
elif (x > 0) and (y > 0):
print("Q1")
elif (x < 0) and (y > 0):
print("Q2")
elif (x < 0) and (y < 0):
print("Q3")
elif (x > 0) and (y < 0):
print("Q4")
|
"""ROM methods."""
def read_all_rom(self) -> list:
"""
Return the values of all the locations of ROM.
Parameters
----------
self : Processor, mandatory
The instance of the processor containing the registers, accumulator etc
Returns
-------
ROM
The values of all the lo... |
class Point(object):
def __init__(self, x, y):
self._x = x
self._y = y
def get_x(self):
return self._x
def set_x(self, x):
self._x = x
def get_y(self):
return self._y
def set_y(self, y):
self._y = y
def euclidean_distance(a, b):
ax = a.get_... |
print("Height: ", end='')
while True:
height = input()
# check if int
try:
height = int(height)
except ValueError:
print("Retry: ", end='')
continue
# check if suitable value
if height >= 0 and height <= 23:
break
else:
print("Height: ", end='')
# ... |
# In Search for the Lost Memory [Explorer Pirate + Jett] (3527)
recoveredMemory = 7081
kyrin = 1090000
sm.setSpeakerID(kyrin)
sm.sendNext("A stable position, with a calm demanor-- but I can tell you're hiding your explosive attacking abilities-- "
"you've become quite an impressive pirate, #h #. It's been a while.")... |
class Powerup:
def __init__(self, coord):
self.coord = coord
def use(self, player):
raise NotImplementedError
def ascii(self):
return "P"
|
languages = {
"c": "c",
"cpp": "cpp",
"cc": "cpp",
"cs": "csharp",
"java": "java",
"py": "python",
"rb": "ruby"
}
|
# Create database engine for data.db
engine = create_engine('sqlite:///data.db')
# Write query to get date, tmax, and tmin from weather
query = """
SELECT date,
tmax,
tmin
FROM weather;
"""
# Make a data frame by passing query and engine to read_sql()
temperatures = pd.read_sql(query, engine)
# Vie... |
#Arquivo que contem os parametros do jogo
quantidade_jogadores = 2 #quantidade de Jogadores
jogadores = [] #array que contem os jogadores(na ordem de jogo)
tamanho_tabuleiro = 40 #tamanho do array do tabuleiro (sempre multiplo de 4 para o tabuleiro ficar quadrado)
quantidade_dados = 2 #quantos dados serao usados
quant... |
s = 'azcbobobegghakl'
num = 0
for i in range(0, len(s) - 2):
if s[i] + s[i + 1] + s[i + 2] == 'bob':
num += 1
print('Number of times bob occurs is: ' + str(num)) |
# --- Day 14: Docking Data ---
# As your ferry approaches the sea port, the captain asks for your help again. The computer system that runs this port isn't compatible with the docking program on the ferry, so the docking parameters aren't being correctly initialized in the docking program's memory.
# After a brief ins... |
#!/usr/bin/env python3
class DNSMasq_DHCP_Generic_Switchable:
def __init__(self, name, value):
self.name = name
self.value = value
def __str__(self):
if self.value is None:
return self.name
elif self.value is not None:
return self.name + "=" + self.valu... |
df4 = pandas.read_csv('supermarkets-commas.txt')
df4
df5 = pandas.read_csv('supermarkets-semi-colons.txt',sep=';')
df5
|
class DummyScheduler(object):
def __init__(self, optimizer):
pass
def step(self):
pass |
"""
@Time : 2018/7/15 20:19
@Author : 郭家兴
@Email : 302802003@qq.com
@File : secure.py
@Desc : 敏感项配置文件
"""
SECRET_KEY = 'X88d\S00DS9FL234SDF234\S00FS8DF$%^AS\X09DL\DFX00934'
DEBUG = False
HOST = '0.0.0.0'
PORT = '5005'
THREADED = True
LEVEL = 'DEBUG'
|
# -*- coding: utf-8 -*-
"""
Created on Wed May 8 12:07:42 2019
@author: DiPu
"""
for i in range(1,6):
print("*"*i)
for j in range(4,0,-1):
print("*"*j) |
a = [int(x) for x in input().split()]
aset = set()
for i in range(5):
for j in range(i+1, 5):
for k in range(j+1, 5):
aset.add(a[i] + a[j] + a[k])
print(sorted(aset, reverse=True)[2])
|
""" Store a person's name, and include some whitespace
characters at beginning and end of the name. Make sure you
use each character combination "\t" and "\n" at least one. """
name = ' James '
print(name.lstrip())
print(name.rstrip())
print(name.strip())
print('\tJames Noria')
print('Name:\nJames Noria') |
def drive(start, end, step, parameters):
step_results = {
"P:sir.out.S": list(),
"P:sir.out.I": list(),
"P:sir.out.R": list(),
"P:sir.in.dt": list(),
}
S = parameters["P:sir.in.S"]
I = parameters["P:sir.in.I"]
R = parameters["P:sir.in.R"]
for i in range(start, e... |
class RequestParseError(Exception):
"""Error raised when the inbound request could not be parsed."""
pass
class AttachmentTooLargeError(Exception):
"""Error raised when an attachment is too large."""
def __init__(self, email, filename, size):
super(AttachmentTooLargeError, self)
self... |
# Configuration file for interface "rpc". This interface is
# used in conjunction with RPC resource for cage-to-cage RPC calls.
#
# If location discovery at runtime is used (which is recommended),
# then all the cages that wish to share the same RPC "namespace" need
# identical broadcast ports, broadcast addresses that... |
EXAMPLE_TWEETS = [
"Trump for President!!! #MAGA",
"Trump is the best ever!",
"RT @someuser: Trump is, by far, the best POTUS in history. \n\nBonus: He^s friggin^ awesome!\n\nTrump gave Pelosi and the Dems the ultimate\u2026 ",
"If Clinton is elected, I'm moving to Canada",
"Trump is doing a great ... |
"""
1. Use for position param, variable params, keyword argument
"""
def test(a, b, *args, m=1, n=2):
print(a)
print(b)
print(args)
print(m)
print(n)
test(1, 2, 3, 4, 5)
print()
test(1, 2, 3, 4, 5, m=10, n=20)
print()
"""
1. Use **kwargs for dict on keyword arguments
"""
def foo(**kwargs):
... |
test_item = {
"stac_version": "1.0.0",
"stac_extensions": [],
"type": "Feature",
"id": "20201211_223832_CS2",
"bbox": [
172.91173669923782,
1.3438851951615003,
172.95469614953714,
1.3690476620161975
],
"geometry": {
"type": "Polygon",
"coordina... |
# output: ok
assert([x for x in ()] == [])
assert([x for x in range(0, 3)] == [0, 1, 2])
assert([(x, y) for x in range(0, 2) for y in range(2, 4)] ==
[(0, 2), (0, 3), (1, 2), (1, 3)])
assert([x for x in range(0, 3) if x >= 1] == [1, 2])
def inc(x):
return x + 1
assert([inc(y) for y in (1, 2, 3)] == [2, 3, ... |
#
# PySNMP MIB module ASCEND-MIBVDSLNET-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBVDSLNET-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:28:54 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... |
def __init__(self):
self.meetings = []
def book(self, start: int, end: int) -> bool:
for s, e in self.meetings:
if s < end and start < e:
return False
self.meetings.append([start, end])
return True |
# Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.
#
# 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 equal to m + n) to hold additional elements from nums2.
# Source - https://leetcod... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Advent of Code 2020, day five."""
INPUT_FILE = 'data/day_05.txt'
def main() -> None:
"""Identify missing ticket."""
with open(INPUT_FILE, encoding='utf-8') as input_file:
tkt = sorted([int(x.strip().replace('F', '0').replace('B', '1')
... |
"""Python3 Code to solve problem 1253: Reconstruct a 2-Row Binary Matrix. """
class Solution(object):
def reconstructMatrix(self, upper: int, lower: int, colsum: list) -> list:
zero_col = set()
two_col = set()
col_num = len(colsum)
for col_id, col_sum in enumerate(colsum):
... |
"""
You're given a substring s of some cyclic string.
What's the length of the smallest possible string that can be concatenated to itself many times to obtain this cyclic string?
Example
For s = "cabca", the output should be
cyclicString(s) = 3.
"cabca" is a substring of a cycle string "abcabcabcabc..." that can be... |
# Example of mutual recursion with even/odd.
#
# Eli Bendersky [http://eli.thegreenplace.net]
# This code is in the public domain.
def is_even(n):
if n == 0:
return True
else:
return is_odd(n - 1)
def is_odd(n):
if n == 0:
return False
else:
return is_even(n - 1)
de... |
X = {}
print(5 in X)
print(X[4])
print(X[5])
|
# -*- coding: utf-8 -*-
# Author: Tonio Teran <tonio@stateoftheart.ai>
# Copyright: Stateoftheart AI PBC 2021.
'''NEAR AI's library wrapper.
Dataset information taken from:
'''
SOURCE_METADATA = {
'name': 'nearai',
'original_name': 'NEAR Program Synthesis',
'url': 'https://github.com/nearai/program_synthe... |
#!/usr/bin/python
inp = input(">> ")
print(inp)
count = 0
while True:
print("hi")
count += 1
if count == 3:
break |
class Solution:
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
if not strs:
return ''
zip_strs = zip(*strs)
for i, letter_group in enumerate(zip_strs):
if len(set(letter_group)) > 1:
... |
#VERSION: 1.0
INFO = {"example":("test","This is an example mod")}
RLTS = {"cls":(),"funcs":("echo"),"vars":()}
def test(cmd):
echo(0,cmd)
|
queries = [
"""SELECT * WHERE { ?s ?p ?o }""",
"""SELECT ?point ?point_type WHERE {
?point rdf:type brick:Point .
?point rdf:type ?point_type
}""",
"SELECT ?meter WHERE { ?meter rdf:type brick:Green_Button_Meter }",
""" SELECT ?t WHERE { ?t rdf:type brick:Weather_Temperature_Sensor }""",
"""SELECT ?sensor WHE... |
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def getIntersectionNode(self, headA, headB):
"""
:type head1, head1: ListNode
:rtype: ListNode
"""
if headA =... |
#so sai quando escrever sair
nome = str(input("Escreva nome :(sair para terminar)"))
while nome != "sair":
nome = str(input("Escreva nome: (sair para terminar)"))
|
def heap_sort(l: list):
# flag is init
def sort(num: int, node: int, flag: bool):
# print(str(node) +' '+str(num))
if num == len(l) - 1:
return
if node < 0:
l[0], l[-(num) - 1] = l[-(num) - 1], l[0] #swap topest
num += 1
node = 0
if... |
# directories where to look for duplicates
dir_list = [
r"C:\Users\Gamer\Documents\Projekte\azzap\azzap-docker-dev\data\html\pub\media\catalog\product",
r"C:\Users\Gamer\Documents\Projekte\azzap\azzap-docker-dev\data\html\pub\media\import\multishopifystoremageconnect",
r"C:\Users\Gamer\Documents\Projekte\a... |
""" User assistance/help texts """
AGGREGATE_DATA = """
Here you can see an overview and aggregated data over all batches. Please note that only \
the data from instances that are part of experimental batches is considered here, not data from instances that \
have been started in between batches.
"""
CUSTOMER_CATEGOR... |
print("NFC West W L T")
print("-----------------------")
print("Seattle 13 3 0")
print("San Francisco 12 4 0")
print("Arizona 10 6 0")
print("St. Louis 7 9 0\n")
print("NFC North W L T")
print("-----------------------")
print("Green Bay 8 7 1")
print("Chicago ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.