content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
test = {
'name': 'switch',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
scm> (switch 1 ((1 (print 'a))
.... (2 (print 'b))
.... (3 (print 'c))))
a
scm> (switch (+ 1 1) ((1 (print 'a))
.... ... | test = {'name': 'switch', 'points': 1, 'suites': [{'cases': [{'code': "\n scm> (switch 1 ((1 (print 'a))\n .... (2 (print 'b))\n .... (3 (print 'c))))\n a\n scm> (switch (+ 1 1) ((1 (print 'a))\n .... (2 (print 'b))\n ... |
class Prunner(object):
def __init__(self):
pass
def fit(self, ensemble, X, y):
return self
def get(self, p=0.1):
return self.ensemble[:int(p * len(self.ensemble))]
| class Prunner(object):
def __init__(self):
pass
def fit(self, ensemble, X, y):
return self
def get(self, p=0.1):
return self.ensemble[:int(p * len(self.ensemble))] |
# -*- coding: utf-8 -*-
'''
Author: Hannibal
Data:
Desc: local data config
NOTE: Don't modify this file, it's build by xml-to-python!!!
'''
simpleskillpassive_map = {};
simpleskillpassive_map[2001] = {"id":2001,"skilldata":[{"lv":1,"effect":"actor['atk']*=1.2","group":1,},{"lv":2,"effect":"actor['atk']*=1.3","group... | """
Author: Hannibal
Data:
Desc: local data config
NOTE: Don't modify this file, it's build by xml-to-python!!!
"""
simpleskillpassive_map = {}
simpleskillpassive_map[2001] = {'id': 2001, 'skilldata': [{'lv': 1, 'effect': "actor['atk']*=1.2", 'group': 1}, {'lv': 2, 'effect': "actor['atk']*=1.3", 'group': 1}, {'lv': 3,... |
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Mytree:
def maketree(self, arr: list):
root = TreeNode(arr[0])
mystack = []
mystack.append(root)
nl = []
i = 0
whil... | class Treenode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Mytree:
def maketree(self, arr: list):
root = tree_node(arr[0])
mystack = []
mystack.append(root)
nl = []
i = 0
wh... |
# MTK GPS Command Sentence Generator for Python
# Copyright (c) 2015 Calvin McCoy (calvin.mccoy@gmail.com)
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including witho... | __valid_baudrates = [4800, 9600, 14400, 19200, 38400, 57600, 115200]
default_sentences = '$PMTK314,-1*04\r\n'
hot_start = '$PMTK101*32\r\n'
warm_start = '$PMTK102*31\r\n'
cold_start = '$PMTK103*30\r\n'
full_cold_start = '$PMTK104*37\r\n'
standby = '$PMTK161,0*28\r\n'
def crc_calc(input_string):
"""
Calculates ... |
asdasdfgs = 1
def add(x, y):
return x + y
print(add(asdasdfgs, 2))
print(add(asdasdfgs, 3))
print(add(asdasdfgs, 5))
| asdasdfgs = 1
def add(x, y):
return x + y
print(add(asdasdfgs, 2))
print(add(asdasdfgs, 3))
print(add(asdasdfgs, 5)) |
#!/usr/bin/python
#coding=utf-8
class List(list):
def __getattr__(self, attr):
tmp = List()
for l in self:
tmp.append(l.__getattr__(attr))
return tmp
def equal(self, value, attr='class'):
tmp = List()
for l in self:
if hasattr(l, 'equal'):
... | class List(list):
def __getattr__(self, attr):
tmp = list()
for l in self:
tmp.append(l.__getattr__(attr))
return tmp
def equal(self, value, attr='class'):
tmp = list()
for l in self:
if hasattr(l, 'equal'):
flag = l.equal(value, ... |
"""
Module for KeywordsADT, a custom ADT in this project. You can read more about it
in the Wiki page on our GitHub profile.
"""
class KeywordsADT:
"""
This class represents all Keywords in list
"""
def _check(self, word):
"""
Check if somebody already uses this word.
:param wo... | """
Module for KeywordsADT, a custom ADT in this project. You can read more about it
in the Wiki page on our GitHub profile.
"""
class Keywordsadt:
"""
This class represents all Keywords in list
"""
def _check(self, word):
"""
Check if somebody already uses this word.
:param wo... |
def add(x, y):
total = x + y
return total
print(add(5, 10))
def add(x, y=3):
total = x + y
return total
print(add(5))
print(add(5, 7))
print(add(x=2))
print(add(x=8, y=4))
print(1, 2, 3, 4, 5)
print(1, 2, 3, 4, 5, sep=' - ')
# The default value is stored at the definition of the function
# as sho... | def add(x, y):
total = x + y
return total
print(add(5, 10))
def add(x, y=3):
total = x + y
return total
print(add(5))
print(add(5, 7))
print(add(x=2))
print(add(x=8, y=4))
print(1, 2, 3, 4, 5)
print(1, 2, 3, 4, 5, sep=' - ')
default_y = 3
def add(x, y=default_y):
total = x + y
print(total)
add... |
a=int(input("Enter the first term of the GP: "))
r=int(input("Enter the common ratio: "))
n=int(input("Enter the number of terms: "))
sum=0
product=1
for i in range(n):
term=a*pow(r,i)
sum=sum+term
product=product*term
print("Sum of",n,"terms=",sum)
print("Product of",n,"terms=",product)
| a = int(input('Enter the first term of the GP: '))
r = int(input('Enter the common ratio: '))
n = int(input('Enter the number of terms: '))
sum = 0
product = 1
for i in range(n):
term = a * pow(r, i)
sum = sum + term
product = product * term
print('Sum of', n, 'terms=', sum)
print('Product of', n, 'terms=',... |
"""Various utils dealing with classes."""
def overrides_method(method_name, obj, base):
"""
Return True if the named base class method is overridden by obj.
Parameters
----------
method_name : str
Name of the method to search for.
obj : object
An object that is assumed to inh... | """Various utils dealing with classes."""
def overrides_method(method_name, obj, base):
"""
Return True if the named base class method is overridden by obj.
Parameters
----------
method_name : str
Name of the method to search for.
obj : object
An object that is assumed to inhe... |
def get_starting_params():
num_players = int(input("Enter Number of Players : ")) # it takes user input
deck_size = 48
if num_players == 2:
hand_size = 10
points_threshold = 5
number_starting_common_cards = 8
elif num_players == 3:
hand_size = 8
points_threshol... | def get_starting_params():
num_players = int(input('Enter Number of Players : '))
deck_size = 48
if num_players == 2:
hand_size = 10
points_threshold = 5
number_starting_common_cards = 8
elif num_players == 3:
hand_size = 8
points_threshold = 3
number_star... |
class Benchmark:
@classmethod
def get_train_tasks(cls, sample_all=False):
return cls(env_type='train', sample_all=sample_all)
@classmethod
def get_test_tasks(cls, sample_all=False):
return cls(env_type='test', sample_all=sample_all)
| class Benchmark:
@classmethod
def get_train_tasks(cls, sample_all=False):
return cls(env_type='train', sample_all=sample_all)
@classmethod
def get_test_tasks(cls, sample_all=False):
return cls(env_type='test', sample_all=sample_all) |
def includeme(config):
# settings = config.registry.settings
config.add_route('processes', '/processes')
config.add_route('processes_list', '/processes/list')
config.add_route('processes_execute', '/processes/execute')
config.include('phoenix.processes.views.actions')
| def includeme(config):
config.add_route('processes', '/processes')
config.add_route('processes_list', '/processes/list')
config.add_route('processes_execute', '/processes/execute')
config.include('phoenix.processes.views.actions') |
class ColumnStyle(TableLayoutStyle):
"""
Represents the look and feel of a column in a table layout.
ColumnStyle(sizeType: SizeType,width: Single)
ColumnStyle()
ColumnStyle(sizeType: SizeType)
"""
@staticmethod
def __new__(self,sizeType=None,width=None):
"""
__new__(cls: type)
__new__(c... | class Columnstyle(TableLayoutStyle):
"""
Represents the look and feel of a column in a table layout.
ColumnStyle(sizeType: SizeType,width: Single)
ColumnStyle()
ColumnStyle(sizeType: SizeType)
"""
@staticmethod
def __new__(self, sizeType=None, width=None):
"""
__new__(cls: type)
__n... |
special_sum = 0
n_minus_1 = n_minus_2 = 1
fib_n = 0
while fib_n < 1000000:
fib_n, n_minus_1, n_minus_2 = n_minus_1, n_minus_2, n_minus_1 + n_minus_2
if fib_n % 2 == 0: special_sum += fib_n
print(special_sum)
| special_sum = 0
n_minus_1 = n_minus_2 = 1
fib_n = 0
while fib_n < 1000000:
(fib_n, n_minus_1, n_minus_2) = (n_minus_1, n_minus_2, n_minus_1 + n_minus_2)
if fib_n % 2 == 0:
special_sum += fib_n
print(special_sum) |
test = { 'name': 'q0_1',
'points': 1,
'suites': [ { 'cases': [ {'code': ">>> flavor_count.labels == ('Flavor', 'count')\nTrue", 'hidden': False, 'locked': False},
{'code': '>>> flavor_count.take(0).column("count").item(0) == 4\nTrue', 'hidden': False, 'locked': False},... | test = {'name': 'q0_1', 'points': 1, 'suites': [{'cases': [{'code': ">>> flavor_count.labels == ('Flavor', 'count')\nTrue", 'hidden': False, 'locked': False}, {'code': '>>> flavor_count.take(0).column("count").item(0) == 4\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> flavor_count.take(1).column("count").ite... |
EXPECTED_TOKEN = "eyJhbGciOiJSUzI1NiIsImtpZCI6Ijk0OTRhZDc1LTNmNTQtNDE1NS04NGZhLWMxYTE3ZGEyMmIzNSIsInR5cCI6IkpXVCJ9.eyJhbGxvdyI6eyIqIjoiKiJ9LCJkZW55Ijp7fX0.nDqCxO2Q1iXpxzbH7syxuyqw7kCY0sDfi9RX-VSUMTRN5aWTLt1bcPw4oN_jx89-YHBzDwnwBc07RsMgpFuo4zz2LU9PF0ciYxMNX-atTNsaIn05NkXT08au2AYb0DRCDS76MZ4QNi-4mRpLrj1SD4mSCwGtc2WNw9f0J... | expected_token = 'eyJhbGciOiJSUzI1NiIsImtpZCI6Ijk0OTRhZDc1LTNmNTQtNDE1NS04NGZhLWMxYTE3ZGEyMmIzNSIsInR5cCI6IkpXVCJ9.eyJhbGxvdyI6eyIqIjoiKiJ9LCJkZW55Ijp7fX0.nDqCxO2Q1iXpxzbH7syxuyqw7kCY0sDfi9RX-VSUMTRN5aWTLt1bcPw4oN_jx89-YHBzDwnwBc07RsMgpFuo4zz2LU9PF0ciYxMNX-atTNsaIn05NkXT08au2AYb0DRCDS76MZ4QNi-4mRpLrj1SD4mSCwGtc2WNw9f0J... |
# Copyright 2020 The Maritime Whale Authors. All rights reserved.
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE.txt file.
#
# Handles log writing.
def log(filename, msg):
"""Append message to specified logfile."""
f = open(filename, "a")
f.write(msg + "\n"... | def log(filename, msg):
"""Append message to specified logfile."""
f = open(filename, 'a')
f.write(msg + '\n')
f.close() |
# Floyed Loop
# Double linked List definition
class DListNode(object):
def __init__(self):
# self.value = x
self.next = None
self.prev = None
class Floyed(object):
def __init__(self):
self.head = None
# super(Floyed, self).__init__()
self.slow = DListNode()
... | class Dlistnode(object):
def __init__(self):
self.next = None
self.prev = None
class Floyed(object):
def __init__(self):
self.head = None
self.slow = d_list_node()
self.fast = d_list_node()
self.slow = self.head
self.fast = self.head
def is_loop(se... |
#!/usr/bin/env python
"""
__init__
Module containing methods for daemonizing
applications.
"""
| """
__init__
Module containing methods for daemonizing
applications.
""" |
def parse_app_id(app_id, method):
if app_id is not None and "/" in app_id:
# This is the normal case - narrative methods
app_id_parts = app_id.split("/")
app_type = "narrative"
elif method is not None:
# Here we use the method for non-narrative methods.
app_id_parts = met... | def parse_app_id(app_id, method):
if app_id is not None and '/' in app_id:
app_id_parts = app_id.split('/')
app_type = 'narrative'
elif method is not None:
app_id_parts = method.split('.')
app_type = 'other'
else:
return None
if len(app_id_parts) != 2:
if ... |
filename = 'test.txt'
filehandle = open('test.txt')
row = 1
filelist = list()
for item in filehandle:
print(item)
if item.startswith('4'):
item = item.strip()
item = int(item)
if item == row:
filelist.append(item)
row = row + 1
else:
... | filename = 'test.txt'
filehandle = open('test.txt')
row = 1
filelist = list()
for item in filehandle:
print(item)
if item.startswith('4'):
item = item.strip()
item = int(item)
if item == row:
filelist.append(item)
row = row + 1
else:
print(file... |
a = 0
b = 67 # 1
c = b # 2
d = 0
e = 0
f = 0
g = 0
h = 0
# count the number of mul
# smoke test for asm translation correctness
count = 0
# jumps > 0: if-else
# jumps < 0: do-while
if a != 0: # 2, 5
b *= 100 # 5
b += 100000 # 6
c = b # 7
c += 17000 # 8
while True: # 32
f = 1 # 9 - flag registe... | a = 0
b = 67
c = b
d = 0
e = 0
f = 0
g = 0
h = 0
count = 0
if a != 0:
b *= 100
b += 100000
c = b
c += 17000
while True:
f = 1
d = 2
outer_g = True
while outer_g:
e = 2
inner_g = True
while inner_g:
g = d
g *= e
count += 1
... |
#Create a histogram from a given list of integers
def histogram( items ):
for n in items:
output = ''
times = n
while( times > 0 ):
output += ' @ '
times = times - 1
print(output)
histogram([2, 3, 6, 5])
| def histogram(items):
for n in items:
output = ''
times = n
while times > 0:
output += ' @ '
times = times - 1
print(output)
histogram([2, 3, 6, 5]) |
# coding=utf-8
#
# for using a COCO model to finetuning with DIVA data.
targetClass1to1 = {
"Vehicle":"car",
"Person":"person",
"Parking_Meter":"parking meter",
"Tree":"potted plant",
"Other":None,
"Trees":"potted plant",
"Construction_Barrier":None,
"Door":None,
"Dumpster":None,
"Push_Pulled_Object":"suitc... | target_class1to1 = {'Vehicle': 'car', 'Person': 'person', 'Parking_Meter': 'parking meter', 'Tree': 'potted plant', 'Other': None, 'Trees': 'potted plant', 'Construction_Barrier': None, 'Door': None, 'Dumpster': None, 'Push_Pulled_Object': 'suitcase', 'Construction_Vehicle': 'truck', 'Prop': 'handbag', 'Bike': 'bicycle... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 5 22:50:19 2020
@author: xg7
"""
def convert_to_Roman_numeral(A):
# can be improved
rome_dict = {(2**(num//2))*(5**(num//2 + num%2)): lett for num, lett in enumerate('IVXLCDMGH')}
res = ''
for num, ln in enumerate(map(int, str(A)),... | """
Created on Mon Oct 5 22:50:19 2020
@author: xg7
"""
def convert_to__roman_numeral(A):
rome_dict = {2 ** (num // 2) * 5 ** (num // 2 + num % 2): lett for (num, lett) in enumerate('IVXLCDMGH')}
res = ''
for (num, ln) in enumerate(map(int, str(A)), 1):
div = 10 ** (len(str(A)) - num)
k =... |
# Write a short Python function, is even(k), that takes an integer value and
# returns True if k is even, and False otherwise. However, your function
# cannot use the multiplication, modulo, or division operators
def is_even(k):
even_nums = [0, 2, 4, 6, 8]
string_k = str(k)
string_list = [c for c in string... | def is_even(k):
even_nums = [0, 2, 4, 6, 8]
string_k = str(k)
string_list = [c for c in string_k]
last_number = string_list[-1] if len(string_list) > 1 else string_list[0]
print(k)
try:
even_nums.index(int(last_number))
return True
except ValueError:
return False
prin... |
# Sample Test passing with nose and pytest
def test_pass():
assert True, "Sample test"
| def test_pass():
assert True, 'Sample test' |
class Solution:
def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]:
ans = []
def dfs(root: TreeNode, sum: int, path: List[int]) -> None:
if root is None:
return
if root.val == sum and root.left is None and root.right is None:
ans.append(path + [root.val])
retur... | class Solution:
def path_sum(self, root: TreeNode, sum: int) -> List[List[int]]:
ans = []
def dfs(root: TreeNode, sum: int, path: List[int]) -> None:
if root is None:
return
if root.val == sum and root.left is None and (root.right is None):
a... |
"""API endpoints."""
API_BASE = "https://osu.ppy.sh/api"
USER = API_BASE + "/get_user"
USER_BEST = API_BASE + "/get_user_best"
USER_RECENT = API_BASE + "/get_user_recent"
SCORES = API_BASE + "/get_scores"
BEATMAPS = API_BASE + "/get_beatmaps"
MATCH = API_BASE + "/get_match"
| """API endpoints."""
api_base = 'https://osu.ppy.sh/api'
user = API_BASE + '/get_user'
user_best = API_BASE + '/get_user_best'
user_recent = API_BASE + '/get_user_recent'
scores = API_BASE + '/get_scores'
beatmaps = API_BASE + '/get_beatmaps'
match = API_BASE + '/get_match' |
class Address:
def __init__(self, street, city, pincode) -> None:
self.street = street
self.city = city
self.pincode = pincode
class Student:
def __init__(self,name, email, street, city, pincode) -> None:
self.name = name
self.email = email
self.address = Address... | class Address:
def __init__(self, street, city, pincode) -> None:
self.street = street
self.city = city
self.pincode = pincode
class Student:
def __init__(self, name, email, street, city, pincode) -> None:
self.name = name
self.email = email
self.address = addr... |
h , m = map(int, input().split())
if m < 45 :
if h==0:
h = 23
else:
h-=1
m += 15
else:
m -= 45
print(h,m) | (h, m) = map(int, input().split())
if m < 45:
if h == 0:
h = 23
else:
h -= 1
m += 15
else:
m -= 45
print(h, m) |
text = """
//------------------------------------------------------------------------------
// Explict instantiation.
//------------------------------------------------------------------------------
#include "SolidSPHHydroBase.cc"
#include "SolidSPHEvaluateDerivatives.cc"
#include "Geometry/Dimension.hh"
namespace Sph... | text = '\n//------------------------------------------------------------------------------\n// Explict instantiation.\n//------------------------------------------------------------------------------\n#include "SolidSPHHydroBase.cc"\n#include "SolidSPHEvaluateDerivatives.cc"\n#include "Geometry/Dimension.hh"\n\nnamespa... |
"""
1. Clarification
2. Possible solutions
- Bit Manipulation, Maths
3. Coding
4. Tests
"""
# T=O(1), S=O(1)
class Solution:
def getSum(self, a: int, b: int) -> int:
mask = 0xffffffff
while b & mask != 0:
carry = (a & b) << 1
a = a ^ b
b = carry
retu... | """
1. Clarification
2. Possible solutions
- Bit Manipulation, Maths
3. Coding
4. Tests
"""
class Solution:
def get_sum(self, a: int, b: int) -> int:
mask = 4294967295
while b & mask != 0:
carry = (a & b) << 1
a = a ^ b
b = carry
return a & mask if b... |
# pyfc4
# version info
__version_info__ = ('0', '1')
__version__ = '.'.join(__version_info__)
| __version_info__ = ('0', '1')
__version__ = '.'.join(__version_info__) |
CONTRACT_RECEIVE_FUNCTION_SOURCE = '''
pragma solidity ^0.6.0;
contract Receive {
string text;
fallback() external payable {
text = 'fallback';
}
receive() external payable {
text = 'receive';
}
function getText() public view returns (string memory) {
return text;
... | contract_receive_function_source = "\npragma solidity ^0.6.0;\n\n\ncontract Receive {\n string text;\n\n fallback() external payable {\n text = 'fallback';\n }\n\n receive() external payable {\n text = 'receive';\n }\n\n function getText() public view returns (string memory) {\n r... |
# Define a function that takes in two non-negative integers a and b and returns the last decimal digit of a^b.
# Note that a and b may be very large!
# For example, the last decimal digit of 9^7 is 9, since 9^7=4782969.
# The last decimal digit of (2^200)^2300, which has over 10^92 decimal digits, is 6.
# Also, plea... | def last_digit(a, b):
return pow(a, b, 10) |
num = int(input("Input: "))
count = 0
squareLength = 3
while squareLength * squareLength < num:
squareLength += 2
squareLength -= 2
cornerValue = squareLength * squareLength
diff = num - cornerValue
midPoint = (squareLength + 1) / 2
# # Walk right one
# diff += 1
# # Walk north
# if squareLength > diff:
# dif... | num = int(input('Input: '))
count = 0
square_length = 3
while squareLength * squareLength < num:
square_length += 2
square_length -= 2
corner_value = squareLength * squareLength
diff = num - cornerValue
mid_point = (squareLength + 1) / 2
print(squareLength)
print(cornerValue)
print(diff)
print(midPoint) |
#Python program to Find ASCII value of character
def main():
x=input("Enter a character")
print("The ASCII value of",x,"is",ord(x))
if __name__=='__main__':
main()
| def main():
x = input('Enter a character')
print('The ASCII value of', x, 'is', ord(x))
if __name__ == '__main__':
main() |
class BinarySearch:
def __init__(self, data, item) -> None:
self.data = data
self.item = item
def binary_search(self):
"""_summary_"""
low = 0
high = len(self.data) - 1
while low <= high:
middle_number_index = (low + high) // 2
guess =... | class Binarysearch:
def __init__(self, data, item) -> None:
self.data = data
self.item = item
def binary_search(self):
"""_summary_"""
low = 0
high = len(self.data) - 1
while low <= high:
middle_number_index = (low + high) // 2
guess = se... |
class ViewFamily(Enum,IComparable,IFormattable,IConvertible):
"""
An enumerated type that corresponds to the type of a Revit view.
enum ViewFamily,values: AreaPlan (110),CeilingPlan (111),CostReport (106),Detail (113),Drafting (108),Elevation (114),FloorPlan (109),GraphicalColumnSchedule (119),ImageView (1... | class Viewfamily(Enum, IComparable, IFormattable, IConvertible):
"""
An enumerated type that corresponds to the type of a Revit view.
enum ViewFamily,values: AreaPlan (110),CeilingPlan (111),CostReport (106),Detail (113),Drafting (108),Elevation (114),FloorPlan (109),GraphicalColumnSchedule (119),ImageView (1... |
{
"cells": [
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The max value = 5\n",
"The min value = -3\n",
"The max squared value = 25\n",
"The length of the list = 7\n",
"T... | {'cells': [{'cell_type': 'code', 'execution_count': 29, 'metadata': {}, 'outputs': [{'name': 'stdout', 'output_type': 'stream', 'text': ['The max value = 5\n', 'The min value = -3\n', 'The max squared value = 25\n', 'The length of the list = 7\n', 'The total of all positive numbers in the list = 15\n', 'The Negative nu... |
"""
A module with a function to show off positional for-loops.
This function has been fully implemented, and is correct.
Author: Walker M. White
Date: April 15, 2019
"""
def partition(s):
"""Returns: a list splitting s in two parts
The 1st element of the list consists of all characters in even
positi... | """
A module with a function to show off positional for-loops.
This function has been fully implemented, and is correct.
Author: Walker M. White
Date: April 15, 2019
"""
def partition(s):
"""Returns: a list splitting s in two parts
The 1st element of the list consists of all characters in even
positio... |
class TestClass(object):
def test_eken(self):
eken = 'diq'
assert eken == 'diq'
def test_gman(self):
gman_is_g = True
assert gman_is_g is True
def test_t(self):
tys_biceps_circumference = 5*1000
assert tys_biceps_circumference > 1000
| class Testclass(object):
def test_eken(self):
eken = 'diq'
assert eken == 'diq'
def test_gman(self):
gman_is_g = True
assert gman_is_g is True
def test_t(self):
tys_biceps_circumference = 5 * 1000
assert tys_biceps_circumference > 1000 |
load("//:plugin.bzl", "ProtoPluginInfo")
load(
"//internal:common.bzl",
"ProtoCompileInfo",
"copy_file",
"descriptor_proto_path",
"get_int_attr",
"get_output_filename",
"strip_path_prefix",
)
ProtoLibraryAspectNodeInfo = provider(
fields = {
"output_files": "The files generated ... | load('//:plugin.bzl', 'ProtoPluginInfo')
load('//internal:common.bzl', 'ProtoCompileInfo', 'copy_file', 'descriptor_proto_path', 'get_int_attr', 'get_output_filename', 'strip_path_prefix')
proto_library_aspect_node_info = provider(fields={'output_files': 'The files generated by this aspect and its transitive dependenci... |
# def foo (arg1, arg2, arg3):
# print (arg1,arg2,arg3)
# foo(
# arg2 = 'second',
# arg3 = 'third',
# arg1 = ['name1','name2']
# )
# string1 = ('{} part'.format('first'))
# string2 = 'second part'
# print (string1+string2)
def create_table(name,columns,datatype,key): #columns is a list containing col... | def create_table(name, columns, datatype, key):
dd = {'str': 'varchar(255)', 'float': 'FLOAT(63,4)'}
query = 'CREATE TABLE {} ( \n'.format(name)
query_seg = ''
for (i, col_name) in enumerate(columns):
query_seg = '{} {} NOT NULL,\n'.format(col_name, dd[datatype[i]])
query += query_seg
... |
chave_certa = 2002
while True:
senha = int(input())
if senha == chave_certa:
print("Acesso Permitido")
break
print("Senha Invalida") | chave_certa = 2002
while True:
senha = int(input())
if senha == chave_certa:
print('Acesso Permitido')
break
print('Senha Invalida') |
#!/usr/bin/python3
def max_integer(my_list=[]):
my_list.sort()
if my_list:
return my_list[len(my_list) - 1]
else:
return None
| def max_integer(my_list=[]):
my_list.sort()
if my_list:
return my_list[len(my_list) - 1]
else:
return None |
"""
Assignment operators are used to assign values to variables
Documentation - https://www.w3schools.com/python/python_operators.asp
"""
x = 3
y = 5
x = y # Means the value of x is equal to y (Assignment, 5)
x += y # Means the value of x is x + y (Addition Assignment, 8)
x -= y # Means the value of x is x - y (Subt... | """
Assignment operators are used to assign values to variables
Documentation - https://www.w3schools.com/python/python_operators.asp
"""
x = 3
y = 5
x = y
x += y
x -= y
x *= y
x /= y
x %= y
x //= y
x **= y
x &= y
x |= y
x ^= y
x >>= y
x <<= y |
class Jogador():
def __init__(self):
self.cartas = []
self.soma = 0
self.turnos = 0 | class Jogador:
def __init__(self):
self.cartas = []
self.soma = 0
self.turnos = 0 |
"""
Contain Edge class for use in a graph
"""
class Edge():
"""
Edge class
"""
def __init__(self, src, dest, **options):
self.src = src
self.dest = dest
self.options = options
def __repr__(self):
options = "\n".join(
[f' {key}="{value}"' for key, value... | """
Contain Edge class for use in a graph
"""
class Edge:
"""
Edge class
"""
def __init__(self, src, dest, **options):
self.src = src
self.dest = dest
self.options = options
def __repr__(self):
options = '\n'.join([f' {key}="{value}"' for (key, value) in self.opti... |
# -*- coding: utf-8 -*-
"""
Stub ui to allow debug on PC
"""
AUTOCAPITALIZE_NONE = 0
def measure_string(*args, **kwargs):
return 12.0
def in_background(func):
return func
def get_screen_size():
return 100, 100
class View(object):
def __init__(self, *args, **kwargs):
self.on_screen = Tru... | """
Stub ui to allow debug on PC
"""
autocapitalize_none = 0
def measure_string(*args, **kwargs):
return 12.0
def in_background(func):
return func
def get_screen_size():
return (100, 100)
class View(object):
def __init__(self, *args, **kwargs):
self.on_screen = True
self.width = 100... |
load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest")
load(":include_tools.bzl", "CommandLineToTemplateString", "ProccessResponse")
def _proccess_response_test_impl(ctx):
response = """clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/... | load('@bazel_skylib//lib:unittest.bzl', 'asserts', 'unittest')
load(':include_tools.bzl', 'CommandLineToTemplateString', 'ProccessResponse')
def _proccess_response_test_impl(ctx):
response = 'clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)\nTarget: x86_64-pc-linux-gnu\nThread model: posix\nInstalledDir: /usr... |
feature_dict = {
'VMAF_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 'adm2', 'motion', ],
}
model_type = "LIBSVMNUSVR"
model_param_dict = {
# ==== preprocess: normalize each feature ==== #
# 'norm_type': 'none', # default: do nothing
'norm_type': 'clip_0to1', # rescale to within... | feature_dict = {'VMAF_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 'adm2', 'motion']}
model_type = 'LIBSVMNUSVR'
model_param_dict = {'norm_type': 'clip_0to1', 'score_clip': [0.0, 100.0], 'gamma': 0.05, 'C': 4.0, 'nu': 0.9} |
class Operation(dict):
def __init__(self, operationType=None, operationName=None, listOfInputMessages=None, listOfOutputMessages=None):
dict.__init__(self, operationType=operationType, operationName=operationName
, listOfInputMessages=listOfInputMessages, listOfOutputMessages=listOfOut... | class Operation(dict):
def __init__(self, operationType=None, operationName=None, listOfInputMessages=None, listOfOutputMessages=None):
dict.__init__(self, operationType=operationType, operationName=operationName, listOfInputMessages=listOfInputMessages, listOfOutputMessages=listOfOutputMessages) |
'''(Partitioning Arrays: Dutch Flag [M]): Dutch National Flag Problem:
Given an array of integers A and a pivot, rearrange A in the following order:
[Elements less than pivot, elements equal to pivot, elements greater than pivot]
For example, if A = [5,2,4,4,6,4,4,3] and pivot = 4 -> result = [3,2,4,4,4,4,6,5]'''... | """(Partitioning Arrays: Dutch Flag [M]): Dutch National Flag Problem:
Given an array of integers A and a pivot, rearrange A in the following order:
[Elements less than pivot, elements equal to pivot, elements greater than pivot]
For example, if A = [5,2,4,4,6,4,4,3] and pivot = 4 -> result = [3,2,4,4,4,4,6,5]"""
def... |
"""
Copyright 2019, SICK AG, Waldkirch
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http ://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwa... | """
Copyright 2019, SICK AG, Waldkirch
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http ://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwa... |
# copying a large dictionary
a = {i: 2 * i for i in range(1000)}
b = a.copy()
for i in range(1000):
print(i, b[i])
print(len(b))
| a = {i: 2 * i for i in range(1000)}
b = a.copy()
for i in range(1000):
print(i, b[i])
print(len(b)) |
class Parser():
def __init__(self, file):
content = [line.strip() for line in file.readlines()]
content = [line.split('//')[0].strip() for line in content if not line.startswith('//') and line is not '']
self.source_code: list = content
self.current_command: int = 0
def _comman... | class Parser:
def __init__(self, file):
content = [line.strip() for line in file.readlines()]
content = [line.split('//')[0].strip() for line in content if not line.startswith('//') and line is not '']
self.source_code: list = content
self.current_command: int = 0
def _command(... |
pkgname = "ninja"
pkgver = "1.10.2"
pkgrel = 0
hostmakedepends = ["python"]
pkgdesc = "Small build system with a focus on speed"
maintainer = "q66 <q66@chimera-linux.org>"
license = "Apache-2.0"
url = "https://ninja-build.org"
sources = [f"https://github.com/ninja-build/ninja/archive/v{pkgver}.tar.gz"]
sha256 = ["ce358... | pkgname = 'ninja'
pkgver = '1.10.2'
pkgrel = 0
hostmakedepends = ['python']
pkgdesc = 'Small build system with a focus on speed'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'Apache-2.0'
url = 'https://ninja-build.org'
sources = [f'https://github.com/ninja-build/ninja/archive/v{pkgver}.tar.gz']
sha256 = ['ce358... |
fonts = AllFonts()
for font in fonts:
min = 0
max = 0
for glyph in font:
if glyph.bounds != None:
if glyph.bounds[1] < min:
min = glyph.bounds[1]
if glyph.bounds[3] > max:
max = glyph.bounds[3]
print(min,max)
capSpace = m... | fonts = all_fonts()
for font in fonts:
min = 0
max = 0
for glyph in font:
if glyph.bounds != None:
if glyph.bounds[1] < min:
min = glyph.bounds[1]
if glyph.bounds[3] > max:
max = glyph.bounds[3]
print(min, max)
cap_space = max - font['H... |
def palindrome():
largest = 0
for a in range(999, 99, -1):
for b in range(999, 99, -1):
# use an awesome extended slice to reverse string
# https://docs.python.org/2/whatsnew/2.3.html#extended-slices
# print(a, b, a*b, str(a*b)[::-1])
if a*b == int(str(a*b... | def palindrome():
largest = 0
for a in range(999, 99, -1):
for b in range(999, 99, -1):
if a * b == int(str(a * b)[::-1]) and a * b > largest:
largest = a * b
return largest
print(palindrome()) |
class MaxHeap:
def __init__(self):
self.data = []
def root_node(self):
return self.data[0]
def last_node(self):
return self.data[-1]
def left_child_index(self, index):
return 2 * index + 1
def right_child_index(self, index):
return 2 * index + 2
def ... | class Maxheap:
def __init__(self):
self.data = []
def root_node(self):
return self.data[0]
def last_node(self):
return self.data[-1]
def left_child_index(self, index):
return 2 * index + 1
def right_child_index(self, index):
return 2 * index + 2
def ... |
"""
============
proyecto IER
============
Para el proyecto de IER
"""
| """
============
proyecto IER
============
Para el proyecto de IER
""" |
wt9_2_10 = {'192.168.122.110': [5.7108, 8.5399, 6.3325, 4.9405, 4.3064, 5.4196, 4.7852, 4.852, 5.5112, 6.0472, 5.987, 5.9324, 5.9693, 5.9885, 5.9521, 5.9517, 5.9214, 5.8912, 6.1639, 6.1483, 6.1269, 6.1008, 6.0684, 6.0465, 6.0183, 5.9975, 6.094, 6.0673, 6.0838, 6.2445, 6.2204, 6.1954, 6.1722, 6.1532, 6.1334, 6.1211, 6.... | wt9_2_10 = {'192.168.122.110': [5.7108, 8.5399, 6.3325, 4.9405, 4.3064, 5.4196, 4.7852, 4.852, 5.5112, 6.0472, 5.987, 5.9324, 5.9693, 5.9885, 5.9521, 5.9517, 5.9214, 5.8912, 6.1639, 6.1483, 6.1269, 6.1008, 6.0684, 6.0465, 6.0183, 5.9975, 6.094, 6.0673, 6.0838, 6.2445, 6.2204, 6.1954, 6.1722, 6.1532, 6.1334, 6.1211, 6.1... |
index = 0
def register(name, func):
global index
index += 1
func_name = name + str(index)
globals()[func_name] = func
return func_name | index = 0
def register(name, func):
global index
index += 1
func_name = name + str(index)
globals()[func_name] = func
return func_name |
def search(data):
string = ""
number = ""
last_i = ""
for el in data:
if el.isdigit():
number += el
last_i = data.index(el)
continue
elif number == "":
string += el
else:
break
return string, number, last_i
dat... | def search(data):
string = ''
number = ''
last_i = ''
for el in data:
if el.isdigit():
number += el
last_i = data.index(el)
continue
elif number == '':
string += el
else:
break
return (string, number, last_i)
data = ... |
# -*- coding: utf-8 -*-
'''
>>> from opem.Dynamic.Padulles_Hauer import *
>>> import shutil
>>> Test_Vector={"T":343,"E0":0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":... | """
>>> from opem.Dynamic.Padulles_Hauer import *
>>> import shutil
>>> Test_Vector={"T":343,"E0":0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":0.1,"i-stop":4,"i-step":... |
class Strategy:
"""A combination of alternative and its belief."""
def __init__(self, alternative, belief):
self.alternative = alternative
self.belief = belief
| class Strategy:
"""A combination of alternative and its belief."""
def __init__(self, alternative, belief):
self.alternative = alternative
self.belief = belief |
bag = dict()
bag["mathTextBook"] = 12.5
bag["nameTag"] = "Winston"
bag.update({"nameTag": "Grace"})
print(bag) | bag = dict()
bag['mathTextBook'] = 12.5
bag['nameTag'] = 'Winston'
bag.update({'nameTag': 'Grace'})
print(bag) |
M = 10**9 + 7
def solve(n):
a = n
i = 1
while i < n:
k = n // i
j = min(n // k + 1, n)
a += k * (j - i) * n - k * (k + 1) * (j - i) * (i + j - 1) // 4
a %= M
i = j
return a
for _ in range(int(input())):
n = int(input())
print(solve(n))
| m = 10 ** 9 + 7
def solve(n):
a = n
i = 1
while i < n:
k = n // i
j = min(n // k + 1, n)
a += k * (j - i) * n - k * (k + 1) * (j - i) * (i + j - 1) // 4
a %= M
i = j
return a
for _ in range(int(input())):
n = int(input())
print(solve(n)) |
"""Extra, simple, "builtin-like" functions."""
def subclasstree(cls):
"""Return dictionary whose first key is the class and whose
value is a dict mapping each of its subclasses to their
subclass trees recursively.
"""
classtree = {cls: {}}
for subclass in type.__subclasses__(cls): # long vers... | """Extra, simple, "builtin-like" functions."""
def subclasstree(cls):
"""Return dictionary whose first key is the class and whose
value is a dict mapping each of its subclasses to their
subclass trees recursively.
"""
classtree = {cls: {}}
for subclass in type.__subclasses__(cls):
class... |
string = input('enter string from which vowels are need to be remove ')
string = string.lower()
vowels = ('a','e','i','o','u')
for c in string:
if string in vowels:
new_str = string.replace(c,'')
print(new_str)
| string = input('enter string from which vowels are need to be remove ')
string = string.lower()
vowels = ('a', 'e', 'i', 'o', 'u')
for c in string:
if string in vowels:
new_str = string.replace(c, '')
print(new_str) |
#
# PySNMP MIB module EdgeSwitch-DOT1X-ADVANCED-FEATURES-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EdgeSwitch-DOT1X-ADVANCED-FEATURES-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:56:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, constraints_union, constraints_intersection, value_size_constraint) ... |
#!/usr/bin/python
class User(object):
def __init__(self,conn, addr,name=None):
self.name = name
self.conn = conn
self.addr = addr
class Player(User):
def __init__(self,conn,addr,name=None):
super(Player,self).__init__(conn,addr,name)
self.passwd = None
self.scor... | class User(object):
def __init__(self, conn, addr, name=None):
self.name = name
self.conn = conn
self.addr = addr
class Player(User):
def __init__(self, conn, addr, name=None):
super(Player, self).__init__(conn, addr, name)
self.passwd = None
self.score = 0
... |
"""
PYTHON LIST SLICING: FLAT LIST
"""
__author__ = 'Sol Amour - amoursol@gmail.com'
__twitter__ = '@solamour'
__version__ = '1.0.0'
# SYNTAX: [ startCut : endCut ]
# startCut = This is the first item included in the Slice
# endCut = This is the last item included in the Slice
# NOTES:
# All parameters h... | """
PYTHON LIST SLICING: FLAT LIST
"""
__author__ = 'Sol Amour - amoursol@gmail.com'
__twitter__ = '@solamour'
__version__ = '1.0.0'
numbers = [[0, 1, 2, 3], [4, 5, 6, 7, 8]]
chosen_range_in_sublists = [n[1:-1] for n in numbers]
out = chosenRangeInSublists |
def pkcs_7_padding(block,N=16):
if N >= 256:
raise Exception('N is too large.')
num_remaining = N - len(block) % N
return block + (chr(num_remaining) * num_remaining).encode('utf-8')
if __name__ == '__main__':
print(pkcs_7_padding(b'YELLOW SUBMARINE', 20)) | def pkcs_7_padding(block, N=16):
if N >= 256:
raise exception('N is too large.')
num_remaining = N - len(block) % N
return block + (chr(num_remaining) * num_remaining).encode('utf-8')
if __name__ == '__main__':
print(pkcs_7_padding(b'YELLOW SUBMARINE', 20)) |
#
# @lc app=leetcode id=487 lang=python3
#
# [487] Max Consecutive Ones II
#
# @lc code=start
class Solution:
def findMaxConsecutiveOnes(self, nums):
curzero = 0
lp = 0
rp = 0
mxlen = 0
while rp < len(nums):
if nums[rp] == 0:
curzero += 1
... | class Solution:
def find_max_consecutive_ones(self, nums):
curzero = 0
lp = 0
rp = 0
mxlen = 0
while rp < len(nums):
if nums[rp] == 0:
curzero += 1
if curzero > 1:
mxlen = max(mxlen, rp - lp)
... |
"""Simple dummy generator for the Pairsum problem, outputting a trivial instance."""
n = 0
with open("input", "r") as input:
n = int(input.readline())
with open("output", "w") as output:
output.write(" ".join("1" for i in range(n)))
output.write("\n")
output.write("0 1 2 3")
| """Simple dummy generator for the Pairsum problem, outputting a trivial instance."""
n = 0
with open('input', 'r') as input:
n = int(input.readline())
with open('output', 'w') as output:
output.write(' '.join(('1' for i in range(n))))
output.write('\n')
output.write('0 1 2 3') |
input = """
1 2 2 1 3 4
1 3 2 1 2 4
1 4 0 0
0
3 b
2 a
0
B+
0
B-
1
0
1
"""
output = """
{b}
{a}
"""
| input = '\n1 2 2 1 3 4\n1 3 2 1 2 4\n1 4 0 0\n0\n3 b\n2 a\n0\nB+\n0\nB-\n1\n0\n1\n'
output = '\n{b}\n{a}\n' |
number1 = int (input())
number2 = int (input())
if number1 >= number2:
print('Greater number: ', number1)
elif number2 > number1:
print('Greater number: ', number2)
else:
print() | number1 = int(input())
number2 = int(input())
if number1 >= number2:
print('Greater number: ', number1)
elif number2 > number1:
print('Greater number: ', number2)
else:
print() |
# header
"""
#Format\tALLC
#Species\thuman
#Genome\thg19
#MethylomeType\tsingle-cell
#Technology\tsnmC-seq2
#ContextLength\t3
#MethylationBase\t0
#mCContent\tCNN
#Generator\tALLCools
""" | """
#Format ALLC
#Species human
#Genome hg19
#MethylomeType single-cell
#Technology snmC-seq2
#ContextLength 3
#MethylationBase 0
#mCContent CNN
#Generator ALLCools
""" |
# -*- coding: utf-8 -*-
name = 'turret_resolver'
version = '1.1.3.0'
authors = ['wen.tan',
'ben.skinner',
'daniel.flood']
build_requires = ['python']
build_command = 'rez env python -c "python {root}/rezbuild.py {install}"'
requires = ['pgtk', 'tk_core']
def commands():
env.PYTHONPATH.... | name = 'turret_resolver'
version = '1.1.3.0'
authors = ['wen.tan', 'ben.skinner', 'daniel.flood']
build_requires = ['python']
build_command = 'rez env python -c "python {root}/rezbuild.py {install}"'
requires = ['pgtk', 'tk_core']
def commands():
env.PYTHONPATH.append('{root}/python')
env.RESOLVE.set('{root}/b... |
def sum(num):
return num + num
def squre(num):
return num * num | def sum(num):
return num + num
def squre(num):
return num * num |
# lextab.py. This file automatically created by PLY (version 2.2). Don't edit!
_lextokens = {'HEADER_NAME': None, 'IDENTIFIER': None, 'PP_NUMBER': None, 'CHARACTER_CONSTANT': None, 'STRING_LITERAL': None, 'OTHER': None, 'PTR_OP': None, 'INC_OP': None, 'DEC_OP': None, 'LEFT_OP': None, 'RIGHT_OP': None, 'LE_OP': None,... | _lextokens = {'HEADER_NAME': None, 'IDENTIFIER': None, 'PP_NUMBER': None, 'CHARACTER_CONSTANT': None, 'STRING_LITERAL': None, 'OTHER': None, 'PTR_OP': None, 'INC_OP': None, 'DEC_OP': None, 'LEFT_OP': None, 'RIGHT_OP': None, 'LE_OP': None, 'GE_OP': None, 'EQ_OP': None, 'NE_OP': None, 'AND_OP': None, 'OR_OP': None, 'MUL_... |
num_students = int(input())
students = {}
for _ in range(num_students):
name, grade = input().split(' ')
if name not in students:
students[name] = []
students[name].append(float(grade))
for name, grades in students.items():
average_grade = sum(grades) / len(grades)
grades = [f'{... | num_students = int(input())
students = {}
for _ in range(num_students):
(name, grade) = input().split(' ')
if name not in students:
students[name] = []
students[name].append(float(grade))
for (name, grades) in students.items():
average_grade = sum(grades) / len(grades)
grades = [f'{x:.2f}' f... |
#Paula Duffy 2018-02-06
#Collatz Conjecture - Week 3 Exercise
n = int(input("Please enter an integer: "))
while n > 1:
if n % 2 == 0:
n = n // 2 #divide by 2 if integer is even
print (n)
elif n % 2 == 1:
n = (n * 3) + 1 #multiply by 3 and add 1 if integer is not even
print (n)
| n = int(input('Please enter an integer: '))
while n > 1:
if n % 2 == 0:
n = n // 2
print(n)
elif n % 2 == 1:
n = n * 3 + 1
print(n) |
def add(a,b):
return a+b
def sub(a,b):
return a-b
def mul(a,b):
return a*b
def div(a,b):
return a/b
print(__name__) | def add(a, b):
return a + b
def sub(a, b):
return a - b
def mul(a, b):
return a * b
def div(a, b):
return a / b
print(__name__) |
class Node(object):
def __init__(self, data):
"""Initialize this node with the given data."""
self.data = data
self.next = None
self.prev = None
def __repr__(self):
"""Return a string representation of this node."""
return 'Node({!r})'.format(self.data)
class D... | class Node(object):
def __init__(self, data):
"""Initialize this node with the given data."""
self.data = data
self.next = None
self.prev = None
def __repr__(self):
"""Return a string representation of this node."""
return 'Node({!r})'.format(self.data)
class D... |
class LatchApp(object):
def __init__(self, appid, secret):
"""
Class constructor
:param appid: App ID
:param secret: Secret code
"""
self._appid = appid
self._secret = secret
self._proxy = None
@property
def appid(self):
"""
Returns App ID
:return: App ID
"""
r... | class Latchapp(object):
def __init__(self, appid, secret):
"""
Class constructor
:param appid: App ID
:param secret: Secret code
"""
self._appid = appid
self._secret = secret
self._proxy = None
@property
def appid(self):
"""
Returns App ID
:r... |
class ObjectView(dict):
def __init__(self, *args, **kwargs):
super(ObjectView, self).__init__(**kwargs)
for arg in args:
if not arg:
continue
elif isinstance(arg, dict):
for key, val in arg.items():
self[key] = val
... | class Objectview(dict):
def __init__(self, *args, **kwargs):
super(ObjectView, self).__init__(**kwargs)
for arg in args:
if not arg:
continue
elif isinstance(arg, dict):
for (key, val) in arg.items():
self[key] = val
... |
def fermat(num):
"""Runs a number through 1 simplified iteration of Fermat's test."""
if ((2 ** num) - 2) % num == 0:
return True
else: return False
def gen_primes(maxnum):
"""Generates primes using fermat"""
if maxnum % 2 == 0: # finds odd number
maxnum -= 1
num = maxnum
wh... | def fermat(num):
"""Runs a number through 1 simplified iteration of Fermat's test."""
if (2 ** num - 2) % num == 0:
return True
else:
return False
def gen_primes(maxnum):
"""Generates primes using fermat"""
if maxnum % 2 == 0:
maxnum -= 1
num = maxnum
while num > 1:
... |
# Problem:
# Write a program that reads a number of integer numbers entered by the user and sums them.
num_of_loops = int(input())
sum = 0;
for i in range(1, num_of_loops + 1):
num = int(input())
sum += num
print(sum)
| num_of_loops = int(input())
sum = 0
for i in range(1, num_of_loops + 1):
num = int(input())
sum += num
print(sum) |
#!/usr/bin/env python
scores = {
"pullups": [(4,20), (5,23), (5,23), (5,23), (5,21), (5,20), (5,19), (4,19)],
"crunches": [
(70,105),
(70,110),
(70,115),
(70,115),
(70,110),
(65,105),
(50,100),
(40,100),
],
"run": [
(18 * 60,27 * 6... | scores = {'pullups': [(4, 20), (5, 23), (5, 23), (5, 23), (5, 21), (5, 20), (5, 19), (4, 19)], 'crunches': [(70, 105), (70, 110), (70, 115), (70, 115), (70, 110), (65, 105), (50, 100), (40, 100)], 'run': [(18 * 60, 27 * 60 + 40), (18 * 60, 27 * 60 + 40), (18 * 60, 28 * 60 + 0), (18 * 60, 28 * 60 + 40), (18 * 60, 28 * 6... |
# https://github.com/cthoyt/cookiecutter-snekpack how to make folder structure
# https://bmcbioinformatics.biomedcentral.com/articles/10.1186/1471-2105-14-340 article for this analysis
CRED = '\033[91m'
CEND = '\033[0m'
EXPRESSION = "../../data/GSE161533.top.table.tsv"
EXPRESSION2 = "../../data/GGSE54129.top.table.tsv... | cred = '\x1b[91m'
cend = '\x1b[0m'
expression = '../../data/GSE161533.top.table.tsv'
expression2 = '../../data/GGSE54129.top.table.tsv'
interaction = '../../data/gene_interaction_map.tsv'
pathway = '../../data/VEGF_signaling_pathw.txt' |
f = [0,1]
n = int(input("numar:"))
for i in range(2, n+1):
f.append(f[i-1]+f[i-2])
print(f)
| f = [0, 1]
n = int(input('numar:'))
for i in range(2, n + 1):
f.append(f[i - 1] + f[i - 2])
print(f) |
# -*- coding: utf-8 -*-
# Scrapy settings for tech163 project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'money163'
SPIDER_MODULES = ['money163.spiders']
NE... | bot_name = 'money163'
spider_modules = ['money163.spiders']
newspider_module = 'money163.spiders'
item_pipelines = {'money163.pipelines.Money163Pipeline': 300}
user_agent = 'Mozilla/5.0 (X11; Windows x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.7'
download_timeout = 35
download_delay = 0.5 |
def first_letter_of_word(current_word):
digits = []
new_current_word = []
for letter in current_word:
if letter.isdigit():
digits.append(letter)
elif letter.isalpha():
new_current_word.append(letter)
first_letter = chr(int("".join(digits)))
new_current_word.in... | def first_letter_of_word(current_word):
digits = []
new_current_word = []
for letter in current_word:
if letter.isdigit():
digits.append(letter)
elif letter.isalpha():
new_current_word.append(letter)
first_letter = chr(int(''.join(digits)))
new_current_word.in... |
N = int(input())
line = []
for a in range(N):
line.append(int(input()))
total = 0
curIter = 1
while min(line) < 999999:
valleys = []
for a in range(N):
if line[a] < 999999:
if (a == 0 or line[a] <= line[a - 1]) and (a == N - 1 or line[a] <= line[a + 1]):
valleys.append... | n = int(input())
line = []
for a in range(N):
line.append(int(input()))
total = 0
cur_iter = 1
while min(line) < 999999:
valleys = []
for a in range(N):
if line[a] < 999999:
if (a == 0 or line[a] <= line[a - 1]) and (a == N - 1 or line[a] <= line[a + 1]):
valleys.append(a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.