content
stringlengths
7
1.05M
class Solution(object): def compareVersion(self, version1, version2): """ :type version1: str :type version2: str :rtype: int """ versionList1 = version1.split(".") versionList2 = version2.split(".") total_level_revisions = max([len(versionList1), len(...
#!/usr/bin/env python3 def primer3_input(header, sequence, args): """ Generates a primer3 input file with specified arguments. Args: header (string): The primer header string sequence (string): the sequence used to design primers args (Namespace): Arparse results. Returns: p...
a=int(input('enter a :')) b=int(input('enter a :')) c=int(input('enter a :')) def largest_num(x,y,z): if x>y and x>z: print(x) elif y>x and y>z: print(y) else: print(z) print('largest :',end="") largest_num(a,b,c)
"""The Decisions module contains the command parsing logic.""" validCommands = ["h", "w"] def processCommand(command: str): # NOTE: that type hinting is still used above """Processes the gamer's input. (below is the Google docstrings example) Args: command (str): The command to process ...
# List in Python # from typing import Tuple name = ["Anirban", "Rangan", "Miko", "UK NK", "Lucifer"] print(name) # mixed List mixing1 = ["ISHITA ROY", 143, 0.99, 'E'] print(mixing1) print(mixing1[2]) # list shorting num1 = [2, 5, 78, 3, 88, 23, 1, 94, 33, 21, 5, 3, 67, 27] print(num1) num2 = num1.copy() num1.sort() pr...
# -*- coding: utf-8 -*- """ @author: zhoujiagen Created on 2020/8/21 5:14 PM """
class Drivers: def __init__(self, client): self.client = client def find_by_context(self, context, filter=None, observations=False, participation=False, interval=None): """ Fetches driver data from the specified context id :param context: Context id to fetch the data ...
def gcd(a, b): """ Returns the greatest common divisor of and b. """ if a < b: a, b = b,a while b > 0: a, b = b, a % b return a print(gcd(50, 20)) print(gcd(22,143))
#ex_086 m = [[],[],[]] for j in range(3): for i in range(3): n = int(input(f'digite o valor para o bloco[{j},{i}]:')) m[j].append(n) for l in range(3): print(m[l]) #ex_087 soma = soma3 = 0 for j in range(3): for i in range(3): if int(m[j][i])%2==0: soma += int(m[j][i]) p...
class AiManager: def __init__(self, modstring): self.modlines = modstring self.fn = self.get_fn() self.edits = self.get_edits() def get_fn(self): return self.modlines[0].split("# ")[1].strip() def get_edits(self): return [{"offset": int(e.split(" ")[0], 16)...
"""General definitions for the AmigaOS Hunk format""" HUNK_UNIT = 999 HUNK_NAME = 1000 HUNK_CODE = 1001 HUNK_DATA = 1002 HUNK_BSS = 1003 HUNK_ABSRELOC32 = 1004 HUNK_RELRELOC16 = 1005 HUNK_RELRELOC8 = 1006 HUNK_EXT = 1007 HUNK_SYMBOL = 1008 HUNK_DEBUG = 1009 HUNK_END = 1010 HUNK_HEADER = 1011 HUNK_OVERLAY = 1013 HUNK_...
# Given an array of integers that is already sorted in ascending order, # find two numbers such that they add up to a specific target number. # # The function twoSum should return indices of the two numbers such # that they add up to the target, where index1 must be less than index2. # # Note: # # Your returned answers...
# 一刷时间: 2019 # 链接:https: // leetcode-cn.com/problems/palindrome-number class Solution: def isPalindrome(self, x: int) -> bool: # x 若是 0 或者负数,返回 false if (x < 0 or (int(x % 10 == 0) and x != 0)): return False # 初始化翻转数字 reverse = 0 # 若原始数字 x 大于从后面开始翻转的数字,说明已经翻转了后半部...
companies = {} command = input() while not command == "End": company, emp_id = command.split(" -> ") if company not in companies: companies[company] = [emp_id] else: if emp_id not in companies[company]: companies[company].append(emp_id) command = input() for company, emp_id...
# Librerias # Constantes # Funciones y/o clases class Auto: # atributos def __init__(self, nro_placa, tipo, color, modelo, anio_fabricacion): # genero las variables de auto self.nro_placa = nro_placa self.tipo = tipo self.color = color self.modelo = modelo s...
tup = ("apple", "banana", "cherry") it = iter(tup) print(next(it)) print(next(it)) print(next(it)) #using class class numbers: def __iter__(self): self.a = 1 return self def __next__(self): x = self.a self.a += 1 return x myclass = numbers() myiter = iter(myclass) print(next(myiter)) print...
# -*- coding: utf-8 -*- def main(): a, b, k = map(int, input().split()) takahashi = a aoki = b for i in range(k): if i % 2 == 0: if takahashi % 2 == 1: takahashi -= 1 takahashi -= takahashi // 2 aoki += takahashi else...
""" LC 406 You are given an array of people, people, which are the attributes of some people in a queue (not necessarily in order). Each people[i] = [hi, ki] represents the ith person of height hi with exactly ki other people in front who have a height greater than or equal to hi. Reconstruct and return the queue that...
w1 = [[ 0.21188451, -0.07536257, -1.50488397, 1.07709642, -1.00670164, 0.70171048, 0.46828757, 1.61520523, -0.61159711, 0.62985384], [ 2.62728329, -2.12787044, -0.37743212, -0.03947755, -0.52624001, -1.86089361, -0.83215303, 0.08603709, -2.79556013, -3.05423877], [-2.74150917, 2.20029538, -0.66665525, -2.7...
DEBUG = True TABLE_NAME = "users" PERMANENT_SESSION_LIFETIME = 1260 TIMEOUT_WARNING_MS = 900000 TIMEOUT_LOGOUT_MS = 1200000 KEEPALIVE_INTERVAL_MS = 60000 SITE_NAME = 'GREP Annotation Viewer'
class preprocess: words_0 = {} words_1 = {} cnt_0 = 0 cnt_1 = 0 content = [] def __init__(self,file1): self.file1 = file1 def split_file_test_train(self,a,b): f1 = open("train.txt", "w") f2 = open("test.txt", "w") lines = [] with open(self.file1.name) ...
''' This program will take multiple inputs from the user and when he enters done as his last input it will return largest and smallest values of user's respective inputs ''' #we are using none as in the loop first value will replace them automatically largest = None smallest = None while True: num = input('Inp...
{ 'variables' : { 'xmpmeta_dir': '<(DEPTH)/third_party/xmpmeta/internal/xmpmeta', }, 'target_defaults': { 'include_dirs' : [ '<(xmpmeta_dir)/external', '<(xmpmeta_dir)/external/miniglog', ], }, 'targets': [ { 'target_name': 'xmpmeta_strings', 'dependencies': [ '...
# These CPC codes are international classifiers for patents. # This dict is imported by patenttools.lookup and is used to provide the "patent class". cpc_codes = { 'B29L': 'INDEXING SCHEME ASSOCIATED WITH SUBCLASS B29C, RELATING TO PARTICULAR ARTICLES', 'D01D': 'MECHANICAL METHODS OR APPARATUS IN THE MANUFACTUR...
class Antecedent(): def __init__(self, template, template_property, value): self.template = template self.template_property = template_property self.value = value class TestAntecedent(): def __init__(self, operation, *parametres): self.parameters = [] self.oper...
n = int(input()) for i in range(n): nota01, nota02, nota03 = map(float, input().split()) total = ((nota01*2) + (nota02*3) + (nota03*5))/10 print('%.1f' % round(total, 1))
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next # https://leetcode.com/problems/merge-k-sorted-lists # Other solutions: ''' https://leetcode.com/problems/merge-k-sorted-lists/discuss/1810642/C%2B%2B-oror-Priority-Queu...
"""https://open.kattis.com/problems/avion""" codes = [] for _ in range(5): codes.append(input()) found = False for i in range(5): if "FBI" in codes[i]: print(i + 1, end=' ') found = True if not found: print("HE GOT AWAY!")
CARD_SUITS = ("SPADES", "HEARTS", "DIAMONDS", "CLUBS") PLAYERS_DEFAULT = 2 DECKS_AMOUNT = 1 RANDOM_NAMES = [ "Geralt of Rivia", "Ciri of Cintra", "Yennefer of Vengerberg", "Triss Merigold", "Dandelion", "Mousesack", "Gaunter O'Dimm", "Keira Metz", "Emhyr var Emreis", "The Angry S...
# from fuzzywuzzy import fuzz class Collection(): """ Base class for collection of data objects **Arguments:** :``datafile``: `str` Filename for local datafile :``base_class``: `class` Class to instantiate for entires in this collection **Keyword Arguments:** ...
class Warrior: attack = 5 health = 50 is_alive = True class Knight(Warrior): attack = 7 def fight(unit_1, unit_2): print('fight') flag = True while unit_1.health > 0 and unit_2.health > 0: if flag is True: unit_2.health -= unit_1.attack fla...
x = [[3,4], [1,2]] y = [[6,9], [5,8]] xy = [[0,0], [0,0]] n=2 for i in range(n): for j in range(n): xy[i][j] = x[i][j] * y[i][j] print(xy)
def functions_in_class(theclass): for funcname in dir(theclass): if funcname.startswith('__'): continue yield getattr(theclass, funcname)
# -*- coding: utf-8 -*- """Project metadata Information describing the project. """ # The package name, which is also the "UNIX name" for the project. package = 'copdai_core' project = "COPDAI CORE" project_no_spaces = project.replace(' ', '') version = '0.1' description = 'Collaborative Open Platform for Distributed...
""" Your task is to implement This function reads a sequence of words provided through command line terminated by the "stop" word and prints them in reverse order. Each word is separated by the "enter", see the main() below for how to read user input from command line Note: this solution can be impr...
#!/usr/bin/env python class Config(object): _cfg = {} def safe_get(self, name): self._cfg.get(name) def append_config_values(self, opts): pass def __setattr__(self, name, value): self._cfg[name] = value def __getattr__(self, name): return self._cfg.get(name) ...
# while loop is used to repeat a block of code until a condition is false # this is useful for loops that don't know how many times they should run # this while loop checks if you are hungry and if you are, it will print "Okay, here's a snack" until you are not hungry hungry = input('Are you hungry? y/n ') while hu...
# Exercice 4.3 : Retour sur l'algorithme d'Euclide def pgcd(a : int, b : int) -> int: """Précondition: b > 0 et a >= b Retourne le plus grand commun diviseur de a et b.""" # Quotient q : int = a # Diviseur r : int = b # Variable temporaire temp : int = 0 ...
# You are using Python class Node() : def __init__(self, value=None) : self.data = value self.next = None class LinkedList() : def __init__(self) : self.head = None self.tail = None def insertElements(self, arr) : """ Recieves an array of inte...
#!/usr/bin/env python3 # Copyright 2009-2017 BHG http://bw.org/ x = '47' y = int(x) # constructor q transforma a string em int conversao z = float(x) a = abs(x) b = divmod(x, 3) c = complex() d = x+34j print(f'x is {type(x)}') print(f'x is {x}') print(f'y is {type(y)}') print(f'y is {y}')
def find_unique(array1): # Return the only element not duplicated missing = 0 for number in array1: print(missing, ' - ', number) missing ^= number print(missing, ' - ', number) return missing if __name__ == "__main__": array = [1, 9, 1, 9, 5, 6, 7, 8, 7, 8, 6] second_array ...
def get_final_position(data): depths,hori_pos = [0],0 aim = 0 for i,e in enumerate(data): if i == 0: if e[0] == 'forward': hori_pos += int(e[1]) elif e[0] == 'down': aim += int(e[1]) elif e[0] == 'up': aim -= int(e[...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: """ 83.删除排序链表中的重复元素 | 难度:简单 | 标签:链表 ...
class Mesa: def __init__(self, casas): self.total = [6, 6, 6, 6, 6, 6, 6] self.casas = casas self.remover(self.casas) def get_casas(self): return self.casas def mostrar_total(self): num = 0 print('+ numero | quantidade +') for item in self.total: ...
class Libro: def __init__(self, titulo, autor, cantidad_de_paginas, genero, sinopsis): self.titulo = titulo self.autor = autor self.cantidad_de_paginas = cantidad_de_paginas self.genero = genero self.sinopsis = sinopsis
l, x = map(int, input().split()) people = 0 not_allowed = 0 for _ in range(x): descri, p = input().split() p = int(p) if descri == "enter": if people + p > l: not_allowed += 1 else: people += p elif descri == "leave": people -= p print(not...
# -*- coding: utf-8 -*- # @Author: GXR # @CreateTime: 2021-04-01 # @UpdateTime: 2021-12-10 # 代理池Redis设置 REDIS_HOST = "redis" REDIS_PORT = "6379" REDIS_DB = "0" # 代理池Redis-key REDIS_KEY_PROXY_FREE = "proxy_free" REDIS_KEY_PROXY_USEFUL = "proxy_useful" # 代理池检查线程数 THREAD_COUNT_PROXY_CHECK = 10 # 代理池刷新线程数 THREAD_COUNT_...
month = int(input()) if month == 1: month = 'January' elif month == 2: month = 'February' elif month == 3: month = 'March' elif month == 4: month = 'April' elif month == 5: month = 'May' elif month == 6: month = 'June' elif month == 7: month = 'July' elif month == 8: month = 'August' el...
# -*- coding: utf-8 -*- class CommandError(Exception): """ Exception class indicating a problem while executing a console scripts. """ pass
command_props = ( "command", "invalidcommand", "postcommand", "tearoffcommand", "validatecommand", "xscrollcommand", "yscrollcommand" ) def handle(widget, config, **kwargs): props = dict(kwargs.get("extra_config", {})) builder = kwargs.get("builder") # add the command name and ...
''' @Author: hua @Date: 2019-05-28 20:11:04 @LastEditors: hua @LastEditTime: 2019-11-16 14:47:41 ''' validation = { #验证规则 'required':{ True:'必须', False: '非必须' }, 'type':'类型', 'string': '字符串', 'integer': '整形', 'list': '列表', 'minlength': '最小长度', 'maxlength': '最大长度', ...
points = dict() points.update(dict.fromkeys(('AEIOULNRST'), 1)) points.update(dict.fromkeys(('DG'), 2)) points.update(dict.fromkeys(('BCMP'), 3)) points.update(dict.fromkeys(('FHVWY'), 4)) points.update(dict.fromkeys(('K'), 5)) points.update(dict.fromkeys(('JX'), 8)) points.update(dict.fromkeys(('QZ'), 10)) def score...
#!/usr/bin/env python3 #This program will write: #Hello from Veronika Cabalova Joseph. print("Hello from Veronika Cabalova Joseph.")
d = {'k1':'v1', 'k2':'v2'}; print(d) e = d.copy(); print(e) d['k1'] = 'v111' print(d, e)
''' @author: Pranshu Aggarwal @problem: https://hack.codingblocks.com/app/practice/1/853/problem ''' def delhi_odd_even(n): even, odd = 0, 0 while n != 0: rem = n % 10 if rem % 2 == 0: even += rem else: odd += rem n = int(n / 10) return (even % 4 == 0 or odd % 3 ...
""" Functions: get_tag make_upstream_probe make_downstream_probe make_probes """ BEAD2TAG = { "LUA-1" : "CTTTAATCTCAATCAATACAAATC", "LUA-2" : "CTTTATCAATACATACTACAATCA", "LUA-3" : "TACACTTTATCAAATCTTACAATC", "LUA-4" : "TACATTACCAATAATCTTCAAATC", "LUA-5" : "CAATTCAAATCACAATAATCAATC", "LUA-6" :...
def Introduction(example): """Make an entry into the dictionary. When this entry is called the dictionary will print an explination of your puzzle. Make sure to include the call required to run your test.""" dictionary = {'example':'Text', 'first_test':'Simply import the test file with from tests import ...
s = input() k = int(input()) def rec(k): d= {} start =0 res ='' for i in range(len(s)): d[s[i]] = d.get(s[i],0)+1 while len(d)>k: d[s[start]]-=1 if d[s[start]] ==0: del d[s[start]] start+=1 l = i - start+1 ...
# -*- python coding: utf-8 -*- # # Copyright © 2014 Jeff Epler http://emergent.unpythonic.net # # This program is is licensed under a disjunctive dual license giving you # the choice of one of the two following sets of free software/open source # licensing terms: # # * GNU General Public License (GPL), version 2.0 o...
def create_position(db: Session, position_id: int, position = schemas.PositionCreate): db_position = models.Person(name = position.name, age = position.age, gender = position.gender, condition = position.condition) db.add(db_position) db.commit() db.refresh(db_position) return db_position
""" This is a comment. """ assert_app_dependency(app, 'Foo', '1.0')
file = open("day1/day1_input.txt", "r") fuel = 0 for mass in file: fuel += (int) (int(mass) / 3) - 2 print(fuel) file.close()
#### create a hierarchy of mammals #### class Mammal: def __init__ (self, name): self.name = name def speak (self): print('Hi! I am', self.name) class LandMammal (Mammal): def __init__ (self, name): super().__init__(name) def walk (self): print('Look at me, me is ...
ANIME_FIELDS = ( 'title { romaji english native }', 'description', 'averageScore', 'status', 'episodes', 'siteUrl', 'coverImage { large medium }', 'bannerImage', 'tags { name }' 'idMal', 'type', 'format', 'season', 'duration', 'chapters', 'volumes', '...
""" Announce ET status changes. """ def consume(client, channel, frame): who = frame.headers['who'] # "kdreyer@redhat.com" # product = frame.headers['product'] # "RHEL-EXTRAS" release = frame.headers['release'] # "Extras-RHEL-7.4" errata_id = int(frame.headers['errata_id']) # 12345 errata_url ...
AVATAR_AUTO_GENERATE_SIZES = 150 # Control the forms that django-allauth uses ACCOUNT_FORMS = { "login": "allauth.account.forms.LoginForm", "add_email": "allauth.account.forms.AddEmailForm", "change_password": "allauth.account.forms.ChangePasswordForm", "set_password": "allauth.account.forms.SetPasswor...
#Automate script for scan IP with nmap value = input('Enter the file name: ') file = open (value,"r") content = file.readlines() for line in content: IP = line.split() print(IP)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created with Corsair vgit-latest Control/status register map. """ class _RegData: def __init__(self, rmap): self._rmap = rmap @property def val(self): """Value of the register""" rdata = self._rmap._if.read(self._rmap.DATA_ADDR)...
n1 = float(input('Digite uma nota: ')) n2 = float(input('Digite outra nota: ')) media = (n1 + n2)/2 if media >= 6.0: print('Sua média foi boa. Parabéns') else: print('Precisa estudar mais')
class WorkOrdersApi(): """ Class is the interface for talking to the work orders api in lightspeed. """ endpoint = "Workorder.json" def __init__(self, client): self.client = client def get_workorders(self, params={}, limit=100, offset=0): params["limit"] = limit pa...
# # PySNMP MIB module BROCADE-SPX-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BROCADE-SPX-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:41:19 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
TEMPLATES = [] PLATFORMS = {} MIDDLEWARES = []
class Pilha: pilha = list() def __init__(self, elemento=None): if elemento: self.inserir(elemento) def inserir(self, elemento): self.pilha.insert(0, elemento) def remover(self): elemento = self.pilha.pop(-1) return elemento def tamanho(self): c...
def resolve_refs(node, resolver): if isinstance(node, list): for v in node: resolve_refs(v, resolver) return if not isinstance(node, dict): return ref_url = node.get('$ref', None) if ref_url is not None: node.clear() _, fragment = resolver.resolve(ref_...
# . Покупатель должен заплатить в кассу S р. У него имеются купюры номиналом 1, 2, 5, 10, 100, 500 р. Сколько # купюр разного достоинства отдаст покупатель, если он начинает платить с самых крупных. #Написание кода #!/usr/bin/env python3 # -*- coding: utf-8 -*- if __name__ == '__main__': # Ввод суммы для оплаты ...
def first_word(str): """ returns the first word in a given text. """ text=str.split() return text[0] if __name__ == '__main__': print("Example:") print(first_word("Hello world"))
print ("Decidere il tipo di triangolo") a= float(input("inserisci lato 1: ")) b= float (input ("Inserisci lato 2: ")) c= float (input ("Inserisci lat 3: ")) print ("Lato 1: ", a) print ("Lato 2: ", b) print ("Lato 3: ", c) if a==b and b==c: print ("Triangolo equilatero") elif a==b or b==c or a==c: print ("T...
AchievementTitles = ('It\'s fun with friends', 'Mr Popular', 'Famous Toon', 'Trolley Time!', 'VP', 'VP', 'VP', 'VP') AchievementDesc = ('You made a Friend!', ...
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] c = [] for x in b: if x in a and x not in c: c.append(x) print(c)
class Owners: def __init__(self, github, cloud_storage): self.github = github self.cloud_storage = cloud_storage def list_all(self): return self.cloud_storage.list_all_owners() def sync(self): all_users = self.github.fetch_users() self.cloud_storage.store_owners_lis...
def merge_sort(l): if len(l) == 1: return l # left = merge_sort(l[:l // 2]) # right = merge_sort(l[l // 2:]) left = merge_sort(l[:len(l)//2]) right = merge_sort(l[len(l)//2:]) return merge(left, right) def merge(left, right): result = [] i = j = 0 while i <= len(left)-1 and...
source = open('Second_train.txt','r') state = 0 output = open('SecondData.txt','w') for line in source: if line[0] == '%': state = 1 elif state == 1: line = line.replace('<SEP>',',') output.write(line) state = 0
################################################################################ # Author: BigBangEpoch <bbepoch@163.com> # Date : 2018-12-24 # Copyright (c) 2018-2019 BigBangEpoch All rights reserved. ################################################################################ def de_normalize(feat_data, norm_p...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' ***************************************** Author: zhlinh Email: zhlinhng@gmail.com Version: 0.0.1 Created Time: 2016-03-26 Last_modify: 2016-03-26 ****************************************** ''' ''' Note: This is an extension of House Robber...
# Its job is to identify which forms are good prompts for the key form, so given a level and a form, # we can pick a good prompt. MATCHING_FORMS = { ("A1", "INDICATIVO_PASSATO_PROSSIMO"): ["'INDICATIVO_PRESENTE'"], ("A2", "INDICATIVO_PASSATO_PROSSIMO"): ["'INDICATIVO_PRESENTE'"], ("B1", "INDICATIVO_PASSATO...
#!/usr/bin/env python # @Time : 6/10/18 1:41 PM # @Author : Huaizheng Zhang # @Site : zhanghuaizheng.info # @File : base.py class BaseDetector(object): ''' This class is a base class of object detection ''' def __init__(self): ''' Init object detector :arg :...
class Player(object): pass class Game(object): pass
# coding=utf-8 """ create on : 2019/04/19 project name : AtCoder file name : 10_ABC086C Problem : https://atcoder.jp/contests/abs/tasks/arc089_a """ def main(): n = int(input()) last_time = 0 last_x = last_y = 0 flag = True for _ in range(n): t, x, y = [int(txy) for txy in input().sp...
""" Test `servifier` package. Author: Nikolay Lysenko """
def createLineSpeed(): x1 = [] y1 = [] x2 = [] y2 = [] print("Enter the beginning and ending of two line (0-1) (xb1,yb1,xe1,ye1,xb2,yb2,xe2,ye2)") Bp = input("Enter line position :").split(",") x1.append((Bp[0])) y1.append((Bp[1])) x1.append((Bp[2])) y1.append((Bp[3])) x2.append((Bp[4])) y2.appe...
""" Daubechies 20 wavelet """ class Daubechies20: """ Properties ---------- asymmetric, orthogonal, bi-orthogonal All values are from http://wavelets.pybytes.com/wavelet/db20/ """ __name__ = "Daubechies Wavelet 20" __motherWaveletLength__ = 40 # length of the mother wavelet __tra...
# coding=utf-8 NETS = ['default'] POOL = 'default' IMAGE = None CPUMODEL = 'host-model' NUMCPUS = 2 CPUHOTPLUG = False MEMORY = 512 MEMORYHOTPLUG = False DISKINTERFACE = 'virtio' DISKTHIN = True DISKSIZE = 10 DISKS = [{'size': DISKSIZE}] GUESTID = 'guestrhel764' VNC = False CLOUDINIT = True RESERVEIP = False RESERVEDNS...
class BrokenDB(Exception): def __init__(self, expected_hash: bytes, actual_hash: bytes, hash_algorithm: str): self.expected_hash = expected_hash self.actual_hash = actual_hash self.hash_algorithm = hash_algorithm class WrongMaster(Exception): pass
class BaseEnv(dataclass): state: any observation_spec: dict[str, Modality] action_spec: dict[str, Modality] last_observation: dict[str, NestedTensor] last_action: dict[str, NestedTensor] def step(self, obs, *args, **kwargs): raise NotImplementedError('subclasses should implement this m...
def warn_the_sheep(queue): if queue[-1]=="wolf": return 'Pls go away and stop eating my sheep' else: return "Oi! Sheep number "+str(len(queue)-queue.index("wolf")-1)+"! You are about to be eaten by a wolf!"
'''input 1 1 1 5 3 1 2 2 ''' # -*- coding: utf-8 -*- # AtCoder Beginner Contest if __name__ == '__main__': n = int(input()) print(n) # See: # https://www.slideshare.net/chokudai/abc021 for _ in range(n): print(1)
# Conversor de moedas carteira = float(input("Quanto dinheiro você tem na carteira?R$ ")) preço_dolar = 5.16 valor_convertido = carteira / preço_dolar print(f"A quantia de R${carteira:.2f} em moeda americana dá US${valor_convertido:.2f}")
class MinStack: def __init__(self): self.L = [] self.min_stack = [] def push(self, val: int) -> None: self.L.append(val) if not self.min_stack: self.min_stack.append(val) else: if val <= self.min_stack[-1]: self.min_stack....
print (' Leia o exercicio para saber o codigo de origem !') pre = float ( input ('Digite preço do produto: ' )) tipo = int ( input ('Codigo de origem ? ')) if (tipo == 1): print ('Preço do produto é R${}, [origem Sul] '.format(pre)) elif ( tipo == 2): print ( 'Preço do produto é R${}, [origem Norte]'.format(pre)) el...
print ('Qual a sua data de nascimento?') dia = input ('Dia: ') mes = input ('Mes: ') ano = input ('Ano: ') print ('Voce nasceu no dia ' + dia + ' de ' + mes + ' de ' + ano)