content
stringlengths
7
1.05M
a = input("First no :") b = input("Second no:") c = int(a)+int(b) print ("sum is :",c)
# Desenvolva uma calculadora que possua um menu, tratamento de erro caso o usuario escolha uma operação invalida e utilize funções na mesma def calculadora(numero1, numero2, operacao): if operacao == '+': print(numero1 + numero2) elif operacao == '-': print(numero1 - numero2) elif operacao =...
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. class FileTypeEnum(object): """Implementation of the 'FileType' enum. Specifies the format type of the file that SQL database stores the data. Specifies the format type of the file that SQL database stores the data. 'kRows' refers to a data file ...
""" Ex065 Crie um programa que leia vários números inteiros pelo teclado. No final da execução, mostre a média entre todos os valores e qual foi o maior e o menor valores lidos. O programa deve perguntar ao usuário se ele quer ou não continuar a digitar valores. """ print('Digite quantos números inteiros quiser, e no f...
# Copyright: (c) 2018, Huawei Inc. # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) class ModuleDocFragment(object): # HCS doc fragment. DOCUMENTATION = ''' options: auth: description: - Dictionary containing auth information as needed by ...
def labels_to_string(label, vocabulary, blank_index=0): labels = [] for l in label: index_list = [index for index in l if index != blank_index] labels.append(''.join([vocabulary[index] for index in index_list])) return labels
# simple example of operathors overloading class Number: def __init__(self, start): """Define attr for Number Args: start (int): any number """ self.data = start def __sub__(self, other): """Overload sub operation for exemplars of Number Args:...
class LinkedNode(object): def __init__(self, val, _next=None): self._next = _next self.val = val @property def next(self): return self._next @next.setter def next(self, node): self._next = node
''' 1 - Crie uma funcao1 que recebe uma funcao2 como parâmetro e retorne o valor da funcao2 executada. ''' def ola_mundo(): return 'Hello world!' def mestre(funcao): return funcao() executando = mestre(ola_mundo) # Executando uma função dentro de outra print(executando) # Mesmo resultado print(ola_mundo()...
# Hladam medzeru # V zadanom texte najdite prvý výskyt medzery a tri znaky, ktoré za ňou následujú. # Sample Input: # Zajtra bude krásne počasie. # Sample Output: # 6 # bud string = input() medzera_index = string.find(' ') print(medzera_index) print(string[1+medzera_index:4+medzera_index]) # rozsah [od:do]
class Solution: def removeInterval(self, intervals: List[List[int]], toBeRemoved: List[int]) -> List[List[int]]: res = [] for a, b in intervals: if a < toBeRemoved[0]: res.append([a, min(toBeRemoved[0], b)]) if b > toBeRemoved[1]: res.append([m...
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
''' Blind Curated 75 - Problem 43 ============================= Number of Islands ----------------- Given a two-dimensional grid of `'1'`s (land) and `'0'`s (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all ...
def GuildConfig(guild, prefix): return { "id": f"{guild.id}", "prefix": "{}".format(prefix if prefix != "" or prefix != None else "!"), "mute_role": "", "mod_log": "", "message_log": "", "server_log": "", "ignored_channels": [], "ignored_roles"...
abspath = Path(Path.cwd(), FILENAME) if abspath.is_file(): result = 'file' elif abspath.is_dir(): result = 'directory' elif not abspath.exists(): result = 'missing'
"""Define constants commonly used throughout STACS CI. SPDX-License-Identifier: BSD-3-Clause """ PATTERN_GIT_DIFF_HEADER = r"^diff\s+.*?a/(.*?)\s+b/(.*)$" PATTERN_GIT_DIFF_HUNK = r"@@\s+-([0-9,]+)\s+\+([0-9,]+)\s+.*@@" PATH_SEPARATOR = "!" # Used to extract hashes of existing comments / bodies of text for deduplica...
a = int(input('\033[30mDigite um valor:\033[m ')) b = int(input('\033[30mDigite outro valor:\033[m ')) c = 0 while c != 5: print(''' \033[1;30m[ 1 ]\033[m \033[1;31mSOMAR\033[m \033[1;30m[ 2 ]\033[m \033[1;32mMULTIPLICAR\033[m \033[1;30m[ 3 ]\033[m \033[1;33mMAIOR\033[m \033[1;30m[ 4 ]\033[...
class Option(object): def __init__(self, option, otype): self.name = option self.type = otype @staticmethod def process_ports(data): ports = [] if data: for key, value in data.items(): port = key.split("/") port_str = "" ...
filename = input().strip() found_id = "" f = open(filename) for line in f: if line[:10] not in found_id: found_id += line[:10]+";" print(line[:10]) f.close()
# -*- coding: utf-8 -*- ######################################################################### ## Customize your APP title, subtitle and menus here ######################################################################### response.title = 'Example web scraping website' ## read more at http://dev.w3.org/html5/mark...
# Copyright (C) 2021 The Android Open Source Project # # 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...
# Вводится целое положительное число N. Выведите все числа по убыванию от N до 1 включительно через пробел. a = int(input()) for i in range(a, 0, -1): print(i, end=" ")
# SV configuration SV_FOV = '90' SV_SIZE = '640x640' SV_PITCH = '0' # Network configuration CITIES = {'NYC': 'New York City, New York, USA', 'SF': 'San Francisco, California, USA', 'Seattle': 'Seattle, Washington, USA', 'Boston': 'Boston, Massachusetts, USA', 'Chicago': 'Chicago...
""" 求矩阵像素的最大连通域,像素为1的pixel周围8*8的像素为1的pixel都是它的邻接点,连接性具有传递性,pixel a与 pixel b连通,b与c连通,则a与c连通,所以找到邻接点后再找邻接点的邻接点。 试找出一个二值矩阵的所有连通域(8邻接),并给出每个连通域的面积(邻接点的个数)和重心。 每组输入包括 M+1 行,第一行输入2个整数 M (1<M<100), N (1<N<100),其中M是矩阵的行数,N是矩阵的列数。 第2至M+1行,每行 N 个整数,表示在矩阵N列的像素值(已二值化为 0 和 1, 连通域为 1 表示的区域)。 输出 K+1 行,第一行输出连通域个数K,第2至 K+1 行,每行输出3个数,...
""" Module for reading and writing the SRT format. Attempts to deal with different encodings in a pass-through fashion: read and write as binary. """ def read_file_tuples(input_file): """ Read an SRT file to (seq, begin, end, text) tuples, where begin and end are float timestamps in seconds. Text is ac...
type_map = { 'CC' :'Coordinating conjunction', 'CD' :'Cardinal number', 'DT' :'Determiner', 'EX' :'Existential there', 'FW' :'Foreign word', 'IN' :'Preposition or subordinating conjunction', 'JJ' :'Adjective', 'JJR' :'Adjective, comparative', 'JJS' :'Adjective, superlative',...
''' 350. Intersection of Two Arrays II Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: Each element in the result should appear as many times as it shows in both arrays. The result can be in any order. Follow up: - What if t...
def check_name(x,y): print(x) print(y) xx = input('Word1') yy = input('Word2') check_name(xx,yy) def name_check(name): if name.lower() == 'josh': print('He da man') else: print('Who is that?!') zz = input('Word3') name_check(zz)
''' Road: The road 2d world coordinate system is a 2D euclidean coordinate system. The intended semantics are - the x axis is identified with (1,0) and considered to be pointing right - the y axis is identified with (0,1) and considered to be pointing up y ...
class Solution: def hIndex(self, citations: List[int]) -> int: size = len(citations) if len(citations) == 0 or citations == [0]: return 0 # citations.sort() for i in range(size): if citations[i] >= size - i: return size - i return 0
# The generators both work on the same principle. To create its next value, a generator will take the previous value it produced, multiply it by a factor (generator A uses 16807; generator B uses 48271), and then keep the remainder of dividing that resulting product by 2147483647. That final remainder is the value it p...
class Coords: def __init__(self, x, y): self.x = x self.y = y def __setattr__(self, attr, value): if isinstance(value, int): object.__setattr__(self, attr, value) else: raise ValueError("Coords should be ints")
START = 'START' RUNNING = 'RUNNING' WON = 'WON' LOST ='LOST' PAUSE ='PAUSE'
# ====================================================================== # # Brad T. Aagaard, U.S. Geological Survey # # ====================================================================== """Top-level cartopy-extra-tiles module. """ __all__ = [ "cached_tiler", "esri_tiles", "stamen_tiles", "scale_b...
class WorkflowJobRunningError(ValueError): """ Operation was prevented by a job running in the job queue """
model = "stages" eval_occlusion = True results_folder = "../../resources/results" dataset_folder = "../../resources/datasets/linemod_occlusion" mesh_folder = "../../resources/object_models" weights_file = "../../resources/weights/linemod_occlusion_stages/model.ckpt-0"
def avarage(numbers): if not numbers: return None return sum(numbers)/len(numbers) if __name__ == "__main__": numbers = [1, 2, 3, 4, 5] print(avarage(numbers))
class LinkedList: def __init__(self, head, tail): assert isinstance(tail, LinkedList) or isinstance(tail, Nil), TypeError( 'tail should either be a LinkedList or a Nil') self._head, self._tail = head, tail @property def head(self): return self._head @property d...
""" ID: tony_hu1 PROG: wormhole LANG: PYTHON3 """ def solve(x,y,next_on_right,N,partner): total = 0 for i in range(1,N+1): if partner[i] == 0: break if i == N: if (cycle_exists(next_on_right,N,partner)): return 1 else: return 0 for j in r...
# -*- coding: utf-8 -*- # Author: Aris Tritas # License: BSD 3-clause class FeedbackGraph: """ A feedback graph shares the result of a loss function between nodes (experts) according to dependence relations represented by the edges between nodes. At each timestep, results are propagated to the observa...
def getMyNumber(): for i in range(1,1001): #First Test: Does the number have 2 more digits? if(len(str(i))>2): #Second Test: Is it a prime? factors=0 for j in range(1,i+1): if(i%j==0): factors+=1 if(factors==2): ...
class Solution: def rotate(self, matrix: List[List[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ # O(M) time | O(1) space # M is the number of cells in the matrix. n = len(matrix) for i in range(n // 2): for j in r...
source = """ Properties Math.E Euler's constant and the base of natural logarithms; approximately 2.718. Math.LN2 Natural logarithm of 2; approximately 0.693. Math.LN10 Natural logarithm of 10; approximately 2.303. Math.LOG2E Base 2 logarithm of E; approximately 1.443. Math.LOG10E Base 10 logarithm...
favorite_fruit = "blueberry" counter = 0 for character in favorite_fruit: if character == "b": counter = counter + 1 print(counter) #2 def letter_check(word, letter): for character in word: if character == letter: return True return False
# -*- coding: utf-8 -*- ''' File name: code\twentytwo_foolish_primes\sol_239.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #239 :: Twenty-two Foolish Primes # # For more information see: # https://projecteuler.net/problem=239 # Problem...
class Node: def __init__(self, data): self.data = data self.neighbors = [] self.visited = False class Graph: def __init__(self, grid, n, m): self.nodes=dict() for i in range(n): for j in range(m): if grid[i][j]==1: current ...
bags = {} def get_bag_definition(_line): components = _line.split(' contain ') return components[0].replace(' bags', '') def get_contain_definition(_line): components = _line.split(' contain ') return components[1].replace(' bags', '').replace(' bag', '') def get_gold_amount(_contain): num = _...
# # PySNMP MIB module XEDIA-POLICY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XEDIA-POLICY-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:36:31 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
''' Suppose there is a circular road. There are n petrol pumps on that road. You are given two array, a[] and b[], and a positive integer c, where: a[i] denote the amount of fuel we get on reaching ith petrol pump, b[i] denote the amount of fuel used to travel from ith petrol pump to (i + 1)th petrol pump and c denotes...
# -*- coding: utf-8 -*- ''' File name: code\tricolored_coin_fountains\sol_519.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #519 :: Tricolored Coin Fountains # # For more information see: # https://projecteuler.net/problem=519 # Proble...
# colors cl_black = (0, 0, 0) cl_white = (255, 255, 255) cl_red = (255, 0, 0) cl_green = (0, 255, 0) cl_blue = (0, 0, 255) cl_off_black = (30, 30, 30) size = SC_WIDTH, SC_HEIGHT = 1024, 640 FPS = 120 PADDLE_SPEED = 300 / FPS
valorCasa = int(input("Qual o valor da casa?: ")) salario = int(input("Qual o seu salário?: ")) tempo = int(input("Em quantos anos pretende pagar esse financiamento?: ")) if (valorCasa / (tempo * 12)) > (salario * 0.3): print("NEGADO.") else: print("CONCEDIDO.")
# Isso é um comentário # Declaração da variável x com o valor 5 x = 5 # Indentação # é o espaço no inicio da linha para representar o bloco. if 10 >= x: # A Indentação é importante no código # ela determina o bloco da instrução # no caso print faz parte do bloco do if print("10 é maior ou igual a x") # O co...
''' Author Akash Kumar. ''' A={"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7, "h" :8,"i":9,"j":10,"k":11,"l":12,"m":13, "n" :14,"o":15,"p":16,"q":17,"r":18, "s":19, "t":20,"u":21,"v":22,"w":23, "x":24,"y":25,"z":26} while(1): print("🎂🎂choose your option🎂🎂") print("1).check pri...
students = ['Tom', 'jack', 'kevin', 'Eric'] print(students) # ['Tom', 'jack', 'kevin', 'Eric'] # 修改 students[1] = 'Eva' print(students) # ['Tom', 'Eva', 'kevin', 'Eric'] # 末尾添加元素 students.append('Cat') print(students) # ['Tom', 'Eva', 'kevin', 'Eric', 'Cat'] # 插入元素 students.insert(1, 'snake') print(students) # [...
print(str.format_map.__doc__) print(vars.__doc__) """ https://python3-cookbook.readthedocs.io/zh_CN/latest/c02/p15_interpolating_variables_in_strings.html """
test = { 'name': 'Question 5', 'points': 4, 'suites': [ { 'cases': [ { 'answer': 'While score0 and score1 are both less than goal', 'choices': [ 'While score0 and score1 are both less than goal', 'While at least one of score0 or score1 is less than goa...
TOKENS = [ 'NUMBER', 'PLUS', 'MINUS', 'MUL', 'DIV', 'OPEN_PARENS', 'CLOSE_PARENS', 'LSHIFT', 'RSHIFT', 'GT', 'LT' ]
# Source: Class and Instance Variables # https://docs.python.org/2/tutorial/classes.html#class-and-instance-variables ''' In the absence of any other superclasses that you specifically want to inherit from, the superclass should always be object, which is the root of all classes in Python. object is technically the ro...
# Desired capabilities example file for Selenoid Grid # # The same result can be achieved on the command-line. Eg: # --cap-string='{"selenoid:options": {"enableVNC": true}}' capabilities = { "acceptSslCerts": True, "acceptInsecureCerts": True, "screenResolution": "1920x1080x24", "selenoid:options":...
# -*- coding: utf-8 -*- """ __author__ = "Ashiquzzaman Khan" __desc__ = "Main Exe file to Run" """
CAKE = 45 * (1 - 0.125) GOFRETTA = 5.80 * (1 - 0.125) PANCAKE = 3.20 * (1 - 0.125) campaign_days = int(input('Campaign days:')) number_of_bakers = int(input('Number of bakers')) number_of_cakes = int(input('Number of cakes')) number_of_gofrettas = int(input('Number of gofrettas')) number_of_pancakes = int(inpu...
for _ in range(int(input())): n=int(input()) lis=list(map(int,input().split())) x=lis.count(1) y=lis.count(2) if(x%2!=0): print("NO") else: if(y%2==0): print("YES") elif(x>=2): print("YES") else: print("NO")
# # PySNMP MIB module ZHONE-COM-IP-FTP-CLIENT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZHONE-COM-IP-FTP-CLIENT-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:47:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python versio...
#!/usr/bin/python # -*- coding:UTF-8 -*- colors = ['black', 'white'] sizes = ['S', 'M', 'L'] if __name__ == '__main__': for tshirt in ('%s %s' % (c, s) for c in colors for s in sizes): print(tshirt)
apiAttachAvailable = u'\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u0418\u041f\u041f' apiAttachNotAvailable = u'\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d' apiAttachPendingAuthorization = u'\u041e\u0436\u...
def get_lines(input): return [x.strip() for x in input.split("\n") if x.strip() != ''] PUZZLE_INPUT = get_lines( """ ...#..#. #..#...# .....### ##....## ......## ........ .#...... ##...#.. """ ) EXAMPLE_INPUT = get_lines( """ .#. ..# ### """ ) TOTAL_CYCLES = 6 def is_active(cub...
def get_data(): return [ { "label": "Documents", "items": [ { "type": "doctype", "name": "eBay Order" }, { "type": "doctype", "name": "eBay Sync Log" ...
""" Liskov's Substitution Principle Let Φ(x) be a property provable about objects x of type T. Then Φ(y) should be true for objects y of type S where S is a subtype of T. Child class objects should be able to replace parent class objects without breaking the integrity of the application. """ class Calculator: ...
class PhotoAlbum: def __init__(self, pages): self.pages = int(pages) self.photos = [[] for _ in range(pages)] self.page_capacity = 4 self.page_index = 0 @classmethod def from_photos_count(cls, photos_count): pages = int(photos_count) // 4 return cls(pages) ...
class myclass: variable = 'blah' myobjectx = myclass() print(myobjectx.variable)
nome = str(input('Escreva seu nome completo:')).strip() print('Seu nome em letras maiúsculas é {}'.format(nome.upper())) print('Seu nome em letras minúsculas é {}'.format(nome.lower())) print('Seu nome tem ao todo {} letras'.format(len(nome)-nome.count(' '))) print('Seu primeiro nome tem {} letras'.format(nome.find...
class Grammar(object): """Grammar may represent any formal grammar. """ commutative_ops = ['+', '*', 'and', 'or'] def __init__(self, rules = None): if rules is None: rules = {} self.rules = rules def add_rule(self, rule): assert(type(rule) == GrammarRule) ...
''' A leap year calculator: every year that is evenly divisible by 4 except every year that is evenly divisible by 100 unless the year is also evenly divisible by 400 ''' def is_leap_year(year): four = year % 4 hundred = year % 100 fourHundred = year % 400 if fourHundred == 0: return Tr...
''' You can run all the examples below using: pytest --doctest-modules -v exercises.py ''' def combine_two_bytes(b1, b2): ''' Combine two bytes into a word: >>> hex(combine_two_bytes(0xff, 0x12)) '0xff12' >>> hex(combine_two_bytes(0, 0x32)) '0x32' ''' return 0 def split_ip_a...
''' Q-1. Write a function called int_return that takes an integer as input and returns the same integer.''' def int_return(i): return i z=int(input()) int_return(z) ''' Q-2. Write a function called add that takes any number as its input and returns that sum with 2 added.''' def add(x): sum = x+2 ...
def Main(a, b, c, d): """ :param a: :param b: :param c: :param d: :return: """ return a + b - c * d
""" write a in-elif-else chain that determines a person's stage of life. Set a value for the variable age """ age = int(input('What\'s your age:\n')) if age < 2: print('baby') elif age == 2 or age < 4: print('toddler') elif age == 4 or age < 13: print('kid') elif age == 13 or age < 20: print('teenager...
def findSingle(arr): res = arr[0] for i in arr[1::]: res = res^arr[i] return res arr = [7, 3, 5, 4, 5, 3, 4] print(findSingle(arr))
N = int(input()) string = list(input()) final = list(input()) counter = 0 first_index = 0 last_index = 0 for x in range(N-1): if string[x] != final[x] and x > first_index: last_index = x if string[x+1] != final[x+1]: continue else: for y in range(first...
class Range: """ A range of parameter values that can be passed to :class:`Control`. Arguments: vmin (float, optional): Minimum value for this parameter (default 0). vmax (float, optional): Maximum value for this parameter (default 1). vdef (float, optional)...
''' On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top of the floor, and you can either start from the step with index 0, or the step with index 1. ''' class Solution: ...
"""Constants for the Strava Home Assistant integration.""" DOMAIN = "ha_strava" # OAuth Specs AUTH_CALLBACK_PATH = "/auth/external/callback" OAUTH2_AUTHORIZE = "https://www.strava.com/oauth/authorize" OAUTH2_TOKEN = "https://www.strava.com/oauth/token" # Camera Config CONF_PHOTOS = "conf_photos" CONF_PHOTOS_ENTITY =...
# -*- coding: utf-8 -*- """ Created on Tue Apr 21 01:37:26 2020 @author: abcdk """ sweet = "cookies" savory = "pickles" num = 100 print (num, savory, "and", num, sweet) print("I choose the", sweet.upper())
def replace_elements_with_greatest_on_right(arr): for i in range(len(arr) - 1): arr[i] = max(arr[i + 1:]) arr[-1] = -1 return arr
# Write a function that returns the boolean True if the given number is zero, the string "positive" if the number is greater than zero or the string "negative" if it's smaller than zero. def equilbrium(x): # if x > 0: # return "positive" # elif x < 0: # return "negative" # else: # return True return "posit...
#!/usr/bin/env python3 n = 10 largest = int(input()) i = 0 while i < n - 1: v = int(input()) if largest < v: largest = v i = i + 1 print(largest)
N, S, D = [int(n) for n in input().split()] ans = 'No' for i in range(N): x, y = [int(n) for n in input().split()] if x >= S or y <= D: continue else: ans = 'Yes' print(ans)
""" Radix Sort Time Complexity: O(nk + n). n is the size of input list and k is the digit length of the number. """ def radix_sort(arr, simulation=False): position = 1 max_number = max(arr) iteration = 0 if simulation: print("iteration", iteration, ":", *arr) while position <= max_number...
class MeboError(Exception): pass class MeboCommandError(MeboError): pass class MeboRequestError(MeboError): pass class MeboConnectionError(MeboError): pass class MeboConfigurationError(MeboError): pass class MeboDiscoveryError(MeboError): pass
n=int(input("")) arr=[] def countx(list): x,y=0,0 for i in range(0,len(list)-1,2): if(list[i]==1): x+=1 for i in range(1,len(list),2): if(list[i]==1): y+=1 return [x,y] for i in range(n): b=int(input("")) c=input("").split() for i in range(len(c)): c[i]=int(c[i]) arr.append(c) ...
class Generic(Exception): def __init__(self, message: str): self.message = message self.data = {} def add_details(self, message: str): """Add details to the error message. Keyword arguments: message -- details to be concatenated Return value: returns se...
"""定数を提供する。""" # 背景・オブジェクトの向きに対応する DOWN = 0 LEFT = 1 RIGHT = 2 UP = 3 # オブジェクトの種類に対応する PLAYER = 0 ENEMY = 1 NEUTRAL = 2
class Animal: def __init__(self,nombre,duracion_de_vida,peso,ecosistema): self.nombre= nombre self.duracion_de_vida = duracion_de_vida self.peso = peso self.ecosistema = ecosistema print("Creamos un animal") def describe(self): print("Soy un animal del t...
def square_root(n): k_squared = 0 i = 0 while k_squared <= n: i += 1 k_squared += 2 * i - 1 k = i-1 return k print(square_root(16))
DATE_TIME = 'j b, G:i' DATE_AT_TIME = 'j F Y à G:i T' TIME = 'G:i T' WEEKDATE = 'l j F Y' WEEKDATE_AT_TIME = 'l j F Y à G:i T'
""" __version__.py ~~~~~~~~~~~~~~ Information about the current version of the synthrunner package. """ __title__ = 'synthrunner' __description__ = 'synthrunner - SynthRunner' __version__ = '0.8.0' __author__ = 'Sarvi Shanmugham' __author_email__ = 'sarvi@yahoo.com' __license__ = 'MIT License' __url__ = 'https://gith...
def remove_dups(L1,L2): for e in L1: if e in L2: L1.remove(e) L1=[1,2,3,4] L2=[1,2,5,6] remove_dups(L1,L2) print(L1) print(L2)
# -*- coding: utf-8 -*- def response_message(msg): data = { 'message': msg } return data
# Created by Florian on 25/03/2019 def poser_question(question: str) -> bool: """ Pose une question à l'utilisateur, qui doit répondre par oui ou non. :param question: La question à poser à l'utilisateur :return: La réponse utilisateur """ while True: entree_utilisateur = input(questio...