content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# This file was generated by the "capture_real_responses.py" script.
# On Wed, 20 Nov 2019 19:34:18 +0000.
#
# To update it run:
# python -m tests.providers.capture_real_responses
captured_responses = [
{
"request": {
"full_url": "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService... | captured_responses = [{'request': {'full_url': 'https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente', 'method': 'POST', 'headers': {}, 'data': bytearray(b'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.b... |
def check(params):
"Check input parameters"
attrs = []
for attr in attrs:
if attr not in params:
raise Exception('key {} not in {}'.format(attr, json.dumps(params)))
def execute(cur, stmt, bindings, verbose=None):
"Helper function to execute statement"
if verbose:
print(... | def check(params):
"""Check input parameters"""
attrs = []
for attr in attrs:
if attr not in params:
raise exception('key {} not in {}'.format(attr, json.dumps(params)))
def execute(cur, stmt, bindings, verbose=None):
"""Helper function to execute statement"""
if verbose:
... |
class Solution:
def twoSum(self, numbers: List[int], target: int) -> List[int]:
left, right = 0, len(numbers) - 1
while left < right:
curSum = numbers[left] + numbers[right]
if curSum == target:
return[left + 1, right + 1]
if curSum > target:
... | class Solution:
def two_sum(self, numbers: List[int], target: int) -> List[int]:
(left, right) = (0, len(numbers) - 1)
while left < right:
cur_sum = numbers[left] + numbers[right]
if curSum == target:
return [left + 1, right + 1]
if curSum > targe... |
'''
A collection of optional backends. You must manually select and
install the backend you want. If the backend is not installed,
then trying to import the module for that backend will cause
an :class:`ImportError`.
See :ref:`Choose a hashing backend` for more.
'''
SUPPORTED_BACKENDS = [
'pycryptodomex', # pref... | """
A collection of optional backends. You must manually select and
install the backend you want. If the backend is not installed,
then trying to import the module for that backend will cause
an :class:`ImportError`.
See :ref:`Choose a hashing backend` for more.
"""
supported_backends = ['pycryptodomex', 'pysha3'] |
class BSTIterator:
def __init__(self, root: Optional[TreeNode]):
self.stack = []
self.pushLeftsUntilNull_(root)
def next(self) -> int:
root = self.stack.pop()
self.pushLeftsUntilNull_(root.right)
return root.val
def hasNext(self) -> bool:
return self.stack
def pushLeftsUntilNull_(self... | class Bstiterator:
def __init__(self, root: Optional[TreeNode]):
self.stack = []
self.pushLeftsUntilNull_(root)
def next(self) -> int:
root = self.stack.pop()
self.pushLeftsUntilNull_(root.right)
return root.val
def has_next(self) -> bool:
return self.stack... |
class Cache:
def __init__(self, function, limit=1000):
self.function = function
self.limit = limit
self.purge()
def get(self, key):
value = self.store.get(key)
if value is None:
value = self.function(key)
self.set(key, value)
return value
... | class Cache:
def __init__(self, function, limit=1000):
self.function = function
self.limit = limit
self.purge()
def get(self, key):
value = self.store.get(key)
if value is None:
value = self.function(key)
self.set(key, value)
return value... |
'''10. Write a Python program to use double quotes to display strings.'''
def double_quote_string(string):
ans = f"\"{string}\""
return ans
print(double_quote_string('This is working already')) | """10. Write a Python program to use double quotes to display strings."""
def double_quote_string(string):
ans = f'"{string}"'
return ans
print(double_quote_string('This is working already')) |
# URI Online Judge 1176
N = 62
n1 = 0
n2 = 1
string = '0 1'
for i in range(N-2):
new = n1 + n2
string += (' ') + str(new)
n1 = n2
n2 = new
fib = [int(item) for item in string.split()]
T = -1
while (T<0) or (T>60):
T = int(input())
for t in range(T):
entrada = int(input())... | n = 62
n1 = 0
n2 = 1
string = '0 1'
for i in range(N - 2):
new = n1 + n2
string += ' ' + str(new)
n1 = n2
n2 = new
fib = [int(item) for item in string.split()]
t = -1
while T < 0 or T > 60:
t = int(input())
for t in range(T):
entrada = int(input())
print('Fib({}) = {}'.format(entrada, fib[en... |
class Solution:
def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]:
res = ListNode(None)
output = res
while list1 and list2:
if list1.val <= list2.val:
output.next = list1
list1 = list1.next... | class Solution:
def merge_two_lists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]:
res = list_node(None)
output = res
while list1 and list2:
if list1.val <= list2.val:
output.next = list1
list1 = list1.next
... |
line = input().split('\\')
line_length = len(line) -1
splitted = line[line_length].split('.')
file_name = splitted[0]
ext = splitted[1]
print(f'File name: {file_name}')
print(f'File extension: {ext}')
| line = input().split('\\')
line_length = len(line) - 1
splitted = line[line_length].split('.')
file_name = splitted[0]
ext = splitted[1]
print(f'File name: {file_name}')
print(f'File extension: {ext}') |
#
# PySNMP MIB module Wellfleet-CCT-NAME-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-CCT-NAME-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:32:56 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')
(value_size_constraint, constraints_union, value_range_constraint, single_value_constraint, constraints_intersection) ... |
word_size = 9
num_words = 256
words_per_row = 4
local_array_size = 15
output_extended_config = True
output_datasheet_info = True
netlist_only = True
nominal_corner_only = True
| word_size = 9
num_words = 256
words_per_row = 4
local_array_size = 15
output_extended_config = True
output_datasheet_info = True
netlist_only = True
nominal_corner_only = True |
class Solution:
def twoSum(self, numbers: List[int], target: int) -> List[int]:
if len(numbers) <= 1:
return [None, None]
idx2 = len(numbers)-1
idx1 = 0
while idx1 < idx2:
if numbers[idx1] + numbers[idx2] == target:
return [id... | class Solution:
def two_sum(self, numbers: List[int], target: int) -> List[int]:
if len(numbers) <= 1:
return [None, None]
idx2 = len(numbers) - 1
idx1 = 0
while idx1 < idx2:
if numbers[idx1] + numbers[idx2] == target:
return [idx1 + 1, idx2 +... |
class SumUpException(Exception):
pass
class SumUpNoAccessCode(SumUpException):
pass
class SumUpAccessCodeExpired(SumUpException):
pass
| class Sumupexception(Exception):
pass
class Sumupnoaccesscode(SumUpException):
pass
class Sumupaccesscodeexpired(SumUpException):
pass |
# flake8: noqa
test_train_config = {"training_parameters": {"EPOCHS": 50}}
test_model_config = {"model_parameters": {"model_save_path": "modeloutput1"}}
test_test_data = {
"text": "what Homeowners Warranty Program means,what it applies to, what is its purpose?"
}
test_entities = [
{"text": "homeowners warra... | test_train_config = {'training_parameters': {'EPOCHS': 50}}
test_model_config = {'model_parameters': {'model_save_path': 'modeloutput1'}}
test_test_data = {'text': 'what Homeowners Warranty Program means,what it applies to, what is its purpose?'}
test_entities = [{'text': 'homeowners warranty program', 'entity': 'Fin_C... |
def entrance():
'''This is the initial room the player will begin their adventure.'''
pass
def orange_rm_1():
'''Todo:
red key(hidden in desk drawer)
health(desk top)
desk
rat (24% damage)
red door
'''
pass
def red_rm_2():
'''locked entrance- requires red key
to do:
... | def entrance():
"""This is the initial room the player will begin their adventure."""
pass
def orange_rm_1():
"""Todo:
red key(hidden in desk drawer)
health(desk top)
desk
rat (24% damage)
red door
"""
pass
def red_rm_2():
"""locked entrance- requires red key
to do:
... |
def main(request, response):
headers = [("Content-Type", "text/javascript")]
milk = request.cookies.first("milk", None)
if milk is None:
return headers, "var included = false;"
elif milk.value == "yes":
return headers, "var included = true;"
return headers, "var included = false;"
| def main(request, response):
headers = [('Content-Type', 'text/javascript')]
milk = request.cookies.first('milk', None)
if milk is None:
return (headers, 'var included = false;')
elif milk.value == 'yes':
return (headers, 'var included = true;')
return (headers, 'var included = false... |
CORRECT_PIN = "1234"
MAX_TRIES = 3
tries_left = MAX_TRIES
pin = input(f"Insert your pni ({tries_left} tries left): ")
while tries_left > 1 and pin != CORRECT_PIN:
tries_left -= 1
print("Your PIN is incorrect.")
pin = input(f"Insert your pni ({tries_left} tries left): ")
if pin == CORRECT_PIN:
print("... | correct_pin = '1234'
max_tries = 3
tries_left = MAX_TRIES
pin = input(f'Insert your pni ({tries_left} tries left): ')
while tries_left > 1 and pin != CORRECT_PIN:
tries_left -= 1
print('Your PIN is incorrect.')
pin = input(f'Insert your pni ({tries_left} tries left): ')
if pin == CORRECT_PIN:
print('You... |
#
# Solution to Project Euler problem 73
# Copyright (c) Project Nayuki. All rights reserved.
#
# https://www.nayuki.io/page/project-euler-solutions
# https://github.com/nayuki/Project-Euler-solutions
#
# The Stern-Brocot tree is an infinite binary search tree of all positive rational numbers,
# where each number ... | def compute():
ans = 0
stack = [(1, 3, 1, 2)]
while len(stack) > 0:
(leftn, leftd, rightn, rightd) = stack.pop()
d = leftd + rightd
if d <= 12000:
n = leftn + rightn
ans += 1
stack.append((n, d, rightn, rightd))
stack.append((leftn, lef... |
class BaseSiteCheckerException(Exception):
pass
class ErrorStopMsgLimit(BaseSiteCheckerException):
pass
| class Basesitecheckerexception(Exception):
pass
class Errorstopmsglimit(BaseSiteCheckerException):
pass |
def get_safe_balanced_split(target, train_ratio=0.8, get_test_indices=True, shuffle=False, seed=None):
classes, counts = np.unique(target, return_counts=True)
num_per_class = float(len(target))*float(train_ratio)/float(len(classes))
if num_per_class > np.min(counts):
print("Insufficient data to produce a bala... | def get_safe_balanced_split(target, train_ratio=0.8, get_test_indices=True, shuffle=False, seed=None):
(classes, counts) = np.unique(target, return_counts=True)
num_per_class = float(len(target)) * float(train_ratio) / float(len(classes))
if num_per_class > np.min(counts):
print('Insufficient data t... |
print("Welcome to the Multiplication/Exponent Table App")
print()
name = input("Hello, What is your name: ")
number = float(input("What number would you like to work with: "))
name = name.strip()
print("Multiplication Table For {}".format(number))
print()
print("\t\t1.0 * {} = {:.2f}".format(number, number*1.0))
print... | print('Welcome to the Multiplication/Exponent Table App')
print()
name = input('Hello, What is your name: ')
number = float(input('What number would you like to work with: '))
name = name.strip()
print('Multiplication Table For {}'.format(number))
print()
print('\t\t1.0 * {} = {:.2f}'.format(number, number * 1.0))
prin... |
# Live preview Markdown and reStructuredText files as HTML in a web browser.
#
# Author: Peter Odding <peter@peterodding.com>
# Last Change: April 12, 2018
# URL: https://github.com/xolox/python-preview-markup
__version__ = '0.3.3'
| __version__ = '0.3.3' |
#
# These methods are working on multiple processors
# that can be located remotely
#
class Bridges:
@staticmethod
def create(master=None, workers=None, name=None):
raise NotImplementedError
@staticmethod
def set(master=None, workers=None, name=None):
raise NotImplementedError
@s... | class Bridges:
@staticmethod
def create(master=None, workers=None, name=None):
raise NotImplementedError
@staticmethod
def set(master=None, workers=None, name=None):
raise NotImplementedError
@staticmethod
def list(hosts=None):
raise NotImplementedError
@staticmet... |
for index in range(1,101):
# if index % 15 == 0:
# print("fifteen")
if index % 3 == 0 and index % 5 == 0 :
print("fifteen")
elif index % 3 == 0:
print("three")
elif index % 5 == 0:
print("five")
else:
print(index)
| for index in range(1, 101):
if index % 3 == 0 and index % 5 == 0:
print('fifteen')
elif index % 3 == 0:
print('three')
elif index % 5 == 0:
print('five')
else:
print(index) |
class Solution:
def rob(self, nums):
if not nums:
return 0
values = [0] * len(nums)
for i in range(len(nums)):
if i == 0:
values[i] = max(values[i], nums[i])
elif i == 1:
values[i] = max(values[i-1], nums[i])
els... | class Solution:
def rob(self, nums):
if not nums:
return 0
values = [0] * len(nums)
for i in range(len(nums)):
if i == 0:
values[i] = max(values[i], nums[i])
elif i == 1:
values[i] = max(values[i - 1], nums[i])
... |
MASTER_PROCESS_RANK = 0 # Only meaningful if webscraper is run with multiple processes. Here we use rank = 0 for master process; however we can set it to any value in [0, nprocs-1].
READING_RATIO_FOR_INPUT_CSVs = 1 # It represents how much of the input files (in csv format for now) we should process.... | master_process_rank = 0
reading_ratio_for_input_cs_vs = 1
number_of_repeats_timeit = 1
create_word_cloud = True
create_bag_of_words = True
create_sentiment_analysis_results = True |
#
# @lc app=leetcode.cn id=1689 lang=python3
#
# [1689] detect-pattern-of-length-m-repeated-k-or-more-times
#
None
# @lc code=end | None |
print("Raadsel 1:",
"\n Wanneer leefde de oudste persoon ter wereld?")
guess = input() #"TUSSEN GEBOORTE en dood" # input ()
guess_words = []
for g in guess.split():
guess_words.append(g.lower())
answer_words = ["tussen", "geboorte", "dood"]
incorrect = False
for word in answer_words:
if word not in ... | print('Raadsel 1:', '\n Wanneer leefde de oudste persoon ter wereld?')
guess = input()
guess_words = []
for g in guess.split():
guess_words.append(g.lower())
answer_words = ['tussen', 'geboorte', 'dood']
incorrect = False
for word in answer_words:
if word not in guess_words:
incorrect = True
if incorrec... |
# Problem code
def countAndSay(n):
if n == 1:
return "1"
current = "1"
for i in range(2, n + 1):
current = helper(current)
return current
def helper(current):
group_count = 1
group_member = current[0]
result = ""
for i in range(1, len(current)):
if current[i] =... | def count_and_say(n):
if n == 1:
return '1'
current = '1'
for i in range(2, n + 1):
current = helper(current)
return current
def helper(current):
group_count = 1
group_member = current[0]
result = ''
for i in range(1, len(current)):
if current[i] == group_member:... |
# A classroom consists of N students, whose friendships can be represented in
# an adjacency list. For example, the following descibes a situation where 0
# is friends with 1 and 2, 3 is friends with 6, and so on.
# {0: [1, 2],
# 1: [0, 5],
# 2: [0],
# 3: [6],
# 4: [],
# 5: [1],
# 6: [3]}
# Each stu... | def friend_group(adjacency):
groups = []
mapping = {}
for i in adjacency:
if i in mapping:
continue
for adj in adjacency[i]:
if adj in mapping:
groups[mapping[adj]].add(i)
mapping[i] = mapping[adj]
if i not in mapping:
... |
class Solution(object):
def longestCommonSubsequence(self, text1, text2):
if not text1 or not text2:
return 0
m = len(text1)
n = len(text2)
dp = [[0]*(n+1) for _ in range(m+1)]
for i in range(1,m+1):
for j in range(1,n+1):
if text1[i-1]... | class Solution(object):
def longest_common_subsequence(self, text1, text2):
if not text1 or not text2:
return 0
m = len(text1)
n = len(text2)
dp = [[0] * (n + 1) for _ in range(m + 1)]
for i in range(1, m + 1):
for j in range(1, n + 1):
... |
class Printer(object):
def __init__(self, sort_keys=None, order=None, header=None):
self.sort_keys = sort_keys
self.order = order
self.header = header
def print(self, d, format='table'):
print(self.value(d,format=format))
def value(self, d, format='table'):
return ... | class Printer(object):
def __init__(self, sort_keys=None, order=None, header=None):
self.sort_keys = sort_keys
self.order = order
self.header = header
def print(self, d, format='table'):
print(self.value(d, format=format))
def value(self, d, format='table'):
return... |
# Copyright 2020 BlueCat Networks. All rights reserved.
# -*- coding: utf-8 -*-
type = 'api'
sub_pages = [
{
'name' : 'user_inventory_page',
'title' : u'user_inventory',
'endpoint' : 'user_inventory/user_inventory_endpoint',
'description' : u'user_inventory'
},
]... | type = 'api'
sub_pages = [{'name': 'user_inventory_page', 'title': u'user_inventory', 'endpoint': 'user_inventory/user_inventory_endpoint', 'description': u'user_inventory'}] |
__all__ = ("Values", )
class Data(object):
def __init__(
self,
plugin_instance=None,
meta=None,
plugin=None,
host=None,
type=None,
type_instance=None,
interval=None,
time=None,
values=None,
... | __all__ = ('Values',)
class Data(object):
def __init__(self, plugin_instance=None, meta=None, plugin=None, host=None, type=None, type_instance=None, interval=None, time=None, values=None):
self.plugin = plugin
self.plugin_instance = (plugin_instance,)
self.meta = meta
self.host = h... |
age = 6
if age < 1:
print("baby")
elif age < 3:
print("toddler")
elif age < 5:
print("preschool")
elif age < 12:
print("gradeschooler")
elif age < 19:
print("teen")
elif age > 20:
print("old")
else:
print("integer error") | age = 6
if age < 1:
print('baby')
elif age < 3:
print('toddler')
elif age < 5:
print('preschool')
elif age < 12:
print('gradeschooler')
elif age < 19:
print('teen')
elif age > 20:
print('old')
else:
print('integer error') |
def main():
# input
H, W = map(int, input().split())
sss = [input() for _ in range(H)]
# compute
cnt = 0
for h in range(1,H-1):
for w in range(1,W-1):
if sss[h][w]=='#' and sss[h-1][w]!='#' and sss[h+1][w]!='#' and sss[h][w-1]!='#' and sss[h][w+1]!='#':
cnt +... | def main():
(h, w) = map(int, input().split())
sss = [input() for _ in range(H)]
cnt = 0
for h in range(1, H - 1):
for w in range(1, W - 1):
if sss[h][w] == '#' and sss[h - 1][w] != '#' and (sss[h + 1][w] != '#') and (sss[h][w - 1] != '#') and (sss[h][w + 1] != '#'):
... |
class Solution:
def getModifiedArray(self, length: int, updates: List[List[int]]) -> List[int]:
arr = [0] * (length + 1)
for s, e, i in updates:
arr[s] += i
arr[e+1] -= i
for i in range(1, length):
arr[i] += arr[i-1]
return arr[:-1]
| class Solution:
def get_modified_array(self, length: int, updates: List[List[int]]) -> List[int]:
arr = [0] * (length + 1)
for (s, e, i) in updates:
arr[s] += i
arr[e + 1] -= i
for i in range(1, length):
arr[i] += arr[i - 1]
return arr[:-1] |
nerdle_len = 8
nerd_num_list = [str(x) for x in range(nerdle_len+2)]
nerd_op_list = ['+','-','*','/','==']
nerd_list = nerd_num_list+nerd_op_list | nerdle_len = 8
nerd_num_list = [str(x) for x in range(nerdle_len + 2)]
nerd_op_list = ['+', '-', '*', '/', '==']
nerd_list = nerd_num_list + nerd_op_list |
'''
As is can shift max '1111' -> 15 on one command...
So a call like shift(20) would need to be split up...
Thinking the user should do this when coding... or
could be stdlib fx that does this...
If want to do shift(16) in one cycle, can add s4 support
(and correspoinding 16muxes) to hardware... revisit as ... | """
As is can shift max '1111' -> 15 on one command...
So a call like shift(20) would need to be split up...
Thinking the user should do this when coding... or
could be stdlib fx that does this...
If want to do shift(16) in one cycle, can add s4 support
(and correspoinding 16muxes) to hardware... revisit as ... |
# coding: utf-8
SECRET_KEY = 'foo'
EMAIL_BACKEND = 'postmarker.django.EmailBackend'
POSTMARK = {
'TOKEN': '<YOUR POSTMARK SERVER TOKEN>'
}
| secret_key = 'foo'
email_backend = 'postmarker.django.EmailBackend'
postmark = {'TOKEN': '<YOUR POSTMARK SERVER TOKEN>'} |
def is_prime(num, primes):
for prime in primes:
if prime == num:
return True
if not num % prime:
return False
return True
def get_primes(num):
limit = (num // 2) + 1
candidates = list()
primes = list()
for i in range(2, limit):
if is_prime(i, pr... | def is_prime(num, primes):
for prime in primes:
if prime == num:
return True
if not num % prime:
return False
return True
def get_primes(num):
limit = num // 2 + 1
candidates = list()
primes = list()
for i in range(2, limit):
if is_prime(i, primes... |
#program to remove two duplicate numbers from a given number of list.
def two_unique_nums(nums):
return [i for i in nums if nums.count(i)==1]
print(two_unique_nums([1,2,3,2,3,4,5]))
print(two_unique_nums([1,2,3,2,4,5]))
print(two_unique_nums([1,2,3,4,5])) | def two_unique_nums(nums):
return [i for i in nums if nums.count(i) == 1]
print(two_unique_nums([1, 2, 3, 2, 3, 4, 5]))
print(two_unique_nums([1, 2, 3, 2, 4, 5]))
print(two_unique_nums([1, 2, 3, 4, 5])) |
types = [
{
'name': 'RNAExpression',
'item_type': 'rna-expression',
'schema': {
'title': 'RNAExpression',
'description': 'Schema for RNA-seq expression',
'properties': {
'uuid': {
'title': 'UUID',
... | types = [{'name': 'RNAExpression', 'item_type': 'rna-expression', 'schema': {'title': 'RNAExpression', 'description': 'Schema for RNA-seq expression', 'properties': {'uuid': {'title': 'UUID'}, 'expression': {'type': 'object', 'properties': {'gene_id': {'title': 'Gene ID', 'type': 'string'}, 'transcript_ids': {'title': ... |
def square(x):
return x * x
def launch_missiles():
print('missiles launched')
def even_or_odd(n):
if n % 2 == 0:
print('even')
return
print('odd')
| def square(x):
return x * x
def launch_missiles():
print('missiles launched')
def even_or_odd(n):
if n % 2 == 0:
print('even')
return
print('odd') |
n = 1
for i in range(1, 10 + 1):
print(n)
n *= i
| n = 1
for i in range(1, 10 + 1):
print(n)
n *= i |
#!/usr/bin/env python
# coding: utf-8
# # Hill Cipher
# Below is the code to implement the Hill Cipher, which is an example of a **polyalphabetic cryptosystem**, that is, it does
# not assign a single ciphertext letter to a single plaintext letter, but rather a ciphertext letter may represent more than
# one plaint... | def digitize(string):
cipher_text = []
holder = []
for i in string:
if i == 'A' or i == 'a':
holder.append(0)
if i == 'B' or i == 'b':
holder.append(1)
if i == 'C' or i == 'c':
holder.append(2)
if i == 'D' or i == 'd':
holder.ap... |
file = open('Advent-of-Code-2021\\Day 13\\Day 13 input.txt')
points = []
folds = []
for line in file:
line = line.strip()
if (line.find(',') != -1):
pointparse = line.split(',')
points.append([int(pointparse[0]),int(pointparse[1])])
elif (line.find('=') != -1):
foldparse = line.sp... | file = open('Advent-of-Code-2021\\Day 13\\Day 13 input.txt')
points = []
folds = []
for line in file:
line = line.strip()
if line.find(',') != -1:
pointparse = line.split(',')
points.append([int(pointparse[0]), int(pointparse[1])])
elif line.find('=') != -1:
foldparse = line.split('=... |
dummy1_iface_cfg = {
'INTERFACE': {
'MODULE': 'daq.interface.interface',
'CLASS': 'DummyInterface',
},
'IFCONFIG': {
'LABEL': 'Dummy1',
'ADDRESS': 'DummyAddress',
'SerialNumber': '1234',
}
}
dummycpc_inst_cfg = {
'INSTRUMENT': {
'MODULE': 'daq.instrum... | dummy1_iface_cfg = {'INTERFACE': {'MODULE': 'daq.interface.interface', 'CLASS': 'DummyInterface'}, 'IFCONFIG': {'LABEL': 'Dummy1', 'ADDRESS': 'DummyAddress', 'SerialNumber': '1234'}}
dummycpc_inst_cfg = {'INSTRUMENT': {'MODULE': 'daq.instrument.instrument', 'CLASS': 'DummyInstrument'}, 'INSTCONFIG': {'DESCRIPTION': {'L... |
print(dir(str))
nome = 'Flavio'
print(nome)
print(nome[:3])
texto = 'marca d\' agua'
print(texto)
texto = "marca d' agua"
print(texto)
texto = ''' texto
... texto
'''
print(texto)
texto = ' texto\n\t ...texto'
print(texto)
print(str.__add__('a', 'b'))
nome = 'Flavio Garcia Fernandes'
print(nome)... | print(dir(str))
nome = 'Flavio'
print(nome)
print(nome[:3])
texto = "marca d' agua"
print(texto)
texto = "marca d' agua"
print(texto)
texto = ' texto\n ... texto\n'
print(texto)
texto = ' texto\n\t ...texto'
print(texto)
print(str.__add__('a', 'b'))
nome = 'Flavio Garcia Fernandes'
print(nome)
print(nome[-9:])
print(n... |
with open('in') as f:
data = list(map(lambda l: list(l.strip().replace(' ', '')), f.readlines()))
def evaluate(e):
value = None
operation = None
i = 0
while i < len(e):
c = e[i]
if c in '+*':
operation = c
elif c in '0123456789':
c = int(c)
... | with open('in') as f:
data = list(map(lambda l: list(l.strip().replace(' ', '')), f.readlines()))
def evaluate(e):
value = None
operation = None
i = 0
while i < len(e):
c = e[i]
if c in '+*':
operation = c
elif c in '0123456789':
c = int(c)
... |
# just keep this as-is
def not_an_activity():
print("boom")
| def not_an_activity():
print('boom') |
label_data = open("label", encoding='utf-8').readlines()
label_data = [x.strip() for x in label_data]
print(len(label_data))
label_kinds = set(label_data)
print(label_kinds) | label_data = open('label', encoding='utf-8').readlines()
label_data = [x.strip() for x in label_data]
print(len(label_data))
label_kinds = set(label_data)
print(label_kinds) |
def tupler(atuple):
print(f"{atuple=}")
return (1, 2, 3)
print(f"{type(tupler((10, 11)))=}")
| def tupler(atuple):
print(f'atuple={atuple!r}')
return (1, 2, 3)
print(f'type(tupler((10, 11)))={type(tupler((10, 11)))!r}') |
n1 = int (input())
s1 = set(map(int,input().split()))
n2 = int (input())
s2 = set(map(int,input().split()))
print(len(s1.intersection(s2)))
| n1 = int(input())
s1 = set(map(int, input().split()))
n2 = int(input())
s2 = set(map(int, input().split()))
print(len(s1.intersection(s2))) |
raio = int(input())
pi = 3.14159
volume = float(4.0 * pi * (raio* raio * raio) / 3)
print("VOLUME = %0.3f" %volume)
| raio = int(input())
pi = 3.14159
volume = float(4.0 * pi * (raio * raio * raio) / 3)
print('VOLUME = %0.3f' % volume) |
#!/usr/bin/env python
# encoding: utf-8
GRADES_FILENAME = 'grades.csv'
GRADING_SLASH_DELIMINATOR = '/'
SUBMISSIONS_FILENAME = 'Submissions'
GRADING_URL_EXTENSION = '&action=grading'
SUBMISSION_LISTING_DELIMINATOR = '-_submission_-'
GRADING_BLANK_GRADE = '-'
GRADING_HEADER_NAME = 'Name'
GRADING_HEADER_EMAIL = 'Email'
... | grades_filename = 'grades.csv'
grading_slash_deliminator = '/'
submissions_filename = 'Submissions'
grading_url_extension = '&action=grading'
submission_listing_deliminator = '-_submission_-'
grading_blank_grade = '-'
grading_header_name = 'Name'
grading_header_email = 'Email'
grading_header_grade = 'Grade' |
# IP and port to bind to.
bind = ['127.0.0.1:4000']
# Maximum number of pending connections.
backlog = 2048
# Number of worker processes to handle connections.
workers = 2
# Fork main process to background.
daemon = True
# PID file to write to.
pidfile = "web.gunicorn.pid"
# Allow connections from any frontend pro... | bind = ['127.0.0.1:4000']
backlog = 2048
workers = 2
daemon = True
pidfile = 'web.gunicorn.pid'
accesslog = 'web.gunicorn.access.log'
errorlog = 'web.gunicorn.error.log'
loglevel = 'warning'
proc_name = 'rouly.net-gunicorn' |
i = 0
while(True):
if i+1<5:
i = i + 1
continue
print(i+1, end=" ")
if(i==50):
break #stop the loop
i = i+ 1 | i = 0
while True:
if i + 1 < 5:
i = i + 1
continue
print(i + 1, end=' ')
if i == 50:
break
i = i + 1 |
#https://leetcode.com/problems/min-stack/
class MinStack(object):
def __init__(self):
self.stack = []
def push(self, x):
self.stack.append((x, min(x, self.getMin())))
def pop(self):
if len(self.stack)==0: return None
return self.stack.pop()[0]
... | class Minstack(object):
def __init__(self):
self.stack = []
def push(self, x):
self.stack.append((x, min(x, self.getMin())))
def pop(self):
if len(self.stack) == 0:
return None
return self.stack.pop()[0]
def top(self):
if len(self.stack) == 0:
... |
def insert_newlines(string, every=64):
return '\n'.join(string[i:i+every] for i in range(0, len(string), every))
for __ in range(int(input())):
n = int(input())
o = "O"
x = "X"
a = ["X" for i in range(64)]
for i in range(n):
a[i] = "."
a[0]=o
print(insert_newlines("".join(a),8))... | def insert_newlines(string, every=64):
return '\n'.join((string[i:i + every] for i in range(0, len(string), every)))
for __ in range(int(input())):
n = int(input())
o = 'O'
x = 'X'
a = ['X' for i in range(64)]
for i in range(n):
a[i] = '.'
a[0] = o
print(insert_newlines(''.join(a... |
## Set Configs
print('Set configs..')
sns.set()
pd.options.display.max_columns = None
RANDOM_SEED = 42
fig_path = os.path.join(os.getcwd(), 'figs')
model_path = os.path.join(os.getcwd(), 'models')
model_bib_path = os.path.join(model_path,'model_bib')
data_path = os.path.join(os.getcwd(), 'data')
## read the data
pri... | print('Set configs..')
sns.set()
pd.options.display.max_columns = None
random_seed = 42
fig_path = os.path.join(os.getcwd(), 'figs')
model_path = os.path.join(os.getcwd(), 'models')
model_bib_path = os.path.join(model_path, 'model_bib')
data_path = os.path.join(os.getcwd(), 'data')
print('Read the data..')
data_fn = os... |
a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
# dumb way
# for i in range(0,len(a),1):
# if a[i]%2 == 0:
# print(str(a[i]),end=" ")
b = [i for i in a if i % 2 == 0]
print(b)
| a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
b = [i for i in a if i % 2 == 0]
print(b) |
'''
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
For example, 2 is written as II in Roman numeral, just two one's added together. 12 is writte... | """
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
For example, 2 is written as II in Roman numeral, just two one's added together. 12 is writte... |
# https://www.codewars.com/kata/55a243393fb3e87021000198/train/python
# My solution
def remember(text):
counter = {}
result = []
for ch in text:
counter[ch] = counter.get(ch, 0) + 1
if counter[ch] == 2:
result.append(ch)
return result
# ...
def remember(str_):
... | def remember(text):
counter = {}
result = []
for ch in text:
counter[ch] = counter.get(ch, 0) + 1
if counter[ch] == 2:
result.append(ch)
return result
def remember(str_):
seen = set()
res = []
for i in str_:
res.append(i) if i in seen and i not in res els... |
directory_map = {
"abilene": "directed-abilene-zhang-5min-over-6months-ALL",
"geant": "directed-geant-uhlig-15min-over-4months-ALL",
"germany50": "directed-germany50-DFN-aggregated-1day-over-1month",
}
| directory_map = {'abilene': 'directed-abilene-zhang-5min-over-6months-ALL', 'geant': 'directed-geant-uhlig-15min-over-4months-ALL', 'germany50': 'directed-germany50-DFN-aggregated-1day-over-1month'} |
class Math1():
def __init__(self):
self.my_num1 = 10
self.my_num2 = 20
def addition(self):
return self.my_num1 + self.my_num2
def subtraction(self):
return self.my_num1 - self.my_num2
class Math_Plus(Math1):
def __init__(self, my_num1=40, my_num2=90):
self... | class Math1:
def __init__(self):
self.my_num1 = 10
self.my_num2 = 20
def addition(self):
return self.my_num1 + self.my_num2
def subtraction(self):
return self.my_num1 - self.my_num2
class Math_Plus(Math1):
def __init__(self, my_num1=40, my_num2=90):
self.my_n... |
# single source of truth for package version,
# see https://packaging.python.org/en/latest/single_source_version/
__version__ = "0.6.0"
# app name to send as part of SDK requests
app_name = "DLHub CLI v{}".format(__version__)
| __version__ = '0.6.0'
app_name = 'DLHub CLI v{}'.format(__version__) |
# coding: utf8
# try something like
def index(): return plugin_flatpage()
def rfp(): return plugin_flatpage()
| def index():
return plugin_flatpage()
def rfp():
return plugin_flatpage() |
'''
PyTorch implementation of the RetinaNet object detector:
Lin, Tsung-Yi, et al. "Focal loss for dense object detection." Proceedings of the IEEE international conference on computer vision. 2017.
Basic implementation forked and adapted from: https://github.com/kuangliu/pytorch-retinanet
2019 Be... | """
PyTorch implementation of the RetinaNet object detector:
Lin, Tsung-Yi, et al. "Focal loss for dense object detection." Proceedings of the IEEE international conference on computer vision. 2017.
Basic implementation forked and adapted from: https://github.com/kuangliu/pytorch-retinanet
2019 Be... |
#import gui.gui as gui
# Python3 program to find number
# of bins required using
# First Fit algorithm.
# Returns number of bins required
# using first fit
# online algorithm
def firstFit(weight, n, c):
# Initialize result (Count of bins)
res = 0
# Create an array to store
# remaining space in bins
# there... | def first_fit(weight, n, c):
res = 0
bin_rem = [0] * n
for i in range(n):
j = 0
min = c + 1
bi = 0
for j in range(res):
if bin_rem[j] >= weight[i] and bin_rem[j] - weight[i] < min:
bi = j
min = bin_rem[j] - weight[i]
if min ... |
# mapping for AWS IAM user_name to slack ID accross all AWS accounts
#
# Fill in "<aws_IAM_user_id>:<slack_id>" here. Seperate each entry by a comma, and leave the last one without a comma
# Example:
# mapping = {
# "IAM_user_id1":"slack_id1",
# "IAM_user_id2":"slack_id2",
# "IAM_user_id3":"slack_id... | mapping = {'IAM_user_id1': 'slack_id1', 'IAM_user_id2': 'slack_id2', 'IAM_user_id3': 'slack_id3'} |
# Bot's version number
__version__ = "0.1.0"
# Authorized guild
GUILD_ID = 952941520867196958 | __version__ = '0.1.0'
guild_id = 952941520867196958 |
#Rep of loops
numbers = [2, 3, 4, 45]
l = len(numbers)
for i in range(l):
print(numbers[i]) # each iteration the i takes on a different
#value according to len of numbers (4)
for i in range(8):
print(i) # prints numbers 0 through 7
for el in numbers:
print(el)
# using a loop to change elements within ... | numbers = [2, 3, 4, 45]
l = len(numbers)
for i in range(l):
print(numbers[i])
for i in range(8):
print(i)
for el in numbers:
print(el)
items = ['yellow', 'red', 'green', 'purple', 'blue']
for i in range(5):
print('Before item ', i, 'is', items[i])
items[i] = 'different'
print('After item ', i, '... |
def append_text(new_text):
'''
Write the code instruction to be exported later on
Args.
new_text (str): the text that will be appended to the base string
'''
global code_base_text
code_base_text = code_base_text + new_text | def append_text(new_text):
"""
Write the code instruction to be exported later on
Args.
new_text (str): the text that will be appended to the base string
"""
global code_base_text
code_base_text = code_base_text + new_text |
n=int(input ('veverite'))
if n %2==0: print ('par')
else: print ('impar')
print('par' if n%2==0 else 'impar')
| n = int(input('veverite'))
if n % 2 == 0:
print('par')
else:
print('impar')
print('par' if n % 2 == 0 else 'impar') |
# pylint: disable=missing-class-docstring, disable=missing-function-docstring, missing-module-docstring/
#$ header class Point(public)
#$ header method __init__(Point, double, double)
#$ header method __del__(Point)
#$ header method translate(Point, double, double)
class Point(object):
def __init__(self, x, y):
... | class Point(object):
def __init__(self, x, y):
self.x = x
self.y = y
def __del__(self):
pass
def translate(self, a, b):
self.x = self.x + a
self.y = self.y + b
if __name__ == '__main__':
p = point(0.0, 0.0)
x = p.x
p.x = x
a = p.x
a = p.x - 2
... |
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftPLUSMINUSleftTIMESDIVIDEleftPOWERrightUMINUSCOMMA DATA DEF DIM DIVIDE END EQUALS FLOAT FOR GE GOSUB GOTO GT ID IF INTEGER LE LET LIST LPAREN LT MINUS NE NEW NEWLINE... | _tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftPLUSMINUSleftTIMESDIVIDEleftPOWERrightUMINUSCOMMA DATA DEF DIM DIVIDE END EQUALS FLOAT FOR GE GOSUB GOTO GT ID IF INTEGER LE LET LIST LPAREN LT MINUS NE NEW NEWLINE NEXT PLUS POWER PRINT READ REM RETURN RPAREN RUN SEMI STEP STOP STRING THEN TIMES TOprogram :... |
#-*- coding: utf8 -*-
class P3PMiddleware(object):
def process_response(self, request, response):
response['P3P'] = 'CP="CAO PSA OUR"'
return response
| class P3Pmiddleware(object):
def process_response(self, request, response):
response['P3P'] = 'CP="CAO PSA OUR"'
return response |
# Copyright 2018 Databricks, Inc.
VERSION = '0.7.0.dev'
| version = '0.7.0.dev' |
#!/usr/bin/env python
'''
This script prints Hello World!
'''
print('Hello, World!')
| """
This script prints Hello World!
"""
print('Hello, World!') |
__all__ = ["InvalidECFGFormatException"]
class InvalidECFGFormatException(Exception):
pass
| __all__ = ['InvalidECFGFormatException']
class Invalidecfgformatexception(Exception):
pass |
r=int(input('banyaknya angka:'))
data=[]
for i in range (r): #v
n=int(input("Enter Integer {}:".format(i+1))) #v
data.append(n) #v
m=10**(r-1)
for i in range (r):
y=int(data[i]*m)
print(y)
m=m/10
#print(r);
| r = int(input('banyaknya angka:'))
data = []
for i in range(r):
n = int(input('Enter Integer {}:'.format(i + 1)))
data.append(n)
m = 10 ** (r - 1)
for i in range(r):
y = int(data[i] * m)
print(y)
m = m / 10 |
def define_display_nodes(tree,nodemap,unscoped_vectors=False,looped_definition=False):
if unscoped_vectors:
s = ''
else:
s = '\t\t\tstd::vector<MPILib::NodeId> display_nodes;\n'
display_nodes = tree.findall('.//Display')
for dn in display_nodes:
node_id = str(nodemap[dn.attrib[... | def define_display_nodes(tree, nodemap, unscoped_vectors=False, looped_definition=False):
if unscoped_vectors:
s = ''
else:
s = '\t\t\tstd::vector<MPILib::NodeId> display_nodes;\n'
display_nodes = tree.findall('.//Display')
for dn in display_nodes:
node_id = str(nodemap[dn.attrib... |
def factorial(n):
if n==0:
return 1
else:
return factorial(n-1)*n
print(factorial(80))
| def factorial(n):
if n == 0:
return 1
else:
return factorial(n - 1) * n
print(factorial(80)) |
#Make sure that we handle keyword-only arguments correctly
def f(a, *varargs, kw1, kw2="has-default"):
pass
#OK
f(1, 2, 3, kw1=1)
f(1, 2, kw1=1, kw2=2)
#Not OK
f(1, 2, 3, kw1=1, kw3=3)
f(1, 2, 3, kw3=3)
#ODASA-5897
def analyze_member_access(msg, *, original, override, chk: 'default' = None):
pass
def ok(... | def f(a, *varargs, kw1, kw2='has-default'):
pass
f(1, 2, 3, kw1=1)
f(1, 2, kw1=1, kw2=2)
f(1, 2, 3, kw1=1, kw3=3)
f(1, 2, 3, kw3=3)
def analyze_member_access(msg, *, original, override, chk: 'default'=None):
pass
def ok():
return analyze_member_access(msg, original=original, chk=chk)
def bad():
retur... |
class Parser():
def __init__(self, config):
self._config_args = config
@property
def experiment_args(self):
return self._config_args["Experiment"]
@property
def train_dataset_args(self):
return self._config_args["Dataset - metatrain"]
@property
def valid_dataset_ar... | class Parser:
def __init__(self, config):
self._config_args = config
@property
def experiment_args(self):
return self._config_args['Experiment']
@property
def train_dataset_args(self):
return self._config_args['Dataset - metatrain']
@property
def valid_dataset_arg... |
class X:
def __init__(self,x):
print("Inside X ", x)
class Y:
def __init__(self):
print("Inside Y")
class Z(X,Y):
def __init__(self):
super().__init__(10)
print("Inside Z")
obj = Z()
| class X:
def __init__(self, x):
print('Inside X ', x)
class Y:
def __init__(self):
print('Inside Y')
class Z(X, Y):
def __init__(self):
super().__init__(10)
print('Inside Z')
obj = z() |
# -*- coding: utf-8 -*-
valor = float(input())
if 0 < valor <= 25:
print('Intervalo [0, 25]')
elif 25 < valor <= 50:
print('Intervalo (25, 50]')
elif 50 < valor <= 75:
print('Intervalo (50, 75]')
elif 75 < valor <= 100:
print('Intervalo (75, 100]')
else:
print('Fora de intervalo')
| valor = float(input())
if 0 < valor <= 25:
print('Intervalo [0, 25]')
elif 25 < valor <= 50:
print('Intervalo (25, 50]')
elif 50 < valor <= 75:
print('Intervalo (50, 75]')
elif 75 < valor <= 100:
print('Intervalo (75, 100]')
else:
print('Fora de intervalo') |
# Aula 13 - Desafio 47: Contagem de numeros pares
# Mostrar na tela todos os numeros pares entre 1 e 50
print('Entre 1 e 50, sao numeros pares:')
for n in range(2, 51, 2):
print(n, end=' ')
| print('Entre 1 e 50, sao numeros pares:')
for n in range(2, 51, 2):
print(n, end=' ') |
word1=input()
word2=input()
dict={}
alphabet="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
for char in alphabet:
dict[char]=0
for ch in word1:
dict[ch]+=1
for ch in word2:
dict[ch]-=1
flag=False
sum=0
for char in dict:
count=dict[char]
sum+=count
if count == 1:
flag=True
... | word1 = input()
word2 = input()
dict = {}
alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
for char in alphabet:
dict[char] = 0
for ch in word1:
dict[ch] += 1
for ch in word2:
dict[ch] -= 1
flag = False
sum = 0
for char in dict:
count = dict[char]
sum += count
if count == 1:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Source code meta data
__author__ = 'Dalwar Hossain'
__email__ = 'dalwar.hossain@protonmail.com'
| __author__ = 'Dalwar Hossain'
__email__ = 'dalwar.hossain@protonmail.com' |
tm20 = toi = h = 0
print('-' * 25)
print(' CADASTRANDO PESSOAS ')
print('-' * 25)
while True:
id = int(input('digite a idade '))
sex = ' '
while sex not in 'MF':
sex = str(input('digite o sexo')).upper()
if id >= 18:
toi += 1
if sex == 'M':
h += 1
if sex == 'f' and id <... | tm20 = toi = h = 0
print('-' * 25)
print(' CADASTRANDO PESSOAS ')
print('-' * 25)
while True:
id = int(input('digite a idade '))
sex = ' '
while sex not in 'MF':
sex = str(input('digite o sexo')).upper()
if id >= 18:
toi += 1
if sex == 'M':
h += 1
if sex == 'f' and id < ... |
# De uitwerking van 4-autoencoder.py moet hiervoor gedraaid worden!
voorspeller = tf.keras.models.Sequential([
tf.keras.layers.Dense(200, activation=tf.nn.relu),
tf.keras.layers.Dense(50, activation=tf.nn.relu),
tf.keras.layers.Dense(50, activation=tf.nn.relu),
tf.keras.layers.Dense(10, activation=tf.nn.softma... | voorspeller = tf.keras.models.Sequential([tf.keras.layers.Dense(200, activation=tf.nn.relu), tf.keras.layers.Dense(50, activation=tf.nn.relu), tf.keras.layers.Dense(50, activation=tf.nn.relu), tf.keras.layers.Dense(10, activation=tf.nn.softmax)])
voorspeller.compile(optimizer='adam', loss='sparse_categorical_crossentro... |
# model settings
model = dict(
type='ImageClassifier',
pretrained=None,
backbone=dict(
type='OmzBackboneCls',
mode='train',
model_path='public/mobilenet-v2/FP32/mobilenet-v2.xml',
last_layer_name='relu6_4',
normalized_img_input=True
),
neck=dict(
type=... | model = dict(type='ImageClassifier', pretrained=None, backbone=dict(type='OmzBackboneCls', mode='train', model_path='public/mobilenet-v2/FP32/mobilenet-v2.xml', last_layer_name='relu6_4', normalized_img_input=True), neck=dict(type='GlobalAveragePooling'), head=dict(type='LinearClsHead', num_classes=1000, in_channels=12... |
class Environment(object):
def __init__(self):
pass
def act(self, state, action):
pass
def end_state(self, state):
return True
def reset(self):
pass
def available_actions(self):
return None
| class Environment(object):
def __init__(self):
pass
def act(self, state, action):
pass
def end_state(self, state):
return True
def reset(self):
pass
def available_actions(self):
return None |
# Question(#1143): Given two strings text1 and text2, return the length of their longest common subsequence.
# Solution: Use the longest common susequence dynamic programming algorithm
def longestCommonSubsequence(text1: str, text2: str) -> int:
grid = [[0 for _ in range(len(text2)+1)] for _ in range(len(text1)+1)... | def longest_common_subsequence(text1: str, text2: str) -> int:
grid = [[0 for _ in range(len(text2) + 1)] for _ in range(len(text1) + 1)]
for i in range(1, len(text1) + 1):
for j in range(1, len(text2) + 1):
if text1[i - 1] == text2[j - 1]:
grid[i][j] = 1 + grid[i - 1][j - 1]... |
print("Let's do Factorial") #printing the operation what we are performing
def factorial(number): #defining the factorial method
result = 1 # result is intially defined with 1. if we define initially with ... | print("Let's do Factorial")
def factorial(number):
result = 1
if number == 0:
print('The factorial of 0 is 1')
elif number < 0:
print('Error..Enter only whole numbers')
else:
for i in range(1, number + 1):
result = result * i
print('The Factorial of', number,... |
#!/usr/bin/env python
include = "$chrs".replace("[", "").replace("]", "").replace(" ", "").split(",")
ref = "$reference"
with open(ref) as ifh, open("include.bed", "w") as ofh:
for line in ifh:
toks = line.strip().split("\\t")
if toks[0] in include:
print(toks[0], 0, toks[1], sep="\\t"... | include = '$chrs'.replace('[', '').replace(']', '').replace(' ', '').split(',')
ref = '$reference'
with open(ref) as ifh, open('include.bed', 'w') as ofh:
for line in ifh:
toks = line.strip().split('\\t')
if toks[0] in include:
print(toks[0], 0, toks[1], sep='\\t', file=ofh) |
# Modify the program to show the numbers from 50 to 100
x=50
while x<=100:
print(x)
x=x+1 | x = 50
while x <= 100:
print(x)
x = x + 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.