content
stringlengths
7
1.05M
students = [ {'name': 'fred', 'age': 29}, {'name': 'jim', 'age': 34}, {'name': 'alice', 'age': 12} ] students = sorted(students, key=lambda x: x['age']) #print(students) students = [ {'name': 'fred', 'dob': '1961-08-12'}, {'name': 'jim', 'dob': '1972-01-12'}, {'name': 'alice', 'dob': '1949-01-01'}, {'name': 'bob', '...
class Solution: def orangesRotting(self, grid: List[List[int]]) -> int: minutes = 0 mark = [] nonRotten = 0 for i, row in enumerate(grid): for j, r in enumerate(row): if r == 2: # Rotten mark.append((i,j)) ...
# # PySNMP MIB module Q-BRIDGE-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/Q-BRIDGE-MIB # Produced by pysmi-0.0.7 at Fri Feb 17 12:48:35 2017 # On host 5641388e757d platform Linux version 4.4.0-62-generic by user root # Using Python version 2.7.13 (default, Dec 22 2016, 09:22:15) # ( Int...
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. ######################################################## # NOTE: THIS FILE IS GENERATED. DO NOT EDIT IT! # # Instead, run create_include_gyp.py to reg...
# Python Program To Apply Two Decorator To The Same Function Using @ Symbol ''' Function Name : Apply 2 Decorator To Same Function Using @. Function Date : 9 Sep 2020 Function Author : Prasad Dangare Input : Integer Output : Integer ''' def decor(fun): def inner(): ...
#! /usr/bin/python3 # LCS using dynamic programming recursive method def lcsRecursion(seq1,seq2,m,n): if m == 0 or n == 0: return 0 else: if seq1[m-1] == seq2[n-1]: return 1 + lcsRecursion(seq1,seq2,m-1,n-1) else: return (max(lcsRecursion(seq1,seq2,m-1,n),lcsRecursion(seq1,seq2,m,n-1))) seq...
# def conv(x): # if x == 'R': # return [0,1] # elif x == 'L': # return [0,-1] # elif x == 'U': # return [-1, 0] # elif x == 'D': # return [1,0] # h, w, n = map(int, input().split()) # sr, sc = map(int, input().split()) # s = list(map(lambda x: conv(x), list(input()))) # t = list(map(lambda x: c...
### # Copyright (c) 2002-2005, Jeremiah Fincher # Copyright (c) 2010-2021, Valentin Lorentz # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the a...
class Graph: def __init__(self): self.edges = {} def neighbors(self, node_id): return self.edges[node_id]
Config = { '笑话':['jokes','Jokes'], '电影':['movies', 'Movies'], '天气':['weather', 'Weather'], '美女':['girls','Girls'], '美食':['food','Food'], '歌词':['lyrics','Lyrics'] } Token = '91930762d6cc738b' Domain = 'www.liaotian2020.com' Welcome = '欢迎关注liaotian2020,在这里我会提供一些生活常用信息的自动查询,比如{key}等,回复带有这些关键词的语句看看有...
numdays = int(input('Number of worked days in a month: ')) # 8 is the number of hours worked by day and 25 is the gain per hour gainperday = 25*8 salary = numdays*gainperday print('The employee has worked {} days in the last month.' .format(numdays)) print('The value that he will receive is R${:.2f}.'.format((sal...
class Orange: priceOfOranges = 5 stock = 30 def __init__(self, quantityToBuy): self.quantityToBuy = quantityToBuy def OrangeSelling(self): if int(self.quantityToBuy) > Orange.stock: print("We do not have enough oranges, Please select a lesser quantity.") else: ...
species_ids =set([str(i) for i in [882,1148,3055,3702,4081,4577,4896,4932,5061,5691,5833,6239,7165,7227,7460,7955,8364,9031,9598,9606,9615,9796,9823,9913,10090,10116,39947,44689,64091,83332,85962,99287,122586,158878,160490,169963,192222,198214,208964,211586,214092,214684,224308,226186,243159,260799,267671,272623,272624...
""" Class to help with key entry less typos """ class MTKeys: """class to enumerate keys used in module""" data = "data" date = "date" # TVMaze tvmaze = "tvmaze" summary = "summary" name = "name" url = "url" image = "image" medium = "medium" original = "original" idOf...
# 8. Write a Python function that takes a list and returns a new list with unique elements of the first list. def unique(s): a = [] for i in s: if i not in a: a.append(i) else: pass return a print (unique([1,2,3,3,3,3,4,5]))
Pokemon = {"HP":149, "Attack":43, "Defense":154} OutputFileName = "ドーミラー.csv" #If LimitCP < 0 then, No Limit LimitCP=500 Range={"HP":(0, 15), "Attack":(0, 15), "Defense":(0, 15)} PokemonLevelRange=(1, 41) Multiprocessing=True SortValue="SCP"
''' This one works (Remember, a negative number multiplied by another negative number returns a positive number) ''' def solution(A): #sort the contents of A #find maxy1 by multiplying last three elements of sortedA #find maxy2 by multiplying first two elements of sortedA with the last element of sortedA ...
string = 'this is a string with spaces' splits = [] pos = -1 last_pos = -1 while ' ' in string[pos + 1:]: pos = string.index(' ', pos + 1) splits.append(string[last_pos + 1:pos]) last_pos = pos splits.append(string[last_pos + 1:]) print(splits)
# # 67. Add Binary # # Q: https://leetcode.com/problems/add-binary/ # A: https://leetcode.com/problems/add-binary/discuss/744220/Javascript-Python3-C%2B%2B-accumulate-sum-a%2Bb%2Bc-in-reverse # class Solution: def addBinary(self, A: str, B: str, c = 0) -> str: # ⭐️ c is the carry ans = [] i = len(A...
countObjects, countVarinCallers = map(int, input().split()) if countVarinCallers <= 2: ans = 2 + countObjects + countObjects * countVarinCallers else: ans = 2 + countObjects + countObjects * countVarinCallers + countObjects * countVarinCallers* (countVarinCallers-1) // 2 print(ans)
class MyClass: __var2 = 'var2' var3 = 'var3' def __init__(self): self.__var1 = 'var1' def normal_method(self): print(self.__var1) @classmethod def class_method(cls): print(cls.__var2) def my_method(self): print(self.__var1) print(self.__var2) ...
# Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
class UpdateBag: """ Contains all the information that needs to passed between the Game and GUI class. """ def __init__(self, removals, bonuses, additions, movements, ice_removed, medals_removed, info, state=()): self.removals = removals self.bonuses = bonuses self.additions...
print('Welcome to the first interview!') print('Please enter your typing speed!') #get user typing speed typing_speed=int(input()) if typing_speed>60: print('Congratulation') print('You passed the first interview') print('The company will contact you') print('Later regarding the second interview') el...
class Solution: def insert_list(self, head): stack = [] while(head): stack.append(head.val) head = head.next return stack def isPalindrome(self, head: ListNode) -> bool: if head == None: return True reverse_stack = self.insert_list...
class RedisPort: ''' 使用Redis代替之前的Memcached 提供一个转换实现 ''' def __init__(self, redis): self._redis = redis def set(self, key, value, ttl=-1): pass def get(self, key): pass
# -*- coding: utf-8 -*- def comp_axes(self, output): """Compute axes used for the Structural module Parameters ---------- self : Structural a Structural object output : Output an Output object (to update) """ output.struct.Time = output.mag.Time # output.struct.Nt_tot...
class Solution: def checker(self, s,l,r): while l >= 0 and r < len(s) and s[l] == s[r]: l -= 1 r += 1 return s[l+1:r] def longest_palindromic(self, s: str) -> str: maximum = " " for i in range(len(s)): case_1 = self.checker(s, ...
def usermail(user): """ Created: 2019-01-21 11:09:48 Aim: Change the destination of onsuccess email according to username. """ d={} paths = glob.glob('../mw*/src/snakemake/tables/email*.tsv') #paths.extend(glob.glob('inp/*/src/snakemake/tables/email*.tsv')) #print(paths) ...
"""Copy one or more files to nodes in a cluster of systems""" __author__ = "Khosrow Ebrahimpour" __version__ = "0.1.2" __license__ = "MIT"
SKIPPER = 1096000 REITING = 1096001 if sm.sendAskYesNo("Would you like to skip the intro?"): sm.completeQuestNoRewards(2568) if sm.getChr().getLevel() < 10: sm.addLevel(10 - sm.getChr().getLevel()) sm.warp(912060500) sm.dispose() sm.lockInGameUI(True) sm.curNodeEventEnd(True) sm.forcedInput(0)...
apiAttachAvailable = u'API\u53ef\u7528' apiAttachNotAvailable = u'\u7121\u6cd5\u4f7f\u7528' apiAttachPendingAuthorization = u'\u7b49\u5f85\u6388\u6b0a' apiAttachRefused = u'\u88ab\u62d2' apiAttachSuccess = u'\u6210\u529f' apiAttachUnknown = u'\u4e0d\u660e' budDeletedFriend = u'\u5df2\u5f9e\u670b\u53cb\u540d\u55ae\u522a...
def main(): N = int(input()) ans = 0 for i in range(1, N + 1): if '7' in str(i): continue if '7' in oct(i): continue ans += 1 print(ans) if __name__ == "__main__": main()
'''面试题50-1:字符串中第一个只出现一次的字符 Example: input: abaccdeff output: b ------------------ 如果需要判断多个字符是不是在某个字符串里出现过或者统计多个字符在某个字符串中出现的次数, 那么我们可以考虑基于数组创建一个简单的哈希表,这样可以用很小的空间消耗换来时间效率的提升。 ''' def find_first_appeared_once(string): if string is None or len(string) == 0: return None appear_times = [0] * 256 for i...
# Part 1 data = open('data/day2.txt') x = 0 y = 0 for line in data: curr = line.strip().split() if curr[0] == "forward": x += int(curr[1]) elif curr[0] == "up": y -= int(curr[1]) else: y += int(curr[1]) print(x*y) # Part 2 data = open('data/day2.txt') x = 0 y = 0 aim = 0 for li...
def docs(**kwargs): """ Annotate the decorated view function with the specified Swagger attributes. Usage: .. code-block:: python from aiohttp import web @docs(tags=['my_tag'], summary='Test method summary', description='Test method description', ...
def add_num(num_1, num_2): result = num_1 + num_2 return result print(add_num(2, 3))
# 클래스 구조 # 구조 설계 후 재사용성 증가, 코드 반보 최소화, 메소드 class Student(): def __init__(self, name, number, grade, details): self._name = name self._number = number self._grade = grade self._details = details def __str__(self): return 'str: {} - {}'.format(self._name, self._number) ...
""" Description In selection sort we start by finding the minimum value in a given list and move it to a sorted list. Then we repeat the process for each of the remaining elements in the unsorted list. The next element entering the sorted list is compared with the existing elements and placed at its correct position...
def arqexiste(arq): """ -> Verifica se existe o arquivo arq :param arq: Nome do arquivo a ser testado. :return: retorna True se o arquivo for encontrado, caso contrário False """ try: a = open(arq) except FileNotFoundError: # O arquivo não foi encontrado print('Arquivo não encontrado!') return False els...
# Leia duas sequências numéricas de tamanho 10 cada. Apresente o resultado da intercalação da primeira sequência lida com a segunda e vice-versa. def leitorLista(): lista = list(map(int, input().split())) return lista lista1 = leitorLista() lista2 = leitorLista() listaIntercalada = [] for i in ...
""" Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as possible. Example 1: Input: [1,4,3,2] Output: 4 Explanation: n is 2, and the maximum sum of pairs is 4 = min(1, 2) + m...
# # PySNMP MIB module GDC-SC553-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/GDC-SC553-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:05:21 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
class PedidoNotFoundException(Exception): pass class RequiredDataException(Exception): pass
PADDLE_WIDTH = 20 PADDLE_HEIGHT = 90 AI_PADDLE_MAX_SPEED = 20 PADDLE_SPEED_SCALING = 0.6 PADDLE_MAX_SPEED = None BALL_X_SPEED = 12 BALL_BOUNCE_ON_PADDLE_SCALE = 0.40
class UserAgents: @staticmethod def mac(): return 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' @staticmethod def android(): return 'Mozilla/5.0 (Linux; Android 11; IN2021) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.210 M...
NAV1P1 = "Nav1.1" # labels CURRENT_LABEL = "Current (nA)" DISTANCE_LABEL = 'Distance from soma (μm)' INSTA_FR_LABEL = "Instantaneous firing rate (Hz)" FIRING_RATE_LABEL = "Firing rate (Hz)" MAX_PROP_LABEL = "Max propagation distance (μm)" NAV_FRAC_LABEL = f"{NAV1P1} fraction" NAV_PERC_LABEL = NAV_FRAC_LABEL.replace("...
#views.py class CustomerServieViews(object): def customer_service(self, request): if request.user.is_anonymous(): return HttpResponseRedirect('/accounts/login') try: customer_service = models.Customer_Service.objects.get(pk=models.Customer_Service.objects.all()[0].id) except: customer_service = models....
""" Given an array where elements are sorted in ascending order, convert it to a height balanced BST. """ # Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param num, a list of integ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ __init__.py ~~~~~~~~~~~ A set of tools for lawyers :copyright: (c) 2021 by Law Engineering Systems SRL. :license: see LICENSE for more details. """ __title__ = 'lawyertools' __version__ = '0.0.1' __author__ = 'Biagio Distefano'
print('hello word') # 输出数字,字符串和表达式 print(100) print(1+1) print(1==1) # 可以输出到文件中 fp=open('./test.txt','a+') print('hello',file=fp) fp.close() # 字符串最后一个字符不能是反斜杠 # 输出多个内容,可以用,隔开 print('tom','jack') print(1,1) # 转义字符 print('hello\rword') print('hello\bword') # 取消转义,让字符串原样输出,字符串前加r或者R print(r'he...
#A number of stamps can be divided incrementally amongst people if the #number of stamps is equal to or exceeds the sum of the range from [1,N] def divideStamps(N, stamps): stamp_count = 0 total_per_person = 0 #Count number of stamps for i in range(len(stamps)): stamp_count += stamps[i] ...
class Solution: def missingNumber(self, nums: List[int]) -> int: return self.missingNumberUsingSum(nums) def missingNumberUsingXOR(self, nums: List[int]) -> int: sum = 0 for i in range(0, len(nums) + 1): sum = sum ^ i for n in nums: ...
PER_PAGE = 15 RECENT_BOOK_COUNT = 30 BEANS_UPLOAD_ONE_BOOK = 0.5
# automatically generated by the FlatBuffers compiler, do not modify # namespace: apemodefb class ERotationOrderFb(object): EulerXYZ = 0 EulerXZY = 1 EulerYZX = 2 EulerYXZ = 3 EulerZXY = 4 EulerZYX = 5 EulerSphericXYZ = 6
class Template(object): def __init__(self, content): self._content = content @property def id(self): return self._content.get('id') @property def name(self): return self._content.get('name') @property def is_default(self): return self._content.get('is_defau...
incoming_dragons = int(input()) dragons_den = {} while incoming_dragons: dragon_spawn = input() # {type} {name} {damage} {health} {armor} rarity, name, damage, health, armor = dragon_spawn.split(" ") # default values: health 250, damage 45, and armor 10 if damage == "null": damage = "45" ...
expected_output = { 'pid': 'WS-C3850-24P', 'os': 'iosxe', 'platform': 'cat3k_caa', 'version': '16.4.20170410:165034', }
# ' % kmergrammar # ' % Maria Katherine Mejia Guerra mm2842 # ' % 15th May 2017 # ' # Introduction # ' Some of the code below is under active development # ' ## Required libraries # + name = 'import_libraries', echo=False # + name= 'create_matrices', echo=False def create_matrices(): """ Parameters -----...
class Node: def __init__(self, k, v): self.k = k self.v = v self.pre = None self.nxt = None class LRUCache: def __init__(self, cap): self.mp = dict() self.cap = cap self.head = Node(0, 0) self.tail = Node(0, 0) self.head.nxt = self.tail ...
class Solution: """ 哈希法 """ def canConstruct(self, ransomNote: str, magazine: str) -> bool: hashtable = [0 for _ in range(26)] for char in magazine: hashtable[ord(char)-97] += 1 for char in ransomNote: index = ord(char) - 97 hashtable[index...
# 2020.01.15 # Sorry, was not in good mood yesterday # Problem Statement: # https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/ # Almost the same question as question 108, adding a convertion of linked list to array # Definition for singly-linked list. # class ListNode: # def __init__(self, va...
def test_valid(cldf_dataset, cldf_logger): assert cldf_dataset.validate(log=cldf_logger) # "Lexical data consist of 59 lists of 210 basic vocabularies" def test_languages(cldf_dataset, cldf_logger): assert len(list(cldf_dataset["LanguageTable"])) == 59 def test_parameters(cldf_dataset, cldf_logger): ass...
#WAP to accept a string from user and perform verbing operation on it. #String should be greater than or equal to 3, else leave unedited #if string ends with 'ing', replace 'ing' with 'ly' #add 'ing' if not present inputStr = input('Enter a string : ') result = '' if len(inputStr) >= 3: if inputStr.endswith('...
@profile def mean(nums): top = sum(nums) bot = len(nums) return float(top) / float(bot) if __name__ == "__main__": a_list = [1, 2, 3, 4, 5, 6, 10, 100] result = mean(a_list) print(result)
d, m, a = [int(x) for x in input().split()] t = (d % 5) + 3 mat = [] for i in range(t): mat.append([0 for x in range(t)]) mat[0][0] = a mat[0][1] = m mat[1][0] = d p = 2 for i in range(2, t): mat[0][i] = mat[0][i-1] + p mat[i][0] = mat[i-1][0] + p p += 1 for i in range(1, t): for j in range(1, t): ...
RESET = "\x1B[0m" BOLD = "\x1B[1m" DIM = "\x1B[2m" UNDER = "\x1B[4m" REVERSE = "\x1B[7m" HIDE = "\x1B[8m" CLEARSCREEN = "\x1B[2J" CLEARLINE = "\x1B[2K" BLACK = "\x1B[30m" RED = "\x1B[31m" GREEN = "\x1B[32m" YELLOW = "\x1B[33m" BLUE = "\x1B[34m" MAGENTA = "\x1B[35m" CYAN = "\x1B[36m" WHITE = "\x1B[37m" B...
def create_message_routes(server): metrics = server._augur.metrics
s = 'Ala ma kota' lz = list(s) print(lz) print() for i in range(len(lz)): print(lz[i]) print() for i in lz: print(i)
head = '''###host_name### NAC Implementation\n DATE START_TIME till END_TIME\nChange #''' first_line = "Participants & Contact Information:" second_line = 'Objectives' third_line = 'Procedure' numbered_line_part_one = ['Conduct pre job brief', "Contact the NOC (network alarms)", "Contact the Help Desk ...
# value of A represent its position in C # value of C represent its position in B def count_sort(A, k, exp): B = [0 for i in range(len(A))] C = [0 for i in range(k)] # count the frequency of each elements in A and save them in the coresponding position in B for i in range(0, len(A)): # calcula...
if __name__ == '__main__': text = input() text = text.lower() l = list(text) i = 0 while i < len(l): if i == 0: print(l[i].upper(), end='') elif l[i] == 'i' and (l[i-1] == ' ' or l[i-1] == '.' or l[i-1] == ',') and (l[i+1] == ' ' or l[i+1] == '.' or l[i+1] == ','): ...
ssb_sequence = Sequence(name='ssb', variable=' diff down from f0', variable_unit='GHz', step=1e6, start=0, stop=100e6) qubit_time = 1e-6 qubit_points = round(qubit_time / resolution) qubit_time_array = np...
# :coding: utf-8 # :copyright: Copyright (c) 2013 Martin Pengelly-Phillips # :license: See LICENSE.txt. '''Custom error classes.''' class CollectionError(Exception): '''Raise when a collection error occurs.'''
TMP_PREFIX=".tmp" EXT_FRCMOD=".frcmod" EXT_PDB=".pdb" EXT_INP=".in" EXT_PARM7=".parm7"
# Copyright (c) 2022 Patrick260 # Distributed under the terms of the MIT License. n = int(input()) print(int(n / 2) * int(n / 2))
# Copyright 2017 Alvaro Lopez Garcia # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
flag = object() # or class _Flag: __instance = None def __new__(cls): if cls.__instance is None: cls.__instance = object.__new__(cls) return cls.__instance # or class _Flag(Enum): flag = auto() flag = _Flag.flag
MAJOR_COLORS = ['White', 'Red', 'Black', 'Yellow', 'Violet'] MINOR_COLORS = ["Blue", "Orange", "Green", "Brown", "Slate"] def get_color_from_pair_number(pair_number): zero_based_pair_number = pair_number - 1 major_index = zero_based_pair_number // len(MINOR_COLORS) if major_index >= len(MAJOR_COLORS): raise...
# # PySNMP MIB module Nortel-MsCarrier-MscPassport-TdmaIwfMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-TdmaIwfMIB # Produced by pysmi-0.3.4 at Wed May 1 14:31:23 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwan...
## For !) ozone2 = ruleGMLString("""rule [ ruleID "O3 attack by .O-X, X != O " left [ node [ id 1 label "O+" ] node [ id 2 label "O-" ] edge [ source 1 target 2 label "-" ] node [ id 3 label "O." ] ] context [ node [ id 4 label "*" ] edge [ source 1 target 4 label "*" ] ] right [...
"""This module define WordFreq. WordFreq helps to measure distance between two texts.""" def _tokenize(text): """Return tokens from text. Text are splitted by tokens with space as seperator. All non alpha character discarded. All tokens are casefolded. """ # split text by spaces and add only ...
phrasal_verbs_data = [ ( 'The cat went to the garden. They left it out.', ['left out'] ), ( 'Going down the mountain was hectic.', ['Going down'] ), ( 'He got off at the airport. It was a rainy day. They switched the lights off.', ['got off', 'switched...
class Array: _MAX_INDEX_LOOKUP_LENGTH = 1000 def __init__(self, reader, read_all): self.reader = reader self.begin_pos = self.reader._tell_read_pos() self.length = -1 # For optimizing index queries self.last_known_pos = self.reader._tell_read_pos() self.last_kn...
# Print out a message and then ask the user for input print('Hello, world') user_name = input('Enter your name: ') print('Hello ', user_name)
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
# coding: utf-8 """ Provides a class to customize template information on a per-view basis. To customize template properties for a particular view, create that view from a class that subclasses TemplateSpec. The "spec" in TemplateSpec stands for "special" or "specified" template information. """ class TemplateSpe...
x=int(input()) if(x%4==0 and x%100!=0 or x%400==0): print('1') else: print('0')
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class PyAzuremlTrainAutomlClient(Package): """The azureml-train-automl-client package contains functionality for ...
def solution(A): """ Codility 100% https://app.codility.com/demo/results/trainingZ3A6TH-XF3/ A[P] − A[Q], A[Q] ≥ A[P] considering this as profit. Idea is start from end, in each iteration subtract the current price with the previous max_price_from_here. Keep track for the maximum value(max_pric...
"""Templates used to parse an XML object, that is send to the CSW server. """ xml_base = ( "<?xml version='1.0' encoding='ISO-8859-1' standalone='no'?>" "<csw:GetRecords " "xmlns:csw='http://www.opengis.net/cat/csw/2.0.2' " "xmlns:ogc='http://www.opengis.net/ogc' " "service='CSW' " "version='2....
#!/usr/bin/python # ============================================================================== # Author: Tao Li (taoli@ucsd.edu) # Date: May 2, 2015 # Question: 104-Maximum-Depth-of-Binary-Tree # Link: https://leetcode.com/problems/maximum-depth-of-binary-tree/ # ==========================================...
"""Reachy Pyluos Hal abstraction. Connects to the multipled gates via serial to synchronize with hardware. """
# ------------------------------------------ API URLs ------------------------------------------------------------------ GOOGLE_PROFILE_API_URL = 'https://www.googleapis.com/userinfo/v2/me' FACEBOOK_PROFILE_API_URL = 'https://graph.facebook.com/v3.2/me' FACEBOOK_PROFILE_PIC_API_URL = 'https://graph.facebook.com/v3.2/m...
class Solution(object): def minWindow(self, s, t): """ :type s: str :type t: str :rtype: str """ start, end, left = 0, 0, 0 min_len = sys.maxsize hash = collections.defaultdict(int) for i in t: hash[i] += 1 num =...
text = "Have a nice day!\nSee ya!" # with open("test1.txt", "a") as file: # append some text # file.write(text) # with open("test1.txt", "w") as file: # write a text overwriting # file.write(text) # with open("test1.txt", "r") as file: # read a text # ...
# 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. { 'includes': [ 'extensions.gypi', ], 'variables': { 'chromium_code': 1, }, 'targets': [ { # GN version: //extensions/common ...
def total_takings(monthly_takings): """ A regular flying circus happens twice or three times a month. For each month, information about the amount of money taken at each event is saved in a list, so that the amounts appear in the order in which they happened. The months' data is all collected in a dictionary ca...
class MyTime: def __init__(self, hrs=0, mins=0, secs=0): """ Create a MyTime object initialized to hrs, mins, secs """ self.hours = hrs self.minutes = mins self.seconds = secs totalsecs = hrs * 3600 + mins * 60 + secs self.hours = totalsecs // 3600 # Split in h, m,...
class XpathValidationError(Exception): """ When an error occurs in the process of xpath validation (NOT when an xpath is invalid) """ pass