content stringlengths 7 1.05M |
|---|
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 31 19:47:34 2020
@author: Administrator
"""
"""
一个数组里,除了三个数是唯一出现的,其余的数都出现偶数次,找出这三个数中的任意一个.比如数组序列为[1,2,4,5,6,4,2],
只有1,5,6这三个数字是唯一出现的,数字2与4均出现了偶数次(2次),只需要输出数字1,5,6中的任意一个就行.
"""
def FindOneDisNum(arr):
# find the distinct number in the array that only app... |
class UI_UL_list:
pass
|
class Solution:
def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]:
curr, pre = head, None
while curr:
temp = curr.next
curr.next = pre
pre = curr
curr = temp
return pre
|
expected_output = {
'vrf': {
'default': {
'address_family': {
'ipv6': {
'routes': {
'2001:0:10:204:0:30:0:2/128': {
'active': True,
'next_hop': {
... |
"""
Implement a function that removes all the even elements from a given list.
Name it remove_even(list).
Input:
- A list with random integers.
Output:
- A list with only odd integers
Sample Input:
- my_list = [1,2,4,5,10,6,3]
Sample Output:
- my_list = [1,5,3]
"""
def remove_even(list):
return [x for x in list... |
# http://www.codewars.com/kata/523b66342d0c301ae400003b/
def multiply(a, b):
return a * b
|
num = int(input("\nDigite um numero inteiro para saber se é primo: "))
cont = 0
for i in range(num):
if num % (i + 1) == 0:
cont += 1
else:
cont
if cont == 2:
print("O numero é primo")
else:
print("O numero não é primo")
|
# Author: AKHILESH SANTOSHWAR
# Input: root node, key
#
# Output: predecessor node, successor node
# 1. If root is NULL
# then return
# 2. if key is found then
# a. If its left subtree is not null
# Then predecessor will be the right most
# child of left subtree or left child itself.
# b.... |
bmi = ''
while True:
input_numbers = input()
if ( '-1' == input_numbers ) or ( -1 == input_numbers.find(' ') ):
break
input_numbers = input_numbers.split()
weight = int(input_numbers[0])
height = int(input_numbers[1])
tmp = weight / ( height / 100 ) ** 2
bmi += str(tmp) + "\n"
... |
print('=' * 15, '\033[1;35mAULA 17 - Listas[Testes]\033[m', '=' * 15)
valores = list()
for cont in range(0, 5):
valores.append(int(input('Digite um Valor: ')))
for c, v in enumerate(valores):
print(f'Na Posição {c} encontrei o Valor {v}!')
print('End!!!')
|
def partition(number):
answer = set()
answer.add((number, ))
for x in range(1, number):
for y in partition(number - x):
answer.add(tuple(sorted((x, ) + y)))
return answer
def euler78():
num = -1
i = 30
while True:
i += 1
print(str(i))
... |
n = 0
row = 5
while n < row:
n += 1
end = row * 2 - 1
right = row - n
left = row + n
l = 1
while l < row * 2:
if l > right and l < left:
print("*", end='')
# print('%')
else:
print(' ', end='')
# print('$')
l += 1
print... |
class BetweenRadiusFilterCriteria(object):
"""
Filter criteria for distance between two radius
"""
def __init__(self, radius1, radius2):
self._radius1 = radius1
self._radius2 = radius2
@property
def radius1(self):
return self._radius1
@property
def radius2(self... |
class localStorage:
def __init__(self, driver) :
self.driver = driver
def __len__(self):
return self.driver.execute_script("return window.localStorage.length;")
def items(self) :
return self.driver.execute_script( \
"var ls = window.localStorage, items = {}; ... |
__________________________________________________________________________________________________
class Solution:
def twoSumLessThanK(self, A: List[int], K: int) -> int:
maxx = -float('inf')
for i in range(len(A)):
for j in range(i+1, len(A)):
if maxx < A[i] +A[j] and A[... |
# coding: utf-8
# pynput
# Copyright (C) 2015-2018 Moses Palmér
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.... |
class Command(object):
"""
This class is used to generate SQL commands. It must be the only place where
SQL commands are defined and created. If new commands must be created, it
must be added in this class.
"""
def insert(self, table: str, values: list):
"""
This method returns ... |
#!/usr/bin/env python
'''@package docstring
Just a giant list of processes and properties
'''
processes = {
'DY1JetsToLL_M-10to50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8':('DY1JetsToLL_M-10to50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8','MC',729.726349),
'DY2JetsToLL_M-10to50_TuneCUETP8M1_13TeV-madgraphMLM-pyth... |
src = ['board.c']
component = aos_board_component('board_mk3060', 'moc108', src)
aos_global_config.add_ld_files('memory.ld.S')
supported_targets="helloworld linuxapp meshapp uDataapp networkapp linkkitapp"
build_types="release"
|
# # define 下定义
# def func1():
# print("hello function")
#
#
#
# func1()
#
# a = 10
# b = 10
#
# print(a + b)
#
# c = 20
# d = 20
# print(c + d)
# def sum(num1,num2):
# print(num1+num2)
#
# sum(1,2)
# sum(10,10)
def fun2():
return "hello fun2"
def sum2(a,b):
return (a+b)
b=sum2(1,1)
print(b) |
# coding=utf-8
__all__ = ["slack_username", ]
def slack_username(user_id: str) -> str:
""" Generate a slack username macro """
return "<@{}>".format(user_id)
|
#!/usr/bin/env python3
no_c = __import__('5-no_c').no_c
print(no_c("a software development program"))
print(no_c("Chicago"))
print(no_c("C is fun!"))
|
{
7 : {
"operator" : "join",
"multimatch" : False,
},
9 : {
"operator" : "selection",
"selectivity" : 0.5
},
10 : {
"operator" : "join",
"multimatch" : False,
"selectivity" : 0.04
},
12 : {
"operator" : "selection",
... |
class Solution:
# @param num, a list of integer
# @return an integer
def findPeakElement(self, num):
left = 0
right = len(num) - 1
while left <= right:
mid = (left + right) / 2
if not mid:
leftValue = num[mid] - 1
else:... |
class Solution(object):
def fullJustify(self, words, maxWidth):
"""
:type words: List[str]
:type maxWidth: int
:rtype: List[str]
"""
lines = []
i = 0
while i < len(words):
llen = 0
cur = i
while i < len(words):
... |
# C:\gop\ch11\House.py
class House(object): # House 클래스 정의
def __init__(self, year, acreages, address, price):
self.year = year
self.acreages = acreages
self.address = address
self.price = price
def change_price(self, rate):
self.price = self.price * rate
def show... |
#==========================================================================
# this choice mechanism is obviously stupid, but it's here to remind us
# that this is intended as a source of platform-specific data, and so we
# should be making changes to a specific platform's section, rather than
# just adding code all wi... |
ten_things = "Apples Oranges Crows Telephone Light Sugar"
print("Wait there are not 10 things in that list. Let's fix that.")
stuff = ten_things.split(' ')
more_stuff = ["Day", "Night", "Song", "Frisbee",
"Corn", "Banana", "Girl", "Boy"]
while len(stuff) != 10:
next_one = more_stuff.pop()
pr... |
def playerIcons(poi):
if poi['id'] == 'Player':
poi['icon'] = "https://overviewer.org/avatar/%s" % poi['EntityId']
return "Last known location for %s" % poi['EntityId']
def signFilter(poi):
if poi['id'] == 'Sign' or poi['id'] == 'minecraft:sign':
if poi['Text4'] == '-- RENDER --':
... |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def mergeTrees(self, t1, t2):
"""
:type t1: TreeNode
:type t2: TreeNode
:rtype: TreeNode
... |
"""Get data from csv file"""
data = open('Real_Final_database_02.csv') #Open file database that use
alldata = data.readlines()
listdata = []
for i in alldata:
listdata.append(i.strip().split(',')) #Add data form database file into list
|
# initial data input
infilename = "./day9.txt"
def readfile() -> list:
with open(infilename, "rt", encoding="utf-8") as file:
inlist = [line.strip() for line in file]
return inlist
def parse_input(inlist=readfile()) -> list:
return list(map(int, inlist))
# --- Part One ---
"""
Upon connection... |
"""
---> Merge Sorted Array
---> Medium
"""
class Solution:
def merge(self, nums1, m: int, nums2, n: int) -> None:
p1 = m - 1
p2 = n - 1
p = n + m - 1
while p2 >= 0:
if p1 >= 0 and nums1[p1] > nums2[p2]:
nums1[p] = nums1[p1]
p1 -= 1
... |
# 列表
def list_study():
arr = list()
arr2 = []
print(arr)
arr2.append("1")
arr2.append(2)
# 删除元素
del arr2[1]
print(arr2)
# 在列表末尾一次性追加另一个序列中的多个值(用新列表扩展原来的列表)
arr2.extend([2, 3])
print(arr2)
# 元组与列表类似,不同之处在于元组的元素不能修改。元组使用小括号,列表使用方括号。
def tuple_study():
t = tuple()
t2 =... |
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 28 23:39:31 2021
@author: qizhe
"""
# 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 buildTree(self, preorder, ino... |
def str_to_int(s):
ctr = i = 0
for c in reversed(s):
i += (ord(c) - 48) * (10 ** ctr)
ctr += 1
return i
print()
for s in ('0', '1', '2', '3', '12', '123', '234', '456', '567'):
i = str_to_int(s)
print("s = {}, i = {} |".format(s, i), end=' ')
print()
print()
for i in range(50):
... |
def __logging(visited, rest=[]):
if rest:
print("visited:%s\n rest:%s\n" % (visited, rest))
else:
print("visited:%s" % (visited))
is_found = False
def dfs_rec(graph, start, end, visited=[]):
global is_found
if is_found:
return visited
if start == end:
is_found =... |
def remover_repeticao(lista):
for i in lista:
k = 1
while k <= (lista.count(i)-1):
lista.remove(i)
k = k + 1
lista.sort()
return lista
def nova_lista():
n = int(input("digite um número inteiro: "))
lista = []
while n != 0:
lista.app... |
# animals = ["Gully", "Rhubarb", "Zephyr", "Henry"]
# for animal in enumerate(animals): # creates a list of Tuples
# print(animal) # (0, 'Gully')
# # (1, 'Rhubarb')
# # (2, 'Zephyr')
# # (3, 'Henry')
# animals = ["Gully", "Rhubarb", "Zephyr", "Henry"... |
def lines(file):
for line in file:
yield line
yield "\n"
def blocks(file):
block = []
for line in lines(file):
if line.strip():
block.append(line)
elif block:
yield "".join(block).strip()
block = []
|
"""
Traduce texto de entrada en valores operables o texto
txt_hex = "C8"
txt_dec = "200"
txt_bin = "11001000"
mat_bin = [0,0,0,1,0,0,1,1]
"""
def hex_a_bin(txt_hex):
num_bin = bin(int(txt_hex,16))
txt_bin = num_bin.split("b")[1]
txt_bin = txt_bin.zfill(8)
txt_bin = txt_bin.upper()
return txt_bin
... |
# coding: utf-8
cry_names = [
'Nidoran_M',
'Nidoran_F',
'Slowpoke',
'Kangaskhan',
'Charmander',
'Grimer',
'Voltorb',
'Muk',
'Oddish',
'Raichu',
'Nidoqueen',
'Diglett',
'Seel',
'Drowzee',
'Pidgey',
'Bulbasaur',
'Spearow',
'Rhydon',
'Golem',
'Blastoise',
'Pidgeotto',
'Weedle',
'Caterpie',
'Ekans'... |
a = []
b = []
for m in range(101):
a.append(300 - m * 100)
for n in range(101):
b.append(a[n] + 200)
c = 0
for a in b:
if a < 0:
c += 1
print(c) |
def translate_table(line, suite_pos):
fields = line.split("|")
suite_name = fields[suite_pos]
fields = suite_name.split("_")
other = []
if fields[0] == "ade":
template = "thereis"
if fields[1] == "same":
strategy = "ADE-SI"
if fields[-1] == "tisce":
... |
firstStep = "1-1"
print(firstStep)
row = 1
column = 1
column += 1
while True:
answer = int(input())
if column > 10:
row += 1
column = 1
response = str(row) + "-" + str(column)
column += 1
print(response)
|
class ListNode:
def __init__(self, val):
self.next = None
self.val = val
class LinkList:
def __init__(self, node=None):
self._head = node
# 头部插入
def add(self, val):
node = ListNode(val)
if not self._head:
self._head = node
return
... |
class node:
def __init__(self, data):
self.data = data
self.next = None
class linkedList:
def __init__(self):
self.head = None
def printList(self):
temp = self.head
while (temp):
print(temp.data, end=' ')
temp = temp.next
if _... |
class Solution:
def minMoves2(self, nums: List[int]) -> int:
temp = []
nums.sort()
medile_p = len(nums) // 2
medile_num = nums[medile_p]
nums.remove(medile_num)
for i in nums:
if medile_num >= i:
step = medile_num - i
temp.a... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 12 14:52:40 2017
@author: Nadiar
"""
def f(a,b):
return a + b
def union(l1,l2):
temp = []
if len(l1) > len(l2):
for l in l2:
if l in l1:
temp.append(l)
else:
for l in l1:
if l ... |
"""
Sponge Knowledge Base
Used for testing a gRPC API server and clients.
"""
def onBeforeLoad():
sponge.addEventType("notification", RecordType().withFields([
StringType("source").withLabel("Source"),
IntegerType("severity").withLabel("Severity").withNullable(),
sponge.getType("Person", "p... |
class Sms:
def __init__(self, number: str, message: str) -> None:
self.to_phone = number
self.message_body = message
def get(self) -> dict:
return {
"to_phone": self.to_phone,
"message_body": self.message_body,
}
|
# x = 2.8
# print(type(x))
#
# y=3
# print(type(y))
#
# z=2j
# print(type(z))
#
# c=3.5e-4
# print(c)
# x=input("Enter your name:")
# print("Hello," + x)
x = str("ssss www. aaa").upper()
print(x)
my_list = [124125, "tekst", True, 123.44]
my_list2 = [[1,2,3], 2, ['to jest prawda', True]]
print(my_list [0])
for ele... |
files_c=[
'C/7zBuf2.c',
'C/7zCrc.c',
'C/7zCrcOpt.c',
'C/7zStream.c',
'C/Aes.c',
'C/Alloc.c',
'C/Bcj2.c',
'C/Bcj2Enc.c',
'C/Blake2s.c',
'C/Bra.c',
'C/Bra86.c',
'C/BraIA64.c',
'C/BwtSort.c',
'C/CpuArch.c',
'C/Delta.c',
'C/HuffEnc.c',
'C/LzFind.c',
'C/LzFindMt.c',
'C/Lzma2Dec.c',
'C/Lzma2Enc.c',
'C/L... |
# multiple.sequences.while.py
people = ["Conrad", "Deepak", "Heinrich", "Tom"]
ages = [29, 30, 34, 36]
position = 0
while position < len(people):
person = people[position]
age = ages[position]
print(person, age)
position += 1
|
# -*- coding: utf-8 -*-
BOT_NAME = 'tbSpider'
SPIDER_MODULES = ['tbSpider.spiders']
NEWSPIDER_MODULE = 'tbSpider.spiders'
#配置日志输出等级
LOG_LEVEL = 'ERROR'
#你懂得
ROBOTSTXT_OBEY = False
#激活自定义下载中间件
DOWNLOADER_MIDDLEWARES = {
'tbSpider.EmulateDownloaderMiddleware.Emulate': 543,
}
#激活piplines
ITEM_PIPELINES = {
'tbSpi... |
{
'target_defaults': {
'configurations': {
'Debug': {
'defines': [ 'DEBUG', '_DEBUG' ]
},
'Release': {
'defines': [ 'NDEBUG' ]
}
}
},
'targets': [
{
'target_name': 'mappedbuffer',
'sources': [
'src/mappedbuffer.cc'
]
}
]
}
|
# Databricks notebook source
# MAGIC %md
# MAGIC # Project Timesheet Source Data
# COMMAND ----------
spark.conf.set(
"fs.azure.account.key.dmstore1.blob.core.windows.net",
"s8aN23JQ1EboPql5lx++0zQOyYrYC2EvT7NbgewR/8yAmQzpPfojntRWrCr4XOuonMowUUXsEzSxP11Jzd3kTg==")
# COMMAND ----------
# MAGIC %sql
# MAGIC creat... |
# Copyright 2018 The Bazel Authors. All rights reserved.
#
# 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 la... |
class FormatSingle:
def __init__(self, singleData: dict):
self.data = singleData
def getMonthDay(self):
fullData = self.data["TimePeriod"]["Start"]
return fullData[5:]
def getAmount(self):
stringAmountData = self.data["Total"]["BlendedCost"]["Amount"]
return float(... |
"""
Minimum Domino version supported by this python-domino library
"""
MINIMUM_SUPPORTED_DOMINO_VERSION = '4.1.0'
"""
Environment variable names used by this python-domino library
"""
DOMINO_TOKEN_FILE_KEY_NAME = 'DOMINO_TOKEN_FILE'
DOMINO_USER_API_KEY_KEY_NAME = 'DOMINO_USER_API_KEY'
DOMINO_HOST_KEY_NAME = 'DOMINO_A... |
def login_to_foxford(driver):
'''Foxford login'''
driver.get("about:blank")
driver.switch_to.window(driver.window_handles[0]) # <--- Needed in some cases when something popups
driver.get("https://foxford.ru/user/login/")
|
# https://leetcode.com/problems/coin-change/
#You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money.
#Return the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combinati... |
# -*- coding: utf-8 -*-
LOG_TYPES = {
"s": {"event": "Success Login", "level": 1}, # Info
"seacft": {"event": "Success Exchange", "level": 1}, # Info
"seccft": {"event": "Success Exchange (Client Credentials)", "level": 1}, # Info
"feacft": {"event": "Failed Exchange", "level": 3}, # Error
"fec... |
"""
==============
Array indexing
==============
Array indexing refers to any use of the square brackets ([]) to index
array values. There are many options to indexing, which give numpy
indexing great power, but with power comes some complexity and the
potential for confusion. This section is just an overview of the
v... |
class InvalidProgramException(SystemException,ISerializable,_Exception):
"""
The exception that is thrown when a program contains invalid Microsoft intermediate language (MSIL) or metadata. Generally this indicates a bug in the compiler that generated the program.
InvalidProgramException()
InvalidProgr... |
# This sample tests error detection for certain cases that
# are explicitly disallowed by PEP 572 for assignment expressions
# when used in context of a list comprehension.
pairs = []
stuff = []
# These should generate an error because assignment
# expressions aren't allowed within an iterator expression
# in a "for"... |
#
# Solicitud de inscripcion SCIT
#
CP = (
(u"CABA", u"RECOLETA, CABA - C1119"),
(u"22 DE MAYO", u"22 DE MAYO - S2124XAD"),
(u"4 DE FEBRERO", u"4 DE FEBRERO - S2732XAA"),
(u"AARÓN CASTELLANOS", u"AARÓN CASTELLANOS - S6106"),
(u"ABIPONES", u"ABIPONES - S3042XAA"),
(u"ACEBAL", u"ACEBAL - S2109"),
(u"ACHAVAL... |
class Component:
def __init__(self, id_, name_):
self.id = id_
self.name = name_
|
class Mods:
__slots__ = ('map_changing', 'nf', 'ez', 'hd', 'hr', 'dt', 'ht', 'nc',
'fl', 'so', 'speed_changing', 'map_changing')
def __init__(self, mods_str=''):
self.nf = False
self.ez = False
self.hd = False
self.hr = False
self.dt = False
self... |
class Solution:
def maxNumOfSubstrings(self, s: str) -> List[str]:
start, end = {}, {}
for i, c in enumerate(s):
if c not in start:
start[c] = i
end[c] = i
def checkSubstring(i):
curr = i
right = end[s[curr]]
... |
# -*- coding: utf-8 -*-
{
'name': "HR Attendance Holidays",
'summary': """""",
'category': 'Human Resources',
'description': """
Hides the attendance presence button when an employee is on leave.
""",
'version': '1.0',
'depends': ['hr_attendance', 'hr_holidays'],
'auto_install': True,
... |
# -*- coding: utf-8 -*-
"""This Module helps test private extras."""
class PrivateDict(dict):
"""A priviate dictionary."""
|
# Make a dictionary called cities. Use the names of three cities as
# keys in your dictionary. Create a dictionary of information about each city and
# include the country that the city is in, its approximate population, and one fact
# about that city. The keys for each city’s dictionary should be something like
# coun... |
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 3 11:15:57 2020
@author: Tarun Jaiswal
"""
x=range(2,11,2)
print (x)
for item in x:
print(item,end=",")
|
'''
this code is for using PySpark to read straight from S3 bucket instead of using the default data source (AWS Glue Data Catalog).
'''
#this is the default line that we will change:
datasource0 = glueContext.create_dynamic_frame.from_catalog(database = "<DATABASE_NAME>", table_name = "<TABLE_NAME>", transformation... |
"""
New England
Buffalo
Miami
N.Y. Jets
Pittsburgh
Baltimore
Cincinnati
Cleveland
Jacksonville
Tennessee
Indianapolis
Houston
Kansas City
L.A. Chargers
Las Vegas
Denver
Philadelphia
Dallas
Washington
N.Y. Giants
Minnesota
Detroit
Green Bay
Chicago
New Orleans
Carolina
Atlanta
Tampa Bay
L.A. Rams
Seattle
Arizona
San Fra... |
class Solution:
def removePalindromeSub(self, s: str) -> int:
if not s or len(s) == 0:
return 0
left, right = 0, len(s) - 1
while left < right and s[left] == s[right]:
left += 1
right -= 1
if left >= right:
return 1... |
class Solution(object):
def backspaceCompare(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
def manipulateString(string):
new_string = []
for char in string:
if char != '#':
new_string.append(cha... |
radious=2.5
area=3.14*radious**2
print("area of circle",area)
circum=2*3.14*radious
print("circumof",circum)
|
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 09/10/14 #3623 randerso Manually created, do not regenerate
#
class SiteActivationNotification(object):
def __init__(self... |
#!/usr/bin/env python3
# Change the variables and rename this file to secret.py
# add your url here (without trailing / at the end!)
url = "https://home-assistant.duckdns.org"
# get a "Long-Lived Access Token" at YOUR_URL/profile
token = "AJKSDHHASJKDHA871263291873KHGSDKAJSGD"
|
# Time: O(n)
# Space: O(1)
class Solution(object):
def largestSubarray(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: List[int]
"""
left, right, l = 0, 1, 0
while right+k-1 < len(nums) and right+l < len(nums):
if nums[left+l] == n... |
# pylint: skip-file
class OadmPolicyException(Exception):
''' Registry Exception Class '''
pass
class OadmPolicyUserConfig(OpenShiftCLIConfig):
''' RegistryConfig is a DTO for the registry. '''
def __init__(self, namespace, kubeconfig, policy_options):
super(OadmPolicyUserConfig, self).__init... |
# Stage 3/6: More interaction
# Description
# We are going to make our program more complex. As you remember,
# the conicoin rate was fixed in the previous stage. But in the real world,
# things are different. It's time to write a program that takes your
# conicoins and an up-to-date conicoin exchange rate, then count... |
def test_convert_from_bool(get_contract_with_gas_estimation):
code = """
@external
def foo() -> bool:
val: bool = True and True and False
return val
@external
def bar() -> bool:
val: bool = True or True or False
return val
@external
def foobar() -> bool:
val: bool = False and True or False
... |
class ForkName:
Frontier = 'Frontier'
Homestead = 'Homestead'
EIP150 = 'EIP150'
EIP158 = 'EIP158'
Byzantium = 'Byzantium'
Constantinople = 'Constantinople'
Metropolis = 'Metropolis'
ConstantinopleFix = 'ConstantinopleFix'
Istanbul = 'Istanbul'
Berlin = 'Berlin'
London = 'Lond... |
class fruta:
def __init__ (self,nombre, calorias, vitamina_c, porcentaje_fibra, porcentaje_potasio):
self.nombre = nombre
self.calorias = calorias
self.vitamina_c = vitamina_c
self.porcentaje_fibra = porcentaje_fibra
self.porcentaje_potasio = porcentaje_potasio
def ... |
load("//:bouncycastle.bzl", "bouncycastle_repos")
load("//:gerrit_api_version.bzl", "gerrit_api_version")
load("//:rules_python.bzl", "rules_python_repos")
load("//tools:maven_jar.bzl", "MAVEN_LOCAL", "MAVEN_CENTRAL", "maven_jar")
"""Bazel rule for building [Gerrit Code Review](https://www.gerritcodereview.com/)
gerri... |
# this is an embedded Python script it's really on GitHub
# and this is only a reference - so when it changes people
# will see the change on the webpage .. GOODTIMES !
pid = Runtime.start("pid","PID") |
def estrutura_sintatica_frase(dependencies_tags, pred_tags, dep_words, frase):
"""
Define a ordem frásica da frase em português (ex: "SVO") com base nas relações de dependência retornadas pelo SpaCy.
:param dependencies_tags: lista com as etiquetas de dependencia da frase dadas pelo SpaCy
:param pred_tags: lista co... |
print("""
071) Crie um programa que simule o funcionamento de um caixa eletrônico.
No início, pergunte ao usuário qual será o valor a ser sacado (Número
inteiro) e o programa vai informar quantas cédulas de cada valor serão
entregues.
OBS.: Considere que o Caixa possui cédulas de R$ 50, R$ 20, R$ 10 e R$ 1.
""")
### S... |
def fram_write8(addr: number, val: number):
pins.digital_write_pin(DigitalPin.P16, 0)
pins.spi_write(OPCODE_WRITE)
pins.spi_write(addr >> 8)
pins.spi_write(addr & 0xff)
pins.spi_write(val)
pins.digital_write_pin(DigitalPin.P16, 1)
def on_button_pressed_a():
fram_write8(0, 10)
basic.paus... |
class HtmlDocument(object):
""" Provides top-level programmatic access to an HTML document hosted by the System.Windows.Forms.WebBrowser control. """
def AttachEventHandler(self,eventName,eventHandler):
"""
AttachEventHandler(self: HtmlDocument,eventName: str,eventHandler: EventHandler)
Adds an event ha... |
class GumoBaseError(RuntimeError):
pass
class ConfigurationError(GumoBaseError):
pass
class ServiceAccountConfigurationError(ConfigurationError):
pass
class ObjectNotoFoundError(GumoBaseError):
pass
|
class CrudBackend(object):
def __init__(self):
pass
def create(self, key, data=None):
return NotImplementedError()
def read(self, key):
return NotImplementedError()
def update(self, key, data):
return NotImplementedError()
def delete(self, key):
return Not... |
class CommonInfoAdminMixin:
def get_readonly_fields(self, request, obj=None):
return super().get_readonly_fields(request, obj) + ('created_by', 'lastmodified_by', 'created_at',
'lastmodified_at')
def save_form(self, request, form, change):
... |
# In Python, the // operator performs
# integer (whole-number) floor division,
# the / operator performs floating-point division,
# and the ‘%’ (or modulo) operator calculates and returns
# the remainder from integer division:
print('5 // 3:', 5//3) # 1
print('5 / 3:', 5/3) # 1.6666666666666667
print('5 % 3:', 5%3)... |
'''
Problem Statement
Given a linked list with integer data, arrange the elements in such a manner that all nodes with even numbers are placed after odd numbers.
Do not create any new nodes and avoid using any other data structure. The relative order of even and odd elements must not change.
Example:
linked list = 1... |
# krotki
k = ('a', 1, 'qqq', {1: 'x', 2: 'y'})
print(k)
print(k[0])
print(k[-1])
print(k[1:-1])
print('------operacje ----------')
# k.append('www')
# k.remove('qq')
print(k.index(1))
# print k.index('b')
print(k.count('b'))
print(len(k))
k[-1][1] = 'zzz'
print(k)
print('a' in k, 'z' in k)
# krotka jako lista
l = ... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.