content stringlengths 7 1.05M |
|---|
"""Flow - Algorithmic HF trader
Copyright 2016, Yazan Obeidi
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 ap... |
def py35():
return [
('MacOS', 'https://www.python.org/ftp/python/3.5.3/python-3.5.3-macosx10.6.pkg', 'python/python-3.5.3-macosx10.6.pkg'), # noqa
('Windows (64-bit)', 'https://www.python.org/ftp/python/3.5.3/python-3.5.3-amd64.exe', 'python/python-3.5.3-amd64.exe'), # noqa
('Windows (32... |
palavra=input("Digite a palavra chave: ").upper()
palavra_chave=[]
forca=[]
for i in palavra:
palavra_chave.append(i)
for i in range(0,len(palavra_chave)):
forca.append("_")
acertou=False
while acertou==False:
letra=input("digte um litra: ").upper()
for i in range (0,len(palavra_chave)):
... |
class Block:
id = ""
name = "Block Name"
icon = ""
component = "BasicBlock"
disable_scrubbing = False
empty_msg = "No content."
has_sections = False
def __init__(self, tab, handler, options={}):
# tab which holds the block
self.tab = tab
self.handler = handler
... |
dados = {}
dados['Nome'] = input('Nome: ')
dados['media'] = float(input('Média: '))
print('-+-' * 20)
if dados['media'] >= 7:
dados['situação'] = 'APROVADO'
elif 5 <= dados['media'] < 7:
dados['situação'] = 'RECUPERAÇÃO'
else:
dados['situação'] = 'REPROVADO'
for k, v in dados.items():
print(f'{k} é i... |
a, b = map(int, input().split())
s = list(map(int, input().split()))
b = list(map(lambda x: bool(int(x)), bin(b)[2:]))[::-1]
t = 0
for i in range(len(b)):
if b[i]:
t += s[i]
print(t)
|
class WykopAPIClientError(Exception):
"""Base Wykop client API exception."""
pass
class NamedParameterNone(WykopAPIClientError):
pass
class ApiParameterNone(WykopAPIClientError):
pass
class InvalidWykopConnectSign(WykopAPIClientError):
pass
|
class Proxy(object):
def __init__(self, inner):
object.__setattr__(
self,
"_obj",
inner
)
#
# proxying (special cases)
#
def __getattribute__(self, name):
value = getattr(object.__getattribute__(self, "_obj"), name)
if callable(val... |
b={}
m={}
d=n=x=y=t=0
s=open(0)
while 1:
if t:x,y,n,t=b[d]
n=m[x,y]=min(m.get((x,y),9e9),n);c=s.read(1)
if c=='$':break
if c=='(':d+=1;b[d]=x,y,n,0
d-=c==')';t=c=='|';y+={'N':1,'S':-1}.get(c,0);x+={'E':1,'W':-1}.get(c,0);n+=1
p=print
v=m.values()
p(max(v))
p(sum(x>999 for x in v))
|
class Node:
def __init__(self, name):
self.name = name
self.triggered = False
self.parents = []
self.child_nodes = []
def add_child(self, child):
if child in self.child_nodes:
return
child.add_parent(self)
self.child_nodes.append(child)
... |
__log_debug__ = True
def debug(obj):
if __log_debug__:
print(obj)
|
class Solution:
def isValid(self, s: str) -> bool:
replace = True
while replace:
start_len = len(s)
for inner in ['{}', '()', '[]']:
s = s.replace(inner, '')
if start_len == len(s):
replace = False
return s == '' |
"""
WITH summary AS (
SELECT
node_id,
title,
ctype,
page_num,
page_rank,
page_highlight,
ROW_NUMBER() OVER(
PARTITION BY
subq.node_id ORDER BY subq.page_rank DESC,
subq.page_... |
length1 = int(input("Enter the length of room1: "))
width1 = int(input("Enter the width of room1: "))
length2 = int(input("Enter the length of room2: "))
width2 = int(input("Enter the width of room2: "))
area1 = width1*length1
area2 = width2*length2
total = area1 + area2
print("The total area of two rooms is: ", total)... |
def test_sync_host_network_backend_without_ifaces(host, add_host, revert_etc):
# test should pass as sync host network ignores backends without networking
result = host.run('stack sync host network')
assert result.rc == 0
def test_sync_host_network_frontend_only(host, revert_etc):
result = host.run('stack sync hos... |
class Event:
def __init__(self, event_type, target, source, **kwargs):
self._type = event_type
self._target = target
self._source = source
self._kwargs = kwargs
@property
def kwargs(self):
return self._kwargs
@property
def source(self):
return self.... |
"""
File: anagram.py
Name: Albert
----------------------------------
This program recursively finds all the anagram(s)
for the word input by user and terminates when the
input string matches the EXIT constant defined
at line 19
If you correctly implement this program, you should see the
number of anagrams for each wor... |
"""
Recently I had a visit with my mom and we realized that the two digits that make up my
age when reversed resulted in her age. For example, if she's 73, I'm 37. We wondered how
often this has happened over the years but we got sidetracked with other topics and we
never came up with an answer.
When I got home I f... |
symbolMap = {"crypto": [
{"symbol": "BTC", "name": "bitcoin", "id": "bitcoin"},
{"symbol": "ETH", "name": "ethereum", "id": "ethereum"},
{"symbol": "ADA", "name": "cardano", "id": "cardano"}
],
"fiat": [
{"symbol": "USDT", "name": "us dollars", "id": "tether"}
]}
|
def start_tutorial(user_id, ref = None):
send_sticker(user_id, 'CAADAgADWgADP1c0GpzyckP3XK1hAg')
if ref:
db.change_ref(user_id, ref)
text = '`Приветствую тебя, путешественник. Рад видеть тебя, готового к приключениям. Кто знает, какая судьба тебя ждёт? Станешь ли ты великим воином, или сдашься и пад... |
def hello():
print("Hello world ")
return "Hello world"
hello()
|
# Flask
DEBUG = True
# Change this when not testing >.> You know how.
SECRET_KEY = "Aaxus"
SECRET_KEY = "AaxusJWT"
SECURITY_PASSWORD_SALT = "I_Love_Candy"
# Database
# MONGODB_DB = 'aaxusdb'
# MONGODB_HOST = 'localhost'
# MONGODB_PORT = 27017
# MONGODB_USER = 'aaxus'
# MONGODB_PASSWORD = 'aaxus'
# Database Mock
MONG... |
class Date:
def __init__(self, strDate):
strDate = strDate.split('.')
self.day = strDate[0]
self.month = strDate[1]
self.year = strDate[2]
|
"""
Problem Statement:
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
"""
class TwoSum(object):... |
# - * - coding:utf-8 - * -
def cut(address, tup):
for item in tup:
if len(address.split(item, 1)) > 1:
return address.split(item, 1)[0] + item, address.split(item, 1)[1]
return address, address
def address_split(address):
try:
first_class, second = cut(address, ('省', '自治区', '行... |
class Rotation(object):
def __init__(self,yaw=0,roll=0,pitch=0):
self.yaw = yaw
self.roll = roll
self.pitch = pitch
class Location(object):
def __init__(self,x,y,z):
self.x = x
self.y = y
self.z = z
class Transform(object):
def __init__(self,rotation,locatio... |
a=int(input())
for i in range(a):
b=list(map(int,input().split(" ")))
c=0
x=abs(b[c]-b[c+2])
y=abs(b[c+1]-b[c+2])
if(x>y):
print("Police2")
if(x<y):
print("police1")
if(x==y):
print("Both")
|
def swap(arr, index_1, index_2):
temp = arr[index_1]
arr[index_1] = arr[index_2]
arr[index_2] = temp
def bubble_sort_unoptimized(arr):
for el in arr:
for index in range(len(arr) - 1):
if arr[index] > arr[index + 1]:
swap(arr, index, index + 1)
def bubble_sort_optimized(arr):
for i in r... |
class UnauthorizedException(Exception):
pass
class BadRequestException(Exception):
pass
class NotFoundException(Exception):
pass
class RedirectException(Exception):
pass
class ServerErrorException(Exception):
pass
class UnexpectedException(Exception):
pass
class LocationHeaderNotFoun... |
#
# PySNMP MIB module HPN-ICF-CATV-TRANSCEIVER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-CATV-TRANSCEIVER-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:25:13 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python vers... |
'''
Defines quality control settings for different variables
- Section 1 defines ranges for different variables
- Section 2 associated a name with the range
'''
#-------------- Section 1 -------------#
#Test ranges
#Units - N/A
#Ref - XXXX
testVar = {
'good':{
'range':[(0,5),(14,16)],
'rate':[(0,1... |
'''doctest looks for lines beginning with
the interpreter prompt, >>>, to find the beginning of a test case
'''
#python -m doctest -v example7-doctest.py
def my_function(a, b):
"""
>>> my_function(2, 3)
6
>>> my_function('a', 3)
'aaa'
"""
return a * b |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
LABEL_DIRECTORY = 'label' # 'relabel'
IMAGE_DIRECTORY = '.*wsi.*'
LABEL_DIRECTORIES = [
'label',
'relabel',
]
LABEL_FILENAME = 'label.tiff'
MASKED_IMAGE_FILENAME = 'masked.tiff'
# Constants representing the setting keys for this plugin
class PluginSettings(objec... |
def set_referenced_values(self,jc):
print('--tablename>',self.name,self.referencing_columns)
# if self.name == 'lic__products':
# tbl_idx= next((i for i, item in enumerate(jc.tables) if item.name == "prod__packs"), -1)
# print('-->',jc.tables[tbl_idx].current_row)
#print(self.name,self.refer... |
#!/usr/bin/env python
u"""
TRIAL.py
Written Chia-Chun Liang (11/2021)
"""
|
# --
# Copyright (c) 2008-2021 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
# --
"""Variables with a functional interface:
- ``v()`` -- return the value of ``v``
- ``v(x)``... |
"""
.. module:: experiment.__init__
:synopsis: This package is intended to contain everything that has to do
with the experimental results.
"""
|
# Imprime os numeros de 0 a 19
print('Imprime os numeros de 0 a 5 ')
for x in range (5):
print(x)
print('\n')
# Verificar se o numero digitado pelo usuario é um numero primo
print('Verificar se o numero digitado pelo usuario é um numero primo ')
a = int (input ('Digite um número: '))
div = 0
for x in range (1, ... |
"""
curso Python 3 - Exercício Python #003
crie um programa que leia dois numeros e mestre a soma entre eles
19.10.2020 - Felipe Ferreira de Aguiar
"""
number_1 = float(input('Digite o primeiro número: '))
number_2 = float(input('Digite o segundo número: '))
sum = number_1 + number_2
print('A soma de {} co... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"say_hello": "00_hello.ipynb"}
modules = ["hello.py"]
doc_url = "https://seanczak.github.io/torch_series_blog/"
git_url = "https://github.com/seanczak/torch_series_blog/tree/master/"
def custom_doc_links(... |
v = float(input('Qual é a velocidade atual do carro: '))
if v > 80:
print('\033[31m MULTADO! Você excedeu o limite permitido que é de 80Km/h\033[m')
print('Você deve pagar uma multa de R$ {:.2f}'.format((v - 80) * 7))
print('\033[32mTenha um bom dia! Dirija com segurança!\033[m ') |
buf = """const LOGIN_PACKET = 0x8f;
const PLAY_STATUS_PACKET = 0x90;
const DISCONNECT_PACKET = 0x91;
const BATCH_PACKET = 0x92;
const TEXT_PACKET = 0x93;
const SET_TIME_PACKET = 0x94;
const START_GAME_PACKET = 0x95;
const ADD_PLAYER_PACKET = 0x96;
const REMOVE_PLAYER_PACKET = 0x97;
c... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class SplitSynonymClass():
"""Split Synonym class.
This class is split synonym
"""
def __init__(self, data):
"""
Args:
data (list): input the word net data.
"""
self.__data = data
self.__all_dict = {}
... |
class Solution:
def findDuplicate(self, nums: List[int]) -> int:
for i in range(0,len(nums)):
if(nums[abs(nums[i])]<0):
return abs(nums[i])
else:
nums[abs(nums[i])] = -nums[abs(nums[i])]
|
# encoding=utf-8
'''
random_bits = 0
for i in range(64):
if randint(0,1):
random_bits |=1 << i
'''
flavor_list = ['vanlila', 'chocolate', 'pecan', 'strawberry']
for flavor in flavor_list:
print('%s is delicious' % flavor)
for i in range(len(flavor_list)):
flavor = flavor_list[i]
print('%d:%s' % (i + 1, flavor)... |
"""
Protocol-related functions go here
"""
def generate_post_material(
openbp_version,
post_key,
hyperlinks,
hyperlinks_content_size,
hyperlinks_content_type,
hyperlink_content_checksum,
other_post_key,
other_checksum,
**kwargs):
# There are... |
'''
XlPy/matched/Proteome_Discoverer
________________________________
Utilities to parse Proteome Discoverer file formats and export formats.
Proteome Discoverer is a trademark of Thermo Scientific and
is not affiliated with nor endorse XL Discoverer.
Their website can be found here:
h... |
# --------------------------------------------------------------------------------------------------
# jinja2-live: thin custom filters
#
# To create new custom filters:
# just add the function code and docstring in this file
# parser.py will import this file and add the function names and explanation into the HTML ... |
# Python - 3.6.0
test.assert_equals(len(websites), 1000)
test.assert_equals(type(websites), list)
test.assert_equals(list(set(websites)), ['codewars'])
|
notes=[0]*10
while True:
command=input()
if command!="End":
tokens=command.split("-")
priority=int(tokens[0])-1
note=tokens[1]
notes.pop(priority)
notes.insert(priority, note)
else:
break
res=[element for element in notes if element != 0]
print(res... |
class F:
def f(x):
x: int = 42
# EXPECTED:
[
~SETUP_ANNOTATIONS(0),
]
|
class CONST():
Ok = 0
UnKnown = 1000
TimeOutError = 1001
NoUser = 2000
UserRepeat = 2001
AuthenticationField = 2002
UpdateField = 2003
LogField = 2004
NoMore = 2005
FileInvalid = 3000
DeviceError = 4000
def __setattr__(self,*_):
pass
|
n = int(input())
i = s = 1
while s < n:
s += 6 * i
i += 1
print(i)
|
# A program to increment a string by 1
data = "1foobar001"
def increment_string(strng):
strngSplit = list(strng)
for i in range(len(strng)):
if not str.isdigit(strngSplit[i]):
strngSplit.append("1")
return strngSplit
print(increment_string(data))
|
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def bstToGst(self, root: TreeNode) -> TreeNode:
s = 0
def traverse(node):
nonlocal s
if not node:
... |
data = (
'Yun ', # 0x00
'Bei ', # 0x01
'Ang ', # 0x02
'Ze ', # 0x03
'Ban ', # 0x04
'Jie ', # 0x05
'Kun ', # 0x06
'Sheng ', # 0x07
'Hu ', # 0x08
'Fang ', # 0x09
'Hao ', # 0x0a
'Gui ', # 0x0b
'Chang ', # 0x0c
'Xuan ', # 0x0d
'Ming ', # 0x0e
'Hun ', # 0x0f
'Fen ', # 0x10
... |
def bool_env(val):
"""Replaces string based environment values with Python booleans"""
return True if os.environ.get(val, False) == 'True' else False
DEBUG = bool_env('DEBUG')
TEMPLATE_DEBUG = DEBUG
|
# {{ cookiecutter.project_slug }}/__init__.py
"""
{{ cookiecutter.project_short_description }}
"""
__version__ = "{{ cookiecutter.version }}"
__title__ = "{{ cookiecutter.project_name }}"
__description__ = "{{ cookiecutter.project_short_description }}"
__uri__ = "{{ cookiecutter.project_url }}"
__author__ = "{{ cooki... |
weather = input("오늘 날씨는 어떤가요 ?")
if weather=="미세먼지" or weather=="눈" :
print("마스크를 챙기세요")
elif weather=="비":
print("우산을 챙기세요")
else :
print("준비물이 필요 없습니다.")
temp = int(input("기온은 어떤가요? "))
if temp>=30 :
print("굉장히 덥네요")
elif 10<temp and temp <30 :
print("적당하네요")
else :
print("외투를 챙기세요") |
def bintang(n):
space = 2*n-1
for i in range(n):
print(('*'*(2*i+1)).center(space))
bintang(7)
|
#
# @lc app=leetcode.cn id=88 lang=python3
#
# [88] 合并两个有序数组
#
# https://leetcode-cn.com/problems/merge-sorted-array/description/
#
# algorithms
# Easy (42.69%)
# Total Accepted: 32.5K
# Total Submissions: 75.3K
# Testcase Example: '[1,2,3,0,0,0]\n3\n[2,5,6]\n3'
#
# 给定两个有序整数数组 nums1 和 nums2,将 nums2 合并到 nums1 中,使得 n... |
'''
Rip Genie Ops Object Outputs for IOSXE.
'''
class RipOutput(object):
ShowVrfDetail = {
"Mgmt-vrf": {
"vrf_id": 1,
"interfaces": [
"GigabitEthernet0/0"
],
"address_family": {
"ipv4 unicast": {
"table_i... |
# Given an array of integers A, We need to sort the array performing a series of pancake flips.
# In one pancake flip we do the following steps:
# Choose an integer k where 0 <= k < A.length.
# Reverse the sub-array A[0...k].
# For example, if A = [3,2,1,4] and we performed a pancake flip choosing k = 2,
# we reverse ... |
sm.setSpeakerID(1102102)
if sm.sendAskYesNo("Did you enjoy the drink? You better have! It is the special concoction of my people, the Piyo Tribe!\r\nNow... Pop quiz! Do you remember how to fight? Defeat 3 #o9300730# monsters and bring me 3 #t4000489# items!"):
sm.removeEscapeButton()
sm.sendNext("What do you m... |
first = set([int(x) for x in input().split()])
second = set([int(x) for x in input().split()])
n = int(input())
for _ in range(n):
command = input().split()
cmd = command[0]
sequence = command[1]
if cmd == "Add":
numbers = [int(x) for x in command[2:]]
if sequence == "First":
... |
"""
Version of iaesdk
"""
__version__ = '1.1.1'
|
def binary_search(array: list, elem: object) -> int or None:
"""Binary Search is only used on sorted Array.
If element is present in the list then it will return the index of that element else it will return None
Args:
array (list): list of elements
elem (object): element that we want to se... |
def make_bricks(small, big, goal):
if goal >(small + 5*big):
return False
else:
return ((goal%5)<=small)
|
'''
Determine if a 9 x 9 Sudoku board is valid.
Only the filled cells need to be validated according to the following rules:
Each row must contain the digits 1-9 without repetition.
Each column must contain the digits 1-9 without repetition.
Each of the nine 3 x 3 sub-boxes of the grid must contain the digits 1... |
class NetApp_OCUM_Settings(object):
"""
Class object for storing API connection settings.
"""
def __init__(self, **kwargs):
self.api_host = kwargs.get('api_host')
self.api_user = kwargs.get('api_user')
self.api_password = kwargs.get('api_password')
self.api_port ... |
def foo():
pass
def bar():
a = 'a'
b = 'b'
|
"""
Write a Python program to convert a string in a list.
"""
sample_string = "The quick brown fox jumps over the lazy dog."
list1 = sample_string.split()
print(list1) |
# This file was automatically generated from "alwaysLandLevel.ma"
points = {}
boxes = {}
boxes['areaOfInterestBounds'] = (-1.045859963, 12.67722855, -5.401537075) + (0.0, 0.0, 0.0) + (34.46156851, 20.94044653, 0.6931564611)
points['ffaSpawn1'] = (-9.295167711, 8.010664315, -5.44451005) + (1.555840357, 1.453808816, 0.11... |
# https://leetcode.com/problems/counting-bits/
class Solution:
def countBits(self, num: int) -> [int]:
# return self.solution1(num)
return self.solution2(num)
# Time: O(n * sizeOf(int))
def solution1(self, num):
return list(map(lambda i: bin(i).count("1"), range(0, num + 1)))
... |
# -*- coding: utf-8 -*-
def main():
t = int(input())
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
count = 0
i = 0
j = 0
while i < n:
if j >= m:
break
if a[i] <= b[j] <= a[i] ... |
# Split into all the possible subset of an array can be either number of string
print("----------INPUT----------")
# For arrays
str_arr = input('Enter array of integers: ').split(' ')
arr = [int(num) for num in str_arr]
# For strings
# str_arr = input('Enter array of strings: ')
# arr = str_arr
# print("----------DP... |
def fras(f):
tam = len(f)
print("-"*tam)
print(f)
print("-"*tam)
frase = str(input("Digite uma frase: "))
fras(frase)
|
# ex-076 - Lista de preços com tuplas
print(f'{"MATERIAIS":-^39}')
lista = ('Lápis', 1.75,
'Borracha', 2,
'Caderno', 15.9,
'Estojo', 25,
'Transferidor', 4.2,
'Compasso', 9.00,
'Mochila', 120.9,
'Caneta', 2.3,
'Livro', 34.9)
for l in range(len(list... |
"""
MIT License
Copyright (c) 2021 AWS Cloud Community LPU
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIA... |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class AlertDocument(object):
"""Implementation of the 'AlertDocument' model.
Specifies documentation about the Alert such as name, description, cause
and how to resolve the Alert.
Attributes:
alert_cause (string): Specifies cause of the... |
# 6. Реализовать функцию int_func(), принимающую слово из маленьких латинских букв
# и возвращающую его же, но с прописной первой буквой. Например, print(int_func(‘text’)) -> Text.
# Продолжить работу над заданием.
# В программу должна попадать строка из слов, разделенных пробелом.
# Каждое слово состоит из латинских б... |
def show_messages(messages):
print("Printing all messages")
for message in messages:
print(message)
def send_messages(messages,sent_messages):
while messages:
removed_messages = messages.pop()
sent_messages.append(removed_messages)
print(sent_messages)
|
ID_PREFIX = "imvdb"
SITE_URL = "https://imvdb.com"
API_URL = "https://imvdb.com/api/v1"
COUNTRIES = {
"United States": "us",
"United Kingdom": "gb",
"Angola": "ao",
"Antigua And Barbuda": "ag",
"Argentina": "ar",
"Aruba": "aw",
"Australia": "au",
"Austria": "at",
"Bahamas": "bs",
... |
class Solution:
def longestPalindrome(self, s: str) -> str:
'''
O(n2) solution
'''
def getLength(s, l, r):
while l >= 0 and r < len(s) and s[l] == s[r]:
l -= 1
r += 1
return r - l - 1
max_len = 0
... |
'''
Created on Sep 8, 2010
@author: Wilder Rodrigues (wilder.rodrigues@ekholabs.nl)
'''
'''
PBean (what I call Python Bean) Coordinates.
'''
class Coordinates():
def __init__(self, lat, long):
'''
Class constructor.
'''
self.lat = lat
self.long = long
... |
a=int(input("Enter value of a"))
b=int(input("Enter value of b"))
print("Value of a " + str(a))
print("Value of b " + str(b))
temp=a
a=b
b=temp
print("Value of a " + str(a))
print("Value of b " + str(b))
|
# Uses python3
def calc_fib_last_digit(n):
fib_nums_last_dig = []
fib_nums_last_dig.append(0)
fib_nums_last_dig.append(1)
for i in range(2, n + 1):
fib_nums_last_dig.append((fib_nums_last_dig[i - 1] + fib_nums_last_dig[i - 2]) % 10)
return fib_nums_last_dig[n]
n = int(input())
print(calc_f... |
# Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Tests for shared flocker components.
"""
|
"""
git status info manipulate
"""
def status_manipulate(msg):
unmerged_files = []
modified_files = []
deleted_files = []
added_files = []
unmerged_tag = "both modified:"
modified_tag = "modified:"
deleted_tag = "deleted:"
added_tag = "Untracked files:"
end_tag = "no changes added"
#msg = msg.replace("\n"... |
# Extremamente Básico
a=int(input())
b=int(input())
x=a+b
print('X =',x)
|
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# 新增插件的话,请在这里手动添加
# 也许应该自动查找插件
def register_all(cmds):
cmds.register_builtin()
# cmds.register(YourSelfPlugin)
|
_base_ = "./resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO_01_02MasterChefCan.py"
OUTPUT_DIR = (
"output/gdrn/ycbvPbrSO/resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO/04_05TomatoSoupCan"
)
DATASETS = dict(TRAIN=("ycbv_005_tomato_soup_can_train_pbr",))
|
def capitalizeWord(word):
c= word[0].upper()+word[1:]
return c
def capitalizeWord1(word):
return word[0].upper() + word[1:] |
print("Hello! Running this after a connection is stablished.")
## Example: get files generated in remote host during the session:
"""
remote_origin = "/home/vagrant/.xxh/.xxh/shells/xxh-shell-xonsh/build/../../../../.local/share/xonsh/my_data"
local_destination = "/my_directory"
bash_wrap_begin = "bash -c 'shopt -s d... |
length=int(input())
list1=list(map(int,input().rstrip().split()))
list1=sorted(list1)
list1=list1[::-1]
count=0
for i in range(length):
a=count+(list1[i]*(2**i))
count=a
print(a)
|
# (*) Burocracia
def nome():
return ...
def dre():
return ...
def meu_arquivo():
ls = ["p2", str(dre()), str(nome())] # meus dados
s1 = str.join(" ", ls) # coloque um espaço entre eles
s2 = str.replace(s1, " ", "_")
print(s2 + ".py")
# Obrigado!
# (*) Questão 1
#
# Você vai escrever três procedimentos... |
# https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html
KEYWORDS = (
# Keywords used in declarations:
'associatedtype', 'class', 'deinit', 'enum', 'extension', 'fileprivate',
'func', 'import', 'init', 'inout', 'internal', 'let', 'open', 'operator',
'private', 'precedencegroup', 'protoc... |
#!/usr/bin/env python
x = 25
def printer():
x = 50
return x
print(x)
print(printer())
# LEGB Rule
# L: Local — Names assigned in any way within a function (def or lambda), and not declared global in that function.
# lambda num: num ** 2
# E: Enclosing function locals — Names in the local scope of any a... |
header, *data = DATA
result = []
for row in data:
pair = zip(header, row)
result.append(dict(pair))
|
# 此处可 import 模块
"""
@param string line 为单行测试数据
@return string 处理后的结果
"""
def solution(line):
# 缩进请使用 4 个空格,遵循 PEP8 规范
# please write your code here
# return 'your_answer'
nums, num = line.strip().split(' ')
nums = nums.split(',')
if num in nums:
return nums.index(num)
else:
return -... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.