content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
Graph_Index_1 = \
[
{
"Datapoints": [
{
"Average": 220.4406813560452,
"Maximum": 220.4406813560452,
"Timestamp": "2019-03-29T12:42:00+00:00",
"Unit": "Count/Second"
},
{
"Average": 298.8450192496792,
"Maximum": 298.8450192496792,
"Timestamp... | graph__index_1 = [{'Datapoints': [{'Average': 220.4406813560452, 'Maximum': 220.4406813560452, 'Timestamp': '2019-03-29T12:42:00+00:00', 'Unit': 'Count/Second'}, {'Average': 298.8450192496792, 'Maximum': 298.8450192496792, 'Timestamp': '2019-03-29T13:35:00+00:00', 'Unit': 'Count/Second'}, {'Average': 279.2406919769341,... |
class dotSaveOperation_t(object):
# no doc
aComment = None
aID = None
aSaveAsPath = None
Operation = None
| class Dotsaveoperation_T(object):
a_comment = None
a_id = None
a_save_as_path = None
operation = None |
def filter_positive_even_numbers(numbers):
"""Receives a list of numbers, and filters out numbers that
are both positive and even (divisible by 2), try to use a
list comprehension"""
return [num for num in numbers if num > 0 and num % 2 == 0] | def filter_positive_even_numbers(numbers):
"""Receives a list of numbers, and filters out numbers that
are both positive and even (divisible by 2), try to use a
list comprehension"""
return [num for num in numbers if num > 0 and num % 2 == 0] |
"""
****************************************
qal.common - Commonly used functionality
****************************************
This package gathers miscellaneous functionality that is used around QAL and the users of QAL.
:copyright: Copyright 2010-2014 by Nicklas Boerjesson
:license: BSD... | """
****************************************
qal.common - Commonly used functionality
****************************************
This package gathers miscellaneous functionality that is used around QAL and the users of QAL.
:copyright: Copyright 2010-2014 by Nicklas Boerjesson
:license: BSD... |
# Functions #########################################################
class Graph(object):
def __init__(self):
self.nodes = {} # Node -> Group mappings
self.groups = {} # Group -> Node mappings
self._next_group = 0 # Unique id for new groups
def parse_node(self, line):
... | class Graph(object):
def __init__(self):
self.nodes = {}
self.groups = {}
self._next_group = 0
def parse_node(self, line):
components = line.split('<->')
node = int(components[0])
connections = list(map(int, components[1].split(',')))
return self.add_nod... |
# Here are a few examples of function declarations (definition)
# printHelloWorld: no arguments, no output
def printHelloWorld():
print("Hello world")
# div: input = 2 integers; output = 1 float
def div(a,b):
return a/b
# splitStringAtComma: input = 1 string; output = list of strigns
def splitStringAtComma(s):
... | def print_hello_world():
print('Hello world')
def div(a, b):
return a / b
def split_string_at_comma(s):
return s.split(',')
def fibonacci(n):
x_nm1 = 0
x_nm2 = 1
for i in range(n):
x_n = x_nm1 + x_nm2
x_nm2 = x_nm1
x_nm1 = x_n
return x_nm1
print_hello_world()
f = d... |
class Solution:
"""
@param i:
@param j:
@param k:
@return: nothing
"""
def equlSum(self, i, j, k):
# Write your code here
return (i + j)*(j - i + 1) // 2 + (j - 1 + k) * (j - k) // 2
| class Solution:
"""
@param i:
@param j:
@param k:
@return: nothing
"""
def equl_sum(self, i, j, k):
return (i + j) * (j - i + 1) // 2 + (j - 1 + k) * (j - k) // 2 |
class SpotifyObject:
'''
Represents a generic Spotify Object.
Attributes
----------
id: str
Spotify ID of the object.
name: str
Name of the object.
uri: str
Spotify URI of the object.
'''
_type = None
def __init__(self, client, data):
self._client = client
self.id = data.pop('id', None)
s... | class Spotifyobject:
"""
Represents a generic Spotify Object.
Attributes
----------
id: str
Spotify ID of the object.
name: str
Name of the object.
uri: str
Spotify URI of the object.
"""
_type = None
def __init__(self, client, data):
self._client = client
self.id = data... |
class ImageInfo(object):
"""Represents a single image, either an atomicapp meta or binary image."""
def __init__(self, imagename, vcs_url=None, vcs_type='git', vcs_local_path=None,
vcs_image_buildfile='Dockerfile', image_type='docker', is_meta=False,
build_configs=None, built=F... | class Imageinfo(object):
"""Represents a single image, either an atomicapp meta or binary image."""
def __init__(self, imagename, vcs_url=None, vcs_type='git', vcs_local_path=None, vcs_image_buildfile='Dockerfile', image_type='docker', is_meta=False, build_configs=None, built=False):
self.imagename = i... |
# include exclude
exclude_paths = ["dont_test", "unittests"]
include_paths = ["test_simple.py", "dont_test/test_anyway/"]
# /include exclude
autoindex = True
@job("self_depends")
def self_depends():
pass
@job()
def root():
pass
@job("self_depends", "root")
def root2():
pass
@job("x1", "root")
def x3... | exclude_paths = ['dont_test', 'unittests']
include_paths = ['test_simple.py', 'dont_test/test_anyway/']
autoindex = True
@job('self_depends')
def self_depends():
pass
@job()
def root():
pass
@job('self_depends', 'root')
def root2():
pass
@job('x1', 'root')
def x3():
pass
@job('x3', 'root')
def x4()... |
# -*- coding: utf-8 -*-
__author__ = 'gzp'
class Solution:
def monotoneIncreasingDigits(self, N):
"""
:type N: int
:rtype: int
"""
if N < 10:
return N
num = [int(n) for n in str(N)[::-1]]
n = len(num)
ind = -1
for i in range(1, ... | __author__ = 'gzp'
class Solution:
def monotone_increasing_digits(self, N):
"""
:type N: int
:rtype: int
"""
if N < 10:
return N
num = [int(n) for n in str(N)[::-1]]
n = len(num)
ind = -1
for i in range(1, n):
if num[i... |
# -- Project information
project = "Bayesian Workflow resources"
author = "ArviZ contributors"
copyright = f"2022, {author}"
version = "0.1.0"
release = version
# -- General configuration
extensions = [
"sphinx.ext.intersphinx",
"sphinx.ext.mathjax",
"myst_nb",
"sphinx_copybutton",
"sphinx_desi... | project = 'Bayesian Workflow resources'
author = 'ArviZ contributors'
copyright = f'2022, {author}'
version = '0.1.0'
release = version
extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.mathjax', 'myst_nb', 'sphinx_copybutton', 'sphinx_design']
templates_path = ['sphinx/_templates']
exclude_patterns = ['Thumbs.db', '... |
class ResetPasswordToken:
types = {
'resetPasswordUrl': str
}
def __init__(self):
self.resetPasswordUrl = None # str
| class Resetpasswordtoken:
types = {'resetPasswordUrl': str}
def __init__(self):
self.resetPasswordUrl = None |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def leafSimilar(self, root1: TreeNode, root2: TreeNode) -> bool:
seq1, seq2 = [], []
self._inorderTraverse(root1, seq1, r... | class Solution:
def leaf_similar(self, root1: TreeNode, root2: TreeNode) -> bool:
(seq1, seq2) = ([], [])
self._inorderTraverse(root1, seq1, root1.val)
self._inorderTraverse(root2, seq2, root2.val)
if seq1 == seq2:
return True
else:
return False
... |
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
... | pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
pass
... |
#############################
'''
Configuration File for running model.
'''
###########################
DATASET_DIR = '../data/facial_mask/Mask_Datasets/'
IMG_WIDTH = 300
IMG_HEIGHT = 300
BATCH_SIZE = 32
EPOCHS=15
MODELS_PATH = './models/' | """
Configuration File for running model.
"""
dataset_dir = '../data/facial_mask/Mask_Datasets/'
img_width = 300
img_height = 300
batch_size = 32
epochs = 15
models_path = './models/' |
class MockSocket(object):
def __init__(self):
self.connected = False
self.timeout = 0
self.ipaddr = None
self.ipport = None
self.buffer = []
self.request = []
def settimeout(self, timeout):
self.timeout = timeout
def connect(self, ipaddrAndipportTup... | class Mocksocket(object):
def __init__(self):
self.connected = False
self.timeout = 0
self.ipaddr = None
self.ipport = None
self.buffer = []
self.request = []
def settimeout(self, timeout):
self.timeout = timeout
def connect(self, ipaddrAndipportTup... |
# This rule was inspired by rules_closure`s implementation of
# |closure_proto_library|, licensed under Apache 2.
# https://github.com/bazelbuild/rules_closure/blob/3555e5ba61fdcc17157dd833eaf7d19b313b1bca/closure/protobuf/closure_proto_library.bzl
"""Starlark rules for using gRPC-Web with Bazel and `rules_closure`.""... | """Starlark rules for using gRPC-Web with Bazel and `rules_closure`."""
load('@io_bazel_rules_closure//closure/compiler:closure_js_library.bzl', 'create_closure_js_library')
load('@io_bazel_rules_closure//closure/private:defs.bzl', 'CLOSURE_JS_TOOLCHAIN_ATTRS', 'unfurl')
load('@io_bazel_rules_closure//closure/protobuf:... |
def day06(banks):
history = list()
iterations = 0
n = len(banks)
next = lambda i: (i + 1) % n
while True:
m = max(range(n), key=lambda i: banks[i])
blocks = banks[m]
banks[m] = 0
i = next(m)
for _ in range(blocks):
banks[i] += 1
i = ne... | def day06(banks):
history = list()
iterations = 0
n = len(banks)
next = lambda i: (i + 1) % n
while True:
m = max(range(n), key=lambda i: banks[i])
blocks = banks[m]
banks[m] = 0
i = next(m)
for _ in range(blocks):
banks[i] += 1
i = nex... |
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 20 18:51:18 2020
@author:chikoofudge
problem statement:print a n row by n column matrix representing numbers from 1 to 9 ..such that the sum of all the rows and columns and diagnols will be n(n^2+1)/2
algorithm:1)sum=n(n^2+1)/2 for every column and row and diagnol whe... | """
Created on Thu Feb 20 18:51:18 2020
@author:chikoofudge
problem statement:print a n row by n column matrix representing numbers from 1 to 9 ..such that the sum of all the rows and columns and diagnols will be n(n^2+1)/2
algorithm:1)sum=n(n^2+1)/2 for every column and row and diagnol when numbers are placed.
2)lets ... |
"""
Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order.
Example 1:
Input: nums = [-4,-1,0,3,10]
Output: [0,1,9,16,100]
Explanation: After squaring, the array becomes [16,1,0,9,100].
After sorting, it becomes [0,1,9,16,100].
Examp... | """
Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order.
Example 1:
Input: nums = [-4,-1,0,3,10]
Output: [0,1,9,16,100]
Explanation: After squaring, the array becomes [16,1,0,9,100].
After sorting, it becomes [0,1,9,16,100].
Examp... |
"""
Jaro distance
The higher the Jaro distance for two strings is, the more similar the strings are.
The score is normalized such that 0 equates to no similarity and 1 is an exact match.
The algorithm is described on:
https://en.wikipedia.org/wiki/Jaro-Winkler_distance
"""
# from math import floor, ceil
# impor... | """
Jaro distance
The higher the Jaro distance for two strings is, the more similar the strings are.
The score is normalized such that 0 equates to no similarity and 1 is an exact match.
The algorithm is described on:
https://en.wikipedia.org/wiki/Jaro-Winkler_distance
"""
def jaro(s1, s2):
if s1 == s2:
re... |
class Claim:
def __init__(self, claim_soup):
self.soup = claim_soup
print(claim_soup)
self.id = self.soup.get('id')
self.number = self.soup.get('num')
claim_ref = self.soup.find('claim-ref')
if claim_ref:
self.parent_id = claim_ref.get('idref')
s... | class Claim:
def __init__(self, claim_soup):
self.soup = claim_soup
print(claim_soup)
self.id = self.soup.get('id')
self.number = self.soup.get('num')
claim_ref = self.soup.find('claim-ref')
if claim_ref:
self.parent_id = claim_ref.get('idref')
se... |
side = -1
flag = False
def emergency_detect():
global flag
while True:
global side
x = int(input())
if x >= 1 and x <= 4:
side = x
flag = True
elif x == 0:
side = -1
flag = False | side = -1
flag = False
def emergency_detect():
global flag
while True:
global side
x = int(input())
if x >= 1 and x <= 4:
side = x
flag = True
elif x == 0:
side = -1
flag = False |
#
# PySNMP MIB module TRAPEZE-NETWORKS-LICENSE-FEATURE-TC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRAPEZE-NETWORKS-LICENSE-FEATURE-TC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:27:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwan... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection, constraints_union) ... |
'''
Implement a Python program to generate all sentences where subject is in
["Americans", "Indians"] and verb is in ["Play", "watch"] and the object is in
["Baseball","cricket"].
Americans play Baseball.
Americans play Cricket.
Americans watch Baseball.
Americans watch Cricket.
Indians play Baseball.
India... | """
Implement a Python program to generate all sentences where subject is in
["Americans", "Indians"] and verb is in ["Play", "watch"] and the object is in
["Baseball","cricket"].
Americans play Baseball.
Americans play Cricket.
Americans watch Baseball.
Americans watch Cricket.
Indians play Baseball.
Indians play Cr... |
# 95% confidence intervals
def t_interval(n):
t_table = {}
t_table[1] = 12.71
t_table[2] = 4.303
t_table[3] = 3.182
t_table[4] = 2.776
t_table[5] = 2.571
t_table[6] = 2.447
t_table[7] = 2.365
t_table[8] = 2.306
t_table[9] = 2.262
t_table[10] = 2.228
t_table[1... | def t_interval(n):
t_table = {}
t_table[1] = 12.71
t_table[2] = 4.303
t_table[3] = 3.182
t_table[4] = 2.776
t_table[5] = 2.571
t_table[6] = 2.447
t_table[7] = 2.365
t_table[8] = 2.306
t_table[9] = 2.262
t_table[10] = 2.228
t_table[11] = 2.201
t_table[12] = 2.179
t... |
# Copyright 2019 Lorna Authors. All Rights Reserved.
# 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 appli... | __all__ = ['accuracy']
def accuracy(output, target, topk=(1,)):
"""Computes the precision@k for the specified values of k"""
maxk = max(topk)
batch_size = target.size(0)
(_, pred) = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = ... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
def main():
friends_ages = { "Rolf" : 24, "Adam" : 30, "Anne": 27 }
print(friends_ages["Rolf"])
friends_ages["Bob"] = 20
print(friends_ages)
friends_ages["Rolf"] = 25
print(friends_ages)
friends = (
{ "name": "Rolf Smith", "age" : 24 },
{ "name":... | def main():
friends_ages = {'Rolf': 24, 'Adam': 30, 'Anne': 27}
print(friends_ages['Rolf'])
friends_ages['Bob'] = 20
print(friends_ages)
friends_ages['Rolf'] = 25
print(friends_ages)
friends = ({'name': 'Rolf Smith', 'age': 24}, {'name': 'Adam Wool', 'age': 30}, {'name': 'Anne Pun', 'age': 2... |
t,m=map(int,input().split())
val=[0 for i in range(t+1)]
for i in range(m):
c,v=map(int,input().split())
for j in range(c,t+1):
val[j-c]=max(val[j-c],val[j]+v)
print(val[0]) | (t, m) = map(int, input().split())
val = [0 for i in range(t + 1)]
for i in range(m):
(c, v) = map(int, input().split())
for j in range(c, t + 1):
val[j - c] = max(val[j - c], val[j] + v)
print(val[0]) |
# Copyright (c) 2018, Joyent, Inc.
__version_info__ = (2, 6, 2)
__version__ = ".".join(map(str, __version_info__))
| __version_info__ = (2, 6, 2)
__version__ = '.'.join(map(str, __version_info__)) |
'''
Question:
1. Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
Example:
Given nums = [2, 7, 11, 15], target = 9,
Because nums[0] + num... | """
Question:
1. Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
Example:
Given nums = [2, 7, 11, 15], target = 9,
Because nums[0] + num... |
""" Calculate LCM """
class Solution_1:
"""Naive solution."""
def getLCM(self, a, b):
largest = max(a, b)
while True:
if largest % a == 0 and largest % b == 0:
break
largest += 1
return largest
class Solution_2:
""" Euclid solution. """
... | """ Calculate LCM """
class Solution_1:
"""Naive solution."""
def get_lcm(self, a, b):
largest = max(a, b)
while True:
if largest % a == 0 and largest % b == 0:
break
largest += 1
return largest
class Solution_2:
""" Euclid solution. """
... |
# ListNode.py
class ListNode(object):
def __init__(self, item = None, link = None):
'''creates a ListNode with the specified data value and link
post: creates a ListNode with the specified data value and link'''
self.item = item
self.link = link
| class Listnode(object):
def __init__(self, item=None, link=None):
"""creates a ListNode with the specified data value and link
post: creates a ListNode with the specified data value and link"""
self.item = item
self.link = link |
def verify(isbn):
if len(isbn) == 0:
return False
result = []
for n in isbn:
if n.isnumeric():
result.append(n)
if isbn[-1] == 'X':
result.append(10)
if len(result) != 10:
return False
else:
r = 0
for i in range(10):
... | def verify(isbn):
if len(isbn) == 0:
return False
result = []
for n in isbn:
if n.isnumeric():
result.append(n)
if isbn[-1] == 'X':
result.append(10)
if len(result) != 10:
return False
else:
r = 0
for i in range(10):
r += in... |
# Leo colorizer control file for icon mode.
# This file is in the public domain.
# Properties for icon mode.
properties = {
"indentCloseBrackets": "}",
"indentOpenBrackets": "{",
"lineComment": "#",
"lineUpClosingBracket": "true",
"wordBreakChars": "|.\\\\:,+-*/=?^!@%<>&",
}
# Attribut... | properties = {'indentCloseBrackets': '}', 'indentOpenBrackets': '{', 'lineComment': '#', 'lineUpClosingBracket': 'true', 'wordBreakChars': '|.\\\\:,+-*/=?^!@%<>&'}
icon_main_attributes_dict = {'default': 'null', 'digit_re': '(0x[[:xdigit:]]+[lL]?|[[:digit:]]+(e[[:digit:]]*)?[lLdDfF]?)', 'escape': '\\', 'highlight_digit... |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
def pathSum(self, root, sum):
rst = []
self.dfs(root, sum, rst, [])
... | class Solution(object):
def path_sum(self, root, sum):
rst = []
self.dfs(root, sum, rst, [])
return rst
def dfs(self, root, sum, rst, path):
if not root:
return
path.append(root.val)
if not root.left and (not root.right):
if not sum - roo... |
# Merge sort
# Uses Divide and Conquer
# Time complexity: O(nlogn)
# Space Complexity:O(n)
def merge(left, right): # Function to merge sorted lists
i, j = 0, 0
result = []
while i < len(left) and j < len(right):
if left[i] <= right[j]:
result.append(left[i])
i += 1
... | def merge(left, right):
(i, j) = (0, 0)
result = []
while i < len(left) and j < len(right):
if left[i] <= right[j]:
result.append(left[i])
i += 1
else:
result.append(right[j])
j += 1
result += left[i:]
result += right[j:]
return res... |
class Sleigh(object):
def authenticate(self, name, password):
if name == 'Santa Claus' and password == 'Ho Ho Ho!':
return True
return False | class Sleigh(object):
def authenticate(self, name, password):
if name == 'Santa Claus' and password == 'Ho Ho Ho!':
return True
return False |
# Space : O(n)
# Time : O(n**2)
class Solution:
def fourSumCount(self, A: List[int], B: List[int], C: List[int], D: List[int]) -> int:
hashmap = {}
ans = 0
for i in A:
for j in B:
if i + j not in hashmap:
hashmap[i+j] = 1
... | class Solution:
def four_sum_count(self, A: List[int], B: List[int], C: List[int], D: List[int]) -> int:
hashmap = {}
ans = 0
for i in A:
for j in B:
if i + j not in hashmap:
hashmap[i + j] = 1
else:
hashmap... |
"""
Just Add the func for your own template Lol
you can design at
https://developers.line.biz/console/fx/
thx to me arsybai hehe :3
"""
class flexTemplate:
def __init__(self):
return None
def contoh(self):
this = {
"type": "bubble",
"hero": {
"type": "image",
"url": "https://scdn... | """
Just Add the func for your own template Lol
you can design at
https://developers.line.biz/console/fx/
thx to me arsybai hehe :3
"""
class Flextemplate:
def __init__(self):
return None
def contoh(self):
this = {'type': 'bubble', 'hero': {'type': 'image', 'url': 'https://scdn.line-apps.co... |
default_db_extra = """{
"metadata_params": {},
"engine_params": {},
"metadata_cache_timeout": {},
"schemas_allowed_for_csv_upload": []
}"""
| default_db_extra = '{\n "metadata_params": {},\n "engine_params": {},\n "metadata_cache_timeout": {},\n "schemas_allowed_for_csv_upload": []\n}' |
# writing a check if a number is a plaindrome in a quick and easy way
string = input("Please enter a string to check : ")
def palindrome():
if string == string[:: -1]:
return True
else:
return False
string = palindrome()
if string == True:
print("This is a palindrome string")
else:
... | string = input('Please enter a string to check : ')
def palindrome():
if string == string[::-1]:
return True
else:
return False
string = palindrome()
if string == True:
print('This is a palindrome string')
else:
print('This is not a palindrome') |
class Users():
def __init__(self, http_client):
self.http_client = http_client
self.users = {}
async def get_picture(self, user):
if user in self.users:
info = self.users[user]
else:
info = await self.http_client.get_user_info(user)
self.u... | class Users:
def __init__(self, http_client):
self.http_client = http_client
self.users = {}
async def get_picture(self, user):
if user in self.users:
info = self.users[user]
else:
info = await self.http_client.get_user_info(user)
self.users[... |
try:
f = open("my.txt")
except Exception as e:
print(e)
print("Important Stuff") | try:
f = open('my.txt')
except Exception as e:
print(e)
print('Important Stuff') |
#! /usr/bin/env python3
# coding=utf-8
def main():
for n in range(1, 11):
print(f"{n:2} {n**2:3} {n**3:4}")
if __name__ == "__main__":
main()
| def main():
for n in range(1, 11):
print(f'{n:2} {n ** 2:3} {n ** 3:4}')
if __name__ == '__main__':
main() |
"""Module allowing dynamically to create and further on to edit via django-admin settings"""
# About
__author__ = "Vadym Zabiiaka"
__email__ = "v.zabiiaka@gmail.com"
__program__ = "django-stored-settings"
__version__ = "0.2.1"
| """Module allowing dynamically to create and further on to edit via django-admin settings"""
__author__ = 'Vadym Zabiiaka'
__email__ = 'v.zabiiaka@gmail.com'
__program__ = 'django-stored-settings'
__version__ = '0.2.1' |
#!/usr/bin/python3
polymer = list(open('input.in').read()[:-1])
letters = [chr(x) for x in range(ord('a'), ord('z') + 1)]
total = len(polymer)
def get_len(polymer):
result_polymer = [' ', polymer[0]]
for index in range(1, len(polymer)):
r = polymer[index]
l = result_polymer[-1]
if l.lo... | polymer = list(open('input.in').read()[:-1])
letters = [chr(x) for x in range(ord('a'), ord('z') + 1)]
total = len(polymer)
def get_len(polymer):
result_polymer = [' ', polymer[0]]
for index in range(1, len(polymer)):
r = polymer[index]
l = result_polymer[-1]
if l.lower() == r.lower() a... |
Othman = Goalkeeper('Hafizuddin Othman', 74, 72, 68, 70)
Rahim = Outfield_Player('Razie Rahim', 'DF', 70, 71, 71, 72, 69, 73)
Hassan = Outfield_Player('Azi Hassan', 'MF', 77, 73, 76, 71, 74, 72)
Saari = Outfield_Player('Fitri Saari', 'MF', 76, 71, 67, 68, 70, 72)
Saabah = Outfield_Player('Shahril Saabah', 'FW', 71,... | othman = goalkeeper('Hafizuddin Othman', 74, 72, 68, 70)
rahim = outfield__player('Razie Rahim', 'DF', 70, 71, 71, 72, 69, 73)
hassan = outfield__player('Azi Hassan', 'MF', 77, 73, 76, 71, 74, 72)
saari = outfield__player('Fitri Saari', 'MF', 76, 71, 67, 68, 70, 72)
saabah = outfield__player('Shahril Saabah', 'FW', 71,... |
def solve_coin_change(denominations, amount):
solution = [0] * (amount + 1)
solution[0] = 1;
for den in denominations:
for i in range(den, amount + 1):
solution[i] += solution[i - den]
return solution[len(solution) - 1]
print(solve_coin_change([1,2,5], 7)) | def solve_coin_change(denominations, amount):
solution = [0] * (amount + 1)
solution[0] = 1
for den in denominations:
for i in range(den, amount + 1):
solution[i] += solution[i - den]
return solution[len(solution) - 1]
print(solve_coin_change([1, 2, 5], 7)) |
class Locadora:
def __init__(self):
self.filmes = []
def adicionar_filme(self, filme):
self.filmes.append(filme)
def listar_filmes(self):
for filme in self.filmes:
print(filme.nome)
class Filme:
def __init__(self, nome):
self.nome = nome
locadora = Loc... | class Locadora:
def __init__(self):
self.filmes = []
def adicionar_filme(self, filme):
self.filmes.append(filme)
def listar_filmes(self):
for filme in self.filmes:
print(filme.nome)
class Filme:
def __init__(self, nome):
self.nome = nome
locadora = locado... |
cc_pvdz = { "H" : 1, "He" : 1, "Li" : 0, "Be" : 0, "B" : 1, "C" : 1, "N" : 1, \
"O" : 1, "F" : 1, "Ne" : 1, "Na" : 0, "Mg" : 0, "Al" : 1, "Si" : 1, \
"P" : 1, "S" : 1, "Cl" : 1, "Ar" : 1, "K" : 0, "Ca" : 0 }
cc_pvtz = { "H" : 7, "He" : 2, "Li" : 0, "Be" : 0, "B" : 2, "C" : 6, "N" : 6, \
... | cc_pvdz = {'H': 1, 'He': 1, 'Li': 0, 'Be': 0, 'B': 1, 'C': 1, 'N': 1, 'O': 1, 'F': 1, 'Ne': 1, 'Na': 0, 'Mg': 0, 'Al': 1, 'Si': 1, 'P': 1, 'S': 1, 'Cl': 1, 'Ar': 1, 'K': 0, 'Ca': 0}
cc_pvtz = {'H': 7, 'He': 2, 'Li': 0, 'Be': 0, 'B': 2, 'C': 6, 'N': 6, 'O': 6, 'F': 6, 'Ne': 2, 'Na': 10, 'Mg': 0, 'Al': 2, 'Si': 2, 'P': 2... |
"""
Write a program to check whether a given number is an ugly number.
Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it includes another prime factor 7.
Note that 1 is typically treated as an ugly number.
"""
class Solution(object)... | """
Write a program to check whether a given number is an ugly number.
Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it includes another prime factor 7.
Note that 1 is typically treated as an ugly number.
"""
class Solution(object)... |
def change_second_char(s, c):
return s[0] + c + s[2:]
print(change_second_char("bald", "o"))
print(change_second_char("stitch", "w"))
print(change_second_char("shell","m"))
print()
def change_index_char(s, c, i):
if i >= len(s) or i < -len(s):
return "Error: index out of range"
return s[0:i] + c +... | def change_second_char(s, c):
return s[0] + c + s[2:]
print(change_second_char('bald', 'o'))
print(change_second_char('stitch', 'w'))
print(change_second_char('shell', 'm'))
print()
def change_index_char(s, c, i):
if i >= len(s) or i < -len(s):
return 'Error: index out of range'
return s[0:i] + c +... |
'''
Source : https://leetcode.com/problems/flipping-an-image/
Author : Yuan Wang
Date : 2018-06-16
/**********************************************************************************
*Given a binary matrix A, we want to flip the image horizontally, then invert it,
*and return the resulting image.
*
*To flip an ima... | """
Source : https://leetcode.com/problems/flipping-an-image/
Author : Yuan Wang
Date : 2018-06-16
/**********************************************************************************
*Given a binary matrix A, we want to flip the image horizontally, then invert it,
*and return the resulting image.
*
*To flip an ima... |
#!/usr/bin/env python3
# coding: utf-8
__author__ = 'ytyng'
__version__ = '0.3.0'
__license__ = 'BSD'
| __author__ = 'ytyng'
__version__ = '0.3.0'
__license__ = 'BSD' |
class Field:
def __init__(self, type, name):
self.type = type
self.name = name
def __str__(self):
return "type: {} name: {}".format(self.type, self.name)
class Class:
def __init__(self, name):
self.name = name
self.fields = {}
self.margin = 2
def __str... | class Field:
def __init__(self, type, name):
self.type = type
self.name = name
def __str__(self):
return 'type: {} name: {}'.format(self.type, self.name)
class Class:
def __init__(self, name):
self.name = name
self.fields = {}
self.margin = 2
def __st... |
class Player:
def __init__(self, name, hp, mp):
self.name = name
self.hp = hp
self.mp = mp
self.skills = {}
self.guild = "Unaffiliated"
def add_skill(self, skill_name, mana_cost):
if skill_name in self.skills:
return "Skill already added"
self... | class Player:
def __init__(self, name, hp, mp):
self.name = name
self.hp = hp
self.mp = mp
self.skills = {}
self.guild = 'Unaffiliated'
def add_skill(self, skill_name, mana_cost):
if skill_name in self.skills:
return 'Skill already added'
sel... |
x = 0
while x < 5:
print(x)
x = x + 1
print(x)
print("########")
x = 0
while x < 5:
x = x + 1
print(x)
print(x)
print("########")
y = 0
while y < 5:
print(y)
y = y + 2
print(y) | x = 0
while x < 5:
print(x)
x = x + 1
print(x)
print('########')
x = 0
while x < 5:
x = x + 1
print(x)
print(x)
print('########')
y = 0
while y < 5:
print(y)
y = y + 2
print(y) |
def reverseText(inputPath, outputPath):
with open(outputPath, "w") as outputFile:
with open(inputPath) as inputFile:
content = inputFile.read()
outputFile.write(content[::-1]) | def reverse_text(inputPath, outputPath):
with open(outputPath, 'w') as output_file:
with open(inputPath) as input_file:
content = inputFile.read()
outputFile.write(content[::-1]) |
suits = []
def is_flush(lists):
for s in lists:
card_type = s[-1]
suits.append(card_type)
if suits.count(suits[0]) == len(suits):
print("True")
else:
print("False")
card1 = input('Input: ').split(', ')
is_flush(card1)
def high_card(list):
max=0
fo... | suits = []
def is_flush(lists):
for s in lists:
card_type = s[-1]
suits.append(card_type)
if suits.count(suits[0]) == len(suits):
print('True')
else:
print('False')
card1 = input('Input: ').split(', ')
is_flush(card1)
def high_card(list):
max = 0
for r in list:
... |
class treenode:
def __init__(self,val = 0 , left= None, right = None):
self.val = val
self.left = left
self.right = right
class solution:
def buildtree(self,preorder,inorder):
memory = {}
for index,key in enumerate(inorder):
memory[key] = index
... | class Treenode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def buildtree(self, preorder, inorder):
memory = {}
for (index, key) in enumerate(inorder):
memory[key] = index
root... |
#checks if a year passed is a leap year
#all years diisible by 400 are leap years
#then all years divisible by 4 but not by 100 are also leap years
def is_leap_year(year):
return year % 400 == 0 or (year % 4 == 0 and year % 100 != 0) | def is_leap_year(year):
return year % 400 == 0 or (year % 4 == 0 and year % 100 != 0) |
class ApiKeyError(Exception):
pass
class UserNotExist(Exception):
pass
| class Apikeyerror(Exception):
pass
class Usernotexist(Exception):
pass |
def nextPermutation(nums):
n=len(nums)
for i in range(n-1,0,-1):
if nums[i]>nums[i-1]:
nums[i:]=sorted(nums[i:])
for j in range(i,n):
if nums[j]>nums[i-1]:
nums[j],nums[i-1]=nums[i-1],nums[j]
print(*nums)
... | def next_permutation(nums):
n = len(nums)
for i in range(n - 1, 0, -1):
if nums[i] > nums[i - 1]:
nums[i:] = sorted(nums[i:])
for j in range(i, n):
if nums[j] > nums[i - 1]:
(nums[j], nums[i - 1]) = (nums[i - 1], nums[j])
pr... |
class Luhn:
def __init__(self, card_num):
self.card_num = card_num # storing as astring not a number!
def valid(self):
clean_card_num = "" # store the clean number string here
for char in self.card_num:
if char.isnumeric(): # check if character is number and add it to clean_... | class Luhn:
def __init__(self, card_num):
self.card_num = card_num
def valid(self):
clean_card_num = ''
for char in self.card_num:
if char.isnumeric():
clean_card_num = f'{clean_card_num}{char}'
elif char == ' ':
continue
... |
# To be included in pyth.py
class PythParseError(Exception):
def __init__(self, active_char, rest_code):
self.active_char = active_char
self.rest_code = rest_code
def __str__(self):
return "%s is not implemented, %d from the end." % \
(self.active_char, len(self.rest_code... | class Pythparseerror(Exception):
def __init__(self, active_char, rest_code):
self.active_char = active_char
self.rest_code = rest_code
def __str__(self):
return '%s is not implemented, %d from the end.' % (self.active_char, len(self.rest_code) + 1)
class Unsafeinputerror(Exception):
... |
# bucket_counts, bucket_input, bucket_export = [int(a) for a in input().split()], list(()), set(())
# for each_bin in range(bucket_counts[0]): bucket_input.append([int(b) for b in input().split()])
# for bucket_output in [int(c)-1 for c in input().split()]:
# for each_bucket in range(bucket_counts[0]):
# ... | (bucket_counts, bucket_input, bucket_info) = ([int(a) for a in input().split()], list(()), dict())
for each_bin in range(bucket_counts[0]):
bucket_input.append([int(b) for b in input().split()])
(bucket_require, bucket_contain, bucket_passed) = ([int(c) - 1 for c in input().split()], list(()), list(()))
for each_nb... |
def response(hey_bob):
"""
Bob is a lackadaisical teenager. In conversation,
his responses are very limited.
Bob answers 'Sure.' if you ask him a question,
such as "How are you?".
He answers 'Whoa, chill out!' if you
YELL AT HIM (in all capitals).
He answers 'Calm down, I know what I'... | def response(hey_bob):
"""
Bob is a lackadaisical teenager. In conversation,
his responses are very limited.
Bob answers 'Sure.' if you ask him a question,
such as "How are you?".
He answers 'Whoa, chill out!' if you
YELL AT HIM (in all capitals).
He answers 'Calm down, I know what I'... |
# paths
log_paths = './logs'
data_dir = "./data"
sample_dir = "./sample"
Image_size = 64
# hyperparameters for WGANGP
epochs = 20
hidden_dim=128
img_channels=3
learning_rate = 1e-4 # 5e-5
batch_size = 64
critic_iter = 5
lambda_GP = 10
| log_paths = './logs'
data_dir = './data'
sample_dir = './sample'
image_size = 64
epochs = 20
hidden_dim = 128
img_channels = 3
learning_rate = 0.0001
batch_size = 64
critic_iter = 5
lambda_gp = 10 |
def filter_backups_by_tags(backup_list, tags_equal={}, tags_not_equal={}):
def equals_filter(item):
for k, v in tags_equal.items():
return k in item.tags and item.tags[k] == v
return True
def not_equals_filter(item):
for k, v in tags_not_equal.items():
return k n... | def filter_backups_by_tags(backup_list, tags_equal={}, tags_not_equal={}):
def equals_filter(item):
for (k, v) in tags_equal.items():
return k in item.tags and item.tags[k] == v
return True
def not_equals_filter(item):
for (k, v) in tags_not_equal.items():
retur... |
__author__ = 'BrianAguirre'
f = open("data.txt", 'r')
text = f.read()
for i in range(0,51):
print(str(text.splitlines()[i].split()) + ",") | __author__ = 'BrianAguirre'
f = open('data.txt', 'r')
text = f.read()
for i in range(0, 51):
print(str(text.splitlines()[i].split()) + ',') |
def as_bool(value):
'''
Smart cast value to bool
'''
if isinstance(value, bool):
return value
value = value.strip().lower()
if value in ('y', 'yes', 'on', 't', 'true', '1'):
return True
if value in ('n', 'no', 'off', 'f', 'false', '0'):
return False
raise ValueE... | def as_bool(value):
"""
Smart cast value to bool
"""
if isinstance(value, bool):
return value
value = value.strip().lower()
if value in ('y', 'yes', 'on', 't', 'true', '1'):
return True
if value in ('n', 'no', 'off', 'f', 'false', '0'):
return False
raise value_er... |
for i in range(1,6):
for j in range (1,i):
print (j, end = '')
print ( )
| for i in range(1, 6):
for j in range(1, i):
print(j, end='')
print() |
Tables = dict()
for i in range(10):
Tables[i] = 0
def AddFee():
TableNo = int(input("TableNo: "))
ss = Tables[TableNo]
add = float(input("Add to fee "))
Total = ss + add
Tables[TableNo] = Total
def DelFee():
TableNo = int(input("TableNo: "))
ss = Tables[TableNo]
add = float(input("Add... | tables = dict()
for i in range(10):
Tables[i] = 0
def add_fee():
table_no = int(input('TableNo: '))
ss = Tables[TableNo]
add = float(input('Add to fee '))
total = ss + add
Tables[TableNo] = Total
def del_fee():
table_no = int(input('TableNo: '))
ss = Tables[TableNo]
add = float(in... |
fruit = 'Banana'
letter = fruit[1]
print(letter)
# 0 is the first letter
fruit = 'Banana'
letter = fruit[0]
print(letter)
print(len('banana')*7)
| fruit = 'Banana'
letter = fruit[1]
print(letter)
fruit = 'Banana'
letter = fruit[0]
print(letter)
print(len('banana') * 7) |
colour = 'red'
size = 5
quantity = 3
area = 0
sam = {
'ham': 'green',
'eggs': 'green'
}
class Box:
donuts = 5
def post_import(config):
config['area'] = config['size'] * config['quantity']
print('area is being calculated')
| colour = 'red'
size = 5
quantity = 3
area = 0
sam = {'ham': 'green', 'eggs': 'green'}
class Box:
donuts = 5
def post_import(config):
config['area'] = config['size'] * config['quantity']
print('area is being calculated') |
def sum_of_numbers_iterative(n):
the_sum=0
for i in range(n):
the_sum += (i+1)
return the_sum
print(sum_of_numbers_iterative(int(input("Enter a number: "))))
#5+4+3+2+1=15
#Too high a number give:
#RecursionError: maximum recursion depth exceeded in comparison
| def sum_of_numbers_iterative(n):
the_sum = 0
for i in range(n):
the_sum += i + 1
return the_sum
print(sum_of_numbers_iterative(int(input('Enter a number: ')))) |
"""
Question 1) How would you find the number equal or of if the equal not found, closest number that is less in a sorted array.
"""
def find_closest(lst, n):
"""
:type l: list
:type n: int
:rtype: int
Finds the largest number equal to or less than a provided number in a sorted list
... | """
Question 1) How would you find the number equal or of if the equal not found, closest number that is less in a sorted array.
"""
def find_closest(lst, n):
"""
:type l: list
:type n: int
:rtype: int
Finds the largest number equal to or less than a provided number in a sorted list
"""
num... |
"""
New BSD
Copyright (c) 2008, John D'Errico, Per A. Brodtkorb
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
a. Redistributions of source code must retain the above copyright notice,
... | """
New BSD
Copyright (c) 2008, John D'Errico, Per A. Brodtkorb
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
a. Redistributions of source code must retain the above copyright notice,
this l... |
# -*- coding: utf-8 -*-
class Solution:
def is_match(self, s: str, p: str) -> bool:
if not p:
return not s
first_match = bool(s) and p[0] in ('.', s[0])
if len(p) >= 2 and p[1] == '*':
if first_match:
return self.is_match(s[1:], p) or self.is_match... | class Solution:
def is_match(self, s: str, p: str) -> bool:
if not p:
return not s
first_match = bool(s) and p[0] in ('.', s[0])
if len(p) >= 2 and p[1] == '*':
if first_match:
return self.is_match(s[1:], p) or self.is_match(s, p[2:])
retu... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 17 09:03:21 2018
@author: dietz
"""
| """
Created on Fri Aug 17 09:03:21 2018
@author: dietz
""" |
#Author: Jocelino F.G
x = input().split()
A,B,C,D = x
A = int(A)
B = int(B)
C = int(C)
D = int(D)
if (B>C and D>A and (D+C)>(A+B) and C>0 and D>0 and A%2==0):
print("Valores aceitos")
else:
print("Valores nao aceitos")
| x = input().split()
(a, b, c, d) = x
a = int(A)
b = int(B)
c = int(C)
d = int(D)
if B > C and D > A and (D + C > A + B) and (C > 0) and (D > 0) and (A % 2 == 0):
print('Valores aceitos')
else:
print('Valores nao aceitos') |
if __name__ == '__main__':
n = int(input())
arr = map(int, input().split())
#print (sorted(set(arr)))
#Score = (n, list(arr))
#print (Score)
Score = set(list(arr))
#print (Score)
j = sorted(Score)
print (j[-2]) | if __name__ == '__main__':
n = int(input())
arr = map(int, input().split())
score = set(list(arr))
j = sorted(Score)
print(j[-2]) |
def is_prime(value, know_primes=[]):
'''
Given a list of prime numbers, check if a number is a prime number
'''
if (max(know_primes)**2) > value:
for prime in know_primes:
if (value % prime) == 0:
return False
return True
else:
raise ValueError('List of known primes is too short for the given value'... | def is_prime(value, know_primes=[]):
"""
Given a list of prime numbers, check if a number is a prime number
"""
if max(know_primes) ** 2 > value:
for prime in know_primes:
if value % prime == 0:
return False
return True
else:
raise value_error('List of k... |
with open("input.txt", 'r') as inpt:
line = inpt.read().split("\n\n")
count = sum([len(set([c for c in group if not c.isspace()])) for group in line])
print("Part 1:")
print(count)
groups = [[set(person) for person in group.splitlines()] for group in line]
intersections = sum(len(set.intersection(*... | with open('input.txt', 'r') as inpt:
line = inpt.read().split('\n\n')
count = sum([len(set([c for c in group if not c.isspace()])) for group in line])
print('Part 1:')
print(count)
groups = [[set(person) for person in group.splitlines()] for group in line]
intersections = sum((len(set.intersection(*grou... |
class TornadoApp:
def add_api(self, yaml=None):
pass
def listen(self, port):
pass
| class Tornadoapp:
def add_api(self, yaml=None):
pass
def listen(self, port):
pass |
#!/usr/bin/python3
#
# codec.py
# - encodes (lat,lng) to geohash.
# - decodes geohash to (lat_range,lng_range).
# Geohash:
# https://en.wikipedia.org/wiki/Geohash
#
BASE32 = '0123456789bcdefghjkmnpqrstuvwxyz'
BASE32_TO_DECIMAL = dict((BASE32[i], i) for i in range(len(BASE32)))
def bits2char(bits):
return BASE32[bi... | base32 = '0123456789bcdefghjkmnpqrstuvwxyz'
base32_to_decimal = dict(((BASE32[i], i) for i in range(len(BASE32))))
def bits2char(bits):
return BASE32[bits]
def char2bits(char):
return BASE32_TO_DECIMAL[char]
def midpoint(seq):
assert len(seq) == 2
return (seq[0] + seq[1]) / 2.0
def lower_half(seq):
... |
base_url = "https://portal.getpaidinbitcoin.com.au"
login_url = "/account/login"
reset_password_url = "/Account/ForgotPassword"
reset_confirmation_url = "/Account/ForgotPasswordConfirmation"
dashboard_url = "/Dashboard"
register_url = "/Account/Register"
test_user = "alice@getpaidinbitcoin.com.au"
test_password = "Test... | base_url = 'https://portal.getpaidinbitcoin.com.au'
login_url = '/account/login'
reset_password_url = '/Account/ForgotPassword'
reset_confirmation_url = '/Account/ForgotPasswordConfirmation'
dashboard_url = '/Dashboard'
register_url = '/Account/Register'
test_user = 'alice@getpaidinbitcoin.com.au'
test_password = 'Test... |
SIGNATURE_KEYS = ['signature', 'timestamp', 'nonce', 'echostr']
ENCRYPT_SIGNATURE_KEYS = ['signature', 'timestamp', 'nonce', 'msg_signature']
MSG_KEYS = ['ToUserName', 'FromUserName', 'MsgType', 'Content']
OTHER_MSG_TYPE = ['image', 'voice', 'video', 'shortvideo', 'location', 'link']
REPLY_STR = '''<xml>
... | signature_keys = ['signature', 'timestamp', 'nonce', 'echostr']
encrypt_signature_keys = ['signature', 'timestamp', 'nonce', 'msg_signature']
msg_keys = ['ToUserName', 'FromUserName', 'MsgType', 'Content']
other_msg_type = ['image', 'voice', 'video', 'shortvideo', 'location', 'link']
reply_str = '<xml>\n ... |
a = b = c = d = e = f = 42
print(c)
x, y, z = 1, 2, 76
print(x)
print(y)
print(z)
print("Unpacking a tuple")
data = 1, 2, 76 # data represents a tuple
x, y, z = data
print(x)
print(y)
print(z)
print("Unpacking a list")
data_list = [12, 13, 14]
data_list.append(15)
p, q, r = data_list
print(p)
print(q)
print(r)
| a = b = c = d = e = f = 42
print(c)
(x, y, z) = (1, 2, 76)
print(x)
print(y)
print(z)
print('Unpacking a tuple')
data = (1, 2, 76)
(x, y, z) = data
print(x)
print(y)
print(z)
print('Unpacking a list')
data_list = [12, 13, 14]
data_list.append(15)
(p, q, r) = data_list
print(p)
print(q)
print(r) |
# -*- coding: utf-8 -*-
while True:
a, b, c, d = input().split()
a = int(a)
b = int(b)
c = int(c)
d = int(d)
if (a + b + c + d) == 0:
break
x = c * (a/2 + b) / d
print("%.5f" % x) | while True:
(a, b, c, d) = input().split()
a = int(a)
b = int(b)
c = int(c)
d = int(d)
if a + b + c + d == 0:
break
x = c * (a / 2 + b) / d
print('%.5f' % x) |
class perifecos():
def __init__(self, fone, mouse, teclado, monitor,):
self.fone = fone
self.mouse = mouse
self.teclado = teclado
self.monitor = monitor
class specdopc():
def __init__(self, processador, memoria_ram, placa_de_video, fonte):
self.processador = processador... | class Perifecos:
def __init__(self, fone, mouse, teclado, monitor):
self.fone = fone
self.mouse = mouse
self.teclado = teclado
self.monitor = monitor
class Specdopc:
def __init__(self, processador, memoria_ram, placa_de_video, fonte):
self.processador = processador
... |
if __name__ == '__main__':
with open('test_input', 'r') as file:
hmap = [[int(y) for y in x.strip()] for x in file.readlines()]
def surround(x, y):
cords = [
(x - 1, y),
(x, y - 1),
(x, y + 1),
(x + 1, y),
]
return [hmap[i][j] for ... | if __name__ == '__main__':
with open('test_input', 'r') as file:
hmap = [[int(y) for y in x.strip()] for x in file.readlines()]
def surround(x, y):
cords = [(x - 1, y), (x, y - 1), (x, y + 1), (x + 1, y)]
return [hmap[i][j] for (i, j) in cords if 0 <= i <= len(hmap) - 1 and 0 <= j <= le... |
"""
Implementation of the data structure "BinarySearchTree"
"""
class Node: # pylint: disable=too-few-public-methods
"""
Node Structure
"""
def __init__(self, root, left_node=None, right_node=None):
self.root = root
self.left_node = left_node
self.right_node = right_node
c... | """
Implementation of the data structure "BinarySearchTree"
"""
class Node:
"""
Node Structure
"""
def __init__(self, root, left_node=None, right_node=None):
self.root = root
self.left_node = left_node
self.right_node = right_node
class Binarysearchtree:
"""
Binary se... |
btfnx_api_url = {
'host': 'api.bitfinex.com',
# Public API
'ticker': 'https://api.bitfinex.com/v1/pubticker/',
'stats': 'https://api.bitfinex.com/v1/stats/',
'funding_book': 'https://api.bitfinex.com/v1/lendbook/',
'order_book': 'https://api.bitfinex.com/v1/book/',
'tradesInfo': 'https://api... | btfnx_api_url = {'host': 'api.bitfinex.com', 'ticker': 'https://api.bitfinex.com/v1/pubticker/', 'stats': 'https://api.bitfinex.com/v1/stats/', 'funding_book': 'https://api.bitfinex.com/v1/lendbook/', 'order_book': 'https://api.bitfinex.com/v1/book/', 'tradesInfo': 'https://api.bitfinex.com/v1/trades/', 'lends': 'https... |
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the co... | source('../../shared/qtcreator.py')
def verify_change_project(projectName):
proj_item = invoke_context_menu_on_project(projectName, 'Set "%s" as Active Project' % projectName)
wait_for('projItem.font.bold==True', 3000)
test.verify(projItem.font.bold == True, 'Multiple projects - verifying if active project... |
'''
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, p... | """
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, p... |
"""
1. Print a Linked List
2. Length of a linked list
3. Node at a given index in linked list
4. Delete a node by index
5. Append
Explanation
address
node[data,next]
1. initial
2001
[None,None]
2. Secondly
2001 3001
[None,3001] -> [3,None]
3. Continue repeat
2001 3001 4001 5001... | """
1. Print a Linked List
2. Length of a linked list
3. Node at a given index in linked list
4. Delete a node by index
5. Append
Explanation
address
node[data,next]
1. initial
2001
[None,None]
2. Secondly
2001 3001
[None,3001] -> [3,None]
3. Continue repeat
2001 3001 4001 5001... |
# Village People, 2017
BUILDER_TYPES = ["VillagePeople18Binary",
"Malmo",
"Symbolic"]
| builder_types = ['VillagePeople18Binary', 'Malmo', 'Symbolic'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.