content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
'''
def candies(n, arr):
count = 0
for i in range(n):
even = True
sum_even = 0
sum_odd = 0
for j in range(n):
if i == j:
continue
if even:
sum_even += arr[j]
even = False
else:
s... | """
def candies(n, arr):
count = 0
for i in range(n):
even = True
sum_even = 0
sum_odd = 0
for j in range(n):
if i == j:
continue
if even:
sum_even += arr[j]
even = False
else:
su... |
class Queue:
#Constructor
def __init__(self):
self.queue = list()
self.maxSize = 8
self.head = 0
self.tail = 0
#Adding elements
def enqueue(self,data):
#Checking if the queue is full
if self.size() >= self.maxSize:
return ("Queue Full")
... | class Queue:
def __init__(self):
self.queue = list()
self.maxSize = 8
self.head = 0
self.tail = 0
def enqueue(self, data):
if self.size() >= self.maxSize:
return 'Queue Full'
self.queue.append(data)
self.tail += 1
return True
def... |
class Defaults(object):
window_size = 7
filter_nums = [100, 100, 100]
filter_sizes = [3, 4, 5]
hidden_sizes = [1200]
hidden_activation = 'relu'
max_vocab_size = 1000000
optimizer = 'adam'
learning_rate = 1e-4
epochs = 20
iobes = True # Map tags to IOBES on input
max_tokens... | class Defaults(object):
window_size = 7
filter_nums = [100, 100, 100]
filter_sizes = [3, 4, 5]
hidden_sizes = [1200]
hidden_activation = 'relu'
max_vocab_size = 1000000
optimizer = 'adam'
learning_rate = 0.0001
epochs = 20
iobes = True
max_tokens = None
encoding = 'utf-8'... |
def average_weight(file_name):
min_value=45
max_value=125
average=0
count_number=0
with open(file_name,"r") as FILE:
list1=list(FILE.read().split())
for i in list1:
i=int(i)
if(min_value<=i<=max_value):
average+=i
count_number+=1
if... | def average_weight(file_name):
min_value = 45
max_value = 125
average = 0
count_number = 0
with open(file_name, 'r') as file:
list1 = list(FILE.read().split())
for i in list1:
i = int(i)
if min_value <= i <= max_value:
average += i
count_number += ... |
#Python program to illustrate
# combining else with while
count = 0
while (count < 3):
count = count + 1
print("Hello Geek")
else:
print("In Else Block")
| count = 0
while count < 3:
count = count + 1
print('Hello Geek')
else:
print('In Else Block') |
DEFAULT_IMAGETYPES = {'jpg', 'png', 'apng', 'bmp', 'jpeg', 'gif', 'svg', 'webp'}
ZIP_TYPES = {'zip', 'cbz'}
RAR_TYPES = {'rar', 'cbr'}
_7Z_TYPES = {'7z', 'cb7'}
ASSETS = {
'styles.css',
'scripts.js',
'zenscroll.js',
'menu.svg',
'menu-light.svg',
'scroll.svg',
'scroll-light.svg',
'roboto-... | default_imagetypes = {'jpg', 'png', 'apng', 'bmp', 'jpeg', 'gif', 'svg', 'webp'}
zip_types = {'zip', 'cbz'}
rar_types = {'rar', 'cbr'}
_7_z_types = {'7z', 'cb7'}
assets = {'styles.css', 'scripts.js', 'zenscroll.js', 'menu.svg', 'menu-light.svg', 'scroll.svg', 'scroll-light.svg', 'roboto-bold.woff2', 'roboto-regular.wof... |
# Create a function taking a positive integer as its parameter and returning a string containing the Roman Numeral representation of that integer.
# Modern Roman numerals are written by expressing each digit separately starting with the left most digit and skipping any digit with a value of zero. In Roman numerals 199... | def solution(n):
if n == 0:
return ''
my_dict = {1000: 'M', 900: 'CM', 500: 'D', 400: 'CD', 100: 'C', 90: 'XC', 50: 'L', 40: 'XL', 10: 'X', 9: 'IX', 5: 'V', 4: 'IV', 1: 'I'}
for i in [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]:
if n - i >= 0:
return my_dict.get(i) + ''... |
a=0
b=1
n=10
print(1)
for i in range(n):
c=a+b
a=b
b=c
print(c)
| a = 0
b = 1
n = 10
print(1)
for i in range(n):
c = a + b
a = b
b = c
print(c) |
# Advent of Code 2015
#
# From https://adventofcode.com/2015/day/5
#
VOWELS = set('aeiou')
PAIRS = {x * 2 for x in 'abcdefghijklmnopqrstuvwxyz'}
NAUGHTY = {'ab', 'cd', 'pq', 'xy'}
def part1_check(string_):
if sum(string_.count(v) for v in VOWELS) >= 3:
pairs = set(string_[i:i + 2] for i in range(len(stri... | vowels = set('aeiou')
pairs = {x * 2 for x in 'abcdefghijklmnopqrstuvwxyz'}
naughty = {'ab', 'cd', 'pq', 'xy'}
def part1_check(string_):
if sum((string_.count(v) for v in VOWELS)) >= 3:
pairs = set((string_[i:i + 2] for i in range(len(string_) - 1)))
if not pairs.intersection(NAUGHTY) and pairs.int... |
BORDOR_LEFT = "CURSOR_REACH_LEFT"
BORDOR_RIGHT = "CURSOR_REACH_RIGHT"
BORDOR_TOP = "CURSOR_REACH_TOP"
BORDOR_BOTTOM = "CURSOR_REACH_BOTTOM"
| bordor_left = 'CURSOR_REACH_LEFT'
bordor_right = 'CURSOR_REACH_RIGHT'
bordor_top = 'CURSOR_REACH_TOP'
bordor_bottom = 'CURSOR_REACH_BOTTOM' |
#
# @lc app=leetcode id=226 lang=python3
#
# [226] Invert Binary Tree
#
# https://leetcode.com/problems/invert-binary-tree/description/
#
# algorithms
# Easy (66.70%)
# Likes: 4930
# Dislikes: 72
# Total Accepted: 670.1K
# Total Submissions: 997K
# Testcase Example: '[4,2,7,1,3,6,9]'
#
# Given the root of a bina... | class Solution:
def invert_tree(self, root: TreeNode) -> TreeNode:
if not root:
return root
left = self.invertTree(root.left)
right = self.invertTree(root.right)
root.right = left
root.left = right
return root |
number=int(input('What is your number? '))
prime=True
for fac in range(2, number):
if int(number)%fac==0 and not number==2:
prime=False
if prime==True and not number<2:
print('The number is prime.')
else:
print('The number is not prime.') | number = int(input('What is your number? '))
prime = True
for fac in range(2, number):
if int(number) % fac == 0 and (not number == 2):
prime = False
if prime == True and (not number < 2):
print('The number is prime.')
else:
print('The number is not prime.') |
# Source : https://leetcode.com/problems/check-if-numbers-are-ascending-in-a-sentence/
# Author : foxfromworld
# Date : 30/11/2021
# First attempt
class Solution:
def areNumbersAscending(self, s: str) -> bool:
curr = 0
for token in s.split(' '):
if token.isdigit():
#if toke... | class Solution:
def are_numbers_ascending(self, s: str) -> bool:
curr = 0
for token in s.split(' '):
if token.isdigit():
token = int(token)
if token > curr:
curr = token
else:
return False
re... |
class SquareRoot:
@staticmethod
def square_root(a):
c = pow(a, 0.5)
return c | class Squareroot:
@staticmethod
def square_root(a):
c = pow(a, 0.5)
return c |
# HS08TEST
amt,bal=map(float,input().split())
if(int(amt)%5==0):
if(amt<=(bal-0.5)): print("{:.2f}".format(bal-0.5-amt))
else: print("{:.2f}".format(bal))
else: print("{:.2f}".format(bal)) | (amt, bal) = map(float, input().split())
if int(amt) % 5 == 0:
if amt <= bal - 0.5:
print('{:.2f}'.format(bal - 0.5 - amt))
else:
print('{:.2f}'.format(bal))
else:
print('{:.2f}'.format(bal)) |
class UrlManager:
def __init__(self):
self.pending_urls = set()
self.crawled_urls = set()
def has_pending_url(self):
return len(self.pending_urls) != 0
def add_url(self, url):
if url is None or len(url) == 0:
return
if url in self.crawled_urls:
... | class Urlmanager:
def __init__(self):
self.pending_urls = set()
self.crawled_urls = set()
def has_pending_url(self):
return len(self.pending_urls) != 0
def add_url(self, url):
if url is None or len(url) == 0:
return
if url in self.crawled_urls:
... |
# let the library to know how many jobs it has to allocate
GRID_SEARCH_CV_PARAMS = {
"n_jobs" : 4,
"cv" : 10
}
VERBOSE = True
VERBOSITY = 1
POS_NEG_DATASET_DIR = "./data/Positve_negative_sentences/"
HAM_SPAM_DATASET_DIR = "./data/Ham_Spam_comments/"
TRAINING_DIR= "Training/"
TEST_DIR = "Test/"
| grid_search_cv_params = {'n_jobs': 4, 'cv': 10}
verbose = True
verbosity = 1
pos_neg_dataset_dir = './data/Positve_negative_sentences/'
ham_spam_dataset_dir = './data/Ham_Spam_comments/'
training_dir = 'Training/'
test_dir = 'Test/' |
first_name = input()
second_name = input()
delimiter = input()
print(f"{first_name}{delimiter}{second_name}") | first_name = input()
second_name = input()
delimiter = input()
print(f'{first_name}{delimiter}{second_name}') |
# encoding:utf-8
save_problem_schema = {
'type': 'object',
'properties': {
'title': {'type': 'string'},
'content': {'type': 'string'},
'time_limit': {'type': 'integer'},
'memory_limit': {'type': 'integer'},
'difficulty' : {'type': 'string'},
'case_list': {'type':... | save_problem_schema = {'type': 'object', 'properties': {'title': {'type': 'string'}, 'content': {'type': 'string'}, 'time_limit': {'type': 'integer'}, 'memory_limit': {'type': 'integer'}, 'difficulty': {'type': 'string'}, 'case_list': {'type': 'array'}, 'answer_list': {'type': 'array'}}, 'required': ['title', 'content'... |
def main(grains):
return {
'states': ['vim'],
'pillars': {}
}
| def main(grains):
return {'states': ['vim'], 'pillars': {}} |
class A:
def __init__(self):
self.x = 1
def _foo(self):
print(self.x)
a = A()
a._foo()
print(a.x) | class A:
def __init__(self):
self.x = 1
def _foo(self):
print(self.x)
a = a()
a._foo()
print(a.x) |
# for data acquisition:
numberOfChannels = 8
samplingRate = 500.0
# for preprocessing:
lowBandPassFreq = 2.0
highBandPassFreq = 100.0
lowBandStopFreq = 49
highBandStopFreq = 51
# for feature calculation:
windowSize = 0.15 # in s -> 150ms = 0.15s
samplesPerWindow = int(windowSize / (1. / samplingRate))
windowShift = ... | number_of_channels = 8
sampling_rate = 500.0
low_band_pass_freq = 2.0
high_band_pass_freq = 100.0
low_band_stop_freq = 49
high_band_stop_freq = 51
window_size = 0.15
samples_per_window = int(windowSize / (1.0 / samplingRate))
window_shift = int(samplesPerWindow / 2)
data_sample_correction = 1e-06
virtual_midi_cable = '... |
# a module
# define the function
def showState(state):
if(state == True):
print("On")
else:
print("Off")
| def show_state(state):
if state == True:
print('On')
else:
print('Off') |
def findDecision(obj): #obj[0]: Coupon, obj[1]: Education, obj[2]: Occupation, obj[3]: Restaurant20to50, obj[4]: Distance
# {"feature": "Coupon", "instances": 8147, "metric_value": 0.4722, "depth": 1}
if obj[0]>1:
# {"feature": "Distance", "instances": 5903, "metric_value": 0.4599, "depth": 2}
if obj[4]<=2:
# ... | def find_decision(obj):
if obj[0] > 1:
if obj[4] <= 2:
if obj[3] <= 1.0:
if obj[2] > 0:
if obj[1] <= 3:
return 'True'
elif obj[1] > 3:
return 'True'
else:
... |
# Shallow Copy
meta.append(arr)
# Deep Copy
meta.append(arr[:])
| meta.append(arr)
meta.append(arr[:]) |
def solve(data):
result = 0
for lines in data:
dimensions = list(map(int, lines.split('x')))
l = dimensions[0]
w = dimensions[1]
h = dimensions[2]
dimensions[0] = l * w
dimensions[1] = w * h
dimensions[2] = h * l
smallest_side = min(dimensions... | def solve(data):
result = 0
for lines in data:
dimensions = list(map(int, lines.split('x')))
l = dimensions[0]
w = dimensions[1]
h = dimensions[2]
dimensions[0] = l * w
dimensions[1] = w * h
dimensions[2] = h * l
smallest_side = min(dimensions)
... |
person_schema = {
"fname": {'type': 'string'},
"lname": {'type': 'string'},
"person_id": {'type': 'number'},
"timestamp": {'type': 'string'}
} | person_schema = {'fname': {'type': 'string'}, 'lname': {'type': 'string'}, 'person_id': {'type': 'number'}, 'timestamp': {'type': 'string'}} |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def maxPathSum(self, root: TreeNode) -> int:
self.res = float('-inf')
def dfs(root):
if not root:
... | class Solution:
def max_path_sum(self, root: TreeNode) -> int:
self.res = float('-inf')
def dfs(root):
if not root:
return 0
left = max(0, dfs(root.left))
right = max(0, dfs(root.right))
val = root.val + left + right
self.... |
def dx(ux, u, nx, dx, order):
# summation-by-parts finite difference operators for first derivatives du/dx
m = nx-1
# second order accurate case
if order==2:
# calculate partial derivatives on the boundaries:[0, m] with one-sided difference operators
ux[0, :] = (u[1, :] - u[0,... | def dx(ux, u, nx, dx, order):
m = nx - 1
if order == 2:
ux[0, :] = (u[1, :] - u[0, :]) / dx
ux[m, :] = (u[m, :] - u[m - 1, :]) / dx
for j in range(1, m):
ux[j, :] = (u[j + 1, :] - u[j - 1, :]) / (2.0 * dx)
if order == 4:
ux[0, :] = -24.0 / 17 * u[0, :] + 59.0 / 34... |
set_example={"ATGCT","ATAGTATA","ATGCT"} #set will remove the duplicate members
print(set_example)
set_example={"YC1","YC2","YC3","YC3"}
print(set_example)
t_cell_epitopes={"LPVLQV","FGDSVE","VEKGVLPQLEQ","ARTAPH","EIPVA"}
b_cell_epitopes={"ARTAPH","IQYG","EIPVA"}
#all the available epitopes
#union operation
all_e... | set_example = {'ATGCT', 'ATAGTATA', 'ATGCT'}
print(set_example)
set_example = {'YC1', 'YC2', 'YC3', 'YC3'}
print(set_example)
t_cell_epitopes = {'LPVLQV', 'FGDSVE', 'VEKGVLPQLEQ', 'ARTAPH', 'EIPVA'}
b_cell_epitopes = {'ARTAPH', 'IQYG', 'EIPVA'}
all_epitopes = t_cell_epitopes | b_cell_epitopes
print(all_epitopes)
common... |
MOCK_ENTRIES = [{
"symbol": "GE",
"companyName": "General Electric Company",
"exchange": "New York Stock Exchange",
"industry": "Industrial Products",
"website": "http://www.ge.com",
"description":
"General Electric Co is a digital industrial company. It operates"
" in various se... | mock_entries = [{'symbol': 'GE', 'companyName': 'General Electric Company', 'exchange': 'New York Stock Exchange', 'industry': 'Industrial Products', 'website': 'http://www.ge.com', 'description': 'General Electric Co is a digital industrial company. It operates in various segments, including power and water, oil and g... |
#from swagger_server.models.configurations import Configurations
#from swagger_server.models.configuration import Configuration
class GuardAgentSecurityContext(object):
class __GuardAgentSecurityContext:
def __init__(self):
# self._time_between_probes=Configuration("time_between_probes", "int", "Tim... | class Guardagentsecuritycontext(object):
class __Guardagentsecuritycontext:
def __init__(self):
pass
def to_dict(self):
return self.configurations.to_dict()
def to_str(self):
return self.configurations.to_str()
def time_between_probes(self, tb... |
s = str(__import__('sys').stdin.readline().strip()).replace("()","0")
res = 0
sticker = 0
for x in s:
if x == "(":
sticker += 1
elif x == "0":
res += sticker
else:
sticker -= 1
res += 1
print(res)
| s = str(__import__('sys').stdin.readline().strip()).replace('()', '0')
res = 0
sticker = 0
for x in s:
if x == '(':
sticker += 1
elif x == '0':
res += sticker
else:
sticker -= 1
res += 1
print(res) |
#
# PySNMP MIB module VMWARE-VA-AGENTCAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VMWARE-VA-AGENTCAP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:35:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) ... |
'''
1. True y
2. False y
3. False y
4. True y
5. True y
6. False n
7. False y
8. True y
9. False y
10. False y
11. True y
12. False y
13. True y
14. False y
15. False y
16. True n
17. True y
18. True y
19. False y
20. False y
'''
| """
1. True y
2. False y
3. False y
4. True y
5. True y
6. False n
7. False y
8. True y
9. False y
10. False y
11. True y
12. False y
13. True y
14. False y
15. False y
16. True n
17. True y
18. True y
19. False y
20. False y
""" |
def palm_pilot(general, dev, msg) :
code = 13
prio = 800
prio += adjust_prio(general, dev, msg)
keys=list();
keys.append('Bottom of Cesar Chavez (LHS)')
keys.append('South Hall entrance 1')
if ( disallowed(general, dev) or not contains(dev, keys) ) : return (0, 0, 0, '', '')
if ( dev['Bottom of Cesar Chavez ... | def palm_pilot(general, dev, msg):
code = 13
prio = 800
prio += adjust_prio(general, dev, msg)
keys = list()
keys.append('Bottom of Cesar Chavez (LHS)')
keys.append('South Hall entrance 1')
if disallowed(general, dev) or not contains(dev, keys):
return (0, 0, 0, '', '')
if dev['B... |
{
"targets": [
{
"target_name": "addon",
"sources": [ "src/logql.cc" ],
"libraries": [ "<!(pwd)/logql.so" ]
}
]
}
| {'targets': [{'target_name': 'addon', 'sources': ['src/logql.cc'], 'libraries': ['<!(pwd)/logql.so']}]} |
def Articles():
articles = [
{
'id': 1,
'title': 'Article One',
'body': 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut... | def articles():
articles = [{'id': 1, 'title': 'Article One', 'body': 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute ir... |
def removeDuplicates(s: str) -> str:
i = 0
while i < len(s)-1:
if s[i] == s[i+1]:
s = s[i+2:] if s==0 else s[:i]+s[i+2:]
i = 0 if i==0 else i-1
else:
i+=1
return s
print(removeDuplicates("gnyogdbncigrwnjjtqtyregqyhkinjxgzmkpxskloxjcensflhhxlpfkrcmuctrr... | def remove_duplicates(s: str) -> str:
i = 0
while i < len(s) - 1:
if s[i] == s[i + 1]:
s = s[i + 2:] if s == 0 else s[:i] + s[i + 2:]
i = 0 if i == 0 else i - 1
else:
i += 1
return s
print(remove_duplicates('gnyogdbncigrwnjjtqtyregqyhkinjxgzmkpxskloxjcensf... |
#!/usr/local/bin/python3
def resultado_f1(**kwargs):
for posicao, piloto in kwargs.items():
print(f'{posicao} -> {piloto}')
if __name__ == '__main__':
resultado_f1(primeiro='Hamilton', segundo='Massa')
podium = {'primeiro': 'Hamilton', 'segundo': 'Massa'}
resultado_f1(**podium)
| def resultado_f1(**kwargs):
for (posicao, piloto) in kwargs.items():
print(f'{posicao} -> {piloto}')
if __name__ == '__main__':
resultado_f1(primeiro='Hamilton', segundo='Massa')
podium = {'primeiro': 'Hamilton', 'segundo': 'Massa'}
resultado_f1(**podium) |
#Write a class complex to represent complex numbers,
#along with overloaded operators + and * which adds and multiplies them.
#Formula --> (a+bi)(c+di) = (ac-bd) + (ad+bc)i
class Complex:
def __init__(self, r, i):
self.real = r
self.imaginary = i
def __add__(self, c):
return Complex(s... | class Complex:
def __init__(self, r, i):
self.real = r
self.imaginary = i
def __add__(self, c):
return complex(self.real + c.real, self.imaginary + c.imaginary)
def __mul__(self, c):
mul_real = self.real * c.real - self.imaginary * c.imaginary
mul_img = self.real *... |
guess = None
value = 5
trial = 5
print("WELCOME TO OUR GUESS GAME")
while trial > 0:
print('Your remaining trial is {}'.format(trial))
guess = int(input('enter a number: '))
if guess == value:
print('You win')
break
else:
trial = trial-1
else:
print('You loss')
| guess = None
value = 5
trial = 5
print('WELCOME TO OUR GUESS GAME')
while trial > 0:
print('Your remaining trial is {}'.format(trial))
guess = int(input('enter a number: '))
if guess == value:
print('You win')
break
else:
trial = trial - 1
else:
print('You loss') |
class IllegalArgumentException(Exception):
pass
class LinkedList:
class _Node:
def __init__(self, val=None, next_node=None):
self.val = val
self.next = next_node
# def __str__(self):
# return str(self.val)
# def __repr__(self):
# return... | class Illegalargumentexception(Exception):
pass
class Linkedlist:
class _Node:
def __init__(self, val=None, next_node=None):
self.val = val
self.next = next_node
def __init__(self):
self._dummy_head = self._Node()
self._size = 0
def get_size(self):
... |
line_num = 0
total = 0
visited = {}
with open("day8.txt") as f:
data = f.readlines()
def nop(num):
global line_num
line_num += 1
def jmp(num):
global line_num
line_num += num
def acc(num):
global total
global line_num
total += num
line_num += 1
cmds ... | line_num = 0
total = 0
visited = {}
with open('day8.txt') as f:
data = f.readlines()
def nop(num):
global line_num
line_num += 1
def jmp(num):
global line_num
line_num += num
def acc(num):
global total
global line_num
total += num
line_num += 1
cmds = {'nop': nop, 'jmp': jmp, 'acc... |
# Divyanshu Lohani: https://github.com/DivyanshuLohani
def pypart(n):
for i in range(0, n):
for j in range(0, i+1):
# printing stars
print("* ",end="")
# ending line after each row
print("\r")
n = 5
pypart(n) | def pypart(n):
for i in range(0, n):
for j in range(0, i + 1):
print('* ', end='')
print('\r')
n = 5
pypart(n) |
built_modules = list(name for name in
"Core;Gui;Widgets;PrintSupport;Sql;Network;Test;Concurrent;Xml;Help;OpenGL;OpenGLFunctions;OpenGLWidgets;Qml;Quick;QuickControls2;QuickWidgets;Svg;SvgWidgets;UiTools"
.split(";"))
shiboken_library_soversion = str(6.0)
pyside_library_soversion = str(6.0)
version = "6.0.0"
... | built_modules = list((name for name in 'Core;Gui;Widgets;PrintSupport;Sql;Network;Test;Concurrent;Xml;Help;OpenGL;OpenGLFunctions;OpenGLWidgets;Qml;Quick;QuickControls2;QuickWidgets;Svg;SvgWidgets;UiTools'.split(';')))
shiboken_library_soversion = str(6.0)
pyside_library_soversion = str(6.0)
version = '6.0.0'
version_i... |
'''
Pattern
Enter number of rows: 5
5
54
543
5432
54321
'''
print('Pattern: ')
number_rows=int(input('Enter number of rows: '))
for row in range(number_rows,0,-1):
for column in range(number_rows,row-1,-1):
if column < 10:
print(f'0{column}',end=' ')
else:
print(column,end=' ')
print()
| """
Pattern
Enter number of rows: 5
5
54
543
5432
54321
"""
print('Pattern: ')
number_rows = int(input('Enter number of rows: '))
for row in range(number_rows, 0, -1):
for column in range(number_rows, row - 1, -1):
if column < 10:
print(f'0{column}', end=' ')
else:
print(colu... |
line = input().split()
n = int(line[0])
m = int(line[1])
ans = min(n,m)
if(ans%2==0):
print("Malvika")
else:
print("Akshat")
| line = input().split()
n = int(line[0])
m = int(line[1])
ans = min(n, m)
if ans % 2 == 0:
print('Malvika')
else:
print('Akshat') |
data = open("day15.txt").read().replace("\n", "").split(",")
data = [int(x) for x in data]
def find_last_number(data, stop):
previous = data[-1]
turn = len(data)
last_spoken = {value: key + 1 for key, value in enumerate(data[:-1])}
while turn < stop:
new_number = turn - \
last_spok... | data = open('day15.txt').read().replace('\n', '').split(',')
data = [int(x) for x in data]
def find_last_number(data, stop):
previous = data[-1]
turn = len(data)
last_spoken = {value: key + 1 for (key, value) in enumerate(data[:-1])}
while turn < stop:
new_number = turn - last_spoken[previous] ... |
# Approach 2 - Left-to-Right Pass Improved
values = {
"I": 1,
"V": 5,
"X": 10,
"L": 50,
"C": 100,
"D": 500,
"M": 1000,
"IV": 4,
"IX": 9,
"XL": 40,
"XC": 90,
"CD": 400,
"CM": 900
}
class Solution:
def romanToInt(self, s: str) -> int:
total = 0
i ... | values = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000, 'IV': 4, 'IX': 9, 'XL': 40, 'XC': 90, 'CD': 400, 'CM': 900}
class Solution:
def roman_to_int(self, s: str) -> int:
total = 0
i = 0
while i < len(s):
if i < len(s) - 1 and s[i:i + 2] in values:
... |
#
# PySNMP MIB module CTRON-SSR-TRAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-SSR-TRAP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:31:35 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint, constraints_union) ... |
remote = ("example.com", 80)
page = "/response"
auth = ""
reqthreads = 4
| remote = ('example.com', 80)
page = '/response'
auth = ''
reqthreads = 4 |
class Queue:
def __init__(self):
self.__items = []
def enqueue(self, item):
self.__items.append(item)
def dequeue(self):
if not self.length():
raise QueueEmptyException()
item = self.__items[0]
self.__items = self.__items[1:]
return item
def... | class Queue:
def __init__(self):
self.__items = []
def enqueue(self, item):
self.__items.append(item)
def dequeue(self):
if not self.length():
raise queue_empty_exception()
item = self.__items[0]
self.__items = self.__items[1:]
return item
... |
def solve(data, part_two=False):
max_found = -1
seat_ids = []
for l in data:
row_max = 127
row_min = 0
seat_max = 7
seat_min = 0
for c in l:
if c == 'F':
row_max = ((row_max-row_min) // 2) + row_min
elif c == 'B':
... | def solve(data, part_two=False):
max_found = -1
seat_ids = []
for l in data:
row_max = 127
row_min = 0
seat_max = 7
seat_min = 0
for c in l:
if c == 'F':
row_max = (row_max - row_min) // 2 + row_min
elif c == 'B':
... |
# !/usr/bin/env python3
# Author: C.K
# Email: theck17@163.com
# DateTime:2021-12-04 09:48:17
# Description:
class Solution:
def longestWord(self, words: List[str]) -> str:
valid = set([""])
for word in sorted(words, key=lambda x: len(x)):
if word[:-1] in valid:
v... | class Solution:
def longest_word(self, words: List[str]) -> str:
valid = set([''])
for word in sorted(words, key=lambda x: len(x)):
if word[:-1] in valid:
valid.add(word)
return max(sorted(valid), key=lambda x: len(x))
if __name__ == '__main__':
pass |
class Bipartite(object):
def __init__(self, graph):
self.is_bipartite = True
self.color = [False for _ in range(graph.v)]
self.marked = [False for _ in range(graph.v)]
self.edge_to = [0 for _ in range(graph.v)]
self.odd_length_cycle = []
for v in range(graph.v):
... | class Bipartite(object):
def __init__(self, graph):
self.is_bipartite = True
self.color = [False for _ in range(graph.v)]
self.marked = [False for _ in range(graph.v)]
self.edge_to = [0 for _ in range(graph.v)]
self.odd_length_cycle = []
for v in range(graph.v):
... |
# The objective is to find the summation of the odd elements in the array
# Define a simple array
sample =[12,33,54,89,776,3]
# Get length of the array
l= len(sample)
s=0
# Looping on the array up to max length to sum up the odd elements
for i in range(l):
if (i%2!=0):
s = s + int(sample[i])
#print the sum... | sample = [12, 33, 54, 89, 776, 3]
l = len(sample)
s = 0
for i in range(l):
if i % 2 != 0:
s = s + int(sample[i])
print(s) |
class SmokeTestFail(Exception):
pass
class SmokeTestRegistry(object):
def __init__(self):
self.tests = {}
def register(self, sequence, name):
def decorator(fn):
self.tests[name] = {
'sequence': sequence,
'test': fn
}
ret... | class Smoketestfail(Exception):
pass
class Smoketestregistry(object):
def __init__(self):
self.tests = {}
def register(self, sequence, name):
def decorator(fn):
self.tests[name] = {'sequence': sequence, 'test': fn}
return fn
return decorator
def __ite... |
# Stores JSON schema version, incrementing major/minor number = incompatible
CDOT_JSON_VERSION_KEY = "cdot_version"
# Keys used in dictionary (serialized to JSON)
CONTIG = "contig"
CHROM = "chrom"
START = "start"
END = "stop"
STRAND = "strand"
BEST_REGION_TYPE_ORDER = ["coding", "5PUTR", "3PUTR", "non coding", "intr... | cdot_json_version_key = 'cdot_version'
contig = 'contig'
chrom = 'chrom'
start = 'start'
end = 'stop'
strand = 'strand'
best_region_type_order = ['coding', '5PUTR', '3PUTR', 'non coding', 'intron'] |
def int_from_rgb(r, g, b):
return (r << 16) + (g << 8) + b
def rgb_from_int(color):
return ((color >> 16) & 255), ((color >> 8) & 255), (color & 255)
| def int_from_rgb(r, g, b):
return (r << 16) + (g << 8) + b
def rgb_from_int(color):
return (color >> 16 & 255, color >> 8 & 255, color & 255) |
questions = ['''A 2m long stick, when it is at rest, moves past an observer on the ground with a speed of 0.5c.
(a) What is the length measured by the observer ?
(b) If the same stick moves with the velocity of 0.05c what would be its length measured by the observer ''',''' A small lantern of mass 100 gm is hanged fro... | questions = ['A 2m long stick, when it is at rest, moves past an observer on the ground with a speed of 0.5c.\n(a) What is the length measured by the observer ?\n(b) If the same stick moves with the velocity of 0.05c what would be its length measured by the observer ', ' A small lantern of mass 100 gm is hanged from t... |
pkg_dnf = {}
actions = {
'dnf_makecache': {
'command': 'dnf makecache',
'triggered': True,
},
}
files = {
'/etc/dnf/dnf.conf': {
'source': 'dnf.conf',
'mode': '0644',
},
}
if node.metadata.get('dnf', {}).get('auto_downloads', False):
pkg_dnf['yum-cron'] = {}
s... | pkg_dnf = {}
actions = {'dnf_makecache': {'command': 'dnf makecache', 'triggered': True}}
files = {'/etc/dnf/dnf.conf': {'source': 'dnf.conf', 'mode': '0644'}}
if node.metadata.get('dnf', {}).get('auto_downloads', False):
pkg_dnf['yum-cron'] = {}
svc_systemd = {'yum-cron': {'needs': ['pkg_dnf:yum-cron']}}
f... |
#https://stackabuse.com/parallel-processing-in-python/
def load_deck(deck_loc):
deck_list = open('vintage_cube.txt', 'r')
deck = Queue()
for card in deck_list:
deck.put(card)
deck_list.close()
return deck
| def load_deck(deck_loc):
deck_list = open('vintage_cube.txt', 'r')
deck = queue()
for card in deck_list:
deck.put(card)
deck_list.close()
return deck |
n=[int(x) for x in input("Enter the numbers with space: ").split()]
x=[ ]
s=0
for i in range(len(n)):
for j in range(i+1,len(n)):
x.append((n[i],n[j]))
for i in range(int(len(x))):
a = min(x[i])+min(x[len(x)-i-1])
if(a>s):
s=a
print("OUTPUT: ",s)
| n = [int(x) for x in input('Enter the numbers with space: ').split()]
x = []
s = 0
for i in range(len(n)):
for j in range(i + 1, len(n)):
x.append((n[i], n[j]))
for i in range(int(len(x))):
a = min(x[i]) + min(x[len(x) - i - 1])
if a > s:
s = a
print('OUTPUT: ', s) |
class Params ():
def __init__(self):
print('HotpotQA')
self.name = "HotpotQA"
################################
# dataset
################################
data_path = ''
DATA_TRAIN = 'train.pkl'
DATA_DEV = 'dev.pkl'
DATA_TEST = 'dev.pkl'
... | class Params:
def __init__(self):
print('HotpotQA')
self.name = 'HotpotQA'
data_path = ''
data_train = 'train.pkl'
data_dev = 'dev.pkl'
data_test = 'dev.pkl'
data_debug = 'debug.pkl'
dic = 'vocab-elmo.txt'
elmo_token = 'ELMO_token_embeddings.hdf5'
elmo_options = 'ELM... |
pkgname = "duktape"
pkgver = "2.7.0"
pkgrel = 0
build_style = "makefile"
make_cmd = "gmake"
make_build_args = ["-f", "Makefile.sharedlibrary"]
make_install_args = ["-f", "Makefile.sharedlibrary", "INSTALL_PREFIX=/usr"]
hostmakedepends = ["gmake", "pkgconf"]
pkgdesc = "Embeddeable JavaScript engine"
maintainer = "q66 <q... | pkgname = 'duktape'
pkgver = '2.7.0'
pkgrel = 0
build_style = 'makefile'
make_cmd = 'gmake'
make_build_args = ['-f', 'Makefile.sharedlibrary']
make_install_args = ['-f', 'Makefile.sharedlibrary', 'INSTALL_PREFIX=/usr']
hostmakedepends = ['gmake', 'pkgconf']
pkgdesc = 'Embeddeable JavaScript engine'
maintainer = 'q66 <q... |
config = {
'row_data_path': './data/rel_data.txt',
'triplet_data_path': './data/triplet_data.txt',
'kg_data_path': './output/kg_data.json',
'template_path': './output/template.xlsx',
'url': "http://localhost:7474",
'user': "neo4j",
'password': "123456"
}
| config = {'row_data_path': './data/rel_data.txt', 'triplet_data_path': './data/triplet_data.txt', 'kg_data_path': './output/kg_data.json', 'template_path': './output/template.xlsx', 'url': 'http://localhost:7474', 'user': 'neo4j', 'password': '123456'} |
class Villager:
def __init__(self, number, books):
self.number = number
self.books = books
self.goodTrades = []
def getNumber(self):
return self.number
def getBooks(self):
return self.books
def addGoodTrade(self, book):
self.goodTrades.append(bo... | class Villager:
def __init__(self, number, books):
self.number = number
self.books = books
self.goodTrades = []
def get_number(self):
return self.number
def get_books(self):
return self.books
def add_good_trade(self, book):
self.goodTrades.append(book)... |
#!/usr/bin/env python3
def lookandsay(n):
acc = [(1,n[0])]
for c in n[1:]:
count, num = acc[-1]
if num == c:
acc[-1] = (count+1, num)
else:
acc += [(1, c)]
return "".join(["".join((str(x),y)) for (x,y) in acc])
seed = "3113322113"
for i in range(50):
see... | def lookandsay(n):
acc = [(1, n[0])]
for c in n[1:]:
(count, num) = acc[-1]
if num == c:
acc[-1] = (count + 1, num)
else:
acc += [(1, c)]
return ''.join([''.join((str(x), y)) for (x, y) in acc])
seed = '3113322113'
for i in range(50):
seed = lookandsay(see... |
class RBI:
def __init__(self, fmeca):
self.fmeca = fmeca
self._generate_rbi()
def _generate_rbi(self):
# TODO: Add rbi logic (from risk_calculator but modified to take a
# fmeca argument and loop through each inspection type)
if self._total_risk is None:
... | class Rbi:
def __init__(self, fmeca):
self.fmeca = fmeca
self._generate_rbi()
def _generate_rbi(self):
if self._total_risk is None:
print('Calculating total component risk.')
self._total_risk = 0
for subcomponent in self.subcomponents:
... |
def parse(it):
result = []
while True:
try:
tk = next(it)
except StopIteration:
break
if tk == '}':
break
val = next(it)
if val == '{':
result.append((tk,parse(it)))
else:
result.append((tk, val))
r... | def parse(it):
result = []
while True:
try:
tk = next(it)
except StopIteration:
break
if tk == '}':
break
val = next(it)
if val == '{':
result.append((tk, parse(it)))
else:
result.append((tk, val))
re... |
kminicial = float(input('Insira a km inicial: '))
kmatual = float(input('insira a km atual: '))
dias = int(input('Quantos dias ficou alugado? '))
kmpercorrido = kmatual - kminicial
rkm = kmpercorrido * 0.15
rdias = dias * 60
total = rkm+rdias
print ('O total de km percorrido foi: {}. A quantidade de dias utilizado foi... | kminicial = float(input('Insira a km inicial: '))
kmatual = float(input('insira a km atual: '))
dias = int(input('Quantos dias ficou alugado? '))
kmpercorrido = kmatual - kminicial
rkm = kmpercorrido * 0.15
rdias = dias * 60
total = rkm + rdias
print('O total de km percorrido foi: {}. A quantidade de dias utilizado foi... |
attribute_filter_parameter_schema = [
{
'name': 'search',
'in': 'query',
'required': False,
'description': 'Lucene query syntax string for use with Elasticsearch. '
'See <a href=https://www.elastic.co/guide/en/elasticsearch/'
'reference/7... | attribute_filter_parameter_schema = [{'name': 'search', 'in': 'query', 'required': False, 'description': 'Lucene query syntax string for use with Elasticsearch. See <a href=https://www.elastic.co/guide/en/elasticsearch/reference/7.10/query-dsl-query-string-query.html#query-string-syntax>reference</a>. This search strin... |
def get_max_profit(prices, fee, reserve=0, buyable=True):
if not prices:
return reserve
price_offset = -prices[0] - fee if buyable else prices[0]
return max(
get_max_profit(prices[1:], fee, reserve, buyable),
get_max_profit(prices[1:], fee, reserve + price_offset, not buyable)
)... | def get_max_profit(prices, fee, reserve=0, buyable=True):
if not prices:
return reserve
price_offset = -prices[0] - fee if buyable else prices[0]
return max(get_max_profit(prices[1:], fee, reserve, buyable), get_max_profit(prices[1:], fee, reserve + price_offset, not buyable))
assert get_max_profit(... |
# =============================================================================
# Author: Teerapat Jenrungrot - https://github.com/mjenrungrot/
# FileName: 11056.py
# Description: UVa Online Judge - 11056
# =============================================================================
while True:
... | while True:
try:
n = int(input())
except EOFError:
break
a = []
for i in range(N):
line = input()
(name, time_str) = line.split(' : ')
time_token = time_str.split()
time = 60 * 1000 * int(time_token[0]) + 1000 * int(time_token[2]) + int(time_token[4])
... |
class ModbusException(Exception):
@staticmethod
def fromExceptionCode(exception_code: int):
if exception_code == 1:
return IllegalFunctionError
elif exception_code == 2:
return IllegalDataAddressError
elif exception_code == 3:
return IllegalDataValueError
elif exception_code == 4:
... | class Modbusexception(Exception):
@staticmethod
def from_exception_code(exception_code: int):
if exception_code == 1:
return IllegalFunctionError
elif exception_code == 2:
return IllegalDataAddressError
elif exception_code == 3:
return IllegalDataValu... |
# aoc 2020 day 9
def two_sum(val, lst):
for x in lst:
for y in lst:
if x + y == val:
return True
return False
prelude_len = 25
with open("aoc_2020_9.in") as f:
data = f.readlines()
data = list(map(int, data))
part_one_answer = 0
for idx in range(prelude_len, len(dat... | def two_sum(val, lst):
for x in lst:
for y in lst:
if x + y == val:
return True
return False
prelude_len = 25
with open('aoc_2020_9.in') as f:
data = f.readlines()
data = list(map(int, data))
part_one_answer = 0
for idx in range(prelude_len, len(data)):
preceding = da... |
#
# PySNMP MIB module A3COM-SWITCHING-SYSTEMS-FDDI-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-SWITCHING-SYSTEMS-FDDI-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:08:20 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Pyt... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint) ... |
# Huu Hung Nguyen
# 12/07/2021
# Nguyen_HuuHung_freq_distribution.py
# The program takes a numbers list and creates a frequency distribution table.
# It then display the frequency distribution table.
def get_max(data_list):
''' Take a data list and return its maximum data. '''
# Determine the num... | def get_max(data_list):
""" Take a data list and return its maximum data. """
n = len(data_list)
if n == 0:
max_data = 0
else:
max_data = data_list[0]
for data in data_list[1:]:
if data > max_data:
max_data = data
return max_data
def get_min(data_... |
n = int(input())
data = list(map(int,input().split()))
one , two , three = [] , [] , []
for i in range(len(data)):
if data[i] == 1:
one.append(i+1)
elif data[i] == 2:
two.append(i+1)
else:
three.append(i+1)
teams = min(len(one),len(two),len(three))
print(teams)
for i in range(teams):... | n = int(input())
data = list(map(int, input().split()))
(one, two, three) = ([], [], [])
for i in range(len(data)):
if data[i] == 1:
one.append(i + 1)
elif data[i] == 2:
two.append(i + 1)
else:
three.append(i + 1)
teams = min(len(one), len(two), len(three))
print(teams)
for i in rang... |
one_char = ["!", "#", "%", "&", "\\", "'", "(", ")", "*", "+", "-", ".", "/",
":", ";", "<", "=", ">", "?", "[", "]", "^", "{", "|", "}", "~", ","]
# they must be ordered by length decreasing
multi_char = ["...", "::", ">>=", "<<=", ">>>", "<<<", "===", "!=", "==", "===", "<=", ">=", "*=", "&&", "-=", "+=",... | one_char = ['!', '#', '%', '&', '\\', "'", '(', ')', '*', '+', '-', '.', '/', ':', ';', '<', '=', '>', '?', '[', ']', '^', '{', '|', '}', '~', ',']
multi_char = ['...', '::', '>>=', '<<=', '>>>', '<<<', '===', '!=', '==', '===', '<=', '>=', '*=', '&&', '-=', '+=', '||', '--', '++', '|=', '&=', '%=', '/=', '^=', '::']
... |
class MachopCommand(object):
def shutdown(self):
pass
def cleanup(self):
pass
| class Machopcommand(object):
def shutdown(self):
pass
def cleanup(self):
pass |
INPUT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Deriva Demo Input",
"description": ("Input schema for the demo DERIVA ingest Action Provider. This Action "
"Provider can restore a DERIVA backup to a new or existing catalog, "
"or creat... | input_schema = {'$schema': 'http://json-schema.org/draft-04/schema#', 'title': 'Deriva Demo Input', 'description': 'Input schema for the demo DERIVA ingest Action Provider. This Action Provider can restore a DERIVA backup to a new or existing catalog, or create a new DERIVA catalog from a BDBag containing TableSchema.'... |
class TestClassConverter:
@classmethod
def setup_class(cls):
print("\nsetup_class: setup any state specific to the execution of the given class\n")
@classmethod
def teardown_class(cls):
print("\nteardown_class: teardown any state that was previously setup with a call to setup_class.... | class Testclassconverter:
@classmethod
def setup_class(cls):
print('\nsetup_class: setup any state specific to the execution of the given class\n')
@classmethod
def teardown_class(cls):
print('\nteardown_class: teardown any state that was previously setup with a call to setup_class.\n'... |
# model settings
norm_cfg = dict(type='GN', num_groups=32, requires_grad=True)
model = dict(
type='TDN',
pretrained='modelzoo://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='pytorch'),
ne... | norm_cfg = dict(type='GN', num_groups=32, requires_grad=True)
model = dict(type='TDN', pretrained='modelzoo://resnet50', backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, style='pytorch'), neck=dict(type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, num_outs=... |
# convert a decimal number to bukiyip.
def decimal_to_bukiyip(a):
bukiyip = ''
quotient = 2000000
while quotient > 0:
quotient = a // 3
remainder = a % 3
bukiyip += str(remainder)
a = quotient
return bukiyip[::-1]
# convert a bukiyip number to decimal
def bukiyip_to_d... | def decimal_to_bukiyip(a):
bukiyip = ''
quotient = 2000000
while quotient > 0:
quotient = a // 3
remainder = a % 3
bukiyip += str(remainder)
a = quotient
return bukiyip[::-1]
def bukiyip_to_decimal(a):
decimal = 0
string_a = str(a)
power = 0
for i in stri... |
expected_output = {
'type': {
'IP route': {
'address': '10.21.12.0',
'mask': '255.255.255.0',
'state': 'Down',
'state_description': 'no ip route',
'delayed': {
'delayed_state': 'Up',
'secs_remaining': 1.0,
... | expected_output = {'type': {'IP route': {'address': '10.21.12.0', 'mask': '255.255.255.0', 'state': 'Down', 'state_description': 'no ip route', 'delayed': {'delayed_state': 'Up', 'secs_remaining': 1.0, 'connection_state': 'connected'}, 'change_count': 1, 'last_change': '00:00:24'}}, 'delay_up_secs': 20.0, 'delay_down_s... |
# Open terminal > python3 condition.py
# Start typing below commands and see the output
x = int(input('Please enter an integer: '))
if x < 0:
print(str(x) + ' is a negative number')
elif x == 0:
print(str(x) + ' is zero')
else:
print(str(x) + ' is a positive number') | x = int(input('Please enter an integer: '))
if x < 0:
print(str(x) + ' is a negative number')
elif x == 0:
print(str(x) + ' is zero')
else:
print(str(x) + ' is a positive number') |
name0_0_1_1_0_0_0 = None
name0_0_1_1_0_0_1 = None
name0_0_1_1_0_0_2 = None
name0_0_1_1_0_0_3 = None
name0_0_1_1_0_0_4 = None | name0_0_1_1_0_0_0 = None
name0_0_1_1_0_0_1 = None
name0_0_1_1_0_0_2 = None
name0_0_1_1_0_0_3 = None
name0_0_1_1_0_0_4 = None |
if float(input()) < 16 :
print('Master' if input() == 'm' else 'Miss')
else:
print('Mr.' if input() == 'm' else 'Ms.')
| if float(input()) < 16:
print('Master' if input() == 'm' else 'Miss')
else:
print('Mr.' if input() == 'm' else 'Ms.') |
fruit = {"orange":"a sweet, orange, citrus fruit",
"apple": " good for making cider",
"lemon":"a sour, yellow citrus fruit",
"grape":"a small, sweet fruit growing in bunches",
"lime": "a sour, green citrus fruit",
"lime":"its yellow"}
print(fruit)
# .items will pr... | fruit = {'orange': 'a sweet, orange, citrus fruit', 'apple': ' good for making cider', 'lemon': 'a sour, yellow citrus fruit', 'grape': 'a small, sweet fruit growing in bunches', 'lime': 'a sour, green citrus fruit', 'lime': 'its yellow'}
print(fruit)
print(fruit.items())
f_tuple = tuple(fruit.items())
print(f_tuple)
f... |
def isPalindrome(s):
s = s.lower()
holdit = ""
for charac in s:
if charac.isalpha():
holdit+=charac
i=0
j=len(holdit)-1
while i<=j:
if holdit[i]!=holdit[j]:
return False
i+=1
j-=1
return True
s = "0P"
print(isPalindrome(s)) | def is_palindrome(s):
s = s.lower()
holdit = ''
for charac in s:
if charac.isalpha():
holdit += charac
i = 0
j = len(holdit) - 1
while i <= j:
if holdit[i] != holdit[j]:
return False
i += 1
j -= 1
return True
s = '0P'
print(is_palindrom... |
##############################################################################
#
# Copyright (c) 2003-2020 by The University of Queensland
# http://www.uq.edu.au
#
# Primary Business: Queensland, Australia
# Licensed under the Apache License, version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Development unt... | escript_opts_version = 203
openmp = True
umfpack = True
umfpack_prefix = ['/usr/include/suitesparse', '/usr/lib']
umfpack_libs = ['umfpack', 'blas', 'amd']
pythoncmd = '/usr/bin/python3'
pythonlibname = 'python3.8'
pythonlibpath = '/usr/lib/x86_64-linux-gnu/'
pythonincpath = '/usr/include/python3.8'
boost_python = 'boo... |
def trace_get_attributes(cls: type):
class Wrapper:
def __init__(self, *args, **kwargs):
self.wrapped = cls(*args, **kwargs)
def __getattr__(self, item):
result = getattr(self.wrapped, item)
print(f"-- getting attribute '{item}' = {result}")
return res... | def trace_get_attributes(cls: type):
class Wrapper:
def __init__(self, *args, **kwargs):
self.wrapped = cls(*args, **kwargs)
def __getattr__(self, item):
result = getattr(self.wrapped, item)
print(f"-- getting attribute '{item}' = {result}")
return ... |
class Controller:
def __init__(self, cfg):
self.internal = 0
# self.update_period = cfg.policy.params.period
self.last_action = None
def reset(self):
raise NotImplementedError("Subclass must implement this function")
def get_action(self, state):
raise NotImplement... | class Controller:
def __init__(self, cfg):
self.internal = 0
self.last_action = None
def reset(self):
raise not_implemented_error('Subclass must implement this function')
def get_action(self, state):
raise not_implemented_error('Subclass must implement this function') |
#!usr/bin/python
# -*- coding:utf8 -*-
class Cat(object):
def say(self):
print("I am a cat")
class Dog(object):
def say(self):
print("I am a dog")
def __getitem__(self, item):
return "bobby"
class Duck(object):
def say(self):
print("I am a duck")
# animal = Cat
# ani... | class Cat(object):
def say(self):
print('I am a cat')
class Dog(object):
def say(self):
print('I am a dog')
def __getitem__(self, item):
return 'bobby'
class Duck(object):
def say(self):
print('I am a duck')
animal_list = [Cat, Dog, Duck]
for animal in animal_list:
... |
# coding=utf-8
# /usr/bin/env python
'''
Author: wenqiangw
Email: wenqiangw@opera.com
Date: 2020-07-30 11:05
Desc:
''' | """
Author: wenqiangw
Email: wenqiangw@opera.com
Date: 2020-07-30 11:05
Desc:
""" |
name = 'tinymce4'
authors = 'Joost Cassee, Aljosa Mohorovic'
version = '3.0.2'
release = version
| name = 'tinymce4'
authors = 'Joost Cassee, Aljosa Mohorovic'
version = '3.0.2'
release = version |
#!/usr/bin/python3
def solution(A):
if not A:
return 0
max_profit = 0
min_value = A[0]
for a in A:
max_profit = max(max_profit, a - min_value)
min_value = min(min_value, a)
return max_profit | def solution(A):
if not A:
return 0
max_profit = 0
min_value = A[0]
for a in A:
max_profit = max(max_profit, a - min_value)
min_value = min(min_value, a)
return max_profit |
#-*- coding : utf-8 -*-
class Distribute(object):
def __init__(self):
self.__layout = 0
self.__funcs = {list:self._list, dict:self._dict}
@property
def funcs(self):
return self.__funcs
def _drowTab( self, tab, add=' |' ):
add = add * tab
return " {add}".format(**locals())
def _dict( self, data, tab ):... | class Distribute(object):
def __init__(self):
self.__layout = 0
self.__funcs = {list: self._list, dict: self._dict}
@property
def funcs(self):
return self.__funcs
def _drow_tab(self, tab, add=' |'):
add = add * tab
return ' {add}'.format(**locals())
def _d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.