content
stringlengths
7
1.05M
class SignalGenerator: """ Signal generator class It creates different signals depending on the events it's given. Examplee of an events list: [ { "start": { "value": 10 } }, { "step": { "cycle": 100, ...
############################################################################### # Copyright (c) 2017-2020 Koren Lev (Cisco Systems), # # Yaron Yogev (Cisco Systems), Ilia Abashin (Cisco Systems) and others # # # ...
@fields({"dollars": Int, "cents": Int}) class Cash: dollars = 0 cents = 0 def add_dollars(self, dollars): self.dollars += dollars def get_cash()->Cash: c = Cash() c.add_dollars(3.14159) return c get_cash()
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def reverseList(self, head): """ :type head: ListNode :rtype: ListNode """ node_list = [] if head == ...
@client.command() async def button(ctx): await ctx.channel.send( "Rol Almak İçin Butonlara Tıkla!", components = [ Button(style=ButtonStyle.blue, label="Rol Al") ] ) res = await client.wait_for("button_click") if res.channel == ctx.channel: role = discord.u...
""" Problem 40 ========== An irrational decimal fraction is created by concatenating the positive integers: 0.123456789101112131415161718192021... It can be seen that the 12th digit of the fractional part is 1. If dn represents the nth digit of the fractional part, find the value of the following expression. d1 × ...
""" Given a string, find the longest palindromic contiguous substring. If there are more than one with the maximum length, return any one. For example, the longest palindromic substring of "aabcdcb" is "bcdcb". The longest palindromic substring of "bananas" is "anana". """ def longest_palindromic_substring(t...
def retorno(): res=input('Deseja executar o programa novamente?[s/n] ') if(res=='s' or res=='S'): verificar() else: print('Processo finalizado!') pass def cabecalho(texto): print('-'*40) print(' '*10+texto+' '*15) print('-'*40) pass def ve...
n = int(input()) k = int(input()) x = int(input()) y = int(input()) if n > k: print(x * k + (n - k) * y) else: print(x * n)
class BrawlerNotFound(Exception): """Exception raised when a Brawler can't be found from given partial name. """
class Player(object): def __init__(self, player_id, region_id): self.player_id = player_id self.region_id = region_id self.inventory = [] def tick(self): for item in inventory: item.tick()
motorcycles = ['honda', 'yamaha', 'suzuki'] print(motorcycles) motorcycles[0] = 'ducati' print(motorcycles)
def headers(token): return { 'Authorization': f'Bearer {token}', 'content-type': 'application/json'} flight_data = { "name": "American airline"} user_data = { 'email': 'myadminss@example.com', 'username': 'myadminss', 'is_staff': True, "password":"education", }
""" sphinxcontrib.autohttp ~~~~~~~~~~~~~~~~~~~~~~ The sphinx.ext.autodoc-style HTTP API reference builder for sphinxcontrib.httpdomain. :copyright: Copyright 2011 by Hong Minhee :license: BSD, see LICENSE for details. """
# It's a BST! class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def lowestCommonAncestor(self, root, p, q): s, b = sorted([p.val, q.val]) while not s <= root.val <= b: root = root.left if s <= root.val el...
print('{} DESAFIO 47 {}\n'.format('='*10, '='*10)) print('Abaixo estão todos os números pares de 1 à 50: ') for c in range(1, 51): if(c % 2 == 0): print('{}'.format(c), end=' ')
''' This problem was asked by Google. Given k sorted singly linked lists, write a function to merge all the lists into one sorted singly linked list. It has already been solved in: https://github.com/loghmanb/daily-coding-problem/blob/master/google_merge_k_sorted_list.py '''
# Your task is to add up letters to one letter. # The function will be given a variable amount of arguments, each one being a letter to add. # https://www.codewars.com/kata/5d50e3914861a500121e1958 # https://www.codewars.com/kata/5d50e3914861a500121e1958/solutions/python def add_letters(*letters): char_num = 0 ...
class City: def __init__(self, name): self.name = name self.routes = {} def add_route(self, city, price_info): self.routes[city] = price_info atlanta = City("Atlanta") boston = City("Boston") chicago = City("Chicago") denver = City("Denver") el_paso = City("El Paso") atlanta.add_rout...
def replacePi(s): if(len(s) <= 2): return s if(s[0] == "p" and s[1] == "i"): print("3.14",end='') replacePi(s[2:]) else : print(s[0],end="") replacePi(s[1:]) s = input() replacePi(s)
msg = 'Olá, Mundo!' print(msg) print('Hello World!') print('Felipe Schmaedecke')
def format_sentence(sent): sent_text = sent["sent_text"] sent_start, _ = sent["sent_span"] fmt_text = str(sent_text) for mention_text, mention_start, mention_end in sorted(sent["mentions"], key=lambda x: x[1], reverse=True): mention_start, mention_end = mention_start - sent_start, mention_end - ...
# assign table and gis_input file required column names mid_col = 'model_id' gid_col = 'gauge_id' asgn_mid_col = 'assigned_model_id' asgn_gid_col = 'assigned_gauge_id' down_mid_col = 'downstream_model_id' reason_col = 'reason' area_col = 'drain_area' order_col = 'stream_order' # name of some of the files produced by t...
__all__ = ["aobject"] class aobject(object): """ Base class for objects with an async ``__init__`` method. Creating an instance of ``aobject`` requires awaiting, e.g. ``await aobject()``. """ async def __new__(cls, *a, **kw): instance = super().__new__(cls) await instance.__init__...
# # PySNMP MIB module SNMPv2-TC-v1 (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNMPv2-TC-v1 # Produced by pysmi-0.3.4 at Wed May 1 11:31:22 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
"""Constants used by pysysbot.""" VERSION = '0.3.0' AUTHOR_EMAIL = "Fabian Affolter <fabian@affolter-engineering.ch>"
n = int(input()) people = [] for i in range(n): a, b = input().split() people.append((int(a), b, i)) people.sort(key=lambda x:(x[0], x[2])) for p in people: print(p[0], p[1])
#https://leetcode.com/problems/last-substring-in-lexicographical-order/discuss/369191/JavaScript-with-Explanation-no-substring-comparison-fast-O(n)-time-O(1)-space.-(Credit-to-nate17) def lastSubstring(input): start = end = 0 skip = 1 while (skip+end) < len(input): if input[start+end] == inpu...
# ============================================================================= # Python examples - if else # ============================================================================= seq = [1,2,3] if len(seq) == 0: print("sequence is empty") elif len(seq) == 1: print("sequence contains one element") else...
class StatcordException(Exception): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) class RequestFailure(StatcordException): def __init__(self, status: int, response: str): super().__init__("{}: {}".format(status, response))
def get_paths(root, format='jpg', paths_count=None): path_i = 0 paths = [] for path in root.glob(f'**/*.{format}'): if path_i == paths_count: break paths.append(path) path_i += 1 return paths def get_train_val_paths(root, format='jpg', val_size=0.2, paths_count=...
def a64l(s): """ An implementation of a64l as from the c stdlib. Convert between a radix-64 ASCII string and a 32-bit integer. '.' (dot) for 0, '/' for 1, '0' through '9' for [2,11], 'A' through 'Z' for [12,37], and 'a' through 'z' for [38,63]. TODO: do some implementations use '' inst...
# 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 flatten(self, root: TreeNode) -> None: """ Do not return anything, modify root in-place instead. ...
example_dict = { 65: "integer", "1": "fake integer", 3.14: "float", "3.14": "fake float", 0.345: "float 2", ".345": "fake float 2", 123.0: "float 3", "123.": " fake float 3", "false_": False, "true_": True, False: False, True: True, -3.0: "float negative", "-3.1":...
# Things like files are called resources. They are gicen by the operating system and # have to be disposed of after being done with. # We have to close files for instance fd = open("with.py", "r") print(fd.readline()) fd.close() # In order to do this a bit more automatic you can use with with open("with.py", "r") a...
_base_ = [ '../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_180k.py', '../_base_/default_runtime.py' ] evaluation = dict(interval=20000, metric='bbox') checkpoint_config = dict(by_epoch=False, interval=20000) work_dir = 'work_dirs/coco/faster_...
class Interactions: current_os = -1 logger = None def __init__(self, current_os, logger, comfun): self.current_os = current_os self.logger = logger self.comfun = comfun def print_info(self): self.logger.raw("This is interaction with 3dsmax") # common interactions ...
string1 = "he's " string2 = "probably " string3 = "going to " string4 = "get fired " string5 = "today " print(string1 + string2 + string3 + string4 + string5) print("he's " "probably " "going to " "get fired " "today") print (string1 * 5) print ("he's " * 5) print ("hello " * 5 + "4") print("hello " * (5 + 4)) ...
def subarraySort(array): min_ascending_anomaly_number = float('inf') max_descending_anomaly_number = float('-inf') i, j = 1, len(array) - 2 while i < len(array) and j > - 1: if array[i] < array[i - 1]: min_ascending_anomaly_number = min(array[i], min_ascending_anomaly_number) ...
# python3 def last_digit_of_the_sum_of_fibonacci_numbers_naive(n): assert 0 <= n <= 10 ** 18 if n <= 1: return n fibonacci_numbers = [0] * (n + 1) fibonacci_numbers[0] = 0 fibonacci_numbers[1] = 1 for i in range(2, n + 1): fibonacci_numbers[i] = fibonacci_numbers[i - 2] + fib...
# File: Bridge.py # Description: Assignment 09 | Bridge # Student Name: Matthew Maxwell # Student UT EID: mrm5632 # Course Name: CS 313E # Unique Number: 50205 # Date Created: 09-30-2019 # Date Last Modified: 10-01-2019 # read file in, return data set of test cases def readFile(): myFile = open("...
# TYPE OF OPERATORS IN PYTHON # Arithmetic # Assignment # Comparison # Logical # Membership # Identity # Bitwise # Arithmetic operators: Used to perform arithmetic operations between variables # +, -, *, /, %, **, // x = 10 y = 20 # Arithmetic Operators print('Arithmetic Operators') print(x+y) print(x-y) print(x*y) pr...
# You are given a two-digit integer n. Return the sum of its digits. # Example # For n = 29, the output should be # addTwoDigits(n) = 11. def addTwoDigits(n): sum1 = 0 for i in str(n): sum1 += int(i) return sum1 print(addTwoDigits(29))
# 숫자의 표현 def solution(n): answer = 0 for i in range(1, n+1): if n%i==0 and i%2==1: answer+=1 return answer ''' 정확성 테스트 테스트 1 〉 통과 (0.00ms, 10.2MB) 테스트 2 〉 통과 (0.05ms, 10MB) 테스트 3 〉 통과 (0.04ms, 10.2MB) 테스트 4 〉 통과 (0.04ms, 10.1MB) 테스트 5 〉 통과 (0.02ms, 10.2MB) 테스트 6 〉 통과 (0.01ms, 10.2MB) 테...
# $Id: md1.py,v 1.8 2020/04/22 21:39:41 baaden Exp baaden $ # Script (c) 2020 by Marc Baaden, <baaden@smplinux.de> # # UnityMol python script to visualize the Covid-19 spike protein # activate specific commands to simplify interactive raytracing of the scene doRT = False; absolutePath = "C:/Users/ME/fair_covid_molvis...
def a(x): if x == 1: print("x is 1") else: print("x is not 1")
class Solution(object): def guessNumber(self, n: int) -> int: """ # The guess API is already defined. # @param num, your guess # @return -1 if my number is lower, 1 if my number is higher, otherwise return 0 # def guess(num: int) -> int: """ low = 1 hi...
def mergeSort(lst, start, end): if start < end: mid = start + (end - start) // 2 mergeSort(lst, start, mid) mergeSort(lst, mid + 1, end) merge(lst, start, end, mid) def merge(lst, start, end, mid): temp = lst[start: end + 1] left = 0 right = mid + 1 - start index = ...
class Person: pass class Male(Person): def getGender(self): return 'Male' class Female(Person): def getGender(self): return 'Female' print(Male().getGender()) print(Female().getGender())
""" Copied from: https://github.com/jerrymarino/xcbuildkit/blob/master/BazelExtensions/version.bzl """ def _info_impl(ctx): ctx.file("BUILD", content = "exports_files([\"ref\"])") ctx.file("WORKSPACE", content = "") if ctx.attr.value: ctx.file("ref", content = str(ctx.attr.value)) else: ...
# input = ["a", "a", "b", "b", "c", "c", "c"] # o/p = a2b2c3 # O(n) time complexity string_chr = ["a", "a", "b", "b", "c", "c", "c"] def stringCompression(string_chr): newString = '' count = 1 for i in range(len(string_chr)-1): print(i) print(string_chr[i]) if string_chr[i] == str...
def compare_schema_resources(available_resources, schema_resources, version): _available = set(_r.name for _r in available_resources if _r.is_available(version)) _schema = set(schema_resources) unexpected = list(_available.difference(_schema)) missing = list(_schema.difference(_available)) match = ...
#paste your api_hash and api_id from my.telegram.org api_hash = " b59675804753a20366ac24e38dd3ea35" api_id = "1347448" entity = "tgcloud"
''' A Python program to check whether a specifi ed value iscontained in a group of values. ''' def isVowel (inputStr): vowelTuple = ('1', '5', '8', '3', '9') for vowel in vowelTuple: if inputStr == vowel: return True return False def main (): myStr = input ("E...
def reverse_string(string): """Reverses string and returns it. Parameters ---------- string Returns ------- """ # define base case to_list = list(string) if len(to_list) < 2: return to_list # set start and stop indexes. start = 0 stop = len(to_list) - 1 ...
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
n = int(input('n: ')) soma = 0 cont = 0 while cont < n: numeros = int(input('numero: ')) soma += numeros cont += 1 media = soma / n print('soma e igual: {}, e a media: {:.2f}'.format(soma, media))
''' MIT License Copyright (c) 2019 lewis he Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, pub...
def format_interval(t): mins, s = divmod(int(t), 60) h, m = divmod(mins, 60) if h: return '{0:d}:{1:02d}:{2:02d}'.format(h, m, s) else: return '{0:02d}:{1:02d}'.format(m, s) def decode_format_dict(fm): elapsed_str = format_interval(fm['elapsed']) remaining = (fm['total'] - fm['n']) /...
# Initialize search space # Initialize model while not objective_reached and not bugdget_exhausted: # Obtain new hyperparameters suggestion = GetSuggestions() # Run trial with new hyperparameters; collect metrics metrics = RunTrial(suggestion) # Report metrics Report(metrics)
class Solution(object): def findMissingRanges(self, nums, lower, upper): """ :type nums: List[int] :type lower: int :type upper: int :rtype: List[str] """ res = [] nums = [lower - 1] + nums + [upper + 1] nums = nums[::-1] while nums: ...
# Settings DEBUG = True # Setting TESTING to True disables @login_required checks TESTING = False CACHE_TYPE = 'simple' ## SQLite Connection SQLALCHEMY_DATABASE_URI = 'sqlite:///db.sqlite' # Local PostgreSQL Connection # SQLALCHEMY_DATABASE_URI = 'postgresql://puser:Password1@localhost/devdb' SECRET_KEY = 'a9eec0e0...
# OGC GeoTIFF specURL = "http://docs.opengeospatial.org/is/19-008r4/19-008r4.html" fout = open("../mappings/19-008r4.csv","w") # output file fin = open("../specifications/19-008r4.txt","r") # input file elementList = [] # processing the input file for line in fin: tokens = line.split() for token in tokens: ...
class Solution(object): def isValid(self, s): """ :type s: str :rtype: bool """ # The stack to keep track of opening brackets. stack = [] open_par = set(["(", "[", "{"]) # Hash map for keeping track of mappings. This keeps the code very clean. ...
STUDENT_CODE_DEFAULT = 'analysis.py,qlearningAgents.py,valueIterationAgents.py' PROJECT_TEST_CLASSES = 'reinforcementTestClasses.py' PROJECT_NAME = 'Project 3: Reinforcement learning' BONUS_PIC = False
def findLongestWord(s, d): def isSubsequence(x): iterator_of_s = iter(s)#all chars of s return all(c in iterator_of_s for c in x) return max(sorted(filter(isSubsequence, d)) + [''], key=len) if __name__ == "__main__": s = "abpcplea" d = ["ale","apple","monkey","plea"] print(findLon...
class Config: ''' General configuration parent class ''' pass class ProdConfig(Config): ''' Production configuration child class Args: config:The parent configuration class with general configuration settings ''' pass class DevConfig(Config): ''' Devel...
dados = list() pessoa = list() media = list() while True: dados.append(input('Digite seu nome: ')) dados.append(input('Digite a 1° nota: ')) dados.append(input('Digite a 2° nota: ')) pessoa.append(dados[:]) dados.clear() c = input('Deseja continuar: ').upper() if c in 'NAO NOP NA NAH NAUM NO...
## Just to use the same value of a variable in more than just one file; ## That way, will only need to change value here SIZE = 600 # Size of game board, in pixels ROWS = 20 # How many rows the playable game will have DELAY = 50 # Delay time for the game execution, in milliseconds TICK = 10 # Essentially, it's how man...
def sanitize(string): newString = "" flag = False for letter in string: if letter == '@': flag = True elif letter == ' ': flag = False if flag: continue else: ...
# -*- coding: utf-8 -*- """ **Gen_Pnf_With__int__.py** - Copyright (c) 2019, KNC Solutions Private Limited. - License: 'Apache License, Version 2.0'. - version: 1.0.0 """
class Solution: def countElements(self, arr: List[int]) -> int: table = set(arr) return sum(x + 1 in table for x in arr)
'''Faça um programa que leia um número qualquer e mostre o seu fatorial. Ex: 5! = 5x4x3x2x1=120''' escolha=int(input('Digite um número: ')) fatorial=escolha fat=1 while fatorial!=1: fat=fat*fatorial fatorial-=1 print('{}!={}'.format(escolha,fat))
#!/usr/bin/python3 ''' Geralmente é o código que chama a funcao, e nao a funcao em si, que sabe como tratar uma execao. Portanto, normalmente você verá uma instruo raise em uma função e as instruções try e excepton no código que chama a funcao. Exemplo ''' def boxPrint(symbol, width, height): # Funcao que imprim...
# 토너먼트 카드 게임 test_cases = int(input().strip()) def rock_scissor_paper(cards, s1, s2): card1 = cards[s1] card2 = cards[s2] if card1 == card2: return s1 if card1 == 1: if card2 == 2: return s2 else: return s1 elif card1 == 2: if card2 == 1: ...
if __name__ == "__main__": # Initialization haystack = "Hello, Budgie!" print(haystack) # Concatenation joined = "It is -> " + haystack + " <- It was" print(joined) # Characters text = "abc" first = text[0] print("{0}'s first character is {1}.".format(text, first)) # Searc...
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution(object): def levelOrder(self, root): """ :type root: TreeNode :rtype: List[Li...
# # PySNMP MIB module CTRON-SFPS-SIZE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-SFPS-SIZE-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:31:11 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
s = 'abc12321cba' print(s.replace('a', '')) s = 'abc12321cba' print(s.translate({ord('a'): None})) print(s.translate({ord(i): None for i in 'abc'})) # removing spaces from a string s = ' 1 2 3 4 ' print(s.replace(' ', '')) print(s.translate({ord(i): None for i in ' '})) # remove substring from string s = 'ab12abc...
# author: WatchDogOblivion # description: TODO # WatchDogs List Utility class ListUtility(object): @staticmethod def group(lst, groupSize): #type: (list, int) -> list finalList = [] groupSizeList = range(0, len(lst), groupSize) for groupSizeIndex in groupSizeList: finalList.append(lst[group...
# Union of list a = ["apple","Orange"] b = ["Banana","Chocolate"] c = list(set().union(a,b)) print(c)
# -*- coding: utf-8 -*- """ TcEx Error Codes """ class TcExErrorCodes(object): """TcEx Framework Error Codes.""" @property def errors(self): """TcEx defined error codes and messages. .. note:: RuntimeErrors with a code of >= 1000 are considered critical. Those < 1000 are cons...
def part1(code): i = 0; while i < 7 * 365: i = i << 2 | 0b10; return i - 7 * 365 def part2(code): ... def parse(line): xs = line.strip().split() if len(xs) < 3: xs.append("") for i in (1, 2): try: xs[i] = int(xs[i]) except ValueError: ...
def generateWholeBodyMotion(cs, cfg, fullBody=None, viewer=None): raise NotImplemented("TODO")
class Solution: def removeDuplicateLetters(self, s: str) -> str: last_occ = {} stack = [] visited = set() for i in range(len(s)): last_occ[s[i]] = i for i in range(len(s)): if s[i] not in visited: while (stack and stack[-1] > s[i] an...
[ {"created_at": "Thu Nov 30 21:16:44 +0000 2017", "favorite_count": 268, "hashtags": [], "id": 936343262088097795, "id_str": "936343262088097795", "lang": "en", "retweet_count": 82, "source": "<a href=\"http://bufferapp.com\" rel=\"nofollow\">Buffer</a>", "text": "Automation (not immigrants, @realDonaldTrump) could el...
# # PySNMP MIB module ENTERASYS-DIAGNOSTIC-MESSAGE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-DIAGNOSTIC-MESSAGE-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:48:52 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Pyt...
#Faça um programa que leia o peso de cinco pessoas. No final, mostre qual foi o maior e o menor peso lidos. print(f'{"="*30}') print(f'{"Analisador de peso":^30}') print(f'{"="*30}') pmaior = 0 pmenor = 0 n = int(input('Quer analisar o peso de quantas pessoas? ')) for c in range(0, n): p = float(input(f'Peso d...
x:str = "Hello" y:str = "World" z:str = "" z = x + y z = x[0] x = y = z
lines = open('input.txt', 'r').readlines() # part one grid = dict() for line in lines: # extract coord (x1, y1, x2, y2) = [int(coord) for coord_string in line.split(" -> ") for coord in coord_string.split(",")] # parallel to x-axis if x1 == x2: for y in range(min(y1,y2), max(y1,y2)+1): ...
query = input('Pick a number less than the magnitude of 10^8. Note- any multiple of 7 will give an unusual answer. Use a number that is not a multiple ' 'of 7 for the best results. ') print('\nYou have picked the number ' + str(query) + '. To demonstrate the cyclic nature of the number 142857, let\'s ' ...
# This program displays a person's # name and address print('Kate Austen') print('123 Full Circle Drive') print('Ashville, NC 28899')
# Desafio 007 - Desenvolva um programa que leia as duas notas de um aluno, calcule e mostr a sua média. nota1 = float(input('Digite a primeira nota: ')) nota2 = float(input('Digite a segunda nota: ')) media = (nota1 + nota2)/2 print('A média entre {:.1f} e {:.1f} foi {:.1f}'.format(nota1, nota2, media)) # alternativa...
# Inserting a new node in DLL at end # 7 step procedure #Node class class Node: def __init__(self, next = None, prev = None, data = None): self.next = next self.prev = prev self.data = data #DLL class class DoublyLinkedList: def __init__(self): self.head = None def append...
a = 0 a += 5 #Suma en asignacion a -= 10 #Resta en asignacion a *= 2 #Producto de asignacion a /= 2 #Division de asignacion a %= 2 #Modulo de asinacion a **= 10 numero_magico = 12345679 numero_usuario = int(input("Numero entre 1 y 9: ")) numero_usuario *= 9 numero_magico *= numero_usuario print (numero_magico)
'''Faca um Programa que leia um numero de 0 a 9999 e mostre na tela cada um dos gigitos separados Ex: 1834 4 Unidades , 3 Dezenas , 8 Centenas , 1 Milhar ''' numero = input('Digite um Numero de O a 9999: ') print('\033[31m {} \033[m,Unidades '.format(numero[3])) print('\033[32m {} \033[m,Dezenas '.format(numero[2]))...
# import pytest class TestNameSpace: def test___call__(self): # synced assert True def test___len__(self): # synced assert True def test___getitem__(self): # synced assert True def test___setitem__(self): # synced assert True def test___delitem__(self): # s...
"""Constants for the Govee BLE HCI monitor sensor integration.""" DOMAIN = "govee_ble" SCANNER = "scanner" EVENT_DEVICE_ADDED_TO_REGISTRY = f"{DOMAIN}_device_added_to_registry"
# Datos # planetas = { 'Mercurio': (57910000, 4880, 0.241, 58.6, 0.06), 'Venus': (108200000,12000, 0.72, 243, 0.82), 'Tierra': (149600000, 12756, 1, 1, 1), 'Marte': (227940000, 6794, 1.52, 1.03, 0.11), 'Júpiter': (778833000, 142984, 5.20, 0.414, 318), 'Saturno': (1429400000, 120536, 9.55, 0.426, 95), ...
""" 现实世界 虚拟世界 客观事物 -抽象化-> 类 -实例化-> 对象 奔驰汽车 汽车类 汽车对象 宝马汽车 品牌 奔驰 车牌号 京C... 颜色 白色 .... ... """ class Wife: """ 抽象的老婆类(概念) ...