content stringlengths 7 1.05M |
|---|
class CoachAthleteTable:
def __init__(self):
pass
TABLE_NAME = "Coach_Athlete"
ATHLETE_ID = "Athlete_Id"
COACH_ID = "Coach_Id"
CAN_ACCESS_TRAINING_LOG = "Can_Access_Training_Log"
CAN_ACCESS_TARGETS = "Can_Access_Targets"
IS_ACTIVE = "Is_Active"
START_DATE = "Start_Date"
IN... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__project__ = 'leetcode'
__file__ = '__init__.py'
__author__ = 'king'
__time__ = '2020/1/9 10:08'
_ooOoo_
o8888888o
88" . "88
(| -_- |)
... |
'''
leia varios numeros inteiros pelo teclado
no final mostre a soma entre todos
o maior e o menor
o programa deve perguntar se el quer continuar ou nao a digitar válores
'''
num = int(input("Diga um numero"))
soma = num
maior = menor = num
continuar = str(input("Deseja continuar? [s] sim [n] não"))
while (continuar ... |
T=int(input())
def is_anagram(str1, str2):
list_str1 = list(str1)
list_str1.sort()
list_str2 = list(str2)
#list_str2.sort()
return (list_str1 == list_str2)
for i in range(T):
opt=0
L=int(input())
A=str(input())
B=str(input())
for j in range(len(A)):
f... |
__title__ = 'tmuxp'
__package_name__ = 'tmuxp'
__version__ = '0.1.12'
__description__ = 'Manage tmux sessions thru JSON, YAML configs. Features Python API'
__email__ = 'tony@git-pull.com'
__author__ = 'Tony Narlock'
__license__ = 'BSD'
__copyright__ = 'Copyright 2013 Tony Narlock'
|
list=linkedlist()
list.head=node("Monday")
list1=node("Tuesday")
list2=node("Thursday")
list.head.next=list1
list1.next=list2
print("Before insertion:")
list.printing()
print('\n')
list.push_after(list1,"Wednesday")
print("After insertion:")
list.printing()
print('\n')
list.deletion(3)
print("After deleting 4th node")
... |
# -*- coding: utf-8 -*-
DB_LOCATION = 'timeclock.db'
DEBUG = True
|
#
# Copyright (c) 2020-present, Weibo, Inc. 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 app... |
"""
--- Day 23: Coprocessor Conflagration ---
You decide to head directly to the CPU and fix the printer from there. As you get close, you find an experimental coprocessor doing so much work that the local programs are afraid it will halt and catch fire. This would cause serious issues for the rest of the computer, so... |
class Sources:
"""
Sources class to define source object
"""
def __init__(self, id, name, description, url):
self.id = id
self.name = name
self.description = description
self.url = url
class Articles:
"""
Articles class to define articles object
"""
def... |
"""
List Exercise 2
Implementieren Sie die Funktion includes() zur Überprüfung, ob ein bestimmtes Element 'search_element' in
der Liste enthalten ist. Benutzen Sie die nachfolgenden Tests zur Kontrolle.
"""
def includes(my_list, search_element):
return search_element in my_list
# Tests
print(includes([1, 2, 3,... |
#Exercício Python 047:
#Crie um programa que mostre na tela todos os números pares que estão no intervalo entre 1 e 50.
for i in range(1, 50+1, 2):
print(i, end=' ') |
class Vehicle(object):
"""A generic vehicle class."""
def __init__(self, position):
self.position = position
def travel(self, destination):
print('Travelling...')
class RadioMixin(object):
def play_song_on_station(self, station):
print('Playing station...')
class Car(Vehicl... |
#!/usr/bin/env python3
n = int(input())
print(n * ((n - 1) % 2))
|
result = True
another_result = result
print(id(result))
print(id(another_result))
# bool is immutable
result = False
print(id(result))
print(id(another_result))
|
region='' # GCP region e.g. us-central1 etc,
dbusername=''
dbpassword=''
rabbithost=''
rabbitusername=''
rabbitpassword=''
awskey='' # if you intend to import data from S3
awssecret='' # if you intend to import data from S3
mediabucket=''
secretkey=''
superuser=''
superpass=''
superemail=''
cloudfsprefix='gs'
cors_orig... |
CheckNumber = float(input("enter your number"))
print(str(CheckNumber) +' setnumber')
while CheckNumber != 1:
numcheck = CheckNumber
if CheckNumber % 2 == 0:
CheckNumber = CheckNumber / 2
print(str(CheckNumber) +' output reduced')
else:
CheckNumber = CheckNumber * 3 + 1
print(str(CheckNumber) +' output ... |
class Solution:
def asteroidCollision(self, asteroids: List[int]) -> List[int]:
'''
T: (n) and S: O(n)
'''
stack = []
for asteroid in asteroids:
# Case 1: Collision occurs
while stack and (asteroid < 0 and stack[-1] > 0):
if st... |
#
# PySNMP MIB module ENTERASYS-SERVICE-LEVEL-REPORTING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-SERVICE-LEVEL-REPORTING-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:50:17 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
#... |
#
# @lc app=leetcode id=4 lang=python3
#
# [4] Median of Two Sorted Arrays
#
# https://leetcode.com/problems/median-of-two-sorted-arrays/description/
#
# algorithms
# Hard (30.86%)
# Likes: 9316
# Dislikes: 1441
# Total Accepted: 872.2K
# Total Submissions: 2.8M
# Testcase Example: '[1,3]\n[2]'
#
# Given two sor... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def recoverFromPreorder(self, S: str) -> TreeNode:
def dfs(parent, s, lev):
print(parent.val, s, lev)
if ... |
# Enter your code here. Read input from STDIN. Print output to STDOUT
n=int(input())
country_name=set(input() for i in range(n))
print(len(country_name))
|
OP_CODES = {
"inp": 0,
"cla": 1,
"add": 2,
"tac": 3,
"sft": 4,
"out": 5,
"sto": 6,
"sub": 7,
"jmp": 8,
"hlt": 9,
"mul": 10,
"div": 11,
"noop": 12
}
class InstructionError(Exception):
pass
class Assembler(object):
def __init__(self, inputfile):
sel... |
PIPELINE = {
#'PIPELINE_ENABLED': True,
'STYLESHEETS': {
'global': {
'source_filenames': (
'foundation-sites/dist/foundation.min.css',
'pikaday/css/pikaday.css',
'jt.timepicker/jquery.timepicker.css',
'foundation-icon-fonts/foun... |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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://ww... |
#
# @lc app=leetcode id=430 lang=python3
#
# [430] Flatten a Multilevel Doubly Linked List
#
# @lc code=start
"""
# Definition for a Node.
class Node:
def __init__(self, val, prev, next, child):
self.val = val
self.prev = prev
self.next = next
self.child = child
"""
class Solution:... |
TITLE = "Jump game"
WIDTH = 480
HEIGHT = 600
FPS = 30
WHITE = (255, 255, 255)
BLACK = (0,0,0)
RED = (240, 55, 66) |
class Tool:
def __init__(self, name, make):
self.name = name
self.make = make
|
colors = {
"bg0": " #fbf1c7",
"bg1": " #ebdbb2",
"bg2": " #d5c4a1",
"bg3": " #bdae93",
"bg4": " #a89984",
"gry": " #928374",
"fg4": " #7c6f64",
"fg3": " #665c54",
"fg2": " #504945",
"fg1": " #3c3836",
"fg0": " #282828",
"red": " #cc241d",
"red2": " #9d0006",
"oran... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
result = ListNode(0)
result_tail = result
carry = 0
... |
class User:
"""
Class that generates new users login system
"""
def __init__(self,fullname, email, username, password):
self.fullname = fullname
self.email = email
self.username = username
self.password = password
user_list = []
def save_user(self)... |
#!/usr/bin/env python3
# 区间内查询数字的频率
class RangeFreqQuery:
def __init__(self, arr: [int]):
self.arr = arr
return None
def query(self, left: int, right: int, value: int) -> int:
return self.arr[left:right+1].count(value)
a = RangeFreqQuery([12, 33, 4, 56, 22, 2, 34, 33, 22, 12, 34, 56])
print(Ra... |
# WEB_DRIVER_PATH = 'C:\chromedriver.exe'
# XLSX_PATH = 'C:/dateGirls/m3/suyo_sample.xls'
# START_DATE = ['20170220', '20170220', '20170220', '20170220']
# END_DATE = ['20170421', '20170421', '20170421', '20170421']
# DINING_NAME = ['나노하나', '바라티에', '서대문양꼬치', '백곰막걸리']
# BROAD_NAME = '수요미식회'
# BROAD_DATE = ['20170322',... |
budget = float(input())
season = str(input())
region = str()
final_budget = 0
accommodation = str()
if budget <= 100:
region = "Bulgaria"
if season == "summer":
accommodation = "Camp"
final_budget = budget * 0.7
else:
accommodation = "Hotel"
final_budget = budget * 0.30
eli... |
class RequestConnectionError(Exception):
pass
class ReferralError(Exception):
pass
class DataRegistryCaseUpdateError(Exception):
pass
|
class ATTR:
CAND_CSV = "cand_csv"
CANDIDATE = "candidate"
COLOR = "color"
CONFIRMED = "confirmed"
CSV_ENDING = ".csv"
EMAIL = "Email"
FIRST_NAME = "First Name"
LAST_NAME = "Last Name"
NEXT = "next"
NUM_BITBYTES = "num_bitbytes"
NUM_CONFIRMED = "num_confirmed"
NUM_PENDING ... |
# str - рядок, послідовність символів
# Ініціалізація змінних типу str
message_1 = "Men's brain"
message_2 = '"1984" George Orwell. It\'s a cool book.'
message_3 = """
Dear friend. I hope you are doing well.
Warm regards,
Your friend
"""
message_4 = """
Dear friend,
I hope you are doing well.
Warm regards,
Yo... |
class PartOfSpeech:
NOUN = 'noun'
VERB = 'verb'
ADJECTIVE = 'adjective'
ADVERB = 'adverb'
pos2con = {
'n': [
'NN', 'NNS', 'NNP', 'NNPS', # from WordNet
'NP' # from PPDB
],
'v': [
'VB', 'VBD', 'VBG', 'VBN', 'VBZ', # from WordNet
... |
def superTuple(name, attributes):
"""Creates a Super Tuple class."""
dct = {}
#Create __new__.
nargs = len(attributes)
def _new_(cls, *args):
if len(args) != nargs:
raise TypeError("%s takes %d arguments (%d given)." % (cls.__name__,
... |
my_first_name = str(input("My first name is "))
neighbor_first_name = str(input("My neighbor's first name is "))
my_coding = int(input("How many months have I been coding? "))
neighbor_coding = int(input("How many months has my neighbor been coding? "))
print("I am " + my_first_name + " and my neighbor is " + neighbor... |
class MethodPropertyNotFoundError(Exception):
"""Exception to raise when a class is does not have an expected method or property."""
pass
class PipelineNotFoundError(Exception):
"""An exception raised when a particular pipeline is not found in automl search results"""
pass
class ObjectiveNotFoundE... |
print("======Gerador de PA=======")
first = int(input("Informe o primeiro termo: "))
razao = int(input("Informe a razão: "))
cont = 0
sum = first
termos = 10
total=0
while termos != 0:
print("{} -> ".format(sum), end="")
cont+=1
sum+=razao
if cont == termos:
print("PAUSA")
termos = int(i... |
data_nascimento = 9
mes_nascimento = 10
ano_nascimento = 1985
print(data_nascimento, mes_nascimento, ano_nascimento, sep="/", end=".\n")
contador = 1
while(contador <= 10):
print(contador)
contador = contador + 2
if(contador == 5):
contador = contador + 2
|
def even_spread(M, N):
"""Return a list of target sizes for an even spread.
Output sizes are either M//N or M//N+1
Args:
M: number of elements
N: number of partitons
Returns:
target_sizes : [int]
len(target_sizes) == N
sum(target_sizes) == M
"... |
BASE_URL = 'https://caseinfo.arcourts.gov/cconnect/PROD/public/'
### Search Results ###
PERSON_SUFFIX = 'ck_public_qry_cpty.cp_personcase_srch_details?backto=P&'
JUDGEMENT_SUFFIX = 'ck_public_qry_judg.cp_judgment_srch_rslt?'
CASE_SUFFIX = 'ck_public_qry_doct.cp_dktrpt_docket_report?backto=D&'
DATE_SUFFIX = 'ck_publi... |
value = 2 ** 1000
value_string = str(value)
value_sum = 0
for _ in value_string:
value_sum += int(_)
print(value_sum) |
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftplusminusnonassocadvdisadvadv dice disadv div minus newline number plus space star tabcommand : roll_list\n | mod_list\n ... |
# Elaborar um programa que leia duas matrizes A e B de uma dimensão do tipo vetor com dez elementos inteiros cada. Construir uma matriz C de mesmo tipo e dimensão, que seja formada pela soma dos quadrados de cada elemento correspondente das matrizes A e B. Apresentar a matriz C em ordem decrescente.
A = []
B = []
C... |
output = 'Char\tisdigit\tisdecimal\tisnumeric'
html_output = '''<table border="1">
<thead>
<tr>
<th>Char</th>
<th>isdigit</th>
<th>isdecimal</th>
<th>isnumeric</th>
</tr>
</thead>
<tbody>'''
for i in range(1, 1114111):
if chr(i).isdigit() or chr(i).isdecimal() or chr(i).isnu... |
# question can be found at leetcode.com/problems/sqrtx/
# The original implementation does a Binary search
class Solution:
def mySqrt(self, x: int) -> int:
if x == 0 or x == 1:
return x
i, result = 1, 1
while result <= x:
i += 1
result = pow(i, 2)
... |
'''
Problem 13
@author: mat.000
'''
numbers = """37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
74324986199524741059474233309513058123726617309629
91942213363574161572522430563301811072406154908250
23067588207539346171171980310421047513778063246676
89261670696623... |
"""ct.py: Constant time(ish) functions"""
# WARNING: Pure Python is not amenable to the implementation of truly
# constant time cryptography. For more information, please see the
# "Security Notice" section in python/README.md.
def select(subject, result_if_one, result_if_zero):
# type: (int, int, int) -> int
... |
# indices for weight, magnitude, and phase lists
M, P, W = 0, 1, 2
# Set max for model weighting. Minimum is 1.0
MAX_MODEL_WEIGHT = 100.0
# Rich text control for red font
RICH_TEXT_RED = "<FONT COLOR='red'>"
# Color definitions
# (see http://www.w3schools.com/tags/ref_colorpicker.asp )
M_COLOR = "#6f93ff" # magnitude... |
# Lost Memories Found [Hayato] (57172)
recoveredMemory = 7081
mouriMotonari = 9130008
sm.setSpeakerID(mouriMotonari)
sm.sendNext("I've been watching you fight for Maple World, Hayato. "
"Your dedication is impressive.")
sm.sendSay("I, Mouri Motonari, hope that you will call me an ally. "
"The two of us have a great ... |
"""
##################################################################################################
# Copyright Info : Copyright (c) Davar Lab @ Hikvision Research Institute. All rights reserved.
# Filename : test_base_setting.py
# Abstract : Base recognition Model test setting
# Current Versio... |
def enc():
code=input('Write what you want to encrypt: ')
new_code_1=''
for i in range(0,len(code)-1,1):
new_code_1=new_code_1+code[i+1]
new_code_1=new_code_1+code[i]
print(new_code_1)
def dec():
code=input('Write what you want to deccrypt: ')
new_code=''
if len(cod... |
class Node:
def __init__(self, key):
self.data = key
self.left = None
self.right = None
def getNodeCount(root : Node) -> int:
if root is None:
return 0
count = 0
count += 1
count += (getNodeCount(root.left) + getNodeCount(root.right))
return count
if __name__... |
# Copyright 2021 The gRPC Authors
#
# 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 law or agreed to in writ... |
disciplinas=int(input('quantidade de disciplinas por semana: '))
tempojudo=int(input('quantidade de tempo por aula de inglês em minutos: '))
tempoingles=int(input('quantidade de tempo por aula de judô em minutos: '))
ingles=tempoingles*2
minutoslivres=15*60
temposobra= minutoslivres-(ingles+tempojudo)
temposidciplinas=... |
"""Possible user action events"""
EVENT_BROWSE_FILES = "BrowseFiles"
EVENT_DELETE_SONG = "DeleteSong"
EVENT_PLAY_SONG = "PlaySong"
EVENT_SELECT_SONGS = "SelectSingleSong"
EVENT_CREATE_PLAYLIST = "CreatePlaylist"
EVENT_DELETE_PLAYLIST = "DeletePlaylist"
EVENT_SELECT_PLAYLIST = "SelectPlaylist"
EVENT_PLAY_PLAYLIST = "Pla... |
# 変数townに辞書を代入してください
town = {"Aichi" : "Nagoya", "Kanagawa" : "Yokohama"}
# townの出力
print(town)
# 型の出力
print(type(town)) |
# import torch
# import torch.nn as nn
# import numpy as np
class NetworkFit(object):
def __init__(self, model, optimizer, soft_criterion):
self.model = model
self.optimizer = optimizer
self.soft_criterion = soft_criterion
def train(self, inputs, labels):
self.optimizer.zero_... |
#!/usr/bin/python3
def no_c(my_string):
newStr = ""
for i in range(len(my_string)):
if my_string[i] != "c" and my_string[i] != "C":
newStr += my_string[i]
return (newStr)
|
height = int(input())
for i in range(1, height + 1):
for j in range(1, height + 1):
if(i == 1 or i == height or j == 1 or j == height):
print(1,end=" ")
else:
print(0,end=" ")
print()
# Sample Input :- 5
# Output :-
# 1 1 1 1 1
# 1 0 0 0 1
# 1 0 0 ... |
class Trie(object):
def __init__(self):
self.root = TrieNode()
def add(self, word):
"""
Add `word` to trie
"""
current_node = self.root
for char in word:
current_node = current_node.children[char]
current_node.is_word = True
def exi... |
input = """
p(1) :- #count{X:q(X)}=1.
q(X) :- p(X).
"""
output = """
p(1) :- #count{X:q(X)}=1.
q(X) :- p(X).
"""
|
def _find_patterns(content, pos, patterns):
max = len(content)
for i in range(pos, max):
for p in enumerate(patterns):
if content.startswith(p[1], i):
return struct(
pos = i,
pattern = p[0]
)
return None
_find_endi... |
# Time: O(n)
# Space: O(n)
# 946
# Given two sequences pushed and popped with distinct values, return true if and only if this could have been the
# result of a sequence of push and pop operations on an initially empty stack.
# 0 <= pushed.length == popped.length <= 1000
# 0 <= pushed[i], popped[i] < 1000
# pushed i... |
# Desenvolva um program que leia 4 valores pelo teclado e guarde-os em uma tupla.
# no final mostre:
# a) quantas vezes apareceu o valor 9
# b) em que posição foi digitado o valor 3
# c) quais foram os números pares
n = (int(input('Digite um número: ')),
int(input('Digite outro número: ')),
int(input('Digite... |
def num_of_likes(names):
if len(names) == 0:
return 'no one likes this'
elif len(names) == 1:
return names[0] + ' likes this'
elif len(names) == 2:
return names[0] + ' and ' + names[1] + ' like this'
elif len(names) == 3:
return names[0] + ', ' + names[1] + ' and ' + nam... |
def singleton(theClass):
""" decorator for a class to make a singleton out of it """
classInstances = {}
def getInstance(*args, **kwargs):
""" creating or just return the one and only class instance.
The singleton depends on the parameters used in __init__ """
key = (theClass, a... |
"""
These are functions that create a sequence by adding the first number to the
second number and then adding the third number to the second, and so on.
"""
def fibonacci(n):
"""
This function assumed the first number is 0 and the second number is 1.
fibonacci(nth number in sequence you want returned)
... |
def is_none_us_symbol(symbol: str) -> bool:
return symbol.endswith(".HK") or symbol.endswith(".SZ") or symbol.endswith(".SH")
def is_us_symbol(symbol: str) -> bool:
return not is_none_us_symbol(symbol)
|
# table definition
table = {
'table_name' : 'adm_functions',
'module_id' : 'adm',
'short_descr' : 'Functions',
'long_descr' : 'Functional breakdwon of the organisation',
'sub_types' : None,
'sub_trans' : None,
'sequence' : ['seq', ['parent_id'], None],
'tree_para... |
#objetivo é criar um programa em que o usuário insere dois valores para a mensuração de operações diversas.
n1 = int(input('Digite um valor: '))
n2 = int(input('Digite outro valor: '))
s = n1+n2
m = n1*n2
d = n1/n2
di = n1//n2
e = n1**n2
print('A soma é: {}, o produto é: {} e a divisão é: {:.3f}'.format(s, m, d))
pri... |
# Commutable Islands
#
# There are n islands and there are many bridges connecting them. Each bridge has
# some cost attached to it.
#
# We need to find bridges with minimal cost such that all islands are connected.
#
# It is guaranteed that input data will contain at least one possible scenario in which
# all islands ... |
x=[2,25,34,56,72,34,54]
val=int(input("Enter the value you want to get searched : "))
for i in x:
if i==val:
print(x.index(i))
break
elif x.index(i)==(len(x)-1) and i!=val:
print("The Val u want to search is not there in the list")
|
# subsequence: a sequence that can be derived from another sequence by deleting one or more elements,
# without changing the order
# unlike substrings, subsequences are not required to occupy consecutive positions within the parent sequence
# so ACE is a valid subsequence of ABCDE
# find the length of the longest comm... |
"""Constants for the Purple Air integration."""
AQI_BREAKPOINTS = {
'pm2_5': [
{ 'pm_low': 500.5, 'pm_high': 999.9, 'aqi_low': 501, 'aqi_high': 999 },
{ 'pm_low': 350.5, 'pm_high': 500.4, 'aqi_low': 401, 'aqi_high': 500 },
{ 'pm_low': 250.5, 'pm_high': 350.4, 'aqi_low': 301, 'aqi_high': 400... |
# Input: arr[] = {1, 20, 2, 10}
# Output: 72
def single_rotation(arr,l):
temp=arr[0]
for i in range(l-1):
arr[i]=arr[i+1]
arr[l-1]=temp
def sum_calculate(arr,l):
sum=0
for i in range(l):
sum=sum+arr[i]*(i)
return sum
def max_finder(arr,l):
max=arr[0]
for i in range(l):... |
'''
Exercício Python 24:
Crie um programa que leia o nome de uma cidade diga se ela
começa ou não com o nome “SANTO”.
'''
cid = str(input('Em que cidade você nasceu? ')).strip()
print(cid[0:5].lower() == 'santo')
|
class UsageError(Exception):
"""Error in plugin usage."""
__module__ = "builtins"
|
"""Constants for the Nuvo Multi-zone Amplifier Media Player component."""
DOMAIN = "nuvo_serial"
CONF_ZONES = "zones"
CONF_SOURCES = "sources"
ZONE = "zone"
SOURCE = "source"
CONF_SOURCE_1 = "source_1"
CONF_SOURCE_2 = "source_2"
CONF_SOURCE_3 = "source_3"
CONF_SOURCE_4 = "source_4"
CONF_SOURCE_5 = "source_5"
CONF_SO... |
# Script will correct .hoc file from neuromorpho.org.
# In order to make the correction, same data is needed from
# Neuron's import3D tool.
# CNS-GROUP, Tampere University
def fix_commas(IMPORT3D_FILE, _3DVIEWER_FILE):
"""
This will correct commas, change "user7" to "dendrite"
and will seek "OrginalDen... |
def show_robot():
#常见错误:1.拼写错误 2.大小写错误 3.中文符号
#知识点:
#1.python程序是.py文件
#2.执行程序: python mai.py
#3.print是一个函数,用来打印输入
#4.要打印的内容成为参数,参数一定要放在括号里面
#5.字符串一定要用引号引起来,可以是单引号,也可以是双引号,还可以是三引号
#6.三引号括起来的字符串才可以换行,可以是3个单引号,也可以是3个双引号
#7.字符串可以通过+号来拼接。可以把字符串和变量拼接在一起。
print(''' \_/
(* *)
__)#(__
( )...( )(_... |
# program checks if the string is palindrome or not.
def function(string):
if(string == string[:: - 1]):
print("This is a Palindrome String")
else:
print("This is Not a Palindrome String")
string = input("Please enter your own String : ")
function(string)
|
#!/usr/bin/env python
# coding: utf8
""" Pythonic Redis backed data structure """
__version__ = '1.0.0'
__authors__ = 'Felix Voituret <felix@voituret.fr>'
|
_base_ = './deit-small_pt-4xb256_in1k.py'
# model settings
model = dict(
backbone=dict(type='DistilledVisionTransformer', arch='deit-base'),
head=dict(type='DeiTClsHead', in_channels=768),
)
# data settings
data = dict(samples_per_gpu=64, workers_per_gpu=5)
|
class Solution:
def findRestaurant(self, list1: List[str], list2: List[str]) -> List[str]:
h = {v: i for i, v in enumerate(list1)}
result = []
m = inf
for i, v in enumerate(list2):
if v in h:
r = h[v] + i
if r < m:
m = r... |
#
# This helps us not have to pass so many things (caches, resolvers,
# transcoders...) around by letting us set class properties on the IIIFRequest
# at startup. Here's a basic example of how this pattern works:
#
# >>> class MyMeta(type): # Note we subclass type, not object
# ... _something = None
# ... def _... |
def anderson_iteration(X, U, V, labels, p, logger):
def multi_update_V(V, U, X):
delta_V = 100
while delta_V > 1e-1:
new_V = update_V(V, U, X, epsilon)
delta_V = l21_norm(new_V - V)
V = new_V
return V
V_len = V.flatten().shape[0]
mAA = 0
V... |
"""Set metadata for chat-downloader"""
__title__ = 'chat-downloader'
__program__ = 'chat_downloader'
__summary__ = 'A simple tool used to retrieve chat messages from livestreams, videos, clips and past broadcasts. No authentication needed!'
__author__ = 'xenova'
__email__ = 'admin@xenova.com'
__copyright__ = '2020, 20... |
def move(cc, order, value):
if order == "N":
cc[1] += value
if order == "S":
cc[1] -= value
if order == "E":
cc[0] += value
if order == "W":
cc[0] -= value
return cc
def stage1(inp):
direct = ["S", "W", "N", "E"]
facing = "E"
current_coord = [0, 0]
... |
A = int(input('Enter the value of A: '))
B = int(input('Enter the value of B: '))
#A = int(A)
#B = int(B)
C = A
A = B
B = C
print('Value of A', A, 'Value of B', B)
|
# Input:
# 1
# 8
# 1 2 2 4 5 6 7 8
#
# Output:
# 2 1 4 2 6 5 8 7
def pairWiseSwap(head):
if head == None or head.next == None:
return head
prev = None
cur = head
count = 2
while count > 0 and cur != None:
temp = cur.next
cur.next = prev
prev = cur
cur = te... |
#!/usr/bin/env python
#
# Test function for sct_dmri_concat_b0_and_dwi
#
# Copyright (c) 2019 Polytechnique Montreal <www.neuro.polymtl.ca>
# Author: Julien Cohen-Adad
#
# About the license: see the file LICENSE.TXT
def init(param_test):
"""
Initialize class: param_test
"""
# initialization
defaul... |
a = 5 > 3
b = 5 > 4
c = 5 > 5
d = 5 > 6
e = 5 > 7
|
names = []
startingletter = ""
# Open file and getting all names from it
with open("./Input/Names/invited_names.txt") as file:
for line in file:
names.append(line.strip())
# Getting the text from the starting letter
with open("./Input/Letters/starting_letter.txt") as file:
startingletter = file.read()... |
def Counting_Sort(A, k=-1):
if(k==-1): k=max(A)
C = [0 for x in range(k+1)]
for x in A: C[x]+=1
for x in range(1, k+1):C[x]+=C[x-1]
B = [0 for x in range(len(A))]
for i in range(len(A)-1, -1, -1):
x = A[i]
B[C[x]-1] = x
C[x]-=1
return B
A = [13,20,18,20,12,15,7]
print(Counting_Sort(A))
|
class Solution:
def minWindow(self, s: str, t: str) -> str:
target, window = defaultdict(int), defaultdict(int)
left, right, match = 0, 0, 0
d = float("inf")
for c in t:
target[c] += 1
while right < len(s):
c = s[right]
if c in target:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.