content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Solution:
def minIncrementForUnique(self, A: List[int]) -> int:
ans = 0
minAvailable = 0
A.sort()
for a in A:
ans += max(minAvailable - a, 0)
minAvailable = max(minAvailable, a) + 1
return ans
| class Solution:
def min_increment_for_unique(self, A: List[int]) -> int:
ans = 0
min_available = 0
A.sort()
for a in A:
ans += max(minAvailable - a, 0)
min_available = max(minAvailable, a) + 1
return ans |
#
# PySNMP MIB module HPN-ICF-ARP-RATELIMIT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-ARP-RATELIMIT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:37:29 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint, constraints_union) ... |
expected_output = {'current-eta-records': 0,
'excess-packets-received': 60,
'excess-syn-received': 0,
'total-eta-fnf': 2,
'total-eta-idp': 2,
'total-eta-records': 4,
'total-eta-splt': 2,
'total-packets-out-of-order': 0,
'total-packets-received': 80,
'total-packets-retransmitted': 0}
| expected_output = {'current-eta-records': 0, 'excess-packets-received': 60, 'excess-syn-received': 0, 'total-eta-fnf': 2, 'total-eta-idp': 2, 'total-eta-records': 4, 'total-eta-splt': 2, 'total-packets-out-of-order': 0, 'total-packets-received': 80, 'total-packets-retransmitted': 0} |
class SomeSingleton(object):
__instance__ = None
def __new__(cls, *args,**kwargs):
if SomeSingleton.__instance__ is None:
SomeSingleton.__instance__ = object.__new__(cls)
return SomeSingleton.__instance__
def __init__(self,f=0,y=0):
self.f = f
self.y= y
def ... | class Somesingleton(object):
__instance__ = None
def __new__(cls, *args, **kwargs):
if SomeSingleton.__instance__ is None:
SomeSingleton.__instance__ = object.__new__(cls)
return SomeSingleton.__instance__
def __init__(self, f=0, y=0):
self.f = f
self.y = y
... |
# import os
# BANK_URL = os.environ['BANK_URL']
# TRANSACTION_URL = os.environ['TRANSACTION_URL']
# UNDERWRITER_URL = os.environ['UNDERWRITER_URL']
# USER_URL = os.environ['USER_URL']
# applications_url = f"http://{UNDERWRITER_URL}/applications"
# registration_url = f"http://{USER_URL}/users/registration"
# login_url... | applications_url = 'http://localhost/applications'
registration_url = 'http://localhost/users/registration'
login_url = 'http://localhost/login'
bank_url = 'http://localhost/banks'
branch_url = 'http://localhost/branches'
transaction_url = 'http://localhost/transactions' |
for _ in range(int(input())):
a=input()
b=input()
s={}
ans=0
for i in range(26):
s[a[i]]=i+1
temp=[]
for j in b:
temp.append(s[j])
for k in range(len(temp)-1):
ans+=abs(temp[k]-temp[k+1])
print(ans) | for _ in range(int(input())):
a = input()
b = input()
s = {}
ans = 0
for i in range(26):
s[a[i]] = i + 1
temp = []
for j in b:
temp.append(s[j])
for k in range(len(temp) - 1):
ans += abs(temp[k] - temp[k + 1])
print(ans) |
def isPalindrome(str):
result = False
if str == str[::-1]:
result = True
return result
print("Please enter a string: ")
x = input()
flag = isPalindrome(x)
if flag:
print(x, "is a Palindrome")
else:
print(x, "is NOT a Palindrome")
| def is_palindrome(str):
result = False
if str == str[::-1]:
result = True
return result
print('Please enter a string: ')
x = input()
flag = is_palindrome(x)
if flag:
print(x, 'is a Palindrome')
else:
print(x, 'is NOT a Palindrome') |
class Node:
def __init__(self, val):
self.val = val
self.next = None
def add(self, val):
if not self.next:
self.next = Node(val)
else:
self.next.add(val)
def remove(self, val):
if self.next.val == val:
self.next = self.next.next
... | class Node:
def __init__(self, val):
self.val = val
self.next = None
def add(self, val):
if not self.next:
self.next = node(val)
else:
self.next.add(val)
def remove(self, val):
if self.next.val == val:
self.next = self.next.next
... |
# File: factorial_recursion.py
# Purpose: Example: FActorial using recursion
# Programmer: Amal Shehu
# Course: Practice
# Date: Sunday 28th August 2016, 11:10 PM
num = int(input("Enter a number")) # Convert to an int
def factorial(num):
if (num == 0):
return
else:
re... | num = int(input('Enter a number'))
def factorial(num):
if num == 0:
return
else:
return num * factorial(num - 1)
result = factorial(num)
print(result) |
UNKNOWN_WORD = "<unk>"
embedding_dimension = 50
min_count = 5
window_size = 3
sample = 1e-3
negative = 5
vocab_size = None
train_words = None
# Special parameters
MIN_SENTENCE_LENGTH = 3 | unknown_word = '<unk>'
embedding_dimension = 50
min_count = 5
window_size = 3
sample = 0.001
negative = 5
vocab_size = None
train_words = None
min_sentence_length = 3 |
#!/usr/bin/python
DNB_YEARLY_PERCENTAGE = 2.10 / 100
DNB_MONTHLY_PERCENTAGE = DNB_YEARLY_PERCENTAGE / 12
DNB_FEE = 50
DNB_INITIAL_PAYMENT = 10000
NORDEA_YEARLY_PERCENTAGE = 2.15 / 100
NORDEA_MONTHLY_PERCENTAGE = NORDEA_YEARLY_PERCENTAGE / 12
NORDEA_FEE = 65
NORDEA_INITIAL_PAYMENT = 0
def months_until_paid_out(credit... | dnb_yearly_percentage = 2.1 / 100
dnb_monthly_percentage = DNB_YEARLY_PERCENTAGE / 12
dnb_fee = 50
dnb_initial_payment = 10000
nordea_yearly_percentage = 2.15 / 100
nordea_monthly_percentage = NORDEA_YEARLY_PERCENTAGE / 12
nordea_fee = 65
nordea_initial_payment = 0
def months_until_paid_out(credit_sum, monthly_payment... |
text="ANCHE TU BRUTO FIGLIO MIO?";
s=4;
result="";
text=text.upper();
for i in range(len(text)):
c = text[i];
if(c.isupper()):
result+=chr((ord(c)+s-65)%26+65);
else:
result+=chr((ord(c)+s-97)%26+97);
print(result);
| text = 'ANCHE TU BRUTO FIGLIO MIO?'
s = 4
result = ''
text = text.upper()
for i in range(len(text)):
c = text[i]
if c.isupper():
result += chr((ord(c) + s - 65) % 26 + 65)
else:
result += chr((ord(c) + s - 97) % 26 + 97)
print(result) |
# -*- encoding: utf-8 -*-
'''
@project : LeetCode
@File : diameterOfBinaryTree.py
@Contact : 9824373@qq.com
@Desc :
@Modify Time @Author @Version @Desciption
------------ ------- -------- -----------
2020-03-10 zhan 1.0 None
'''
# Definition f... | """
@project : LeetCode
@File : diameterOfBinaryTree.py
@Contact : 9824373@qq.com
@Desc :
@Modify Time @Author @Version @Desciption
------------ ------- -------- -----------
2020-03-10 zhan 1.0 None
"""
class Treenode:
def __init__(self, x... |
render = ez.Node()
aspect2D = ez.Node()
camera = ez.Camera(parent=render)
camera.y = -20
# Create collision shapes:
# Collision Sphere:
sphere = ez.collision.shapes.Sphere(0.25, parent=render)
sphere.parent = None
sphere.parent = render
# Collide from mask 2:
ez.collision.set_mask(sphere, ez.mask[2])
# Set what sph... | render = ez.Node()
aspect2_d = ez.Node()
camera = ez.Camera(parent=render)
camera.y = -20
sphere = ez.collision.shapes.Sphere(0.25, parent=render)
sphere.parent = None
sphere.parent = render
ez.collision.set_mask(sphere, ez.mask[2])
ez.collision.set_from_mask(sphere, ez.mask[1])
sphere.pos = (0, 0, 0)
sphere.show()
sph... |
while True:
senha=int(input('digite sua senha : '))
if senha==2:
print('acesso permitido')
break
else:
print('senha invalida, tente novamente') | while True:
senha = int(input('digite sua senha : '))
if senha == 2:
print('acesso permitido')
break
else:
print('senha invalida, tente novamente') |
#!/usr/bin/env python3
def myFunc(x, y):
if not isinstance(x, (int, float)):
raise TypeError('x has wrong type')
if not isinstance(y, (int, float)):
raise TypeError('y has wrong type')
else:
print(x + y)
myFunc(1, 3)
| def my_func(x, y):
if not isinstance(x, (int, float)):
raise type_error('x has wrong type')
if not isinstance(y, (int, float)):
raise type_error('y has wrong type')
else:
print(x + y)
my_func(1, 3) |
phonetic_alphabet = {"alpha": "A", "adam": "A", "boy": "B", "bravo": "B", "charlie": "C",
"delta": "D", "david": "D", "echo": "E", "edward": "E", "foxtrot": "F", "frank": "F",
"golf": "G", "george": "G", "hotel": "H", "henry": "H", "india": "I", "ida": "I",
"aida": "I", "juliette": "J", "john": "J", "kilo":... | phonetic_alphabet = {'alpha': 'A', 'adam': 'A', 'boy': 'B', 'bravo': 'B', 'charlie': 'C', 'delta': 'D', 'david': 'D', 'echo': 'E', 'edward': 'E', 'foxtrot': 'F', 'frank': 'F', 'golf': 'G', 'george': 'G', 'hotel': 'H', 'henry': 'H', 'india': 'I', 'ida': 'I', 'aida': 'I', 'juliette': 'J', 'john': 'J', 'kilo': 'K', 'king'... |
def decrypt(ciphertext, s):
pltext = ""
for i in range(len(ciphertext)):
char = ciphertext[i]
if (char.isupper()):
pltext += chr((ord(char) - s-65) % 26 + 65)
else:
pltext += chr((ord(char) - s - 97) % 26 + 97)
return pltext
ciphertext = "EXXEG... | def decrypt(ciphertext, s):
pltext = ''
for i in range(len(ciphertext)):
char = ciphertext[i]
if char.isupper():
pltext += chr((ord(char) - s - 65) % 26 + 65)
else:
pltext += chr((ord(char) - s - 97) % 26 + 97)
return pltext
ciphertext = 'EXXEGOEXSRGI'
s = 4
p... |
# A non-empty array A consisting of N integers is given.
# A permutation is a sequence containing each element from 1 to N once, and only once.
# For example, array A such that:
# A[0] = 4
# A[1] = 1
# A[2] = 3
# A[3] = 2
# is a permutation, but array A such that:
# A[0] = 4
# A[1] = 1
# ... | def perm_check(A):
memo = {}
limit = len(A)
for element in A:
if not 1 <= element <= limit:
return 0
elif element in memo:
return 0
else:
memo[element] = True
return 1 |
ITCH_BASE = "itch.io"
ITCH_URL = f"https://{ITCH_BASE}"
ITCH_API = f"https://api.{ITCH_BASE}"
# Extracts https://user.itch.io/name to {'author': 'user', 'game': 'name'}
ITCH_GAME_URL_REGEX = r"^https:\/\/(?P<author>[\w\d\-_]+).itch.io\/(?P<game>[\w\d\-_]+)$"
ITCH_BROWSER_TYPES = [
"games",
"tools",
"game-... | itch_base = 'itch.io'
itch_url = f'https://{ITCH_BASE}'
itch_api = f'https://api.{ITCH_BASE}'
itch_game_url_regex = '^https:\\/\\/(?P<author>[\\w\\d\\-_]+).itch.io\\/(?P<game>[\\w\\d\\-_]+)$'
itch_browser_types = ['games', 'tools', 'game-assets', 'comics', 'books', 'physical-games', 'soundtracks', 'game-mods', 'misc'] |
sys_name = "XSS'OR"
sys_copyright = "@evilcos.me"
def sys(req):
return {
'sys_name': sys_name,
'sys_copyright': sys_copyright,
}
| sys_name = "XSS'OR"
sys_copyright = '@evilcos.me'
def sys(req):
return {'sys_name': sys_name, 'sys_copyright': sys_copyright} |
instrument_familes = {
'Strings': ['Guitar', 'Banjo', 'Sitar'],
'Percussion': ['Conga', 'Cymbal', 'Cajon'],
'woodwinds': ['Flute', 'Oboe', 'Clarinet']
}
class KeyError(Exception):
def __init__(self, key):
self.key = key
def __str__(self) -> str:
return f"Key {self.key} does not exist"
def print... | instrument_familes = {'Strings': ['Guitar', 'Banjo', 'Sitar'], 'Percussion': ['Conga', 'Cymbal', 'Cajon'], 'woodwinds': ['Flute', 'Oboe', 'Clarinet']}
class Keyerror(Exception):
def __init__(self, key):
self.key = key
def __str__(self) -> str:
return f'Key {self.key} does not exist'
def prin... |
def intersection(l1, l2):
res = [v for v in l1 if v in l2]
return res
def divide_into_primes(num, base=2, seq=None):
if seq is None:
seq = []
if num == 1:
return seq
for i in range(base, num+1):
if not num % i:
seq.append(i)
return divide_into_primes... | def intersection(l1, l2):
res = [v for v in l1 if v in l2]
return res
def divide_into_primes(num, base=2, seq=None):
if seq is None:
seq = []
if num == 1:
return seq
for i in range(base, num + 1):
if not num % i:
seq.append(i)
return divide_into_prime... |
def check(cmd, mf):
m = mf.findNode('uuid')
if m:
return dict(expected_missing_imports=set(['netbios', 'win32wnet']))
| def check(cmd, mf):
m = mf.findNode('uuid')
if m:
return dict(expected_missing_imports=set(['netbios', 'win32wnet'])) |
s = set()
for _ in range(int(input())):
s.add(input())
print (len(s))
# one line solution
print ( len(set([str(input()) for _ in range(int(input()))])) )
# https://www.hackerrank.com/challenges/py-set-add/problem | s = set()
for _ in range(int(input())):
s.add(input())
print(len(s))
print(len(set([str(input()) for _ in range(int(input()))]))) |
params = input().split(" ")
params = [int(param) for param in params]
if params[0] == params[1]:
for i in range(1, params[0] + 1):
print(input())
exit(0)
else:
all_gnomes = set(range(1, params[0] + 1))
remaining_gnomes = []
sorted = True
prev_gnome = -1
for _ in range(params[1]):... | params = input().split(' ')
params = [int(param) for param in params]
if params[0] == params[1]:
for i in range(1, params[0] + 1):
print(input())
exit(0)
else:
all_gnomes = set(range(1, params[0] + 1))
remaining_gnomes = []
sorted = True
prev_gnome = -1
for _ in range(params[1]):
... |
pointer=-1
lock=0
def setSeq(data) :
if lock == 1:
exit(2)
globals()['pointer']=-1
globals()['data']=data.split(',')
globals()['lock']=1
def raw_input() :
globals()['pointer']+=1
try:
return data[pointer]
except IndexError:
exit(0)
def open(path,mode) :
exit(3)
| pointer = -1
lock = 0
def set_seq(data):
if lock == 1:
exit(2)
globals()['pointer'] = -1
globals()['data'] = data.split(',')
globals()['lock'] = 1
def raw_input():
globals()['pointer'] += 1
try:
return data[pointer]
except IndexError:
exit(0)
def open(path, mode):
... |
result = 0
for i in range(1000):
if i%3==0 or i%5==0:
result += i
print(result) | result = 0
for i in range(1000):
if i % 3 == 0 or i % 5 == 0:
result += i
print(result) |
text = input()
sum = 0
for symbol in text:
if symbol == "a":
sum += 1
elif symbol == "e":
sum += 2
elif symbol == "i":
sum += 3
elif symbol == "o":
sum += 4
elif symbol == "u":
sum += 5
print(sum) | text = input()
sum = 0
for symbol in text:
if symbol == 'a':
sum += 1
elif symbol == 'e':
sum += 2
elif symbol == 'i':
sum += 3
elif symbol == 'o':
sum += 4
elif symbol == 'u':
sum += 5
print(sum) |
debt = 95000
interest_percent = .059
yearly_salary = None
hourly_salary = 20
debt_repayment_percent = .2
debt_repayment_length = 0
work_days = 261
work_hours = 8
interest = 0
if yearly_salary and hourly_salary is not None:
if yearly_salary != hourly_salary * work_days * work_hours:
raise ValueError('only y... | debt = 95000
interest_percent = 0.059
yearly_salary = None
hourly_salary = 20
debt_repayment_percent = 0.2
debt_repayment_length = 0
work_days = 261
work_hours = 8
interest = 0
if yearly_salary and hourly_salary is not None:
if yearly_salary != hourly_salary * work_days * work_hours:
raise value_error('only... |
max_len = 79
str_plier = 2
foo = "Oh oh oh oh you don't know, Joe."*str_plier
curr_len = len(foo)
if curr_len > max_len:
print("Danger, Will Robinson!!!")
print("Your sentiment is {} ".format(curr_len-max_len)+"characters too long!")
else:
print("What a lovely sentiment!\n"+ foo+"\nIn only {} characters!".... | max_len = 79
str_plier = 2
foo = "Oh oh oh oh you don't know, Joe." * str_plier
curr_len = len(foo)
if curr_len > max_len:
print('Danger, Will Robinson!!!')
print('Your sentiment is {} '.format(curr_len - max_len) + 'characters too long!')
else:
print('What a lovely sentiment!\n' + foo + '\nIn only {} chara... |
TEMPERATURE = 0x01
GAS = 0x02
VOLTAGE = 0x04
DELAY = 0x10
TEST_SUCCESS = 0x3F
ERROR_RELAY_OPEN = 0x04
ERROR_RELAY_CLOSED = 0x08
MODE_CONFIG = 0x80
MODE_RUN = 0x40
MODE_ERROR = 0xC0
MODE_TIMEOUT = 0x00
WRITE = 0x20
def print_status(state):
if(state&MODE_ERROR == MODE_ERROR):
print("ERROR MODE")
elif(state&MOD... | temperature = 1
gas = 2
voltage = 4
delay = 16
test_success = 63
error_relay_open = 4
error_relay_closed = 8
mode_config = 128
mode_run = 64
mode_error = 192
mode_timeout = 0
write = 32
def print_status(state):
if state & MODE_ERROR == MODE_ERROR:
print('ERROR MODE')
elif state & MODE_ERROR == MODE_TIM... |
# TODO write docs
class SceneDrawer(object):
def __init__(self, device, register):
self.device = device
self.background_color = "black"
self.entity_register = register
def draw(self, scene):
for entity in scene.entities:
if entity.drawer is not None:
... | class Scenedrawer(object):
def __init__(self, device, register):
self.device = device
self.background_color = 'black'
self.entity_register = register
def draw(self, scene):
for entity in scene.entities:
if entity.drawer is not None:
entity.drawer.dra... |
content = '''package main
import (
"context"
"github.com/qsock/qim/lib/proto/ret"
)
type Server struct{}
func (*Server) Ping(ctx context.Context, req *ret.NoArgs) (*ret.NoArgs, error) {
return new(ret.NoArgs), nil
}'''
def gen(name, srv_dir) :
with open(srv_dir+"/handle.go", "w") as f:
f.write(conte... | content = 'package main\n\nimport (\n\t"context"\n\t"github.com/qsock/qim/lib/proto/ret"\n)\n\ntype Server struct{}\n\nfunc (*Server) Ping(ctx context.Context, req *ret.NoArgs) (*ret.NoArgs, error) {\n\treturn new(ret.NoArgs), nil\n}'
def gen(name, srv_dir):
with open(srv_dir + '/handle.go', 'w') as f:
f.w... |
# Source : https://leetcode.com/problems/symmetric-tree/
# Author : penpenps
# Time : 2019-07-09
# Revert right node firstly, then compare with left node
# Time Complexity: O(n)
# Space Complexity: O(n)
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def is_symmetric(self, root: TreeNode) -> bool:
def revert(node):
if not node:
return
(node.left, node.right) = (node.right, node.lef... |
result = [
{0: 0, 1: 'var 1'},
{0: 0, 1: 'var 2'}
]
| result = [{0: 0, 1: 'var 1'}, {0: 0, 1: 'var 2'}] |
description = 'memograph readout'
group = 'optional'
devices = dict(
t_in_fak40 = device('nicos_mlz.devices.memograph.MemographValue',
hostname = 'memograph02.care.frm2',
group = 1,
valuename = 'T_in MIRA',
description = 'inlet temperature memograph',
fmtstr = '%.2F',
... | description = 'memograph readout'
group = 'optional'
devices = dict(t_in_fak40=device('nicos_mlz.devices.memograph.MemographValue', hostname='memograph02.care.frm2', group=1, valuename='T_in MIRA', description='inlet temperature memograph', fmtstr='%.2F', warnlimits=(-1, 17.5), unit='degC'), t_out_fak40=device('nicos_m... |
class Solution:
def backspaceCompare(self, S: str, T: str) -> bool:
print(S[0])
stack = []
for i in S:
if i=="#":
if len(stack)==0:
continue
stack.pop()
else:
s... | class Solution:
def backspace_compare(self, S: str, T: str) -> bool:
print(S[0])
stack = []
for i in S:
if i == '#':
if len(stack) == 0:
continue
stack.pop()
else:
stack.append(i)
s = ''
... |
# Tram, Minh
# mqt0029
# 1001540029
# 2019-05-13
#---------#---------#---------#---------#---------#--------#
class InternalError( Exception ) : pass
class LexicalError( Exception ) : pass
class SemanticError( Exception ) : pass
class SyntacticError( Exception ) : pass
#---------#---------#---------#---------#----... | class Internalerror(Exception):
pass
class Lexicalerror(Exception):
pass
class Semanticerror(Exception):
pass
class Syntacticerror(Exception):
pass |
def coord(x,y):
if x > 0 and y > 0:
i = "I"
elif x > 0 and y < 0:
i = "IV"
elif x < 0 and y < 0:
i = "III"
elif x < 0 and y > 0:
i = "II"
print(f"O ponto ({x:.0f}, {y:.0f}) pertence ao quadrante: {i}")
print(" ")
def main():
a = float(input("Digite um valor p... | def coord(x, y):
if x > 0 and y > 0:
i = 'I'
elif x > 0 and y < 0:
i = 'IV'
elif x < 0 and y < 0:
i = 'III'
elif x < 0 and y > 0:
i = 'II'
print(f'O ponto ({x:.0f}, {y:.0f}) pertence ao quadrante: {i}')
print(' ')
def main():
a = float(input('Digite um valor ... |
#!/usr/bin/env python3
m = int(input())
if m < 100:
print("00")
elif m <= 5000:
print(str(m//100).zfill(2))
elif m <= 30000:
print(m//1000 + 50)
elif m <= 70000:
print((m//1000 - 30)//5 + 80)
else:
print(89) | m = int(input())
if m < 100:
print('00')
elif m <= 5000:
print(str(m // 100).zfill(2))
elif m <= 30000:
print(m // 1000 + 50)
elif m <= 70000:
print((m // 1000 - 30) // 5 + 80)
else:
print(89) |
# to compute modular power
# Iterative Function to calculate
# (x^y)%p in O(log y)
def power(x, y, p) :
res = 1 # Initialize result
# Update x if it is more
# than or equal to p
x = x % p
while (y > 0) :
# If y is odd, multiply
# x with result
... | def power(x, y, p):
res = 1
x = x % p
while y > 0:
if y & 1 == 1:
res = res * x % p
y = y >> 1
x = x * x % p
return res |
#print excepation information as a msg in program
try:
print(10/0)
except ZeroDivisionError as msg:
print("the type of error:",msg.__class__)
| try:
print(10 / 0)
except ZeroDivisionError as msg:
print('the type of error:', msg.__class__) |
'''Defines the `checkstyle_aspect`.
'''
load("//java:providers/JavaCompilationInfo.bzl", "JavaCompilationInfo")
load(
"//java:common/extract/toolchain_info.bzl",
"extract_java_runtime_toolchain_class_path_separator",
"extract_checkstyle_toolchain_info",
)
_JAVA_RUNTIME_TOOLCHAIN_TYPE = "@dwtj_rules_java//... | """Defines the `checkstyle_aspect`.
"""
load('//java:providers/JavaCompilationInfo.bzl', 'JavaCompilationInfo')
load('//java:common/extract/toolchain_info.bzl', 'extract_java_runtime_toolchain_class_path_separator', 'extract_checkstyle_toolchain_info')
_java_runtime_toolchain_type = '@dwtj_rules_java//java/toolchains/j... |
expected_output = {
"interface_name": "Gi1/0/1",
"if_id": "75",
"phy_registers": {
"0": {
"register_number": "0000",
"hex_bit_value": "1140",
"register_name": "Control Register",
"bits": "0001000101000000",
},
"1": {
"regist... | expected_output = {'interface_name': 'Gi1/0/1', 'if_id': '75', 'phy_registers': {'0': {'register_number': '0000', 'hex_bit_value': '1140', 'register_name': 'Control Register', 'bits': '0001000101000000'}, '1': {'register_number': '0001', 'hex_bit_value': '796d', 'register_name': 'Control STATUS', 'bits': '0111100101101... |
class Solution:
def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]:
l = set(nums1)
ret = [i for i in nums2 if i in l]
return list(set(ret)) | class Solution:
def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]:
l = set(nums1)
ret = [i for i in nums2 if i in l]
return list(set(ret)) |
def solution(N):
b_rep = '{:b}'.format(N)
counter = 0
res = 0
prev_val = 0
count = False
for val in b_rep:
val = int(val)
if val - prev_val == -1:
count = True
counter += 1
if val - prev_val == 0 and count:
counter += 1
if val -... | def solution(N):
b_rep = '{:b}'.format(N)
counter = 0
res = 0
prev_val = 0
count = False
for val in b_rep:
val = int(val)
if val - prev_val == -1:
count = True
counter += 1
if val - prev_val == 0 and count:
counter += 1
if val -... |
x = 30;
y = 3;
## addition
print("x + y : ",x + y);
## we can use + for concatenate string
print("Hello, " + "World!");
## Subtraction
print("x - y : ",x - y);
## Division
print("x / y : ",x / y);
## here division operator always return float type number
## Multiplication
print("x * y : ",x*y);
# we can use * oper... | x = 30
y = 3
print('x + y : ', x + y)
print('Hello, ' + 'World!')
print('x - y : ', x - y)
print('x / y : ', x / y)
print('x * y : ', x * y)
print("'word '*5 : ", 'word' * 5)
print('x%6 : ', x % 6)
print('x//7 : ', x // 7)
print('2**4 : ', 2 ** 4) |
#!/usr/bin/env python3
# Please make sure this file can be executed.
# chmod +x hello.py
print('Hello World!!')
| print('Hello World!!') |
def seta(n):
for i in range(n):
if i == n - 1:
print((2 * n) * '*', end='')
print((i + 1) * '*')
else:
print((2 * n) * ' ', end='')
print((i + 1) * '*')
for j in range(n - 1, 0, -1):
print((2 * n) * ' ',end='')
print(j * '*')
seta(1... | def seta(n):
for i in range(n):
if i == n - 1:
print(2 * n * '*', end='')
print((i + 1) * '*')
else:
print(2 * n * ' ', end='')
print((i + 1) * '*')
for j in range(n - 1, 0, -1):
print(2 * n * ' ', end='')
print(j * '*')
seta(10) |
'''input
atcoder beginner contest
ABC
'''
# -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem A
if __name__ == '__main__':
a, b, c = input().split()
result = a[0] + b[0] + c[0]
print(result.upper())
| """input
atcoder beginner contest
ABC
"""
if __name__ == '__main__':
(a, b, c) = input().split()
result = a[0] + b[0] + c[0]
print(result.upper()) |
file = open("AAPL.txt", "r")
lines = file.readlines()
prices = []
for line in lines:
price = float(line)
prices.append(price)
print(price)
print(prices) | file = open('AAPL.txt', 'r')
lines = file.readlines()
prices = []
for line in lines:
price = float(line)
prices.append(price)
print(price)
print(prices) |
'''
Problem Description:
--------------------
The program reads a file and counts
the number of blank spaces in a text file.
'''
print(__doc__)
print('-'*25)
fileName=input('Enter file name: ')
k=0
with open(fileName,'r')as f:
for line in f:
words=line.split()
for i in words:
for letter in i:
... | """
Problem Description:
--------------------
The program reads a file and counts
the number of blank spaces in a text file.
"""
print(__doc__)
print('-' * 25)
file_name = input('Enter file name: ')
k = 0
with open(fileName, 'r') as f:
for line in f:
words = line.split()
for i in words:
... |
functions = {
'Add': (2, lambda p: p[0] + p[1]),
'Minus': (2, lambda p: p[0] - p[1]),
'UnaryMinus': (1, lambda p: -p[0]),
'Divide': (2, lambda p: p[0] / p[1]),
'Multiply': (2, lambda p: p[0] * p[1]),
'Modulo': (2, lambda p: p[0] % p[1]),
'EqualTo': (2, lambda p: p[0] == p[1]),
'NotEqualT... | functions = {'Add': (2, lambda p: p[0] + p[1]), 'Minus': (2, lambda p: p[0] - p[1]), 'UnaryMinus': (1, lambda p: -p[0]), 'Divide': (2, lambda p: p[0] / p[1]), 'Multiply': (2, lambda p: p[0] * p[1]), 'Modulo': (2, lambda p: p[0] % p[1]), 'EqualTo': (2, lambda p: p[0] == p[1]), 'NotEqualTo': (2, lambda p: p[0] != p[1]), ... |
class Features:
NOTEBOOKS = 'app.features.notebooks'
class Deployment:
SITE = 'app.deployment.site'
class Branding:
PRIVACY = 'app.configuration.privacy'
LICENSE = 'app.configuration.license'
HEADER_LOGO_ID = 'app.configuration.header.logo.file.id'
FOOTER_LOGO_ID = 'app.configuration.footer.lo... | class Features:
notebooks = 'app.features.notebooks'
class Deployment:
site = 'app.deployment.site'
class Branding:
privacy = 'app.configuration.privacy'
license = 'app.configuration.license'
header_logo_id = 'app.configuration.header.logo.file.id'
footer_logo_id = 'app.configuration.footer.lo... |
WIDTH = 512
HEIGHT = 336
FPS = 50
PIX_FOR_BRIX = 16
STEPS_FOR_CYCLE = 16
N_STEP_FOR_TEST = 5
BLACK = (0, 0, 0)
BKGR = (0, 0, 0)
| width = 512
height = 336
fps = 50
pix_for_brix = 16
steps_for_cycle = 16
n_step_for_test = 5
black = (0, 0, 0)
bkgr = (0, 0, 0) |
a = [1, 2, 3]
b = a
print(a == b)
# => True
print(a is b)
# => True
c = list(a)
# == evaluates to true if the objects referred by the variables are equal
print(a == c)
# => True
# is evaluates to true if both variables point to the same object
print(a is c)
# => false
| a = [1, 2, 3]
b = a
print(a == b)
print(a is b)
c = list(a)
print(a == c)
print(a is c) |
# Best
# time O(log(n))
# space O(1)
def binarySearch(array, target):
low = 0
high = len(array)-1
while low<=high:
mid = (low+high)//2
if array[mid] == target:
return mid
if target > array[mid]:
low = mid + 1
else:
high = mid -... | def binary_search(array, target):
low = 0
high = len(array) - 1
while low <= high:
mid = (low + high) // 2
if array[mid] == target:
return mid
if target > array[mid]:
low = mid + 1
else:
high = mid - 1
return -1
def binary_search_helpe... |
l = [1,2,3,4]
def printCombo(l):
for j in range(1, len(l)+1):
for i in range(len(l)-1):
l[i],l[i+1]=l[i+1],l[i]
print(l)
for i in range(len(l)):
printCombo(l[i:])
| l = [1, 2, 3, 4]
def print_combo(l):
for j in range(1, len(l) + 1):
for i in range(len(l) - 1):
(l[i], l[i + 1]) = (l[i + 1], l[i])
print(l)
for i in range(len(l)):
print_combo(l[i:]) |
f=open('This.txt','r')
# this is Default read mode of file
f=open('This.txt') #open file
# data=f.read()
data=f.read(5) #Starting 5 characters from file
print(data)
f.close() | f = open('This.txt', 'r')
f = open('This.txt')
data = f.read(5)
print(data)
f.close() |
# Create cache for known results
factorial_memo = {}
def factorial(k):
if k < 2:
return 1
if not k in factorial_memo:
factorial_memo[k] = k * factorial(k-1)
return factorial_memo[k]
print(factorial_memo)
print(factorial(4))
print(factorial_memo)
print(factorial(5))
print(factorial_mem... | factorial_memo = {}
def factorial(k):
if k < 2:
return 1
if not k in factorial_memo:
factorial_memo[k] = k * factorial(k - 1)
return factorial_memo[k]
print(factorial_memo)
print(factorial(4))
print(factorial_memo)
print(factorial(5))
print(factorial_memo) |
# author: Gonzalo Salazar
# assigment: Homework #2
# description: contains three functions
# First function:
# Input: temperature value in degrees Centigrade
# Output: temperature value in degrees Fahrenheit
# Second function:
# Input: temperature value in degrees Fahrenheit
# Output: temper... | def centigrade_to_fahrenheit(T_c):
t_f = 9 / 5 * T_c + 32
return T_f
def fahrenheit_to_centigrade(T_f):
t_c = 5 / 9 * (T_f - 32)
return T_c
def wind_chill_factor(TEMPERATURE, WIND):
wc = 0.0817 * (3.71 * WIND ** 0.5 + 5.81 - 0.25 * WIND) * (TEMPERATURE - 91.4) + 91.4
return wc |
# https://leetcode.com/problems/maximum-product-subarray/
class Solution:
def maxProduct(self, nums: List[int]) -> int:
res = nums[0]
maxNum, minNum = 1, 1
for num in nums:
tempMax = num * maxNum
tempMin = num... | class Solution:
def max_product(self, nums: List[int]) -> int:
res = nums[0]
(max_num, min_num) = (1, 1)
for num in nums:
temp_max = num * maxNum
temp_min = num * minNum
max_num = max(num, tempMax, tempMin)
min_num = min(num, tempMax, tempMin)... |
# Program to reverse an array
def reverseArray(arr : list) :
for i in range(len(arr) // 2) :
arr[i], arr[len(arr)-1-i] = arr[len(arr)-1-i], arr[i]
if __name__ == "__main__":
arr = [1,2,3,4,5,6,7]
reverseArray(arr)
print(arr)
| def reverse_array(arr: list):
for i in range(len(arr) // 2):
(arr[i], arr[len(arr) - 1 - i]) = (arr[len(arr) - 1 - i], arr[i])
if __name__ == '__main__':
arr = [1, 2, 3, 4, 5, 6, 7]
reverse_array(arr)
print(arr) |
#
# PySNMP MIB module Juniper-MPLS-CONF (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-MPLS-CONF
# Produced by pysmi-0.3.4 at Mon Apr 29 19:52:41 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ... |
class Solution:
def searchInsert(self, nums: List[int], target: int) -> int:
s = 0
e = len(nums) - 1
while(s <= e):
m = (s + e) // 2
if (nums[m] < target):
s = m + 1
elif (nums[m] > target):
e = m - 1
else:
return m
return s | class Solution:
def search_insert(self, nums: List[int], target: int) -> int:
s = 0
e = len(nums) - 1
while s <= e:
m = (s + e) // 2
if nums[m] < target:
s = m + 1
elif nums[m] > target:
e = m - 1
else:
... |
#%%
# dutch_w = 0.664
# turkish_w = 0.075
# moroccan_w = 0.13
# ghanaian_w = 0.021
# suriname_w = 0.11
# sample_n = 4000
# dutch_pop = sample_n * dutch_w
# suriname_pop = sample_n * suriname_w
# turkish_pop = sample_n * turkish_w
# moroccan_pop = sample_n * moroccan_w
# ghanaian_pop = sample_n * ghanaian_w
# ethn... | debug = True
savetype = 'group'
root = 'C:/Users/Admin/Code/status/'
results_dir = 'C:/Users/Admin/Code/status/results/'
param_dict = {'similarity_min': [], 'interactions': [], 'ses_noise': [], 'vul_param': [], 'psr_param': [], 'coping_noise': [], 'recover_param': [], 'prestige_beta': [], 'prestige_param': [], 'stresso... |
entries = [
{
'env-title': 'atari-alien',
'env-variant': 'Human start',
'score': 570.20,
},
{
'env-title': 'atari-amidar',
'env-variant': 'Human start',
'score': 133.40,
},
{
'env-title': 'atari-assault',
'env-variant': 'Human start',
... | entries = [{'env-title': 'atari-alien', 'env-variant': 'Human start', 'score': 570.2}, {'env-title': 'atari-amidar', 'env-variant': 'Human start', 'score': 133.4}, {'env-title': 'atari-assault', 'env-variant': 'Human start', 'score': 3332.3}, {'env-title': 'atari-asterix', 'env-variant': 'Human start', 'score': 124.5},... |
SECRET_KEY = 'secret'
ROOT_URLCONF = 'jsonrpc.tests.test_backend_django.urls'
ALLOWED_HOSTS = ['testserver']
DATABASE_ENGINE = 'django.db.backends.sqlite3'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
JSONRPC_MAP_VIEW_ENABLED = True
| secret_key = 'secret'
root_urlconf = 'jsonrpc.tests.test_backend_django.urls'
allowed_hosts = ['testserver']
database_engine = 'django.db.backends.sqlite3'
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}}
jsonrpc_map_view_enabled = True |
packages = {
'Greenspace': {
'description': '',
'foundations' : [
'neighborhood_development_18_027',
'neighborhood_development_18_021'
],
'default_foundation' : 'neighborhood_development_18_027',
'slides' : [
'neighborhood_development_18_003',
'neighborhood_de... | packages = {'Greenspace': {'description': '', 'foundations': ['neighborhood_development_18_027', 'neighborhood_development_18_021'], 'default_foundation': 'neighborhood_development_18_027', 'slides': ['neighborhood_development_18_003', 'neighborhood_development_18_004', 'neighborhood_development_18_005'], 'default_slid... |
# Solution 2
# def fib(num, l=[]):
# a=b=1
# while(True):
# a+=b
# if a % 2 == 0:
# l.append(a)
# a,b=b,a
# if a >= num:
# break
# return l
# print(sum(fib(4000000)))
# Solution 3
# import math
# def factors(num):
# factors_list = []
# for value in range(2, math.ceil(math... | palindrome = []
for val in range(2, 1000)[::-1]:
for value in range(2, val)[::-1]:
str_int = str(val * value)
if list(str_int) == list(str_int)[::-1]:
palindrome.append(val * value)
print(max(palindrome)) |
l = [4, 3, 5, 4, -3,10,2,33,98,4]
print(l)
min = l[0]
max = l[0]
n = len(l)
for i in range(1, n):
curr = l[i]
if curr < min:
min=curr
if curr>max:
max=curr
print("Min=",min,"Max=",max)
| l = [4, 3, 5, 4, -3, 10, 2, 33, 98, 4]
print(l)
min = l[0]
max = l[0]
n = len(l)
for i in range(1, n):
curr = l[i]
if curr < min:
min = curr
if curr > max:
max = curr
print('Min=', min, 'Max=', max) |
class MinMaxHeap:
# Checks if a binary tree is a min/max heap.
@staticmethod
def is_valid(values, index, level, min_value, max_value):
if index >= len(values):
return True
if (values[index] > min_value and values[index] < max_value) == False:
return False
... | class Minmaxheap:
@staticmethod
def is_valid(values, index, level, min_value, max_value):
if index >= len(values):
return True
if (values[index] > min_value and values[index] < max_value) == False:
return False
if level % 2 != 0:
min_value = values[in... |
chars2get = set()
with open('biofic2take.tsv', encoding = 'utf-8') as f:
for line in f:
fields = line.strip().split('\t')
charid = fields[0]
chars2get.add(charid)
outlines = []
with open('../biofic50/biofic50_doctopics.txt', encoding = 'utf-8') as f:
for line in f:
fields = li... | chars2get = set()
with open('biofic2take.tsv', encoding='utf-8') as f:
for line in f:
fields = line.strip().split('\t')
charid = fields[0]
chars2get.add(charid)
outlines = []
with open('../biofic50/biofic50_doctopics.txt', encoding='utf-8') as f:
for line in f:
fields = line.stri... |
class BoundingBox:
def __init__(self, top: float, right: float, bottom: float, left: float):
self.top = top
self.right = right
self.bottom = bottom
self.left = left
def to_flickr_bounding_box(self):
return '{self.left}, {self.bottom}, {self.right}, {self.top}'.format(sel... | class Boundingbox:
def __init__(self, top: float, right: float, bottom: float, left: float):
self.top = top
self.right = right
self.bottom = bottom
self.left = left
def to_flickr_bounding_box(self):
return '{self.left}, {self.bottom}, {self.right}, {self.top}'.format(se... |
#!/usr/bin/python3.6
class Reaction:
# the sets of reactants, inhibitors and products of the reaction
name = None
reactants = set()
inhibitors = set()
products = set()
# the creation of a reaction is made through the called of a function in which all the controls are performed, so we can
... | class Reaction:
name = None
reactants = set()
inhibitors = set()
products = set()
def __init__(self, _name, _reactants, _inhibitors, _products):
self.name = _name
self.reactants = _reactants
self.inhibitors = _inhibitors
self.products = _products
def __str__(sel... |
# Pattern that would startup the DUT, then do nothing else.
# Should still generate.
with Pattern() as pat:
...
| with pattern() as pat:
... |
N = int(input())
total = 0
for i in range(1, N+1):
if (i % 3) != 0 and (i % 5) != 0:
total = total+i
print(total)
| n = int(input())
total = 0
for i in range(1, N + 1):
if i % 3 != 0 and i % 5 != 0:
total = total + i
print(total) |
INSTRUCTIONS = {
"SUM": 0b00001,
"SUB": 0b00010,
"MULT": 0b00011,
"DIV": 0b00101,
}
def instrFor(instr):
return INSTRUCTIONS[instr] | instructions = {'SUM': 1, 'SUB': 2, 'MULT': 3, 'DIV': 5}
def instr_for(instr):
return INSTRUCTIONS[instr] |
#
# This file contains the Python code from Program 6.7 of
# "Data Structures and Algorithms
# with Object-Oriented Design Patterns in Python"
# by Bruno R. Preiss.
#
# Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved.
#
# http://www.brpreiss.com/books/opus7/programs/pgm06_07.txt
#
class StackAsLinked... | class Stackaslinkedlist(Stack):
def push(self, obj):
self._list.prepend(obj)
self._count += 1
def pop(self):
if self._count == 0:
raise ContainerEmpty
result = self._list.first
self._list.extract(result)
self._count -= 1
return result
de... |
class Model():
def __init__(self, model):
pass
| class Model:
def __init__(self, model):
pass |
pound = int(input())
conv_to_dollar = pound * 1.31
print(f"{conv_to_dollar:.3f}")
| pound = int(input())
conv_to_dollar = pound * 1.31
print(f'{conv_to_dollar:.3f}') |
S, W = map(int, input().split())
if(W >= S):
print("unsafe")
else:
print("safe") | (s, w) = map(int, input().split())
if W >= S:
print('unsafe')
else:
print('safe') |
#medicine = 'Coughussin'
#dosage = 5
#duration = 4.5
#instructions = '{} - Take {} ML by mouth every {} hours.'.format(medicine, dosage, duration)
#print(instructions)
#instructions = '{2} - Take {1} ML by mouth every {0} hours'.format(medicine, dosage, duration)
#print(instructions)
#instructions = '{medicine} - Take... | value = 'hi'
print(f'.{value:<25}.')
print(f'.{value:>25}.')
print(f'.{value:^25}.')
print(f'.{value:-^25}.') |
# TWITTER PYTHON
# Copyright 2022 Billyfranklim
# See LICENSE for details.
__version__ = '0.1.0'
__author__ = 'Billyfranklim Pereira'
__license__ = 'MIT' | __version__ = '0.1.0'
__author__ = 'Billyfranklim Pereira'
__license__ = 'MIT' |
# def print_hi(name):
# print(f'Hi, {name}')
# if __name__ == '__main__':
# print_hi('PyCharm')
print("Hello World Python xd")
# Para saber la direccion de memoria de cierta variable se usa el metodo id()
name = "Juan Diego Castellanos"
print(name)
print(id(name))
print("------")
print("tipo de dato")
print(ty... | print('Hello World Python xd')
name = 'Juan Diego Castellanos'
print(name)
print(id(name))
print('------')
print('tipo de dato')
print(type(name))
last_name: str = 'Castellanos Jerez'
print(last_name)
print('---------Day Qualifier--------')
dia = int(input('How was your day? (between 1 to 10 ): '))
print(f'Your day was... |
'''
Your plot of the ECDF and determination of the confidence interval make it pretty clear that the beaks of G. scandens on Daphne Major have gotten deeper. But is it possible that this effect is just due to random chance? In other words, what is the probability that we would get the observed difference in mean beak d... | """
Your plot of the ECDF and determination of the confidence interval make it pretty clear that the beaks of G. scandens on Daphne Major have gotten deeper. But is it possible that this effect is just due to random chance? In other words, what is the probability that we would get the observed difference in mean beak d... |
#!/usr/bin/env python3
def isBalanced(s: str) -> bool:
stack = []
pair = {'(': ')', '{': '}', '[': ']'}
for ch in s:
# For left brackets push right brackets
if (ch in pair.keys()):
stack.append(pair[ch])
else:
# Unmatch right char
if len(stack) =... | def is_balanced(s: str) -> bool:
stack = []
pair = {'(': ')', '{': '}', '[': ']'}
for ch in s:
if ch in pair.keys():
stack.append(pair[ch])
else:
if len(stack) == 0:
return False
if ch != stack[-1]:
return False
... |
#
# if type(input) == string:
# find if palindrome
# elif type(input) == number:
# find factorial
# find if palindrome
#
def pal(st):
l = len(st)
i = 0
flag = True
while i < l//2:
if st[i] == st[l-i-1]:
pass
else:
flag = False
i += 1
return flag
while True:
print("Menu\n1. for palindrome\n2... | def pal(st):
l = len(st)
i = 0
flag = True
while i < l // 2:
if st[i] == st[l - i - 1]:
pass
else:
flag = False
i += 1
return flag
while True:
print('Menu\n1. for palindrome\n2. for factorial\n3. exit')
ip = int(input('enter your choise: '))
... |
class TSDBClientException(Exception):
pass
class TSDBNotAlive(TSDBClientException):
pass
class TagsError(TSDBClientException):
pass
class ValidationError(TSDBClientException):
pass
class UnknownTSDBConnectProtocol(TSDBClientException):
def __init__(self, protocol):
self.protocol = ... | class Tsdbclientexception(Exception):
pass
class Tsdbnotalive(TSDBClientException):
pass
class Tagserror(TSDBClientException):
pass
class Validationerror(TSDBClientException):
pass
class Unknowntsdbconnectprotocol(TSDBClientException):
def __init__(self, protocol):
self.protocol = proto... |
# Author: Jocelino F.G
a, b = input().split(), input().split()
q1 = int(a[1])
v1 = float(a[2])
q2 = int(b[1])
v2 = float(b[2])
t1 = q1 * v1
t2 = q2 * v2
tt = t1 + t2
print('VALOR A PAGAR: R$ %.2f' %tt)
| (a, b) = (input().split(), input().split())
q1 = int(a[1])
v1 = float(a[2])
q2 = int(b[1])
v2 = float(b[2])
t1 = q1 * v1
t2 = q2 * v2
tt = t1 + t2
print('VALOR A PAGAR: R$ %.2f' % tt) |
def merge_sort(unsorted_list):
if len(unsorted_list) <= 1:
return unsorted_list
# Finding the middle point and partitioning the array into two halves
middle = len(unsorted_list) // 2
left = unsorted_list[:middle]
right = unsorted_list[middle:]
left = merge_sort(left)
right = merge_s... | def merge_sort(unsorted_list):
if len(unsorted_list) <= 1:
return unsorted_list
middle = len(unsorted_list) // 2
left = unsorted_list[:middle]
right = unsorted_list[middle:]
left = merge_sort(left)
right = merge_sort(right)
return list(merge(left, right))
def merge(left, right):
... |
x = 0
drone_chk = [112, 334, 4444, 4444, 445, 112, 27466, 445, 27466]
for i in drone_chk:
x ^= i
print("The missing drone order ID is:", x)
| x = 0
drone_chk = [112, 334, 4444, 4444, 445, 112, 27466, 445, 27466]
for i in drone_chk:
x ^= i
print('The missing drone order ID is:', x) |
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the co... | source('../../shared/qtcreator.py')
def main():
files = check_and_copy_files(testData.dataset('files.tsv'), 'filename', temp_dir())
if not files:
return
start_application('qtcreator' + SettingsPath)
if not started_without_plugin_error():
return
for current_file in files:
tes... |
#
# PySNMP MIB module F5-3DNS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/F5-3DNS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:11:39 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, 0... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, constraints_intersection, value_range_constraint, single_value_constraint) ... |
#Return the sum of all the multiples of 3 or 5 below the number passed in.
def solution(number):
lit = []
for i in range(0, number):
if i % 3 == 0 or i % 5 == 0:
lit.append(i)
return sum(lit)
#Alternate Solution
def solution(number):
return sum(x for x in range(number) if x % 3 == 0... | def solution(number):
lit = []
for i in range(0, number):
if i % 3 == 0 or i % 5 == 0:
lit.append(i)
return sum(lit)
def solution(number):
return sum((x for x in range(number) if x % 3 == 0 or x % 5 == 0)) |
class Queue:
def __init__(self, initial_values):
self.queue = initial_values
def enqueue(self, val):
self.queue.insert(0, val)
def dequeue(self):
if self.is_empty():
return None
else:
return self.queue.pop()
def size(self):
return len(... | class Queue:
def __init__(self, initial_values):
self.queue = initial_values
def enqueue(self, val):
self.queue.insert(0, val)
def dequeue(self):
if self.is_empty():
return None
else:
return self.queue.pop()
def size(self):
return len(s... |
# <auto-generated>
# This code was generated by the UnitCodeGenerator tool
#
# Changes to this file will be lost if the code is regenerated
# </auto-generated>
def to_millilitres(value):
return value * 14.786764781249998848
def to_litres(value):
return value * 0.014786764781249998848
def to_kilolitres(value):
re... | def to_millilitres(value):
return value * 14.78676478125
def to_litres(value):
return value * 0.01478676478125
def to_kilolitres(value):
return value * 1.4786764781249997e-05
def to_teaspoons(value):
return value * 2.498021521399172
def to_tablespoons(value):
return value * 0.8326738404663907
d... |
# Configure schema: 'Column_name': ['List', 'of', 'synonyms']
columns_with_synonyms = {
'Name': ['Mitglied des Landtages'],
'Fraktion': ['Partei',
'Fraktion (ggf. Partei)',
],
'Wahlkreis': ['Landtagswahlkreis der Direktkandidaten',
'Landtagswahlkreis',
... | columns_with_synonyms = {'Name': ['Mitglied des Landtages'], 'Fraktion': ['Partei', 'Fraktion (ggf. Partei)'], 'Wahlkreis': ['Landtagswahlkreis der Direktkandidaten', 'Landtagswahlkreis', 'Wahlkreis/Liste'], 'Kommentar': ['Anmerkung', 'Anmerkungen', 'Bemerkungen'], 'Bild': ['Foto'], 'Wikipedia-URL': []}
schema = list(c... |
# 18. Write a language program to get the volume of a sphere with radius 6
radius=6
volume=(4/3)*3.14*(radius**3)
print("Volume of sphere with radius 6= ",volume)
| radius = 6
volume = 4 / 3 * 3.14 * radius ** 3
print('Volume of sphere with radius 6= ', volume) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.