content
stringlengths
7
1.05M
__all__ = ( "config_measure_voltage", "config_measure_resistance", "enable_source", "disable_source", "read", "config_voltage_pulse", ) def config_measure_voltage(k2400, nplc=1, voltage=21.0, auto_range=True): """Configures the measurement of voltage. (Courtesy of pymeasure, see link below...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # || ____ _ __ # +------+ / __ )(_) /_______________ _____ ___ # | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \ # +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/ # || || /_____/_/\__/\___/_/ \__,_/ /___/\___/ # # Copyright (C) 20...
"""Escreva um programa que recebe como entradas dois números inteiros correspondentes à largura e à altura de um retângulo, respectivamente. O programa deve imprimir, usando repetições encaixadas, uma cadeia de caracteres que represente o retângulo informado com caracteres '#' na saída.""" def main(): coluna...
# Python3 function to calculate number of possible stairs arrangements with given number of boxes/bricks def solution(n): dp=[[0 for x in range(n + 5)] for y in range(n + 5)] for i in range(n+1): for j in range (n+1): dp[i][j]=0 dp[3][2]=1 dp[4][2]=1 for i in range(5...
class PdfDoc(): def __init__(self, filename): self.filename = filename self.pages = [] def page_count(self): return len(self.pages)
arquivo =open('mobydick.txt', 'r') saida = open('saida.txt', 'w') texto = arquivo.readlines()[:] for linha in texto: if linha == '\n': continue else: linha = linha.split() for palavra in linha: saida.write(f'{palavra} ') saida.write('\n') arquivo.close() saida.close()
file = open('signalsAndNoise_input.txt', 'r') lines_read = file.readlines() message_length = len(lines_read[0].strip()) letter_frequencies = [None] * message_length for index in range(message_length): letter_frequencies[index] = dict() for line in lines_read: line = line.strip() for i in range(len(line))...
# Python - 3.6.0 def testing(actual, expected): Test.assert_equals(actual, expected) Test.describe('opstrings') Test.it('Basic tests vert_mirror') testing(oper(vert_mirror, 'hSgdHQ\nHnDMao\nClNNxX\niRvxxH\nbqTVvA\nwvSyRu'), 'QHdgSh\noaMDnH\nXxNNlC\nHxxvRi\nAvVTqb\nuRySvw') testing(oper(vert_mirror, 'IzOTWE\nkkbeC...
# (C) Datadog, Inc. 2018 # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) def headers(agentConfig, **kwargs): # Build the request headers res = { 'User-Agent': 'Datadog Agent/%s' % agentConfig.get('version', '0.0.0'), 'Content-Type': 'application/x-www-form-url...
# from ../../.tcp_chat_server import server.py, client.py # something is wrong with the directory above. # import pytest # Linter said it could not import pytest def test_alive(): """ Does the testing file run? """ pass
class GlueError(Exception): """Base Exception class for glue Errors.""" error_code = 999 class PILUnavailableError(GlueError): """Raised if some PIL decoder isn't available.""" error_code = 2 class ValidationError(GlueError): """Raised by formats or sprites while .""" error_code = 3 class ...
for i in range(101): if i % 3 == 0: print(i)
""" Otrzymujesz liste par liczb. Liczby w parze reprezentuja poczatek i koniec przedzialu. Niektore przedzialy moga na siebie nachodzic. W takim przypadku polacz je ze soba i zwroc liste niepokrywajacych sie przedzialow. """ # Wersja 1 def polacz_przedzialy_v1(lista): lista = sorted(lista) wynik = [] poc...
to_solve = '' with open('input.txt') as f: to_solve = f.readlines() to_solve = list(map(lambda x: x.split(': '), to_solve)) temp = [] for i in to_solve: ttemp = i[0].split(' ') tttemp = ttemp[0].split('-') ttttemp = {'char': ttemp[1], 'passwd': i[1], 'min': int(tttemp[0]), 'max': int(tttemp[1])} temp.append(ttt...
""" You have an array of logs. Each log is a space delimited string of words. For each log, the first word in each log is an alphanumeric identifier. Then, either: Each word after the identifier will consist only of lowercase letters, or; Each word after the identifier will consist only of digits. We will ca...
# http://codingbat.com/prob/p194053 def combo_string(a, b): if len(a) > len(b): return b + a + b else: return a + b + a
"""Tests which check the various ways you can set DJANGO_SETTINGS_MODULE If these tests fail you probably forgot to run "python setup.py develop". """ BARE_SETTINGS = ''' # At least one database must be configured DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:...
def tree(entity): """tree is a filter to build the file tree Args: entity: the current entity Returns: A file tree, starting with the highest parent """ root = entity # Get the highest available parent while hasattr(root, 'parent') and root.parent and root.parent.type == r...
""" What does the phrase "in-order successor" mean when we are talking about a node in a binary search tree? A - the node that has the next lowest value B - the node that has the maximum value C - the node that has the minimuin value D - the node that has the next highest value answer is : """
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...
# -*- 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: # @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...
#!/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]...
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...
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...
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 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...
# -*- 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 _...
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"]) ...
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...
# 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):...
# -*- coding: utf-8 -*- # Scrapy settings for scrapy_multi_thread project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # https://doc.scrapy.org/en/latest/topics/settings.html # https://doc.scrapy.org/en/...
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...
# 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...
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...
# 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...
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...
""" --- 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...
""" 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...
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...
""" messages.py The text replies for certain commands """ commands = { "FAQS": "Please try the fixes and suggestions provided in our <#765222197518139404> channel. Many of the most common issues are already covered there.", "ANDROID_CACHE": "If you have an android phone, and you're stuck with a Play button in ...
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/ # ================================================================...
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...
# 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...
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...
class Solution: def isAnagram(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']
text = {"greet_new": "👨‍Здравствуйте, вы обратились в службу экстренной помощи\n" "Прежде чем использовать все возможности бота, ответьте на несколько вопросов используя клавиатуру\n\n" "👩‍Пожалуйста введите своё ФИО", "greet_old_beginning": "Здравствуйте, ", "greet_o...
# -*- 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,...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `ansible_task_worker` package."""
#!/usr/bin/env python3 class _drop_html_event(object): pass def drop_html_event(sts): """过滤到HTML的事件属性 :param sts: :return: """ pass
list_input = {"-": "-", "Spot price": "Current market price at which asset is bought or sold.", "Strike": 'The price at which a put or call option can be exercised.', "Risk-free rate": 'The risk-free interest rate is the rate of return of a hypothetical investment with no' ...
''' 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()
"""Handler for help messages.""" __all__ = ["handle_generic_help"] async def handle_generic_help(*, event, app, logger): """Handle an event from a user asking for help with the bot. Note that this is a generic help request, so all backends will be responding. Parameters ---------- event : `...
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]) ...
""" 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//...
jogos = int ( input ('Digite quantos jogadores vão participar: ')) cibs = 1 soma = 0 if jogos == 1: for cibs in range(1): nome1 = str(input('Nome do primeiro : ')) elif jogos == 2: for cibs in range(1): nome1 = str(input('Nome do primeiro : ')) nome2 = str(input('Nome do segundo : ')) p...
# 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 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...
{ "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 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 Solution: # def numSquares(self, n: int) -> int: # ans = [] # for k in range(n, -1, -1): # while k != 0: # if self.fun(k): # ans.append(k) # k = n-k # else: # break # if su...
# 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...
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...
# 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...
""" 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':...
''' 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...
v = float(input('Digite a velocidade do seu carro: ')) if v>80: multa = (v-80)*7 print ('Você ultrapassou o limite de 80Km/h desta via, valor da multa: R${:.2f}'.format(multa))
# -*- 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])): ...
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...
# # 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:...
# -*- coding: utf-8 -*- # MIT License # Copyright (c) 2019 Ronnasayd de Sousa Machado # 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 ...
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! """
# 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...
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...
description = 'Kompass standard instrument' group = 'basic' includes = ['mono', 'guidefocus', 'selector', 'astrium', 'sample', 'reactor', #'detector', ]
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...
"""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(): ...
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 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,...
#!/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...
__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...
""" 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): ...
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) ...
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...