content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# Copyright 2018 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | """Rules for generating Protos from FHIR definitions"""
stu3_package_dep = '@com_google_fhir//spec:fhir_stu3'
r4_package_dep = '@com_google_fhir//spec:fhir_r4'
proto_generator = '@com_google_fhir//java/com/google/fhir/protogen:ProtoGenerator'
profile_generator = '@com_google_fhir//java/com/google/fhir/protogen:ProfileG... |
def add_matrix():
if r1==r2 and c1==c2:
print("Addition Matrix of Given matrices is:")
for i in range(r1):
for j in range(c1):
print(m1[i][j]+m2[i][j], end=" ")
print()
else:
print("Error! Can't Add them!!")
r1=int(input("Enter no of rows in the m... | def add_matrix():
if r1 == r2 and c1 == c2:
print('Addition Matrix of Given matrices is:')
for i in range(r1):
for j in range(c1):
print(m1[i][j] + m2[i][j], end=' ')
print()
else:
print("Error! Can't Add them!!")
r1 = int(input('Enter no of rows i... |
'''
Created on Nov 7, 2016
@author: matth
'''
class init(object):
'''
This will set up all of the initial systems that need to be started when a new flight is requested.
'''
def __init__(self):
'''
Constructor
'''
def start(self):
'''
This is what... | """
Created on Nov 7, 2016
@author: matth
"""
class Init(object):
"""
This will set up all of the initial systems that need to be started when a new flight is requested.
"""
def __init__(self):
"""
Constructor
"""
def start(self):
"""
This is what will be ... |
pkgname = "ncurses"
pkgver = "6.3"
pkgrel = 0
build_style = "gnu_configure"
configure_args = [
"--enable-widec", "--enable-big-core", "--enable-ext-colors",
"--enable-pc-files", "--without-debug", "--without-ada",
"--with-shared", "--with-manpage-symlinks",
"--with-manpage-format=normal",
"--with-pk... | pkgname = 'ncurses'
pkgver = '6.3'
pkgrel = 0
build_style = 'gnu_configure'
configure_args = ['--enable-widec', '--enable-big-core', '--enable-ext-colors', '--enable-pc-files', '--without-debug', '--without-ada', '--with-shared', '--with-manpage-symlinks', '--with-manpage-format=normal', '--with-pkg-config-libdir=/usr/... |
"""Configs for STL->CIFAR experiments."""
def get_weighting_config_class_pareto(alpha, reverse, seed):
return {
'name': 'class_pareto',
'kwargs': {
'alpha': alpha,
'reverse': reverse,
'seed': seed
},
}
def get_dataset_config_cifar_stl_pareto_target... | """Configs for STL->CIFAR experiments."""
def get_weighting_config_class_pareto(alpha, reverse, seed):
return {'name': 'class_pareto', 'kwargs': {'alpha': alpha, 'reverse': reverse, 'seed': seed}}
def get_dataset_config_cifar_stl_pareto_target_imbalance(alpha, seed=None):
return {'name': 'CIFAR_STL', 'val_fra... |
class InversionConfiguration:
"""A utility class for storing all inversion options at the same place
This class is mainly used for configuring the FlexibleInversionControllers behaviour. Should be passed to the FIC
init method.
Parameter:
general_bert_verbose: A boolean indicating if bert shou... | class Inversionconfiguration:
"""A utility class for storing all inversion options at the same place
This class is mainly used for configuring the FlexibleInversionControllers behaviour. Should be passed to the FIC
init method.
Parameter:
general_bert_verbose: A boolean indicating if bert shou... |
def flatten(dd, prefix=''):
def flatten_impl(dd):
if (type(dd) == dict):
nextKey = [*dd][0]
return '[' + nextKey + ']' + flatten(dd[nextKey])
else:
return '=' + str(dd)
return prefix + flatten_impl(dd) | def flatten(dd, prefix=''):
def flatten_impl(dd):
if type(dd) == dict:
next_key = [*dd][0]
return '[' + nextKey + ']' + flatten(dd[nextKey])
else:
return '=' + str(dd)
return prefix + flatten_impl(dd) |
def is_palindrom(permutation: str) -> bool:
if not permutation:
return False
permutation = permutation.replace(' ', '').lower()
store = {}
odd = 0
for letter in permutation:
if letter not in store:
store[letter] = 0
store[letter] += 1
if store[letter] %... | def is_palindrom(permutation: str) -> bool:
if not permutation:
return False
permutation = permutation.replace(' ', '').lower()
store = {}
odd = 0
for letter in permutation:
if letter not in store:
store[letter] = 0
store[letter] += 1
if store[letter] % 2 ... |
# Suppose a sorted array is rotated at some pivot unknown to you beforehand.
# (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
# Find the minimum element.
# The array may contain duplicates.
def find_min(numbers):
size = len(numbers)
if size == 0:
return 0
elif size == 1:
return numbers[... | def find_min(numbers):
size = len(numbers)
if size == 0:
return 0
elif size == 1:
return numbers[0]
elif size == 2:
return min(numbers[0], numbers[1])
start = 0
stop = size - 1
while start < stop - 1:
if numbers[start] < numbers[stop]:
return numbe... |
'''
gsconfig is a python library for manipulating a GeoServer instance via the GeoServer RESTConfig API.
The project is distributed under a MIT License .
'''
__author__ = "David Winslow"
__copyright__ = "Copyright 2012-2015 Boundless, Copyright 2010-2012 OpenPlans"
__license__ = "MIT"
# shapefile_and_friends = None
... | """
gsconfig is a python library for manipulating a GeoServer instance via the GeoServer RESTConfig API.
The project is distributed under a MIT License .
"""
__author__ = 'David Winslow'
__copyright__ = 'Copyright 2012-2015 Boundless, Copyright 2010-2012 OpenPlans'
__license__ = 'MIT'
def shapefile_and_friends(path):... |
class LoginFlags:
CONSOLE = 1
GUI = 2 | class Loginflags:
console = 1
gui = 2 |
def tree(p, n):
return [1 if i==0 or i==n-1 else p[i-1]+p[i] for i in range(n)] #weird stuff
List=[]
n=1
arr=[1]
while n!=30: #change this for your own length
arr=euclidtree(arr,n)
List.append(arr)
n += 1
s_len = len(" ".join(map(str,List[-1])))
for el in List:
s = " ".join(map(str,el... | def tree(p, n):
return [1 if i == 0 or i == n - 1 else p[i - 1] + p[i] for i in range(n)]
list = []
n = 1
arr = [1]
while n != 30:
arr = euclidtree(arr, n)
List.append(arr)
n += 1
s_len = len(' '.join(map(str, List[-1])))
for el in List:
s = ' '.join(map(str, el))
print(str.center(s, s_len))
inp... |
#
# @lc app=leetcode id=102 lang=python3
#
# [102] Binary Tree Level Order Traversal
#
# @lc code=start
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def... | class Solution:
def level_order(self, root: TreeNode) -> List[List[int]]:
if root is None:
return []
result = []
trees = [root]
while trees:
result.append([t.val for t in trees])
new_trees = []
for t in trees:
if t.left... |
while(True):
try:
a,b=list(map(int,input().split()))
if(a==b):
break
else:
if(a<b):
print("Crescente")
else:
print("Decrescente")
except EOFError:
break | while True:
try:
(a, b) = list(map(int, input().split()))
if a == b:
break
elif a < b:
print('Crescente')
else:
print('Decrescente')
except EOFError:
break |
std_template = '''
from flask import Flask, render_template
from flask_ask import Ask, statement, question, session
app = Flask(__name__)
ask = Ask(app,"/")
@ask.launch
def launched():
welcome = "<WELCOME_MESSAGE>. Would you like to try this skill out?"
return question(welcome)
@ask.intent('YesIntent')
def logic_b... | std_template = '\nfrom flask import Flask, render_template\nfrom flask_ask import Ask, statement, question, session\n\napp = Flask(__name__)\nask = Ask(app,"/")\n\n@ask.launch\ndef launched():\n\twelcome = "<WELCOME_MESSAGE>. Would you like to try this skill out?"\n\treturn question(welcome)\n\n@ask.intent(\'YesIntent\... |
microcode = '''
def macroop VADDSS_XMM_XMM {
maddf xmm0, xmm0v, xmm0m, size=4, ext=Scalar
movfph2h dest=xmm0, src1=xmm0v, dataSize=4
movfp dest=xmm1, src1=xmm1v, dataSize=8
vclear dest=xmm2, destVL=16
};
def macroop VADDSS_XMM_M {
movfp dest=xmm0, src1=xmm0v, dataSize=8
movfp dest=xmm1, src1=x... | microcode = '\ndef macroop VADDSS_XMM_XMM {\n maddf xmm0, xmm0v, xmm0m, size=4, ext=Scalar\n movfph2h dest=xmm0, src1=xmm0v, dataSize=4\n movfp dest=xmm1, src1=xmm1v, dataSize=8\n vclear dest=xmm2, destVL=16\n};\n\ndef macroop VADDSS_XMM_M {\n movfp dest=xmm0, src1=xmm0v, dataSize=8\n movfp dest=xmm1,... |
def our_decorator(func):
def function_wrapper(x):
print("Before calling " + func.__name__)
func(x)
print("After calling " + func.__name__)
return function_wrapper
@our_decorator
def foo(x):
print("Hi, foo has been called with " + str(x))
foo("Hi")
| def our_decorator(func):
def function_wrapper(x):
print('Before calling ' + func.__name__)
func(x)
print('After calling ' + func.__name__)
return function_wrapper
@our_decorator
def foo(x):
print('Hi, foo has been called with ' + str(x))
foo('Hi') |
class Solution:
def wiggleMaxLength(self, nums):
if len(nums) <= 2: return 0 if not nums else 1 if nums[0] == nums[-1] else 2
inc = nums[0] < nums[1] if nums[0] != nums[1] else None
cnt = 2 if inc != None else 1
for i in range(2, len(nums)):
if nums[i - 1] != nums[i] and ... | class Solution:
def wiggle_max_length(self, nums):
if len(nums) <= 2:
return 0 if not nums else 1 if nums[0] == nums[-1] else 2
inc = nums[0] < nums[1] if nums[0] != nums[1] else None
cnt = 2 if inc != None else 1
for i in range(2, len(nums)):
if nums[i - 1] ... |
# Python - 3.6.0
test.assert_equals(is_palindrome('anna'), True)
test.assert_equals(is_palindrome('walter'), False)
test.assert_equals(is_palindrome(12321), True)
test.assert_equals(is_palindrome(123456), False)
| test.assert_equals(is_palindrome('anna'), True)
test.assert_equals(is_palindrome('walter'), False)
test.assert_equals(is_palindrome(12321), True)
test.assert_equals(is_palindrome(123456), False) |
#
# PySNMP MIB module MYLEXRAID-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MYLEXRAID-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:16:50 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, constraints_intersection, single_value_constraint, value_size_constraint) ... |
n, x = map(int, input().split())
students = []
for _ in range(x):
students.append(map(float, input().split()))
for i in zip(*students):
print(sum(i) / len(i))
| (n, x) = map(int, input().split())
students = []
for _ in range(x):
students.append(map(float, input().split()))
for i in zip(*students):
print(sum(i) / len(i)) |
#A while statement will repeatedly execute a single statement or group of statements as long as the condition is true.
# The reason it is called a 'loop' is because the code statements are looped through over and over again until the condition is no longer met.
# Example
x = 0
while x < 10:
print('x is currently... | x = 0
while x < 10:
print('x is currently: ', x)
print(' x is still less than 10, adding 1 to x')
x += 1
else:
print('All Done!')
'\nbreak: Breaks out of the current closest enclosing loop.\ncontinue: Goes to the top of the closest enclosing loop.\npass: Does nothing at all.'
x = 0
while x < 10:
pri... |
'''
Module for pretrained models to be used for transfer learning
Import modules to register class names in global registry
'''
__author__ = 'Elisha Yadgaran'
| """
Module for pretrained models to be used for transfer learning
Import modules to register class names in global registry
"""
__author__ = 'Elisha Yadgaran' |
class Action:
def __init__(self, head, arg_types, goal, precond):
self.head = head
self.arg_types = arg_types
self.goal = goal
self.precond = precond | class Action:
def __init__(self, head, arg_types, goal, precond):
self.head = head
self.arg_types = arg_types
self.goal = goal
self.precond = precond |
class LuxDevice:
def __init__(self, serial_number, is_connected=True, temperature=None):
self.serial_number = serial_number
self.__temperature = temperature
self.is_connected = is_connected
@property
def temperature(self):
return self.__temperature
@temperature.setter
... | class Luxdevice:
def __init__(self, serial_number, is_connected=True, temperature=None):
self.serial_number = serial_number
self.__temperature = temperature
self.is_connected = is_connected
@property
def temperature(self):
return self.__temperature
@temperature.setter
... |
'''
Bing.com page objects as CSS selectors
'''
class Page(object):
search_box = 'input.b_searchbox'
search_button = 'input[name="go"]'
search_results = '#b_results'
| """
Bing.com page objects as CSS selectors
"""
class Page(object):
search_box = 'input.b_searchbox'
search_button = 'input[name="go"]'
search_results = '#b_results' |
class PossibilitySet:
def __init__(self, dependencies, possibilities):
self.dependencies = dependencies
self.possibilities = possibilities
@property
def latest_version(self):
if self.possibilities:
return self.possibilities[-1]
def __str__(self):
return '[{... | class Possibilityset:
def __init__(self, dependencies, possibilities):
self.dependencies = dependencies
self.possibilities = possibilities
@property
def latest_version(self):
if self.possibilities:
return self.possibilities[-1]
def __str__(self):
return '[{... |
class Solution(object):
def searchInsert(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
lo = 0
hi = len(nums) -1
mid = (lo + hi) / 2
if target > nums[hi]:
return hi + 1
while lo <=... | class Solution(object):
def search_insert(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
lo = 0
hi = len(nums) - 1
mid = (lo + hi) / 2
if target > nums[hi]:
return hi + 1
while lo <= hi:
... |
class GTIError(Exception):
"""An exception occured while using the GTI API."""
def __init__(self, return_code, error_text, error_dev_info):
self.return_code = return_code
self.error_text = error_text
self.error_dev_info = error_dev_info
class CannotConnect(Exception):
"""Exception... | class Gtierror(Exception):
"""An exception occured while using the GTI API."""
def __init__(self, return_code, error_text, error_dev_info):
self.return_code = return_code
self.error_text = error_text
self.error_dev_info = error_dev_info
class Cannotconnect(Exception):
"""Exception ... |
class Time:
def __init__(self, hour, minute):
self.hour = hour
self.minute = minute
def __sub__(self, time):
res = (self.hour - time.hour) * 60 + (self.minute - time.minute)
if res > 0: return res
else: return res + 24*60
def __str__(self):
m... | class Time:
def __init__(self, hour, minute):
self.hour = hour
self.minute = minute
def __sub__(self, time):
res = (self.hour - time.hour) * 60 + (self.minute - time.minute)
if res > 0:
return res
else:
return res + 24 * 60
def __str__(self)... |
#!/usr/bin/env python
# Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
# Government retains certain rights in this software.
allowable_variable_chars = set( 'abcdefghijklmnopqrstuvwxyz'
... | allowable_variable_chars = set('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_')
allowable_word_chars = allowable_variable_chars.union('.-=+#@^%:~')
allowable_param_value_chars = allowable_word_chars.union('<>!')
allowable_wildcard_expression_chars = allowable_word_chars.union('*?[]!')
def allowable_w... |
s = input()
if len(s) > 0:
s = s.strip()[:-1]
print(' '.join(map(str, map(len, s.split()))))
| s = input()
if len(s) > 0:
s = s.strip()[:-1]
print(' '.join(map(str, map(len, s.split())))) |
a=int(input('Digite a altura: '))
b=int(input('Digite a largura: '))
area= a*b
tinta= area/2
print('Vai precisar de {}L de tinta'.format(tinta)) | a = int(input('Digite a altura: '))
b = int(input('Digite a largura: '))
area = a * b
tinta = area / 2
print('Vai precisar de {}L de tinta'.format(tinta)) |
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
class BaseReporter(object):
def __init__(self, metric_provider):
self.metrics = []
self.metric_provider... | class Basereporter(object):
def __init__(self, metric_provider):
self.metrics = []
self.metric_provider = metric_provider
def track_metric(self, metric):
self.metrics.append(metric)
def get_metric_values(self):
metric_values = {}
for metric in self.metrics:
... |
# Author: Allan Chua allanchua.officefiles@gmail.com
def is_not_blank(s):
return bool(s and not s.isspace())
class DownloadKeyPair:
"""Class used for representing a download URI and a local persistence path.
Attributes:
----------------
download_url: str
The download URI.
local_path: ... | def is_not_blank(s):
return bool(s and (not s.isspace()))
class Downloadkeypair:
"""Class used for representing a download URI and a local persistence path.
Attributes:
----------------
download_url: str
The download URI.
local_path: str
The local persistence path.
"""
def __init__(s... |
infile = open("hotels.txt", "r")
hotels = []
for line in infile:
[hotel, stars, review] = line.split(";")
hotels.append([hotel, int(stars), float(review)])
infile.close()
# print(hotels)
star = int(input())
found_hotels = []
for h in hotels:
if h[1] >= star:
found_hotels.append([h[2], h[1], h[0]])
f... | infile = open('hotels.txt', 'r')
hotels = []
for line in infile:
[hotel, stars, review] = line.split(';')
hotels.append([hotel, int(stars), float(review)])
infile.close()
star = int(input())
found_hotels = []
for h in hotels:
if h[1] >= star:
found_hotels.append([h[2], h[1], h[0]])
found_hotels.sort... |
class App(object):
name = 'AppName'
def __init__(self, tManager):
self.textManager = tManager
self.playerList = []
self.__running = False
def help(self):
''' Print the help message '''
return ''
def start(self):
''' Wrapper for __start ''... | class App(object):
name = 'AppName'
def __init__(self, tManager):
self.textManager = tManager
self.playerList = []
self.__running = False
def help(self):
""" Print the help message """
return ''
def start(self):
""" Wrapper for __start """
self.... |
class Solution:
def XXX(self, l1: ListNode, l2: ListNode) -> ListNode:
p1 = l1
p2 = l2
res = ListNode()
res_head = res
carry = 0
while p1 and p2:
res.next = ListNode()
res = res.next
res.val = p1.val + p2.val + carry
car... | class Solution:
def xxx(self, l1: ListNode, l2: ListNode) -> ListNode:
p1 = l1
p2 = l2
res = list_node()
res_head = res
carry = 0
while p1 and p2:
res.next = list_node()
res = res.next
res.val = p1.val + p2.val + carry
... |
"""Example function to import in the same package"""
def example_function_to_import():
"""Example function to import inside this package
Returns:
Hard coded message
"""
return "example_function_to_import"
| """Example function to import in the same package"""
def example_function_to_import():
"""Example function to import inside this package
Returns:
Hard coded message
"""
return 'example_function_to_import' |
INITIATED = 'INIT'
PAID = 'PAID'
FAILED = 'FAIL'
PAYMENT_STATUS_CHOICES = (
(INITIATED, 'Initiated'),
(PAID, 'Paid'),
(FAILED, 'Failed'),
)
| initiated = 'INIT'
paid = 'PAID'
failed = 'FAIL'
payment_status_choices = ((INITIATED, 'Initiated'), (PAID, 'Paid'), (FAILED, 'Failed')) |
class UnknownUser(Exception):
"""User not found on the system."""
class CriticalParameterMissing(Exception):
"""Some url argument is missing"""
| class Unknownuser(Exception):
"""User not found on the system."""
class Criticalparametermissing(Exception):
"""Some url argument is missing""" |
# python program Swap
# two nibbles in a byte
def swapNibbles(x):
return ( (x & 0x0F)<<4 | (x & 0xF0)>>4 )
# Driver code
x = 100
print(swapNibbles(x))
| def swap_nibbles(x):
return (x & 15) << 4 | (x & 240) >> 4
x = 100
print(swap_nibbles(x)) |
class Node:
def __init__(self, data=None):
self.data = data
self.out_edges = []
self.in_edges = []
def outgoing_edges(self):
return self.out_edges
def incoming_edges(self):
return self.in_edges
def edges(self):
return self.out_edges + self.in_edges
... | class Node:
def __init__(self, data=None):
self.data = data
self.out_edges = []
self.in_edges = []
def outgoing_edges(self):
return self.out_edges
def incoming_edges(self):
return self.in_edges
def edges(self):
return self.out_edges + self.in_edges
... |
"""GCP simple pipeline
This package contains the modules for deploying a simple pipeline on GCP.
It is part of the educational repositories (https://github.com/pandle/materials)
to learn how to write stardard code and common uses of the CI/CD.
Package contents ..
>>> import gcp_simple_pipeline
>>> help(gcp_... | """GCP simple pipeline
This package contains the modules for deploying a simple pipeline on GCP.
It is part of the educational repositories (https://github.com/pandle/materials)
to learn how to write stardard code and common uses of the CI/CD.
Package contents ..
>>> import gcp_simple_pipeline
>>> help(gcp_... |
with open("input.txt") as x:
lines = x.read().splitlines()
rules = lines[:20]
ticket = lines[22]
nearby = lines[25:]
rularr = {}
for r in rules:
f, rules = r.split(": ")
rules = rules.split(" or ")
rules = [rule.split("-") for rule in rules]
ruld[f] = [[int(n) for n in r] for r in rule... | with open('input.txt') as x:
lines = x.read().splitlines()
rules = lines[:20]
ticket = lines[22]
nearby = lines[25:]
rularr = {}
for r in rules:
(f, rules) = r.split(': ')
rules = rules.split(' or ')
rules = [rule.split('-') for rule in rules]
ruld[f] = [[int(n) for n in r] for r in rule... |
#encoding:utf-8
subreddit = 'quotes'
t_channel = '@lyricalquotes'
def send_post(submission, r2t):
return r2t.send_simple(submission, disable_web_page_preview=True)
| subreddit = 'quotes'
t_channel = '@lyricalquotes'
def send_post(submission, r2t):
return r2t.send_simple(submission, disable_web_page_preview=True) |
# -*- coding: utf-8 -*-
"""OR2-LP2.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1_z9BpSrycC5zURaxc0uToxRo3bpMDKFa
Critical Path Method : Project schedule modeling technique
Network Diagram has many paths originating from one point and ending a... | """OR2-LP2.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1_z9BpSrycC5zURaxc0uToxRo3bpMDKFa
Critical Path Method : Project schedule modeling technique
Network Diagram has many paths originating from one point and ending at another point. Every p... |
my_dictionary={
"nama": "Elyas",
"tinggal": "Probolinggo",
"year": 2000
}
print(my_dictionary)
my_dictionary= {'warna': 'merah',
1: [2,3,5]}
print(my_dictionary[1][-1]) | my_dictionary = {'nama': 'Elyas', 'tinggal': 'Probolinggo', 'year': 2000}
print(my_dictionary)
my_dictionary = {'warna': 'merah', 1: [2, 3, 5]}
print(my_dictionary[1][-1]) |
class HashNode:
"""
Node in the hash table, keeps a track of the cache object at that location.
"""
def __init__(self):
self.entry = None
class HashTable:
"""
A hash table for accessing the cache contents
Assumed 'collision-free'
"""
def __init__(self, size=1009):
"... | class Hashnode:
"""
Node in the hash table, keeps a track of the cache object at that location.
"""
def __init__(self):
self.entry = None
class Hashtable:
"""
A hash table for accessing the cache contents
Assumed 'collision-free'
"""
def __init__(self, size=1009):
... |
# Defines number of epochs
n_epochs = 1000
for epoch in range(n_epochs):
# Sets model to TRAIN mode
model.train()
# Step 1 - Computes model's predicted output - forward pass
yhat = model(x_train_tensor)
# Step 2 - Computes the loss
loss = loss_fn(yhat, y_train_tensor)
# Step 3 - Com... | n_epochs = 1000
for epoch in range(n_epochs):
model.train()
yhat = model(x_train_tensor)
loss = loss_fn(yhat, y_train_tensor)
loss.backward()
optimizer.step()
optimizer.zero_grad() |
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftPLUSMINUSleftTIMESDIVIDEPERCENTrightUMINUSCIRCLE COMMA DIVIDE DO DOUBLE DOUBLE_CONST ECHO ELSE ENDIF ENDSUBROUTINE ENDWHILE EQUALITY EQUALS FOR GREATER_EQUAL GREATE... | _tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftPLUSMINUSleftTIMESDIVIDEPERCENTrightUMINUSCIRCLE COMMA DIVIDE DO DOUBLE DOUBLE_CONST ECHO ELSE ENDIF ENDSUBROUTINE ENDWHILE EQUALITY EQUALS FOR GREATER_EQUAL GREATER_THAN IF INPUT INT INT_CONST LBRACKET LESS_EQUAL LESS_THAN LPAREN MINUS NEWLINE NEXT NOT_EQUA... |
KEY_LABEL_BOXES_3D = 'label_boxes_3d'
KEY_LABEL_ANCHORS = 'label_anchors'
KEY_LABEL_CLASSES = 'label_classes'
KEY_LABEL_SEG = 'label_seg'
KEY_IMAGE_INPUT = 'image_input'
KEY_BEV_INPUT = 'bev_input'
KEY_BEV_PSE_INPUT = 'bev_pse_input'
KEY_SEG_INPUT = 'seg_input'
KEY_SAMPLE_IDX = 'sample_idx'
KEY_SAMPLE_NAME = 's... | key_label_boxes_3_d = 'label_boxes_3d'
key_label_anchors = 'label_anchors'
key_label_classes = 'label_classes'
key_label_seg = 'label_seg'
key_image_input = 'image_input'
key_bev_input = 'bev_input'
key_bev_pse_input = 'bev_pse_input'
key_seg_input = 'seg_input'
key_sample_idx = 'sample_idx'
key_sample_name = 'sample_n... |
print("This program returns prevalence, sensitivity, specificity, positive predictive value, and negative predictive value.")
tp = ""
tn = ""
fp = ""
fn = ""
def get_diagnostic_parameter_from_user(parameter, message:str):
while type(parameter) != int:
parameter = input(message)
try:
par... | print('This program returns prevalence, sensitivity, specificity, positive predictive value, and negative predictive value.')
tp = ''
tn = ''
fp = ''
fn = ''
def get_diagnostic_parameter_from_user(parameter, message: str):
while type(parameter) != int:
parameter = input(message)
try:
pa... |
# Time complexity: ?
# Space Complexity: ?
def newman_conway(num):
""" Returns a list of the Newman Conway numbers for the given value.
Time Complexity: O(n)
Space Complexity: O(n)
"""
if num == 0:
raise ValueError
if num == 1:
return "1"
seq = [0, 1, 1]
for i... | def newman_conway(num):
""" Returns a list of the Newman Conway numbers for the given value.
Time Complexity: O(n)
Space Complexity: O(n)
"""
if num == 0:
raise ValueError
if num == 1:
return '1'
seq = [0, 1, 1]
for i in range(3, num + 1):
next_num = seq[s... |
def reverse(nums):
start = 0
end = len(nums) - 1
while end > start:
nums[start], nums[end] = nums[end], nums[start]
start += 1
end -= 1
if __name__ == "__main__":
n = [1, 2, 3, 4]
reverse(n)
print(n)
| def reverse(nums):
start = 0
end = len(nums) - 1
while end > start:
(nums[start], nums[end]) = (nums[end], nums[start])
start += 1
end -= 1
if __name__ == '__main__':
n = [1, 2, 3, 4]
reverse(n)
print(n) |
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
def rules_nfpm_setup(nogo = None):
go_rules_dependencies()
go_register_toolchains(nogo = nogo)
gazelle_dependencies()
| load('@io_bazel_rules_go//go:deps.bzl', 'go_register_toolchains', 'go_rules_dependencies')
load('@bazel_gazelle//:deps.bzl', 'gazelle_dependencies')
def rules_nfpm_setup(nogo=None):
go_rules_dependencies()
go_register_toolchains(nogo=nogo)
gazelle_dependencies() |
"""
problem 7:
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13,
we can see that the 6th prime is 13.
What is the 10 001st prime number?
"""
def prime_numbers(to_number):
tn = to_number
for possible_prime in range(2, tn+1):
is_prime = True
for num in range(2, possible_prime):
... | """
problem 7:
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13,
we can see that the 6th prime is 13.
What is the 10 001st prime number?
"""
def prime_numbers(to_number):
tn = to_number
for possible_prime in range(2, tn + 1):
is_prime = True
for num in range(2, possible_prime):
... |
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'codesearch',
]
def RunSteps(api):
api.codesearch.set_config('base')
api.codesearch.run_clang_tool()
def GenTests(api):
yield (
ap... | deps = ['codesearch']
def run_steps(api):
api.codesearch.set_config('base')
api.codesearch.run_clang_tool()
def gen_tests(api):
yield api.test('basic')
yield (api.test('run_translation_unit_clang_tool_failed') + api.step_data('run translation_unit clang tool', retcode=1)) |
#
# @lc app=leetcode id=326 lang=python3
#
# [326] Power of Three
#
# @lc code=start
class Solution:
def isPowerOfThree(self, n: int) -> bool:
if n <= 0:
return False
if n == 1:
return True
if n % 3 != 0:
return False
return self.isPowerOfThree... | class Solution:
def is_power_of_three(self, n: int) -> bool:
if n <= 0:
return False
if n == 1:
return True
if n % 3 != 0:
return False
return self.isPowerOfThree(n // 3) |
#
# @lc app=leetcode.cn id=337 lang=python3
#
# [337] house-robber-iii
#
None
# @lc code=end | None |
#!/usr/bin/python
class Game:
def __init__(self, team1, team1players, team2, team2players, date):
self.team1 = team1
self.team1players = team1players
self.team2 = team2
self.team2players = team2players
self.date = date
self.team1Score = 0
self.team2Score = 0... | class Game:
def __init__(self, team1, team1players, team2, team2players, date):
self.team1 = team1
self.team1players = team1players
self.team2 = team2
self.team2players = team2players
self.date = date
self.team1Score = 0
self.team2Score = 0
def get_score... |
def make_form(args, action, method='post', cls='payment-form'):
html = "<meta http-equiv='content-type' content='text/html; charset=utf-8'>"
html += '<form class="{}" action="{}" method="{}">'.format(cls, action, method)
for k, v in args.items():
html += '<div>{}<input name="{}" value="{}" /></div>'... | def make_form(args, action, method='post', cls='payment-form'):
html = "<meta http-equiv='content-type' content='text/html; charset=utf-8'>"
html += '<form class="{}" action="{}" method="{}">'.format(cls, action, method)
for (k, v) in args.items():
html += '<div>{}<input name="{}" value="{}" /></div... |
# (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
class JSONDict(dict):
"""Subclass of dict which adds jsonpointer-like access methods"""
def _resolve(self, path):
parts = path.lstrip('/').split('/')
obj = self
for p... | class Jsondict(dict):
"""Subclass of dict which adds jsonpointer-like access methods"""
def _resolve(self, path):
parts = path.lstrip('/').split('/')
obj = self
for p in parts:
try:
p = int(p)
except Exception:
pass
try... |
if __name__ == '__main__':
k1, k2 = map(int, input().split())
n = int(input())
row_sum = [0] * k1
col_sum = [0] * k2
all_sum = 0
real = {}
for _ in range(n):
x, y = map(int, input().split())
x -= 1
y -= 1
real[(x, y)] = real.get((x, y), 0) + 1
row_su... | if __name__ == '__main__':
(k1, k2) = map(int, input().split())
n = int(input())
row_sum = [0] * k1
col_sum = [0] * k2
all_sum = 0
real = {}
for _ in range(n):
(x, y) = map(int, input().split())
x -= 1
y -= 1
real[x, y] = real.get((x, y), 0) + 1
row_su... |
"""
Cube digit pairs
"""
| """
Cube digit pairs
""" |
# -*- coding: utf-8 -*-
class BasePlugin(object):
NAME = 'base_plugin'
DESCRIPTION = ''
@property
def plugin_name(self):
"""Return the name of the plugin."""
return self.NAME
def Process(self, **kwargs):
"""Evaluates if this is the correct plugin and processes data accord... | class Baseplugin(object):
name = 'base_plugin'
description = ''
@property
def plugin_name(self):
"""Return the name of the plugin."""
return self.NAME
def process(self, **kwargs):
"""Evaluates if this is the correct plugin and processes data accordingly.
"""
... |
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 5 2020
@author: Shrey1608
"""
# Approach :1) Recursive inorder traversal i.e first do a inorder traversal which is a method of Dfs and then just follow the recursion(Time complexity= O(N)(h is height of the tree)
# It's a very straightforward approach with O(N)\mathcal{O... | """
Created on Mon Oct 5 2020
@author: Shrey1608
"""
class Solution:
def inorder(self, root, output):
if root == None:
return
else:
self.inorder(root.left, output)
output.append(root.val)
self.inorder(root.right, output)
def kth_smallest(self,... |
# Car Pooling
# Medium
class Solution(object):
def carPooling(self, trips, capacity):
"""
:type trips: List[List[int]]
:type capacity: int
:rtype: bool
"""
overload = [0] * 1001
for trip in trips:
for i in range(trip[1],trip[2]):
... | class Solution(object):
def car_pooling(self, trips, capacity):
"""
:type trips: List[List[int]]
:type capacity: int
:rtype: bool
"""
overload = [0] * 1001
for trip in trips:
for i in range(trip[1], trip[2]):
overload[i] += trip[0]... |
"""
Class used to represent a clause in CNF for the graph coloring problem.
Variable X_v_c is true iff node v has color c.
For example, to create a clause:
X_1_1 or ~X_1_2 or X_3_4
you can do:
clause = Clause(3)
clause.add_positive(1, 1)
clause.add_negative(1, 2)
clause.add_positive(3, 3)
"""
class Clause:
def ... | """
Class used to represent a clause in CNF for the graph coloring problem.
Variable X_v_c is true iff node v has color c.
For example, to create a clause:
X_1_1 or ~X_1_2 or X_3_4
you can do:
clause = Clause(3)
clause.add_positive(1, 1)
clause.add_negative(1, 2)
clause.add_positive(3, 3)
"""
class Clause:
d... |
# Substring with Concatenation of All Words
# You are given a string s and an array of strings words of the same length.
# Return all starting indices of substring(s) in s that is a concatenation of each word
# in words exactly once, in any order, and without any intervening characters.
# You can return the answer in ... | def find_substring(s, words):
window = 0
res = []
for ele in words:
window += len(ele)
if len(s) < window:
return []
(start, end) = (0, window)
while end <= len(s):
substring = True
redundant_words = {}
for ele in words:
if words.count(ele) != ... |
def testmethod(f):
f.__testmethod__=True
return f
| def testmethod(f):
f.__testmethod__ = True
return f |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 12 07:50:30 2022
@author: User
"""
| """
Created on Sat Feb 12 07:50:30 2022
@author: User
""" |
# Bootstrap class for flash alerts
class Flash_Alerts():
SUCCESS = 'success'
ERROR = 'danger'
INFO = 'info'
WARNING = 'warning'
ALERT = Flash_Alerts()
| class Flash_Alerts:
success = 'success'
error = 'danger'
info = 'info'
warning = 'warning'
alert = flash__alerts() |
#!/usr/bin/python3
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython
* Estatus : AC
* Porcentaje : 100.00%
* Memoria : 10.31 MB
* Tiempo : 0.82s
"""
def _get_data():
r1 = tuple(map(int, input().split()))
r2 = tuple(map(int, input().split()))
return r1[:2], r1[2:], r2[:2... | """AyudaEnPython: https://www.facebook.com/groups/ayudapython
* Estatus : AC
* Porcentaje : 100.00%
* Memoria : 10.31 MB
* Tiempo : 0.82s
"""
def _get_data():
r1 = tuple(map(int, input().split()))
r2 = tuple(map(int, input().split()))
return (r1[:2], r1[2:], r2[:2], r2[2:])
def _a... |
# -*- coding: utf-8 -*-
"""
wegene.Configuration
This file was automatically generated by APIMATIC BETA v2.0 on 02/22/2016
"""
class Configuration :
# The base Uri for API calls
BASE_URI = "https://api.wegene.com"
# The OAuth 2.0 access token to be set before API calls
# TODO: Rep... | """
wegene.Configuration
This file was automatically generated by APIMATIC BETA v2.0 on 02/22/2016
"""
class Configuration:
base_uri = 'https://api.wegene.com'
o_auth_access_token = 'TODO: Replace' |
a=4
b=2
c=a-b
print(c)
| a = 4
b = 2
c = a - b
print(c) |
def diap_to_prefix(a, b):
def inner(aa, bb, p):
if p == 1:
if a <= aa <= b:
yield aa
return
for d in range(aa, bb + 1, p):
if a <= d and d + p - 1 <= b:
yield d // p
elif not (bb < a or aa > b):
for i in... | def diap_to_prefix(a, b):
def inner(aa, bb, p):
if p == 1:
if a <= aa <= b:
yield aa
return
for d in range(aa, bb + 1, p):
if a <= d and d + p - 1 <= b:
yield (d // p)
elif not (bb < a or aa > b):
for i ... |
IMAGE_BLACK = [
# 0X00,0X01,0XC8,0X00,0XC8,0X00,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XF... | image_black = [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, ... |
# ============================================================================
# Author: Apurv Kulkarni
# ----------------------------------------------------------------------------
# This file contains a function that returns main setup for simulation analysis.
# Changes implemented here will be reflected in whol... | def main_file(geo_data):
return f'$# LS-DYNA Keyword file created by LS-PrePost(R) V4.5.7\n$# Created by Apurv Kulkarni\n*TITLE\n$# title\nLS-DYNA keyword deck by LS-PrePost\n*CONTROL_ACCURACY\n$# osu inn pidosu iacc \n ... |
# Copyright 2022 The AI Flow Authors
#
# 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 wri... | class Bashprocessor(object):
"""
BashProcessor is the processor corresponding to the bash job.
"""
def __init__(self, bash_command: str, output_encoding: str='utf-8'):
"""
:param bash_command: The command of the bash job.
:param output_encoding: The bash job output encoding type... |
# This file contains the following function(s): countCedit
def countCedit(listPAMinfo, strand):
"""This program finds all instances of the base C in the 2nd --> 10th base pairs before the PAM sequence(counting
backward from the PAM they are identified as base pairs -19 to -11)."""
print("Start countCedit... | def count_cedit(listPAMinfo, strand):
"""This program finds all instances of the base C in the 2nd --> 10th base pairs before the PAM sequence(counting
backward from the PAM they are identified as base pairs -19 to -11)."""
print('Start countCedit')
if strand == '+':
loc_c = []
num_c = ... |
# grid illusion
# settings
pw = ph = 600
grid_lines = 9
bar_s = 11
cell_s = pw/grid_lines
dot_f = 1.25
# drawings
newPage(pw, ph)
rect(0, 0, pw, ph)
fill(.5)
# the grid
for i in range(grid_lines):
rect(cell_s*i + cell_s/2 -bar_s/2, 0, bar_s, ph)
rect(0, cell_s*i + cell_s/2 -bar_s/2, pw, bar_s)
# the do... | pw = ph = 600
grid_lines = 9
bar_s = 11
cell_s = pw / grid_lines
dot_f = 1.25
new_page(pw, ph)
rect(0, 0, pw, ph)
fill(0.5)
for i in range(grid_lines):
rect(cell_s * i + cell_s / 2 - bar_s / 2, 0, bar_s, ph)
rect(0, cell_s * i + cell_s / 2 - bar_s / 2, pw, bar_s)
fill(1)
for i in range(grid_lines):
for j in... |
class SubPackage:
def keyword_in_mylibdir_subpackage_class(self):
pass
| class Subpackage:
def keyword_in_mylibdir_subpackage_class(self):
pass |
n=int(input())
s=[int(i) for i in input().split()]
cnt=0
for i in range(n):
if i+1!=s[i]: cnt+=1
print(cnt)
| n = int(input())
s = [int(i) for i in input().split()]
cnt = 0
for i in range(n):
if i + 1 != s[i]:
cnt += 1
print(cnt) |
name = "mtoa"
version = "3.3.0.1.2018"
authors = [
"Solid Angle",
"Autodesk"
]
description = \
"""
MtoA is a plug-in for Autodesk Maya which allows you to use the Arnold renderer directly in Maya.
"""
requires = [
"cmake-3+",
"maya-{maya_version}".format(maya_version=str(version.rsplit("... | name = 'mtoa'
version = '3.3.0.1.2018'
authors = ['Solid Angle', 'Autodesk']
description = '\n MtoA is a plug-in for Autodesk Maya which allows you to use the Arnold renderer directly in Maya.\n '
requires = ['cmake-3+', 'maya-{maya_version}'.format(maya_version=str(version.rsplit('.')[-1]))]
variants = [['platfo... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Helper script to determine voltage levels based on the resistor values in the windvane
# and the used resistor for the voltage divider on the boad.
resistances = [33000, 6570, 8200, 891, 1000, 688, 2200, 1410, 3900, 3140, 16000, 14120, 120000, 42120, 64900, 21880]
def volt... | resistances = [33000, 6570, 8200, 891, 1000, 688, 2200, 1410, 3900, 3140, 16000, 14120, 120000, 42120, 64900, 21880]
def voltage_divider(r1, r2, vin):
vout = vin * r1 / (r1 + r2)
return round(vout, 3)
for x in range(len(resistances)):
print(resistances[x], voltage_divider(4700, resistances[x], 3.3)) |
# Project Euler #4: Largest palindrome product
def palindrome(n):
p = 0
while n > 0:
r = n % 10
n = n // 10
p = p * 10 + r
return p
def find_largest():
max = 850000 # make a guess to save time
m = 999
while m >= 100:
n = m
while n >= 100:
pri... | def palindrome(n):
p = 0
while n > 0:
r = n % 10
n = n // 10
p = p * 10 + r
return p
def find_largest():
max = 850000
m = 999
while m >= 100:
n = m
while n >= 100:
print(m)
print(n)
p = m * n
if p < max:
... |
# In a given array nums of positive integers, find three non-overlapping subarrays with maximum sum.
#
# Each subarray will be of size k, and we want to maximize the sum of all 3*k entries.
#
# Return the result as a list of indices representing the starting position of each interval (0-indexed). If there are multiple ... | class Solution(object):
def max_sum_of_three_subarrays(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: List[int]
"""
if len(nums) < k:
return []
dp = [[0 for _ in range(len(nums))] for _ in range(k)]
pre = [-1 for _ in range... |
# -*- coding: utf-8 -*-
# @Author: Cody Kochmann
# @Date: 2018-03-10 09:10:41
# @Last Modified by: Cody Kochmann
# @Last Modified time: 2018-03-10 09:14:03
def reverse(pipe):
''' this has the same funcitonality as builtins.reversed(), except this
doesnt complain about non-reversable things. If you didn... | def reverse(pipe):
""" this has the same funcitonality as builtins.reversed(), except this
doesnt complain about non-reversable things. If you didnt know already,
a generator needs to fully run in order to be reversed.
"""
for i in reversed(list(pipe)):
yield i
if __name__ == '__main... |
"""
KiPlot errors
"""
class KiPlotError(Exception):
pass
| """
KiPlot errors
"""
class Kiploterror(Exception):
pass |
""" Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
[
[1, 1, 1, 1, 1, 1, 1], <- top layer 1, 1, 1, 1, 1, 1, 1
[1, 2, 2, 2, 2, 2, 1],
[1, 2, 3, 3, 3, 2, 1],
[1, 2, 2, 2, 2, 2, 1],
[1, 1, 1, 1, 1, 1, 1] <- bottom layer 1, 1, 1, 1, 1... | """ Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
[
[1, 1, 1, 1, 1, 1, 1], <- top layer 1, 1, 1, 1, 1, 1, 1
[1, 2, 2, 2, 2, 2, 1],
[1, 2, 3, 3, 3, 2, 1],
[1, 2, 2, 2, 2, 2, 1],
[1, 1, 1, 1, 1, 1, 1] <- bottom layer 1, 1, 1, 1, 1... |
i = 1
def index():
return 'hello'
b =10
| i = 1
def index():
return 'hello'
b = 10 |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def invertTree(self, root: TreeNode) -> TreeNode:
def invert(node):
if node.left:
... | class Solution:
def invert_tree(self, root: TreeNode) -> TreeNode:
def invert(node):
if node.left:
invert(node.left)
if node.right:
invert(node.right)
temp = node.left
node.left = node.right
node.right = temp
... |
class CaseData:
"""
A :class:`.Bond` test case.
Attributes
----------
bond : :class:`.Bond`
The bond to test.
atom1 : :class:`.Atom`
The correct first atom of the bond.
atom2 : :class:`.Atom`
The correct second atom of the bond.
order : :class:`int`
Th... | class Casedata:
"""
A :class:`.Bond` test case.
Attributes
----------
bond : :class:`.Bond`
The bond to test.
atom1 : :class:`.Atom`
The correct first atom of the bond.
atom2 : :class:`.Atom`
The correct second atom of the bond.
order : :class:`int`
Th... |
"""ex083 - Validando expressoes matematicas
Crie um programa onde o usario digite uma expressao qualquer que use parenteses.
Seu aplicativo devera analisar se a expressao passada esta com os parenteses abertos
e fechados na ordem correcta."""
expr = str(input("Digite a expressao: "))
pilha = []
for simb in expr:
i... | """ex083 - Validando expressoes matematicas
Crie um programa onde o usario digite uma expressao qualquer que use parenteses.
Seu aplicativo devera analisar se a expressao passada esta com os parenteses abertos
e fechados na ordem correcta."""
expr = str(input('Digite a expressao: '))
pilha = []
for simb in expr:
if... |
"""Abstraction layer for build rules."""
load("@io_bazel_rules_appengine//appengine:py_appengine.bzl", "py_appengine_test", "py_appengine_binary")
py_appengine_library = native.py_library
def upvote_appengine_test(name, srcs, deps=[], data=[], size="medium"): # pylint: disable=unused-argument
py_appengine_test(
... | """Abstraction layer for build rules."""
load('@io_bazel_rules_appengine//appengine:py_appengine.bzl', 'py_appengine_test', 'py_appengine_binary')
py_appengine_library = native.py_library
def upvote_appengine_test(name, srcs, deps=[], data=[], size='medium'):
py_appengine_test(name=name, srcs=srcs, deps=deps, data... |
def stones(n, a, b):
guesses = []
for i in range(n):
if a < b:
small, large = a, b
else:
small, large = b, a
add = (n-1-i)*small + i*large
if add not in guesses:
guesses.append(add)
return guesses
| def stones(n, a, b):
guesses = []
for i in range(n):
if a < b:
(small, large) = (a, b)
else:
(small, large) = (b, a)
add = (n - 1 - i) * small + i * large
if add not in guesses:
guesses.append(add)
return guesses |
def e2e_has_jar_test(name, dep, jar, clazz=None):
"""
sh_library(
name = "mvn-build-lib-with-profile__maven",
srcs = ["dummy.sh"],
data = ["//tests/e2e/mvn-build-lib-with-profile"],
)
sh_test(
name = "mvn-build-lib-one__test",
srcs = ["test_jar.sh"],
a... | def e2e_has_jar_test(name, dep, jar, clazz=None):
"""
sh_library(
name = "mvn-build-lib-with-profile__maven",
srcs = ["dummy.sh"],
data = ["//tests/e2e/mvn-build-lib-with-profile"],
)
sh_test(
name = "mvn-build-lib-one__test",
srcs = ["test_jar.sh"],
args... |
#!/usr/bin/env python3
def w_len(e):
return len(e)
words = ['forest', 'wood', 'tool', 'sky', 'poor', 'cloud', 'rock', 'if']
words.sort(reverse=True, key=w_len)
print(words)
| def w_len(e):
return len(e)
words = ['forest', 'wood', 'tool', 'sky', 'poor', 'cloud', 'rock', 'if']
words.sort(reverse=True, key=w_len)
print(words) |
def string_numbers_till_n(n):
string_var = "0"
for i in range(n):
string_var = string_var + " " + str(i+1)
return string_var
print(string_numbers_till_n(5))
| def string_numbers_till_n(n):
string_var = '0'
for i in range(n):
string_var = string_var + ' ' + str(i + 1)
return string_var
print(string_numbers_till_n(5)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.