content stringlengths 7 1.05M |
|---|
play = ["Rock", "Paper", "Scissors"]
computer = "Rock"
print("")
player = "Paper"
|
# Solved manually after decompiling the input and analyzing it.
# There is already a great explanation out there, so I won't bother
# writing another one. Just have a look at the following well-
# documented code:
# https://github.com/dphilipson/advent-of-code-2021/blob/master/src/days/day24.rs
print(91699394894995)
p... |
"""
Application-level definitions for the zlib module.
NOT_RPYTHON
"""
class error(Exception):
"""
Raised by zlib operations.
"""
|
_base_ = [
'../_base_/models/fcn_hr18.py', '../_base_/datasets/vaihingen.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_40k.py'
]
evaluation = dict(interval=288, metric='mIoU', pre_eval=True, save_best='mIoU')
log_config = dict(
interval=50,
hooks=[
dict(type='TextLoggerHook'... |
"""
Python file where we store our custom exceptions for the app
"""
class InvalidPrajitura(Exception):
def __init__(self , msg):
super().__init__(msg)
class MultiplePrajitura(Exception):
def __init__(self , msg):
super().__init__(msg)
class InvalidCommand(Exception):
def __init__(self , ... |
"""Constant values needed for string parsing"""
intervals = {
"intervalToTuple": {
"1": (1,0),
"2": (2,2),
"b3": (3,3),
"3": (3,4),
"4": (4,5),
"b5": (5,6),
"5": (5,7),
"#5": (5,8),
"6": (6,9),
"bb7": (7,9),
"b7": (7,10),
... |
def is_bouncy(number):
list_of_digits = [int(digit) for digit in str(number)]
digits_len = len(list_of_digits)
last_digit = list_of_digits[0]
increasing_count = 0
decreasing_count = 0
for digit in list_of_digits:
if digit >= last_digit:
increasing_count += 1
if digit... |
"""**DEPRECATED** - Instead, use `@rules_rust//crate_universe:repositories.bzl"""
load(":repositories.bzl", "crate_universe_dependencies")
def crate_deps_repository(**kwargs):
# buildifier: disable=print
print("`crate_deps_repository` is deprecated. See setup instructions for how to update: https://bazelbuild... |
"""
collection of parsers,
each module in this filetypes package is named after the extension of the file it can parse e.g. 'PAR'
"""
|
# CRIANDO UMA FUNÇÃO
def fahrenheit(x):
return (x * (9/5)) + 32
x = float(input('Digite uma temperatura em (C°): '))
print(f'A temperatura digitada em {x}C°, é igual a {fahrenheit(x)}F°') |
class Solution:
def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
Y = len(matrix)
if Y == 0: return False
X = len(matrix[0])
if X == 0: return False
lo, height = 0, Y*X-1
#binary
while lo <= height:
... |
# 496. Next Greater Element I
# Runtime: 48 ms, faster than 71.69% of Python3 online submissions for Next Greater Element I.
# Memory Usage: 14.7 MB, less than 14.37% of Python3 online submissions for Next Greater Element I.
class Solution:
# Brute Force
def nextGreaterElement(self, nums1: list[int], nums2:... |
# Write a program to read through a file and print the contents of the file (line by line) all
# in upper case. Executing the program will look as follows
file_handle = open('/home/sunil/OpenSource/Learning/computer-science/intro-to-programming/python-for-everyone/8-files/mbox-short.txt')
for line in file_handle:
... |
EXTRACTED = '86 90 81 87 a3 49 99 43 97 97 41 92 49 7b 41 97 7b 44 92 7b 44 96 98 a5'
flag = ''.join([chr(int(i,12)) for i in EXTRACTED.split()])
print(flag)
|
text = input().lower()
searched_word = input().lower()
counter = 0
for i in range(len(text)):
if text[i:i + len(searched_word)] == searched_word:
counter += 1
print(counter)
|
{'application':{'type':'Application',
'name':'Minimal',
'backgrounds': [
{'type':'Background',
'name':'bgMin',
'title':'Kunden Datenbank',
'size':(502, 467),
'components': [
{'type':'RadioGroup',
'name':'sortBy',
'position':(8, 67),
'size':(134, -... |
def foo(a=None):
if a is not None:
print('got a: ', a)
print('foo /tmp/a/b/c, 1844')
main = foo
|
# Solution to Mega Contest 1 Problem: DJ WALE BABU
string = input()
while "WUBWUB" in string: string = string.replace("WUBWUB", "WUB")
string = string.replace("WUB", " ")
print(string.strip()) |
valid_location_qualifiers = [{'text': 'oval'},
{'text': 'town centre',
'penalty_following_locality': 10},
{'text': 'recreation reserve',
'penalty_following_locality': 10},
... |
"""
Programa que leia um numero inteiro qualquer e peça para o usuário escolher qual será a base de conversão
1 - para binário
2 - para octal
3 - para hexadecimal
"""
num = int(input('Digite um numero inteiro: '))
print('''
1 - Converter para BINÁRIO
2 - Converter para OCTAL
3 - Converter para HEXADECIMAL
''')
opcao ... |
try:
age = int(input('please enter age: '))
risk = 100/age
print('you are {age} years old na dhave a risk profile of {risk}')
except ValueError:
print('age cannot be non numerical')
except ZeroDivisionError:
print('division by zero is invalid') |
##4. Encryptador: Julio Cesar enviaba mensajes a sus legiones encriptando los mensajes mediante el siguiente algoritmo:
## Se escogia un numero n como clave, y se sumaba a cada letra en el alfabeto n posiciones.
##Asi la clave escogida fuese de 0 a 5, la a pasaria a ser la f, mientras que la f seria la k.
##Se... |
#
# @lc app=leetcode.cn id=19 lang=python3
#
# [19] 删除链表的倒数第N个节点
#
# https://leetcode-cn.com/problems/remove-nth-node-from-end-of-list/description/
#
# algorithms
# Medium (33.22%)
# Total Accepted: 40.4K
# Total Submissions: 121.8K
# Testcase Example: '[1,2,3,4,5]\n2'
#
# 给定一个链表,删除链表的倒数第 n 个节点,并且返回链表的头结点。
#
# 示例:
... |
#
# PySNMP MIB module Wellfleet-5000-CHASSIS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-5000-CHASSIS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:39:18 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... |
#
# PySNMP MIB module ENTERASYS-VRRP-EXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-VRRP-EXT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:50:36 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... |
def counter(endCount):
f = open("test.txt","w")
# ***User Code Below*** #
for __ in range(______):
# Non User Code
f.write(str(____)+"\n")
# User Code
print(_____)
# ***End User Code*** #
f.close |
""" File name: dfa.py
Author: Jeff Yuanbo Han (u6617017)
Date: 6 March 2018
Description: This file defines a function which reads in
a DFA described in a file and builds an appropriate datastructure.
There is also another function which takes this DFA and a w... |
# Exercício 035
r1 = int(input('Digite o valor da primeira reta: '))
r2 = int(input('Digite o valor da segunda reta: '))
r3 = int(input('Digite o valor da terceira reta: '))
if r1 + r2 > r3 and r1 + r3 > r2 and r2 + r3 > r1:
print('\033[1;36mÉ possivel formar um triângulo!\033[m')
else:
print('\033[1;31mNão é ... |
def linear_sum(S, n):
if n == 0:
return 0
return linear_sum(S, n - 1) + S[n - 1]
S = [1, 5, 8, 9, 4, 9, 3]
print(linear_sum(S, len(S)))
|
#Debangshu Roy
# XII - B
# 40
#WAP to display only those sentences which that start with
#"The" from the text file hello.txt
#function to add data to the file
def addData(br):
F = open("hello.txt", 'a+')
F.writelines(br)
F.close()
#function to display all the required data given in the question
def... |
count=0
a=[7,2,9,4,5,2,5,8,3,1,9]
n=0
while(n<len(a)):
i=n
if a[i]<a[i+1] or a[i]<a[i+2]:
if a[i+1]<a[i+2]:
i=i+1
elif a[i]<a[i+2]:
i=i+2
count +=1
print(max(count)) |
api_id = 3538476
api_hash = "b8889e6cb9db9df68b700da878321b90"
bot_token = "5094027680:AAETKP-L61BSdlDcvNudimlVqlw3Z9Ax7yQ"
redis_ip = "localhost"
redis_port = 6379
|
# SPDX-FileCopyrightText: 2018 Scott Shawcroft for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
Check for negative height on the BMP.
Seperated into it's own file to support builds
without longint.
"""
def negative_height_check(height):
"""Check the height return modified if negative."""
if heigh... |
n = 1
cp = 0
ci = 0
while n != 0:
n = int(input('Digite um valor:'))
if n % 2 == 0:
cp += 1
else:
ci += 1
print('O total de pares é: {} e impares: {}!'.format(cp, ci)) |
class Hook:
def __init__(self, t, location, cls, method, payload_apk_path, payload_dec_path):
"""
Create a new hook for the currently handled application.
This object contains all relevant information necessary to place the hook at the user defined location.
:param t: Ty... |
AMQP = {"default": {"url": "amqp://localhost:5672"}}
"""
Named sets of connection arguments for AIO-Pika AMQP connection.
Use either a URL or broken out connection eg::
AMQP = {"default": {
"url": "amqp://localhost:5672",
}}
# or
AMQP = {"default": {
"host": 'localhost',
"por... |
n = int(input())
s = input()
d = {'4': '322', '6': '53', '8': '7222', '9': '7332'}
ans = ''
for i in s:
if i=='1' or i=='0':
continue
a = i
if i in d:
a = d[i]
ans += a
ans = list(ans)
ans = sorted(ans)[::-1]
print(''.join(ans)) |
def get_int(val, default=None):
assert default is None or type(default) is int
try:
return int(val)
except ValueError:
return default
except TypeError:
# When val is None, list, tuple, set, dict, etc.
return default
|
# Python - 3.6.0
Test.expect(square_sum([1, 2]), 'squareSum did not return a value')
Test.assert_equals(square_sum([1, 2]), 5)
Test.assert_equals(square_sum([0, 3, 4, 5]), 50)
|
if __name__ == '__main__':
with open('group_members.txt', encoding='utf-8') as f:
all_members = f.read().splitlines()
with open('members_free_journal.txt', encoding='utf-8') as f:
minus_members = f.read().splitlines()
all_members_minus = [x for x in all_members if x not in minus_members]
... |
def add_model_specific_args(parser, root_dir):
parser.add_argument(
"--train_data_file",
default=None,
type=str,
required=True,
help="The input training data file (a text file).",
)
parser.add_argument(
"--output_dir",
type=str,
required=True,
... |
#Exercício 2.1
x = 10 + 20 *30
y = 4**2 / 30
z = (9**4 + 2) * 6 - 1
print(x, y, z)
#Exercício 2.2
exp = 10 % 3 * (10**2) + 1 - 10 * 4 / 2
print(exp) |
#Program that reads the width and height of a wall in meters, calculates the area and amount of paint you need, knowing that each liter of paint paints an area of 2m².
print('=' * 10, 'DEFIANCE 011', '=' * 10)
hei = float(input('Enter the height of the wall in meters: '))
wid = float(input('Enter the width of the wall ... |
"""
Violation:
Except with pass
"""
class MyException(Exception):
pass
def somefunc():
try:
a = 1
except MyException:
pass # This is specific, so it should be fine
except Exception:
pass # This is broad, that's weird
def someotherfunc():
try:
a = 1
except... |
op = op # pylint:disable=invalid-name,used-before-assignment
root = root # pylint:disable=invalid-name,used-before-assignment
class PreShowExtension():
def __init__(self, my_op):
self.Me = my_op
# test
self.name = my_op.name
print('name: ', self.name )
self.onStop = { 'op... |
class Graph():
def __init__(self):
self.numnodes = 0
self.adjacentList = {}
def addVertex(self, data): # lets us peek at the top of element without removing it from the stack
if data not in self.adjacentList:
self.adjacentList[data] = [] # add key [data] to the empty obje... |
def f(a,b,cc):
if cc == '+':
return a+b
if cc == '-':
return a-b
if cc == '*':
return a*b
n=int(input())
L=[]
for i in range(n):
a=input()
L.append(a.split())
D = [[-987654321]*(n) for i in range(n)]
D2 = [[987654321]*(n) for i in range(n)]
for i in range(n):
if i%2 ... |
''' Used to access the methods stored in the main module. '''
main_module = {}
def _update(main_globals):
''' Gets the current state of the main module. '''
global main_module
main_module = main_globals
def get_instance():
''' Gets the current instance of minecraft, or none if there is not an instan... |
# Marcelo Campos de Medeiros
# ADS UNIFIP 2020.1
# 3 Lista
# Patos-PB maio/2020
'''
Faça um programa que leia 6 valores. Estes valores serão somente negativos ou positivos
(desconsidere os valores nulos). A seguir, mostre a quantidade de valores positivos digitados.
Entrada
Seis valores, negativos e/ou positivos.
Sa... |
class Model():
LR='logistic_regression'
CNN='cnn'
SVM='svm'
GENDERWORD='gender_word'
THRESHOLDCLASSIFIER='threshold_classifier'
class Dataset():
BENEVOLENT='benevolent'
HOSTILE='hostile'
OTHER='other'
CALLME='callme'
SCALES='scales'
class Domain():
BHO={'modified': ... |
# “é múltiplo de 3” ou “não é múltiplo de 3”.
Num1 = int(input("Escreva um Numero: "))
if Num1 % 3 > 0:
print("não é múltiplo de 3")
else:
print("é múltiplo de 3") |
# matchball + Результаты тиража по дате + текущая дата
def test_matchball_results_draw_date_current_date(app):
app.ResultAndPrizes.open_page_results_and_prizes()
app.ResultAndPrizes.click_game_matchball()
app.ResultAndPrizes.click_the_results_of_the_draw_date()
app.ResultAndPrizes.click_ok_in_modal_w... |
# Джокер + Выигрышные номера нескольких тиражей
def test_joker_winning_numbers_for_several_draws(app):
app.ResultAndPrizes.open_page_results_and_prizes()
app.ResultAndPrizes.click_game_joker()
app.ResultAndPrizes.click_the_winning_numbers_for_several_draws()
app.ResultAndPrizes.click_ok_for_several_d... |
class Solution(object):
def findDuplicate(self, nums):
count={}
for i in nums:
if i not in count:
count[i]=1
else:
count[i]+=1
for i in range(0,len(nums)):
if count[nums[i]]>1:
return nums[i... |
#!/usr/bin/python
class Node:
"""Klasa reprezentujaca wezel drzewa binarnego."""
def __init__(self, data=None, left=None, right=None):
self.data = data
self.left = left
self.right = right
def __str__(self):
return str(self.data)
def bst_max(top):
if top is None:
... |
class BytecodeBase:
autoincrement = True # For jump
num_args = 0 # for error checking
def __init__(self):
# Eventually might want to add subclassed bytecodes here
# Though __subclasses__ works quite well
pass
def execute(self, machine):
pass
class Push(BytecodeBas... |
__author__ = "xiaoke"
class GlobalVar:
'''拿到execl中列的值,最后在程序的主入口中,遍历行的时候,根据行和列就能拿到cell单元格的值'''
# id值
ID = '0'
# 模块
NAME = '1'
# 请求的url
URL = '2'
# 是否运行
RUN = '3'
# 请求的方式
REQUEST_METHOD = '4'
# 是否携带header
HEADER = '5'
# case依赖
CASR_DEPEND = '... |
# https://leetcode.com/problems/reshape-the-matrix/
class Solution:
def matrixReshape(self, nums: [[int]], r: int, c: int) -> [[int]]:
if r * c != len(nums) * len(nums[0]):
return nums
# return self.solution1(nums, r, c)
# return self.solution2(nums, r, c)
... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
class UserInfo(object):
def __init__(self, name, age, account):
self.name = name
self._age = age
self.__account = account
def get_account(self):
return self.__account
if __name__ == '__main__':
userInfo = UserInfo('两点水', 23, 3... |
num = int(input("Digite um numero inteiro: "))
base_conversao = int(input("Digite o numero para conversao ( 1 = BINARIO | 2 = OCTAL | 3 = HEXADECIMAL ): "))
if base_conversao == 1:
divisao_inteira = num
resto_divisao = num
binario = ""
while divisao_inteira != 0:
resto_divisao = divisao_intei... |
with open("infile.txt") as f1:
with open("outfile.txt", "w") as f2:
for line in f1:
f2.write(line)
|
print('{:=^40}'.format(' Progressão Aritmética '))
primeiro = int(input('Digite o primeiro valor da PA: '))
razao = int(input('Digite a razão da PA: '))
print('Os 10 primeiros termos da progressão serão: ', end=' ')
cont = 0
termos = 10
while cont != termos:
proximo = primeiro+razao*cont
print(proximo, end=' -... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
功能实现:接受任意数量的可迭代对象或带有length属性的对象,并返回最长的那个。
解读:
使用max()和len()作为键来返回最大长度的项。
如果多个对象具有相同的长度,则返回第一个对象。
"""
def longest_item(*args):
return max(args, key=len)
# Examples
print(longest_item('this', 'is', 'a', 'testcase'))
print(longest_item([1, 2, 3], [1, 2], [1, 2, 3... |
'''
Build a card from list input
'''
class Card():
values = {'2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8,'9':9, '10':10, 'J':10, 'Q':10, 'K':10, 'A':11}
def __init__(self,suit,rank):
self.suit = suit
self.rank = rank
self.value = Card.values[rank]
def __str__(self):
return self.rank + '... |
@app.route('/floorplan/')
def floorplan():
MIDDLE = """
<h1><u>Floorplan</u></h1>
<img src="/static/floorplan.jpg">
<br>
"""
return TOP + MIDDLE + BOTTOM
if __name__ == "__main__":
app.run(debug=False,host='0.0.0.0', port=int(os.getenv('PORT', '5000')))
|
class UF:
def __init__(self, n: int):
self.id = list(range(n))
def union(self, u: int, v: int) -> None:
self.id[self.find(u)] = self.find(v)
def find(self, u: int) -> int:
if self.id[u] != u:
self.id[u] = self.find(self.id[u])
return self.id[u]
class Solution:
def smallestStringWithSwa... |
# These are lists that acts as dbs for storing users, recipes and recipe categories
users_db = []
recipe_db = []
recipe_category_db = []
# catching errors
class UserNotFoundException(Exception):
pass
class NullUserError(Exception):
pass
class RecipeNotFoundError(Exception):
pass
# this is a class for... |
# -*- coding: utf-8 -*-
def test_schema_sqlite(sqlite_db):
"""Test init_schema creates empty tables"""
yo_db = sqlite_db
m = MetaData()
m.create_all(bind=yo_db.engine)
for table in m.tables.values():
with yo_db.acquire_conn() as conn:
query = table.select().where(True)
... |
class Logger:
def info(self, message: str) -> None:
raise NotImplementedError()
def success(self, message: str) -> None:
raise NotImplementedError()
def warning(self, message: str) -> None:
raise NotImplementedError()
def error(self, message: str) -> None:
raise NotImp... |
ODSS_FACTORY_CONTEXT = "__ODSS_FACTORY_CONTEXT__"
HANDLER_PROVIDES = "odss.providers"
HANDLER_REQUIRES = "odss.requires"
HANDLER_VALIDATE = "odss.validate"
HANDLER_BIND = "odss.bind"
PROP_HANDLER_NAME = "odss.handler.id"
METHOD_CALLBACK = "odss.method.callback"
CALLBACK_VALIDATE = "odss.callback.validate"
CALLBACK_... |
"""
This Bubble Sort implementation uses a flag to terminate iterations early if
the list is already sorted, and uses a while loop instad of a for loop for
the outer iterations.
Because we don't know the outer iteration number, we need to iterate the
whole list (both unsorted and unsorted portions) on each inner loop.... |
# Copyright (c) 2019 Intel Corporation.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, ... |
def notas(*n, sit=False):
"""
FUNÇAO QUE ANALISA AS NOTAS E A SITUAÇÃO DE VARIOS ALUNOS
n: uma ou mais notas dos alunos
sit: valor opcional, indicando se deve ou nao adicionar a situação
return: dicionario com varias informações da turma
"""
turma = {}
soma = 0
turma['total']=len(n)... |
class Voice:
def __init__(
self,
channel_id,
user_id,
session_id,
deaf,
mute,
self_deaf,
self_mute,
self_video,
suppress
):
self.channel_id = channel_id
self.user_id = user_id
self.session_id = session_id
... |
class Version(object):
def __init__(self, major, minor, tool):
self.major = major
self.minor = minor
self.tool = tool
@staticmethod
def create(dic):
return Version(int(dic["major"]),int(dic["minor"]),dic["tool"])
def is10(self):
if self.major == 1 and self.minor... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
##===-----------------------------------------------------------------------------*- Python -*-===##
##
## S E R I A L B O X
##
## This file is distributed under terms of BSD license.
## See LICENSE.txt for more information.
##
##===----------... |
set_name(0x80079AEC, "GetTpY__FUs", SN_NOWARN)
set_name(0x80079B08, "GetTpX__FUs", SN_NOWARN)
set_name(0x80079B14, "Remove96__Fv", SN_NOWARN)
set_name(0x80079B4C, "AppMain", SN_NOWARN)
set_name(0x80079BF4, "MAIN_RestartGameTask__Fv", SN_NOWARN)
set_name(0x80079C20, "GameTask__FP4TASK", SN_NOWARN)
set_name(0x80079CB8, "... |
# Gigawhat Website JSON models file.
# Copyright 2022 Gigawhat Programming Team
# Written by Samyar Sadat Akhavi, 2022.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 o... |
class Dog:
def __init__(self, name, age):
self.name = name
self.age = age
def get_name(self):
return self.name
def set_name(self, name):
self.name = name
def bark(self):
print(self.name, "is barking..")
if __name__ == '__main__':
dog = Dog("Tim")
dog... |
home_page_location = "/"
gdp_page_location = "/gdp"
iris_page_location = "/iris"
TIMEOUT = 60 |
"""
@Time : 2021-01-21 12:01:32
@File : evaluations.py
@Author : Abtion
@Email : abtion{at}outlook.com
"""
def report_prf(tp, fp, fn, phase, logger):
# For the detection Precision, Recall and F1
precision = tp / (tp + fp) if (tp + fp) > 0 else 0
recall = tp / (tp + fn) if (tp + fn) > 0 else 0... |
"""
Classes for exposing a number of different output data formats.
Most notably, the exporter module implements the correct output of the
transaction stream into TARIC XML envelopes and handles the process by which
these envelopes are marshalled to CDS.
This module also makes available the objects in the system as a... |
__author__ = 'surya'
def createProtein2Path(proteinList,file):
prot2path={}
for line in open(file):
splits=line.strip().split("\t")
reactomeId=splits[0].strip()
proteins=splits[1:len(splits)]
for each in proteins:
if each in proteinList:
if each not i... |
#
# PySNMP MIB module GNOME-PRODUCT-ZEBRA-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/GNOME-PRODUCT-ZEBRA-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:19:46 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... |
class Plugin(object):
"""Base class for plugins.
The __init__ method of derived classes should accept two arguments:
document - an instance of InselectDocument
parent - a QMainWindow
Derived classes should contain
NAME - a string
DESCRIPTION - a string
Derived classes ... |
##Config file for lifetime_spyrelet.py in spyre/spyre/spyrelet/
# Device List
devices = {
'fungen':[
'lantz.drivers.keysight.Keysight_33622A.Keysight_33622A',
['USB0::0x0957::0x5707::MY53801461::INSTR'],
{}
],
'wm':[
'lantz.drivers.bristol.bristol771.Bristol_771',
[6... |
class Solution:
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
Given nums = [2, 7, 11, 15], target = 9,
Be... |
#!/usr/bin/python
# Published March 2015
# Author : Greg Fabre - http://www.iero.org
# Based on Noah Blon's work : http://codepen.io/noahblon/details/lxukH
# Public domain source code
def getHome() :
return '<g transform="matrix(6.070005,0,0,5.653153,292.99285,506.46284)"><path d="M 42,48 C 29.995672,48.017555 18.0... |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 22 09:58:13 2021
@author: Diva Mehta
"""
class Player:
# Constructor always called when the class is created
def __init__(self):
self.name = ""
self.wins = 0
self.losses = 0
# -1 = no chocie, 1 = scissors, 2 = rock, 3 = paper
... |
class ShortPath:
def __init__(self):
self.paths = []
self.distance = 0
|
n = int(input())
l, r = 0, 0
for _ in range(n):
x, y = map(int, input().split())
if x < 0:
l += 1
else:
r += 1
if l <= 1 or r <= 1:
print('Yes')
else:
print('No')
|
RS_ID = 0x12345678
RS_VERSION = 7
RBSP_ID = 0x35849298
RBSP_VERSION = 2
R_PAT_ID = 0x09784348
R_PAT_VERSION = 0
R_LM_ID = 0x30671804
R_LM_VERSION = 3
R_COL_ID = ... |
class SearchUI:
'''SearchUI provides a means of easily assembling a search interface
for either Elasticsearch or LunrJS powered search services'''
def __init__(self, cfg):
self.cfg = {}
for key in cfg.keys():
self.cfg[key] = cfg.get(key, None)
if not ('id' in self.cfg):... |
a=float(input())
b=float(input())
intdiv=int(a/b)
floatdiv=float(a/b)
print(intdiv,floatdiv, sep='\n')
|
s = list(input())
t = list(input())
n = len(s)
answer = "No"
for i in range(n):
for j in range(n-1):
s[n-1-j], s[n-2-j] = s[n-2-j], s[n-1-j]
if s == t:
answer = "Yes"
print(answer) |
# use classifier and test_datagen from before
# classifier is just a Sequential object
x = test_datagen.flow_from_directory('dataset/image_folder',
target_size = (64, 64),
class_mode = 'binary')
print("It is a %s!" % ("dog" if classifier.predict(... |
# Posts number per page for pagination.
POSTS_PER_PAGE = 10
# Time period in seconds for a page in cache.
CACHED_TIME_INDEX = 3
|
"""
#convert base>10 to decimal(base 10)
num=str(input())
print(int(num,16))
"""
def toDigits(n, b):
#Convert a positive number n to its digit representation in base b.
digits = []
while n > 0:
digits.insert(0, n % b)
n = n // b
return digits
def fromDigits(digits, b):
#Compute th... |
_base_ = [
'../_base_/datasets/textvqa_dataset.py',
'../_base_/models/m4c_config.py',
'../_base_/schedules/schedule_textvqa.py',
'../_base_/textvqa_default_runtime.py'
] # yapf:disable
|
TAIGA_USER = 'e1312060@urhen.com'
TAIGA_PASSWORD = 'test_taiga_user'
PROJECT_SLUG = 'test_taiga_user-fake-project-1'
DONE_SLUG = 'Done'
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.