content
stringlengths
7
1.05M
""" Exceptions. """ class AlreadyAllocated(Exception): pass class NotAllocated(Exception): pass class BufferAlreadyAllocated(AlreadyAllocated): pass class BufferNotAllocated(NotAllocated): pass class BusAlreadyAllocated(AlreadyAllocated): pass class BusNotAllocated(NotAllocated): pas...
# The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317. # Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000. sumSeries = 0 for x in range(1, 1001): sumSeries += pow(x, x) print(str(sumSeries)[-10:])
class Queue(): def __init__(self): self.queue = [] def enqueue(self, value): self.queue.append(value) def dequeue(self): if self.size() > 0: return self.queue.pop(0) else: return None def size(self): return len(self.queue)
#Task 2.1 my_list=[] i=11 k=1 for i in range(1,i): my_list.append(k) k+=3 print("Task 2.1 ",my_list) #Task 2.2 my_listnew = my_list my_listnew.extend([1, 5, 13, 20]) print ("Task 2.2 ",my_listnew) #Task2.3 my_set = set(my_list) print("Task 2.3 ",my_set) #Task 2.4 def compare_elements(a:list, b:set): if ...
# Apresentação print('Programa para converter temperatura') print() # Entradas celsius = float(input('Informe a temperatura em ºC: ')) # Processamento fahrenheit = (9 * celsius + 160) / 5 # Saídas print('A temperatura em ºF é:', fahrenheit)
# Кортежи. Повторение * # Кортеж, который содержит простые числа A = (1, 2, 3) * 3 # A = (1, 2, 3, 1, 2, 3, 1, 2, 3) # Кортеж, который содержит вложенные объекты B = ("ab", ["1", "12"])*2 # A=('ab', ['1','12'], 'ab', ['1','12'])
class BinaryMaxHeap: def __init__(self): self.elements = [] def __str__(self): return self.elements def __repr__(self): return self.elements def max_heapify(self, unordered_list, i): left = (2 * i) + 1 right = (2 * i) + 2 # If the element has no left c...
expected_output = { 'vrf': {'default': {'address_family': {'ipv4': {'default_rpf_table': 'IPv4-Unicast-default', 'isis_mcast_topology': False, 'mo_frr_flow_based': False, 'mo_frr_rib': False, ...
class AllBrowsersBusy(RuntimeError): pass class BrowserStackTunnelClosed(RuntimeError): pass class TooManyElements(RuntimeError): pass class UnknownSelector(RuntimeError): pass class UnsupportedBrowser(RuntimeError): pass
"""Houston client exceptions""" class HoustonException(Exception): """Base Houston client exception""" pass class HoustonServerBusy(HoustonException): """Raised due to too many requests to process""" pass class HoustonClientError(HoustonException): """Error raised when the client has made an...
# robin-0 ( Nabil Ibtehaz) ''' This code implements the Bellman-Ford Algorithm to solve the single source shortest path problem. ''' class Edge: ''' This is the class to model graph edges it has 3 attributes startingNode , endingNode and weight ''' # constructor def __init__(self,startingNode,endingN...
heif_chroma_undefined = 99 heif_chroma_monochrome = 0 heif_chroma_420 = 1 heif_chroma_422 = 2 heif_chroma_444 = 3 heif_chroma_interleaved_RGB = 10 heif_chroma_interleaved_RGBA = 11 heif_chroma_interleaved_RRGGBB_BE = 12 heif_chroma_interleaved_RRGGBBAA_BE = 13 heif_colorspace_undefined = 99 heif_colorspace_YCbCr = 0 h...
''' Problem Statement: Given two sorted arrays, A and B, determine their intersection. What elements are common to A and B? ''' A = [2, 3, 3, 5, 7, 11] B = [3, 3, 7, 15, 31] # One line solution #print(set(A).intersection(B)) def intersection_arrays(A, B): i = 0 j = 0 intersection = list() while i < ...
## Duplicate Encoder ## 6 kyu ## https://www.codewars.com/kata/54b42f9314d9229fd6000d9c def duplicate_encode(word): new = '' for character in word: if word.lower().count(character.lower()) == 1: new += ("(") else: new += (')') return new
print("Welcome to the tip calculator.") total = float(input("What was the total bill? $")) percent = int(input("What percentage tip would you like to give? 10%, 12%, or 15%? ")) people = int(input("How many people to split the bill? ")) total += ((percent * total) / 100) per_person = round(total / people, 2) print(f"E...
class Solution: def networkDelayTime(self, times: List[List[int]], N: int, K: int) -> int: """ The original Dijkstra algorithm is to find the shorting distances between a starting node and each of the rest nodes. This problem can be considered as a variant of Dijkstra...
class Manager: place = "" number = 0 def __init__(self, place, number): self.place = place self.number = number def toString(self): print("Place: " + self.place + ". Number: " + self.number + ".") print(" ")
class Solution: @staticmethod def naive(m,n): dp = [[0 for i in range(n+1)] for j in range(m+1)] dp[m-1][n-1]=1 for i in range(m-1,-1,-1): for j in range(n-1,-1,-1): dp[i][j] = max(dp[i][j],dp[i+1][j]+dp[i][j+1]) return dp[0][0]
""" bmh_search.py This module implements bmh search to find a substring in a string BMH Search Overview: -------------------- Uses a bad-character shift of the rightmost character of the window to compute shifts. The trick to this algorithm is `bmbc`, a lookup table with a default val...
# The sequence we want to analyze seq = 'GACAGACUCCAUGCACGUGGGUAUCUGUC' # Initialize GC counter n_gc = 0 # Initialize sequence length len_seq = 0 # Loop through sequence and count G's and C's for base in seq: len_seq += 1 if base in 'GCgc': n_gc += 1 # Divide to get GC content print(n_gc / len_seq) ...
def search(l, x): return searchInRange(l, x, 0, len(l)-1) def searchInRange(l, x, min, max): if min>max: return False else: middle = min+(max-min)/2 if x > l[middle]: # Search in right half return searchInRange(l, x, middle+1, max) elif x < l[middle]:...
"""This file was adapted from Appium sample code found at https://github.com/appium/appium/tree/master/sample-code as of November 15, 2021. For fixtures and imports, see ./conftest.py""" class TestFirst(): def test_first(self, driver): """Simply checks test discovery and setup. Should be success...
# # @lc app=leetcode id=1372 lang=python3 # # [1372] Longest ZigZag Path in a Binary Tree # # @lc code=start # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: ...
CONTACT_FIELDS = { "preferred_call_time": "STRING", "quiz_complete_date": "STRING", "q6": "STRING", "q5": "STRING", "q4_other": "STRING", "q4": "STRING", "q3": "STRING", "q2_explained": "STRING", "q2": "STRING", "q1_explained": "STRING", "q1": "STRING", "preferred_respons...
class Handler: """ Cloud provider API handler base class. Defines common API between inherited handler classes. """ def __init__(self, app): self.app = app self.compute_client = None self.storage_client = None def fetch_available_ip_address(self): return "" ...
""" Should emit: B018 - on lines 16-25, 29, 32 """ def foo1(): """my docstring""" def foo2(): """my docstring""" a = 2 "str" # Str (no raise) f"{int}" # JoinedStr (no raise) 1j # Number (complex) 1 # Number (int) 1.0 # Number (float) b"foo" # Binary True # NameConstant...
# This module contains the shaders used to render snap point coordinates. # The shaders for snapping to a vertex. VERT_SHADER_V = """ #version 330 uniform mat4 p3d_ModelMatrix; in vec4 p3d_Vertex; void main() { gl_Position = p3d_ModelMatrix * p3d_Vertex; } """ GEOM_SHADER_V = """ #...
# -*- coding: utf-8 -*- class OutputFormatterStyle(object): FOREGROUND_COLORS = { 'black': 30, 'red': 31, 'green': 32, 'yellow': 33, 'blue': 34, 'magenta': 35, 'cyan': 36, 'white': 37 } BACKGROUND_COLORS = { 'black': 40, 're...
def get_vars(conta) -> list: vars = list() for c in conta: # print(c) if c.isalpha() or c == '=': vars.append(c) # print(c, vars) # print(vars) return vars cores = ['blue', 'green', 'yellow', 'red', 'cyan', 'gray', ...
def getHammingDistance(a, b): aLen = len(a) bLen = len(b) if aLen == 0 or bLen == 0: return 0 diff = 0 if aLen != bLen: diff = abs(aLen - bLen) if aLen < bLen: a = a + ' ' * diff elif bLen < aLen: b = b + ' ' * diff result = 0 length = max(aLen, bL...
printlevel = 0 singlemargin = ' ' marginflag = False class nextlevel(): def __enter__(self): global printlevel printlevel+=1 def __exit__(self, *args, **kwargs): global printlevel printlevel-=1 def current_level(): return printlevel def printmargin(kwargs): globa...
elementos_eletro = {'F':3.98,"O":3.44,"Cl":3.16,'N':3.04,'Br':2.96,'I':2.66,'S':2.58,'Ac':0.7,"La":0.79,'Sr':0.82,'Ce':0.89,'Th':0.89,'Na':0.93,'Y':0.95, 'Li':0.98,'K':0.82,'Pr':1.1,'Pa':1.1,'Nd':1.12,'Pm':1.13,'Sm':1.14, 'Gd':1.17,"Dy":1.2,'Zr':1.22,'Er':1.22,'Tm':1.23,'Yb':1.24,'Lu':1.25, 'Ta':1.27,'Cm':1.28,'W':1.3...
# [Silent Crusade] Starling's Proposal BASTILLE = 9073003 sm.setSpeakerID(BASTILLE) sm.sendNext("I've been expecting you! Come, let's go somewhere where we can speak in private.") sm.warp(931050500) sm.completeQuest(parentID)
def tryInt(inp): try: return int(inp) except: return inp def findNameIndex(name, fileContent): for i, entry in list(enumerate(fileContent)): if name == entry and (i%2) == 0: return i return False def getFile(): with open("scores.txt") as f : return [ tryInt(x) for x in f....
# Target for including SkFlate. { 'targets': [ { 'target_name': 'skflate', 'type': 'static_library', 'dependencies': [ 'skia_lib.gyp:skia_lib', ], 'conditions': [ # When zlib is not availible on a system, # SK_NO_FLATE will be defined. [ 'skia_os != "w...
""" operadores relacionais servem para comparar coisas todas as vezes que sao usados retorna um valor bolleado true or false == checar a igualdade > checar se maior >= checar se maior ou igual < <= != se é diferente """ #num_1 = 2 #num_2 = 2 #expresao = (num_1 > num_2) #comando compara as partes #print(expresao) nome ...
s = [] dir = [[0,1],[1,0],[1,1],[-1,1]] for i in range(20): s.append(list(map(int, input().split()))) print(s) ans = 0 def f(x, y, dx, dy): global ans ret = 1 for i in range(4): if x >= 20 or y >= 20: return ret *= s[x][y] x += dx y += dy if ret ...
class Invoice: """This class contains basic information about an invoice :param title: Product name :type title: str :param description: Product description :type description: str :param start_parameter: Unique bot deep.linking parameter that can be used to generate this invoice :type start...
def check_exam(arr1,arr2): def points(corr,stud): if stud == corr: return 4 elif stud: return -1 else: return 0 return max(0, sum(points(*it) for it in zip(arr1,arr2)))
#!/usr/bin/env python3 # https://codeforces.com/problemset/problem/1358/B t = int(input()) for _ in range(t): n,m = list(map(int,input().split())) print((n*m+1)//2)
'''9. Faça um programa que pede para o usuário digitar 5 números e, ao final, imprime uma lista com os 5 números digitados pelo usuário (sem converter os números para int ou float). Exemplo: Se o usuário digitar 1, 5, 2, 3, 6, o programa deve imprimir a lista ['1','5','2','3','6']''' lists = [] i = 0 print('Adding va...
MAJOR = 0 MINOR = 1 PATCH = '' SUFFIX = '' # eg.rc0 __version__ = f"{MAJOR}.{MINOR}.{PATCH}{SUFFIX}"
############################################################################################### # This module is used to check if a process is already running # I don't think this is being used anymore. I may delete it, but I suspect it is very useful. # I may move it to a utility module. # I'll comment it out later a...
class Solution: def shiftingLetters(self, S, shifts): """ :type S: str :type shifts: List[int] :rtype: str """ s = sum(shifts) lst = list(S) for i, shift in enumerate(shifts): ch = ord(lst[i]) - 97 ch = (ch + s) % 26 ...
lista=[] soma=0 for cont in range(10): nota=int(input("Digite a nota: ")) lista.append(nota) print(lista)
""" This is free and unencumbered software released into the public domain. For more details, please visit <http://unlicense.org/>. """ _v = "1.0.2"
class MultiFuture(object): def __init__(self, futures, merger=None): self.merger = merger if hasattr(futures, "__len__"): self.futures = futures else: self.futures = [futures] def done(self): for f in self.futures: if not f.done(): ...
"""Beaker exception classes""" class BeakerException(Exception): pass class BeakerWarning(RuntimeWarning): """Issued at runtime.""" class CreationAbortedError(Exception): """Deprecated.""" class InvalidCacheBackendError(BeakerException, ImportError): pass class MissingCacheParameter(BeakerExce...
class AutoTiler: def __init__(self): self.autoMap = {'UDLR': 0, 'DLR': 32, 'UDL': 64, 'ULR': 96, 'UDR': 128, 'DL': 160, 'UL': 192, 'UR': 224, 'DR': 256, 'LR': 288, 'UD': 320, 'U': 352, 'R': 384, 'D': 416, 'L': 448, '': 480} def auto_tile(self, tile_map): # Do base terrai...
########## Default Octave C = 261.63 #C CS = 277.18 #C_Sharp DF = 277.18 #D_Flat D = 293.66 #D DS = 311.13 #D_Sharp EF = 311.13 #E_Flat E = 329.63 #E F = 349.23 #F FS = 369.99 #F_Sharp GF = 369.99 #G_Flat G = 392.00 #G GS = 415.30 #G_Sharp AF = 415.30 #A_Flat A = 440.00 #A AS = 466.16 #A_Sharp BF = 466....
# THIS FILE IS GENERATED FROM NUMPY SETUP.PY # # To compare versions robustly, use `numpy.lib.NumpyVersion` short_version = '1.13.3' version = '1.13.3' full_version = '1.13.3' git_revision = '31465473c491829d636c9104c390062cba005681' release = True if not release: version = full_version
ETHEREUM_TEST_PARAMETERS = ['ethrpc_endpoint,ethereum_manager_connect_at_start', [ # Query etherscan ('', False), # For real node querying let's use blockscout ('https://mainnet-nethermind.blockscout.com', True), ]]
class DataGridViewRowCancelEventArgs(CancelEventArgs): """ Provides data for the System.Windows.Forms.DataGridView.UserDeletingRow event of a System.Windows.Forms.DataGridView. DataGridViewRowCancelEventArgs(dataGridViewRow: DataGridViewRow) """ @staticmethod def __new__(self,dataGridViewRow): """ _...
# Copyright 2016 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
BASE_URL = 'https://twitter.com' TIMELINE_SEARCH_URL = 'https://twitter.com/i/search/timeline' SEARCH_URL = 'https://twitter.com/search/' LOGIN_URL = 'https://twitter.com/login' SESSIONS_URL = 'https://twitter.com/sessions' RETWEET_URL = 'https://api.twitter.com/1.1/statuses/retweet.json' FOLLOW_URL = 'https://api.twi...
arr=list(map(int,input().split())) left=0 right=len(arr)-1 while(left<=right): #print(left) #print(right) if arr[left]<0 and arr[right]<0: left+=1 elif arr[left]>0 and arr[right]<0: arr[left],arr[right]=arr[right],arr[left] left+=1 right-=1 elif arr[left]>0 and arr[ri...
class Solution: def profitableSchemes(self, G: int, P: int, group: List[int], profit: List[int]) -> int: @lru_cache(maxsize=None) def schemes(G, P, start): if G<0: return 0 if start==len(group): if P<=0: re...
def theSieve(n): '''# Finds all primes less than or equal to n using the Sieve of Eratosthenes''' # Create a boolean array # "prime[0..n]" and initialize # all entries it as true. # A value in prime[i] will # finally be false if i is # Not a prime, else true. prime = [True for i in rang...
# Crie um programa que mostre quanto dinheiro uma pessoa tem e mostre quantos dolares ela pode comprar. real = float(input('Digite quantos reais vocês tem: R$ ')) convert = 0.20 dolar = real * convert print('Você tem {} dolares em reais.'.format(dolar))
# Solution A class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: mp = collections.defaultdict(list) for st in strs: key = ''.join(sorted(st)) mp[key].append(st) return list(mp.values()) # Solution B class Solution: def groupAnagrams(sel...
while True: friends = hero.findFriends() for friend in friends: enemy = friend.findNearestEnemy() if enemy and friend.distanceTo(enemy) < 30: hero.command(friend, "attack", enemy) else: hero.command(friend, "move", {"x": friend.pos.x + 2, "y": friend.pos.y})
""" Utility scripts for PyTables ============================ :Author: Ivan Vilata i Balaguer :Contact: ivan@selidor.net :Created: 2005-12-01 :License: BSD :Revision: $Id$ This package contains some modules which provide a ``main()`` function (with no arguments), so that they can be used as scripts. """
""" 05 Elabore um programa que receba 4 notas de um aluno e calcule a média dele. Exemplo: Primeiro Nota = 7 Segundo Nota = 8 Terceiro Nota = 10 Quarto Nota = 6 Média = 7,75 """ n1 = float(input("Primeira nota: ")) n2 = float(input("Segunda nota: ")) n3 = float(input("Terceira nota: ")) n4 = float(input("Quarta no...
n = int(input()) if n & (n-1) > 0: print("NO") else: print("YES")
#!/usr/bin/env python3 """ momentum """ def update_variables_momentum(alpha, beta1, var, grad, v): """ Create momentum """ dw = beta1 * v + (1 - beta1) * grad w = var - alpha * dw return w, dw
number = 9.0 # Float number division_result = number / 2 division_remainder = number % 2 multiplication_result = division_result * 2 addition_result = multiplication_result + division_remainder subtraction_result = number - multiplication_result floor_result = number // 2 power_result = multiplication_res...
class TokenType(tuple): parent = None def __contains__(self, item): return item is not None and (self is item or item[:len(self)] == self) def __getattr__(self, name): new = TokenType(self + (name,)) setattr(self, name, new) new.parent = self return new def __r...
""" 1. Clarification 2. Possible solutions - HashMap 3. Coding 4. Tests """ # T=O(n), S=O(min(n, k)) class Solution: def containsNearbyDuplicate(self, nums: List[int], k: int) -> bool: d = dict() for i in range(len(nums)): if nums[i] in d and i - d[nums[i]] <= k: r...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def hasCycle(self, head: ListNode) -> bool: if not head or not head.next: return False a, b = head, head.next while b and b.next...
class Node(): def __init__(self, val): self.val = val self.left = None self.right = None def search(root, val): if root is None or root.val == val: return root if root.val < val: return search(root.left, val) else: return search(root.right, val) def se...
def show_cmd(task): return "executing... %s" % task.name def task_custom_display(): return {'actions':['echo abc efg'], 'title': show_cmd}
# This is an input class. Do not edit. class LinkedList: def __init__(self, value): self.value = value self.next = None def findLoop(head): slow = head.next fast = head.next.next while slow != fast: slow = slow.next fast = fast.next.next while head != slow: ...
# encoding: utf-8 ''' 单例模式 单例模式(Singleton Pattern)的核心作用是确保一个类只有一个实例,并且提供一个访问该实例的全局访问点。 单例模式只生成一个实例对象,减少了对系统资源的开销。当一个对象的产生需要比较多的资源,如读取配置文件、产生其他依赖对象时,可以产生一个“单例对象”, 然后永久驻留内存中,从而极大的降低开销。 单例模式有多种实现的方式,我们这里推荐重写__new__()的方法。 ''' class MySingleton: __obj = None __init_flag = True def __new__(cls, *args, **kwargs)...
class NoMessageException(AssertionError): pass class ConnectionClosed(Exception): pass
# Multiplying each element in a list by 2 original_list = [1,2,3,4] new_list = [2*x for x in original_list] print(new_list) # [2,4,6,8]
# Created by MechAviv # Map ID :: 940205100 # Ravaged Base Remnants : Ravaged Eastern Base 1 sm.addPopUpSay(3001500, 1000, "#face8#There are more enemies every moment.", "") sm.systemMessage("Clear out all of the monsters first.")
# This is merely a tag type to avoid circular import issues. # Yes, this is a terrible solution but ultimately it is the only solution. # This was moved out of the ext.commands namespace so discord.Cog/CogMeta # could be imported into it for backwards compatibility. class _BaseCommand: __slots__ = ()
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def alpaca_deps(): """Loads dependencies need to compile and test with the alpaca library.""" # googletest is a testing framework developed by Google. if "com_github_google_gooogletest" not in native.existing_rules(): http_archiv...
# Uses python3 def calc_fib(number): '''Given an integer n, find the nth Fibonacci number Fn.''' if number <= 1: return number previous = 0 current = 1 for _ in range(number - 1): previous, current = current, previous + current return current if __name__ == '__main__': ...
data = list(map(int, open("05.txt"))) size = len(data) # Part 1 vm = data.copy() ip = tick = 0 while (ip >= 0 and ip < size): jr = vm[ip] vm[ip] += 1 ip += jr tick += 1 print(tick) # Part 2 vm = data ip = tick = 0 while (ip >= 0 and ip < size): jr = vm[ip] vm[ip] += 1 if jr < 3 else -1 ip ...
# coding: utf-8 def dp_make_change(coin_list, change, min_coins, coin_used): """ 利用动态规划解决'使用最少的硬币找零'问题 @Arguments: coin_list: 零钱集合,被用于找零 change: 需要找零的钱数 min_coins: 存储[0, change+1)之间每个量找零需要的最少硬币数 coin_used: 记录为min_coins的每一项添加的最后一个硬币 """ for cents in range(change+1): ...
class NetworkService: def __init__(self, client): self.client = client def deleteMember(self, address, id, headers=None, query_params=None, content_type="application/json"): """ Delete member from network It is method for DELETE /network/{id}/member/{address} """ ...
class Category: def __init__(self, bot, name: str = '', description: str = '', fp: str = ''): bot.categories[name] = self self.bot = bot self.name = name self.description = description self.fp = fp self.cogs = [] def add_cogs(self, *cogs): for cog in cogs...
class Solution: def isSubsequence(self, s: str, t: str) -> bool: if not s: return True s_index = 0 t_index = 0 while t_index < len(t): if s[s_index] == t[t_index]: s_index += 1 if s_index == len(s): return ...
''' In this module we implement counting sort ''' def counting_sort(arr): ''' Sort array using counting sort ''' count = [0] * (max(arr)+1) sorted_list = [0]*len(arr) for i in arr: count[i] += 1 for i in range(1,len(count)): count[i] += count[i-1] for i in arr: ...
class Menu: def event_button_up(self): raise("Not implemented") def event_button_down(self): raise("Not implemented") def event_button_left(self): raise("Not implemented") def event_button_right(self): raise("Not implemented") def event_button_a(self): re...
for x in (1, 3, 5): #will iterate once with 1, 3, etc usrRange = 4 for x in range (1, usrRange): #variables can be used as well print ("I will repeat this the specified number of times")
# 2018-11-1 , Model default configurations # lEFT DOWN RIGHT UP arrow key to operation options = [0, 1, 2, 3] # op = [ 65, 83, 68, 87] #'A' 'S' 'D' 'W' character to operation. #operation index actions = [0,1,2,3] # ESC end_game = 27 LR = 1e-3 goal_steps = 2000000 score_requir...
C_HEADER = '/*\nThis source was automatically generated by The IMPORTANT Interpreter & Compiler.\n*/' C_INCLUDE = '#include <stdio.h>\n#include <stdlib.h>\n#include "stack.c"\n' C_MAIN = 'int main(int argc, char **argv) {\n\t\tchar tape[30000]={0};\n\t\tchar* ptr = tape;\n\t\tstruct Stack* ' \ 'stack = createS...
# dervied from http://farsitools.sf.net # Copyright (C) 2003-2011 Parspooyesh Fanavar (http://parspooyesh.com/) # see LICENSE.txt g_days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] j_days_in_month = [31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29] class GregorianToJalali: def __init__(self, gyear...
# -*- coding: utf-8 -*- # Scrapy settings for douban project # # For simplicity, this file contains only the most important settings by # default. All the other settings are documented here: # # http://doc.scrapy.org/en/latest/topics/settings.html # BOT_NAME = 'douban' SPIDER_MODULES = ['douban.spiders'] NEWSPID...
12 + 5 + 1 x=12 x y=20 print("Use print") print(y)
# -*- coding: UTF-8 -*- def add_numbers(x, y): return x + y print(type('This is a string')) # <type 'str'> print(type(None)) # <type 'NoneType'> print(type(1)) # <type 'int'> print(type(1.0)) # <type 'float'> print(type(add_numbers)) # <type 'function'> print('----------------------------------------') x = ...
############################################################# # 2016-09-26: MboxType.py # Author: Jeremy M. Gibson (State Archives of North Carolina) # # Description: Implementation of the mbox-type ############################################################## class Mbox: """""" def __init__(self, rel_path=...
__all__ = ( "SetOptConfError", "NamingError", "DataTypeError", "MissingRequiredError", "ReadOnlyError", ) class SetOptConfError(Exception): pass class NamingError(SetOptConfError): pass class DataTypeError(SetOptConfError): pass class MissingRequiredError(SetOptConfError): pa...
''' 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...
# https://codeforces.com/problemset/problem/467/A n = int(input()) rooms = [list(map(int, input().split())) for _ in range(n)] ans = 0 for room in rooms: if room[1] - room[0] >= 2: ans += 1 print(ans)
# # PySNMP MIB module A3COM-HUAWEI-VRRP-EXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-HUAWEI-VRRP-EXT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 16:53:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
age = float(input()) gender = input() if gender == 'm': if 0 < age < 16: print('Master') elif age >= 16: print ('Mr.') elif gender == 'f': if 0 < age < 16: print('Miss') elif age >= 16: print ('Ms.')
# encoding: utf-8 """ error.py We declare here a class hierarchy for all exceptions produced by IPython, in cases where we don't just raise one from the standard library. """ __docformat__ = "restructuredtext en" #------------------------------------------------------------------------------- # Copyright (C) 2008 ...