content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# vim: set fileencoding=<utf-8> :
# Copyright 2018-2020 John Lees and Nick Croucher
'''PopPUNK (POPulation Partitioning Using Nucleotide Kmers)'''
__version__ = '2.2.1'
| """PopPUNK (POPulation Partitioning Using Nucleotide Kmers)"""
__version__ = '2.2.1' |
n=int(input())
a=list(map(int,input().split()))
a.sort()
l=list(set(a))
k=l[0]
i=0
c=0
while(i!=n and k<=max(l)):
if(k==l[i]):
k=k+1
i=i+1
c=c+1
else:
break
print(c)
| n = int(input())
a = list(map(int, input().split()))
a.sort()
l = list(set(a))
k = l[0]
i = 0
c = 0
while i != n and k <= max(l):
if k == l[i]:
k = k + 1
i = i + 1
c = c + 1
else:
break
print(c) |
#Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the #node's value equals the given value. Return the subtree rooted with that node. If such node doesn't exist, #you should return NULL.
# Definition for a binary tree node.
# class TreeNode:
# def __init__... | class Solution:
def search_bst(self, root: TreeNode, val: int) -> TreeNode:
if not root:
return None
while root:
if root.val == val:
return root
elif val < root.val:
root = root.left
else:
root = root.ri... |
class ContainerAlreadyResolved(Exception):
def __init__(self):
super().__init__("Container already resolved can't be resolved again")
class ForbiddenChangeOnResolvedContainer(Exception):
def __init__(self):
super().__init__("Container can't be modified once resolved")
class ServiceAlreadyDef... | class Containeralreadyresolved(Exception):
def __init__(self):
super().__init__("Container already resolved can't be resolved again")
class Forbiddenchangeonresolvedcontainer(Exception):
def __init__(self):
super().__init__("Container can't be modified once resolved")
class Servicealreadydef... |
dna_to_rna_map = {
"G" : "C",
"C" : "G",
"T" : "A",
"A" : "U"
}
def to_rna(dna_strand):
return "".join([dna_to_rna_map[nuc] for nuc in dna_strand]) | dna_to_rna_map = {'G': 'C', 'C': 'G', 'T': 'A', 'A': 'U'}
def to_rna(dna_strand):
return ''.join([dna_to_rna_map[nuc] for nuc in dna_strand]) |
# Program untuk menampilkan belah ketupat
print('\n==========Belah Ketupat==========\n')
obj_1 = 1
for row_1 in range(6, 0, -1):
for col_1 in range(row_1):
print(' ', end='')
for print_obj_1 in range(obj_1):
print('#', end='')
obj_1+=2
if row_1 == 1:
obj_2 = 9
print('')... | print('\n==========Belah Ketupat==========\n')
obj_1 = 1
for row_1 in range(6, 0, -1):
for col_1 in range(row_1):
print(' ', end='')
for print_obj_1 in range(obj_1):
print('#', end='')
obj_1 += 2
if row_1 == 1:
obj_2 = 9
print('')
for row_2 in range(2, 6 + 1, 1):
... |
blocks = {
'CJK Unified Ideographs Extension A': (0x3400, 0x4DBF),
'CJK Unified Ideographs': (0x4E00, 0x9FFF),
'CJK Unified Ideographs Extension B': (0x20000, 0x2A6DF),
'CJK Unified Ideographs Extension C': (0x2A700, 0x2B73F),
'CJK Unified Ideographs Extension D': (0x2B740, 0x2B81F),
'CJK Unified Ideographs Exten... | blocks = {'CJK Unified Ideographs Extension A': (13312, 19903), 'CJK Unified Ideographs': (19968, 40959), 'CJK Unified Ideographs Extension B': (131072, 173791), 'CJK Unified Ideographs Extension C': (173824, 177983), 'CJK Unified Ideographs Extension D': (177984, 178207), 'CJK Unified Ideographs Extension E': (178208,... |
#app = faust.App('myapp', broker='kafka://localhost')
class QUANTAXIS_PUBSUBER():
def __init__(self, name, broker='rabbitmq://localhost'):
self.exchange = name
#@app.agent(value_type=Order)
def agent(value_type=order):
pass | class Quantaxis_Pubsuber:
def __init__(self, name, broker='rabbitmq://localhost'):
self.exchange = name
def agent(value_type=order):
pass |
class Util:
def __init__(self):
pass
@staticmethod
def compress_uri(uri, base_uri, prefix_map):
uri = uri.strip('<>')
if uri.startswith(base_uri):
return '<' + uri[len(base_uri):] + '>'
for prefix, prefix_uri in prefix_map.items():
if uri.startswith(p... | class Util:
def __init__(self):
pass
@staticmethod
def compress_uri(uri, base_uri, prefix_map):
uri = uri.strip('<>')
if uri.startswith(base_uri):
return '<' + uri[len(base_uri):] + '>'
for (prefix, prefix_uri) in prefix_map.items():
if uri.startswit... |
class ContactHelper:
def __init__(self, app):
self.app = app
def open_add_contact_page(self):
# open add creation new contact
wd = self.app.wd
wd.find_element_by_link_text("add new").click()
def fill_form(self, contact):
# fill contacts form
wd = self.app.w... | class Contacthelper:
def __init__(self, app):
self.app = app
def open_add_contact_page(self):
wd = self.app.wd
wd.find_element_by_link_text('add new').click()
def fill_form(self, contact):
wd = self.app.wd
self.open_add_contact_page()
wd.find_element_by_nam... |
MODEL_CONFIG = {
'unet':{
'simplenet':{
'in_channels':1,
'encoder_name':'simplenet',
'encoder_depth':5,
'encoder_channels':[32,64,128,256,512], #[1,2,4,8,16]
'encoder_weights':None,
'decoder_use_batchnorm':True,
'decoder_at... | model_config = {'unet': {'simplenet': {'in_channels': 1, 'encoder_name': 'simplenet', 'encoder_depth': 5, 'encoder_channels': [32, 64, 128, 256, 512], 'encoder_weights': None, 'decoder_use_batchnorm': True, 'decoder_attention_type': None, 'decoder_channels': [256, 128, 64, 32], 'upsampling': 1, 'classes': 2, 'aux_class... |
# Python - 3.6.0
stock = {
'football': 4,
'boardgame': 10,
'leggos': 1,
'doll': 5
}
test.assert_equals(fillable(stock, 'football', 3), True)
test.assert_equals(fillable(stock, 'leggos', 2), False)
test.assert_equals(fillable(stock, 'action figure', 1), False)
| stock = {'football': 4, 'boardgame': 10, 'leggos': 1, 'doll': 5}
test.assert_equals(fillable(stock, 'football', 3), True)
test.assert_equals(fillable(stock, 'leggos', 2), False)
test.assert_equals(fillable(stock, 'action figure', 1), False) |
# How to Find the Smallest value
largest_so_far = -1
print('Before', largest_so_far)
for the_num in [1, 99, 24, 25, 56, 4, 57, 89, 5, 94, 21] :
if the_num > largest_so_far :
largest_so_far = the_num
print(largest_so_far, the_num)
print('After', largest_so_far)
| largest_so_far = -1
print('Before', largest_so_far)
for the_num in [1, 99, 24, 25, 56, 4, 57, 89, 5, 94, 21]:
if the_num > largest_so_far:
largest_so_far = the_num
print(largest_so_far, the_num)
print('After', largest_so_far) |
integers = [ 1, 6, 4, 3, 15, -2]
print("integers[0] = ", integers[0])
print("integers[1] = ", integers[1])
print("integers[2] = ", integers[2])
print("integers[3] = ", integers[3])
print("integers[4] = ", integers[4])
print("integers[5] = ", integers[5])
| integers = [1, 6, 4, 3, 15, -2]
print('integers[0] = ', integers[0])
print('integers[1] = ', integers[1])
print('integers[2] = ', integers[2])
print('integers[3] = ', integers[3])
print('integers[4] = ', integers[4])
print('integers[5] = ', integers[5]) |
# # ###
# #
# letter = input ("Please enter a letter:\n")
# if (letter == 'i'):
# print ("am lettera vowela")
# elif (letter== 'a'):
# print("am lettera vowela")
# if (letter == 'u'):
# print ("am lettera vowela")
# elif (letter== 'e'):
# print("am lettera vowela")
# if (letter == 'o'):
# print('am ... | def check_vowels():
input_str = input('Enter string: ')
str_without_space = input_str.replace(' ', '')
if len([char for char in str_without_space if char in ['a', 'e', 'i', 'o', 'u']]) == len(input_str):
print('input contains all the vowels')
else:
print('string does not have all the vow... |
n = input()
l = list(map(int,raw_input().split()))
m = 0
mi = n-1
for i in range(n):
if l[i]> l[m]:
m=i
if l[i]<=l[mi]:
mi = i
if mi>m:
print (n+m-mi-1)
else:
print (n+m-mi-2)
| n = input()
l = list(map(int, raw_input().split()))
m = 0
mi = n - 1
for i in range(n):
if l[i] > l[m]:
m = i
if l[i] <= l[mi]:
mi = i
if mi > m:
print(n + m - mi - 1)
else:
print(n + m - mi - 2) |
'''Bet.py
'''
class Bets:
def __init__(self):
self.win = 0
self.info = {"dealer":self.dealer, "player":self.player}
def dealer(self, dealer):
self.dealer = dealer
def player(self, player):
self.player = player
def win(self):
self.win = self.od... | """Bet.py
"""
class Bets:
def __init__(self):
self.win = 0
self.info = {'dealer': self.dealer, 'player': self.player}
def dealer(self, dealer):
self.dealer = dealer
def player(self, player):
self.player = player
def win(self):
self.win = self.odds * self.bet... |
#!/usr/bin/python
with open('INCAR', 'r') as file:
lines=file.readlines()
for n,i in enumerate(lines):
if 'MAGMOM' in i:
# print(i)
items=i.split()
index=items.index('=')
moments=items[index+1:]
# print(moments)
magmom=''
size=4
for i in ra... | with open('INCAR', 'r') as file:
lines = file.readlines()
for (n, i) in enumerate(lines):
if 'MAGMOM' in i:
items = i.split()
index = items.index('=')
moments = items[index + 1:]
magmom = ''
size = 4
for i in range(len(moments) // 3):
k = ' '.join((k for k in mome... |
class text:
def __init__(self,text,*,thin=False,cancel=False,underline=False,bold=False,Italic=False,hide=False,Bg="black",Txt="white"):
self.__color={
"black":30,
"red":31,
"green":32,
"yellow":33,
"blue":34,
"mazenta":35,
... | class Text:
def __init__(self, text, *, thin=False, cancel=False, underline=False, bold=False, Italic=False, hide=False, Bg='black', Txt='white'):
self.__color = {'black': 30, 'red': 31, 'green': 32, 'yellow': 33, 'blue': 34, 'mazenta': 35, 'cian': 36, 'white': 37}
self.underline = ''
if un... |
# 23. Merge k Sorted Lists
# Runtime: 148 ms, faster than 33.74% of Python3 online submissions for Merge k Sorted Lists.
# Memory Usage: 17.8 MB, less than 82.01% of Python3 online submissions for Merge k Sorted Lists.
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None)... | class Solution:
def merge_k_lists(self, lists: list[ListNode]) -> ListNode:
def merge_two_lists(list1: ListNode, list2: ListNode) -> ListNode:
head = list_node()
curr = head
while list1 and list2:
if list1.val < list2.val:
curr.next =... |
configuration = None
def init():
global configuration
configuration = None
| configuration = None
def init():
global configuration
configuration = None |
class ArpProperties(object):
def __init__(self, bpm, base_note, pitch_value):
self.bpm = bpm
self.base_note = base_note
self.pitch = pitch_value
| class Arpproperties(object):
def __init__(self, bpm, base_note, pitch_value):
self.bpm = bpm
self.base_note = base_note
self.pitch = pitch_value |
# Day26 of 100 Days Of Code in Python
# get common numbers from two files using list comprehension
with open("file1.txt") as file1:
file1_data = file1.readlines()
with open("file2.txt") as file2:
file2_data = file2.readlines()
result = [int(item) for item in file1_data if item in file2_data]
print(result) | with open('file1.txt') as file1:
file1_data = file1.readlines()
with open('file2.txt') as file2:
file2_data = file2.readlines()
result = [int(item) for item in file1_data if item in file2_data]
print(result) |
#!/usr/bin/python3
# Problem : https://code.google.com/codejam/contest/351101/dashboard#s=p0
__author__ = 'Varun Barad'
def main():
no_of_test_cases = int(input())
for i in range(no_of_test_cases):
credit = int(input())
no_of_items = int(input())
items = input().split(' ')
for... | __author__ = 'Varun Barad'
def main():
no_of_test_cases = int(input())
for i in range(no_of_test_cases):
credit = int(input())
no_of_items = int(input())
items = input().split(' ')
for j in range(no_of_items):
items[j] = int(items[j])
for j in range(no_of_ite... |
def dibujo (base,altura):
dibujo=print("x"*base)
for fila in range (altura):
print("x"+" "*(base-2)+"x")
dibujo=print("x"*base)
dibujo(7,5)
| def dibujo(base, altura):
dibujo = print('x' * base)
for fila in range(altura):
print('x' + ' ' * (base - 2) + 'x')
dibujo = print('x' * base)
dibujo(7, 5) |
#
# PySNMP MIB module PACKETFRONT-SMI (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PACKETFRONT-SMI
# Produced by pysmi-0.3.4 at Wed May 1 14:36:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, single_value_constraint, value_size_constraint, constraints_union) ... |
# Python Program to find Perfect Number using For loop
Number = int(input(" Please Enter any Number: "))
Sum = 0
for i in range(1, Number):
if(Number % i == 0):
Sum = Sum + i
if (Sum == Number):
print(" %d is a Perfect Number" %Number)
else:
print(" %d is not a Perfect Number" %Number)
| number = int(input(' Please Enter any Number: '))
sum = 0
for i in range(1, Number):
if Number % i == 0:
sum = Sum + i
if Sum == Number:
print(' %d is a Perfect Number' % Number)
else:
print(' %d is not a Perfect Number' % Number) |
## Copyright (c) 2022, Team FirmWire
## SPDX-License-Identifier: BSD-3-Clause
TASKNAMES_LTE = [
"ERT",
"EMACDL",
"EL2H",
"EL2",
"ERRC",
"EMM",
"EVAL",
"ETC",
"LPP",
"IMC",
"SDM",
"VDM",
"IWLAN",
"WO",
"EL1",
"EL1_MPC",
"MLL1",
"SIMMNGR",
"L1ADT... | tasknames_lte = ['ERT', 'EMACDL', 'EL2H', 'EL2', 'ERRC', 'EMM', 'EVAL', 'ETC', 'LPP', 'IMC', 'SDM', 'VDM', 'IWLAN', 'WO', 'EL1', 'EL1_MPC', 'MLL1', 'SIMMNGR', 'L1ADT', 'SSDS']
tasknames_2_g3_g = ['RRLP', 'RATCM', 'MRS', 'URR', 'UL2', 'TL2', 'UL2D', 'TL2D', 'GL1_PCORE', 'RSVA', 'MM', 'CC', 'CISS', 'SMS', 'SIM', 'SIM2', ... |
def helper(N):
if (N <= 2):
print ("NO")
return
value = (N * (N + 1)) // 2
if(value%2==1):
print ("NO")
return
s1 = []
s2 = []
if (N%2==0):
shift = True
start = 1
last = N
while (start < last):
if (shift):
... | def helper(N):
if N <= 2:
print('NO')
return
value = N * (N + 1) // 2
if value % 2 == 1:
print('NO')
return
s1 = []
s2 = []
if N % 2 == 0:
shift = True
start = 1
last = N
while start < last:
if shift:
s1.... |
ls=[12,3,9,4,1]
a=len(ls)
l=[]
for i in reversed(range(a)):
l.append(ls[i])
print(l)
| ls = [12, 3, 9, 4, 1]
a = len(ls)
l = []
for i in reversed(range(a)):
l.append(ls[i])
print(l) |
#default
def printx(name,age):
print(name)
print(age)
return;
printx(name='miki',age=96)
#keyword
def printm(str):
print(str)
return;
printm(str='sandy')
#required
def printme(str):
print(str)
return;
printme()
| def printx(name, age):
print(name)
print(age)
return
printx(name='miki', age=96)
def printm(str):
print(str)
return
printm(str='sandy')
def printme(str):
print(str)
return
printme() |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( arr , n , k ) :
count = 0
for i in range ( 0 , n ) :
if ( arr [ i ] <= k ) :
count = co... | def f_gold(arr, n, k):
count = 0
for i in range(0, n):
if arr[i] <= k:
count = count + 1
bad = 0
for i in range(0, count):
if arr[i] > k:
bad = bad + 1
ans = bad
j = count
for i in range(0, n):
if j == n:
break
if arr[i] > k... |
def is_leap(year):
leap = False
if year%400==0:
return True
if year%4==0 and year%100!=0:
return True
return leap
year = int(input())
print(is_leap(year)) | def is_leap(year):
leap = False
if year % 400 == 0:
return True
if year % 4 == 0 and year % 100 != 0:
return True
return leap
year = int(input())
print(is_leap(year)) |
with open("inp1.txt") as file:
data = file.read()
depths = [int(line) for line in data.splitlines()]
depth_inc_cnt = 0
for i in range(1, len(depths)):
if depths[i] > depths[i - 1]:
depth_inc_cnt += 1
print(f"Part 1: {depth_inc_cnt}")
assert depth_inc_cnt == 1832
depth_windowed_inc_cnt = 0
for i in... | with open('inp1.txt') as file:
data = file.read()
depths = [int(line) for line in data.splitlines()]
depth_inc_cnt = 0
for i in range(1, len(depths)):
if depths[i] > depths[i - 1]:
depth_inc_cnt += 1
print(f'Part 1: {depth_inc_cnt}')
assert depth_inc_cnt == 1832
depth_windowed_inc_cnt = 0
for i in range... |
class ListNode:
def __init__ (self, val, next = None):
self.val = val
self.next = next
class Solution:
def swapPairs(self, head):
dummy = ListNode(0)
curr = dummy
dummy.next = head
while curr.next and curr.next.next:
tmp = curr.next
tmp2 ... | class Listnode:
def __init__(self, val, next=None):
self.val = val
self.next = next
class Solution:
def swap_pairs(self, head):
dummy = list_node(0)
curr = dummy
dummy.next = head
while curr.next and curr.next.next:
tmp = curr.next
tmp2 ... |
# UVa 11450 - Wedding Shopping - Bottom Up (faster than Top Down)
def main():
TC = int(input())
for tc in range(TC):
MAX_gm = 30 # 20 garments at most and 20 models per garment at most
MAX_M = 210 # maximum budget i... | def main():
tc = int(input())
for tc in range(TC):
max_gm = 30
max_m = 210
price = [[-1 for i in range(MAX_gm)] for j in range(MAX_gm)]
reachable = [[False for i in range(MAX_M)] for j in range(2)]
(m, c) = [int(x) for x in input().split(' ')]
for g in range(C):
... |
price_list = { 1 : 4.0, 2 : 4.5, 3 : 5.0, 4 : 2.0, 5 : 1.5}
values = input()
product_code, price_product = [int(value) for value in values.split(' ')]
print('Total: R$ {:.2f}'.format(price_list[product_code] * price_product))
| price_list = {1: 4.0, 2: 4.5, 3: 5.0, 4: 2.0, 5: 1.5}
values = input()
(product_code, price_product) = [int(value) for value in values.split(' ')]
print('Total: R$ {:.2f}'.format(price_list[product_code] * price_product)) |
# try out the Python stack functions
# TODO: create a new empty stack
stack = []
# TODO: push items onto the stack
stack.append(1)
stack.append(2)
stack.append(3)
stack.append(4)
# TODO: print the stack contents
print(stack)
#TODO: pop an item off the stack
x = stack.pop()
print(x)
print(stack)
| stack = []
stack.append(1)
stack.append(2)
stack.append(3)
stack.append(4)
print(stack)
x = stack.pop()
print(x)
print(stack) |
class Sword():
def __init__(self, name, damage):
self.damage = damage
self.name = name
@staticmethod
def showAbilities():
print("Swords can only attack orcs and elves, and do zero damage agains magic armour.")
Sword.showAbilities()
| class Sword:
def __init__(self, name, damage):
self.damage = damage
self.name = name
@staticmethod
def show_abilities():
print('Swords can only attack orcs and elves, and do zero damage agains magic armour.')
Sword.showAbilities() |
''' instantiating a class
The process of creating a an object from a class.
''' | """ instantiating a class
The process of creating a an object from a class.
""" |
#
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
#
# SPDX-License-Identifier: Apache-2.0
#
SOC_IRAM_LOW = 0x4037c000
SOC_IRAM_HIGH = 0x403e0000
SOC_DRAM_LOW = 0x3fc80000
SOC_DRAM_HIGH = 0x3fce0000
SOC_RTC_DRAM_LOW = 0x50000000
SOC_RTC_DRAM_HIGH = 0x50002000
SOC_RTC_DATA_LOW = 0x50000000
SOC_RTC_DAT... | soc_iram_low = 1077395456
soc_iram_high = 1077805056
soc_dram_low = 1070071808
soc_dram_high = 1070465024
soc_rtc_dram_low = 1342177280
soc_rtc_dram_high = 1342185472
soc_rtc_data_low = 1342177280
soc_rtc_data_high = 1342185472 |
# greaseweazle/image/hfe.py
#
# Written & released by Keir Fraser <keir.xen@gmail.com>
#
# This is free and unencumbered software released into the public domain.
# See the file COPYING for more details, or visit <http://unlicense.org>.
class HFE:
def __init__(self, start_cyl, nr_sides):
self.start_cyl = ... | class Hfe:
def __init__(self, start_cyl, nr_sides):
self.start_cyl = start_cyl
self.nr_sides = nr_sides
self.nr_revs = None
self.track_list = []
@classmethod
def from_file(cls, dat):
hfe = cls(0, 2)
return hfe
def get_track(self, cyl, side, writeout=Fal... |
# ------------------------------------------------------------------------------
# Access to the CodeHawk Binary Analyzer Analysis Results
# Author: Henny Sipma
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2016-2020 Kestrel Technology LLC
#
#... | class Jumptable(object):
def __init__(self, app, x):
self.app = app
self.x = x
self.base = self.x.get('start')
self.tgts = [n.get('a') for n in self.x.findall('tgt')]
def get_targets(self):
return self.tgts
def __str__(self):
lines = []
lines.append... |
# @desc By Anay '24
def check_age(age):
if age < 21:
return age
return age + 5
def main():
print(check_age(5))
print(check_age(29))
print(check_age(42))
print(check_age(15))
print(check_age(0.38))
print(check_age(21))
if __name__ == '__main__':
main()
| def check_age(age):
if age < 21:
return age
return age + 5
def main():
print(check_age(5))
print(check_age(29))
print(check_age(42))
print(check_age(15))
print(check_age(0.38))
print(check_age(21))
if __name__ == '__main__':
main() |
#test
print('==================================')
print(' this is just a test ')
print('==================================')
num = int(input('insert a number: '))
print((num * 5) % 3)
| print('==================================')
print(' this is just a test ')
print('==================================')
num = int(input('insert a number: '))
print(num * 5 % 3) |
def is_isogram(word):
word_dict = dict()
for c in word:
c = c.lower()
if ord('a') <= ord(c) <= ord('z'):
word_dict[c] = word_dict.get(c, 0) + 1
if word_dict[c] >= 2:
return False
return True
| def is_isogram(word):
word_dict = dict()
for c in word:
c = c.lower()
if ord('a') <= ord(c) <= ord('z'):
word_dict[c] = word_dict.get(c, 0) + 1
if word_dict[c] >= 2:
return False
return True |
option = None
def pytest_addoption(parser):
parser.addoption('--nproc', help='run tests on n processes', type=int, default=1)
parser.addoption('--lsf', help='run tests on with lsf clusters', action="store_true")
parser.addoption('--specs', help='test specs')
parser.addoption('--cases', help='test case ... | option = None
def pytest_addoption(parser):
parser.addoption('--nproc', help='run tests on n processes', type=int, default=1)
parser.addoption('--lsf', help='run tests on with lsf clusters', action='store_true')
parser.addoption('--specs', help='test specs')
parser.addoption('--cases', help='test case ... |
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def merge_list(head1, head2):
if head1 is None:
return head2
if head2 is None:
return head1
if head2.val < head1.val:
head1, head2 = head2, head1
head1.next = merge_list(head1.next, head2)
... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
def merge_list(head1, head2):
if head1 is None:
return head2
if head2 is None:
return head1
if head2.val < head1.val:
(head1, head2) = (head2, head1)
head1.next = merge_list(head1.next, hea... |
first_number = int(input())
second_number = int(input())
large_number = max(first_number, second_number)
small_number = min(first_number, second_number)
remaining_number = 0
gcd = 0
while True:
times = large_number // small_number
remain = large_number - ( small_number * times )
if 0 == remain:
... | first_number = int(input())
second_number = int(input())
large_number = max(first_number, second_number)
small_number = min(first_number, second_number)
remaining_number = 0
gcd = 0
while True:
times = large_number // small_number
remain = large_number - small_number * times
if 0 == remain:
gcd = sm... |
#
# PySNMP MIB module HM2-TRAFFICMGMT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HM2-TRAFFICMGMT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:19:47 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ... |
def find(s):
if s > 0 :
for i in range(9):
if s + i == 10:
return i
else :
return 0
s = 0
t = int(input())
for _ in range(int(t)):
n = int(input())
f = n
while(n>0):
d = n%10
s += d
n = n//10
x = find(s)
print(str(f)+str(x))
d = 0
s = 0 | def find(s):
if s > 0:
for i in range(9):
if s + i == 10:
return i
else:
return 0
s = 0
t = int(input())
for _ in range(int(t)):
n = int(input())
f = n
while n > 0:
d = n % 10
s += d
n = n // 10
x = find(s)
print(str(f) + st... |
x=int(input())
if x < 0:
print(-x)
else:
print(x)
| x = int(input())
if x < 0:
print(-x)
else:
print(x) |
students = int(input())
students_dict = {}
top_students = {}
for _ in range(students):
name = input()
grade = float(input())
if name in students_dict:
students_dict[name].append(grade)
else:
students_dict[name] = [grade]
# for key, item in students_dict.items():
# if sum(item) / le... | students = int(input())
students_dict = {}
top_students = {}
for _ in range(students):
name = input()
grade = float(input())
if name in students_dict:
students_dict[name].append(grade)
else:
students_dict[name] = [grade]
top_students = {k: sum(v) / len(v) for (k, v) in students_dict.item... |
TASKS = {
"binary_classification": 1,
"multi_class_classification": 2,
"entity_extraction": 4,
"extractive_question_answering": 5,
"summarization": 8,
"single_column_regression": 10,
"speech_recognition": 11,
}
DATASETS_TASKS = ["text-classification", "question-answering-extractive"]
| tasks = {'binary_classification': 1, 'multi_class_classification': 2, 'entity_extraction': 4, 'extractive_question_answering': 5, 'summarization': 8, 'single_column_regression': 10, 'speech_recognition': 11}
datasets_tasks = ['text-classification', 'question-answering-extractive'] |
class GuiAbstractObject:
def is_clicked(self, mouse):
area = (self.position[0] * self.screen.engine.settings.graphic['screen']['resolution_scale'][0],
self.position[1] * self.screen.engine.settings.graphic['screen']['resolution_scale'][1],
(self.position[0] + self.position[2... | class Guiabstractobject:
def is_clicked(self, mouse):
area = (self.position[0] * self.screen.engine.settings.graphic['screen']['resolution_scale'][0], self.position[1] * self.screen.engine.settings.graphic['screen']['resolution_scale'][1], (self.position[0] + self.position[2]) * self.screen.engine.settings... |
class NagiosException(Exception):
pass
class NagiosUnexpectedResultError(Exception):
pass
| class Nagiosexception(Exception):
pass
class Nagiosunexpectedresulterror(Exception):
pass |
#!/usr/bin/env python
log_dir = os.environ['LOG_DIR']
admin_server_listen_address = os.environ['ADMIN_SERVER_LISTEN_ADDRESS']
admin_server_listen_port = os.environ['ADMIN_SERVER_LISTEN_PORT']
admin_username = os.environ['ADMIN_USERNAME']
admin_password = os.environ['ADMIN_PASSWORD']
managed_server_name = os.environ[... | log_dir = os.environ['LOG_DIR']
admin_server_listen_address = os.environ['ADMIN_SERVER_LISTEN_ADDRESS']
admin_server_listen_port = os.environ['ADMIN_SERVER_LISTEN_PORT']
admin_username = os.environ['ADMIN_USERNAME']
admin_password = os.environ['ADMIN_PASSWORD']
managed_server_name = os.environ['MANAGED_SERVER_NAME']
d... |
print("Choose from below options:")
print("1.Celsius to Fahrenheit.")
print("2.Fahrenheit to Celsius.")
o=int(input("option(1/2):"))
if(o==1):
c=float(input("Temperature in Celsius:"))
f=1.8*(c)+32.0
f=round(f,1) #temperature in fahrenheit precise to 1 decimal place
print("Temperature in Fahrenheit:",f)... | print('Choose from below options:')
print('1.Celsius to Fahrenheit.')
print('2.Fahrenheit to Celsius.')
o = int(input('option(1/2):'))
if o == 1:
c = float(input('Temperature in Celsius:'))
f = 1.8 * c + 32.0
f = round(f, 1)
print('Temperature in Fahrenheit:', f)
elif o == 2:
f = float(input('Temper... |
class Symbol:
def __init__(self,S,sign=1):
if type(S) != str:
raise TypeError("Symbols must be strings")
if S not in "abcdefghijklmnopqrstuvwxyz":
raise ValueError("Symbols must be lowercase letters")
self.S = S
self.sign = sign
def __str__(self):
... | class Symbol:
def __init__(self, S, sign=1):
if type(S) != str:
raise type_error('Symbols must be strings')
if S not in 'abcdefghijklmnopqrstuvwxyz':
raise value_error('Symbols must be lowercase letters')
self.S = S
self.sign = sign
def __str__(self):
... |
# Enter your code here. Read input from STDIN. Print output to STDOUT
n=int(input())
roll_n=set(map(int,input().split()))
m=int(input())
roll_m=set(map(int,input().split()))
s=roll_n|roll_m
print(len(s))
| n = int(input())
roll_n = set(map(int, input().split()))
m = int(input())
roll_m = set(map(int, input().split()))
s = roll_n | roll_m
print(len(s)) |
logLevel = 0
def log(msg):
if logLevel > 0:
print(msg)
else:
pass
def setLogLevel(value):
global logLevel
logLevel = value | log_level = 0
def log(msg):
if logLevel > 0:
print(msg)
else:
pass
def set_log_level(value):
global logLevel
log_level = value |
def solution(moves):
moves = list(moves)
programs = [chr(s) for s in range(ord("a"), ord("a") + 16)]
hashmap = {program: position for position, program in enumerate(programs)}
movemap = {"s": spin, "x": exchange, "p": partner}
seen = []
s = "".join(programs)
while s not in seen:
see... | def solution(moves):
moves = list(moves)
programs = [chr(s) for s in range(ord('a'), ord('a') + 16)]
hashmap = {program: position for (position, program) in enumerate(programs)}
movemap = {'s': spin, 'x': exchange, 'p': partner}
seen = []
s = ''.join(programs)
while s not in seen:
se... |
# The Nexus software is licensed under the BSD 2-Clause license.
#
# You should have recieved a copy of this license with the software.
# If you did not, you can find one at the following link.
#
# http://opensource.org/licenses/bsd-license.php
if len(parts) < 5:
self.client.sendServerMessage("For Make-a-Mob plea... | if len(parts) < 5:
self.client.sendServerMessage('For Make-a-Mob please use:')
self.client.sendServerMessage('/entity var blocktype MovementBehavior NearBehavior')
self.client.sendServerMessage('MovementBehavior: follow engulf pet random none')
self.client.sendServerMessage('NearBehavior: kill explode n... |
del_items(0x80122D48)
SetType(0x80122D48, "struct THEME_LOC themeLoc[50]")
del_items(0x80123490)
SetType(0x80123490, "int OldBlock[4]")
del_items(0x801234A0)
SetType(0x801234A0, "unsigned char L5dungeon[80][80]")
del_items(0x80123130)
SetType(0x80123130, "struct ShadowStruct SPATS[37]")
del_items(0x80123234)
SetType(0x... | del_items(2148674888)
set_type(2148674888, 'struct THEME_LOC themeLoc[50]')
del_items(2148676752)
set_type(2148676752, 'int OldBlock[4]')
del_items(2148676768)
set_type(2148676768, 'unsigned char L5dungeon[80][80]')
del_items(2148675888)
set_type(2148675888, 'struct ShadowStruct SPATS[37]')
del_items(2148676148)
set_ty... |
'''
some other implementations:
recursive:
def binary_search(array, key, start, end):
if end < start:
return -1
else:
midpoint = start + (end - start) // 2
if key < array[midpoint]:
return binary_search(array, key, start, midpoint - 1... | """
some other implementations:
recursive:
def binary_search(array, key, start, end):
if end < start:
return -1
else:
midpoint = start + (end - start) // 2
if key < array[midpoint]:
return binary_search(array, key, start, midpoint - 1)
... |
bil = -4
if (bil > 0):
print("Bilangan positif")
else:
print("Bilangan negatif atau nol") | bil = -4
if bil > 0:
print('Bilangan positif')
else:
print('Bilangan negatif atau nol') |
input_name: str = input()
if input_name == 'Johnny':
print('Hello, my love!')
else:
print(f'Hello, {input_name}!')
| input_name: str = input()
if input_name == 'Johnny':
print('Hello, my love!')
else:
print(f'Hello, {input_name}!') |
def binary_search(array, target):
first = 0
last = len(array) - 1
while first <= last:
midpoint = (first + last) // 2
if array[midpoint] == target:
return midpoint
elif array[midpoint] < target:
first = midpoint + 1
elif array[midpoint] > target:
... | def binary_search(array, target):
first = 0
last = len(array) - 1
while first <= last:
midpoint = (first + last) // 2
if array[midpoint] == target:
return midpoint
elif array[midpoint] < target:
first = midpoint + 1
elif array[midpoint] > target:
... |
class Solution:
def heightChecker(self, heights: List[int]) -> int:
expected = sorted(heights)
indices=0
for i in range(len(heights)):
if(heights[i] != expected[i]):
indices += 1
return indices | class Solution:
def height_checker(self, heights: List[int]) -> int:
expected = sorted(heights)
indices = 0
for i in range(len(heights)):
if heights[i] != expected[i]:
indices += 1
return indices |
def Plus(a,b):
return a + b
def Minus(a,b):
return a - b
def Times(a,b):
return a*b
def Divide(a,b):
return a/b
| def plus(a, b):
return a + b
def minus(a, b):
return a - b
def times(a, b):
return a * b
def divide(a, b):
return a / b |
def filesFunctionField2list(files, func, field):
theList = []
for file in files:
record = {
"name": file,
field: func(file)
}
theList.append(record)
return theList
def filesClassFunctionField2list(files, Class, functionString, field):
theList = []
for file in files:
myClass = Class(file)
method =... | def files_function_field2list(files, func, field):
the_list = []
for file in files:
record = {'name': file, field: func(file)}
theList.append(record)
return theList
def files_class_function_field2list(files, Class, functionString, field):
the_list = []
for file in files:
my_... |
cancerlist = ["ACC", "BLCA", "BRCA", "CESC", "CHOL", "COAD", "DLBC", "ESCA", "GBM", "HNSC", "KICH", "KIRC", "KIRP", "LGG", "LIHC", "LUAD", "LUSC", "MESO", "OV", "PAAD", "PCPG", "PRAD", "READ", "SARC", "SKCM", "STAD", "TGCT", "THCA", "THYM", "UCEC", "UCS", "UVM"]
input_data_path = "/ngs/data3/public_data/TCGA_FireBrows... | cancerlist = ['ACC', 'BLCA', 'BRCA', 'CESC', 'CHOL', 'COAD', 'DLBC', 'ESCA', 'GBM', 'HNSC', 'KICH', 'KIRC', 'KIRP', 'LGG', 'LIHC', 'LUAD', 'LUSC', 'MESO', 'OV', 'PAAD', 'PCPG', 'PRAD', 'READ', 'SARC', 'SKCM', 'STAD', 'TGCT', 'THCA', 'THYM', 'UCEC', 'UCS', 'UVM']
input_data_path = '/ngs/data3/public_data/TCGA_FireBrowse... |
N, L = map(int, input().split())
ans = 0
margin = float("inf")
for i in range(1, N + 1):
tar = 0
for j in range(1, N + 1):
tar += L + j - 1
res = 0
for j in range(1, N + 1):
if j == i:
continue
else:
res += L + j - 1
if abs(tar - res) < margin:
... | (n, l) = map(int, input().split())
ans = 0
margin = float('inf')
for i in range(1, N + 1):
tar = 0
for j in range(1, N + 1):
tar += L + j - 1
res = 0
for j in range(1, N + 1):
if j == i:
continue
else:
res += L + j - 1
if abs(tar - res) < margin:
... |
#!/usr/bin/python3
def max_integer(my_list=[]):
if (len(my_list) == 0):
return (None)
a = my_list[0]
for i in range(0, len(my_list)):
if (my_list[i] > a):
a = my_list[i]
return (a)
| def max_integer(my_list=[]):
if len(my_list) == 0:
return None
a = my_list[0]
for i in range(0, len(my_list)):
if my_list[i] > a:
a = my_list[i]
return a |
# Enter your code here
def triple(num):
num = num*3
print(num)
triple(6)
triple(99)
| def triple(num):
num = num * 3
print(num)
triple(6)
triple(99) |
EMBED_SIZE = 200
NUM_LAYERS = 2
LR = 0.0001
MAX_GRAD_NORM = 5.0
PAD_ID = 0
UNK_ID = 1
START_ID = 2
EOS_ID = 3
CONV_SIZE = 3
# sanity
# BUCKETS = [(55, 50)]
# BATCH_SIZE = 10
# NUM_EPOCHS = 50
# NUM_SAMPLES = 498
# HIDDEN_SIZE = 400
# test
BUCKETS = [(30, 30), (55, 50)]
BATCH_SIZE = 20
NUM_EPOCHS = 3
NUM_SAMPLES = ... | embed_size = 200
num_layers = 2
lr = 0.0001
max_grad_norm = 5.0
pad_id = 0
unk_id = 1
start_id = 2
eos_id = 3
conv_size = 3
buckets = [(30, 30), (55, 50)]
batch_size = 20
num_epochs = 3
num_samples = 498
hidden_size = 400 |
# a = 42
# print(type(a))
# a = str(a)
# print(type(a))
a = 42.3
print(type(a))
a = str(a)
print(type(a))
| a = 42.3
print(type(a))
a = str(a)
print(type(a)) |
#
# PySNMP MIB module ENTERASYS-IEEE802DOT11EXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-IEEE802DOT11EXT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:49:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ve... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint, constraints_union) ... |
class Solution:
def longestCommonSub(self, a, n, b, m):
dp = [[0]*(m+1) for i in range(n+1)]
for i in range(1, n+1):
for j in range(1, m+1):
if a[i-1] == b[j-1]:
dp[i][j] = dp[i-1][j-1] + 1
else:
dp[i][j] = max(dp[i... | class Solution:
def longest_common_sub(self, a, n, b, m):
dp = [[0] * (m + 1) for i in range(n + 1)]
for i in range(1, n + 1):
for j in range(1, m + 1):
if a[i - 1] == b[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
load("//antlir/bzl:shape.bzl", "shape")
load("//antlir/bzl:target_tagger.shape.bzl", "target_tagged_image_source_t")
tarball_t = shape.shap... | load('//antlir/bzl:shape.bzl', 'shape')
load('//antlir/bzl:target_tagger.shape.bzl', 'target_tagged_image_source_t')
tarball_t = shape.shape(force_root_ownership=shape.field(bool, optional=True), into_dir=shape.path, source=target_tagged_image_source_t) |
# -*- coding: utf-8 -*-
if __name__ == '__main__':
a = u'\u5f53\u524d\u4e91\u533a\u57df\u6ca1\u6709\u53ef\u7528\u7684'
# PROXY\uff0c\u8bf7\u5148\u68c0\u67e5\u5e76\u5b89\u88c5', u'\u76f4\u8fde\u533a\u57df\uff0c\u4e0d\u80fd\u5b89\u88c5PROXY\u548cPAGENT'
print(a) | if __name__ == '__main__':
a = u'当前云区域没有可用的'
print(a) |
if condition:
...
else:
...
| if condition:
...
else:
... |
#
# PySNMP MIB module Juniper-DNS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-DNS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:51:26 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, value_size_constraint, constraints_union, value_range_constraint) ... |
# I have no idea if this is actually functioning.
def line_intersection(l1, l2):
xdiff = (l1[0][0] - l1[1][0], l2[0][0] - l2[1][0])
ydiff = (l1[0][1] - l1[1][1], l2[0][1] - l2[1][1])
def det(a, b):
return a[0] * b[1] - a[1] * b[0]
div = det(xdiff, ydiff)
if div == 0:
return False
... | def line_intersection(l1, l2):
xdiff = (l1[0][0] - l1[1][0], l2[0][0] - l2[1][0])
ydiff = (l1[0][1] - l1[1][1], l2[0][1] - l2[1][1])
def det(a, b):
return a[0] * b[1] - a[1] * b[0]
div = det(xdiff, ydiff)
if div == 0:
return False
d = (det(*l1), det(*l2))
x = det(d, xdiff) /... |
fr = input('Frase: ')
for i in range(len(fr) -1,-1,-1):
print(fr[i], end='')
| fr = input('Frase: ')
for i in range(len(fr) - 1, -1, -1):
print(fr[i], end='') |
def solve(arr, k):
cur=float("-inf")
ans=tuple()
total=sum(arr)
for i in range(len(arr), k-1, -1):
temp=compute(arr, total, i)
if temp[0]>cur:
cur=temp[0]
ans=(temp[1], i)
total-=arr[i-1]
return ans
def compute(arr, total, k):
cur=total
index=0... | def solve(arr, k):
cur = float('-inf')
ans = tuple()
total = sum(arr)
for i in range(len(arr), k - 1, -1):
temp = compute(arr, total, i)
if temp[0] > cur:
cur = temp[0]
ans = (temp[1], i)
total -= arr[i - 1]
return ans
def compute(arr, total, k):
... |
# Move all xeroes to right
N = int(input(''))
array = list(map(int, input().split(' ')[:N]))
flag = 0
# BRING/REPLACE ALL NON-ZEROES TO LEFT
for index in range(0, len(array)):
if(array[index] != 0):
array[flag] = array[index]
flag = flag+1
# NOW ADD ALL ZEROS TOWARDS RIGHT
for index in range(flag... | n = int(input(''))
array = list(map(int, input().split(' ')[:N]))
flag = 0
for index in range(0, len(array)):
if array[index] != 0:
array[flag] = array[index]
flag = flag + 1
for index in range(flag, len(array)):
array[index] = 0
print(array) |
# Space : O(n)
# Time : O(n)
class Solution:
def reverseWords(self, s: str) -> str:
l = s.split(" ")
for i in range(len(l)):
l[i] = l[i][::-1]
return " ".join(l)
| class Solution:
def reverse_words(self, s: str) -> str:
l = s.split(' ')
for i in range(len(l)):
l[i] = l[i][::-1]
return ' '.join(l) |
inputTemplates = {
"M3": {
"QCD": [
[
0.0,
0.0004418671450315185,
0.01605229202018541,
0.05825334528354453,
0.08815209477081883,
0.1030093733105401,
0.10513254530282935,
... | input_templates = {'M3': {'QCD': [[0.0, 0.0004418671450315185, 0.01605229202018541, 0.05825334528354453, 0.08815209477081883, 0.1030093733105401, 0.10513254530282935, 0.09543913272896494, 0.08512520799056993, 0.07489480051367764, 0.06022183314704696, 0.05275434234820922, 0.04426859109280948, 0.03513151550399711, 0.0299... |
# AT Commands
MAKE = 'at+cgmi'
MODEL = 'at+cgmm'
STATUS = 'at!gstatus?'
BANDMASK = 'at!gband?'
SIGNALQ = 'at+csq'
PWRMODE = { 'reboot': 'at!reset',
'lowpower': 'at+cfun=4',
'fullpower': 'at+cfun=1'}
| make = 'at+cgmi'
model = 'at+cgmm'
status = 'at!gstatus?'
bandmask = 'at!gband?'
signalq = 'at+csq'
pwrmode = {'reboot': 'at!reset', 'lowpower': 'at+cfun=4', 'fullpower': 'at+cfun=1'} |
x=int(input("Enter a value for x: "))
y=int(input("Enter a value for y: "))
z=int(input("Enter a value for z: "))
if x<y<z:
print("branch 1", end =' ')
elif x>y>z:
print("branch 2", end =' ')
else:
print("branch 3", end =' ')
print("is the branch") | x = int(input('Enter a value for x: '))
y = int(input('Enter a value for y: '))
z = int(input('Enter a value for z: '))
if x < y < z:
print('branch 1', end=' ')
elif x > y > z:
print('branch 2', end=' ')
else:
print('branch 3', end=' ')
print('is the branch') |
PORT=5050
HEADER=128
FORMAT='utf-8'
HEADER=64
DISCONNECT_MESSAGE='bye_0x8x0_eyb'
PING_MSG='I____NAME____I'
CHANGE_BIT='I_____I'
| port = 5050
header = 128
format = 'utf-8'
header = 64
disconnect_message = 'bye_0x8x0_eyb'
ping_msg = 'I____NAME____I'
change_bit = 'I_____I' |
#!/usr/bin/env python3
syscall_table = [
"ni_syscall",
"console_putc",
"console_puts",
"process_create",
"process_exit",
"thread_create",
"thread_exit",
"vmo_create",
"vmo_write",
"vmo_read",
"vmo_map",
"register_server",
"register_named_server",
"register_client... | syscall_table = ['ni_syscall', 'console_putc', 'console_puts', 'process_create', 'process_exit', 'thread_create', 'thread_exit', 'vmo_create', 'vmo_write', 'vmo_read', 'vmo_map', 'register_server', 'register_named_server', 'register_client', 'register_client_by_name', 'ipc_call', 'ipc_return', 'nanosleep', 'clock_get',... |
class InvalidRequest(Exception):
def __init__(self, message='', status_code=403):
super(InvalidRequest, self).__init__()
self.message = message
self.status_code = status_code
@property
def as_dict(self):
return {
'error': 'Invalid Request',
'message'... | class Invalidrequest(Exception):
def __init__(self, message='', status_code=403):
super(InvalidRequest, self).__init__()
self.message = message
self.status_code = status_code
@property
def as_dict(self):
return {'error': 'Invalid Request', 'message': self.message} |
#!/usr/bin/env python
# coding: utf-8
# # BATCH 7 DAY 3 ASSIGNMENT
# Question 1
# In[ ]:
for altitude in range(1000,10000):
altitude=int(input('enter altitude'))
if altitude ==1000:
print('plane is safe to land')
elif altitude > 1000 and altitude < 5000:
print('bring the plane down to 1... | for altitude in range(1000, 10000):
altitude = int(input('enter altitude'))
if altitude == 1000:
print('plane is safe to land')
elif altitude > 1000 and altitude < 5000:
print('bring the plane down to 1000 ft')
else:
print('turn around and try later')
num1 = 0
num2 = 200
for n in... |
def merge_dicts(dict1, dict2):
res = {**dict1, **dict2}
return res
def pairwise(iterable):
itr = iter(iterable)
a = next(itr, None)
for b in itr:
yield a, b
a = b
| def merge_dicts(dict1, dict2):
res = {**dict1, **dict2}
return res
def pairwise(iterable):
itr = iter(iterable)
a = next(itr, None)
for b in itr:
yield (a, b)
a = b |
class Token:
def __init__(self):
self.content = []
def add_content(self, content):
self.content.append(content)
def close(self):
if len(self.content) == 0:
raise Exception("Content for token '" + self.token_name() + "' is missing")
| class Token:
def __init__(self):
self.content = []
def add_content(self, content):
self.content.append(content)
def close(self):
if len(self.content) == 0:
raise exception("Content for token '" + self.token_name() + "' is missing") |
##########################################################################
# Author: Samuca
#
# brief: returns if a str has "silva"
#
# this is a list exercise available on youtube:
# https://www.youtube.com/playlist?list=PLHz_AreHm4dm6wYOIW20Nyg12TAjmMGT-
############################################################... | name = str(input('write down your full name: ')).strip()
print('Is there Silva in the name? {}'.format('SILVA' in name.upper())) |
class Menu:
def __init__(self):
self.divMenu = '=' * 40
self.infoBot = 'CriptoBot / Versao: 1.1.2'
self.desenvolvedor = 'Guilherme Malaquias'
def inicial_menu(self) -> str:
return f'{self.divMenu}\n0 - Consultar Moeda\n1 - Consultar Moeda Por Intervalo\n\n2 - Para sair\n{self.d... | class Menu:
def __init__(self):
self.divMenu = '=' * 40
self.infoBot = 'CriptoBot / Versao: 1.1.2'
self.desenvolvedor = 'Guilherme Malaquias'
def inicial_menu(self) -> str:
return f'{self.divMenu}\n0 - Consultar Moeda\n1 - Consultar Moeda Por Intervalo\n\n2 - Para sair\n{self.d... |
async def call1(callback):
await callback()
| async def call1(callback):
await callback() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.