content
stringlengths
7
1.05M
#!/usr/bin/env python3 # --------------------( LICENSE )-------------------- # Copyright (c) 2014-2022 Beartype authors. # See "LICENSE" for further details. ''' Project-wide **unimportable data submodule.** This submodule exercises dynamic importability by providing an unimportable submodul...
while True: print("hello") if 2<1: 2 print('hi')
# Copyright 2016 by Raytheon BBN Technologies Corp. All Rights Reserved """ Names and descriptions of attributes that may be added to AST nodes to represent information used by the preprocessor. Attribute names are typically used literally (except when checking for the presence of an attribute by name) so the purpos...
# Słownik tylko do reprezentacji "graficznej" liter UTF-8 do latin1 characters_dict = { "ą": "±", "ę": "ê", "ź": "¼", "ś": "¶", "ł": ("³", "£"), "ń": "ñ", "ż": "¿" } unused_words = ("<tr>", "</>", "tr", "td", "nobr", ...
''' A submodule for doing basic error analysis for experimental physics results. ''' def average(values): # TODO: add documentation pass def percent_diff(expected, actual): # TODO: add documentation pass
# A list is a collection which is ordered and changeable. In Python lists are written with square brackets. thislist = ["apple", "banana", "cherry", "orange", "kiwi", "melon", "mango"] print(thislist) # You access the list items by referring to the index number # Print the second item of the list print("The second e...
#codeing=utf-8 # @Time : 2017-11-08 # @Author : J.sky # @Mail : bosichong@qq.com # @Site : www.17python.com # @Title : 实战:利用Django开发部署自己的个人博客(2)视图/路由 # @Url : http://www.17python.com/blog/53 # @Details : 实战:利用Django开发部署自己的个人博客(2)视图/路由 # @Other : OS X 10.11.6 # Python 3.6.1 # VSC...
#Faça um programa utilizando um dict que leia dados de entrada do usuário. O usuário deve entrar #com os dados de uma pessoa como nome, idade e cidade onde mora (fique livre para acrescentar #outros). Após isso, você deve imprimir os dados como o exemplo abaixo: #nome: João #dade: 20 #idade: São Paulo #(Opcional) Util...
with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="gprpy", version="1.0.8", author="Alain Plattner", author_email="plattner@alumni.ethz.ch", description="GPRPy - open source ground penetrating radar processing and visualization", entry_points={'cons...
class _Emojis: def __init__(self): self.key = "\U0001F511" self.link = "\U0001F4CE" self.alert = "\U0001F6A8" self.ghost = "\U0001F47B" self.package = "\U0001F4E6" self.folder = "\U0001F5C2" self.bell = "\U0001F514" self.dissy = "\U0001F4AB" se...
icu_sources = [ 'utypes.cpp', 'uloc.cpp', 'ustring.cpp', 'ucase.cpp', 'ubrk.cpp', 'brkiter.cpp', 'filteredbrk.cpp', 'ucharstriebuilder.cpp', 'uobject.cpp', 'resbund.cpp', 'servrbf.cpp', 'servlkf.cpp', 'serv.cpp', 'servnotf.cpp', 'servls.cpp', 'servlk.cpp',...
while(True): try: x, a, y, b = map(int, input().split()) if(x * b == a * y): print("=") elif (x * b > a * y): print(">") else: print("<") except: exit()
class Graph(object): def __init__(self, graph={}): """ create the graph dictionary. use empty dictionary if no input. """ self.graph = graph def vertex(self, v): """ add new vertex. checks to see if vertex is already present before adding. """ if v not in self.graph: ...
META = [{ 'lookup': 'city', 'tag': 'city', 'path': ['names','en'], },{ 'lookup': 'continent', 'tag': 'continent', 'path': ['names','en'], },{ 'lookup': 'continent_code', 'tag': 'continent', 'path': ['code'], },{ 'loo...
# Example: Fetch single bridge by ID my_bridge = api.get_bridge('brg-bridgeId') print(my_bridge) ## { 'bridgeAudio': True, ## 'calls' : 'https://api.catapult.inetwork.com/v1/users/u-123/bridges/brg-bridgeId/calls', ## 'createdTime': '2017-01-26T01:15:09Z', ## 'id' : 'brg-bridgeId', ## 's...
# partisan.tests # Tests for the complete partisan package. # # Author: Benjamin Bengfort <bbengfort@districtdatalabs.com> # Created: Sat Jul 16 11:36:08 2016 -0400 # # Copyright (C) 2016 District Data Labs # For license information, see LICENSE.txt # # ID: __init__.py [80822db] benjamin@bengfort.com $ """ Tests fo...
class Solution: def isAdditiveNumber(self, num: str) -> bool: l = len(num) for i in range(1, (2 * l) // 3): for j in range(0, i): if num[0] == "0" and j + 1 != 1: break if num[j + 1] == "0" and i - j != 1: continue ...
class Solution: def findBestValue(self, arr: List[int], target: int) -> int: ln = len(arr) arr.sort() arr.insert(0, 0) arr_sum = arr.copy() for i in range(1, ln + 1): arr_sum[i] += arr_sum[i - 1] # 二不二分其实无所谓, 时间复杂度的大头是排序 O(nlogn), 下面用遍历也就 O(n) # for i in range...
# Database Config config = { 'MYSQL_DATABASE_USER' : 'root', #Username for mysql 'MYSQL_DATABASE_DB' : 'CoveServices', 'MYSQL_DATABASE_PASSWORD' : 'root', # Password to connect to mysql 'MYSQL_DATABASE_HOST' : 'localhost', 'USERNAME' : '', 'USERID' :'', }
nota1 = float(input()) while nota1 > 10 or nota1 < 0: print('nota invalida') nota1 = float(input()) nota2 = float(input()) while nota2 > 10 or nota2 < 0: print('nota invalida') nota2 = float(input()) media = (nota1+nota2)/2 print('media = %.2f'%media)
players = """ -- Name; Case Race; Beer Ball; Flip 50; Nicole;1;2;2; Jenna;2;2;5; Krendan;4;3;3; Dylan;4;3;3; Luke;5;5;3; Jason;5;4;3; Brendan;5;4;3; James E;3;3;3; Aidan;3;4;5; Daniel;4;5;4; Maya;3;3;5; James C;3;3;3; Kayvan;3;2;2; Steph;3;2;4; Kevin;3;3;3; """
km = float(input('Digite a distância da sua viagem: ')) if km <= 200: print(f'Como a sua viagem é de {km} o preço da sua passagem será R${0.5*km}') else: print(f'Como a sua viagem é mais longa que 200km, o preço da sua passagem sera de R${0.45*km}') print('Boa Viagem!')
# -*- coding: utf-8 -*- # TODO: deprecated URL_DID_SIGN_IN = '/api/v2/did/signin' URL_DID_AUTH = '/api/v2/did/auth' URL_DID_BACKUP_AUTH = '/api/v2/did/backup_auth' URL_BACKUP_SERVICE = '/api/v2/internal_backup/service' URL_BACKUP_FINISH = '/api/v2/internal_backup/finished_confirmation' URL_BACKUP_FILES = '/api/v2/inte...
""" .. module: lemur.plugins.utils :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ def get_plugin_option(name, options): """ Retrieve option name from options di...
def input(channel): pass def wait_for_edge(channel, edge_type, timeout=None): pass def add_event_detect(channel, edge_type, callback=None, bouncetime=None): pass def add_event_callback(channel, callback, bouncetime=None): pass def event_detected(channel): pass def remove_event_detect(chann...
n = input('digite alguma coisa: ') print('o Caracter',n, 'é ',n.isalpha()) print('o Caracter é Alfa numérico ? ',n.isalpha()) print(' ele é um número ? ',n.isalnum()) print('ele é número decimal ? ',n.isdecimal())
class Solution: def generateParenthesis(self, n: int) -> List[str]: st = [] res = [] def backtracking(op ,cl): if op == cl == n : res.append("".join(st)) return if op < n : st.append("(") ...
#!/usr/bin/env python # coding=utf-8 # author=dave.fang@outlook.com # create=20160518 """ * Author Dave * Version 1.0 * 此文件中包含的方法属于常用方法,一些复用多的方法。 """ def normalize_url(target, https=False): # 标准化 Target 信息 if not target: return elif target.startswith(('http://', 'https://')): ...
general_desc = """ <div><span class="bold">$name</span><span>: $desc</span></div> """ general_head = """ <html> <body> """ general_foot = """ </html> </body> """ not_srd = """ <!DOCTYPE html> <html> <head> <style> .name { font-size:225%; font-family:Georgia, serif; font-varia...
""" Eugene """ __all__ = ["Config", "Primatives", "Node", "Tree", "Individual", "Population", "Util"] __version__ = '0.1.1' __date__ = '2015-08-07 07:09:00 -0700' __author__ = 'tmthydvnprt' __status__ = 'development' __website__ = 'https://github.com/tmthydvnprt/eugene' __email__ = 'tmthydvnprt@users.noreply.github.co...
#About using of list # 列表的定义 有序的 可以承载各种数据(变量)类型 # 格式: 列表名 = [元素1, 元素2, 元素n] # my_list = [1, 3.14, "hello", True] # print(my_list) # 定义一个空的列表 # my_list1 = [] # <class 'list'> # print(type(my_list1)) # my_list2 = list() # 如果看是否是一个空列表呢? # l = len(my_list2) # print(l) # 定义一个列表 # my_list = ["a", "b", "c", "d"] my_list = l...
#!/usr/bin/python3 """ __slots__魔法 Python是一门动态语言 动态语言允许我们在程序运行时给对象绑定新的属性或方法,当然也可以对已经绑定的属性和方法进行解绑定。 如果我们需要限定自定义类型的对象只能绑定某些属性,可以通过在类中定义__slots__变量来进行限定。 需要注意的是__slots__的限定只对当前类的对象生效,对子类并不起任何作用。 version: 0.1 author: icro """ class Person(object): # 限定Person对象只能绑定_name, _age和_gender属性 __slots__ = ("_name", "_...
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def glog(): http_archive( name="glog" , sha256="bae42ec37b50e156071f5b92d2ff09aa5ece56fd8c58d2175fc1ffea85137664" , ...
p = float(input('digite o preço normal')) o = int(input('Digite\n [1] para dinheiro ou cheque\n [2] para a vista\n [3] em 2x\n [4] em 3x ')) if o == 1: print('o preço com desconto será de R${:.2f}' .format(p-p*.1)) elif o == 2: print ('o preço com desconto será de R${:.2f}' .format (pp*.05)) elif o == 3: p...
''' Created on 14.10.2019 @author: JM ''' class TMC2130_register_variant: " ===== TMC2130 register variants ===== " "..."
condicao = str(input('Deseja iniciar programa [S/N]? ')).upper() ac = 0 contador = 0 media = 0 maior = menor = 0 while condicao != 'N': if condicao == 'S': n = int(input('Digite um número inteiro: ')) ac = ac + n contador = contador + 1 media = ac / contador condicao = str(...
# Rainbow Grid handgezeichnet add_library('handy') def setup(): global h h = HandyRenderer(this) size(600, 600) this.surface.setTitle("Rainbow Grid Handy") rectMode(CENTER) h.setRoughness(1) h.setFillWeight(0.9) h.setFillGap(0.9) def draw(): colorMode(RGB) background(235, 215, ...
set_name(0x800A0CD8, "VID_OpenModule__Fv", SN_NOWARN) set_name(0x800A0D98, "InitScreens__Fv", SN_NOWARN) set_name(0x800A0E88, "MEM_SetupMem__Fv", SN_NOWARN) set_name(0x800A0EB4, "SetupWorkRam__Fv", SN_NOWARN) set_name(0x800A0F44, "SYSI_Init__Fv", SN_NOWARN) set_name(0x800A1050, "GM_Open__Fv", SN_NOWARN) set_name(0x800A...
__title__ = "Django REST framework Caching Tools" __version__ = "1.0.3" __author__ = "Vincent Wantchalk" __license__ = "MIT" __copyright__ = "Copyright 2011-2019 xsudo.com" # Version synonym VERSION = __version__ # Header encoding (see RFC5987) HTTP_HEADER_ENCODING = "iso-8859-1" default_app_config = "drf_cache.apps...
# Generate input data for EM 514, Homework Problem 8 def DefineInputs(): area = 200.0e-6 nodes = [{'x': 0.0e0, 'y': 0.0e0, 'z': 0.0e0, 'xflag': 'd', 'xbcval': 0.0, 'yflag': 'd', 'ybcval': 0.0e0, 'zflag': 'd', 'zbcval': 0.0e0}] nodes.append({'x': 3.0e0, 'y': 0.0e0, 'z': 0.0e0, 'xflag': 'f', 'xb...
n = int(input('Valor do produto: ')) val = (n*5) / 100 res = val print('O VALOR FINAL COM 5% DE DESCONTO VAI SER ${}:'.format(val))
quarter = (dta.inspection_date.dt.month - 1) // 3 quarter_size = dta.groupby((quarter, violation_num)).size() axes = quarter_size.unstack(level=0).plot.bar( figsize=(14, 8), )
# ########################1. 基本使用 ########################### ''' # ##### 基本写法 class SuperBase: def f3(self): print('f3') class Base(SuperBase): # 父类,基类 def f2(self): print('f2') class Foo(Base): # 子类,派生类 def f1(self): print('f1') obj = Foo() obj.f1() obj.f2() obj.f3() # 原...
# pin numbers # http://micropython-on-wemos-d1-mini.readthedocs.io/en/latest/setup.html # https://forum.micropython.org/viewtopic.php?t=2503 D0 = 16 # wake D5 = 14 # sck D6 = 12 # miso D7 = 13 # mosi D8 = 15 # cs PULL-DOWN 10k D4 = 2 # boot PULL-UP 10k D3 = 0 # flash PULL-UP 10k D2 = 4 # sda D1 = 5 # scl RX...
CENTRALIZED = False EXAMPLE_PAIR = "ZRX-WETH" USE_ETHEREUM_WALLET = True FEE_TYPE = "FlatFee" FEE_TOKEN = "ETH" DEFAULT_FEES = [0, 0.00001]
''' 154. Find Minimum in Rotated Sorted Array II https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/ similar problem: "153. Find Minimum in Rotated Sorted Array" https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/ Suppose an array sorted in ascending order is rotated at some pivot u...
# coding: utf8 """ 题目链接: https://leetcode.com/problems/count-complete-tree-nodes/description. 题目描述: Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia: In a complete binary tree every level, except possibly the last, is completely filled,...
def self_powers(final:int): sum_pows = 0 for integer in range(1, final + 1): power = 1 for _ in range(integer): power = (power * integer) % (10**11) sum_pows += power return sum_pows % (10 ** 10) if __name__ == "__main__": print(self_powers(1000))
SP500 = {'A.O. Smith Corp': 'AOS', 'Abbott Laboratories': 'ABT', 'AbbVie Inc.': 'ABBV', 'Accenture plc': 'ACN', 'Activision Blizzard': 'ATVI', 'Acuity Brands Inc': 'AYI', 'Adobe Systems Inc': 'ADBE', 'Advance Auto Parts': 'AAP', 'Advanced Micro Dev...
a= int(input()) if (a%4 == 0) and (a%100 != 0): print(1) elif a%400 ==0: print(1) else: print(0)
# encoding: utf-8 # module cv2.optflow # from /home/davtoh/anaconda3/envs/rrtools/lib/python3.5/site-packages/cv2.cpython-35m-x86_64-linux-gnu.so # by generator 1.144 # no doc # no imports # Variables with simple values DISOpticalFlow_PRESET_FAST = 1 DISOpticalFlow_PRESET_MEDIUM = 2 DISOpticalFlow_PRESET_ULTRAFAST = ...
c = 0 while(True): c+=1 inp = input() if(inp == '0'): break n = int(inp) inp = input().split(' ') su = 0 for j in range(0,len(inp)): su += int(inp[j]) av = int(su / len(inp)) count = 0 for j in range(0,len(inp)): count += abs(av - int(inp[j])) print('Set #' + str(c)) print('The minimum...
# cook your dish here def highestPowerOf2(n): return (n & (~(n - 1))) for t in range(int(input())): ts=int(input()) sum=0 if ts%2==1: print((ts-1)//2) else: x=highestPowerOf2(ts) print(ts//((x*2)))
"""Functions to help edit essay homework using string manipulation.""" def capitalize_title(title): """Convert the first letter of each word in the title to uppercase if needed. :param title: str - title string that needs title casing. :return: str - title string in title case (first letters capitalized)...
'''rig pipeline prototype by Ben Barker, copyright (c) 2015 ben.barker@gmail.com for license info see license.txt '''
def main(): # Manage input file input = open(r"C:\Users\lawht\Desktop\Github\ROSALIND\Bioinformatics Stronghold\(2) Transcribing DNA into RNA\(2) Transcribing DNA into RNA\rosalind_rna.txt","r"); DNA_string = input.readline(); # take first line of input file for counting # Take in input file of DNA st...
class Solution: def minDifference(self, nums: List[int]) -> int: # pick three values if len(nums) <= 4: return 0 nums.sort() ans = nums[-1] - nums[0] for i in range(4): ans = min(nums[-1 - (3 - i)] - nums[i], ans) return ans
'''https://practice.geeksforgeeks.org/problems/bottom-view-of-binary-tree/1 https://www.geeksforgeeks.org/bottom-view-binary-tree/ Bottom View of Binary Tree Medium Accuracy: 45.32% Submissions: 90429 Points: 4 Given a binary tree, print the bottom view from left to right. A node is included in bottom view if it can b...
print('\033[1;93m-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\033[m') print('\033[1;31m DADOS EM UMA TUPLA\033[m') print('\033[1;93m-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\033[m') num = (int(input('Digite um número: ')), int(input('Digite outro número: ')), int(input('Digite mais um número: ')), int(input('Digite o último númer...
class dotControlObject_t(object): # no doc aName = None Color = None Extension = None IsMagnetic = None ModelObject = None Plane = None
""" For a given positive integer n determine if it can be represented as a sum of two Fibonacci numbers (possibly equal). Example For n = 1, the output should be fibonacciSimpleSum2(n) = true. Explanation: 1 = 0 + 1 = F0 + F1. For n = 11, the output should be fibonacciSimpleSum2(n) = true. Explanation: 11 = 3 + ...
#Ask User for his role and save it in a variable role = input ("Are you an administrator, teacher, or student?: ") #If role "administrator or teacher" print they have keys if role == "administrator" or role == "teacher": print ("Administrators and teachers get keys!") #If role "Student" print they dont get ke...
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( k , s1 , s2 ) : n = len ( s1 ) m = len ( s2 ) lcs = [ [ 0 for x in range ( m + 1 ) ] for y in range ( n...
name = 'Zed A. Shaw' age = 35 height = 74 weight = 180 # lbs eyes = 'Blue' teeth = 'White' hair = 'Brown' print(f"Let's talk about {name}.") print(f"He's {height} inches tall.") print(f"He's {weight} pounds heavy.") print("Actually it's not too heavy") print(f"He's got {eyes} eyes and {hair} hair.") print(f"His teeth ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 17 16:17:25 2017 @author: jorgemauricio - Escribe un programa que calcule el valor neto de una cuenta de banco basado en las transacciones que se ingresan en la consola de comandos. Ej: D 200 D 250 P 300 D 100 P 200 Donde: D = Deposito P...
def get_data(path): try: file_handler = open(path, "r") except: return 0 data = [] for line in file_handler: values = line.strip().split(" ") data.append([int(values[1]), int(values[2]), int(values[3])]) return data def sensortxt_parser(path): order = ['lu', 'ru', 'lu', 'ru'] order2 = ['ld', 'rd', ...
# -*- coding: utf-8 -*- # Copyright (C) 2018 by # Marta Grobelna <marta.grobelna@rwth-aachen.de> # Petre Petrov <petrepp4@gmail.com> # Rudi Floren <rudi.floren@gmail.com> # Tobias Winkler <tobias.winkler1@rwth-aachen.de> # All rights reserved. # BSD license. # # Authors: Marta Grobelna <marta.grob...
r""" ************************* Text rendering With LaTeX ************************* Matplotlib can use LaTeX to render text. This is activated by setting ``text.usetex : True`` in your rcParams, or by setting the ``usetex`` property to True on individual `.Text` objects. Text handling through LaTeX is slower than Mat...
# first line: 1 @mem.cache def get_data(filename): data=load_svmlight_file(filename) return data[0],data[1]
# 示例 1 # width = input("请输入长方形的宽:") # height = input("请输入长方形的高:") # area = int(width) * int(height) # print("长方形的面积为:", area) # 示例 2 # weight = input("请输入当前的体重:") # # if float(weight) >= 200: # print("你和加菲猫一样肥!!") # else: # print("你还是很苗条的么!!") # 示例 3 # weight = input("请输入您当前的体重:") # # i...
""" Defines an Indexer Object with different methods to index data, look up, add, remove etc Extremely useful across all NLP tasks Author: Greg Durrett Contact: gdurrett@cs.utexas.edu """ class Indexer(object): """ Bijection between objects and integers starting at 0. Useful for mapping labels, features, ...
tour_es = 'Madrid', 'Paris', 'Lóndres', 'Berlín', 'Alpes austríacos', 'Dublín', 'Atenas', 'Ámsterdam', 'Moscú', \ 'Zurich', 'Roma', 'Lisboa', 'Nueva York', 'Los Angeles', 'Ciudad de México', 'Acapulco', 'Ciudad de Panama', \ 'Gran Caiman', 'Kingston', 'Dubai', 'Tel Aviv', 'Jerusalen', 'Bangkoko', 'T...
# # Copyright 2017, Data61 # Commonwealth Scientific and Industrial Research Organisation (CSIRO) # ABN 41 687 119 230. # # This software may be distributed and modified according to the terms of # the BSD 2-Clause license. Note that NO WARRANTY is provided. # See "LICENSE_BSD2.txt" for details. # # @TAG(DATA61_BSD) # ...
def find_num_1(response_list): responses = [] for r in response_list: responses.extend([i for i in r]) responses = list(set(responses)) return len(responses) def find_num_2(response_list): if len(response_list) == 0: return 0 responses = set(response_list[0]) if len(respons...
LOWER_PRIORITY = 100 LOW_PRIORITY = 75 DEFAULT_PRIORITY = 50 HIGH_PRIORITY = 25 HIGHEST_PRIORITY = 0
class Config(object): data = './' activation='Relu'#Swish,Relu,Mish,Selu init = "kaiming"#kaiming save = './checkpoints'#save best model dir arch = 'resnet' depth = 50 #resnet-50 gpu_id = '0,1' #gpu id train_data = '/home/daixiangzi/dataset/cifar-10/files/...
# Make an xor function # Truth table # | left | right | Result | # |-------|-------|--------| # | True | True | False | # | True | False | True | # | False | True | True | # | False | False | False | # def xor(left, right): # return left != right xor = lambda left, right: left != right print(xor(True, Tr...
class Users: ''' Class that generates new instances of users ''' users_list = [] def save_users(self): ''' This method will save all users to the user list ''' Users.users_list.append(self) def __init__ (self,user_name,first_name,last_name,birth_mont...
PREDEFINED_TORQUE_INPUTS = [ "$torque.environment.id", "$torque.environment.virtual_network_id", "$torque.environment.public_address", "$torque.repos.current.current", "$torque.repos.current.url", "$torque.repos.current.token" ]
def iterate(days): with open("inputs/day6.txt") as f: input = [int(x) for x in f.readline().strip().split(",")] fish = {} for f in input: fish[f] = fish.get(f, 0) + 1 for day in range(1, days+1): new_fish = {} for x in fish: if x =...
rows, cols = [int(x) for x in input().split()] line = input() index = 0 matrix = [] for row in range(rows): matrix.append([None]*cols) for col in range(cols): if row % 2 == 0: matrix[row][col] = line[index] else: matrix[row][cols - 1 - col] = line[index] index = ...
v1 = float(input('Qual a velocidade do carro (km/h)? ')) m = (v1 - 80)*7 if v1 > 80: print(f'Sua velocidade foi de {v1}km/h e está acima do limte de velocidade que é de 80km\h. \nVocê foi multado em R${m:.2f}.') else: print('Tenha um bom dia! Dirija com segurança!')
# -*- coding: utf-8 -*- """ Created on Wed Jul 21 08:25:14 2021 @author: ASUS """
class SplendaException(Exception): def __init__(self, method_name, fake_class, spec_class): self.fake_class = fake_class self.spec_class = spec_class self.method_name = method_name def __str__(self): spec_name = self.spec_class.__name__ fake_name = self.fake_class.__name...
def ficha(nome='<desconhecido>', gols=0): return f'O jogador {nome} fez {gols} gol(s) no campeonato.' # main n = str(input('Nome do Jogador: ')).capitalize() g = str(input('Número de gols: ')) if g.isnumeric(): g = int(g) else: g = 0 if n.strip() == '': print(ficha(gols=g)) else: print(ficha(n, g)...
def count_circle_lattice_points(cx: int, cy: int, r: int, k: int) -> int: """ count up integer point (x, y) in the circle or on it. centered at (cx, cy) with radius r. and both x and y are multiple of k. """ assert r >= 0 and k >= 0 cx %= k cy %= k def is_ok(dx: int, dy: int) -> bo...
# TODO class ICM20948_SETTINGS(object): """ ICM20948 Settings class : param blabla: asfdasg : return: ICM20938 Settings object : rtype: Object """ def __init__(self): pass def parse_config_file(self, filepath): pass # Gyro fu...
# Time: O(n) # Space: O(1) # 856 # Given a balanced parentheses string S, # compute the score of the string based on the following rule: # # () has score 1 # AB has score A + B, where A and B are balanced parentheses strings. # (A) has score 2 * A, where A is a balanced parentheses string. # # Example 1: # # Input: "...
######################### # Custom Error Classes ######################### class LexerClass: def __init__(self,lexicon,ukToken): ''' Steps through rule strings searching for high-level rule string components. Searches for the following high-level tokens in order: ...
class DataTypeGenerator: """DataType生成器""" def __init__(self, filename: str, prefix: str): """Constructor""" self.filename: str = filename self.prefix: str = prefix self.count: int = 0 self.in_enum: bool = False self.enum_value: int = 0 def run(self): ...
#!/usr/bin/env python3 # Write a program that prints the reverse-complement of a DNA sequence # You must use a loop and conditional dna = 'ACTGAAAAAAAAAAA' r = dna[::-1] for i in range(len(r)): a = r[i] if a == 'A': print('T', end='') elif a == 'C': print('G', end='') elif a == 'T': print('A', end='') elif a =...
def chooseformat(): print("1.) fnamelname") print("2.) fname.lname") print("3.) fname_lname") print("4.) finitlname") print("5.) finit.lname") print("6.) finit_lname") print("7.) fname") input("Choose a format to begin with: ")
info = { "UNIT_NUMBERS": { "nul": 0, "nulste": 0, "een": 1, "eerste": 1, "twee": 2, "tweede": 2, "derde": 3, "drie": 3, "vier": 4, "vijf": 5, "zes": 6, "zeven": 7, "acht": 8, "negen": 9 }, "DIRECT...
class Director(object): def __init__(self, builder): self._builder = builder def build_computer(self): self._builder.new_computer() self._builder.get_case() self._builder.build_mainboard() self._builder.install_mainboard() self._builder.install_hard_dr...
#4. Программа принимает действительное положительное число x и целое отрицательное число y. Необходимо выполнить возведение числа x в степень y. # Задание необходимо реализовать в виде функции my_func(x, y). При решении задания необходимо обойтись без встроенной функции возведения числа в степень. # Подсказка: п...
#openfi #escape char in the olxlo produced file will need substitute at later date #for runtime on the second loop of instantiation self.populate dxpone = { "name":"dxpone", "refapione":"dxponeapione --- Hi and welcome to the text case scenario that will be used to insert \ towards a discord or something simil...
a=2 if a<0: print("the number is negative") if a>0: print("the numner is positive")
class Item(): def __init__(self, name, description): # name and description self.name = name self.description = description def __str__(self): # print item's name and description return f"{self.name}: {self.description}"
#####1. Write e Python program to create e set. # e=set() # print(type(e)) #################################################### ####2. Write e Python program to iteration over sets. # e={'e','b','c','t'} # for i in e: # print(i) #################################################### ###3. Write e Python program t...
# DFS class Solution(object): def isSymmetric(self, root): """ :type root: TreeNode :rtype: bool """ return self.check(root.left, root.right) def check(self, Node1, Node2): if Node1 == None and Node2 == None: return True if Node1 == None or N...