content
stringlengths
7
1.05M
""" UpBack: synchronize (both ways) two filesystem braches using rclone, so that you can sync local and remote file systems on Amazon Cloud Drive, Google Drive, Dropbox, etc... """ __version__ = "1.0.0-dev" __author__ = "Davide Rossi" __licence__ = "MIT"
#!/usr/bin/env python3.7 class StrategyTypes: """ Types of strategy available to solve a problem """ NULL = "null" KNUTH = "knuth" GENETIC = "genetic" SWASZEK = "swaszek" HYBRID = "hybrid"
def solution(max): a = 0 b = 1 if max < 0: print("Incorrect input") elif max == 0: return a elif max == 1: return b else: sum = 0 while a+b < max: c = a + b a = b b = c if b % 2 == 0: ...
""" This is only an example of the config file that would be used for database connections. Fields listed as <> would have to be filled in manually. """ db_name = "<database_name>" db_user = "<databse_username>" db_password = "<database_password>" db_host = "<database_host>" db_port = "<database_port>"
""" Author: Armon Dadgar Description: This test tries to initialize a VirtualNamespace and checks that it behaves as expected. """ #pragma repy # Small code snippet, safe safe_code = "meaning_of_life = 42\n" # Unsafe snippet unsafe_code = "import sys\n" # Try to make the safe virtual namespace safe_virt = creat...
#Faça um programa que leia algo pelo teclado e mostre na tela o seu tipo primitivo # e todas as informações possiveis sobre ela.""" n = input('Digite algo para converter: ') print(type(n)) print(n.isalnum()) #isalnum (self) - Verifica se está em Alfanumérico print(n.isalpha()) #isalpha(self) - Verifica se é Alfabetico ...
def CFS(data): features = [] score = -1e-9 while True: best_feature = None for feature in range(data.features): features.append(feature) temp_score = calculate_corr(data[F]) if temp_score > score: score = temp_score best_feature = features features.pop() feature...
# O(n) time | O(d) - where n is the total number of elements in the array, # including sub-elements and d is the greatest depth of arrays in the array def productSum(array, multiplier=1): # Write your code here. sum = 0 for element in array: if type(element) is list: sum += productSum(element, multiplier + 1...
# "The cake is not a lie!" challenge test_string = "abccbaabccba" def solution(s): s_len = len(s) for pattern_len in range(1, s_len + 1): pattern = s[:pattern_len] pattern_count = s.count(pattern) if pattern_count * pattern_len == s_len: return pattern_count if __name__...
def sum_list_1(dataset: list) -> int: """Вычисляет сумму чисел списка dataset, сумма цифр которых делится нацело на 7""" sum_result = 0 for dataset_elem in dataset: sum_numbers = 0 dataset_elem10 = dataset_elem while dataset_elem10 // 10 > 0: sum_numbers += dataset_elem10...
#!/bin/bash with open("version.txt", "r+") as f: version = f.read().split(".") final_string = f"{version[0]}.{int(version[1])+1}.{version[2]}" f.seek(0) f.truncate() # truncate requires cursor at the beginning of the file f.write(final_string)
conditions = { 'test_project_ids': ['*'], 'test_suite_ids': ['*'], 'test_names': ['login'], } def pre_test_run(): pass
_debug = True def SetDebug(val=True): global _debug _debug = val class AtlasException(Exception): def __init__(self, message): super().__init__(message) def AtlasAssert(cond, message): if _debug and (not cond): raise AtlasException(message)
""" Entradas --> 1 valor int que es el salario de la personas Salario --> float --> a Salidas: 1 valor int que será el nuevo sueldo del trabajador Salario neto --> float --> b """ # Entradas a =float(input("\nDime tu salario actual ")) # Caja negra if a < 900000: b = (a * 0.15) + a else: b = (a * 0.12) +...
# Protocol Constants CMD_FIELD_LENGTH = 16 # Exact length of cmd field (in bytes) LENGTH_FIELD_LENGTH = 4 # Exact length of length field (in bytes) MAX_DATA_LENGTH = 10**LENGTH_FIELD_LENGTH-1 # Max size of data field according to protocol MSG_HEADER_LENGTH = CMD_FIELD_LENGTH + 1 + LENGTH_FIELD_LENGTH + 1 # Ex...
class dpcharge: def __init__(self, T: list, Coins: list, money: int): n = len(Coins) bag = [999999 for i in range(money+1)] bag[0] = 0 for i in range(n-1, 0, -1): for j in range(1, Coins[i]+1): for k in range(m, T[i]-1, -1): bag[k] = mi...
class Account: def __init__(self, owner, amount=0): self.owner = owner self.amount = amount self._transactions = [] def __add__(self, other): account = Account(f'{self.owner}&{other.owner}', self.amount + other.amount) account._transactions = self._transactions + other._...
#009 - TABUADA #Faça um programa que leia um número inteiro qualquer e mostre na tela a sua tabiada. n = int(input('Digite um número para ver a sua tabuada: ')) print('-' * 12) print(f'TABUADA DO {n}') print('-' * 12) print(f'{n} x 1 = {n * 1}') print(f'{n} x 2 = {n * 2}') print(f'{n} x 3 = {n * 3}') print(f'{n} x ...
class ScreenType: SSD1306 = 0 SSD1106 = 1 def __init__(self): pass class ConnectionType: I2C = 0 SPI = 1 def __init__(self): pass class Screen: screen_type = "" connection_type = "" bus = "" screen = "" # @timed_function def __init__(self, screen_ty...
names_count = int(input()) names = {input() for _ in range(names_count)} [print(x) for x in names]
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "" services_str = "/home/ubuntu/catkin_ws/src/navigation/robot_pose_ekf/srv/GetStatus.srv" pkg_name = "robot_pose_ekf" dependencies_str = "std_msgs" langs = "gencpp;genlisp;genpy" dep_include_paths_str = "std_msgs;/opt/ros/indigo/share/std_msgs/cmake/....
# # PySNMP MIB module Nortel-Magellan-Passport-VoiceMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-VoiceMIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:19:22 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using P...
""" default range of waypoints on the map (used for node name binary encoding in states) """ def get_pos_min_max(): # find boundaries of X and Y coordinates in the graph ROW_MIN = 11 ROW_MAX = 14 COL_MIN = 0 COL_MAX = 11 # TBD for dynamic graphs return (ROW_MIN, ROW_MAX), (COL_MIN, COL_MA...
# Crie um programa onde o usuário possa digitar sete valores numéricos e cadastre-os em # uma lista única que mantenha separados os valores pares e ímpares. # No final, mostre os valores pares e ímpares em ordem crescente. cores = {'limpa':'\033[m', 'bverde':'\033[1;32m', 'roxo':'\033[35m', ...
SQLALCHEMY_DATABASE_URI = 'postgresql://shepard:shepard@localhost/sheparddb' SECRET_KEY = 'fda890t43nlba8i9pr32jl' MONGODB_SETTINGS = { 'db': 'sheparddb', 'host': '127.0.0.1', 'port': 27017 } PORT = 9999 DEBUG_LOG_FILE = '/var/log/sheparddb/info.log' WTF_CSRF_ENABLED = False...
# For the drifters to work, you need to fill in your Twitter APP key. # The probability values are hidden here. You can decide the values by youself. # The values used in our paper can be found in the manuscript. ################# Access Keys ####################### mashape_key = '' customer_API_key = '' customer_API...
a,b,c = int(input()),input().split(),0 key = [b[i-a:i] for i in range(1, len(b)+1)if i%a==0 and b.count("0")!=a*a] for i in range(a): for j in range(a): if len(key) > 1 and key[i][j] == key[j][i]: c=c+1 if c == a*a: print("yes",end="") else: print("no",end="") ...
class Solution: #given a string #return an integer def romanToInt(self, s): key = ['M','CM','D','CD','C','XC','L','XL','X','IX','V','IV','I'] val = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1] res = 0 for i in range(len(key)): while len(key[i]) <= len(s)...
"""exercism triangle module.""" def is_triangle(sides): """ Check to see if this is a triangle :param sides: list[*int] - the length of the three sides of a triangle? :return bool - whether it is a triangle or not >>> is_triangle([1, 2, 3]) True >>> is_triangle([0, 0, 0]) False ...
# While loop will run until the specified condition is true i = 1 while i < 5: print(i) i += 1 # Using break statement we can stop the flow of the loop print() i =1 while i < 5: print (i) if i == 3: # Our loop will stop executing from 3 break i += 1 # Example 2 # Continue: this wl...
# from math import ceil, floor, trunc # a=12.3456 # b=(a) # # print(b) # list=[1,2,3,4,5] # # here we use the shallow copy method to both has the different memory address. using the "copy.copy". # # list1=copy(list) # help(copy.copy) # print("list : ",id(list)) # print("list1 : ",id(list1)) def uppers(z): for i...
SEARCH_LOCATIONS = [ [-54.1962894, -69.223033], [-51.7628454, -58.8519393], [-48.263197, -70.2777205], [-45.8935737, 168.8783417], [-44.0028155, -68.519908], [-42.8152797, 171.8666229], [-42.1020234, 146.8177948], [-39.1408438, -72.3870955], [-38.7580781, 175.8217011], [-38.73065...
#练习5-3 #能通过测试的版本 alien_color = 'green' if alien_color == 'green': print("You just earned 5 points!") #不能通过测试的版本 alien_color = 'red' if alien_color == 'green': print("You just earned 5 points!") print('\n') #练习5-4 #不执行 else 代码块的版本 alien_color = 'green' if alien_color == 'green': print("You just...
SECRET_KEY = '*&GJD%KDjy' DEBUG = True ENV_CONF = { 'world_size': 12, 'capacity': 10, 'player1_home': (5,5), 'player2_home': (6,6), 'num_walls': 24, 'num_jobs': 24, 'value_range': (6,12), 'max_steps': 200 } # REPLAY_DIR = "/replays" REPLAY_DIR = "/Users/st491/LocalStore/tmp/competition3_repl...
a=5 b=3 print(a+b) c=input() #d=input() d=4 e=c*d print(e)
def cut_candy(arr): size = len(arr) memo = [0 for x in range(size+1)] memo[0] = 0 for i in range(1, size+1): max_profit = -float('inf') for j in range(i): max_profit = max(max_profit, arr[j] + memo[i-j-1]) memo[i] = max_profit print(memo) return memo[size] ...
class ItemValue: #Class to store items data def __init__(self, wt, val, index): self.wt = wt #Weight of item self.val = val #Value of item self.index = index #Index of item in list self.cost = val / wt #Figure of merit def __lt__(self, other)...
fruit = {"orange": "a sweet, orange, citrus fruit", "apple": "good for making cider", "lemon": "a sour, yellow, citrus fruit", "pear": "change me"} # "apple": "The second one"} # reassigns the value of first 'apple' instead of printing a second 'apple' value # # print(fruit) ...
""" link: https://leetcode-cn.com/problems/flip-game-ii problem: 给定一个只含 +- 的字符串,两人轮流将 ++ 变成 --,直至有一方不能操作,判负,问是否有先手必胜策略 solution: SG 函数。显然在这个游戏中,不连续的 +++... 序列间互不影响,求每段长为k的连续+序列的sg值,再异或每段 + 序列的sg值,判其是否处于必败状态。 对长度为 k 的 + 序列,有 sg(k) = mex{sg(i) ^ sg(k-2-i) | i ∈ [0, k//2]} """ def get_sg(n: int) -> [int]: ...
__version__ = '0.0.0' API_ROOT = 'https://www.pythonanywhere.com/api/v0'
def closeH5(h5File): try: h5File.close() except: pass def closeAllH5Files(h5Files): for h5File in h5Files: closeH5(h5File) def loadLabelsBlock(h5Dset, begin, end): return h5Dset[begin[0]:end[0], begin[1]:end[1], begin[2]:end[2], 0] def loadData(h5Dset, begin, end): i...
a = 0 for i in range(10): MyNumb = input('Введите номер!') if MyNumb == '5': a = a + 1 print('пользователем было введено',(a),'цифр 5')
original = 'Mary had a %s lamb.' extra = 'little' original % extra 'Mary had a little lamb.'
# # @lc app=leetcode id=18 lang=python3 # # [18] 4Sum # # https://leetcode.com/problems/4sum/description/ # # algorithms # Medium (30.03%) # Total Accepted: 225.6K # Total Submissions: 746.7K # Testcase Example: '[1,0,-1,0,-2,2]\n0' # # Given an array nums of n integers and an integer target, are there elements # a...
# https://adventofcode.com/2021/day/5 test = "2021-05_sample.txt" run = "2021-05_input.txt" def part1(fname): count = 0 points = {} for line in open(fname): a, _, b = line.rstrip().split(' ') p1 = [int(x) for x in a.split(',')] p2 = [int(x) for x in b.split(',')] #print(f'\...
c=0;a=[];n=int(input()) for _ in range(n): v,p=map(int,input().split()) a.append(v) a.sort(reverse=True);k=a[4] for i in range(5,n): if k==a[i]: c+=1 else: break print(c)
x=1 pos=0 while x<=6: a=float(input()) if a>0: pos=1+pos x=x+1 print("%d valores positivos" % pos)
class Node(object): def __init__(self, item): self.item = item def __str__(self): return str(self.item) def __repr__(self): return str(self) def __getattr__(self, attr): return getattr(self.item, attr)
class MRMSComposite(object): """ Class for the MRMSGrib object """ def __init__(self, validity_date, validity_time, major_axis, minor_axis, data_path, fname, shape, grid_lons=None, grid_lats=None): """ Initializes a new MRMSComposite object Parameters ---------- ...
class CountdownObject(): def __init__(self, list_nums, target): self._list_nums = list_nums # e.g. [1,2,3,4] self._target = target self._permutations = [list_nums.copy()] # list of lists, all possible permutations of original list, e.g. [[1,5,7],[2,4,3]...], starts as original list of nums self._solutions = [[...
description = 'virtual POLI lifting counter' group = 'lowlevel' devices = dict( liftingctr = device('nicos.devices.generic.VirtualMotor', description = 'lifting counter axis', pollinterval = 15, maxage = 61, fmtstr = '%.2f', abslimits = (-4.2, 30), precision = 0.01,...
# # PySNMP MIB module COLUBRIS-CONNECTION-LIMITING-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/COLUBRIS-CONNECTION-LIMITING-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:25:45 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Pyt...
# -*- coding: utf-8 -*- """ Created on Sun Apr 23 23:02:44 2017 @author: LI YUXIN """ ''' VGGNet Placeholder '''
choice = int(input()) if choice == 1: class Conta: pass # Para cada nova instância deve-se colocar os atributos que queremos conta = Conta() conta.titular = 'Ríkard' conta.saldo = 3000 conta.numero = '111-1' print(conta.saldo) #A saída será 3000 # Exemplo de e...
# Press the green button in the gutter to run the script. # list[param1:param2:param3] # # param1,相当于start_index,可以为空,默认是0 # param2,相当于end_index,可以为空,默认是list.size # param3,步长,默认为1。步长为-1时,返回倒序原序列 if __name__ == '__main__': fruits=["apple", "cherry", "peal", "strawberry"] print(sorted(fruits, key=(lambda ...
# Wrap the operations into one function, now named `calculate`, # with a mandatory "operation" parameter. def calculate(x: int, y: int = 1, operation: str = None) -> int: """Calculates the sum (or difference) of two numbers. Parameters: `x` : int The first number `y` : int, optional T...
def is_even(x): result=x//2 if((x-result*2)==0): return True else: return False
#!/usr/bin/python3 complex_delete = __import__('102-complex_delete').complex_delete print_sorted_dictionary = \ __import__('6-print_sorted_dictionary').print_sorted_dictionary a_dictionary = {'lang': "C", 'track': "Low", 'pref': "C", 'ids': [1, 2, 3]} new_dict = complex_delete(a_dictionary, 'C') print_sorted_dicti...
def changeValueA(actualDataFrame, changeValue): predictedData = actualDataFrame.copy() predictedData["y"] = [item*changeValue for item in actualDataFrame["x"]] return predictedData def changeValueB(actualDataFrame, changeValue): predictedData = actualDataFrame.copy() predictedData["y"] = [item+cha...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 10 17:26:43 2021 @author: alef """ #fatorial implementado de forma recursiva def fatorial_r(num): if num <= 1: return 1 else: return (num * fatorial_r(num - 1)) # fatorial sem recursão 1 def fatorial_nr(num): resp = li...
# # # # # # # # Python Tuples (a,b) # # # # # # # # Immutable - size is fixed # # # # # # # # Use - passing data that does not need changing # # # # # # # # Faster than list - less bookkeeping no worries about size change # # # # # # # # "safer" than list # # # # # # # # Can be key in dict unlike list # # # # # # # # F...
# Copyright 2017 Balazs Nemeth # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
''' Read 5 weights and show the higher and the lower value in KG ''' higher = 0 lower = 0 for p in range (1, 6): weight = int(input(f"Type the {p}º person's weight: ")) # p counts the people if p == 1: # First loop the higher and the lower receives the first value higher = weight lower = weight...
# v = dict.fromkeys(["k1","123","323"],123) # print(v) # dic = {'k1': 123, 456: 123, '999': 123} # v = dic.pop() # print(v,dic) # del dic["999"] # print(dic) # dic = {'k1': 123, 123: 123, '999': 123} # v = dic.setdefault("k2","123") # print(v,dic) # dic.update({"k3":"v3"}) # dic.update(k4="v4") # for i in dic.keys(): ...
crime_codes = { '740': 'VANDALISM - FELONY ($400 & OVERALL CHURCH VANDALISMS) 0114', '888': 'TRESPASSING', '330': 'BURGLARY FROM VEHICLE', '745': 'VANDALISM - MISDEAMEANOR ($399 OR UNDER)', '510': 'VEHICLE - STOLEN', '210': 'ROBBERY', '901': 'VIOLATION OF RESTRAINING ORDER', '626': 'INTI...
#!/usr/bin/python # Filename: ex_strings.py #===================================================== # Single Quotes #===================================================== msg = 'Quote me on this' print('msg = ', msg) #===================================================== # Double Quotes work exactly as single quotes #...
def in_range(minim, maxim, num): if minim > maxim: aux = minim minim = maxim maxim = aux return num in range(minim, maxim) x = in_range(10, 14, 11) print(x)
# Faça um programa que leia um número qualquer e mostre o seu fatorial. n = int(input('Digite um valor:')) cont = 2 fatorial = 1 while cont < n+1 : fatorial = fatorial * cont cont += 1 print('O fatorial de {} é {}'.format(n,fatorial))
# 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: def __init__(self): self.has_found = False self.res = [] self.path = [] def DFS(self, n...
info = {0: {'bad_channels': [3], 'color': 'red', 'polygon': [(0.396535162031, -0.628663752105), (0.396444292843, -0.631425958949), (0.396352852158, -0.634185981605), (0.396260837973, -0.63694380631), (0.3961682483, -0.639699419259), ...
n = int(input()) salary = int(input()) penalty = 0 for i in range(n): browser_tab = input() if browser_tab == 'Facebook': penalty += 150 elif browser_tab == 'Instagram': penalty += 100 elif browser_tab == 'Reddit': penalty += 50 if salary - penalty <= 0: print('You have los...
# - Stack() creates a new, empty stack # - push(item) adds the given item to the top of the stack and returns nothing # - pop() removes and returns the top item from the stack # - peek() returns the top item from the stack but doesn’t remove it(the stack isn’t modified) # - is_empty() returns a...
# Tabela verdade do operador not x = True y = False print(not x) print(not y) # Tabela verdade do operador and (e)(apenas true e true da true) x = True y = False print(x and y) # Tabela verdade do operador or (ou) (apenas false ou false da false)(o resto da true) x = True y = False print(x or y) # exemplo 1 not x = ...
def encrypt(y): y = y ^ y >> 11 y = y ^ y << 7 & 2636928640 y = y ^ y << 15 & 4022730752 y = y ^ y >> 18 return y flag = open("flag", 'rb').read().strip() encrypted = list(map(encrypt, flag)) print(encrypted) # 151130148, 189142078, 184947887, 184947887, 155324581, 4194515, 16908820, 16908806, 172234346, 1...
def parity_brute_force(x): res = 0 while x > 0: res ^= x & 0x1 x = x >> 1 return res def parity_bit_shifting(x): four_bit_parity_lookup_table = 0x6996 #= 0b0110100110010110 x ^= x >> 32 x ^= x >> 16 x ^= x >> 8 x ^= x >> 4 x &= 0xF return (four_bit_parity_loo...
#coding=utf-8 #Time 2019/12/25 class Student(): def __init__(self,name,sid,password,age,gender): ''' 初始化学生属性 :param name: :param sid: :param password: :param age: :param gender: ''' self.name = name self.sid = sid self.pword = ...
t=int(input()) while(t): n,v1,v2=map(int,input().split()) if(2**0.5)/v1<2/v2: print("Stairs") else: print("Elevator") t=t-1
class Solution: def lengthOfLongestSubstring(self, s): """ :type s: str :rtype: int """ abc_set = set() max_length = 0 start_pos = 0 for i, c in enumerate(s): while c in abc_set: abc_set.discard(s[start_pos]) ...
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CON...
#def init(): #Global Variables #global sim_start_time sim_start_time = '2014-02-01 00:00:00' #global DatumLong #original coloseum DatumLong = 12.492373 #Eastwards DatumLong = 12.4420 #global DatumLat #original coloseum DatumLat = 41.890251 #Northwards DatumLat = 41.9280 #map bounds in paper #(41.856, 12.442),(41.928...
class Color(DefaultColor): HOSTNAME_FG = 231 HOSTNAME_BG = 23 HOME_SPECIAL_DISPLAY = False JOBS_FG = 15 JOBS_BG = 31
#!/usr/bin/env python """ AWS signature verification exceptions. """ class InvalidSignatureError(Exception): """ An exception indicating that the signature on the request was invalid. """ pass # Local variables: # mode: Python # tab-width: 8 # indent-tabs-mode: nil # End: # vi: set expandtab tabstop=8...
#!/usr/local/bin/python3 # -*- coding: UTF-8 -*- class Solution(object): def test2(self): ''' 题目:企业发放的奖金根据利润提成。利润(I)低于或等于10万元时,奖金可提10%;利润高于10万元,低于20万元时,低于10万元的部分按10%提成,高于10万元的部分,可提成7.5%;20万到40万之间时,高于20万元的部分,可提成5%;40万到60万之间时高于40万元的部分,可提成3%;60万到100万之间时,高于60万元的部分,可提成1.5%,高于100万元时,超过100万元的部分按1%提成,从键盘输入当...
def tabcompare(source, target): s_last_deal = 0 n = 0 with open('result.txt', 'w') as f: for s in source: for t in target: print('compare {} and {}'.format(s, t)) s_last_deal = s if s < t: f.write(str(s)) ...
class Context(): """ステートマシンは、このContextが何なのか知りません。 外部から任意に与えることができる変数です""" def __init__(self): self._user_name = "" @property def user_name(self): """ログインユーザー名""" return self._user_name @user_name.setter def user_name(self, val): self._user_name = val
# Time: O(n) # Space: O(1) def findThreeLargestNumbers(array): threeLargestNumbers = [None, None, None] for num in array: updateLargest(threeLargestNumbers, num) return threeLargestNumbers def updateLargest(threeLargest, num): if threeLargest[2] is None or num > threeLargest[2]: shift...
INF = 999999 def print_distances(graph, from_vertex=0): num_vertices = len(graph) dists = [ INF ] * num_vertices visited = [ False ] * num_vertices dists[from_vertex] = 0 for k in range(num_vertices - 1): min_dist, vertex = INF, -1 for v in range(num_vertices): if...
# Created by MechAviv # Sheep Damage Skin | (2436721) if sm.addDamageSkin(2436721): sm.chat("'Sheep Damage Skin' Damage Skin has been added to your account's damage skin collection.") sm.consumeItem()
def testsgen_basic(uni, asci): u_items = uni.split(" ") a_items = asci.split(" ") for idx, item in enumerate(a_items): print('QUnit.test("u2a {0} => {1}", function(assert){{' 'assert.strictEqual(' 'kn.unicode_to_ascii("{0}"), "{1}");}});'.format( u_items...
class Solution: def checkPerfectNumber(self, num): """ :type num: int :rtype: bool """ if num <= 1: return False return sum(self.getFactors(num)) == num def getFactors(self, num): sqrt_num = int(math.sqrt(num)) # 1 is always a facto...
# Space: O(1) # Time: O(n) class NumMatrix: def __init__(self, matrix): self.board = matrix def sumRegion(self, row1: int, col1: int, row2: int, col2: int) -> int: res = 0 for y in range(row1, row2 + 1): for x in range(col1, col2 + 1): res += self.board[y]...
name = "Sophie" number = 24811 print (number) number -= 20 name += "!!!" print (name) print (number) age = 20016 age -= 20005 print ("Sophie is %s" % name)
class CrudSerializer: get_list_response_model = None get_item_response_model = None update_item_request_model = None update_item_response_model = None create_item_request_model = None create_item_response_model = None remove_item_response_model = None
name = "Jan Maximilan Schaffranek" result = name.find("an") if result == -1: print("Not found") else: print("Found at index: ", result) name2 = name.replace("Jan", "Yann") print(name) print(name2) name3 = name.upper() print(name3) name4 = name.lower() print(name4) name5 = name.split(" ") print(name5)...
class CommandSyntaxException(Exception): CONTEXT_AMOUNT = 50 def __init__(self, exc_type, message, str_input=None, cursor=-1): super().__init__(message) self.type = exc_type self.message = message self.input = str_input self.cursor = cursor def get_message(self)...
x = True y = False print(x and y) # False print(x or y) # True print(not x) # False print(bool(10)) # True print(bool(0)) # False print(bool('')) # False print(bool('0')) # True print(bool('False')) # True print(bool([])) # False print(bool([False])) # True x = 10 # True y = 0 # False print(x and y) # 0 ...
"Mirror of release info" TOOL_VERSIONS = { "v1.2.185": { "android-arm-eabi": "sha384-a9NRmV90j+tXV7xT3+LK+UBcUgKMVRp9k4yz29hKi7VRqwIQxuL3aKAcyP1mXCly", "android-arm64": "sha384-rdQq6yIfkTZtuhYiIz2eo0/Y1MuPDAGqf4See2ZPYRnzF6owWSAkU1MzUnKlwvas", "darwin-arm64": "sha384-hMId2tsrNKrkOUH5MLGmNfR...
a, b = input().split() a = int(a) b = int(b) if a < b: c = b % a if(c == 0): print('Sao Multiplos') else: print('Nao sao Multiplos') else: c = a % b if (c == 0): print('Sao Multiplos') else: print('Nao sao Multiplos')
def MFnComponent_elementCount(*args, **kwargs): pass def MFloatMatrix_isEquivalent(*args, **kwargs): pass def MTrimBoundaryArray_insert(*args, **kwargs): pass def boolPtr_value(*args, **kwargs): pass def MQuaternion_setToZAxis(*args, **kwargs): pass def MDataBlock_inputArrayValue(*args, **...
expected_output = { 'prefixes':{ '/misc/config':{ 'size':'48648003584', 'free':'42960707584', 'type':'flash', 'flags':'rw' }, 'tftp:':{ 'size':'0', 'free':'0', 'type':'network', 'flags':'rw' }, 'disk2:':{ ...