content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def fibonacci(n): if n == 1 or n == 2: return 1 return fibonacci(n-1) + fibonacci(n-2)
def fibonacci(n): if n == 1 or n == 2: return 1 return fibonacci(n - 1) + fibonacci(n - 2)
class Event(): def __init__(self, id, dateTime, userId): self.id = id self.dateTime = dateTime self.userId = userId def getDateTime(self): return self.dateTime def getUserId(self): return self.userId class Scheduler(): def __init__(self): self.calendar...
class Event: def __init__(self, id, dateTime, userId): self.id = id self.dateTime = dateTime self.userId = userId def get_date_time(self): return self.dateTime def get_user_id(self): return self.userId class Scheduler: def __init__(self): self.calenda...
# -*- coding: utf-8 -*- # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def mergeTwoLists(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode ...
class Solution(object): def merge_two_lists(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ if not l1: return l2 if not l2: return l1 if l1.val < l2.val: l1.next = self.mergeTwoLists(l1...
class Solution: # @return an integer def maxArea(self, height): n = len(height) i = 0 j = n - 1 max_area = 0 while i < j: max_area = max(max_area, (j - i) * min(height[i], height[j])) if height[i] <= height[j]: i += 1 el...
class Solution: def max_area(self, height): n = len(height) i = 0 j = n - 1 max_area = 0 while i < j: max_area = max(max_area, (j - i) * min(height[i], height[j])) if height[i] <= height[j]: i += 1 else: j -...
#!/usr/bin/env python """Solution for problem C to Codejam 2016, Round 1B of Martin Thoma.""" def get_dicts(topics): a_words = {} b_words = {} for a, b in topics: if a in a_words: a_words[a] += 1 else: a_words[a] = 1 if b in b_words: b_words[b]...
"""Solution for problem C to Codejam 2016, Round 1B of Martin Thoma.""" def get_dicts(topics): a_words = {} b_words = {} for (a, b) in topics: if a in a_words: a_words[a] += 1 else: a_words[a] = 1 if b in b_words: b_words[b] += 1 else: ...
class InfoUnavailableError(ValueError): """CloudVolume was unable to access this layer's info file.""" pass class ScaleUnavailableError(IndexError): """The info file is not configured to support this scale / mip level.""" pass class AlignmentError(ValueError): """Signals that an operation requiring chunk a...
class Infounavailableerror(ValueError): """CloudVolume was unable to access this layer's info file.""" pass class Scaleunavailableerror(IndexError): """The info file is not configured to support this scale / mip level.""" pass class Alignmenterror(ValueError): """Signals that an operation requirin...
def isnotebook(): try: shell = get_ipython().__class__.__name__ if shell == 'ZMQInteractiveShell': return True # Jupyter notebook or qtconsole elif shell == 'TerminalInteractiveShell': return False # Terminal running IPython else: return...
def isnotebook(): try: shell = get_ipython().__class__.__name__ if shell == 'ZMQInteractiveShell': return True elif shell == 'TerminalInteractiveShell': return False else: return False except NameError: return False
l = [*map(int, input().split())] l.sort() if l[0]+l[3] == l[1]+l[2] or l[3] == l[0]+l[1]+l[2]: print("YES") else: print("NO")
l = [*map(int, input().split())] l.sort() if l[0] + l[3] == l[1] + l[2] or l[3] == l[0] + l[1] + l[2]: print('YES') else: print('NO')
def is_positive(num): if int(num) > 0: return True else: return False def is_negative(num): if int(num) < 0: return True else: return False def is_zero(num): if int(num) == 0: return True else: return False def is_odd(num): if int(num) <=...
def is_positive(num): if int(num) > 0: return True else: return False def is_negative(num): if int(num) < 0: return True else: return False def is_zero(num): if int(num) == 0: return True else: return False def is_odd(num): if int(num) <= 0:...
def factorial(curr): g = 1 for i in range(1, curr + 1): g *= i return g def non_recurrsion(): num = 1 try: row = int(input("Enter number of rows:")) except: print("Invalid input. Please enter an integer") exit(1) for i in range(1, row + 1): for j in...
def factorial(curr): g = 1 for i in range(1, curr + 1): g *= i return g def non_recurrsion(): num = 1 try: row = int(input('Enter number of rows:')) except: print('Invalid input. Please enter an integer') exit(1) for i in range(1, row + 1): for j in r...
# -*- coding: utf-8 -*- """Container for all required classes.""" # __init__.py # # Created by Thomas Nelson <tn90ca@gmail.com> # Created..........................2015-01-25 # Modified.........................2015-01-25 # # This module was developed for use in the Bugs project. # # Copyright (C) 2015 Thomas Nelson _...
"""Container for all required classes.""" __all__ = ['dna', 'brain', 'bug', 'food', 'world']
def can_build(env, platform): return platform == "windows" # For now, GGPO isn't available on linux or mac def configure(env): env.Append(CPPPATH=["#modules/godotggpo/sdk/include/"]) if env["platform"] == "windows": if env["CC"] == "cl": env.Append(LINKFLAGS=["GGPO.lib"]) ...
def can_build(env, platform): return platform == 'windows' def configure(env): env.Append(CPPPATH=['#modules/godotggpo/sdk/include/']) if env['platform'] == 'windows': if env['CC'] == 'cl': env.Append(LINKFLAGS=['GGPO.lib']) env.Append(LIBPATH=['#modules/godotggpo/sdk/bin'])...
print("find greatest common divisor:") def gcd(m, n): cf = [] for i in range (1,min(m,n)+1): if (m%i) == 0 and (n%i) == 0 : cf.append(i) print(cf) print(cf[-1]) gcd(int(input()), int(input()))
print('find greatest common divisor:') def gcd(m, n): cf = [] for i in range(1, min(m, n) + 1): if m % i == 0 and n % i == 0: cf.append(i) print(cf) print(cf[-1]) gcd(int(input()), int(input()))
def object_function_apply_by_key(object_to_apply, key_to_find, function_to_apply): if object_to_apply: if isinstance(object_to_apply, list) and len(object_to_apply) > 0: for item in object_to_apply: object_function_apply_by_key(item, key_to_find, function_to_apply) el...
def object_function_apply_by_key(object_to_apply, key_to_find, function_to_apply): if object_to_apply: if isinstance(object_to_apply, list) and len(object_to_apply) > 0: for item in object_to_apply: object_function_apply_by_key(item, key_to_find, function_to_apply) elif i...
# encoding: utf-8 """ @version: v1.0 @author: Richard @license: Apache Licence @contact: billions.richard@qq.com @site: @software: PyCharm @time: 2019/11/10 10:50 """ class TreeNode(object): def __init__(self, val, left: 'TreeNode ' = None, right: 'TreeNode ' = None):...
""" @version: v1.0 @author: Richard @license: Apache Licence @contact: billions.richard@qq.com @site: @software: PyCharm @time: 2019/11/10 10:50 """ class Treenode(object): def __init__(self, val, left: 'TreeNode '=None, right: 'TreeNode '=None): self.val = val self.left = left se...
r="" for _ in range(int(input())): x=int(input()) if abs(x)%2==0: r+=str(x)+" is even\n" else: r+=str(x)+" is odd\n" print(r,end="")
r = '' for _ in range(int(input())): x = int(input()) if abs(x) % 2 == 0: r += str(x) + ' is even\n' else: r += str(x) + ' is odd\n' print(r, end='')
def slider_event_cb(slider, event): if event == lv.EVENT.VALUE_CHANGED: slider_label.set_text("%u" % slider.get_value()) # Create a slider in the center of the display slider = lv.slider(lv.scr_act()) slider.set_width(200) slider.align(None, lv.ALIGN.CENTER, 0, 0) slider.set_event_cb(slider_event_cb) slide...
def slider_event_cb(slider, event): if event == lv.EVENT.VALUE_CHANGED: slider_label.set_text('%u' % slider.get_value()) slider = lv.slider(lv.scr_act()) slider.set_width(200) slider.align(None, lv.ALIGN.CENTER, 0, 0) slider.set_event_cb(slider_event_cb) slider.set_range(0, 100) slider_label = lv.label(lv.s...
# Dictionaries # Giving a key value and calling my_stuff = {'key1': "123", "key2": "Value of key2"} print(my_stuff['key1']) print(my_stuff['key2']) # Something nexted my_stuff2 = {'key1': "123", "key2": "Value of key2", 'key3': {'key4': [1, 3, 2]}} print(my_stuff2['key3']) print(my_stuff2['key3']['key4']) # This wil...
my_stuff = {'key1': '123', 'key2': 'Value of key2'} print(my_stuff['key1']) print(my_stuff['key2']) my_stuff2 = {'key1': '123', 'key2': 'Value of key2', 'key3': {'key4': [1, 3, 2]}} print(my_stuff2['key3']) print(my_stuff2['key3']['key4']) print(my_stuff, '= Dictionary 1') print(my_stuff2, '= Dictionary 2') my_stuff3 =...
def method1(str1, str2, m, n): # If first string is empty, the only option is to # insert all characters of second string into first if m == 0: return n # If second string is empty, the only option is to # remove all characters of first string if n == 0: return m # If last...
def method1(str1, str2, m, n): if m == 0: return n if n == 0: return m if str1[m - 1] == str2[n - 1]: return method1(str1, str2, m - 1, n - 1) return 1 + min(method1(str1, str2, m, n - 1), method1(str1, str2, m - 1, n), method1(str1, str2, m - 1, n - 1)) if __name__ == '__main__'...
# Copyright 2018, The Android Open Source Project # # 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 agree...
i0 = input('i0', ('TENSOR_FLOAT32', [2, 2])) o1 = output('o1', ('TENSOR_FLOAT32', [1, 2])) o2 = output('o2', ('TENSOR_FLOAT32', [2, 1])) o3 = output('o3', ('TENSOR_FLOAT32', [1])) model1 = model().Operation('MEAN', i0, [0], 1).To(o1) model2 = model().Operation('MEAN', i0, [1], 1).To(o2) model3 = model().Operation('MEAN...
class PushCrewBaseException(BaseException): """ Generic exception """ def __init__(self, *args, **kwargs): BaseException.__init__(self, *args, **kwargs)
class Pushcrewbaseexception(BaseException): """ Generic exception """ def __init__(self, *args, **kwargs): BaseException.__init__(self, *args, **kwargs)
# auth.signature add default fields like the created on/ create by/ modified by/ modified on db.define_table('blog_post', Field('title', requires=IS_NOT_EMPTY()), Field('body', 'text', requires=IS_NOT_EMPTY()), Field('photo', 'upload'), auth.signature) db.define_table('blog_comment', Field('blog_post', 'referenc...
db.define_table('blog_post', field('title', requires=is_not_empty()), field('body', 'text', requires=is_not_empty()), field('photo', 'upload'), auth.signature) db.define_table('blog_comment', field('blog_post', 'reference blog_post'), field('comments', 'text', requires=is_not_empty()), auth.signature) db.blog_post.titl...
""" --- Day 2: Dive! --- https://adventofcode.com/2021/day/2 summary: process directions to calculate depth and horizontal position Part 1 - 2322630 Part 2 - 2105273490 """ def load_data(): #datafile = 'input-day2-example' datafile = 'input-day2' data = [] with open(datafile, 'r') as input: f...
""" --- Day 2: Dive! --- https://adventofcode.com/2021/day/2 summary: process directions to calculate depth and horizontal position Part 1 - 2322630 Part 2 - 2105273490 """ def load_data(): datafile = 'input-day2' data = [] with open(datafile, 'r') as input: for line in input: line_li...
""" multithreading support. See: https://docs.micropython.org/en/v1.17/library/_thread.html |see_cpython_module| :mod:`python:_thread` https://docs.python.org/3/library/_thread.html . This module implements multithreading support. This module is highly experimental and its API is not yet fully settled and not yet de...
""" multithreading support. See: https://docs.micropython.org/en/v1.17/library/_thread.html |see_cpython_module| :mod:`python:_thread` https://docs.python.org/3/library/_thread.html . This module implements multithreading support. This module is highly experimental and its API is not yet fully settled and not yet de...
# ------------------------------------------------------------------ # Copyright (c) 2020 PyInstaller Development Team. # # This file is distributed under the terms of the GNU General Public # License (version 2.0 or later). # # The full license is available in LICENSE.GPL.txt, distributed with # this software. # # SPD...
hiddenimports = ['sklearn.neighbors.typedefs', 'sklearn.utils._cython_blas', 'sklearn.neighbors.quad_tree', 'sklearn.tree._utils']
pkgname = "libxshmfence" pkgver = "1.3" pkgrel = 0 build_style = "gnu_configure" configure_args = ["--with-shared-memory-dir=/dev/shm"] hostmakedepends = ["pkgconf"] makedepends = ["xorgproto"] pkgdesc = "X SyncFence synchronization primitive" maintainer = "q66 <q66@chimera-linux.org>" license = "MIT" url = "https://xo...
pkgname = 'libxshmfence' pkgver = '1.3' pkgrel = 0 build_style = 'gnu_configure' configure_args = ['--with-shared-memory-dir=/dev/shm'] hostmakedepends = ['pkgconf'] makedepends = ['xorgproto'] pkgdesc = 'X SyncFence synchronization primitive' maintainer = 'q66 <q66@chimera-linux.org>' license = 'MIT' url = 'https://xo...
nombre_archivo = input("Ingrese el nombre del archivo que contiene las palabras: ") archivo = open(nombre_archivo,"r") texto = archivo.read() palabras = texto.split() ocurrencias = {} for palabra in palabras: if ocurrencias.get(palabra): ocurrencias[palabra]+=1 else: ocurrencias[palabra]=1 ...
nombre_archivo = input('Ingrese el nombre del archivo que contiene las palabras: ') archivo = open(nombre_archivo, 'r') texto = archivo.read() palabras = texto.split() ocurrencias = {} for palabra in palabras: if ocurrencias.get(palabra): ocurrencias[palabra] += 1 else: ocurrencias[palabra] = 1 ...
#!/usr/bin/python # ============================================================================== # Author: Tao Li (taoli@ucsd.edu) # Date: May 1, 2015 # Question: 009-Palindrome-Number # Link: https://leetcode.com/problems/palindrome-number/ # ================================================================...
class Solution: def is_palindrome(self, x): if x < 0: return False tmp_str = str(x) for i in range(0, len(tmp_str) / 2): if tmp_str[i] != tmp_str[-(i + 1)]: return False return True
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def trellis_deps(): maybe( http_archive, name = "ecal", build_file = Label("//third_party:ecal.BUILD"), sha256 = "1d83d3accfb4a936ffd343524e4a626f0265e...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe') def trellis_deps(): maybe(http_archive, name='ecal', build_file=label('//third_party:ecal.BUILD'), sha256='1d83d3accfb4a936ffd343524e4a626f0265e600226d6e997b3dbbd7f62eaac6', strip_pre...
# VOLTAGE and CURRENT #: Unit for Voltage UNIT_VOLT = 'V' #: Unit for Voltage*10^-3 UNIT_MILLI_VOLT = 'mV' #: Unit for Current UNIT_AMPERE = 'A' #: Unit for Current*10^-3 UNIT_MILLI_AMPERE = 'mA' #: Unit for Current*10^-6 UNIT_MICRO_AMPERE = 'uA' # FREQUENCY #: Unit for Frequencies UNIT_HERTZ = 'Hz' #: Unit for Freque...
unit_volt = 'V' unit_milli_volt = 'mV' unit_ampere = 'A' unit_milli_ampere = 'mA' unit_micro_ampere = 'uA' unit_hertz = 'Hz' unit_kilo_hertz = 'kHz' unit_volt_ampere = 'VA' unit_milli_watt = 'mW' unit_watt = 'W' unit_kilo_watt = 'kW' unit_kilo_watt_hours = 'kWh' unit_seconds = 's' unit_milli_seconds = 'ms' unit_micro_s...
players = ['Nicola', 'Penny', 'Dom', 'Nathan', 'Josie'] print(f"Friends: {players[0]}, {players[1]}, {players[2]}, {players[3]}, {players[4]}") find = input("Who did you find? ") if find in players: print(f"{find} has turned into a zombie!") players[players.index(find)] = "Zombie" print(f"Remaining players:...
players = ['Nicola', 'Penny', 'Dom', 'Nathan', 'Josie'] print(f'Friends: {players[0]}, {players[1]}, {players[2]}, {players[3]}, {players[4]}') find = input('Who did you find? ') if find in players: print(f'{find} has turned into a zombie!') players[players.index(find)] = 'Zombie' print(f'Remaining players:...
"""0MQ Constant names""" # Copyright (C) PyZMQ Developers # Distributed under the terms of the Modified BSD License. #----------------------------------------------------------------------------- # Python module level constants #----------------------------------------------------------------------------- # dictiona...
"""0MQ Constant names""" new_in = {(2, 2, 0): ['RCVTIMEO', 'SNDTIMEO'], (3, 2, 2): ['EMSGSIZE', 'EAFNOSUPPORT', 'ENETUNREACH', 'ECONNABORTED', 'ECONNRESET', 'ENOTCONN', 'ETIMEDOUT', 'EHOSTUNREACH', 'ENETRESET', 'IO_THREADS', 'MAX_SOCKETS', 'IO_THREADS_DFLT', 'MAX_SOCKETS_DFLT', 'ROUTER_BEHAVIOR', 'ROUTER_MANDATORY', 'F...
class Solution: def isAnagram(self, s, t): """ :type s: str :type t: str :rtype: bool """ return sorted(s) == sorted(t)
class Solution: def is_anagram(self, s, t): """ :type s: str :type t: str :rtype: bool """ return sorted(s) == sorted(t)
WINDOW_WIDTH = 560 MODE_SELECTOR_HEIGHT = 50 CONTROLS_FRAME_HEIGHT = 80 KEYBOARD_HEIGHT = 160 SCORE_DISPLAY_HEIGHT = 110 WINDOW_HEIGHT = KEYBOARD_HEIGHT + CONTROLS_FRAME_HEIGHT + MODE_SELECTOR_HEIGHT + SCORE_DISPLAY_HEIGHT CHOICES = ['Scales','Chords','Chord Progressions']
window_width = 560 mode_selector_height = 50 controls_frame_height = 80 keyboard_height = 160 score_display_height = 110 window_height = KEYBOARD_HEIGHT + CONTROLS_FRAME_HEIGHT + MODE_SELECTOR_HEIGHT + SCORE_DISPLAY_HEIGHT choices = ['Scales', 'Chords', 'Chord Progressions']
# -*- coding: utf-8 -*- """ Created on Sun May 5 14:55:31 2019 @author: asus """ """ House hunting caculate the months to save enough money to make the down payment of your dream house """ annual_salary = float(input("Enter your annual salary: ")) portion_saved = float(input("Enter the percent of your salary to save,...
""" Created on Sun May 5 14:55:31 2019 @author: asus """ '\nHouse hunting\ncaculate the months to save enough money to make the down payment of your dream house\n' annual_salary = float(input('Enter your annual salary: ')) portion_saved = float(input('Enter the percent of your salary to save, as a demical: ')) total...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `ansible_task_worker` package."""
"""Tests for `ansible_task_worker` package."""
''' Writing and reading files using w+ ''' f=open("foo.txt","w+") f.writelines(["Hello\n","This is a new line"]) f.flush() f.seek(0) print(f.read()) f.close()
""" Writing and reading files using w+ """ f = open('foo.txt', 'w+') f.writelines(['Hello\n', 'This is a new line']) f.flush() f.seek(0) print(f.read()) f.close()
class Solution: def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode: def _build(l1, r1, l2, r2): if l1 > r1: return None if l1 == r1 or l2 == r2: return TreeNode(postorder[l2]) root = TreeNode(postorder[r2]) ...
class Solution: def build_tree(self, inorder: List[int], postorder: List[int]) -> TreeNode: def _build(l1, r1, l2, r2): if l1 > r1: return None if l1 == r1 or l2 == r2: return tree_node(postorder[l2]) root = tree_node(postorder[r2]) ...
""" This module contains utilities to work with code generated by prost-build. """ load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_test") def generated_files_check(name, srcs, deps, data, manifest_dir): rust_test( name = name, srcs = srcs, data = data + [ "@rules_rust//...
""" This module contains utilities to work with code generated by prost-build. """ load('@rules_rust//rust:defs.bzl', 'rust_binary', 'rust_test') def generated_files_check(name, srcs, deps, data, manifest_dir): rust_test(name=name, srcs=srcs, data=data + ['@rules_rust//rust/toolchain:current_exec_rustfmt_files', '...
# 364 - Nested List Weight Sum II (Medium) # https://leetcode.com/problems/nested-list-weight-sum-ii/ # """ # This is the interface that allows for creating nested lists. # You should not implement it, or speculate about its implementation # """ #class NestedInteger(object): # # def isInteger(self): # """ # ...
class Solution(object): def find_max_depth(self, nestedList, depth): if len(nestedList) == 0: return 0 next_depth = depth + 1 for ni in nestedList: if NI.isInteger(): continue else: depth = max(depth, self.findMaxDepth(NI.g...
class ProductFileMetadata(object): def __init__(self, output_name, local_path, media_type=None, remote_path=None, data_start=None, data_end=None, geojson=None): self.data_start = data_start self.data_end = data_end self.geojson = geojson self.local_path = local_path...
class Productfilemetadata(object): def __init__(self, output_name, local_path, media_type=None, remote_path=None, data_start=None, data_end=None, geojson=None): self.data_start = data_start self.data_end = data_end self.geojson = geojson self.local_path = local_path self.med...
{ "name": "PersianTweets", "version": "2020", "task": "Corpus", "splits": [], "description": "LSCP: Enhanced Large Scale Colloquial Persian Language Understanding <br>\nLearn more about this study at https://iasbs.ac.ir/~ansari/lscp/", "size": 20665964, "filenames": ["lscp-0.5-fa-normalized.txt"] }
{'name': 'PersianTweets', 'version': '2020', 'task': 'Corpus', 'splits': [], 'description': 'LSCP: Enhanced Large Scale Colloquial Persian Language Understanding <br>\nLearn more about this study at https://iasbs.ac.ir/~ansari/lscp/', 'size': 20665964, 'filenames': ['lscp-0.5-fa-normalized.txt']}
class LoginLimiter(object): # use an array to keep track of most recent 10 requests def __init__(self): self.rctCalls = [] # receive timestamp of a call attempt # return true if call is allowed def isAllowed(self, ts): if len(self.rctCalls) < 10: # when client has made l...
class Loginlimiter(object): def __init__(self): self.rctCalls = [] def is_allowed(self, ts): if len(self.rctCalls) < 10: self.rctCalls.append(ts) print('Call API at timestamp %s' % ts) return True elif ts - self.rctCalls[0] < 60: print('E...
class Unserializable(Exception): """ The item is not serializable by the save system. """ pass class DeserializationError(Exception): """ Error deserializing a value during game load """ pass class VerbDefinitionError(Exception): """ A verb is defined in an incorrect or inc...
class Unserializable(Exception): """ The item is not serializable by the save system. """ pass class Deserializationerror(Exception): """ Error deserializing a value during game load """ pass class Verbdefinitionerror(Exception): """ A verb is defined in an incorrect or inconsi...
# Copyright 2019 The Bazel 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 applicable la...
"""Code for interacting with git binary to get the file tree checked out at the specified revision. """ __git_repo_info = provider(doc='Provider to organize precomputed arguments for calling git.', fields={'directory': 'Working directory path', 'shallow': 'Defines the depth of a fetch. Either empty, --depth=1, or --sha...
class Node_Types: image_texture = 'TEX_IMAGE' pbr_node = 'BSDF_PRINCIPLED' mapping = 'MAPPING' normal_map = 'NORMAL_MAP' bump_map = 'BUMP' material_output = 'OUTPUT_MATERIAL' class Shader_Node_Types: emission = "ShaderNodeEmission" image_texture = "ShaderNodeTexImage" mapping = "Sh...
class Node_Types: image_texture = 'TEX_IMAGE' pbr_node = 'BSDF_PRINCIPLED' mapping = 'MAPPING' normal_map = 'NORMAL_MAP' bump_map = 'BUMP' material_output = 'OUTPUT_MATERIAL' class Shader_Node_Types: emission = 'ShaderNodeEmission' image_texture = 'ShaderNodeTexImage' mapping = 'Sha...
# https://www.codewars.com/kata/52b757663a95b11b3d00062d/ ''' Instructions : Write a function toWeirdCase (weirdcase in Ruby) that accepts a string, and returns the same string with all even indexed characters in each word upper cased, and all odd indexed characters in each word lower cased. The indexing just explain...
""" Instructions : Write a function toWeirdCase (weirdcase in Ruby) that accepts a string, and returns the same string with all even indexed characters in each word upper cased, and all odd indexed characters in each word lower cased. The indexing just explained is zero based, so the zero-ith index is even, therefore ...
""" https://edabit.com/challenge/ogjDWJAT2kTXEzkD5 https://www.programiz.com/python-programming/args-and-kwargs#:~:text=Python%20has%20*args%20which%20allow,to%20pass%20variable%20length%20arguments. """
""" https://edabit.com/challenge/ogjDWJAT2kTXEzkD5 https://www.programiz.com/python-programming/args-and-kwargs#:~:text=Python%20has%20*args%20which%20allow,to%20pass%20variable%20length%20arguments. """
# Copyright 2013 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. { 'variables': { 'chromium_code': 1, }, 'targets': [ { 'target_name': 'device_hid', 'type': 'static_library', 'include_dirs':...
{'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'device_hid', 'type': 'static_library', 'include_dirs': ['../..'], 'dependencies': ['../../components/components.gyp:device_event_log_component', '../../net/net.gyp:net', '../core/core.gyp:device_core'], 'sources': ['hid_collection_info.cc', 'hid_collectio...
''' Abstract base class for audio speech and sound command processing. Provides methods shared among all platform implementations. Copyright (c) 2008 Carolina Computer Assistive Technology Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided tha...
""" Abstract base class for audio speech and sound command processing. Provides methods shared among all platform implementations. Copyright (c) 2008 Carolina Computer Assistive Technology Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided tha...
# -*- coding: utf-8 -*- """ Created on Mon Dec 4 13:07:33 2017 @author: James Jiang """ with open('Data.txt') as f: all_lines = [] for line in f: line = line.split() all_lines.append(line) total = 0 for i in range(len(all_lines)): counter = 0 for j in range(len(all_lines[i])): ...
""" Created on Mon Dec 4 13:07:33 2017 @author: James Jiang """ with open('Data.txt') as f: all_lines = [] for line in f: line = line.split() all_lines.append(line) total = 0 for i in range(len(all_lines)): counter = 0 for j in range(len(all_lines[i])): for k in range(len(all_l...
text = input().split(" ") even_words = [i for i in text if len(i) % 2 == 0] for word in even_words: print(word)
text = input().split(' ') even_words = [i for i in text if len(i) % 2 == 0] for word in even_words: print(word)
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def insertionSortList(self, head: ListNode) -> ListNode: if head == None or head.next == None: return head cur = head roo...
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def insertion_sort_list(self, head: ListNode) -> ListNode: if head == None or head.next == None: return head cur = head root = None while cur != No...
# # PySNMP MIB module APCUPS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/APCUPS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:07:20 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection) ...
class frodo: def __init__(self,x): self.x = x def __less__(self,other): if self.x < other.x: return False else: return True a = frodo(10) b = frodo(50) print(a<b)
class Frodo: def __init__(self, x): self.x = x def __less__(self, other): if self.x < other.x: return False else: return True a = frodo(10) b = frodo(50) print(a < b)
print("%(lang)s is fun!" % {"lang":"test"}) #Output """ Python is fun! """
print('%(lang)s is fun!' % {'lang': 'test'}) '\nPython is fun!\n'
# forcing a build def recurring_fibonacci_number(number: int) -> int: """ Calculates the fibonacci number needed. :param number: (int) the Fibonacci number to be calculated :return: (Optional[int]) the calculated fibonacci number """ if number < 0: raise ValueError("Fibonacci has to b...
def recurring_fibonacci_number(number: int) -> int: """ Calculates the fibonacci number needed. :param number: (int) the Fibonacci number to be calculated :return: (Optional[int]) the calculated fibonacci number """ if number < 0: raise value_error('Fibonacci has to be equal or above ze...
better_eyesight = False gold_mult = 1 legday_mult = 1 lifesteal_mult = 0 max_health_mult = 1 acid_blood_mult = 0 bleeding = 0 soul_collector = False soul_eater = False soul_blast = False damage_mult = 1 knockback_mult = 1 resistance_mult = 1 enemy_health_mult = 1 def reset_multipliers(): global better_eyesight, go...
better_eyesight = False gold_mult = 1 legday_mult = 1 lifesteal_mult = 0 max_health_mult = 1 acid_blood_mult = 0 bleeding = 0 soul_collector = False soul_eater = False soul_blast = False damage_mult = 1 knockback_mult = 1 resistance_mult = 1 enemy_health_mult = 1 def reset_multipliers(): global better_eyesight, go...
countdown_3_grid = [{(11, 16): 2, (4, 18): 2, (7, 16): 2, (11, 14): 2, (9, 18): 2, (7, 15): 2, (5, 18): 2, (10, 18): 2, (4, 13): 2, (11, 18): 2, (11, 13): 2, (7, 14): 2, (6, 18): 2, (4, 14): 2, (7, 18): 2, (4, 16): 2, (11, 17): 2, (20, 2): 3, (4, 15): 2, (4, 17): 2, (8, 18): 2, (7, 17): 2, (11, 15): 2}, (20, 2)] countd...
countdown_3_grid = [{(11, 16): 2, (4, 18): 2, (7, 16): 2, (11, 14): 2, (9, 18): 2, (7, 15): 2, (5, 18): 2, (10, 18): 2, (4, 13): 2, (11, 18): 2, (11, 13): 2, (7, 14): 2, (6, 18): 2, (4, 14): 2, (7, 18): 2, (4, 16): 2, (11, 17): 2, (20, 2): 3, (4, 15): 2, (4, 17): 2, (8, 18): 2, (7, 17): 2, (11, 15): 2}, (20, 2)] countd...
description = 'Kompass standard instrument' group = 'basic' includes = ['mono', 'guidefocus', 'selector', 'astrium', 'sample', 'reactor', #'detector', ]
description = 'Kompass standard instrument' group = 'basic' includes = ['mono', 'guidefocus', 'selector', 'astrium', 'sample', 'reactor']
class GraphQLEnabledModel: """ Subclass used by all the models that are dynamically registered as a GraphQL object type. """ pass class GraphQLField: """ Specify metadata about a model field that is to be registered at a GraphQL object type. :param name: Name of the field. :pa...
class Graphqlenabledmodel: """ Subclass used by all the models that are dynamically registered as a GraphQL object type. """ pass class Graphqlfield: """ Specify metadata about a model field that is to be registered at a GraphQL object type. :param name: Name of the field. :par...
"""Websauna Depot models. Place your SQLAlchemy models in this file. """
"""Websauna Depot models. Place your SQLAlchemy models in this file. """
# Use this to take notes on the Edpuzzle video. Try each example rather than just watching it - you will get much more out of it! # Most things are commented out because they can't all coexist without a syntax error user = {"name": "Kasey", "age": 15, "courses": ["History, CompSci"]} for key, value in user.items(): ...
user = {'name': 'Kasey', 'age': 15, 'courses': ['History, CompSci']} for (key, value) in user.items(): print(key, value) 'user.update({"name": "Bob", "age": 25, "phone": "888-8888"})\nuser[\'phone\'] = \'888-8888\'\nuser[\'name\']=\'Bob'
class Solution: def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]: target = [] for i, num in enumerate(nums): idx = index[i] target = target[:idx] + [num] + target[idx:] return target
class Solution: def create_target_array(self, nums: List[int], index: List[int]) -> List[int]: target = [] for (i, num) in enumerate(nums): idx = index[i] target = target[:idx] + [num] + target[idx:] return target
class MySQLClimateQuery: @staticmethod def drop_sport_climates(): return 'DROP TABLE IF EXISTS sport_climates' @staticmethod def create_sport_climates(): return ('CREATE TABLE sport_climates (' 'sport_id int NOT NULL,' 'climate_name varchar(50) NOT NULL,...
class Mysqlclimatequery: @staticmethod def drop_sport_climates(): return 'DROP TABLE IF EXISTS sport_climates' @staticmethod def create_sport_climates(): return 'CREATE TABLE sport_climates (sport_id int NOT NULL,climate_name varchar(50) NOT NULL,PRIMARY KEY (sport_id, climate_name),FO...
#!/usr/bin/env python3 # TODO nedd develop logic for handling strucutre with figure element class FilterModule(object): def filters(self): return { 'json_select': self.json_select } def jmagik(self, jbody, jpth, jfil): if jpth != "" and type(jpth) is not int: jv...
class Filtermodule(object): def filters(self): return {'json_select': self.json_select} def jmagik(self, jbody, jpth, jfil): if jpth != '' and type(jpth) is not int: jvar = jbody for i in jpth: jvar = jvar[i] elif type(jpth) is int: j...
__pycmd_map = {} def register_pycmd(name, pycmd): __pycmd_map[name] = pycmd def get_pycmd(name): if isinstance(name, str) and name in __pycmd_map: return __pycmd_map[name] elif callable(name): return name else: return None class PyCmdOption(object): def __init__(self, globals, locals): se...
__pycmd_map = {} def register_pycmd(name, pycmd): __pycmd_map[name] = pycmd def get_pycmd(name): if isinstance(name, str) and name in __pycmd_map: return __pycmd_map[name] elif callable(name): return name else: return None class Pycmdoption(object): def __init__(self, glo...
""" Given a set, remove all the even numbers from it, and for each even number removed, add "Removed [insert the even number you removed]". Example: {1,54, 2, 5} becomes {"Removed 54", 1, 5, "Removed 2"}. It is possible to solve this problem using either discard or remove. """ def odd_set_day(given_set): ...
""" Given a set, remove all the even numbers from it, and for each even number removed, add "Removed [insert the even number you removed]". Example: {1,54, 2, 5} becomes {"Removed 54", 1, 5, "Removed 2"}. It is possible to solve this problem using either discard or remove. """ def odd_set_day(given_set): add_remov...
def format_words(words): if not words: return "" while "" in words: words.remove("") if not words: return "" elif len(words)==1: return words[0] return ", ".join(words[:-1])+" and "+words[-1]
def format_words(words): if not words: return '' while '' in words: words.remove('') if not words: return '' elif len(words) == 1: return words[0] return ', '.join(words[:-1]) + ' and ' + words[-1]
class Solution: def removeDuplicates(self, nums): i = 0 while i < len(nums): if i == 0: lastNum = nums[i] else: if lastNum != nums[i]: lastNum = nums[i] else: nums.pop(i) ...
class Solution: def remove_duplicates(self, nums): i = 0 while i < len(nums): if i == 0: last_num = nums[i] elif lastNum != nums[i]: last_num = nums[i] else: nums.pop(i) continue i = i + ...
data = ( 'You ', # 0x00 'Yang ', # 0x01 'Lu ', # 0x02 'Si ', # 0x03 'Jie ', # 0x04 'Ying ', # 0x05 'Du ', # 0x06 'Wang ', # 0x07 'Hui ', # 0x08 'Xie ', # 0x09 'Pan ', # 0x0a 'Shen ', # 0x0b 'Biao ', # 0x0c 'Chan ', # 0x0d 'Mo ', # 0x0e 'Liu ', # 0x0f 'Jian ', # 0x10 'P...
data = ('You ', 'Yang ', 'Lu ', 'Si ', 'Jie ', 'Ying ', 'Du ', 'Wang ', 'Hui ', 'Xie ', 'Pan ', 'Shen ', 'Biao ', 'Chan ', 'Mo ', 'Liu ', 'Jian ', 'Pu ', 'Se ', 'Cheng ', 'Gu ', 'Bin ', 'Huo ', 'Xian ', 'Lu ', 'Qin ', 'Han ', 'Ying ', 'Yong ', 'Li ', 'Jing ', 'Xiao ', 'Ying ', 'Sui ', 'Wei ', 'Xie ', 'Huai ', 'Hao ', '...
""" Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between). For example: Given binary tree [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7 return its zigzag level order traversal as: [ [...
""" Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between). For example: Given binary tree [3,9,20,null,null,15,7], 3 / 9 20 / 15 7 return its zigzag level order traversal as: [ [3], ...
# -*- coding: utf-8 -*- def main(): n = int(input()) mod = 10 ** 9 + 7 ans = 0 for i in range(n): ans += ((i + 1) ** 10 - i ** 10) * (n // (i + 1)) ** 10 ans %= mod print(ans) if __name__ == '__main__': main()
def main(): n = int(input()) mod = 10 ** 9 + 7 ans = 0 for i in range(n): ans += ((i + 1) ** 10 - i ** 10) * (n // (i + 1)) ** 10 ans %= mod print(ans) if __name__ == '__main__': main()
load("//tools/bzl:maven_jar.bzl", "maven_jar") GUAVA_VERSION = "30.1-jre" GUAVA_BIN_SHA1 = "00d0c3ce2311c9e36e73228da25a6e99b2ab826f" GUAVA_DOC_URL = "https://google.github.io/guava/releases/" + GUAVA_VERSION + "/api/docs/" TESTCONTAINERS_VERSION = "1.15.3" def declare_nongoogle_deps(): """loads dependencies t...
load('//tools/bzl:maven_jar.bzl', 'maven_jar') guava_version = '30.1-jre' guava_bin_sha1 = '00d0c3ce2311c9e36e73228da25a6e99b2ab826f' guava_doc_url = 'https://google.github.io/guava/releases/' + GUAVA_VERSION + '/api/docs/' testcontainers_version = '1.15.3' def declare_nongoogle_deps(): """loads dependencies that ...
# leetcode 625. Minimum Factorization # Given a positive integer a, find the smallest positive integer b whose multiplication of each digit equals to a. # If there is no answer or the answer is not fit in 32-bit signed integer, then return 0. # Example 1 # Input: # 48 # Output: # 68 # Example 2 # Input: # 15 ...
class Solution(object): def smallest_factorization(self, a): if a == 1: return 1 for i in range(2, 10): if a % i == 0: q = int(a / i) ans = min(a * 10 + i, i * 10 + a) if ans <= 2 ** 31: return ans ...
''' Last digit of number's factorial Status: Accepted ''' ############################################################################### def main(): """Read input and print output""" nonzero = {} nonzero[1] = 1 nonzero[2] = 2 nonzero[3] = 6 nonzero[4] = 4 for _ in range(int(input())): ...
""" Last digit of number's factorial Status: Accepted """ def main(): """Read input and print output""" nonzero = {} nonzero[1] = 1 nonzero[2] = 2 nonzero[3] = 6 nonzero[4] = 4 for _ in range(int(input())): i = int(input()) if i in nonzero: print(nonzero[i]) ...
def find_metathesis_pair(filename): """Takes a word list as text file, returns a list of word pairs that can be created by swapping one pair of letters""" res = [] t = find_anagrams(filename) for i in t: possibles = i for x in range(len(possibles)): for y in...
def find_metathesis_pair(filename): """Takes a word list as text file, returns a list of word pairs that can be created by swapping one pair of letters""" res = [] t = find_anagrams(filename) for i in t: possibles = i for x in range(len(possibles)): for y in range(len(pos...
Import("env") print("Extra Script (Pre): common_pre.py") # Get build flags values from env def get_build_flag_value(flag_name): build_flags = env.ParseFlags(env['BUILD_FLAGS']) flags_with_value_list = [build_flag for build_flag in build_flags.get('CPPDEFINES') if type(build_flag) == list] defines = {k: v...
import('env') print('Extra Script (Pre): common_pre.py') def get_build_flag_value(flag_name): build_flags = env.ParseFlags(env['BUILD_FLAGS']) flags_with_value_list = [build_flag for build_flag in build_flags.get('CPPDEFINES') if type(build_flag) == list] defines = {k: v for (k, v) in flags_with_value_list...
KONSTANT = "KONSTANT" def funktion(value): print(value) class Klass: def method(self): funktion(KONSTANT) Klass().method()
konstant = 'KONSTANT' def funktion(value): print(value) class Klass: def method(self): funktion(KONSTANT) klass().method()
# -*- coding: utf-8 -*- """ square This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ class HttpResponse(object): """Information about an HTTP Response including its status code, returned headers, and raw body Attributes: status_code (int): The status code ...
""" square This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ class Httpresponse(object): """Information about an HTTP Response including its status code, returned headers, and raw body Attributes: status_code (int): The status code response from the server th...
conf = { 'version': 1, 'disable_existing_loggers': False, 'filters': { 'isAccessLog': { '()': 'utils.CustomLogFilter.AccessLogFilter' }, 'isHuntLog': { '()': 'utils.CustomLogFilter.HuntLogFilter' }, 'isHuntResultLog': { '()': 'utils...
conf = {'version': 1, 'disable_existing_loggers': False, 'filters': {'isAccessLog': {'()': 'utils.CustomLogFilter.AccessLogFilter'}, 'isHuntLog': {'()': 'utils.CustomLogFilter.HuntLogFilter'}, 'isHuntResultLog': {'()': 'utils.CustomLogFilter.HuntResultLogFilter'}}, 'root': {'level': 'DEBUG', 'handlers': ['consoleHandle...
def isPerfectCube(num): ans = 0 while ans**3 < abs(num): ans += 1 if ans**3 != abs(num): print("Not a perfect cube") else: if num < 0: ans = -ans print(ans, "is a cube root of", num) def main(): if __name__ == "__main__": print(isPerfectCube(8), "a...
def is_perfect_cube(num): ans = 0 while ans ** 3 < abs(num): ans += 1 if ans ** 3 != abs(num): print('Not a perfect cube') else: if num < 0: ans = -ans print(ans, 'is a cube root of', num) def main(): if __name__ == '__main__': print(is_perfect_cu...
# -*- coding: utf-8 -*- """ #project: CCP_Python3 #file: CCPRest.py #author: ceephoen #contact: ceephoen@163.com #time: 2019/6/13 21:43:21 #desc: """
""" #project: CCP_Python3 #file: CCPRest.py #author: ceephoen #contact: ceephoen@163.com #time: 2019/6/13 21:43:21 #desc: """
""" # Definition for Employee. class Employee: def __init__(self, id: int, importance: int, subordinates: List[int]): self.id = id self.importance = importance self.subordinates = subordinates """ class Solution: def getImportance(self, employees: List['Employee'], id: int) -> int: ...
""" # Definition for Employee. class Employee: def __init__(self, id: int, importance: int, subordinates: List[int]): self.id = id self.importance = importance self.subordinates = subordinates """ class Solution: def get_importance(self, employees: List['Employee'], id: int) -> int: ...
def detect_db(fh): """ Parameters ---------- fh : file-like object Returns ------- db_type : str one of 'irefindex', 'string' Notes ----- STRING ====== head -n2 9606.protein.links.full.v10.5.txt protein1 protein2 neighborhood neighborhood_transferred fusion cooccurence homology coexpres...
def detect_db(fh): """ Parameters ---------- fh : file-like object Returns ------- db_type : str one of 'irefindex', 'string' Notes ----- STRING ====== head -n2 9606.protein.links.full.v10.5.txt protein1 protein2 neighborhood neighborhood_transferred fusion cooccurence homology coexpr...
""" This module contains exceptions for use throughout the L11 Colorlib. """ class ColorMathException(Exception): """ Base exception for all colormath exceptions. """ pass class UndefinedConversionError(ColorMathException): """ Raised when the user asks for a color space conversion that doe...
""" This module contains exceptions for use throughout the L11 Colorlib. """ class Colormathexception(Exception): """ Base exception for all colormath exceptions. """ pass class Undefinedconversionerror(ColorMathException): """ Raised when the user asks for a color space conversion that does n...
# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Modifications made by Cloudera are: # Copyright (c) 2016 Cloudera, Inc. 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. A cop...
class Altusclierror(Exception): """ The base exception class for Altus CLI exceptions. """ fmt = 'An unspecified error occured' def __init__(self, **kwargs): msg = self.fmt.format(**kwargs) Exception.__init__(self, msg) self.kwargs = kwargs class Validationerror(AltusCLIErr...
NORMALIZED_POWERS = { 191: ('1x127', '1.5'), 200: ('1x133', '1.5'), 330: ('1x220', '1.5'), 345: ('1x230', '1.5'), 381: ('1x127', '3'), 399: ('1x133', '3'), 445: ('1x127', '3.5'), 466: ('1x133', '3.5'), 572: ('3x220/127', '1.5'), 598: ('3x230/133', '1.5'), 635: ('1x127', '5'),...
normalized_powers = {191: ('1x127', '1.5'), 200: ('1x133', '1.5'), 330: ('1x220', '1.5'), 345: ('1x230', '1.5'), 381: ('1x127', '3'), 399: ('1x133', '3'), 445: ('1x127', '3.5'), 466: ('1x133', '3.5'), 572: ('3x220/127', '1.5'), 598: ('3x230/133', '1.5'), 635: ('1x127', '5'), 660: ('1x220', '3'), 665: ('1x133', '5'), 69...
dict_camera = {'wfpc1': 1, 'wfpc1_planetary': 2, 'wfpc1_foc_f48': 3, 'wfpc1_foc_f48': 4, 'wfpc2': 5, 'wfpc2_planetary': 6, 'wfpc2_foc_f48': 7, 'wfpc2_foc_f48': 8, 'nicmos1_precryo': 9, 'nicmos2_precryo': 10, 'nicmos3_precryo': 11, 'stis_ccd': 12, 'stis_nuv': 13, 'stis_fuv': 14, 'acs_widefield': 15, 'acs_highres': 16,...
dict_camera = {'wfpc1': 1, 'wfpc1_planetary': 2, 'wfpc1_foc_f48': 3, 'wfpc1_foc_f48': 4, 'wfpc2': 5, 'wfpc2_planetary': 6, 'wfpc2_foc_f48': 7, 'wfpc2_foc_f48': 8, 'nicmos1_precryo': 9, 'nicmos2_precryo': 10, 'nicmos3_precryo': 11, 'stis_ccd': 12, 'stis_nuv': 13, 'stis_fuv': 14, 'acs_widefield': 15, 'acs_highres': 16, '...
def log_error(error): ''' This logging function just print a formated error message ''' print(error)
def log_error(error): """ This logging function just print a formated error message """ print(error)
class Depvar: """The Depvar object specifies solution-dependent state variables. Notes ----- This object can be accessed by: .. code-block:: python import material mdb.models[name].materials[name].depvar import odbMaterial session.odbs[name].materials[name].depvar ...
class Depvar: """The Depvar object specifies solution-dependent state variables. Notes ----- This object can be accessed by: .. code-block:: python import material mdb.models[name].materials[name].depvar import odbMaterial session.odbs[name].materials[name].depvar ...
host = 'Your SMTP server host here' port = 25 # Your SMTP server port here username = 'Your SMTP server username here' password = 'Your SMTP server password here' encryption = 'required' # Your SMTP server security policy here. Must be one of 'required', 'optional', or 'ssl' __all__ = ['host', 'port', 'username', '...
host = 'Your SMTP server host here' port = 25 username = 'Your SMTP server username here' password = 'Your SMTP server password here' encryption = 'required' __all__ = ['host', 'port', 'username', 'password', 'encryption']
class Solution: # @param {string} a a number # @param {string} b a number # @return {string} the result def addBinary(self, a, b): # Write your code here alen, blen = len(a), len(b) if alen > blen: b = '0' * (alen - blen) + b nlen = alen else: ...
class Solution: def add_binary(self, a, b): (alen, blen) = (len(a), len(b)) if alen > blen: b = '0' * (alen - blen) + b nlen = alen else: a = '0' * (blen - alen) + a nlen = blen (res, c) = ('', 0) for i in range(nlen - 1, -1, -...
palettes = { "material_design": { "red_500": 0xF44336, "pink_500": 0xE91E63, "purple_500": 0x9C27B0, "deep_purple_500": 0x673AB7, "indigo_500": 0x3F51B5, "blue_500": 0x2196F3, "light_blue_500": 0x03A9F4, "cyan_500": 0x00BCD4, "teal_500": 0x0096...
palettes = {'material_design': {'red_500': 16007990, 'pink_500': 15277667, 'purple_500': 10233776, 'deep_purple_500': 6765239, 'indigo_500': 4149685, 'blue_500': 2201331, 'light_blue_500': 240116, 'cyan_500': 48340, 'teal_500': 38536, 'green_500': 5025616, 'light_green_500': 9159498, 'lime_500': 13491257, 'yellow_500':...
def main(request, response): try: name = "recon_fail_" + request.GET.first("id") headers = [("Content-Type", "text/event-stream")] cookie = request.cookies.first(name, None) state = cookie.value if cookie is not None else None if state == 'opened': status = (200...
def main(request, response): try: name = 'recon_fail_' + request.GET.first('id') headers = [('Content-Type', 'text/event-stream')] cookie = request.cookies.first(name, None) state = cookie.value if cookie is not None else None if state == 'opened': status = (200, ...
#! python3 # __author__ = "YangJiaHao" # date: 2018/2/14 class Solution: def findSubstring(self, s, words): """ :type s: str :type words: List[str] :rtype: List[int] """ if words == []: return [] word_length = len(words[0]) words_length = ...
class Solution: def find_substring(self, s, words): """ :type s: str :type words: List[str] :rtype: List[int] """ if words == []: return [] word_length = len(words[0]) words_length = word_length * len(words) dic = {} for wo...
# Python - 3.6.0 paradise = God() test.assert_equals(isinstance(paradise[0], Man), True, 'First object are a man')
paradise = god() test.assert_equals(isinstance(paradise[0], Man), True, 'First object are a man')
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- # pylint:...
def step_create(test, checks=None, cache_num=1): if checks is None: checks = [] if test.kwargs.get('no_database'): test.cmd('az redisenterprise create --cluster-name "{cluster}" --sku "EnterpriseFlash_F300" --tags tag1="value1" --no-database --resource-group "{rg}"', checks=checks) elif test...
#input # 15 # 2 4 3 6 7 9 1 5 8 # 9 3 7 8 6 1 5 2 4 # 1 4 9 5 6 3 2 8 7 # 1 6 8 3 4 2 9 7 5 # 7 4 6 5 1 9 3 8 2 # 8 1 7 5 6 3 9 2 4 # 2 4 3 9 7 8 5 1 6 # 6 3 1 9 2 7 4 5 8 # 1 4 7 6 8 9 5 3 2 # 7 9 1 8 5 6 3 2 4 # 1 3 9 6 8 2 5 7 4 # 8 5 4 6 3 7 2 1 9 # 7 2 4 5 8 1 9 3 6 # 5 2 6 1 8 4 9 3 7 # 4 8 5 3 2 6 1 7 9 class G...
class Game: board = [] def initialize(self): self.board = [] for i in range(0, 3): self.board.append([None, None, None]) def mark(self, pos, p): self.board[pos // 3][pos % 3] = p def is_game_over(self): for i in range(0, 3): if self.board[i][0] ...
#!/usr/bin/env python3 # Write a program that prints the reverse-complement of a DNA sequence # You must use a loop and conditional dna = 'ACTGAAAAAAAAAAA' rvdna = '' for i in range(len(dna) -1, -1, -1) : nt = dna[i] if nt == 'A' : rvdna += 'T' elif nt == 'T': rvdna += 'A' elif nt == 'C': rvdna += 'G' elif nt ...
dna = 'ACTGAAAAAAAAAAA' rvdna = '' for i in range(len(dna) - 1, -1, -1): nt = dna[i] if nt == 'A': rvdna += 'T' elif nt == 'T': rvdna += 'A' elif nt == 'C': rvdna += 'G' elif nt == 'G': rvdna += 'C' print(rvdna) '\npython3 anti.py\nTTTTTTTTTTTCAGT\n'