content
stringlengths
7
1.05M
''' Created on 1.12.2016 @author: Darren ''' ''' Given a binary search tree and a node in it, find the in-order successor of that node in the BST. Note: If the given node has no in-order successor in the tree, return null. '''
def printCommands(): print("Congratulations! You're running Ryan's Task list program.") print("What would you like to do next?") print("1. List all tasks.") print("2. Add a task to the list.") print("3. Delete a task.") print("q. To quit the program") printCommands() aTaskListArray = ["bob", "...
data = open("input.txt", "r") data = data.read().split(",") check = True index = 0 while check is True: section = data[index] firstNum = int(data[int(data[index + 1])]) secondNum = int(data[int(data[index + 2])]) if section == "1": total = firstNum + secondNum if section == "2": ...
mod = 10**9 + 7 n = int(input()) a = list(map(int, input().split())) answer = 0 sumation = sum(a) for i in range(n-1): sumation -= a[i] answer += a[i]*sumation answer %= mod print(answer)
{ "targets": [ { "target_name": "sharedMemory", "include_dirs": [ "<!(node -e \"require('napi-macros')\")" ], "sources": [ "./src/sharedMemory.cpp" ], "libraries": [], }, { "target_name": "messaging", "include_dirs": [ "<!(node -e \"require('na...
def protected(func): def wrapper(password): if password=='platzi': return func() else: print('Contrasena invalida') return wrapper @protected def protected_func(): print('To contrasena es correcta') if __name__ == "__main__": password=str(raw_input('Ingresa tu ...
s=input() if s[-1] in '24579': print('hon') elif s[-1] in '0168': print('pon') else: print('bon')
# Text Type: str # Numeric Types: int, float, complex # Sequence Types: list, tuple, range # Mapping Type: dict # Set Types: set, frozenset # Boolean Type: bool # Binary Types: bytes, bytearray, memoryview x = float(1) # x will be 1.0 y = float(2.8) # y will be 2.8 z = float("3") # z will be 3.0 w = float("4.2...
"""Extended Euclidean Algorithm ============================== GCD of two numbers is the largest number that divides both of them. A simple way to find GCD is to factorize both numbers and multiply common factors. GCD(a,b) = ax + by If we can find the value of x and y then we can easily find the ...
TRAIN_DATA_PATH = "data/processed/train_folds.csv" TEST_DATA_PATH = "data/processed/test.csv" MODEL_PATH = "models/" NUM_FOLDS = 5 SEED = 23 VERBOSE = 0 FEATURE_COLS = [ "Pclass", "Sex", "Age", "SibSp", "Parch", "Ticket", "Fare", "Cabin", "Embarked", "Title", "Surname", "...
""" author: Alice Francener problem: 1082 - Connected Components description: https://www.urionlinejudge.com.br/judge/en/problems/view/1082 """ '''Problema: quantos grafos conexos existem''' class DisjointSets: def __init__(self, n): self.rank = [0] * n self.parent = [] for i in rang...
def parse_ninja(): f = open('out/peerconnection_client.ninja', 'r') for line in f.readlines(): lines = line.split(" ") for l in lines: print(l) f.close() def create_list_of_libs(): f = open('out/client_libs.txt', 'r') for line in f.readlines(): segments = line.st...
#(n-1)%M = x - 1 #(n-1)%N = y - 1 gcd = lambda a,b: gcd(b,a%b) if b else a def finder(M,N,x,y): for i in range(N//gcd(M,N)): if (x-1+i*M)%N==y-1: return x+i*M return -1 for _ in range(int(input())): M,N,x,y = map(int,input().split()) print(finder(M,N,x,y))
# while循环,语法如下 # while 条件表达式: # 循环体 print("求数,三三数之剩二,五五数之剩三,七七数之剩二") found = False number = 0 while not found: number += 1 if number % 3 == 2 and number % 5 == 3 and number % 7 == 2: print("数字为", str(number)) found = True # for循环,语法如下 # for 迭代变量 in 对象: # 循环体 print("计算1+2+3+···+100=?") r...
norm_cfg = dict(type='GN', num_groups=32, requires_grad=True) model = dict( type='PoseDetDetector', pretrained='pretrained/dla34-ba72cf86.pth', # pretrained='open-mmlab://msra/hrnetv2_w32', backbone=dict( type='DLA', return_levels=True, levels=[1, 1, 1, 2, 2, 1], channel...
"""top-level pytest config options can only be defined here, not in binderhub/tests/conftest.py """ def pytest_addoption(parser): parser.addoption( "--helm", action="store_true", default=False, help="Run tests marked with pytest.mark.helm", )
# Exceptions class SequenceFieldException(Exception): pass
try: x = int(input("X: ")) except ValueError: print("That is not an int!") exit() try: y = int(input("Y: ")) except ValueError: print("That is not an int!") exit() print (x + y)
# Design Linked List class ListNode: def __init__(self, x): self.value = x self.next = None class LinkedList: def __init__(self): self.size = 0 self.head = ListNode(0) # Sentinel Node as psuedo-head # add at head def addAtHead(self, val): self.addAtHead(0, val...
# -*- coding:utf-8 -*- pizza = { 'crust': 'thick', 'toppings': ['mushrooms', 'extra cheese'], }
''' 1) 파일 열기(open) 2) 파일 읽기(read)/쓰기(write) 3) 파일 닫기(close) ''' # 파일 열기 f = open('test.txt', 'w', encoding ='utf-8') # 파일에 텍스트를 씀 for i in range(1,11): f.write(f'{i}번째 줄...\n') # 파일 닫기 f.close() # with 구문 : 리소스를 사용한 후 close() 메소드를 자동으로 호출 # with ...as 변수: # 실행문 with open('test2.txt', mode='w', encoding='utf-8...
# You may remember by now that while loops use the condition to check when # to exit. The body of the while loop needs to make sure that the condition begin # checked will change. If it doesn't change, the loop may never finish and we get # what's called an infinite loop, a loop that keeps executing and never stops. # ...
""" *Sounding State* A type describing state of data soundness. """ class SoundingState( StatefulPhantomClass, ): pass
""" Top level of MQTT IO package. """ VERSION = "2.1.4"
DOMAIN = "audiconnect" CONF_VIN = "vin" CONF_CARNAME = "carname" CONF_ACTION = "action" MIN_UPDATE_INTERVAL = 5 DEFAULT_UPDATE_INTERVAL = 10 CONF_SPIN = "spin" CONF_REGION = "region" CONF_SERVICE_URL = "service_url" CONF_MUTABLE = "mutable" SIGNAL_STATE_UPDATED = "{}.updated".format(DOMAIN) TRACKER_UPDATE = f"{DOMA...
def first_last6(list1: list) -> bool: """Return True if either/both first and last element are assigned a value of 6 >>> first_last6(test_list1) False >>> first_last6(test_list2) True >>> first_last6(test_list3) True """ if list1[0] or list1[5] == 6: return True ...
class Mouse: __slots__=( '_system_cursor', 'has_mouse' ) def __init__(self): self._system_cursor = ez.window.panda_winprops.get_cursor_filename() self.has_mouse = ez.panda_showbase.mouseWatcherNode.has_mouse def hide(self): ez.window.panda_winprops.set_curso...
n = int(input()) s = set(map(int, input().split())) for i in range(int(input())): f = input().split() if (f[0] == "pop"): s.pop() elif (f[0] == "remove"): s.remove(int(f[-1])) else: s.discard(int(f[-1])) print(sum(s))
# ------------------------------------------------------------------------------------ # Tutorial: Learn how to use Dictionaries in Python # ------------------------------------------------------------------------------------ # Dictionaries are a collection of key-value pairs. # Keys can only appear once in a dictiona...
def setup(): noLoop() size(500, 500) noStroke() smooth() def draw(): background(50) fill(94, 206, 40, 100) ellipse(250, 100, 160, 160) fill(94, 206, 40, 150) ellipse(250, 200, 160, 160) fill(94, 206, 40, 200) ellipse(250, 300, 160, 160) fill(94, 206, 4...
def test_get_condition_new(): scraper = Scraper('Apple', 3000, 'new') result = scraper.condition_code assert result == 1000 def test_get_condition_used(): scraper = Scraper('Apple', 3000, 'used') result = scraper.condition_code assert result == 3000 def test_get_condition_error(): scraper = Scraper('A...
""" Hao Ren 11 October, 2021 495. Teemo Attacking """ class Solution(object): def findPoisonedDuration(self, timeSeries, duration): """ :type timeSeries: List[int] :type duration: int :rtype: int """ time = 0 length = len(timeSeries) for i in range(le...
def get_median( arr ): size = len(arr) mid_pos = size // 2 if size % 2 == 0: # size is even median = ( arr[mid_pos-1] + arr[mid_pos] ) / 2 else: # size is odd median = arr[mid_pos] return (median) def collect_Q1_Q2_Q3( arr ): # Preprocessing # in-pl...
class YamboSpectra(): """ Class to show optical absorption spectra """ def __init__(self,energies,data): self.energies = energies self.data = data
def vowelCount(str): count = 0 for i in str: if i == "a" or i == "e" or i == "u" or i == "i" or i == "o": count += 1 print(count) exString = "Count the vowels in me!" vowelCount(exString)
def test_add_two_params(): expected = 5 actual = add(2, 3) assert expected == actual def test_add_three_params(): expected = 9 actual = add(2, 3, 4) assert expected == actual def add(a, b, c=None): if c is None: return a + b else: return a + b + c
# pylint: disable=R0903 """test __init__ return """ __revision__ = 'yo' class MyClass(object): """dummy class""" def __init__(self): return 1 class MyClass2(object): """dummy class""" def __init__(self): return class MyClass3(object): """dummy class""" def __init__(self): ...
l = [58, 60, 67, 72, 76, 74, 79] s = '[' for ll in l: s += ' %i' % (ll + 9) s += ' ]' print(s)
# -*- coding: utf-8 -*- # @Time: 2020/6/22 22:33 # @Author: GraceKoo # @File: interview_26.py # @Desc: https://leetcode-cn.com/problems/ # er-cha-sou-suo-shu-yu-shuang-xiang-lian-biao-lcof/ """ # Definition for a Node. class Node: def __init__(self, val, left=None, right=None): self.val = val self...
''' Estruturas Lógicas: and, or, not, is. Operadores unários: -not, is. Operadores binários: - and, or Regras de funcionamento: Para o and ambos os valores pecisam serem verdadeiros (True) Para o 'or', um ou outro valor precisa ser verdadeiro (True) ara o 'not', o valor do boolenao é invertido, ou seja, se...
{ "variables": { "GTK_Root%": "c:\\gtk", "conditions": [ [ "OS == 'mac'", { "pkg_env": "PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig" }, { "pkg_env": "" }] ] }, "targets": [ { "target_name": "rsvg", "sources": [ "src/Rsvg.cc", "src/Enums.cc", "src/Autocrop.cc" ], "include_d...
def is_even_with_return(i): print('with return') remainder = i % 2 return remainder == 0 print(is_even_with_return(132)) def is_even(i): return i % 2 == 0 print("All numbers between 0 and 20: even or not") for i in range(20): if is_even(i): print(i, "even") else: print(i, "odd...
class gbXMLBuildingOperatingSchedule(Enum,IComparable,IFormattable,IConvertible): """ Enumerations for gbXML (Green Building XML) format,used for energy analysis,schema version 0.34. enum gbXMLBuildingOperatingSchedule,values: DefaultOperatingSchedule (0),KindergartenThruTwelveGradeSchool (7),NoOfOpera...
class Solution: def firstBadVersion(self, n): if n == 1: return 1 l, r = 2, n while l <= r: mid = (l + r) // 2 if isBadVersion(mid) and not isBadVersion(mid - 1): return mid elif isBadVersion(mid): r = mid - 1...
class Solution: def wordPatternMatch(self, pattern, text): """ :type pattern: str :type str: str :rtype: bool { "a": asd } asdasdasd 3 "" """ return self._find_match(pattern, text, 0, 0...
for i in range(10): if i%2==0: continue print(i) #1 3 5 7 9 numbers=[10,20,0,5,0,30] for n in numbers: if n==0: print("Hey how we can divide with zero…pagal ho gya kya") continue print('100/{}={}'.format(n,100/n)) #---100/10=10.0 100/20=5.0 hey how we can devide with zero……..
""" Time utilities for lux analysis and replay """ # Sunrise sunset data for Sunnyvale, CA, 2016. # From http://aa.usno.navy.mil/cgi-bin/aa_rstablew.pl?ID=AA&year=2016&task=0&state=CA&place=Sunnyvale # Eventually use ephem (https://pypi.python.org/pypi/pyephem/) to # compute the sunrise/sunset. sunrise_sunset_data =\ ...
class Obstacle: def __init__(self, clearance): self.x = 10 self.y = 10 self.clearance = clearance self.robot_radius = 0.354 / 2 self.clearance = self.robot_radius + self.clearance self.dynamic_Obstacle = False # self.rect1_corner1_x = 3 # self.rect1...
""" Problem Given a list of integers, find the largest product you could make from 3 integers in the list Requirements You can assume that the list will always have at least 3 integers """ def get_largest_product(lst): if len(lst) < 3: raise ValueError("List is too short") high = max(lst[0], lst[1...
"""Project metadata Information describing the project. """ # The package name, which is also the so-called "UNIX name" for the project. package = 'ecs' project = "Entity-Component-System" project_no_spaces = project.replace(' ', '') version = '0.1' description = 'An entity/component system library for games' authors...
def f(*, b): return b def f(a, *, b): return a + b def f(a, *, b, c): return a + b + c def f(a, *, b=c): return a + b def f(a, *, b=c, c): return a + b + c def f(a, *, b=c, c=d): return a + b + c def f(a, *, b=c, c, d=e): return a + b + c + d def f(a=None, *, b=None): return a + b...
# Sort the entries of medals: medals_sorted medals_sorted = medals.sort_index(level=0) # Print the number of Bronze medals won by Germany print(medals_sorted.loc[('bronze','Germany')]) # Print data about silver medals print(medals_sorted.loc['silver']) # Create alias for pd.IndexSlice: idx idx = pd.IndexSl...
class WebSocketDefine: Uri = "wss://sdstream.binance.com/stream" # testnet new spec # Uri = "wss://sdstream.binancefuture.com/stream" class RestApiDefine: Url = "https://dapi.binance.com" # testnet # Url = "https://testnet.binancefuture.com"
s = input() y, m, d = map(int, s.split('/')) f = False ( Heisei, TBD, )= ( 'Heisei', 'TBD', ) if y < 2019: print(Heisei) elif y == 2019: if(m < 4): print(Heisei) elif m == 4: if(d <= 30): print(Heisei) else : print(TBD) else : print...
""" The meat. Things to do: TaskFinder - querys a (file|db) for what sort of tasks to run Task - initialize from task data pulled by TaskFinder - enumerate the combination of args and kwargs to sent to this task - provide a function which takes *args and **kwargs to execute the task - ...
rfm69SpiBus = 0 rfm69NSS = 5 # GPIO5 == pin 7 rfm69D0 = 9 # GPIO9 == pin 12 rfm69RST = 8 # GPIO8 == pin 11 am2302 = 22 # GPIO22 == pin 29 voltADC = 26 # GPIO26 == pin 31
class persona: edad=0 id = -1 id_padre=0 id_madre=0 def __init__(self, nombre,edad,id,id_padre,id_madre): self.nombre=nombre self.edad = edad self.id = id self.id_padre=id_padre self.id_madre=id_madre personas=[] for i ...
# # @lc app=leetcode.cn id=400 lang=python3 # # [400] 第N个数字 # class Solution: def findNthDigit(self, n: int) -> int: if n < 10: return n i = 1 length = 0 cnt = 9 while length + cnt * i < n: length += cnt * i cnt *= 10 i += 1...
# Hack 3: create your own math function # Function is superfactorial: superfactorial is product of all factorials until n. # OOP method class superFactorial(): def __init__(self,n): self.n = n def factorial(self,y): y = self.n if y is None else y product = 1 for x in range(1,y...
class Settings(): "A class to store all settings for Football game." def __init__(self): """Initialize the game's settings.""" # Screen settings. self.screen_width = 1200 self.screen_height = 700 self.bg_color = (50, 205, 50) self.attacker_speed_factor = 1.5 ...
#条件分岐によるbreak(終了)とcontinue(スキップ) for num in range(10): #0~10未満(9まで)の値を順にnumに代入 if num == 1: #numが1の時、 continue #これより下の処理をスキップし、繰り返し処理に戻る(printもスキップされる) if num == 5: #numが5の時、 break #終了 print(num) #for文の組み合わせ(for_4.pyに続く…)
#declaração variaveis idade_med = 0 idade_maior = -1 quant_menor = 0 #laço for para pegar os dados for c in range(1, 5): print('-----{}ª pessoa-----'.format(c)) nome = str(input('Nome: ')).upper() idade = int(input('Idade: ')) genero = str(input('Gênero [M/F]: ')).upper() #calcular média de idade ...
# -*- coding: utf-8 -*- # ------------- Funciones en listas ------------- #Pop en listas print ("Lista A") listaA = [1, 2, 3, 4] print (listaA) elem_borrado = listaA.pop(1) print ("Eliminaste el elemento:", elem_borrado) #listaA.pop(0) #Elimina primer elemento print ("POP", listaA.pop(0)) print (listaA) #La función de...
# -*- Mode:Python;indent-tabs-mode:nil; -*- # # File: psaExceptions.py # Created: 05/09/2014 # Author: BSC # # Description: # Custom execption class to manage error in the PSC # class psaExceptions( object ): class confRetrievalFailed( Exception ): pass
class CategoryDefinition: """ Defines a category for labeling texts.""" def __init__(self, name): self.name = name class NamedEntityDefinition: """ Defines a named entity for annotating texts.""" def __init__(self, code, key_sequence = None, maincolor = None, backcolor = None, forecolor= Non...
# multiply a list by a number def mul(row, num): return [x * num for x in row] # subtract one row from another def sub(row_left, row_right): return [a - b for (a, b) in zip(row_left, row_right)] # calculate the row echelon form of the matrix def echelonify(rw, i, m): for j, row in enum...
ans = 0 a=input() for _ in range(int(input())): s=input() for start in range(10): for j in range(len(a)): if a[j] != s[(start+j)%10]: break else: ans+=1 break print(ans)
#!/usr/bin/env python3 """ Problem : Double-Degree Array URL : http://rosalind.info/problems/ddeg/ Author : David P. Perkins """ if __name__=="__main__": with open("ddegIn.txt", "r") as infile, open("ddegOut.txt", "w") as outfile: nodeCount = int(infile.readline().split()[0]) adjl = {x:set(...
# Easy # Runtime: 32 ms, faster than 73.01% of Python3 online submissions for Count and Say. # Memory Usage: 12.9 MB, less than 100.00% of Python3 online submissions for Count and Say. class Solution: def countAndSay(self, n: int) -> str: def count_and_say(n): if n == 1: return ...
class IBeacon(): def __init__(self, driver_instace) -> None: self.ble_driver_instace = driver_instace def setUUID(self, uuid : str) -> None: "uuid is 16 bytes should be represented as a string of hex-decimal format: XX XX XX XX ..." self.uuid = uuid def setMajor(self, major : str...
input("как вас зовут? ") # типы переменных int \ float \ bool \ None - пустой тип \ str name = "Mike" print(type(name)) bul_type = True print(type(bul_type)) date = "22" print(type(date)) date = int(date) print(type(date)) new_date = str(date) + " число" print(type(new_date)) # ####################### # print + se...
class PlannerEventHandler(object): pass def ProblemNotImplemented(self): return False def StartedPlanning(self): return True def SubmittedPipeline(self, pipeline): return True def RunningPipeline(self, pipeline): return True def CompletedPipeline(self, pipeli...
def minSubArrayLen(target, nums): length = list() for i in range(len(nums)): remain = target - nums[i] if remain <= 0: length.append(1) continue for j in range(i+1, len(nums)): remain = remain - nums[j] if remain <= 0: len...
''' Created on Apr 23, 2021 @author: Jimmy Palomino ''' def Region(main): """This function creates the region and set the boundaries to the machine analysis by FEM. Args: main (Dic): Main Dictionary than contain the necessary information. Returns: Dic: unmodified main dictionary. ...
# -*- coding: UTF-8 -*- class Shared(object): ''' Class used for /hana/shared attributes. Attributes and methods are passed to other LVM Classes. ''' name = 'shared' vg_physical_extent_size = '-s 1M' vg_data_alignment = '--dataalignment 1M' vg_args = vg_physical_extent...
class Solution: def longestCommonPrefix(self, strs: List[str]) -> str: shortest = min(strs, key=len) longest_common = "" for idx, char in enumerate(shortest): for word in strs: if word[idx] != char: return longest_common longest_co...
class Solution: def uniqueOccurrences(self, arr: List[int]) -> bool: dict = {} for i in arr : if i in dict : dict[i] += 1 else : dict[i] = 1 count = 0 s = set(dict.values()) ns = len(s) nl = len(...
test = { 'name': 'q1d', 'points': 1, 'suites': [ { 'cases': [ {'code': ">>> species_by_island.labels == ('species', 'Biscoe', 'Dream', 'Torgersen')\nTrue", 'hidden': False, 'locked': False}, {'code': ">>> np.all(species_by_island.column('Biscoe') == np.array([44, 0, 11...
# objects here will be mixed into the dynamically created asset type classes # based on name. # This lets us extend certain asset types without having to give up the generic # dynamic meta implementation class Attachment(object): def set_blob(self, blob): return self._v1_v1meta.set_attachment_...
def input_journal(path: str): journal = {} count = int(input("Введите количество записей: ")) for i in range(count): name = input("Введите Имя и Фамилию: ") mark = int(input(f"Введите оценку для {name}: ")) journal[name] = mark with open(path, "w") as file: file.write(str...
LOG_EPOCH = 'epoch' LOG_TRAIN_LOSS = 'train_loss' LOG_TRAIN_ACC = 'train_acc' LOG_VAL_LOSS = 'val_loss' LOG_VAL_ACC = 'val_acc' LOG_FIELDS = [LOG_EPOCH, LOG_TRAIN_LOSS, LOG_TRAIN_ACC, LOG_VAL_LOSS, LOG_VAL_ACC] LOG_COLOR_HEADER = '\033[95m' LOG_COLOR_OKBLUE = '\033[94m' LOG_COLOR_OKCYAN = '\033[96m' LOG_COLOR_OKGREEN =...
""" Test module for learning python packaging. """ def my_sum(arg): """ Sums the arguments and returns the sum. """ total = 0 for val in arg: total += val return total class MySum(object): # pylint: disable=too-few-public-methods """ MySum class """ @staticmethod ...
def load(h): return ({'abbr': 1, 'code': 1, 'title': 'PRES Pressure [hPa]'}, {'abbr': 2, 'code': 2, 'title': 'psnm Pressure reduced to MSL [hPa]'}, {'abbr': 3, 'code': 3, 'title': 'tsps Pressure tendency [Pa/s]'}, {'abbr': 4, 'code': 4, 'title': 'var4 undefined'}, {'a...
class Settings: params = () def __init__(self, params): self.params = params
urlChatAdd = '/chat/add' urlUserAdd = '/chat/adduser' urlGetUsers = '/chat/getusers/' urlGetChats = '/chat/chats' urlPost = '/chat/post' urlHist = '/chat/hist' urlAuth = '/chat/auth'
""" This module contains the definitions for Bike and its subclasses Bicycle and Motorbike. """ class Bike: """ Class defining a bike that can be ridden and have its gear changed. Attributes: seats: number of seats the bike has gears: number of gears the bike has """ def __init__...
# 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, software # distributed under the Li...
try: with open('../../../assets/img_cogwheel_argb.bin','rb') as f: cogwheel_img_data = f.read() except: try: with open('images/img_cogwheel_rgb565.bin','rb') as f: cogwheel_img_data = f.read() except: print("Could not find binary img_cogwheel file") # create the cogwheel image data cogwheel_im...
class Solution(object): def calculate(self, s): """ :type s: str :rtype: int """ if not s: return 0 s = s.replace(" ", "") n = len(s) stack = [] num = 0 sign = '+' for i in range(n): if s[i].isdigit(): ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Feb 23 13:11:49 2020 @author: abdulroqeeb """ host = "127.0.0.1" port = 7497 ticktypes = { 66: "Bid", 67: "Ask", 68: "Last", 69: "Bid Size", 70: "Ask Size", 71: "Last Size", 72: "High", ...
int1 = int(input('informe o inteiro 1 ')) int2 = int(input('informe o inteiro 2 ')) real = float(input('informe o real ')) print('a %2.f' %((int1*2)*(int2/2))) print('b %2.f' %((int1*3)+(real))) print('c %2.f' %(real**3))
data = ( 'ruk', # 0x00 'rut', # 0x01 'rup', # 0x02 'ruh', # 0x03 'rweo', # 0x04 'rweog', # 0x05 'rweogg', # 0x06 'rweogs', # 0x07 'rweon', # 0x08 'rweonj', # 0x09 'rweonh', # 0x0a 'rweod', # 0x0b 'rweol', # 0x0c 'rweolg', # 0x0d 'rweolm', # 0x0e 'rweolb', ...
class PHPWriter: def __init__(self, constants): self.constants = constants def write(self, out): out.write("<?php\n") out.write("/* This file was generated by generate_constants. */\n\n") for enum in self.constants.enum_values.values(): out.write("\n") f...
__version__ = "170130" __authors__ = "Ryo KOBAYASHI" __email__ = "kobayashi.ryo@nitech.ac.jp" class Machine(): """ Parent class of any other machine classes. """ QUEUES = { 'batch': {'num_nodes': 12, 'default_sec': 86400, 'limit_sec': 604800}, 'default':{'num_nodes': 12, 'default_se...
Amount = float BenefitName = str Email = str Donor = Email PaymentId = str def isnotemptyinstance(value, type): if not isinstance(value, type): return False # None returns false if isinstance(value, str): return (len(value.strip()) != 0) elif isinstance(value, int): return (value...
# model settings model = dict( type='ImageClassifier', backbone=dict( type='SVT', arch='base', in_channels=3, out_indices=(3, ), qkv_bias=True, norm_cfg=dict(type='LN'), norm_after_stage=[False, False, False, True], drop_rate=0.0, attn_drop...
nome = input('Digite seu nome: ') def saudar(x): print(f'Bem-vindo, {x}!') saudar(nome)
"""Anagram utilities""" def find_anagrams(word: str, candidates: list) -> list: """Detect anagrams on a list against a reference word Args: word: the reference word candidates: the list of words to be compared Returns: A new list with the anagrams found. """ low_word =...
class Solution: def sortedSquares(self, nums: List[int]) -> List[int]: sq_nums = [] for num in nums: sq_nums.append(num ** 2) sq_nums.sort() return sq_nums
class Stack(object): def __init__(self): self.items = [] self.min_value = None def push(self, item): if not self.min_value or self.min_value > item: self.min_value = item self.items.append(item) def pop(self): self.items.pop() def get_min_val...