content
stringlengths
7
1.05M
h,m,s = map(int, input().split()) s += (m*60 + h*3600 + int(input())) h = s//3600 m = (s%3600)//60 s = (s%3600)%60 if h>23: h %= 24 print(h,m,s)
#!/usr/bin/env python # -*- coding: UTF-8 -*- # 地址:http: //www.runoob.com/python/python-exercise-example85.html def func(num): j = 1 sum = 9 m = 9 flag = True while flag: if sum % num == 0: print(sum) flag = False else: m *= 10 sum +...
#!/usr/bin/env python3 def main(): s = 0 for j in range(1, 1001): s += j ** j print(str(s)[-10:]) if __name__ == '__main__': main()
""" Audio segment """ class Segment(): """ Audio segment """ def __init__(self, waveform, boundaries, sample_rate, channel): self._waveform = waveform self._boundaries = boundaries self._sample_rate = sample_rate self._channel = channel @property def waveform(...
f = open("thirteen.txt", "r") lines = [x.strip() for x in f.readlines()] dots = [] for line in lines: if line == "": break p = line.split(",") dots.append((int(p[0]), int(p[1]))) folds = [line.split()[2] for line in lines if line.startswith("fold along ")] fold = folds[0] dir = fold[0] line ...
class FormattedTextRun(object, IDisposable): """ A structure that defines a single run of a formatted text. """ def Dispose(self): """ Dispose(self: FormattedTextRun) """ pass def ReleaseUnmanagedResources(self, *args): """ ReleaseUnmanagedResources(self: FormattedTextRun,d...
def test_register_get(client, captured_templates): """ GIVEN a Flask application configured for testing (client) WHEN the '/' route is requested (GET) THEN there should be the correct `status_code`, `template.name`, and the correct `page_title` in the context """ # mimic a browser: 'GE...
# -*- coding: UTF-8 -*- # @author: xuyong # @file: 202-fbnqsl.py # @time: 2018/7/27 下午7:33 # @desc: 斐波那契数列实现 # 获取用户输入数据 # 随便手动输入数字,比如 10 # nterms = int(input("你需要几项?")) nterms = 10 # 第一和第二项 n1 = 0 n2 = 1 count = 2 # 判断输入的值是否合法 if nterms <= 0: print("请输入一个正整数。") elif nterms == 1: print("斐波那契数列:") pri...
class Solution: # @param A : integer # @return a list of strings def fizzBuzz(self, n): result = [] for i in range(1, n+1): s = '' if i %3 == 0: s += 'Fizz' if i % 5 == 0: s += 'Buzz' if s == ''...
class Tag: _major: str _minor: str _separator: str _factors: dict def __init__(self, major: str, minor="", separator="", **kwargs): self._major = major self._minor = minor self._separator = separator self._factors = kwargs @property def major(self) -> str: ...
# -*- coding: utf-8 -*- """ File Name: minimum-number-of-arrows-to-burst-balloons.py Author : jynnezhang Date: 2020/11/23 3:34 下午 Description: https://leetcode-cn.com/problems/minimum-number-of-arrows-to-burst-balloons/ """ class Solution: def findMinArrowShots(self, points) -> int: """ ...
"""197 · Permutation Index""" class Solution: """ @param A: An array of integers @return: A long integer """ def permutationIndex(self, A): # write your code here permutation = 1 result = 0 for i in range(len(A) - 2, -1, -1): smaller = 0 for j...
print('ANALISANDO DADOS') pessoas = dict() lista = list() media = soma = 0 print('-=' * 50) while True: pessoas.clear() pessoas['nome'] = str(input('Nome: ')) pessoas['sexo'] = str(input('Sexo [M/F]: ')).upper().strip()[0] while pessoas['sexo'] not in 'MF': print('Erro, digite apenas M ou F.') ...
def boyer_moore_bad_environment(A, p, m, k): bad_table = {(i, a): True for i in range(1, m + 1) for a in A} for i in range(1, m + 1): for j in range(max(0, i - k), min(i + k, m) + 1): bad_table[(j, p[i])] = False return bad_table def boyer_moore_multi_dim_shift(A, p, m, k): ready = {a: m + 1 for a i...
# dfir_ntfs: an NTFS parser for digital forensics & incident response # (c) Maxim Suhanov __version__ = '1.0.3' __all__ = [ 'MFT', 'Attributes', 'WSL', 'USN', 'LogFile', 'BootSector', 'ShadowCopy', 'PartitionTable' ]
# motorsports.vehicles # description # # Author: Allen Leis <allen.leis@georgetown.edu> # Created: Fri Sep 11 23:22:32 2015 -0400 # # Copyright (C) 2015 georgetown.edu # For license information, see LICENSE.txt # # ID: vehicles.py [] allen.leis@georgetown.edu $ """ A module to supply building related classes """ #...
# obtain the comma-separated value from the user csv = input("Enter string: ") # split the string by the coma and save it in a list csv = csv.split(',') # displaying each of the variables # csv[0] is the name # csv[1] is the age # csv[2] is the phone number print('\n{0:=<30}\nName: {1:30}\nAge: {2:30}\nContact: {3:30...
class Solution: def sortedSquares(self, nums: List[int]) -> List[int]: arr = [] for i in nums: sq = i*i arr.append(sq) return sorted(arr)
# Fibonacci numbers def fibs(_to, _from=0): ''' Returns a given range of fibonacci sequence. Both indexes are included. fibonacci_sequence[_from:_to] param _to: int [required] - upper index of requested range param _from: int [optional] - lower index of requested range returns: list...
def greedy_player_mgt(game_mgr): game_mgr = game_mgr def fn_get_action(pieces): valid_moves = game_mgr.fn_get_valid_moves(pieces, 1) if valid_moves is None: return None candidates = [] for a in range(game_mgr.fn_get_action_size()): if valid_moves[a]==0:...
# Time: O(n) # Space: O(1) class Solution(object): def maximumPopulation(self, logs): """ :type logs: List[List[int]] :rtype: int """ MIN_YEAR, MAX_YEAR = 1950, 2050 years = [0]*(MAX_YEAR-MIN_YEAR+1) for s, e in logs: years[s-MIN_YEAR] += 1 ...
# Time: O(1), per move. # Space: O(n^2) class TicTacToe(object): def __init__(self, n): """ Initialize your data structure here. :type n: int """ self.__rows = [[0, 0] for _ in xrange(n)] self.__cols = [[0, 0] for _ in xrange(n)] self.__diagonal = [0, 0] ...
# Lists in Python are mutable objects that may contain # any number of items of different types my_list = [1, "Hello", True, 3.4] # Python allows negative indexing my_list = [1, 2, 3, 4, 5, 6] print(my_list[-1]) # We can access a range of items within the list using slicing # my_list[start:stop:step] my_list = ['H', ...
l = [2, 5, 6, 5, 11] def isPal(x): str_num = str(x) if len(str_num) == 1: return True if len(str_num) % 2 != 0: mid = int(len(str_num)/2) front = str_num[:mid] back = str_num[mid+1:] else: mid = int(len(str_num)/2) front = str_num[:mid] back =...
# take two input numbers number1 = input("Insert first number : ") number2 = input("Insert second number : ") operator = input("Insert operator (+ or - or * or /)") if operator == '+': total = number1 + number2 elif operator == '-': total = number1 - number2 elif operator == '*': total = number...
""" File containing all local variable necessary for the script to run """ #Enter your domain name. A value beginning with a period can be used as a subdomain wildcard. DOMAIN = ".locktopus.fr" #PATHS : DEVELOPMENT_SETTINGS_FILE_PATH = "../locktopus/web_project/settings.py"
#var #n, media, cont: int #i: str i='s' cont=0 media=0 while i!='n': n=int(input('Digite um número: ')) media=media+n cont=cont+1 i=input("Desejar continuar somando (s) ou deseja encerrar o programa (n)? ") media=media/cont print (media)
# https://leetcode.com/problems/gray-code/ # # algorithms # Easy (35.75%) # Total Accepted: 365,649 # Total Submissions: 1,022,741 # beats 95.52% of python submissions class Solution(object): def merge(self, nums1, m, nums2, n): """ :type nums1: List[int] :type m: int :type nums...
# Geometry.py # Tasks # Write these functions to calculate following tasks # 1. Areas ==> Circle, Triangle, Reactangle, Square,.. # 2. Volumes ==> Sphere, Pyramid, Prism, Cone, def rectangle(width, length): return width * length def perimeter_rect(width, length): return 2*width + 2*length def triangle(base,...
def pascal(p): result = [] for i in range(p): if i == 0: result.append([1]) else: result.append([1] + [result[i - 1][j] + result[i - 1][j + 1] for j in range(len(result[i - 1]) - 1)] + [1]) return result
def encode(key: str, txt: str): txt_c = '' for index in range(0, len(txt)): txt_int = ord(txt[index].lower()) + (ord(key[index % len(key)].upper()) - 65) if txt_int > 122: txt_int = txt_int - 26 if txt_int < 97 or txt_int > 122: txt_c = txt_c + txt[index] ...
# Class to store Trie(Patterns) # It handles all cases particularly the case where a pattern Pi is a subtext of a pattern Pj for i != j class Trie_Patterns: def __init__(self, patterns, start, end): self.build_trie(patterns, start, end) # The trie will be a dictionary of dictionaries where: # ... T...
def trikotniska_stevila(n): vsota = 0 for i in range(1, n + 1): vsota += i return vsota def najdi(): j = 0 n = 0 st_deliteljev = 0 while st_deliteljev <= 500: st_deliteljev = 0 j += 1 n = trikotniska_stevila(j) i = 1 while i <= n ** 0.5: ...
pid_yaw = rm_ctrl.PIDCtrl() list_LineList = RmList() variable_X = 0 def start(): global variable_X global list_LineList global pid_yaw robot_ctrl.set_mode(rm_define.robot_mode_chassis_follow) # rotate gimbal downward so the line is more visible gimbal_ctrl.pitch_ctrl(-20) # enable line det...
def f1(a, b, c=0, *args, **kw): print('a =', a, 'b =', b, 'c =', c, 'args =', args, 'kw =', kw) def f2(a, b, c=0, *, d, **kw): print('a =', a, 'b =', b, 'c =', c, 'd =', d, 'kw =', kw) def product(*x): sum = 1 if len(x) > 0: for item in x: sum = item * sum print(sum) def tr...
# def form_list(): # with open("words.txt",'r') as f: # import pdb; pdb.set_trace() # data=f.readlines() # form_list() data=['TEMPERATURE', 'PARTICULAR', 'INSTRUMENT', 'EXPERIMENT', 'EXPERIENCE', 'ESPECIALLY', 'DICTIONARY', 'SUBSTANCE', 'REPRESENT', 'PARAGRAPH', 'NECESSARY', 'DIFFICULT', '...
# -*- coding: utf-8 -*- """ 1534. Count Good Triplets Given an array of integers arr, and three integers a, b and c. You need to find the number of good triplets. A triplet (arr[i], arr[j], arr[k]) is good if the following conditions are true: 0 <= i < j < k < arr.length |arr[i] - arr[j]| <= a |arr[j] - arr[k]| <= b...
# # PySNMP MIB module HH3C-RADIUS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-RADIUS-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:29:17 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
#!/usr/bin/env python3 # python3 program of subtraction of # two numbers using 2's complement . # function to subtract two values # using 2's complement method def Subtract(a, b): # ~b is the 1's Complement of b # adding 1 to it make it 2's Complement c = a + (~b + 1) return c # Driver code if __na...
class Solution: """ @param nums: The integer array. @param target: Target to find. @return: The first position of target. Position starts from 0. """ def binarySearch(self, nums, target): left = 0 right = len(nums) - 1 while right != left: mi...
''' This solution worked out because it has a time complexity of O(N) ''' # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): # write your code in Python 3.6 lengthy = len(A) if (lengthy == 0 or lengthy == 1): return 0 diffies...
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def binaryTreePaths(self, root): """ :type root: TreeNode :rtype: List[str] """ i...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ============================================================================= # # ============================================================================= __author__ = 'Chet Coenen' __copyright__ = 'Copyright 2020' __credits__ = ['Chet Coenen'] __license__ = '/LICE...
# coding: utf-8 """ https://leetcode.com/problems/min-stack/ """ class MinStack: def __init__(self): self.array = [] def push(self, x: int) -> None: self.array.append(x) def pop(self) -> None: self.array.pop() def top(self) -> int: return self.array[-1] def getM...
# vim:tw=50 """Tuples You have already seen one kind of sequence: the string. Strings are a sequence of one-character strings - they're strings all the way down. They are also **immutable**: once you have defined one, it can never change. Another immutable seqeunce type in Python is the **tuple**. You define a tupl...
""" @apiDefine Success @apiError 0 Success. """ """ @apiDefine IdNotFound @apiError 1 Swimmer <code>id</code> not found. """ """ @apiDefine InvalidParamLaps @apiError 2 Invalid value for <code>laps</code> param. """ """ @apiDefine AvatarNotFound @apiError 3 Swimmer avatar file not found. """ """ @apiDefine MissingParam...
""" # COMBINATION SUM II Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to target. Each number in candidates may only be used once in the combination. Note: The solution set must not contain duplicate comb...
# EASY # find all multiples less than n # ex Input 6 # arr = [1:True, 2:True ,3:True ,4:True ,5:True ] # start from 2, mark 2*2, 2*3, 2*4 ... False # Time O(N^2) Space O(N) class Solution: def countPrimes(self, n: int) -> int: arr = [1 for _ in range(n)] count = 0 ...
def test_sm_etprf_include_eic_yestoday(app): app.testhelpersm.refresh_page() app.session.open_SM_page(app.smPurchases) app.session.ensure_login_sm(app.username, app.password) app.session.ensure_login_sm(app.username, app.password) app.session.open_SM_page(app.smPurchases) app.testHelperSMSear...
class ViewModel: current_model = None def __init__(self, view): self.view = view def switch(self, model): self.clear_annotation() self.current_model = model self.view.show(model) def get_current_id(self): return self.current_model.identifier def clear_ann...
var1 = "Hello World" var2 = 100 # while something is true do stuff while(var2 < 110): print("still less than 110!") var2 += 1 else: print(f"Not less than 110: var2 = {var2}")
def sort_carries(carries): sorted_results = {"loss": [], "no_gain": [], "short_gain": [], "med_gain": [], "big_gain": []} for carry in carries: if carry < 0: sorted_results["loss"].append(carry) elif carry == 0: sorted_results["no_gain"].append(carry) elif 0 < c...
# # PySNMP MIB module CXPhysicalInterfaceManager-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXPhysicalInterfaceManager-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:17:44 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ...
def df_to_lower(data, cols=None): '''Convert all string values to lowercase data : pandas dataframe The dataframe to be cleaned cols : str, list, or None If None, an attempt will be made to turn all string columns into lowercase. ''' if isinstance(cols, str): cols...
nome = str(input("Digite seu nome: ")).strip() print("Seu nome em maiusculas é {}".format(nome.upper())) print("Seu nome em minusculas é {}".format(nome.lower())) print("Seu nome tem ao todo {} letras".format(len(nome) - nome.count(' '))) print("Seu primeiro nome é {} e ele tem {} letras.".format(nome[:nome.find(' ')]...
def exercise_1(): a_word = "hello world" f = open("exo1.txt",'a') f.write(a_word) f.close() def save_list2file(sentences, filename): f = open(filename,"w") f.close()
''' The .pivot_table() method has several useful arguments, including fill_value and margins. fill_value replaces missing values with a real value (known as imputation). What to replace missing values with is a topic big enough to have its own course (Dealing with Missing Data in Python), but the simplest thing to...
def matrix_rank(x): """ Returns the rank of a Galois field matrix. References ---------- * https://numpy.org/doc/stable/reference/generated/numpy.linalg.matrix_rank.html Examples -------- .. ipython:: python GF = galois.GF(31) A = GF.Identity(4); A np.linalg.ma...
def make_differences(arr): diff_arr = [0] * (len(arr) - 1) for i in range(1, len(arr)): diff_arr[i - 1] = arr[i] - arr[i - 1] return diff_arr def paths_reconstruction(arr): num_paths_arr = [0] * len(arr) num_paths_arr[-1] = 1 for i in range(len(arr) - 2, -1, -1): ...
class EmptyDicomSeriesException(Exception): """ Exception that is raised when the given folder does not contain dcm-files. """ def __init__(self, *args): if not args: args = ('The specified path does not contain dcm-files. Please ensure that ' 'the path points to...
#!/usr/bin/env python3 # A feladat megoldásához felhasználtam: https://docs.python.org/3/library/stdtypes.html def tizesbe(rendszer, szamstr): res = 0 for b in range(len(szamstr)): if szamstr[b].isdecimal(): res += int(szamstr[b]) * rendszer ** (len(szamstr) - 1 - b) else: res += (ord(szamstr[...
#DictExample8.py student = {"name":"sumit","college":"stanford","grade":"A"} #this will prints whole key and values pairs using items() for x in student.items(): print(x) print("-----------------------------------------------------") #you can also store key and value in two differnet variable li...
# -*- coding: utf-8 -*- def uninstall(portal, reinstall=False): """ launch uninstall profile """ setup_tool = portal.portal_setup setup_tool.runAllImportStepsFromProfile( 'profile-Products.PloneGlossary:uninstall')
class config: global auth; auth = "YOUR TOKEN" # Enter your discord token for Auto-Login. global prefix; prefix = "$" # Enter your prefix for selfbot. global nitro_sniper; nitro_sniper = "true" # 'true' to enable nitro sniper, 'false' to disable. global giveaway_sniper; giveaway_sniper = "true" # 't...
# # PySNMP MIB module HUAWEI-IMA-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/HUAWEI-IMA-MIB # Produced by pysmi-0.0.7 at Sun Jul 3 11:25:20 2016 # On host localhost.localdomain platform Linux version 3.10.0-229.7.2.el7.x86_64 by user root # Using Python version 2.7.5 (default, Jun 24 201...
def sort_a_little_bit(items, begin_index, end_index): left_index = begin_index pivot_index = end_index pivot_value = items[pivot_index] while pivot_index != left_index: item = items[left_index] if item <= pivot_value: left_index += 1 continue items[left_...
@auth.requires_membership('admin') def album(): grid = SQLFORM.grid(db.t_mtalbum) return dict(grid=grid) @auth.requires_membership('admin') def dataset(): grid = SQLFORM.grid(db.t_mtdataset) return dict(grid=grid) @auth.requires_membership('admin') def item(): grid = SQLFORM.grid(db.t_mtitem) ...
n = int(input().strip()) value1 = 0 value2 = 0 for i in range(n): a_t = [int(a_temp) for a_temp in input().strip().split(' ')] value1 += a_t[i] value2 += a_t[-1-i] print(abs(value2-value1))
def test(): # noqa assert 1 + 1 == 2 def test_multi_line_args(math_fixture, *args, **kwargs): # noqa assert 1 + 1 == 2
def checkio(str_number, radix): try: return int(str_number,radix) except: return -1 #These "asserts" using only for self-checking and not necessary for auto-testing if __name__ == '__main__': assert checkio("AF", 16) == 175, "Hex" assert checkio("101", 2) == 5, "B...
async def _asyncWrapWith(res, wrapper_fn): result = await res return wrapper_fn(result["id"]) def wrapWith(res, wrapper_fn): if isinstance(res, dict): return wrapper_fn(res) else: return _asyncWrapWith(res, wrapper_fn)
#!/usr/bin/env python # encoding: utf-8 def run(whatweb, pluginname): whatweb.recog_from_file(pluginname, "themes\default\Wikiwyg\Wikiwy\Phpwiki.js", "phpwiki")
r = float(input('Raio = ')) h = float(input('Altura = ')) r2 = r ** 2 v = 3.14159 * h * r2 print('Volume da lata de óleo é {:.2f}'.format(v))
# DLS and JLS are bored with a Math lesson. In order to entertain themselves, DLS took a sheet of paper and drew n distinct lines, given by equations y=x+piy = x + p_iy=x+pi​ for some distinct p1,p2,…,pnp_1, p_2, \ldots, p_np1​,p2​,…,pn​. # Then JLS drew on the same paper sheet m distinct lines given by equations y=−x+...
# Given two non-empty binary trees s and t, # check whether tree t has exactly the same structure and node values with a subtree of s. # A subtree of s is a tree consists of a node in s and all of this node's descendants. # The tree s could also be considered as a subtree of itself. # Example 1: # Given tree s: # ...
__author__ = "Prikly Grayp" __license__ = "MIT" __version__ = "1.0.0" __email__ = "priklygrayp@gmail.com" __status__ = "Development" def first(iterable): iterator = iter(iterable) try: return next(iterator) except StopIteration: raise ValueError('iterable is empty') first(['Spring', 'Summ...
# https://leetcode.com/problems/kids-with-the-greatest-number-of-candies/submissions/ class Solution: def kidsWithCandies(self, candies: [int], extraCandies: int) -> [bool]: maxCandies = max(candies, default=0) return [True if v + extraCandies >= maxCandies else False for v in candies]
# Alternating Characters # Developer: Murillo Grubler # Link: https://www.hackerrank.com/challenges/alternating-characters/problem # Time complexity: O(n) def alternatingCharacters(s): sumChars = 0 for i in range(len(s)): if i == 0 or tempChar != s[i]: tempChar = s[i] continue ...
# A simple use of user defined functions in python def greet_user(name): print(f"Hi {name}!") print("Welcome Aboard!") print("Start") greet_user("Kwadwo") greet_user("Sammy") print("finish")
#!/usr/bin/env python3 """ binary_tree contains methods to search a binary tree """ def is_valid_binary_search_tree(node): """ Traverses tree depth first in order """ return is_valid_bst(node, float('-inf'), float('inf')) def is_valid_bst(node, value_min, value_max): """ Traverses tree depth...
""" In a given grid, each cell can have one of three values: - the value 0 representing an empty cell; - the value 1 representing a fresh orange; - the value 2 representing a rotten orange. Every minute, any fresh orange that is adjacent (4-directionally) to a rotten orange becomes ...
""" A proxy provides a surrogate or place holder to provide access to an object. Ex1: Use an extra level of indirection to support distributed, controlled, or conditional access. """ class SubjectInterface: """ Define the common interface for RealSubject and Proxy so that a Proxy can be used anywh...
""" 30 Dec 2015. code interpretation by Dealga McArdle of this paper. http://www.cc.gatech.edu/~jarek/graphics/papers/04PolygonBooleansMargalit.pdf It's the first thing that came up after a 'polygon unions' Google search. This repo is an attempt at getting that psuedo code into a working state. It might be over my...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def insertionSortList(self, head: ListNode) -> ListNode: dummyHead = ListNode(float('-inf'), head) currentNode = dummyHead.next ...
def Factorial_Head(n): # Base Case: 0! = 1 if(n == 0): return 1 # Recursion result1 = Factorial_Head(n-1) result2 = n * result1 return result2 def Factorial_Tail(n, accumulator): # Base Case: 0! = 1 if( n == 0): return accumulator # Recursion return ...
class palin: def __init__(self,string): self.string=string s=self.string a=[] for i in s: a.append(i) b=[] for i in range(len(a)-1,-1,-1): b.append(a[i]) if(a==b): print('True') else: print('False') # if __name__=='__main__': # obj=palin('kaif') # obj.check()
class UnboundDataPullException(Exception): pass class DataPullInProgressError(Exception): pass
print("To define a new function, you use 'def+<your_function_name>+(+<your_params_comma_separated>+)', example: 'def myFunction(param1, param2, ..., paramn)'") # Creating a simple function and calling it print("Creating simple function and calling it") def sayHello(name): print("Hello",name) sayHello("balam909") # D...
#!/user/bin/python # -*- coding: utf-8 -*- """ 文件读取 测试 """ print('hello world')
ecn_show_config_output="""\ Profile: AZURE_LOSSLESS ----------------------- ------- red_max_threshold 2097152 wred_green_enable true ecn ecn_all green_min_threshold 1048576 red_min_threshold 1048576 wred_yellow_enable true yellow_min_threshold 1048576 green_max_...
# package org.apache.helix.store #from org.apache.helix.store import * class HelixPropertyListener: def onDataChange(self, path): """ Returns void Parameters: path: String """ pass def onDataCreate(self, path): """ Returns void Pa...
# -*- coding: utf-8 -*- GRAPPELLI_INDEX_DASHBOARD = 'dashboard.CustomIndexDashboard' GRAPPELLI_ADMIN_TITLE = u'Админка'
class Credentials: """ Class that generates new instances of credentials. """ credentials_list = [] #empty user list def __init__(self,account,username,password): self.account = account self.username = username self.password = password def save_credentials(self): ...
class Solution: def brokenCalc(self, X: int, Y: int) -> int: count = 0 while Y>X: if Y%2==0: Y //= 2 else: Y += 1 count += 1 return count + X - Y
s = float(input('What is the salary of the functionary? $')) if s > 1250.00: t = s + s * 0.10 print(f'His salary increased by 10% and is now {t:.2f}') else: f = s + s * 0.15 print(f'His salary increased by 15% and is now {f:.2f}')
# Use dictionary # 1-) Herhangi bir düğümü seçin, bitişikteki ziyaret edilmemiş köşeyi ziyaret edin, # ziyaret edildi olarak işaretleyin, görüntüleyin ve bir sıraya ekleyin. # 2-) Kalan bitişik tepe noktası yoksa, ilk tepe noktasını kuyruktan çıkarın # 3-) Sıra boşalana veya istenen düğüm bulunana kadar 1. ve ...
condition_table_true = ["lt", "gt", "eq"] condition_table_false = ["ge", "le", "ne"] trap_condition_table = { 1: "lgt", 2: "llt", 4: "eq", 5: "lge", 8: "gt", 12: "ge", 16: "lt", 20: "le", 31: "u" } spr_table = { 8: "lr", 9: "ctr" } def decodeI(value): return (value >> ...
__version__ = "2.2.3" __title__ = "taxidTools" __description__ = "A Python Toolkit for Taxonomy" __author__ = "Gregoire Denay" __author_email__ = 'gregoire.denay@cvua-rrw.de' __licence__ = 'BSD License' __url__ = "https://github.com/CVUA-RRW/taxidTools"
#!/usr/bin/python3.3 S1 = 'abc' S2 = 'xyz123' z = zip(S1, S2) print(list(z)) print(list(zip([1, 2, 3], [2, 3, 4, 5]))) print(list(map(abs, [-2, -1, 0, 1, 2]))) print(list(map(pow, [1, 2, 3], [2, 3, 4, 5]))) print(list(map(lambda x, y: x+y, open('script2.py'), open('script2.py')))) print([x+y for (x, y) in zip(ope...
class Solution(object): def isPalindrome(self, s): """ :type s: str :rtype: bool """ ns = '' for ch in s: if ch.isalnum(): ns += ch.lower() return ns == ns[::-1]