content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def urandom(n): # """urandom(n) -> str # Return a string of n random bytes suitable for cryptographic use. # """ #try: # _urandomfd = open("/dev/urandom", O_RDONLY) #except (OSError, IOError): # raise NotImplementedError("/dev/urandom (or equivalent) not found") #try: # bs...
def urandom(n): raise not_implemented_error('/dev/urandom (or equivalent) not found') return bs
#!/usr/bin/env python """List of hedge funds/institution names **for educational purposes only. MIT License""" __author__ = "Aneesh Panoli" __copyright__ = "MIT License" def institutions(): keywords = ["Natixis", "TIAA", "Deutsche", "Invesco", "Franklin", "Rowe", "AXA", "Legg", "Sumitomo"\ ...
"""List of hedge funds/institution names **for educational purposes only. MIT License""" __author__ = 'Aneesh Panoli' __copyright__ = 'MIT License' def institutions(): keywords = ['Natixis', 'TIAA', 'Deutsche', 'Invesco', 'Franklin', 'Rowe', 'AXA', 'Legg', 'Sumitomo', 'UBS', 'Affiliated', 'Mitsubishi', 'Insight', ...
# # @lc app=leetcode id=114 lang=python3 # # [114] Flatten Binary Tree to Linked List # # https://leetcode.com/problems/flatten-binary-tree-to-linked-list/description/ # # algorithms # Medium (51.57%) # Likes: 4378 # Dislikes: 411 # Total Accepted: 451.1K # Total Submissions: 847.4K # Testcase Example: '[1,2,5,3...
class Solution: def flatten(self, root: TreeNode) -> None: """ Do not return anything, modify root in-place instead. """ if root is None: return None self.flatten(root.left) self.flatten(root.right) if root.left is None: return None ...
def Tproduct(arg0, *args): p = arg0 for arg in args: p *= arg return p
def tproduct(arg0, *args): p = arg0 for arg in args: p *= arg return p
mylist = input('Enter your list: ') mylist = [int(x) for x in mylist.split(' ')] points = [0,15,10,10,25,15,15,20,10,25,20,25,25,5,20,30,20,15,10,5,5,15,20,20,20,20,15,15,20,25,15,20,20,20,15,40,15,30,35,20,25,15,20,15,25,20,25,20,25,20,10] total = 0 for index in mylist: total += points[index] print (total)
mylist = input('Enter your list: ') mylist = [int(x) for x in mylist.split(' ')] points = [0, 15, 10, 10, 25, 15, 15, 20, 10, 25, 20, 25, 25, 5, 20, 30, 20, 15, 10, 5, 5, 15, 20, 20, 20, 20, 15, 15, 20, 25, 15, 20, 20, 20, 15, 40, 15, 30, 35, 20, 25, 15, 20, 15, 25, 20, 25, 20, 25, 20, 10] total = 0 for index in mylist...
"""Pipelines for features generation.""" __all__ = [ "base", "lgb_pipeline", "image_pipeline", "linear_pipeline", "text_pipeline", "wb_pipeline", ]
"""Pipelines for features generation.""" __all__ = ['base', 'lgb_pipeline', 'image_pipeline', 'linear_pipeline', 'text_pipeline', 'wb_pipeline']
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
""" The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # # FreeType high-level python API - Copyright 2011-2015 Nicolas P. Rougier # Distributed under the terms of the new BSD license. # # ----------------------------------------------------------------------------- ""...
""" These values determine how the end of opened sub-paths are rendered in a stroke. FT_STROKER_LINECAP_BUTT The end of lines is rendered as a full stop on the last point itself. FT_STROKER_LINECAP_ROUND The end of lines is rendered as a half-circle around the last point. FT_STROKER_LINECAP_SQUARE The en...
INPUT_FILE = "../../input/01.txt" def parse_input() -> list[int]: """ Parses the input and returns a list of depth measurements. """ with open(INPUT_FILE, "r") as f: return [int(line) for line in f] def count_increases(measurements: list[int]) -> int: """ Counts the number of times a...
input_file = '../../input/01.txt' def parse_input() -> list[int]: """ Parses the input and returns a list of depth measurements. """ with open(INPUT_FILE, 'r') as f: return [int(line) for line in f] def count_increases(measurements: list[int]) -> int: """ Counts the number of times a m...
URLS = 'app.urls' POSTGRESQL_DATABASE_URI = "" DEBUG = True BASE_HOSTNAME = 'http://192.168.30.101:8080' HOST = '0.0.0.0' USERNAME = 'user' PASSWORD = 'pass'
urls = 'app.urls' postgresql_database_uri = '' debug = True base_hostname = 'http://192.168.30.101:8080' host = '0.0.0.0' username = 'user' password = 'pass'
class ModelMetrics: def __init__(self, model_name, model_version, metric_by_feature): self.model_name = model_name self.model_version = model_version self.metrics_by_feature = metric_by_feature
class Modelmetrics: def __init__(self, model_name, model_version, metric_by_feature): self.model_name = model_name self.model_version = model_version self.metrics_by_feature = metric_by_feature
{ "name": "Attachment Url", "summary": """Use attachment URL and upload data to external storage""", "category": "Tools", "images": [], "version": "13.0.2.1.0", "application": False, "author": "IT-Projects LLC, Ildar Nasyrov", "website": "https://apps.odoo.com/apps/modules/13.0/ir_attach...
{'name': 'Attachment Url', 'summary': 'Use attachment URL and upload data to external storage', 'category': 'Tools', 'images': [], 'version': '13.0.2.1.0', 'application': False, 'author': 'IT-Projects LLC, Ildar Nasyrov', 'website': 'https://apps.odoo.com/apps/modules/13.0/ir_attachment_url/', 'license': 'LGPL-3', 'dep...
class Sample: """A representation of a sample obtained from IRIDA""" def __init__(self, name, paired_path, unpaired_path): """ Initialize a sample instance :type name: str :param name: the name of the sample :type path: str :param path: the URI to obtain the sa...
class Sample: """A representation of a sample obtained from IRIDA""" def __init__(self, name, paired_path, unpaired_path): """ Initialize a sample instance :type name: str :param name: the name of the sample :type path: str :param path: the URI to obtain the sam...
class QuotesType: """ Checks whether quotation marks are double or single in source file. """ NEED_TO_USE_SINGLE_QUOTES = 'need_to_use_single_quotes' NEED_TO_USE_DOUBLE_QUOTES = 'need_to_use_double_quotes' discrete_groups = [ { 'name': 'single_quotes' }, { 'name': 'double_quotes' }, ...
class Quotestype: """ Checks whether quotation marks are double or single in source file. """ need_to_use_single_quotes = 'need_to_use_single_quotes' need_to_use_double_quotes = 'need_to_use_double_quotes' discrete_groups = [{'name': 'single_quotes'}, {'name': 'double_quotes'}] inspections = {NEED_T...
def get_xoutput_ref(self): """Return the reference XOutput (or Output) either from xoutput_ref or output_list Parameters ---------- self : XOutput A XOutput object Returns ------- xoutput_ref: XOutput reference XOutput (or Output) (if defined) """ if self.xoutput_re...
def get_xoutput_ref(self): """Return the reference XOutput (or Output) either from xoutput_ref or output_list Parameters ---------- self : XOutput A XOutput object Returns ------- xoutput_ref: XOutput reference XOutput (or Output) (if defined) """ if self.xoutput_ref...
def constraint_in_set(_set = range(0,128)): def f(context): note, seq, tick = context if seq.to_pitch_set() == {}: return False return seq.to_pitch_set().issubset(_set) return f def constraint_no_repeated_adjacent_notes(): def f(context): note, seq, tick = co...
def constraint_in_set(_set=range(0, 128)): def f(context): (note, seq, tick) = context if seq.to_pitch_set() == {}: return False return seq.to_pitch_set().issubset(_set) return f def constraint_no_repeated_adjacent_notes(): def f(context): (note, seq, tick) = c...
load("@rules_scala_annex//rules:providers.bzl", "LabeledJars") def labeled_jars_implementation(target, ctx): if JavaInfo not in target: return [] deps_labeled_jars = [dep[LabeledJars] for dep in getattr(ctx.rule.attr, "deps", []) if LabeledJars in dep] java_info = target[JavaInfo] return [ ...
load('@rules_scala_annex//rules:providers.bzl', 'LabeledJars') def labeled_jars_implementation(target, ctx): if JavaInfo not in target: return [] deps_labeled_jars = [dep[LabeledJars] for dep in getattr(ctx.rule.attr, 'deps', []) if LabeledJars in dep] java_info = target[JavaInfo] return [label...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may...
class Tablejoiner: def __init__(self, hive_context, query): self.query = query self.hive_context = hive_context def join_tables(self): df = self.hive_context.sql(self.query) return df
def check_for_wildcard(policy): """ Checks for wildcards in policy statements """ # Make sure Statement is a list if type(policy.policy_json['Statement']) is dict: policy.policy_json['Statement'] = [ policy.policy_json['Statement'] ] for sid in policy.policy_json['Statement']: ...
def check_for_wildcard(policy): """ Checks for wildcards in policy statements """ if type(policy.policy_json['Statement']) is dict: policy.policy_json['Statement'] = [policy.policy_json['Statement']] for sid in policy.policy_json['Statement']: if 'Action' in sid: if type(...
#Escreva um programa que leia a velocidade de um carro. velocidade = float(input('Velocidade: ')) # Se ele ultrapassar 80Km/h, mostre uma mensagem dizendo que ele foi multado if velocidade > 80: print(f'Passou a {velocidade} numa pista de 80 !!! \nVai pagar R${((velocidade-80)*30):.2f} de multa') #A multa vai custa...
velocidade = float(input('Velocidade: ')) if velocidade > 80: print(f'Passou a {velocidade} numa pista de 80 !!! \nVai pagar R${(velocidade - 80) * 30:.2f} de multa') else: print(f'{velocidade}Km. Voce estava dentro do limite de 80Km')
# This is the version string assigned to the entire egg post # setup.py install __version__ = "0.0.9" # Ownership and Copyright Information. __author__ = "Colin Bell <colin.bell@uwaterloo.ca>" __copyright__ = "Copyright 2011-2014, University of Waterloo" __license__ = "BSD-new"
__version__ = '0.0.9' __author__ = 'Colin Bell <colin.bell@uwaterloo.ca>' __copyright__ = 'Copyright 2011-2014, University of Waterloo' __license__ = 'BSD-new'
#This file was created by Diego Saldana TITLE = " SUPREME JUMP " TITLE2 = " GAME OVER FOO :( " # screen dims WIDTH = 480 HEIGHT = 600 # frames per second FPS = 60 # player settings PLAYER_ACC = 0.5 PLAYER_FRICTION = -0.12 PLAYER_GRAV = 0.8 PLAYER_JUMP = 100 FONT_NAME = 'arcade' # platform settings PLATFO...
title = ' SUPREME JUMP ' title2 = ' GAME OVER FOO :( ' width = 480 height = 600 fps = 60 player_acc = 0.5 player_friction = -0.12 player_grav = 0.8 player_jump = 100 font_name = 'arcade' platform_list = [(0, HEIGHT - 40, WIDTH, 40), (65, HEIGHT - 300, WIDTH - 400, 40), (20, HEIGHT - 350, WIDTH - 300, 40), (200, HEIGHT ...
# # PySNMP MIB module XYLAN-HEALTH-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XYLAN-HEALTH-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:38:37 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, value_range_constraint, constraints_intersection, single_value_constraint) ...
# parrot = "Norwegian Blue" # # for character in parrot: # print(character) number = '9,223;372:036 854,775;807' seperators = "" for char in number: if not char.isnumeric(): seperators = seperators + char print(seperators) things = ["bed", "computer", "red", "desk"] space = "" for i ...
number = '9,223;372:036 854,775;807' seperators = '' for char in number: if not char.isnumeric(): seperators = seperators + char print(seperators) things = ['bed', 'computer', 'red', 'desk'] space = '' for i in things: if not 'ed' in i: space = space + i + ' ' print(space) print() quote = 'Alrig...
""" Settings for running tests. """ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } SECRET_KEY = '8ij$(7l2!w0f8kggntbv=+$bd=^2xs$cl+3v^_##qjw@2py9_3' INSTALLED_APPS = ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.co...
""" Settings for running tests. """ databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}} secret_key = '8ij$(7l2!w0f8kggntbv=+$bd=^2xs$cl+3v^_##qjw@2py9_3' installed_apps = ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.c...
expected_output = { 'vll': { 'MY-UNTAGGED-VLL': { 'vcid': 3566, 'vll_index': 37, 'local': { 'type': 'untagged', 'interface': 'ethernet2/8', 'state': 'Up', 'mct_state': 'None', 'ifl_id': '--', 'vc_type': 'tag', 'mtu': 9190, 'cos': '-...
expected_output = {'vll': {'MY-UNTAGGED-VLL': {'vcid': 3566, 'vll_index': 37, 'local': {'type': 'untagged', 'interface': 'ethernet2/8', 'state': 'Up', 'mct_state': 'None', 'ifl_id': '--', 'vc_type': 'tag', 'mtu': 9190, 'cos': '--', 'extended_counters': True}, 'peer': {'ip': '192.168.1.2', 'state': 'UP', 'vc_type': 'tag...
# # @lc app=leetcode id=72 lang=python3 # # [72] Edit Distance # # https://leetcode.com/problems/edit-distance/description/ # # algorithms # Hard (40.50%) # Likes: 2795 # Dislikes: 44 # Total Accepted: 213.4K # Total Submissions: 526.3K # Testcase Example: '"horse"\n"ros"' # # Given two words word1 and word2, fi...
class Solution: def min_distance(self, word1: str, word2: str) -> int: return self.dp_bottom_up(word1, word2) def dp_bottom_up(self, word1: str, word2: str) -> int: """ dp bottom up solution """ memo = [[0] * (len(word2) + 1) for _ in range(len(word1) + 1)] for ...
""" Reverse Words in a String III Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. Example 1: Input: "Let's take LeetCode contest" Output: "s'teL ekat edoCteeL tsetnoc" Note: In the string, each word is separated by si...
""" Reverse Words in a String III Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. Example 1: Input: "Let's take LeetCode contest" Output: "s'teL ekat edoCteeL tsetnoc" Note: In the string, each word is separated by si...
class User: def __init__(self, id = None, email = None, name = None, surname = None, password = None, wallet = 0.00, disability = False, active_account = False, id_user_category = 2): # id_user_category = 2 -> Student self._id = id self._email = email self._name = name self._surna...
class User: def __init__(self, id=None, email=None, name=None, surname=None, password=None, wallet=0.0, disability=False, active_account=False, id_user_category=2): self._id = id self._email = email self._name = name self._surname = surname self._password = password ...
# 487. Max Consecutive Ones II # Runtime: 420 ms, faster than 12.98% of Python3 online submissions for Max Consecutive Ones II. # Memory Usage: 14.5 MB, less than 11.06% of Python3 online submissions for Max Consecutive Ones II. class Solution: _FLIP_COUNT = 1 # Sliding Window def findMaxConsecutiveOne...
class Solution: _flip_count = 1 def find_max_consecutive_ones(self, nums: list[int]) -> int: assert Solution._FLIP_COUNT > 0 max_count = 0 left = 0 zero_idx = [] for right in range(len(nums)): if nums[right] == 0: zero_idx.append(right) ...
# -*- coding:utf-8 -*- # --------------------------------------------- # @file options # @description options # @author WcJun # @date 2021/08/02 # --------------------------------------------- class RequestOptions(object): def __init__(self, url, method='post', body=None, parameters=None, heade...
class Requestoptions(object): def __init__(self, url, method='post', body=None, parameters=None, headers=None, ssl=False, mock_enabled=False, mock_response=None): """ get-post-put-patch-delete :param url: :param method: """ self.url = url self.method = method...
x1, y1, x2, y2 = map(int, input().split()) dx = x2 - x1 dy = y2 - y1 ans = [] for i in range(2): dx, dy = -dy, dx x2 += dx y2 += dy ans.append(x2) ans.append(y2) print(*ans)
(x1, y1, x2, y2) = map(int, input().split()) dx = x2 - x1 dy = y2 - y1 ans = [] for i in range(2): (dx, dy) = (-dy, dx) x2 += dx y2 += dy ans.append(x2) ans.append(y2) print(*ans)
# O(NlogM) / O(1) class Solution: def shipWithinDays(self, weights: List[int], D: int) -> int: def count(t): ans, cur = 1, 0 for w in weights: cur += w if cur > t: ans += 1 cur = w return ans...
class Solution: def ship_within_days(self, weights: List[int], D: int) -> int: def count(t): (ans, cur) = (1, 0) for w in weights: cur += w if cur > t: ans += 1 cur = w return ans (l, r) = (...
x=oi() q=x z(q)
x = oi() q = x z(q)
#!/usr/bin/env python """ Author: Gianluca Biccari Description: Implementation of an Hash Table with string keys """ class HashTable(object): """ Do-it by yourself implemenation in case you don't want to use the built in data structure dictionary. """ def __init__(self): ...
""" Author: Gianluca Biccari Description: Implementation of an Hash Table with string keys """ class Hashtable(object): """ Do-it by yourself implemenation in case you don't want to use the built in data structure dictionary. """ def __init__(self): self.size = 11 s...
class Output: def __init__(self, race_nr, winner, loser, ): self.race_nr = race_nr self.winner = winner self.loser = loser def get_output_template(self): if self.winner == 'O' or 'X': results = f'\nR...
class Output: def __init__(self, race_nr, winner, loser): self.race_nr = race_nr self.winner = winner self.loser = loser def get_output_template(self): if self.winner == 'O' or 'X': results = f'\nRace {self.race_nr}: car {self.winner} - WIN, car {self.loser} - LOSE\...
#-*- coding:utf-8 -*- # <component_name>.<environment>[.<group_number>] HostGroups = { 'web.dev': ['web.dev.example.com'], 'ap.dev': ['ap.dev.example.com'], 'web.prod.1': ['web001.example.com'], 'web.prod.2': ['web{:03d}.example.com'.format(n) for n in range(2,4)], 'web.prod.3': ['web{:03d}...
host_groups = {'web.dev': ['web.dev.example.com'], 'ap.dev': ['ap.dev.example.com'], 'web.prod.1': ['web001.example.com'], 'web.prod.2': ['web{:03d}.example.com'.format(n) for n in range(2, 4)], 'web.prod.3': ['web{:03d}.example.com'.format(n) for n in range(4, 6)], 'ap.prod.1': ['ap001.example.com'], 'ap.prod.2': ['ap...
class NewsValidator: def __init__(self, config): self._config = config def validate_news(self, news): news = news.as_dict() assert self.check_languages(news), "Wrong language!" assert self.check_null_values(news), "Null values!" assert self.check_description_length(new...
class Newsvalidator: def __init__(self, config): self._config = config def validate_news(self, news): news = news.as_dict() assert self.check_languages(news), 'Wrong language!' assert self.check_null_values(news), 'Null values!' assert self.check_description_length(news...
# -*- coding: utf-8 -*- """ Created on Tue Dec 12 01:33:05 2017 @author: Mayur """ # ============================================================================= # Exercise: coordinate # # Consider the following code from the last lecture video: # # class Coordinate(object): # def __init__(self, x...
""" Created on Tue Dec 12 01:33:05 2017 @author: Mayur """ class Coordinate(object): def __init__(self, x, y): self.x = x self.y = y def get_x(self): return self.x def get_y(self): return self.y def __str__(self): return '<' + str(self.getX()) + ',' + str(se...
#https://programmers.co.kr/learn/courses/30/lessons/42860 def solution(name): answer = 0 name_length = len(name) move = [1 if name[i]=='A' else 0 for i in range(name_length)] for i in range(name_length): now_str = name[i] answer += get_move_num_alphabet(now_str, 'A') a...
def solution(name): answer = 0 name_length = len(name) move = [1 if name[i] == 'A' else 0 for i in range(name_length)] for i in range(name_length): now_str = name[i] answer += get_move_num_alphabet(now_str, 'A') answer += get_move_num_cursor(move) return answer def get_move_num_...
#code def SelectionSort(arr,n): for i in range(0,n): minpos = i for j in range(i,n): if(arr[j]<arr[minpos]): minpos = j arr[i],arr[minpos] = arr[minpos],arr[i] #or #temp = arr[minpos] #arr[minpos] = arr[i] #arr[i] = temp #driver ar...
def selection_sort(arr, n): for i in range(0, n): minpos = i for j in range(i, n): if arr[j] < arr[minpos]: minpos = j (arr[i], arr[minpos]) = (arr[minpos], arr[i]) arr = [5, 2, 8, 6, 9, 1, 4] n = len(arr) selection_sort(arr, n) print('Sorted array is :') for i in...
ES_HOST = 'localhost:9200' ES_INDEX = 'pending-pseudocap_go' ES_DOC_TYPE = 'gene' API_PREFIX = 'pseudocap_go' API_VERSION = ''
es_host = 'localhost:9200' es_index = 'pending-pseudocap_go' es_doc_type = 'gene' api_prefix = 'pseudocap_go' api_version = ''
# V1.43 messages # PID advanced # does not include feedforward data or vbat sag comp or thrust linearization # pid_advanced = b"$M>2^\x00\x00\x00\x00x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x007\x00\xfa\x00\xd8\x0e\x00\x00\x00\x00\x01\x01\x00\n\x14H\x00H\x00H\x00\x00\x15\x1a\x00(\x14\x00\xc8\x0fd\x04\x00\xb1" p...
pid_advanced = b'$M>2^\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x007\x00\xfa\x00\xd8\x0e\x00\x00\x00\x00\x01\x01\x00\n\x14H\x00H\x00H\x00\x00\x15\x1a\x00(\x14\x00\xc8\x0fd\x04\x00\xb1' pid = b'$M>\x0fp\x16D\x1f\x1aD\x1f\x1dL\x0457K(\x00\x00G' fc_version = b'$M>\x03\x03\x01\x0c\x15\x18' fc_version...
N = int(input()) swifts = [int(n) for n in input().split(' ')] semaphores = [int(n) for n in input().split(' ')] swift_sum = 0 semaphore_sum = 0 largest = 0 for k in range(N): swift_sum += swifts[k] semaphore_sum += semaphores[k] if swift_sum == semaphore_sum: largest = k + 1 print(largest)
n = int(input()) swifts = [int(n) for n in input().split(' ')] semaphores = [int(n) for n in input().split(' ')] swift_sum = 0 semaphore_sum = 0 largest = 0 for k in range(N): swift_sum += swifts[k] semaphore_sum += semaphores[k] if swift_sum == semaphore_sum: largest = k + 1 print(largest)
"""Firehose resource for AWS Cloudformation.""" __version__ = "0.0.6" __author__ = "German Gomez-Herrero, FindHotel BV"
"""Firehose resource for AWS Cloudformation.""" __version__ = '0.0.6' __author__ = 'German Gomez-Herrero, FindHotel BV'
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Aug 17 09:54:02 2020 @author: AzureD Formatting tools for displaying HELP inside the MUD clients. """ def docstring_to_help(name: str, docstring: str): """ Converts a function docstring to a more viewable format for MUD clients. Mainly use...
""" Created on Mon Aug 17 09:54:02 2020 @author: AzureD Formatting tools for displaying HELP inside the MUD clients. """ def docstring_to_help(name: str, docstring: str): """ Converts a function docstring to a more viewable format for MUD clients. Mainly used inside `src/mud/commands` commands for quick ...
# Iterate over the enitre array. Insert counts only if != 1. Pop repeated occurances of characters. class Solution: def compress(self, chars: List[str]) -> int: run = 1 prev = chars[0] i = 1 while i<len(chars): c = chars[i] if c==prev: ...
class Solution: def compress(self, chars: List[str]) -> int: run = 1 prev = chars[0] i = 1 while i < len(chars): c = chars[i] if c == prev: run += 1 chars.pop(i) else: if run > 1: ...
{ "targets": [{ "target_name": "pifacecad", "sources": ["piface.cc"], "include_dirs": ["./src/"], "link_settings": { "libraries": [ "../lib/libpifacecad.a", "../lib/libmcp23s17.a" ] }, "cflags": ["-std=c++11"] }] }
{'targets': [{'target_name': 'pifacecad', 'sources': ['piface.cc'], 'include_dirs': ['./src/'], 'link_settings': {'libraries': ['../lib/libpifacecad.a', '../lib/libmcp23s17.a']}, 'cflags': ['-std=c++11']}]}
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: pre = ListNode(0) pre.next = head head1, head2 = pre, pre for i in range(n)...
class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def remove_nth_from_end(self, head: ListNode, n: int) -> ListNode: pre = list_node(0) pre.next = head (head1, head2) = (pre, pre) for i in range(n): head2 = head2.n...
with open("day10/input.txt", encoding='utf-8') as file: data = file.read().splitlines() opening_chars = '([{<' closing_chars = ')]}>' sum_of_corrupted = 0 mapping_dict = {'(' : [')', 3], '[' : [']', 57], '{' : ['}', 1197], '<' : ['>', 25137]} mapping_dict_sums = {')' : 3, ']' : 57, '}' : 1197, '>' : 25137} mappin...
with open('day10/input.txt', encoding='utf-8') as file: data = file.read().splitlines() opening_chars = '([{<' closing_chars = ')]}>' sum_of_corrupted = 0 mapping_dict = {'(': [')', 3], '[': [']', 57], '{': ['}', 1197], '<': ['>', 25137]} mapping_dict_sums = {')': 3, ']': 57, '}': 1197, '>': 25137} mapping_dict_par...
class StairsEditScope(EditScope,IDisposable): """ StairsEditScope allows user to maintain a stairs-editing session. StairsEditScope(document: Document,transactionName: str) """ def Dispose(self): """ Dispose(self: EditScope,A_0: bool) """ pass def ReleaseUnmanagedResources(self,*args): """ R...
class Stairseditscope(EditScope, IDisposable): """ StairsEditScope allows user to maintain a stairs-editing session. StairsEditScope(document: Document,transactionName: str) """ def dispose(self): """ Dispose(self: EditScope,A_0: bool) """ pass def release_unmanaged_resources(self, ...
{ 'application':{ 'type':'Application', 'name':'Template', 'backgrounds': [ { 'type':'Background', 'name':'bgTemplate', 'title':'Standard Template with File->Exit menu', 'size':( 400, 300 ), 'style':['resizeable'], 'statusBar':0, 'menubar': { 'type':'MenuBar'...
{'application': {'type': 'Application', 'name': 'Template', 'backgrounds': [{'type': 'Background', 'name': 'bgTemplate', 'title': 'Standard Template with File->Exit menu', 'size': (400, 300), 'style': ['resizeable'], 'statusBar': 0, 'menubar': {'type': 'MenuBar', 'menus': [{'type': 'Menu', 'name': 'menuFile', 'label': ...
def menu_selection_error(a): """if input is not a valid menu choice, throw an error""" print("'\033[91m'ERROR:'\033[92m'Invalid input! Please select from the menu'\033[0m'") def handle_division(a): """makes sure number is not zero""" if a == 0: print("'\033[91m'ERROR:'\033[92m'Cannot divide ...
def menu_selection_error(a): """if input is not a valid menu choice, throw an error""" print("'\x1b[91m'ERROR:'\x1b[92m'Invalid input! Please select from the menu'\x1b[0m'") def handle_division(a): """makes sure number is not zero""" if a == 0: print("'\x1b[91m'ERROR:'\x1b[92m'Cannot divide by ...
class ErosionStatus: is_running: bool # signalize that the erosion (usually in other thread) should stop stop_requested: bool = False progress: int def __init__(self, is_running: bool = False, progress: int = 0): self.is_running = is_running self.progress = progress
class Erosionstatus: is_running: bool stop_requested: bool = False progress: int def __init__(self, is_running: bool=False, progress: int=0): self.is_running = is_running self.progress = progress
# Any recipe starts with a list of ingredients. Below is an extract # from a cookbook with the ingredients for some dishes. Write a # program that tells you what recipe you can make based on the # ingredient you have. # The input format: # A name of some ingredient. # The ouput format: # A message that says "food ti...
pasta = 'tomato, basil, garlic, salt, pasta, olive oil' apple_pie = 'apple, sugar, salt, cinnamon, flour, egg, butter' ratatouille = 'aubergine, carrot, onion, tomato, garlic, olive oil, pepper, salt' chocolate_cake = 'chocolate, sugar, salt, flour, coffee, butter' omelette = 'egg, milk, bacon, tomato, salt, pepper' in...
PROXIES = [ {'protocol':'http', 'ip_port':'118.193.26.18:8080'}, {'protocol':'http', 'ip_port':'213.136.77.246:80'}, {'protocol':'http', 'ip_port':'198.199.127.16:80'}, {'protocol':'http', 'ip_port':'103.78.213.147:80'}, {'protocol':'https', 'ip_port':'61.90.73.10:8080'}, {'protocol':'http', 'ip_port'...
proxies = [{'protocol': 'http', 'ip_port': '118.193.26.18:8080'}, {'protocol': 'http', 'ip_port': '213.136.77.246:80'}, {'protocol': 'http', 'ip_port': '198.199.127.16:80'}, {'protocol': 'http', 'ip_port': '103.78.213.147:80'}, {'protocol': 'https', 'ip_port': '61.90.73.10:8080'}, {'protocol': 'http', 'ip_port': '36.83...
""" GTSAM Copyright 2010-2020, Georgia Tech Research Corporation, Atlanta, Georgia 30332-0415 All Rights Reserved See LICENSE for the license information Various common utilities. Author: Varun Agrawal """ def collect_namespaces(obj): """ Get the chain of namespaces from the lowest to highest for the given...
""" GTSAM Copyright 2010-2020, Georgia Tech Research Corporation, Atlanta, Georgia 30332-0415 All Rights Reserved See LICENSE for the license information Various common utilities. Author: Varun Agrawal """ def collect_namespaces(obj): """ Get the chain of namespaces from the lowest to highest for the given ...
def notas(*n, sit=False): """ -> Funcao para analisar notas e situacoes de alunos :param n: uma ou mais notas de alunos :param sit: valor opcional, indicando se deve ou nao adicionar a situacao :return: dicionario com varias informacoes sobre a situacao da turma """ r = dict() r['total']...
def notas(*n, sit=False): """ -> Funcao para analisar notas e situacoes de alunos :param n: uma ou mais notas de alunos :param sit: valor opcional, indicando se deve ou nao adicionar a situacao :return: dicionario com varias informacoes sobre a situacao da turma """ r = dict() r['total']...
""" This package is for adding officially supported integrations with other libraries. The goal of the integrations is to make it easy to get started with dbx combined with other frameworks. Features that an integration might add are: - automatic loggic - automatic checkpoints - pause/resume functionality integrated ...
""" This package is for adding officially supported integrations with other libraries. The goal of the integrations is to make it easy to get started with dbx combined with other frameworks. Features that an integration might add are: - automatic loggic - automatic checkpoints - pause/resume functionality integrated ...
def dict_words(string): dict_word={} list_words=string.split() for word in list_words: if(dict_word.get(word)!=None): dict_word[word]+=1 else: dict_word[word]=1 return dict_word def main(): with open('datasets/rosalind_ini6.txt...
def dict_words(string): dict_word = {} list_words = string.split() for word in list_words: if dict_word.get(word) != None: dict_word[word] += 1 else: dict_word[word] = 1 return dict_word def main(): with open('datasets/rosalind_ini6.txt') as input_file: ...
SORTIE_PREFIXE = "God save" def get_enfants(parent, liens_parente, morts): return [f for p, f in liens_parente if (p == parent) and (f not in morts)] def get_parent(fils, liens_parente): for p, f in liens_parente: if f == fils: return p def get_heritier(mec_mort, liens_parente, morts)...
sortie_prefixe = 'God save' def get_enfants(parent, liens_parente, morts): return [f for (p, f) in liens_parente if p == parent and f not in morts] def get_parent(fils, liens_parente): for (p, f) in liens_parente: if f == fils: return p def get_heritier(mec_mort, liens_parente, morts): ...
############################################### # # # Created by Youssef Sully # # Beginner python # # While Loops 3 # # # ################################...
print('\n{} {} {}\n'.format('-' * 9, 'While loop', '-' * 9)) iterator = 0 while iterator < 10: print('{} '.format(iterator), end='') iterator = iterator + 1 print('\n') print('{} {} {}\n'.format('-' * 9, 'Using break', '-' * 9)) iterator = 0 while iterator < 10: if iterator == 4: print('Number 4 is ...
class Solution: def findOcurrences(self, text: str, first: str, second: str) -> List[str]: text = text.split(' ') return [text[i] for i in range(2, len(text)) if text[i - 2] == first and text[i - 1] == second]
class Solution: def find_ocurrences(self, text: str, first: str, second: str) -> List[str]: text = text.split(' ') return [text[i] for i in range(2, len(text)) if text[i - 2] == first and text[i - 1] == second]
# Swap Pairs using Recursion ''' Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list's nodes, only nodes itself may be changed. Example: Given 1->2->3->4, you should return the list as 2->1->4->3. ''' # Definition for singly-linked list. # class ListNod...
""" Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list's nodes, only nodes itself may be changed. Example: Given 1->2->3->4, you should return the list as 2->1->4->3. """ class Solution: def swap_pairs(self, head: ListNode) -> ListNode: if...
class BaseMixin(object): @property def blocks(self): return self.request.GET.getlist('hierarchy_block', []) @property def awcs(self): return self.request.GET.getlist('hierarchy_awc', []) @property def gp(self): return self.request.GET.getlist('hierarchy_gp', None) def...
class Basemixin(object): @property def blocks(self): return self.request.GET.getlist('hierarchy_block', []) @property def awcs(self): return self.request.GET.getlist('hierarchy_awc', []) @property def gp(self): return self.request.GET.getlist('hierarchy_gp', None) def...
n, k = input().strip().split(' ') n, k = int(n), int(k) imp_contests = 0 imp = [] nimp = [] for i in range(n): l, t = input().strip().split(' ') l, t = int(l), int(t) if t == 1: imp.append([l,t]) else: nimp.append([l,t]) imp.sort() ans = 0 ans_subtract = 0 for i in ran...
(n, k) = input().strip().split(' ') (n, k) = (int(n), int(k)) imp_contests = 0 imp = [] nimp = [] for i in range(n): (l, t) = input().strip().split(' ') (l, t) = (int(l), int(t)) if t == 1: imp.append([l, t]) else: nimp.append([l, t]) imp.sort() ans = 0 ans_subtract = 0 for i in range(le...
def f(a): s = 0 for i in range(1,a): if a%i == 0: s+=i return "Perfect" if s==a else ("Abundant" if s > a else "Deficient") T = int(input()) L = list(map(int,input().split())) for i in L: print(f(i))
def f(a): s = 0 for i in range(1, a): if a % i == 0: s += i return 'Perfect' if s == a else 'Abundant' if s > a else 'Deficient' t = int(input()) l = list(map(int, input().split())) for i in L: print(f(i))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Oct 13 19:35:17 2019 @author: abhijithneilabraham """ name='katran'
""" Created on Sun Oct 13 19:35:17 2019 @author: abhijithneilabraham """ name = 'katran'
#!/usr/bin/python class Block(object): def __init__(self): print("Block") class Chain(object): def __init__(self): print("Chain") def main(): b = Block() c = Chain() if __name__ == "__main__": main()
class Block(object): def __init__(self): print('Block') class Chain(object): def __init__(self): print('Chain') def main(): b = block() c = chain() if __name__ == '__main__': main()
class Config: DEBUG = True SQLALCHEMY_DATABASE_URI = "mysql+mysqldb://taewookim:1234@173.194.86.171:3306/roompi2_db" SQLALCHEMY_TRACK_MODIFICATION = True @classmethod def init_app(cls, app): # config setting for flask app instance app.config.from_object(cls) return app
class Config: debug = True sqlalchemy_database_uri = 'mysql+mysqldb://taewookim:1234@173.194.86.171:3306/roompi2_db' sqlalchemy_track_modification = True @classmethod def init_app(cls, app): app.config.from_object(cls) return app
""" Given a string path, which is an absolute path (starting with a slash '/') to a file or directory in a Unix-style file system, convert it to the simplified canonical path. In a Unix-style file system, a period '.' refers to the current directory, a double period '..' refers to the directory up a level, and any mu...
""" Given a string path, which is an absolute path (starting with a slash '/') to a file or directory in a Unix-style file system, convert it to the simplified canonical path. In a Unix-style file system, a period '.' refers to the current directory, a double period '..' refers to the directory up a level, and any mu...
# -*- coding: utf-8 -*- # segundo link: dobro do terceiro # segundo link: metade do primeiro clicks_on_3 = int(input()) clicks_on_2 = clicks_on_3 * 2 clicks_on_1 = clicks_on_2 * 2 print(clicks_on_1)
clicks_on_3 = int(input()) clicks_on_2 = clicks_on_3 * 2 clicks_on_1 = clicks_on_2 * 2 print(clicks_on_1)
#Coded by Ribhu Sengupta. def solveKnightMove(board, n, move_no, currRow, currCol): #solveKnightMove(board, dimesion of board, Moves_already_done, currRoe, currCol) if move_no == n*n: #Lets say n=8, if no of moves knight covered 64 then it will stop further recursion. return True rowDir = [+...
def solve_knight_move(board, n, move_no, currRow, currCol): if move_no == n * n: return True row_dir = [+2, +1, -1, -2, -2, -1, +2, +2] col_dir = [+1, +2, +2, +1, -1, -2, -2, -1] for index in range(0, len(rowDir)): next_row = currRow + rowDir[index] next_col = currCol + colDir[in...
# https://leetcode.com/problems/jewels-and-stones/description/ # input: J = "aA" | S = "aAAbbbb" # output: 3 # input: J = "z", S = "ZZ" # output: 0 # Solution: O(N^2) def num_jewels_in_stones(J, S): jewels = 0 for j in J: for s in S: if s == j: jewels += 1 return j...
def num_jewels_in_stones(J, S): jewels = 0 for j in J: for s in S: if s == j: jewels += 1 return jewels print(num_jewels_in_stones('aA', 'aAAbbbb')) print(num_jewels_in_stones('z', 'ZZ')) def num_jewels_in_stones_opt(J, S): number_by_chars = {} counter = 0 fo...
def writeList(l,name): wptr = open(name,"w") wptr.write("%d\n" % len(l)) for i in l: wptr.write("%d\n" % i) wptr.close()
def write_list(l, name): wptr = open(name, 'w') wptr.write('%d\n' % len(l)) for i in l: wptr.write('%d\n' % i) wptr.close()
# DEFAULT ROUTE ROUTE_SANDBOX = 'https://sandbox.boletobancario.com/api-integration' ROUTE_SANDBOX_AUTORIZATION_SERVER = "https://sandbox.boletobancario.com/authorization-server/oauth/token" ROUTE_PRODUCAO = 'https://api.juno.com.br' ROUTE_PRODUCAO_AUTORIZATION_SERVER = "https://api.juno.com.br/authorization-server/oa...
route_sandbox = 'https://sandbox.boletobancario.com/api-integration' route_sandbox_autorization_server = 'https://sandbox.boletobancario.com/authorization-server/oauth/token' route_producao = 'https://api.juno.com.br' route_producao_autorization_server = 'https://api.juno.com.br/authorization-server/oauth/token'
user_input = input("Enter maximum number: ") number = int(user_input) spaces_amount = number // 2 f = open("my_tree.txt", "w") while (spaces_amount >= 0): if (spaces_amount*2 == number): spaces_amount -= 1 continue for j in range(spaces_amount): f.write(" ") # print(" ", sep="", end="") for ...
user_input = input('Enter maximum number: ') number = int(user_input) spaces_amount = number // 2 f = open('my_tree.txt', 'w') while spaces_amount >= 0: if spaces_amount * 2 == number: spaces_amount -= 1 continue for j in range(spaces_amount): f.write(' ') for j in range(number - spa...
# Copyright (c) 2020. JetBrains s.r.o. # Use of this source code is governed by the MIT license that can be found in the LICENSE file. # from .corr import * # from .im import * # __all__ = (im.__all__ + # corr.__all__) # 'bistro' packages must be imported explicitly. __all__ = []
__all__ = []
if __name__ == "__main__": net_amount=0 while(True): person = input("Enter the amount that you want to Deposit/Withdral ? ") transaction = person.split(" ") type = transaction[0] amount =int( transaction[1]) if type =="D" or type =='d': net_amount += ...
if __name__ == '__main__': net_amount = 0 while True: person = input('Enter the amount that you want to Deposit/Withdral ? ') transaction = person.split(' ') type = transaction[0] amount = int(transaction[1]) if type == 'D' or type == 'd': net_amount += amount...
# Put the token you got from https://discord.com/developers/applications/ here token = 'x' # Choose the prefix you'd like for your bot prefix = "?" # Copy your user id on Discord to set you as the owner of this bot myid = 0 # Change None to the id of your logschannel (if you want one) logschannelid = None # Change 0 to...
token = 'x' prefix = '?' myid = 0 logschannelid = None myserverid = 0
# course = "Python's course for Beginners" # print(course[0]) # print(course[-1]) # print(course[-2]) # print(course[0:3]) # print(course[0:]) # print(course[1:]) # print(course[:5]) # print(course[:]) # copy string # # another = course[:] # print(another) ####################################### # f...
course = "Python's course for Beginners" print(course.find('p')) print(course.find('P')) print(course.find('o')) print(course.find('Beginners')) print(course.replace('Beginners', 'Absolute Beginners')) print('Python' in course) print(course.title())
class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' # default load test intervals, in milliseconds INTERVAL_DEFAULT = 200 # load test speed, txs per second TXS_PER_SE...
class Bcolors: header = '\x1b[95m' okblue = '\x1b[94m' okgreen = '\x1b[92m' warning = '\x1b[93m' fail = '\x1b[91m' endc = '\x1b[0m' bold = '\x1b[1m' underline = '\x1b[4m' interval_default = 200 txs_per_sec_normal = 100 txs_per_sec_slow = 10 tx_commit = 1 tx_sync = 2 tx_async = 3
# -*- coding: utf-8 -*- # @Time : 2020/1/23 13:38 # @Author : jwh5566 # @Email : jwh5566@aliyun.com # @File : if_example.py def check_if(): a = int(input("Enter a number \n")) if (a == 100): print("a is equal 100") else: print("a is not equal 100") return a
def check_if(): a = int(input('Enter a number \n')) if a == 100: print('a is equal 100') else: print('a is not equal 100') return a
amount_of_dancers = int(input()) amount_of_points = float(input()) season = input() place = input() money_left = 0 charity = 0 dancers_point_won = amount_of_dancers * amount_of_points dancers_point_won_aboard = dancers_point_won + (dancers_point_won * 0.50) money_per_dancer = 0 if place == "Bulgaria": if season =...
amount_of_dancers = int(input()) amount_of_points = float(input()) season = input() place = input() money_left = 0 charity = 0 dancers_point_won = amount_of_dancers * amount_of_points dancers_point_won_aboard = dancers_point_won + dancers_point_won * 0.5 money_per_dancer = 0 if place == 'Bulgaria': if season == 'su...
nome = input("Qual seu nome: ") idade = int(input("Qual sua idade: ")) altura = float(input("Qual sua altura: ")) peso = float(input("Qual seu peso: ")) op= int(input("Estado civil:\n1.Casado\n2.Solteiro\n")) if op==1: op = True else: op = False eu = [nome, idade, altura, peso, op] for c in eu: print(c,...
nome = input('Qual seu nome: ') idade = int(input('Qual sua idade: ')) altura = float(input('Qual sua altura: ')) peso = float(input('Qual seu peso: ')) op = int(input('Estado civil:\n1.Casado\n2.Solteiro\n')) if op == 1: op = True else: op = False eu = [nome, idade, altura, peso, op] for c in eu: print(c, ...
#Example: grocery = 'Milk\nChicken\r\nBread\rButter' print(grocery.splitlines()) print(grocery.splitlines(True)) grocery = 'Milk Chicken Bread Butter' print(grocery.splitlines())
grocery = 'Milk\nChicken\r\nBread\rButter' print(grocery.splitlines()) print(grocery.splitlines(True)) grocery = 'Milk Chicken Bread Butter' print(grocery.splitlines())
class Document: # general info about document class Info: def __init__(self): self.author = "unknown" self.producer = "unknown" self.subject = "unknown" self.title = "unknown" self.table_of_contents = [] def __init__(self, path: str, is_pd...
class Document: class Info: def __init__(self): self.author = 'unknown' self.producer = 'unknown' self.subject = 'unknown' self.title = 'unknown' self.table_of_contents = [] def __init__(self, path: str, is_pdf: bool): self.is_pdf = ...
class Solution: def removeElement(self, nums: [int], val: int) -> int: i = 0 j = len(nums) while i < j: if nums[i] == val: nums[i] = nums[j - 1] j -= 1 else: i += 1 return i
class Solution: def remove_element(self, nums: [int], val: int) -> int: i = 0 j = len(nums) while i < j: if nums[i] == val: nums[i] = nums[j - 1] j -= 1 else: i += 1 return i
class Solution: def findItinerary(self, tickets: List[List[str]]) -> List[str]: def dfs(graph, u, res): while(len(graph[u])): dfs(graph, graph[u].pop(), res) res.append(u) graph = defaultdict(list) res = [] for ticket in tickets: ...
class Solution: def find_itinerary(self, tickets: List[List[str]]) -> List[str]: def dfs(graph, u, res): while len(graph[u]): dfs(graph, graph[u].pop(), res) res.append(u) graph = defaultdict(list) res = [] for ticket in tickets: ...
SKULLTAG_FREQS = [ 0.14473691, 0.01147017, 0.00167522, 0.03831121, 0.00356579, 0.03811315, 0.00178254, 0.00199644, 0.00183511, 0.00225716, 0.00211240, 0.00308829, 0.00172852, 0.00186608, 0.00215921, 0.00168891, 0.00168603, 0.00218586, 0.00284414, 0.00161833, 0.00196043, 0.00151029, 0...
skulltag_freqs = [0.14473691, 0.01147017, 0.00167522, 0.03831121, 0.00356579, 0.03811315, 0.00178254, 0.00199644, 0.00183511, 0.00225716, 0.0021124, 0.00308829, 0.00172852, 0.00186608, 0.00215921, 0.00168891, 0.00168603, 0.00218586, 0.00284414, 0.00161833, 0.00196043, 0.00151029, 0.00173932, 0.0021837, 0.00934121, 0.00...
''' Description: X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X. Each digit must be rotated - we cannot choose to leave it alone. A number is valid if each digit remains a digit after rotation. 0, 1, and 8 rotate to themselves; 2 and 5 rot...
""" Description: X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X. Each digit must be rotated - we cannot choose to leave it alone. A number is valid if each digit remains a digit after rotation. 0, 1, and 8 rotate to themselves; 2 and 5 rot...
# Python - 2.7.6 Test.describe('Basic tests') Test.assert_equals(logical_calc([True, False], 'AND'), False) Test.assert_equals(logical_calc([True, False], 'OR'), True) Test.assert_equals(logical_calc([True, False], 'XOR'), True) Test.assert_equals(logical_calc([True, True, False], 'AND'), False) Test.assert_equals(lo...
Test.describe('Basic tests') Test.assert_equals(logical_calc([True, False], 'AND'), False) Test.assert_equals(logical_calc([True, False], 'OR'), True) Test.assert_equals(logical_calc([True, False], 'XOR'), True) Test.assert_equals(logical_calc([True, True, False], 'AND'), False) Test.assert_equals(logical_calc([True, T...
# -*- coding: utf-8 -*- class INITIALIZE(object): def __init__(self, ALPHANUMERIC=' ', NUMERIC=0): self.alphanumeric = ALPHANUMERIC self.numeric = NUMERIC def __call__(self, obj): self.initialize(obj) def initialize(self, obj): if isinstance(obj, dict): for k, ...
class Initialize(object): def __init__(self, ALPHANUMERIC=' ', NUMERIC=0): self.alphanumeric = ALPHANUMERIC self.numeric = NUMERIC def __call__(self, obj): self.initialize(obj) def initialize(self, obj): if isinstance(obj, dict): for (k, v) in obj.items(): ...
class User: userdetail = ["layersony","Samuel", "Maingi", "0796727706", "sm@gmail.com", "123456", '123456'] """ class for register user have to firstname, lastname, phonenumber, email, password, confirm password """ def __init__(self, username ,first_name, last_name, phone_number, email, password, con_pas...
class User: userdetail = ['layersony', 'Samuel', 'Maingi', '0796727706', 'sm@gmail.com', '123456', '123456'] '\n class for register user have to firstname, lastname, phonenumber, email, password, confirm password\n ' def __init__(self, username, first_name, last_name, phone_number, email, password, con...
class Config: SECRET_KEY = 'hard to guess string' SQLALCHEMY_COMMIT_ON_TEARDOWN = True MAIL_SERVER = 'smtp.qq.com' MAIL_PORT = 465 MAIL_USE_TLS = False MAIL_USE_SSL = True MAIL_USERNAME = '536700549@qq.com' MAIL_PASSWORD = 'mystery123.' FLASKY_MAIL_SUBJECT_PREFIX = '[Flasky]' FLA...
class Config: secret_key = 'hard to guess string' sqlalchemy_commit_on_teardown = True mail_server = 'smtp.qq.com' mail_port = 465 mail_use_tls = False mail_use_ssl = True mail_username = '536700549@qq.com' mail_password = 'mystery123.' flasky_mail_subject_prefix = '[Flasky]' fla...
""" This script learns about escape characters. Even more practice on the document string """ SPLIT_STRING = "This string has been \nsplit over\nseveral\nlines" print(SPLIT_STRING) TABBED_STRING = "1\t2\t3\t4\t5" print(TABBED_STRING) print('The pet shop owner said "No, no, \'e\'s uh,...he\'s resting".') # or print("T...
""" This script learns about escape characters. Even more practice on the document string """ split_string = 'This string has been \nsplit over\nseveral\nlines' print(SPLIT_STRING) tabbed_string = '1\t2\t3\t4\t5' print(TABBED_STRING) print('The pet shop owner said "No, no, \'e\'s uh,...he\'s resting".') print('The pet ...
n = int(input()) lst = [float('inf') for _ in range(n+1)] lst[1] = 0 for i in range(1,n): if 3*i<=n:lst[3*i]=min(lst[3*i],lst[i]+1) if 2*i<=n:lst[2*i]=min(lst[2*i],lst[i]+1) lst[i+1]=min(lst[i+1],lst[i]+1) print(lst[n])
n = int(input()) lst = [float('inf') for _ in range(n + 1)] lst[1] = 0 for i in range(1, n): if 3 * i <= n: lst[3 * i] = min(lst[3 * i], lst[i] + 1) if 2 * i <= n: lst[2 * i] = min(lst[2 * i], lst[i] + 1) lst[i + 1] = min(lst[i + 1], lst[i] + 1) print(lst[n])
Till=int(input("Enter the upper limit\n")) From=int(input("Enter the lower limit\n")) i=1 print("\n") while(From<=Till): if((From%4==0)and(From%100!=0))or(From%400==0): print(From) From+=1 input()
till = int(input('Enter the upper limit\n')) from = int(input('Enter the lower limit\n')) i = 1 print('\n') while From <= Till: if From % 4 == 0 and From % 100 != 0 or From % 400 == 0: print(From) from += 1 input()
class BaseKeyMap(): """docstring for BaseKeyMap.""" def __init__(self, arg): self.arg = arg
class Basekeymap: """docstring for BaseKeyMap.""" def __init__(self, arg): self.arg = arg
class Square: piece = None promoting = False def __init__(self, promoting=False): self.promoting = promoting def set_piece(self, piece): self.piece = piece def remove_piece(self): self.piece = None def get_piece(self): return self.piece def is_empty(self)...
class Square: piece = None promoting = False def __init__(self, promoting=False): self.promoting = promoting def set_piece(self, piece): self.piece = piece def remove_piece(self): self.piece = None def get_piece(self): return self.piece def is_empty(self)...