content stringlengths 7 1.05M |
|---|
class R1DataCheckSpecificDto:
def __init__(self, id_r1_data_check_specific=None, init_event=None, end_event=None, init_pixel=None, end_pixel=None,
init_sample=None, end_sample=None,
init_subrun=None, end_subrun=None, type_of_gap_calc=None, list_of_module_in_detail=None):
s... |
def takethis():
fullspeed()
i01.moveHead(14,90)
i01.moveArm("left",13,45,95,10)
i01.moveArm("right",5,90,30,10)
i01.moveHand("left",2,2,2,2,2,60)
i01.moveHand("right",81,66,82,60,105,113)
i01.moveTorso(85,76,90)
sleep(3)
closelefthand()
i01.moveTorso(110,90,90)
sleep(2)
isitaball()
i01.mouth.s... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2019-05-18 23:29:05
# @Author : Ivy Mong (davy0328meng@gmail.com)
arr1 = [1, 3, 4, 6, 10]
arr2 = [2, 5, 8, 11]
ind = 0
ans = arr1.copy()
for i in range(len(arr2)):
while ind < len(arr1):
if arr2[i] <= arr1[ind]:
ans.insert(ind+i, ar... |
print('Dratuti!')
print('Hello!')
print('Hello, Georgios!')
print('Hello, Pupa!')
|
# Copyright (C) 2018 Google Inc.
#
# 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... |
DEBUG = True
SECRET_KEY = "iECgbYWReMNxkRprrzMo5KAQYnb2UeZ3bwvReTSt+VSESW0OB8zbglT+6rEcDW9X"
SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:999999@127.0.0.1:3306/fisher"
|
class RebarContainerItem(object,IDisposable):
""" Provides implementation for Rebar stored in RebarContainer. """
def CanApplyPresentationMode(self,dBView):
"""
CanApplyPresentationMode(self: RebarContainerItem,dBView: View) -> bool
Checks if a presentation mode can be applied for this rebar in the ... |
def test_shib_redirect(client, app):
r = client.get("/login/shib")
assert r.status_code == 302
def test_shib_login(app, client):
r = client.get(
"/login/shib/login", headers={app.config["SHIBBOLETH_HEADER"]: "test"}
)
assert r.status_code == 200
def test_shib_login_redirect(app, client):... |
siblings = int(input())
popsicles = int(input())
#your code goes here
if((popsicles % siblings)==0):
print("give away")
else:
print("eat them yourself")
|
# encoding: utf-8
# module System.Text calls itself Text
# from mscorlib,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089,System,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089
# by generator 1.145
# no doc
# no imports
# no functions
# classes
class Encoding(object,ICloneable... |
E = str(input("Digite a expressão: "))
P = []
for S in E:
if S == "(":
P.append("(")
elif S == ")":
if len(P) > 0:
P.pop()
else:
P.append(")")
break
if len(P) == 0:
print("Sua expressão é válida!!")
else:
print("Sua expressão é invalida!!") |
"""
* Assignment: Exception Raise One
* Required: yes
* Complexity: easy
* Lines of code: 2 lines
* Time: 3 min
English:
1. Validate value passed to a `result` function:
a. If `value` is less than zero, raise `ValueError`
2. Non-functional requirements:
a. Write solution inside `result` functio... |
class Solution:
def minMeetingRooms(self, intervals: List[List[int]]) -> int:
minHeap = [] # store end times of each room
for start, end in sorted(intervals):
if minHeap and start >= minHeap[0]:
heapq.heappop(minHeap)
heapq.heappush(minHeap, end)
return len(minHeap)
|
class custom_range:
def __init__(self, start, end, step=1):
self.start = start
self.end = end
self.step = step
self.increment = 1
if self.step < 0:
self.start, self.end = self.end, self.start
self.increment = -1
def __iter__(self):
return... |
digits = "0123456789abcdefghijklmnopqrstuvwxyz"
def baseN(num,b):
return (((num == 0) and "0" )
or ( baseN(num // b, b).lstrip("0")
+ digits[num % b]))
# alternatively:
def baseN(num,b):
if num == 0: return "0"
result = ""
while num != 0:
num, d = divmod(num, b)
result += d... |
class Event:
""" The base for all Lavalink events. """
pass
class QueueEndEvent(Event):
""" This event is dispatched when there are no more songs in the queue. """
def __init__(self, player):
self.player = player
class TrackStuckEvent(Event):
""" This event is dispatched when the current... |
class Counter:
"This is a counter class"
def __init__(self):
self.value = 0
def increment(self):
"Increments the counter"
self.value = self.value + 1
def decrement(self):
"Decrements the counter"
self.value = self.value - 1 |
# Find Fractional Number
# https://www.acmicpc.net/problem/1193
n = int(input())
i = 1
while True:
sums = int((1 + i) * i * 0.5)
if sums >= n:
if (i%2) == 0:
x = i - (sums - n)
y = (sums - n) + 1
else:
x = (sums - n) + 1
y = i - (sums - n)
... |
def for_l():
for row in range(6):
for col in range(4):
if col==1 and row<5or (row==5 and (col==0 or col==2 or col==3)) :
print("*",end=" ")
else:
print(" ",end=" ")
print()
def while_l():
row=0
while row<6:
col=0
... |
#
# 120. Triangle
#
# Q: https://leetcode.com/problems/triangle/
# A: https://leetcode.com/problems/triangle/discuss/38726/Kt-Js-Py3-Cpp-The-ART-of-Dynamic-Programming
#
# TopDown
class Solution:
def minimumTotal(self, A: List[List[int]]) -> int:
N = len(A)
def go(i = 0, j = 0):
if i ==... |
def remove_duplicates_v2(arr):
dedupe_arr = []
for i in arr:
if i not in dedupe_arr:
dedupe_arr.append(i)
return dedupe_arr
result = remove_duplicates([0,0,0,1,1,2,2,3,4,5])
print(result)
|
dimensions = (200, 50)
print(dimensions[0])
print(dimensions[1])
for dimension in dimensions:
print(dimension)
|
class Config():
def __init__(self):
pass
def to_dict(self):
res_dict = dict()
for key, value in self.__dict__.items():
if isinstance(value, Config):
res_dict.update(value.to_dict())
else:
res_dict[key] = value
return res_di... |
def lazy(func):
fnattr = "__lazy_" + func.__name__
@property
def wrapper(*args, **kwargs):
if not hasattr(func, fnattr):
setattr(func, fnattr, func(*args, **kwargs))
return getattr(func, fnattr)
return wrapper
|
#def recursion():
#return recursion()
#def factorial(n):
# rslt = n
# for i in range(1, n):
# rslt *= i
# return rslt
"""
def factorial(n):
if n == 1:
return 1
else:
return n * factorial(n-1)
print(factorial(3))"""
"""
def pow(x, n):
rslt = 1
for i in range(n):
rslt *= x
return rslt
print(pow(3, 2))"""
... |
class Profiles(object):
"""
A class to manage V2 API's for AirWatch Profiles Management
"""
def __init__(self, client):
self.client = client
def search(self, **kwargs):
"""
Returns the Profile information matching the search parameters.
/api/mdm/profiles/search?{pa... |
"""
Given an integer number n, define a function named printDict() which can print a dictionary where the keys are numbers between 1 and n (both included) and the values are square of keys.
The function printDict() doesn't take any argument.
Input Format:
The first line contains the number n.
Output Format:
Print t... |
class Solution(object):
def singleNumber(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
xor = 0
for num in nums:
xor ^= num
xor = xor & -xor
a, b = 0, 0
for num in nums:
if num & xor:
... |
#
# PySNMP MIB module CXFrameRelay-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXFrameRelay-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:17:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... |
# Note that this file is multi-lingual and can be used in both Python
# and POSIX shell.
# This file should define a variable VERSION which we use as the
# debugger version number.
VERSION = '2.9.0'
|
"""
This module calculate Jaccard's distance score
parameters:
x : (numpy array) first string sequence
y : (numpy array) second string sequence
return:
(float) : Jaccard's distance socre (1 - Jaccard's similarlity)
"""
def jaccard_seq(x, y):
len_x = len(x)
len_y = len(y)
fst, snd = (x, y) if len_x < len_... |
def reverse(input):
#reverse as string
return input[::-1]
#An alternative approach I wass using - string to list
'''myinput = input
mylist = list(myinput)
#print (mylist)
mylist.reverse()
return (mylist)'''
'''while True:
if input == None:
print (None)
... |
# Similar to longest substring with k different characters, with k = 2
class Solution:
def totalFruit(self, tree: List[int]) -> int:
if not tree or len(tree) == 0:
return 0
left = 0
ans = 0
baskets = {}
# Use the dictionary to store the last index all fruits/lette... |
'''
Return Permutations of a String
Given a string, find and return all the possible permutations of the input string.
Note : The order of permutations are not important.
Sample Input :
abc
Sample Output :
abc
acb
bac
bca
cab
cba
'''
def permutations(string):
#Implement Your Code Here
if len(string) == 1:
... |
def get_hours_since_midnight(seconds):
'''
Type the code to calculate total hours given n(number) of seconds
For example, given 3800 seconds the total hours is 1
'''
return (seconds//3600)
'''
IF YOU ARE OK WITH A GRADE OF 70 FOR THIS ASSIGNMENT STOP HERE.
'''
def get_minutes(seconds):
'''
... |
class BingoBoard:
def __init__(self) -> None:
self.board = []
self.markedNums = 0
def __repr__(self) -> str:
ret = ''
for line in self.board:
for num in line:
ret += num + ' '
ret += '\n'
return ret
def check_value(self, val:... |
#! /usr/bin/env python3
# coding: utf-8
def main():
with open('sample1.txt','r') as f:
content = f.read()
content = content.upper()
with open('sample2.txt','w') as f:
f.write(content)
if __name__ =='__main__':
main()
|
f_chr6 = open("/hwfssz1/ST_BIOCHEM/P18Z10200N0032/liyiyan/SV_Caller/HG002/chr6_reads.fastq")
liness = f_chr6.readlines()
reads_list = []
for i in range(1,len(liness),4):
reads_list.append(liness[i])
res = min(reads_list, key=len,default='')
print(len(res)-1)
|
qtd = 0
soma = 0
for i in range(1, 101, 1):
if i % 2 == 0:
qtd += 1
soma += i
media = soma / qtd
print('A media dos pares de 1 ate 100 e de {} '.format(media))
|
# Calcula a soma entre todos os ímpares que são múltiplos de três
soma_impar = 0
cont = 0
for c in range(1, 501, 2):
if (c % 3) == 0:
cont += 1
soma_impar += c
print('A soma dos {} ímpares múltiplos de 3 de 0 a 500 é {}'.format(cont, soma_impar)) |
names = ["Adam", "Alex", "Mariah", "Martine", "Columbus"]
for word in names:
print(word)
|
#
# PySNMP MIB module HPNSAECC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPNSAECC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:42:09 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... |
"""
return the taker/maker commission rate
"""
class CommissionRate:
def __init__(self):
self.symbol = ""
self.makerCommissionRate = 0.0
self.takerCommissionRate = 0.0
@staticmethod
def json_parse(json_data):
result = CommissionRate()
result.symbol = json_data.get_s... |
# status: testado com exemplos da prova
if __name__ == '__main__':
n = int(input())
cubes = [int(x) for x in input().split()]
ways = 0
for x in range(0, n):
x_sum = cubes[x]
for y in range(x, n):
if x == y:
if cubes[y] % 8 == 0:
ways += ... |
""" Write an efficient algorithm that searches for a value in an m x n matrix.
This matrix has the following properties:
Integers in each row are sorted in ascending from left to right. Integers in
each column are sorted in ascending from top to bottom.
"""
class Solution240:
pass
|
def albumFromID(id:int):
return f'https://www.jiosaavn.com/api.php?__call=content.getAlbumDetails&_format=json&cc=in&_marker=0%3F_marker=0&albumid={id}'
def albumsearchFromSTRING(query:str):
return f'https://www.jiosaavn.com/api.php?__call=autocomplete.get&_format=json&_marker=0&cc=in&includeMetaTags=1&query... |
def normalize_inputs(data):
"""
Normalizes the inputs to [-1, 1]
:param data: input data array
:return: normalized data to [-1, 1]
"""
data = (data - 127.5) / 127.5
return data
|
def samesign(a, b):
return a * b > 0
def bisect(func, low, high):
'Find root of continuous function where f(low) and f(high) have opposite signs'
assert not samesign(func(low), func(high))
for i in range(54):
midpoint = (low + high) / 2.0
if samesign(func(low), func(midpoint... |
i = 1
while i <= 9:
j = 1
while j <= i:
print("{}x{}={}\t".format(j, i, i * j), end='')
j += 1
print()
i += 1 |
'''
Default quantization scheme
The options are:
iteration: Specify numbers of images for quantization
use_avg: Whether to use AVG method to calculate scale
data_scale: Specify data_scale to scale Min and Max
mean: When firstconv need mean preprocess input
std: When fistconv need std preprocess inpu... |
class StateMachine(object):
"""
Abstract character-driven finite state machine implementation, used to
chop down and transform strings.
Useful for implementig simple transpilators, compressors and so on.
Important: when implementing this class, you must set the :attr:`current`
attribute to a k... |
"""
Utility functions for i3 blocks formatting
"""
################################################################################
def _to_sRGB(component):
"""
Convert linear Color to sRGB
"""
component = 12.92 * component if component <= 0.0031308 else (1.055 * (component**(1/2.4))) - 0.055
... |
def test_preamble(l: list) -> bool:
t = l.pop()
for i in range(len(l) - 1):
if t - l[i] in l[i + 1:]:
return True
return False
def find_preamble(s: str, p: int) -> int:
l = [int(l) for l in s.splitlines()]
for i in range(len(l) - p):
if not test_preamble(l[i:i + p + 1])... |
load("//bazel/macros:toolchains.bzl", "parse_toolchain_file")
def _archive_rule(provider):
additional = ""
if provider.archive_opts != None:
additional = "\n strip_prefix = \"%s\"," % (provider.archive_opts)
return """
http_archive(
name = "{name}",
url = "{url}",
... |
print('Hello my dear') #comments are essential but I am always to lazy
print ('what is your name?')
myName = input()
print('it is nice to meet you,' + myName)
print('the length of you name is :')
print(len(myName))
print ('what is your age?')
myAge = input ()
print('you will be ' + str(int(myAge) +1) +' in a year')
|
#encoding:utf-8
subreddit = 'HermitCraft'
t_channel = '@r_HermitCraft'
def send_post(submission, r2t):
return r2t.send_simple(submission, min_upvotes_limit=100)
|
# exc. 7.1.4
def squared_numbers(start, stop):
while start <= stop:
print(start**2)
start += 1
def main():
start = -3
stop = 3
squared_numbers(start, stop)
if __name__ == "__main__":
main() |
lado = float(input())
altura = float(input())
numero = int(input())
area_1 = lado * altura
area_2 = 0
erro_max = 0
# Fazer o somatorio porposto pelo exercicio
for x in range(-50,51):
atual = numero + x
for j in range (0,atual):
area_2 += lado * (altura/(atual))
modulo_dif = abs(area_1 - area_2)
... |
# Important class
class ImportantClass:
def __init__(self, var):
# Instance variable
self.var = var
# Important function
def importantFunction(self, old_var, new_var):
return old_var + new_var
# Make users happy
def makeUsersHappy(self, users):
... |
def en_even(r):
return r[0] == "en" and len(r[1]) % 2 == 0
def en_odd(r):
return r[0] == "en" and len(r[1]) % 2 == 1
def predict(w):
def result(r):
return (r[0],r[1], np.dot(w.T, r[2])[0][0], r[3])
return result
train = rdd.filter(en_even)
test = rdd.filter(en_odd)
nxxt = train.map(x_xtransp... |
class InvalidAgencyNumber(Exception):
def __init__(self, agency_number=None):
self.message = 'Agência inválida.'
if agency_number is not None:
self.message = f'A agência deve conter {agency_number} números. Complete com zeros a esquerda se necessário.'
super().__init__(self.mes... |
class DHFetchPlugin(object):
""" Drill-Hawkプラグイン
"""
def get_es_source(self):
""" メトリクスのElasticSearchでデータをsearchするときに、
_sourceに指定する項目のリストを返す
:return: _sourcesに指定するElasticSearch上の項目のリスト (string list)
"""
raise NotImplementedError()
def build(self, cwl_workflow... |
rsa_key_data = [
"9cf7192b51a574d1ad3ccb08ba09b87f228573893eee355529ff243e90fd4b86f79a82097cc7922c0485bed1616b1656a9b0b19ef78ea8ec34c384019adc5d5bf4db2d2a0a2d9cf14277bdcb7056f48b81214e3f7f7742231e29673966f9b1106862112cc798dba8d4a138bb5abfc6d4c12d53a5d39b2f783da916da20852ee139bbafda61d429caf2a4f30847ce7e7ae32ab4061e... |
def main():
data = open("day3/input.txt", "r")
data = [line.strip() for line in data.readlines()]
tree_counter = 0
x = 0
for line in data:
if x >= len(line):
x = x % (len(line))
if line[x] == "#":
tree_counter += 1
x += 3
print(tree_counter)
if ... |
iterations = 1
generations_list = [500]
populations_list = [30]
elitism_list = [0.2, 0.8]
mutables_list = [1] |
# -*- coding: utf-8 -*-
"""
converters package.
"""
|
{
'variables': { 'target_arch%': 'ia32', 'naclversion': '0.4.5' },
'targets': [
{
'target_name': 'sodium',
'sources': [
'sodium.cc',
],
"dependencies": [
"<(module_root_dir)/dep... |
l, r = int(input()), int(input()) / 100
count = 1
result = 0
while True:
l = int(l*r)
if l <= 5:
break
result += (2**count)*l
count += 1
print(result)
|
# Given a collection of numbers that might contain duplicates, return all possible unique permutations.
# For example,
# [1,1,2] have the following unique permutations:
# [1,1,2], [1,2,1], and [2,1,1].
class Solution:
# @param {integer[]} nums
# @return {integer[][]}
def permuteUnique(self, nums):
... |
class Person:
'''
This class represents a person
'''
def __init__(self, id, firstname, lastname, dob):
self.id = id
self.firstname = firstname
self.lastname = lastname
self.dob = dob
def __str__(self):
return "University ID Number: " + self.id + "\nName: " +... |
## CamelCase Method
## 6 kyu
## https://www.codewars.com//kata/587731fda577b3d1b0001196
def camel_case(string):
return ''.join([word.title() for word in string.split()]) |
#
# PySNMP MIB module Juniper-E2-Registry (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-E2-Registry
# Produced by pysmi-0.3.4 at Mon Apr 29 19:51:41 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... |
#https://leetcode.com/problems/time-needed-to-inform-all-employees/
#Source: https://leetcode.com/problems/time-needed-to-inform-all-employees/discuss/532560/JavaC%2B%2BPython-DFS
class Solution:
def numOfMinutes(self, n: int, headID: int, manager: List[int], informTime: List[int]) -> int:
children = [[] f... |
#validation of fields that are required
def validate_required(row, variable, metadata, formater,pre_checks=[]):
"""
:param row:
:param variable:
:param metadata:
:param formater:
:param pre_checks:
:return:
"""
errors=[]
for fun in pre_checks:
if fun(row,variable,metada... |
load("@bazel_skylib//lib:dicts.bzl", _dicts = "dicts")
load(
"//rules/scala_proto:private/core.bzl",
_scala_proto_library_implementation = "scala_proto_library_implementation",
_scala_proto_library_private_attributes = "scala_proto_library_private_attributes",
)
scala_proto_library = rule(
attrs = _dic... |
# -*- coding: utf-8 -*-
class Scope(object):
"""
A base scope.
This indicates a permission access.
The `identifier` should be unique.
"""
identifier = None
def __init__(self, identifier):
self.identifier = identifier
def get_description(self):
return None
def __s... |
class Node:
"""链表节点类"""
def __init__(self):
self.data = 0
self.next = None
class LinkedListStack:
"""链表结构堆栈类"""
def __init__(self):
"""初始化堆栈的属性"""
self.head = Node()
self.top = self.head # 堆栈的顶端,当前表示堆栈为空
def is_empty(self):
"""判断堆栈是否为空"""
i... |
class Error(Exception):
"""Base class for other exceptions"""
pass
class InvalidSpecies(Error):
"""Species out of bounds of legitimate species"""
pass
class InvalidForm(Error):
"""Form is invalid"""
pass
class APIError(Error):
"""Something wrong with the API"""
pass |
class Solution:
def XXX(self, height: List[int]) -> int:
left = 0
right = len(height)-1
temp = 0
while left<right:
temp = max(temp,min(height[left],height[right])*(right-left))
if height[left] < height[right]:
left+=1
else:
... |
'''
core exception module
'''
class ConversionUnitNotImplemented(Exception):
'''
raises when tring can not convert a TemperatureUnit
'''
def __init__(self, unit_name: str):
super().__init__('Conversion unit %s not implemented' % unit_name)
|
line, k = input(), int(input())
iterator = line.__iter__()
iterators = zip(*([iterator] * k))
for word in iterators:
d = dict()
result = ''.join([d.setdefault(letter, letter) for letter in word if letter not in d])
print(result)
|
e_h,K = map(int,input().split())
h,m,s,e_m,e_s,ans = 0,0,0,59,59,0
while e_h != h or e_m != m or e_s != s:
z = "%02d%02d%02d" % (h,m,s)
if z.count(str(K)) >0:
# print(z)
ans+=1
s+=1
if s==60:
m+=1
s=0
if m==60:
h+=1
m=0
z = "%02d%02d%02d" % (h,m,s)
... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# ... |
"""
Please write assert statements to verify that every number in the list [2,4,6,8] is even.
data = [2,4,5,6]
for i in data:
assert i%2 == 0, "{} is not an even number".format(i)
"""
"""
Please write a program which accepts basic mathematic expression from console and print the evaluation result.
Example: If... |
# # 9608/22/PRE/O/N/2020
# The code below declares the variables and arrays that are supposed to be pre-populated.
ItemCode = ["1001", "6056", "5557", "2568", "4458"]
ItemDescription = ["Pencil", "Pen", "Notebook", "Ruler", "Compass"]
Price = [1.0, 10.0, 100.0, 20.0, 30.0]
NumberInStock = [100, 100, 50, 20, 20]
n = ... |
def discover_fields(layout):
"""Discover all fields defined in a layout object
This is used to avoid defining the field list in two places --
the layout object is instead inspected to determine the list
"""
fields = []
try:
comps = list(layout)
except TypeError:
return fiel... |
"""
После дрессировки черепашка научилась понимать и запоминать указания биологов следующего вида:
север 10
запад 20
юг 30
восток 40
где первое слово — это направление, в котором должна двигаться черепашка, а число после слова — это положительное
расстояние в сантиметрах, которое должна пройти черепашка.
Но команды да... |
# 4.04 Lists
# Purpose: learning how to use lists
#
# Author@ Shawn Velsor
# Date: 1/8/2021
electronics = ["computer", "cellphone", "laptop", "headphones"]
mutualItem = False
print("Hello, these are the items I like:")
count = 1
for i in electronics:
print(str(count) + ".", i)
count += 1
print()
def main()... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Peter Mounce <public@neverrunwithscissors.com>
#
# This file is part of Ansible
#
# Ansible 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... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Определение общих символов в двух строках, введенных с клавиатуры.
if __name__ == "__main__":
print('Введитите 1 строку')
s1 = set(input())
print('Введитите 2 строку')
s2 = set(input())
# Нахождение пересечений
a = s1.intersection(s2)
print(a... |
# ==== PATHS ===================
PATH_TO_DATASET = "houseprice.csv"
OUTPUT_SCALER_PATH = 'scaler.pkl'
OUTPUT_MODEL_PATH = 'lasso_regression.pkl'
# ======= PARAMETERS ===============
# imputation parameters
LOTFRONTAGE_MODE = 60
# encoding parameters
FREQUENT_LABELS = {
'MSZoning': ['FV', 'RH', 'RL', 'RM'],... |
__title__ = 'plinn'
__description__ = "Partition Like It's 1999"
__url__ = 'https://github.com/giannitedesco/plinn'
__author__ = 'Gianni Tedesco'
__author_email__ = 'gianni@scaramanga.co.uk'
__copyright__ = 'Copyright 2020 Gianni Tedesco'
__license__ = 'Apache 2.0'
__version__ = '0.0.2'
|
# 2. Write Python code to find the cost of the minimum-energy seam in a list of lists.
energies = [[24, 22, 30, 15, 18, 19],
[12, 23, 15, 23, 10, 15],
[11, 13, 22, 13, 21, 14],
[13, 15, 17, 28, ... |
mqtt_host = "IP_OR_DOMAIN"
mqtt_port = 1883
mqtt_topic = "screen/rpi"
mqtt_username = "USERNAME"
mqtt_password = "PASSWORD"
# Raspberry Pi
power_on_command = "vcgencmd display_power 1"
power_off_command = "vcgencmd display_power 0"
# Other HDMI linux devices
# power_on_command = "xset -display :0 dpms force on"
# power... |
"""
Dictionary Comprehension
Se quiseremos criar uma lista fazemos:
lista = [1, 2, 3, 4]
Se quiseremos criar uma tupla:
tupla = (1, 2, 3, 4) # 1, 2, 3, 4
Se quisermos criar um set (conjunto):
conjunto = {1, 2, 3, 4}
Se quisermos criar um dicionário:
dicionario = {'a': 1, 'b': 2, 'c': 3, 'd': 3}
# ... |
"""
Implements mainly the Vector class. See its documentation.
"""
class VectorError(Exception):
"""
An exception to use with Vector
"""
def __init__(self, msg):
self.msg = msg
def __str__(self):
return repr(self.value)
class Vector(tuple):
"""
A vector.
"""
def __... |
class Token:
TOP_LEFT = "┌"
TOP_RIGHT = "┐"
BOTTOM_LEFT = "└"
BOTTOM_RIGHT = "┘"
HORIZONTAL = "─"
BOX_START = TOP_LEFT + HORIZONTAL
VERTICAL = "│"
INPUT_PORT = "┼"
OUTPUT_PORT = "┼"
FUNCTION = "ƒ"
COMMENT = "/*...*/"
SINGLE_QUOTE = "'"
DOUBLE_QUOTE = '"'
LEFT_PARE... |
# Child Prime is such a prime number which can be obtained by summing up the square of the digit of its parent prime number.
# For example, 23 is a prime. If we calculate 2^2+3^2 = 4+9 = 13, which is also a prime no. then we call 13 as a child prime of 23.
ul = int(input("Enter Upper Limit: "))
gt = int(input("Genera... |
class MissingVariableError(Exception):
def __init__(self, name):
self.name = name
self.message = f'The required variable "{self.name}" is missing'
super().__init__(self.message)
class ReservedVariableError(Exception):
def __init__(self, name):
self.name = name
self.mess... |
def main():
# input
a, b, c = map(int, input().split())
# compute
cnt = 0
for i in range(a, b+1):
if c%i == 0:
cnt += 1
# output
print(cnt)
if __name__ == "__main__":
main()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.