content
stringlengths
7
1.05M
JWT_SECRET_KEY = "e75a9e10168350b2a8869a8eb8a0f946a15eec8452048c0b51923f98ea9ea43b" JWT_ALGORITHM = "HS256" JWT_EXPIRATION_TIME_MINUTES = 60 * 24 * 5 TOKEN_DESCRIPTION = "It checks username and password if they are true, it returns JWT token to you." TOKEN_SUMMARY = "It returns JWT Token." ISBN_DESCRIPTION = "It is u...
load(":rollup_js_result.bzl", "RollupJsResult") def _impl(ctx): node_executable = ctx.attr.node_executable.files.to_list()[0] rollup_script = ctx.attr.rollup_script.files.to_list()[0] module_name = ctx.attr.module_name node_modules_path = rollup_script.path.split("/node_modules/")[0] + "/node_modules" ...
''' A format for expressing an ordered list of integers is to use a comma separated list of either individual integers or a range of integers denoted by the starting integer separated from the end integer in the range by a dash, '-'. The range includes all integers in the interval including both endpoints. It is not c...
class Pattern_Seven: '''Pattern seven * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ''' def __init__(self, strings='*', steps=10): self.steps = st...
# Example 1: # Input: haystack = "hello", needle = "ll" # Output: 2 # Example 2: # Input: haystack = "aaaaa", needle = "bba" # Output: -1 # Example 3: # Input: haystack = "", needle = "" # Output: 0 class Solution: def strStr(self, haystack: str, needle: str) -> int: return haystack.find(needle)
#!/usr/bin/env python3 for file_name in ['file_ignored_by_git_included_explicitly', 'file_managed_by_git']: with open(file_name) as f: print(f.read(), end='') for file_name in ['file_managed_by_git_excluded', 'file_ignored_by_git']: try: with open(file_name)...
# https://leetcode.com/problems/ugly-number/ # # Write a program to check whether a given number is an ugly number. # # Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. # For example, 6, 8 are ugly while 14 is not ugly since it includes another prime factor 7. # # Note that 1 is typically tre...
#! usr/bin/python3 """ This is the python script used to download few codechef questions from the website. Put them in the correct place as the structure demands like beginner questions in beginner and so on. Add the question statement as a Readme.md for each question and the link to the question. <Add the features o...
captcha="4281224989975872839961169513979579335691369498483794171253625322698694611857431137339923313798564463624821296465562866115437565642757153598749248981134244727829747894643486262785329362288817862735862788865758282393667944292233174767223374243992399861536752759241133225618738143644513391869188134516852631928916...
class Metric: def __init__(self): pass def update(self, outputs, target): raise NotImplementedError def value(self): raise NotImplementedError def name(self): raise NotImplementedError def reset(self): pass
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. # Copyright (c) 2011 Cubic ERP - Teradata SAC. (http://cubicerp.com). { 'name': 'Peru - Accounting', 'description': """ Peruvian accounting chart and tax localization. According the PCGE 2010. ==================...
"""Proper parenthetics.""" def lisp_parens_with_count(parens): """Output with count to see whether parens are open(1), broken(-1), or balanced(0).""" open_count = 0 for par in parens: if par == '(': open_count elif par == ')': open_count -= 1 if open_count <...
## Local ems economic dispatch computing format # Diesel generator set PG = 0 RG = 1 # Utility grid set PUG = 2 RUG = 3 # Bi-directional convertor set PBIC_AC2DC = 4 PBIC_DC2AC = 5 # Energy storage system set PESS_C = 6 PESS_DC = 7 RESS = 8 EESS = 9 # Neighboring MG set PMG = 10 # Emergency curtailment or shedding set ...
def find(n): l = [''] * (n + 1) size = 1 m = 1 while (size <= n): i = 0 while(i < m and (size + i) <= n): l[size + i] = "1" + l[size - m + i] i += 1 i = 0 while(i < m and (size + m + i) <= n): l[size + m + i] = "2" + l[size - m + i] ...
# -*- coding: utf-8 -*- class warehouse: def __init__(self, location, product): self.location = location self.deliveryPoints = list() self.allProducts = product self.wishlist = list() self.excessInventory = [] self.allProducts = self.convertInv(self.allProducts) ...
# dummy variables for flake8 # see: https://github.com/patrick-kidger/torchtyping/blob/master/FURTHER-DOCUMENTATION.md batch = None channels = None time = None behavior = None annotator = None classes = None
T = input() soma = 0 matriz = [] for i in range(0,12,+1): linha = [] for j in range(0,12,+1): numeros = float(input()) linha.append(numeros) matriz.append(linha) contagem = 0 pegaNum = 0 for i in range(1, 12,+1): #linha for j in range(0, i, +1): pegaNum = float(matriz[i][j]) ...
"""A library to help interacting with omegaUp. This is composed of two modules: - [**`omegaup.api`**](./omegaup/api/) helps interacting with [omegaUp's API](https://github.com/omegaup/omegaup/blob/master/frontend/server/src/Controllers/README.md) and is auto-generated with correct types and the docstrings straigh...
# -*- coding: utf-8 -*- """ cli structs module. """ class CLIGroups: """ cli groups class. each cli handler group will be registered with its relevant group name. usage example: `python cli.py alembic upgrade --arg value` `python cli.py babel extract --arg value` `python cli.py template...
#!/usr/bin/env python3 def word_frequencies(filename="src/alice.txt"): with open(filename, "r") as f: lines = f.readlines() d = {} for line in lines: words = line.split() for word in words: word = word.strip("""!"#$%&'()*,-./:;?@[]_""") if d.get(word) !=...
class REQUEST_MSG(object): TYPE_FIELD = "type" GET_ID = "get-id" CONNECT_NODE = "connect-node" AUTHENTICATE = "authentication" HOST_MODEL = "host-model" RUN_INFERENCE = "run-inference" LIST_MODELS = "list-models" DELETE_MODEL = "delete-model" DOWNLOAD_MODEL = "download-model" SYF...
valid_passwords = 0 with open('input.txt', 'r') as f: for line in f: min_max, letter_colon, password = line.split() pmin, pmax = [int(c) for c in min_max.split('-')] letter = letter_colon[0:1] # remove colon password = ' ' + password # account for 1-indexing matching_chars = 0 ...
class Globee404NotFound(Exception): def __init__(self): super().__init__() self.message = 'Payment Request returned 404: Not Found' def __str__(self): return self.message class Globee422UnprocessableEntity(Exception): def __init__(self, errors): super().__init__() ...
class BaseExchangeContactService(object): def __init__(self, service, folder_id): self.service = service self.folder_id = folder_id def get_contact(self, id): raise NotImplementedError def new_contact(self, **properties): raise NotImplementedError class BaseExchangeContac...
# coding: utf-8 n, t = [int(i) for i in input().split()] queue = list(input()) for i in range(t): queue_new = list(queue) for j in range(n-1): if queue[j]=='B' and queue[j+1]=='G': queue_new[j], queue_new[j+1] = queue_new[j+1], queue_new[j] queue = list(queue_new) print(''.join(queue))
### global constants ### hbar = None ### dictionary for hbar ### hbars = {'ev': 0.658229, 'cm': 5308.8, 'au': 1.0 } ### energy units ### conv = {'ev': 0.0367493, 'cm': 4.556e-6, 'au': 1.0, 'fs': 41.3413745758, 'ps': 41.3413745758*1000.} ### mass units ### me2...
# Per kobotoolbox/kobo-docker#301, we have changed the uWSGI port to 8001. This # provides a helpful message to anyone still trying to use port 8000. # Based upon # https://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html#the-first-wsgi-application html_response = b''' <html> <head><title>System configuration e...
class Action: def __init__(self, num1: float, num2: float): self.num1 = num1 self.num2 = num2 class History: def __init__(self, goldenNums: list, userActs: dict): self.goldenNums = goldenNums self.userActs = userActs class Game: def __init__(self): self.goldenNums...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/2/14 14:58 # @Author : Baimohan/PH # @Site : https://github.com/BaiMoHan # @File : varargs3.py # @Software: PyCharm def test(x, y, z=3, *books, **scores): # **代表收集关键字参数 print(x, y, z) print(books) # 收集参数保存的是元组 print(scores) # 对于关键...
PORT = 8050 DEBUG = True DASH_TABLE_PAGE_SIZE = 5 DEFAULT_WAVELENGTH_UNIT = "angstrom" DEFAULT_FLUX_UNIT = "F_lambda" LOGS = { "do_log":True, "base_logs_directory":"/base/logs/directory/" } MAX_NUM_TRACES = 30 CATALOGS = { "sdss": { "base_data_path":"/base/data/path/", ...
def show_urls( urllist, depth=0 ): for entry in urllist: if ( hasattr( entry, 'namespace' ) ): print( "\t" * depth, entry.pattern.regex.pattern, "[%s]" % entry.namespace ) else: print( "\t" * depth, entry.pattern.regex.pattern, "[%s]" % e...
def area(l, c): return f'A área do terreno {l}x{c} é de {l * c:.2f} m²' print(area(float(input('Qual a largura do terreno? ')), float(input('Qual o comprimento do terreno? '))))
class DictToObject(object): def __init__(self, dictionary): def _traverse(key, element): if isinstance(element, dict): return key, DictToObject(element) else: return key, element objd = dict(_traverse(k, v) for k, v in dictionary.items()) ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- MAX_SEQUENCE_LENGTH = 800 MAX_NB_WORDS = 20000 EMBEDDING_DIM = 50 #300 VALIDATION_SPLIT = 0.2 TEST_SPLIT = 0.10 K=10 #10 EPOCHES=100 #100 OVER_SAMPLE_NUM = 800 UNDER_SAMPLE_NUM = 500 ACTIVATION_M = 'sigmoid' LOSS_M = 'binary_crossentropy' OPTIMIZER_M = 'adam' ACTIVATI...
{"tablejoin_id": 204, "matched_record_count": 156, "layer_join_attribute": "TRACT", "join_layer_id": "641", "worldmap_username": "rp", "unmatched_records_list": "", "layer_typename": "geonode:join_boston_census_blocks_0zm_boston_income_01tab_1_1", "join_layer_url": "/data/geonode:join_boston_census_blocks_0zm_bo...
""" network-structure of vgg16 excludes fully-connection layer date: 9/17 author: arabian9ts """ # structure of convolution and pooling layer up to fully-connection layer """ size-format: [ [ convolution_kernel ], [ bias ] ] [ [ f_h, f_w, in_size, out_size ], [ out_size ] ] """...
""" Set of tools to work with different observations. """ __all__ = ["hinode", "iris"]
def wiki_json(name): name = name.strip().title() url = 'https://en.wikipedia.org/w/api.php?action=query&titles={0}&continue=&prop=categories&format=json'.format(name) return url def categories(response): return response.json()["query"]["pages"].values()[0]["categories"] def is_ambiguous(dic): for ite...
""" IPv4 was the first publicly used Internet Protocol. It used 4-byte addresses and permitted 232 distinct values. The typical format for an IPv4 address is A.B.C.D where A, B, C, and D are integers in the inclusive range between 0 and 255. IPv6, with 128 bits, was developed to permit the expansion of the address spa...
# Escreva um programa para ler um vetor de 10 elementos inteiros. Em seguida exclua o 3° elemento do vetor deslocando os elementos subsequentes uma posição para o inicio do vetor. Depois escreva o vetor resultante na tela. list = [1,2,3,4,5,6,7,8,9,10] for i in range(len(list)): print(f"Posição {i}: {list[i]}") ...
class ValidationError(Exception): pass class MaxSizeValidator: def __init__(self, max_size): self.so_far = 0 self.max_size = max_size def __call__(self, chunk): self.so_far += len(chunk) if self.so_far > self.max_size: raise ValidationError( 'S...
# # JSON Output # def GenerateJSONArray(list, startIndex=0, endIndex=None, date=False): # Generate a json array string from a list # ASSUMPTION: All items are of the same type / if one is list all are list if(len(list) > 0 and type(list[0]) == type([])): # If the list has entries and...
#!/usr/bin/python3 def target_in(box, position): xs, xe = min(box[0]), max(box[0]) ys, ye = min(box[1]), max(box[1]) if position[0] >= xs and position[0] <= xe and position[1] >= ys and position[1] <= ye: return True return False def do_step(pos, v): next_pos = (pos[0] + v[0], pos[1] + v[1...
# login.py # # Copyright 2011 Joseph Lewis <joehms22@gmail.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at yo...
def print_line(): print("-" * 60) def print_full_header(build_step_name): print_line() print(" Build Step /// {}".format(build_step_name)) def print_footer(): print_line() def log(level, data): print("{0}: {1}".format(level, data))
def partition(lst,strt,end): pindex = strt for i in range(strt,end-1): if lst[i] <= lst[end-1]: lst[pindex],lst[i] = lst[i],lst[pindex] pindex += 1 lst[pindex],lst[end-1] = lst[end-1],lst[pindex] return pindex def quickSort(lst,strt=0,end=0): if strt >= end: ...
class Encapsulation: def __init__(self): self.__my_price = 10 def sell(self): print("my selling price is {}".format(self.__my_price)) def setprice(self, price): self.__my_price = price encap = Encapsulation() encap.sell() encap.__my_price = 20 encap.sell() encap.setprice(20) encap...
# You will receive lines of input: # • On the first line, you will receive a title of an article # • On the second line, you will receive the content of that article # • On the following lines, until you receive "end of comments" you will get the comments about the article # # Print the whole information in html forma...
# -*- encoding: utf-8 -*- ''' @Time : 2020/7/27 9:36 @Author : qinhanluo @File : gunicorn.conf.py @Software: PyCharm @Description : TODO ''' workers = 5 worker_class = 'gevent' bind = "0.0.0.0:5000"
#Code that can be used to calculate the total cost of room makeover in a house def room_area(width, length): return width*length def room_name(): print("What is the name of the room?") return input() def price(name,area): if name == "bathroom": return 20*area elif name == "kitchen": return 10*area e...
epochs=300 batch_size=16 latent=10 lr=0.0002 weight_decay=5e-4 encode_dim=[3200, 1600, 800, 400] decode_dim=[] print_interval=10
def histogram(data, n, b, h): # data is a list # n is an integer # b and h are floats # Write your code here # return the variable storing the histogram # Output should be a list pass def addressbook(name_to_phone, name_to_address): #name_to_phone and name_to_addre...
class Solution: def countStudents(self, students: List[int], sandwiches: List[int]) -> int: count = {0:0, 1:0} for el in students: count[el] += 1 i = 0 while i < len(students) and count[sandwiches[i]]: count[sandwiches[i]] -= 1 i += 1 ...
streetlights = [ { "_id": "5c33cb90633a6f0003bcb38b", "latitude": 40.109356050955824, "longitude": -88.23546712954632, }, { "_id": "5c33cb90633a6f0003bcb38c", "latitude": 40.10956288950609, "longitude": -88.23546931624688, }, { "_id": "5c33cb90...
def contador(*num): for valor in num: print(num) contad contador(1, 2, 3,)
a = [[1, 2, 3], [1, 2, 3], [1, 2, 3]] def t(): for i in range(len(a)): a[i][i] = a[i][i]*2 t() print(a)
# Vipul Patel Hectoberfest def fun1(n): for i in range(1, n + 1): if i % 3 == 0 and i % 5 != 0: print("Fizz") elif i % 5 == 0 and i % 3 != 0: print("Buzz") elif i % 3 == 0 and i % 5 == 0: print("FizzBuzz") else: print(i) num = 100 # ...
# Find the first n ugly numbers # Ugly numbers are the numbers whose prime factors are 2,3 or 5. # Normal Approach : # Run a loop till n and check if it has 2,3 or 5 as the only prime factors # if yes, then print the number. It is in-efficient but has constant extra space. # DP approach : # As we know, every other n...
teste = 3 * 5 + 4 ** 2 s = 'prova de python' n = 'José' i = 25 print('Você se chama {} e tem {} anos de idade'.format(n, i))
# Lexical Grammar: # # NUMBER → DIGIT+ ( "." DIGIT+ )? ; # STRING → "\"" <any char except "\"">* "\"" ; # IDENTIFIER → (ALPHA | "@") ( ALPHA | DIGIT )* ; # ALPHA → "a" ... "z" | "A" ... "Z" | "_" ; # DIGIT → "0" ... "9" ; class AstError(Exception): def __init__(self, msg, posi...
def initialize(context): context.spy= sid(8554) schedule_function(my_rebalance, date_rules.month_start(), time_rules.market_open()) def my_rebalance(context,data): position= context.portfolio.positions[context.spy].amount if position == 0: order_target_percent(context.spy, 1.0) re...
# Shared list of BuiltIn keywords that should be implemented # by specialized comparators. builtin_method_names = ( "should_be_equal", "should_not_be_equal", "should_be_empty", "should_not_be_empty", "should_match", "should_not_match", "should_match_regexp", "should_not_match_regexp", ...
""" leetcode 239 Sliding Window Maximum """ """ Time Complexity: O(N*logk) Because python doesn't have an index_maxheap,so need to implement Notes: 1)当“滑动窗口”要把左边界移除的时候,但是没有从一个堆中移除非最堆顶元素的操作; 2)找到即将要滑出边界的那个索引,索引值如何更新呢?新进来的那个数的索引,索引对 k 取模的那个索引进行更新. """ class IndexMaxHeap: def __init__(self, capacity: int): ...
REPORTS = [ { "address": "0xCd0D1a6BD24fCD578d1bb211487cD24f840BC900", "payload": { "messages": [ "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000602110e50000000000000000000000000000000000000000000...
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/parallels/catkin_ws/install/include".split(';') if "/home/parallels/catkin_ws/install/include" != "" else [] PROJECT_CATKIN_DEPENDS = "cv_bridge;image_geometry;image_transport;camera_info_manager...
self.description = "Fileconflict file -> dir on package replacement (FS#24904)" lp = pmpkg("dummy") lp.files = ["dir/filepath", "dir/file"] self.addpkg2db("local", lp) p1 = pmpkg("replace") p1.provides = ["dummy"] p1.replaces = ["dummy"] p1.files = ["dir/filepath/", "dir/filepath/file", ...
#!/usr/bin/env python # -*- encoding: utf-8 -*- # # Copyright 2014 Telefónica Investigación y Desarrollo, S.A.U # # This file is part of FI-WARE 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 th...
def find_lowest(lst): # Return the lowest positive # number in a list. def lowest(first, rest): # Base case if len(rest) == 0: return first if first > rest[0] or first < 0: return lowest(rest[0], rest[1:]) else: return lowest(first, rest) return lowest(lst[0], lst[1:]) a = [16,...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"get_installed_dependencies": "00_checker.ipynb", "check_new_version": "00_checker.ipynb"} modules = ["checker.py"] doc_url = "https://muellerzr.github.io/dependency_checker/" git_url = "https://g...
path_name = "SampleWrite.txt" ### withを使ったファイル読み込み with open(path_name, mode='w') as f: f.write('hello new world!!') # close不要 # f.close()
num = 600851475143 p = int(num**0.5) + 1 factors = [] def addToFactors(x): for f in factors: if not x % f: return factors.append(x) for i in range(2, p): if not num % i: addToFactors(i) print(max(factors))
# https://codeforces.com/problemset/problem/230/B n = int(input()) numbers = [int(x) for x in input().split()] counter = 0 for number in numbers: if number == 1 or number == 2: print('NO') continue for x in range(2, number): if counter > 1: break if number % x == 0...
class Solution(object): def majorityElement(self, nums): """ :type nums: List[int] :rtype: int """ c = len(nums) / 3 m = {} for n in nums: m[n] = m.get(n, 0) + 1 return [k for k, v in m.items() if v > c] def test_majority_element(): s...
# Default dt for the imaging DEF_DT = 0.2 # Parameters for cropping around bouts: PRE_INT_BT_S = 2 # before POST_INT_BT_S = 6 # after
first_sequence = list(map(int, input().split())) second_sequence = list(map(int, input().split())) line = input() while not line == 'nexus': first_pair, second_pair = line.split('|') first_list_index1, second_list_index1 = list(map(int, first_pair.split(':'))) first_list_index2, second_list_index2 = list(...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def mergeKLists(self, lists: List[Optional[ListNode]]) -> Optional[ListNode]: node_list = [] sentinel = head = ListNode(0, None) ...
# https://leetcode.com/problems/fair-candy-swap/discuss/161269/C%2B%2BJavaPython-Straight-Forward class Solution: def fairCandySwap(self, A: List[int], B: List[int]) -> List[int]: diff = (sum(A) - sum(B)) // 2 B = set(B) A = set(A) for b in B: if b + diff in A: ...
class BaseEncounter(object): """Base encounter class.""" def __init__(self, player, check_if_happens=True): self.p = self.player = player if (check_if_happens and self.check_if_happens()) or not check_if_happens: enc_name = self.__class__.__name__ enc_dict = self.p.game....
# create node class class Node: def __init__(self, value=None, next=None): self.value = value self.next = next # create stack class Stack: def __init__(self): self.top = None def isEmpty(self): if self.top == None: return True else: ...
""" Copyright 2020 Robert MacGregor Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, d...
# -*- coding: utf-8 -*- class Hero(object): def __init__(self, forename, surname, hero): self.forename = forename self.surname = surname self.heroname = hero
class Ball: def __init__(self): self.x, self.y = 320, 240 self.speed_x = -10 self.speed_y = 10 self.size = 8 def movement(self, player1, player2): self.x += self.speed_x self.y += self.speed_y if self.y <= 0: self.speed_y *= -1 elif s...
def fizzbuzz(n): if n%3 == 0 and n%5 != 0: resultado = "Fizz" elif n%5 == 0 and n%3 != 0: resultado = "Buzz" elif n%3 == 0 and n%5 == 0: resultado = "FizzBuzz" else: resultado = n return resultado
{ "includes": [ "ext/snowcrash/common.gypi" ], "targets" : [ # LIBSOS { 'target_name': 'libsos', 'type': 'static_library', 'direct_dependent_settings' : { 'include_dirs': [ 'ext/sos/src' ], }, 'sources': [ 'ext/sos/src/sos.cc', 'ext/sos/src/sos.h',...
# Config key of the MYSQL tag in config.ini MSSQL_TAG = "MSSQL" HOST_CONFIG = "host" DATABASE_CONFIG = "database" USER_CONFIG = "user" PASSWORD_CONFIG = "password" TABLE_CONFIG = "table" DRIVER_CONFIG = "driver" INSTANCE_NAME_FIELD_CONFIG = "instance_name_column" TIMESTAMP_FIELD_CONFIG = "timestamp_column" TIMESTAMP_FO...
print("hello, what is your name?") name = input() print("hi " + name)
#Python 3.X solution for Easy Challenge #0007 #GitHub: https://github.com/Ashkore #https://www.reddit.com/user/Ashkoree/ alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"] morase = [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-.....
'''As Organizações Tabajara resolveram dar um aumento de salário aos seus colaboradores e lhe contraram para desenvolver o programa que calculará os reajustes. Faça um programa que recebe o salário de um colaborador e o reajuste segundo o seguinte critério, baseado no salário atual: salários até R$ 880,00 (incluindo)...
# Write a function or lambda using the implementation of fold below that will # return the product of the elements of a list. def or_else(lhs, rhs): if lhs != None: return lhs else: return rhs def fold(function, arguments, initializer, accumulator = None): if len(arguments) == 0: return accumulator else: r...
def solution(A): nums = {} for num in A: nums[num] = 1 for num in nums: if num + 1 in nums or num - 1 in nums: return True return False def solution(N): num = N numStr = str(N) if num < 0: length = len(numStr) - 1 while length > 0: if ...
test = { 'name': 'q1_1', 'points': 1, 'suites': [ { 'cases': [{'code': ">>> unemployment.select('Date', 'NEI', 'NEI-PTER').take(0).column(0).item(0) == '1994-01-01'\nTrue", 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 't...
command = input() numbers_sequence = [int(x) for x in input().split()] odd_numbers = [] even_numbers = [] for number in numbers_sequence: if number % 2 == 0: even_numbers.append(number) else: odd_numbers.append(number) if command == 'Odd': print(sum(odd_numbers) * len(numbers_sequence)) e...
def sainte_claire1(general, dev, msg) : code = 2 prio = 500 prio += adjust_prio(general, dev, msg) keys=list(); keys.append('Sainte Claire') if ( not contains(dev, keys) ) : return (0, 0, 0, '', '') if ( dev['Sainte Claire']['count'] < 3) : return (0, 0, 0, '', '') title = "RU @ Sainte Claire?" body = "...
"""Test the backend models module""" def test_foo(): """A fake test, because I just want to get nox to pass"""
# General TEMP_FILES_PATH = '/tmp/temp_files_parkun' PERSONAL_FOLDER = 'broadcaster' BOLD = 'bold' ITALIC = 'italic' MONO = 'mono' STRIKE = 'strike' POST_URL = 'post_url' # Twitter TWITTER_ENABLED = False CONSUMER_KEY = 'consumer_key' CONSUMER_SECRET = 'consumer_secret' ACCESS_TOKEN = 'access_token' ACCESS_TOKEN_SEC...
''' Author : MiKueen Level : Easy Problem Statement : Convert Binary Number in a Linked List to Integer Given head which is a reference node to a singly-linked list. The value of each node in the linked list is either 0 or 1. The linked list holds the binary representation of a number. Return the decimal value of the...
def computepay(h,r): return 42.37 hrs = input("Enter Hours : ") h = float(hrs) rate = input("Enter rate per hour : ") r = float(rate) if h > 40: gross = (40*r)+(h-40)*(r*1.5) print(gross) else: gross=h*r print(gross)
for t in range(int(input())): p, q = map(int, input().split()) q = q + 1 hori = [0 for _ in range(q)] vert = [0 for _ in range(q)] for _ in range(p): x, y, d = input().split() x = int(x) y = int(y) if d == 'N': vert[y + 1] += 1 if d == 'S': vert[y] -= 1 vert[0] += 1 ...
matrix = [sublist.split() for sublist in input().split("|")][::-1] print(' '.join([str(number) for sublist in matrix for number in sublist]))
LOGIN_URL = "/login" XPATH_EMAIL_INPUT = "//form//input[contains(@placeholder,'Email')]" XPATH_PASSWORD_INPUT = "//form//input[contains(@placeholder,'Password')]" XPATH_SUBMIT = "//form//button[contains(@type,'submit')]"