content stringlengths 7 1.05M |
|---|
class EvaluationFactory:
factories = {}
@staticmethod
def add_factory(name, evaluation_factory):
"""
Add a EvaluationFactory into all the factories
:param name: the name of the factory
:param evaluation_factory: the instance of the factory
"""
EvaluationFacto... |
class QgisCtrl():
def __init__(self, iface):
super(QgisCtrl, self).__init__()
self.iface = iface |
def add_numbers(a, b):
return a + b
def two_n_plus_one(a):
return 2 * a + 1 |
conversation_property_create = """
<config>
<host-table xmlns="urn:brocade.com:mgmt:brocade-arp">
<aging-mode>
<conversational></conversational>
</aging-mode>
<aging-time>
<conversational-timeout>{{arp_aging_timeout}}</conversational-timeout>
</aging-tim... |
'''
## Question
### 13. [Roman to Integer](https://leetcode.com/problems/palindrome-number/)
Roman numerals are represented by seven different symbols: `I, V, X, L, C, D and M` .
| | |
|**Symbol**|**Value**|
|:--:|:--:|
|I|1|
|V|5|
|X|10|
|L|50|
|C|100|
|D|500|
|M|1000|
For example, `two` is written as `II` in Rom... |
# Lesson 2
class FakeSocket:
# These variables belong to the CLASS, not the instance!
DEFAULT_IP = '127.0.0.1'
DEFAULT_PORT = 12345
# instance methods can access instance, class, and static variables and methods.
def __init__(self, ip=DEFAULT_IP, port=DEFAULT_PORT):
# These variables belong... |
class CacheItem:
def __init__(self, id, value, compValue=1, order = 1) -> None:
self.id = id
self.compValue = compValue
self.value = value
self.order = order
class PriorityQueue:
items = []
def add(self, item: CacheItem):
self.items.append(item)
se... |
def greaterThan(a, b):
flag = True
count = 0
for i in range(3):
if a[i] < b[i]:
flag = False
break
if a[i] > b[i]:
count += 1
if not flag or count < 1:
return False
else:
return True
t = int(input())
for _ in range(t):
l = []
for i in range(3):
l.append(list(map(int,... |
# 141, Суптеля Владислав
# 【Дата】:「09.03.20」
# 18. Перевірити, чи можна переливати кров донор пацієнту.
print("Резус-фактор не враховуємо . . . \n")
def bloodseeker():
d, r = map(int, input("「Донор」(d), 「Реципієнт」(r): ").split())
if d == r:
print("Da.")
elif 1 == d:
print("Da.")
elif r... |
i = 11
print(i)
j = 12
print(j)
f = 12.34
print(f)
g = -0.99
print(g)
s = "Hello, World"
print(s)
print(s[0])
print(s[:5])
print(s[7:12])
l = [2,3,4,5,7,11]
print(l) |
# https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
class Solution:
def maxProfit(self, prices: list[int]) -> int:
max_price = prices[-1]
max_profit = 0
idx = len(prices) - 2 # Start from the penultimate item
while idx >= 0:
curr_price = prices[idx]
... |
class TabelaHash:
""" Implementação de uma tabela Hash usando o método da divisão e endereçamento aberto
com sondagem linear para resolver colisões.
"""
def __init__(self, tamanho = 10):
self.lista = [None] * tamanho
def insere(self, elemento):
""" Insere o elemento na tabela Hash.... |
##### CLASSE ARBRE #####
class Arbre:
#Initialise l'arbre
def __init__(self):
#Valeur de l'arbre
self.valeur = 0
#Fils gauche
self.gauche = None
#Fils droit
self.droit = None
#Position de l'arbre
self.position = Position()
def __str__(self):
return "["+s... |
class Topology:
"""Heat exchanger topology data"""
def __init__(self, exchanger_addresses, case_study, number):
self.number = number
# Initial heat exchanger topology
self.initial_hot_stream = int(case_study.initial_exchanger_address_matrix['HS'][number] - 1)
self.initial_cold_... |
class A:
def func():
pass
class B:
def func():
pass
class C(B,A):
pass
c=C()
c.func() |
class Graph:
def __init__(self, nodes):
self.node = {i: set([]) for i in range(nodes)}
def addEdge(self, src, dest, dir=False):
self.node[src].add(dest)
if not dir:
self.node[dest].add(src) # for undirected edges
class Solution:
def hasCycle(self, graph):
whitese... |
"""Binance Module for XChainPY Clients
.. moduleauthor:: Thorchain
"""
__version__ = '0.2.3' |
epochs = 500
batch_size = 25
dropout = 0.2
variables_device = "/cpu:0"
processing_device = "/cpu:0"
sequence_length = 20 # input timesteps
learning_rate = 1e-3
prediction_length = 2 # expected output sequence length
embedding_dim = 5 # input dimension total number of features in our case
## BOSHLTD/ MICO same....
C... |
class JustCounter:
__secretCount = 0
publicCount = 0
def count(self):
self.__secretCount += 1
self.publicCount += 1
print(self.__secretCount)
counter = JustCounter()
counter.count()
counter.count()
print(counter.publicCount)
print(counter.__secretCount)
|
"""
``imbalanced-learn`` is a set of python methods to deal with imbalanced
datset in machine learning and pattern recognition.
"""
# Based on NiLearn package
# License: simplified BSD
# PEP0440 compatible formatted version, see:
# https://www.python.org/dev/peps/pep-0440/
#
# Generic release markers:
# X.Y
# X.Y.Z # ... |
# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidato... |
class Solution:
def simplifyPath(self, path: str) -> str:
spath = path.split('/')
result = []
for i in range(len(spath)):
if spath[i] == '' or spath[i] == '.' or (spath[i] == '..' and len(result) == 0):
continue
elif spath[i] == '..' and len(... |
class TypeUnknownParser:
"""
Parse invocations to a APIGateway resource with an unknown integration type
"""
def invoke(self, request, integration):
_type = integration["type"]
raise NotImplementedError("The {0} type has not been implemented".format(_type))
|
BOLD = '\033[1m'
RESET = '\033[0m'
def start_box(size):
try:
print('┏' + '━' * size + '┓')
except (UnicodeDecodeError, UnicodeEncodeError):
print('-' * (size + 2))
def end_box(size):
try:
print('┗' + '━' * size + '┛')
except (UnicodeDecodeError, UnicodeEncodeError):
p... |
#MenuTitle: Nested Components
# -*- coding: utf-8 -*-
__doc__="""
Creates a new tab with glyphs that have nested components.
"""
Font = Glyphs.font
tab = []
def showNestedComponents(glyph):
for idx, layer in enumerate(glyph.layers):
if not layer.components:
continue
for component in layer.components:
compo... |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@license:
'''
SPELL=u'huāngshù'
CN=u'肓俞'
NAME=u'huangshu14'
CHANNEL='kidney'
CHANNEL_FULLNAME='KidneyChannelofFoot-Shaoyin'
SEQ='KI16'
if __name__ == '__main__':
pass
|
# fig_supp_steady_pn_lognorm_syn.py ---
# Author: Subhasis Ray
# Created: Fri Mar 15 16:04:34 2019 (-0400)
# Last-Updated: Fri Mar 15 16:05:11 2019 (-0400)
# By: Subhasis Ray
# Version: $Id$
# Code:
jid = '22251511'
#
# fig_supp_steady_pn_lognorm_syn.py ends here
|
# -*- coding: utf-8 -*-
__author__ = 'Amit Arora'
__email__ = 'aa1603@georgetown.edu'
__version__ = '0.1.0'
|
class Solution:
def addStrings(self, num1: str, num2: str) -> str:
nums1 = list(num1)
nums2 = list(num2)
res, carry = [], 0
while nums1 or nums2:
n1 = n2 = 0
if nums1:
n1 = ord(nums1.pop()) - ord("0")
if nums2:
n2 =... |
#
# Copyright (c) 2013 Markus Eliasson, http://www.quarterapp.com/
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use... |
class DrumException(Exception):
"""Base drum exception"""
pass
class DrumCommonException(DrumException):
"""Raised in case of common errors in drum"""
pass
class DrumPerfTestTimeout(DrumException):
"""Raised when the perf-test case takes too long"""
pass
class DrumPerfTestOOM(DrumExcept... |
class SATImportOptions(BaseImportOptions, IDisposable):
"""
The import options used to import SAT format files.
SATImportOptions(option: SATImportOptions)
SATImportOptions()
"""
def Dispose(self):
""" Dispose(self: BaseImportOptions,A_0: bool) """
pass
def ReleaseUn... |
# -*- coding: utf-8 -*-
"""
pagarmecoreapi
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""
class HttpContext(object):
"""An HTTP Context that contains both the original HttpRequest
object that intitiated the call and the HttpResponse object that
is... |
# -*- coding: utf-8 -*-
sehir = {"0":"http://ibb-media1.ibb.gov.tr:1935/live/223.stream/chunklist_w1088399288.m3u8", #mecidiyeköy
"1":"http://ibb-media1.ibb.gov.tr:1935/live/344.stream/chunklist_w1837373499.m3u8", #FSM Köprüsü
"2":"http://ibb-media1.ibb.gov.tr:1935/live/338.stream/chunklist_w1878212776.m3u8", #268-s ... |
def backtrack(estado_corrente, n):
# 1. verifique se o estado corrente merece tratamento especial
# (se é um estado "final")
if len(estado_corrente) == n:
print(estado_corrente) # encontrei uma permutacao caótica!
return # nada mais a ser feito a partir deste estado atual
posicao_a_... |
nome_usuario=input("faça o login com seu nome\n")
senha=input("Digite sua senha\n")
while senha==nome_usuario:
print("Erro! Senha ou nome de usuário inválido\n")
nome_usuario=input("faça o login com seu nome\n")
senha=input("Digitre sua senha\n")
|
Alcool=0
Gasolina=0
Diesel=0
numero=0
while True:
numero=int(input())
if(numero==1):
Alcool+=1
if(numero==2):
Gasolina+=1
if(numero==3):
Diesel+=1
if(numero==4):
break
print('MUITO OBRIGADO')
print(f'Alcool: {Alcool}')
print(f'Gasolina: {Gasolina}')
print(f'Diesel: {D... |
#!/usr/bin/python
class GrabzItScrape:
def __init__(self, identifier, name, status, nextRun, results):
self.ID = identifier
self.Name = name
self.Status = status
self.NextRun = nextRun
self.Results = results
|
# -*- coding: utf-8 -*-
def main():
s = input()
n = len(s)
k = int(input())
if k > n:
print(0)
else:
ans = set()
for i in range(n - k + 1):
ans.add(s[i:i + k])
print(len(ans))
if __name__ == '__main__':
main()
|
nome = input ("colocar nome do cliente:")
preco = float (input ("colocar preco:"))
quantidade = float (input ("colocar a contidade:"))
valor_total = (quantidade) * (preco)
print("Senhor %s seus produtos totalizam R$ %.2f reais."%(nome,valor_total)) |
# -*- coding: utf-8 -*-
"""
1184. Distance Between Bus Stops
A bus has n stops numbered from 0 to n - 1 that form a circle.
We know the distance between all pairs of neighboring stops where distance[i] is the distance between the stops number
i and (i + 1) % n.
The bus goes along both directions i.e. clockwise and co... |
"""Message passing enables object impermanent worlds.
"""
class Message:
"""A message can be passed between layers in order to affect the model's
behavior.
Each message has a unique id, which can be used to manipulate this message
afterwards.
"""
def __init__(self, msg):
self.msg = ms... |
"""
Version of vpc
"""
__version__ = '0.5.0'
|
class Celsius:
def __init__(self, temperature=0):
self.temperature = temperature
def to_fahrenheit(self):
return (self.temperature * 1.8) + 32
@property
def temperature(self):
print(f"Getting value: {self.__temperature}")
return self.__temperature # private attribute = ... |
# Created by MechAviv
# Map ID :: 807040000
# Momijigaoka : Unfamiliar Hillside
if "1" not in sm.getQRValue(57375) and sm.getChr().getJob() == 4001:
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.sendDelay(1000)
sm.levelUntil(10)
sm.cr... |
def pierwsza():
"""Tutaj będzie nasz opis"""
imie = input("Podaj swoje imię: ")
print(f"Cześć {imie} - tu Python.")
def druga(powitanie):
"""Witam się z userem
powitanie - string do wypisania"""
imie = input("Podaj swoje imię: ")
print(f"Cześć {imie} - tu {powitanie}.")
########################... |
age=input("How old are you?")
height=input("How tall are you?")
weight=input("How much do you weigh?")
print("So, you're %r old, %r tall and %r heavy." %(age,height,weight))
|
#!/usr/bin/python3
__author__ = 'Alan Au'
__date__ = '2017-12-13'
'''
--- Day 10: Knot Hash ---
You come across some programs that are trying to implement a software emulation of a hash based on knot-tying. The hash these programs are implementing isn't very strong, but you decide to help them anyway. You make a me... |
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
d = {}
for i, x in enumerate(nums):
if target - x in d:
return [i, d[target - x]]
d[x] = i
return []
|
class Person:
def __init__(self, name, money):
self.name = name
self.money = money
@property
def money(self):
print("money getter executed")
return self.__money
@money.setter
def money(self, money):
print("setter executed")
if money < 0:
... |
"""This module contains the constants."""
HTML_DIR = 'views'
UI_DIR = 'views'
VOCABULARY_FILE = 'vocabulary.json'
CONFIG_FILE = 'config.json'
WORDNIK_API_URL = 'https://api.wordnik.com/v4'
|
# Lab 26
#!/usr/bin/env python3
def main():
round = 0
answer = ' '
while round < 3 and answer.lower() != "brian":
round += 1
print('Finish the movie title, "Monty Python\'s The Life of ______"')
answer = input("Your answer --> ")
if answer.lower() == "brian":
pr... |
MONEY_HEIST_QUOTES = [
{
"id": 1,
"author": "Tokyo",
"quote": "In the end, love is a good reason for everything to fall apart.",
},
{
"id": 2,
"author": "Tokyo",
"quote": "Have you ever thought that if you could go back in time, you might still make the same d... |
config = {
'username': "", # Robinhood credentials
'password': "",
'trades_enabled': False, # if False, just collect data
'simulate_api_calls': False, # if enabled, just pretend to connect to Robinhood
'ticker_list': { # list of coin ticker pairs Kraken/Robinhood (XETHZUSD/ETH, etc) - https://api.k... |
# %% [279. Perfect Squares](https://leetcode.com/problems/perfect-squares/)
class Solution:
def numSquares(self, n: int) -> int:
return numSquares(n, math.floor(math.sqrt(n)))
@functools.lru_cache(None)
def numSquares(n, m):
if n <= 0 or not m:
return 2 ** 31 if n else 0
return min(numSqua... |
class Service:
def __init__(self):
self.ver = '/api/nutanix/v3/'
@property
def name(self):
return self.ver
|
# https://leetcode.com/problems/word-search
class Solution:
def __init__(self):
self.ans = False
def backtrack(self, current_length, visited, y, x, board, word):
if self.ans:
return
if current_length == len(word):
self.ans = True
return
next... |
a = 1
b = 2
c = 3
print("hello python")
|
# -*- coding: utf-8 -*-
name = 'usd_katana'
version = '0.8.2'
requires = [
'usd-0.8.2'
]
build_requires = [
'cmake-3.2',
]
variants = [['platform-linux', 'arch-x86_64', 'katana-2.5.4'],
['platform-linux', 'arch-x86_64', 'katana-2.6.4']]
def commands():
env.KATANA_RESOURCES.append('{this.r... |
class PMS_base(object):
history_number = 2 # image history number
jobs = 4 # thread or process number
max_iter_number = 400 # 'control the max iteration number for trainning')
paths_number = 4 # 'number of paths in each rollout')
max_path_length = 200 # 'timesteps in each path')
batch_siz... |
def labyrinth(levels, orcs_first, L):
if levels == 1:
return orcs_first
return min(labyrinth(levels - 1, orcs_first, L) ** 2, labyrinth(levels - 1, orcs_first, L) + L)
print(labyrinth(int(input()), int(input()), int(input())))
|
_base_ = [
'../_base_/models/mask_rcnn_r50_fpn.py',
'../_base_/datasets/cityscapes_instance.py', '../_base_/default_runtime.py'
]
model = dict(
pretrained=None,
roi_head=dict(
bbox_head=dict(
type='Shared2FCBBoxHead',
in_channels=256,
fc_out_channels=1024,
... |
#!/usr/bin/python3
for tens in range(0, 9):
for ones in range(tens + 1, 10):
if tens != 8:
print("{}{}, ".format(tens, ones), end='')
print("89")
|
# ==================================================================================================
# Copyright 2014 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Silvio Peroni <essepuntato@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted, provided that the above copyright notice
# and this permission notice appear in all copies.
#
# THE SOFTWARE I... |
class A:
def __init__(self):
self.A_NEW_NAME = 1
def _foo(self):
pass
a_class = A()
a_class._foo()
print(a_class.A_NEW_NAME)
|
# Constants used for creating the Filesets.
FILESETS_ENTRY_GROUP_NAME_COLUMN_LABEL = 'entry_group_name'
FILESETS_ENTRY_GROUP_DISPLAY_NAME_COLUMN_LABEL = 'entry_group_display_name'
FILESETS_ENTRY_GROUP_DESCRIPTION_COLUMN_LABEL = 'entry_group_description'
FILESETS_ENTRY_ID_COLUMN_LABEL = 'entry_id'
FILESETS_ENTRY_DISPLAY... |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... |
#
# Copyright (c) 2020-2021 Arm Limited and Contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""Package containing jinja templates used by mbed_tools.project."""
|
__all__ = [
'phone_regex'
]
phone_regex = r'^010[-\s]??\d{3,4}[-\s]??\d{4}$'
|
def insertion(array):
for i in range(1, len(array)):
j = i -1
while array[j] > array[j+1] and j >= 0:
array[j], array[j+1] = array[j+1], array[j]
j-=1
return array
print (insertion([7, 8, 5, 4, 9, 2])) |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Kevin Subileau (@ksubileau)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = r'''
---
module: win_rds_rap
short_description: Manage Resource Authorization Policies (RAP) on a Remote Desktop Gat... |
name = 'causalml'
__version__ = '0.11.1'
__all__ = ['dataset',
'features',
'feature_selection',
'inference',
'match',
'metrics',
'optimize',
'propensity']
|
# ************************************************************************* #
# Author: Pawel Rosikiewicz #
# Copyrith: IT IS NOT ALLOWED TO COPY OR TO DISTRIBUTE #
# these file without written #
#... |
"""Encoding PDUs for use in testing."""
############################# A-ASSOCIATE-RQ PDU #############################
# Called AET: ANY-SCP
# Calling AET: ECHOSCU
# Application Context Name: 1.2.840.10008.3.1.1.1
# Presentation Context Items:
# Presentation Context ID: 1
# Abstract Syntax: 1.2.840.10008.1.1 Verifi... |
def reverse_list(ll):
"""Reverses a linked list
Args:
ll: linked list
Returns:
linked list in reversed form
"""
# put your function implementation here
return ll
|
#
# PySNMP MIB module ASANTE-SWITCH-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASANTE-SWITCH-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:09:56 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... |
# Okta codility challenge
def solution(A, Y):
# write your code in Python 3.6
clientTimestamps = {}
clients = []
resultMap = {}
result = []
for cur in A:
client = cur.split(' ')[0]
timestamp = cur.split(' ')[1]
if client not in clientTimestamps:
clients.ap... |
class Circle:
__pi = 3.14
def __init__(self, diameter):
self.radius = diameter / 2
self.diameter = diameter
def calculate_circumference(self):
return self.diameter * self.__pi
def calculate_area(self):
radius = self.diameter / 2
return radius * radius * self.__... |
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
"""Packaging of Linux, macOS and Windows binaries into tarballs"""
load("@os_info//:os_info.bzl", "is_windows")
def _package_app_impl(ctx):
files = depset(ctx.attr.binary.files)... |
permissions = [
'accessapproval.requests.approve',
'accessapproval.requests.dismiss',
'accessapproval.requests.get',
'accessapproval.requests.list',
'accessapproval.settings.get',
'accessapproval.settings.update',
'androidmanagement.enterprises.manage',
'appengine.applications.create',
'appengine.applications.... |
ALL_BLUE_MOUNTAINS_SERVICES = range(9833, 9848)
INBOUND_BLUE_MOUNTAINS_SERVICES = (9833, 9835, 9838, 9840, 9841, 9843, 9844,
9847)
YELLOW_LINE_SERVICES = [9901, 9903, 9904, 9906, 9908, 9909, 9911, 9964, 9965,
9966, 9967, 9968, 9969, 9972, 9973, 9974]
# 9847 has... |
study_name = 'mperf'
# Sampling frequency
SAMPLING_FREQ_RIP = 21.33
SAMPLING_FREQ_MOTIONSENSE_ACCEL = 25
SAMPLING_FREQ_MOTIONSENSE_GYRO = 25
# MACD (moving average convergence divergence) related threshold
FAST_MOVING_AVG_SIZE = 13
SLOW_MOVING_AVG_SIZE = 131
# FAST_MOVING_AVG_SIZE = 20
# SLOW_MOVING_AVG_SIZE = 205
#... |
class Printer:
"""
Class for printing string with specific color
Color list: blue, green, cyan, red, white
"""
def __init__(self):
self.__BLUE = '\033[1;34;48m'
self.__GREEN = '\033[1;32;48m'
self.__CYAN = '\033[1;36;48m'
self.__RED = '\033[1;31;48m'
self.__TE... |
x = y = 1
print(x,y)
x = y = z = 1
print(x,y,z)
|
"""Custom exceptions for the application"""
class InvalidConfigException(Exception):
"""Exception that is thrown if the configuration file is not valid"""
def __init__(self):
super().__init__('Configuration file is not valid. \
Please review the docs and check your config file.')
|
#-*- coding: utf-8 -*-
# Let's start with lists
spam = ["eggs", 7.12345] # This is a list, a comma-separated sequence of values between square brackets
print(spam)
print(type(spam))
eggs = [spam,
1.2345,
"fooo"] # No problem with multi-line declaration
print(eggs)
#========... |
""" some constants
"""
# pylint: disable=invalid-name
version_info = (0, 2, 0, "dev")
__version__ = ".".join(map(str, version_info))
module_name = "@deathbeds/wxyz-yaml"
module_version = "^0.2.0"
|
#define a dictionary data structure
#dictionaries have key:valyue pairs for the elements
example_dict = {
"class" : "ASTR 119",
"prof" : "Brant",
"awesomeness" : 10
}
print ("The type of example_dict is ", type(example_dict))
#get value via key
course = example_dict["class"]
print(course)
example_dict["awesomene... |
class BaseLoadOn(Enum,IComparable,IFormattable,IConvertible):
"""
An enumerated type listing all the possible power load use types for a space object.
enum BaseLoadOn,values: kNoOfBaseLoadOnMethods (3),kUseActualLoad (2),kUseCalculatedLoad (1),kUseDefaultLoad (-1),kUseEnteredLoad (0)
"""
def __eq__(self,... |
## @ GpioDataConfig.py
# This is a Gpio config script for Slim Bootloader
#
# Copyright (c) 2020, Intel Corporation. All rights reserved. <BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
#
# The index for a group has to match implementation
# in a platform specific Gpio library.
#
grp_info_lp = {
# Grp ... |
class Solution:
def flipAndInvertImage(self, A: [[int]]) -> [[int]]:
for row in A :
left, right = 0 , len(row) -1
while left < right :
if row[left] == row[right] :
row[left] ^= 1
row[right] ^= 1
left += 1
... |
def read_input():
with open("input.txt", "r") as file:
d = [c[2:].split("..") for c in file.read()[13:].split(", ")]
return [int(i) for s in d for i in s]
def bruteforce(y_v, x_v, b):
x,y = 0,0
while True:
x+=x_v
y+=y_v
if b[0] <= x <= b[1] and b[2] <= y <= b[3]:
... |
#!/usr/bin/python
# Filename: ex_global.py
x = 50
def func():
global x
print('x is ', x)
x = 2
print('Changed local x to ', x)
func()
print('Value of x is ', x)
|
###############################################################################################
# 遍历一遍,可以叫做双指针,分别指向读和写的位置
###########
# 时间复杂度:O(n)
# 空间复杂度:O(1)
###############################################################################################
class Solution:
def compress(self, chars: List[str]) ... |
USAGE_MSG = """
Usage: golem
golem run <project> <test|suite|dir> [-b -t -e]
golem gui [-p]
golem createproject <project>
golem createtest <project> <test>
golem createsuite <project> <suite>
golem createuser <username> <password> [-a -p -r]
Usage: golem run
Run tests or suites
positional arguments... |
class RUNLOG:
class STATUS:
SUCCESS = "SUCCESS"
PENDING = "PENDING"
RUNNING = "RUNNING"
FAILURE = "FAILURE"
WARNING = "WARNING"
ERROR = "ERROR"
APPROVAL = "APPROVAL"
APPROVAL_FAILED = "APPROVAL_FAILED"
ABORTED = "ABORTED"
ABORTING = "AB... |
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. There are special exceptio... |
print("Bem vindo ao jogo ")
chute=0
while chute != 42:
g = input("digite um numero: ")
chute=int(g)
if chute == 42:
print("você venceu!!!!!")
else:
if chute >42:
print("valor alto")
else:
print("valor baixo")
print("fim de jogo")
|
l=int(input("enter length: "))
b=int(input("enter breath: "))
area=l*b
perimeter=2*(l+b)
print(area)
print(perimeter)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.