content
stringlengths
7
1.05M
''' Play with numbers You are given an array of n numbers and q queries. For each query you have to print the floor of the expected value(mean) of the subarray from L to R. First line contains two integers N and Q denoting number of array elements and number of queries. Next line contains N space seperated integers ...
def glyphs(): return 97 _font =\ b'\x00\x4a\x5a\x00\x4a\x5a\x00\x4a\x5a\x00\x4a\x5a\x00\x4a\x5a'\ b'\x00\x4a\x5a\x00\x4a\x5a\x00\x4a\x5a\x00\x4a\x5a\x00\x4a\x5a'\ b'\x00\x4a\x5a\x00\x4a\x5a\x00\x4a\x5a\x00\x4a\x5a\x00\x4a\x5a'\ b'\x00\x4a\x5a\x00\x4a\x5a\x00\x4a\x5a\x00\x4a\x5a\x00\x4a\x5a'\ b'\x00\x4a\x5a\x00\x4a\x5...
class Solution: def buddyStrings(self, A: str, B: str) -> bool: if len(A) != len(B): return False if A == B: seen = set() for char in A: if char in seen: return True seen.add(char) return False ...
# ------------------------------ # 560. Subarray Sum Equals K # # Description: # Given an array of integers and an integer k, you need to find the total number of # continuous subarrays whose sum equals to k. # # Example 1: # Input:nums = [1,1,1], k = 2 # Output: 2 # # Note: # The length of the array is in range [1...
# testSIF = "123456789012" testSIF = open("input.txt", 'r').read() # testSIF = "0222112222120000" x_size = 25 y_size = 6 layer_count = len(testSIF) // (x_size * y_size) layers = [] index = 0 for z in range(layer_count): layer = [] for y in range(y_size): for x in range(x_size): layer += tes...
class Object: ## Lisp apply() to `that` object in context def apply(self, env, that): raise NotImplementedError(['apply', self, env, that])
loop = 1 while (loop < 10): noun1 = input("Choose a noun: ") plur_noun = input("Choose a plural noun: ") noun2 = input("Choose a noun: ") place = input("Name a place: ") adjective = input("Choose an adjective (Describing word): ") noun3 = input("Choose a noun: ") print ("--------...
def aumentar(n,p,formatar=False): v = n + (n * p / 100) if formatar: return moeda(v) else: return v def diminuir(n,p,formatar=False): v = n - (n * p / 100) if formatar: return moeda(v) else: return v def dobro(n,formatar=False): v = n*2 if...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Product Availability', 'category': 'Website/Website', 'summary': 'Manage product inventory & availability', 'description': """ Manage the inventory of your products and display their availabili...
#!/usr/bin/env python3 """ Advent of Code! --- Day 2: Dive! --- Now doing advent of code day 2 in-between working on finals... I sure hope the puzzles don't ramp up too much the first few days! """ def process_input(input_name): with open(input_name) as input: return input.readlines() def calculate_pos(inp...
""" Base class implementing class level locking capability. MIT License (C) Copyright [2020] Hewlett Packard Enterprise Development LP 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 res...
""" Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same. Since it is impossible to change the length of the array in some languages, you must instead have the result be plac...
# coding:utf-8 """ Simplized version of 0-1 knapSack method. Donghui Chen, Wangmeng Song May 15, 2017 Wangmeng Song August 16, 2017 """ def zeros(rows, cols): row = [] data = [] for i in range(cols): row.append(0) for i in range(rows): data.append(row[:]) return data def getIte...
""" Think of something you could store in a list. Write a program that creates a list containing these items """ start = True languages = [] while start: name = input('Hi, what\'s your name?: ') print(f'Welcome {name.title()}') fav_language = input('What is your favorite programming language?:\n') lan...
numbers = [54, 23, 66, 12] sumEle = numbers[1] + numbers[2] print(sumEle)
class Solution: def search(self, nums: List[int], target: int) -> int: #start pointers low = 0 high = len(nums) - 1 # iterate trought the array while low <= high: # define middle of array mid = low + (high - low) // 2 # if position == tar...
#-*- coding: utf-8 -*- #!/usr/bin/env python ## dummy class to replace usbio class class I2C(object): def __init__(self,module,slave): pass def searchI2CDev(self,begin,end): pass def write_register(self, reg, data): pass # def I2C(self,mo...
# Variables representing the number of candies collected by alice, bob, and carol alice_candies = 121 bob_candies = 77 carol_candies = 109 # Your code goes here! Replace the right-hand side of this assignment with an expression # involving alice_candies, bob_candies, and carol_candies total = (alice_candies + bob_cand...
class ProfileDoesNotExist(Exception): def __init__(self, message, info={}): self.message = message self.info = info class ScraperError(Exception): def __init__(self, message, info={}): self.message = message self.info = info
field_size = 40 snakeTailX = [40,80,120] snakeTailY = [0,0,0 ] Xhead, Yhead, Xfood, Yfood = 120,0,-40,- 40 snakeDirection = 'R' foodkey = True snakeLeight = 2 deadKey = False score = 0 def setup(): global img smooth() size(1024,572) img = loadImage("gameover.jpg") size(1024,572) ...
#function with default parameter def describe_pet(pet_name,animal_type='dog'): """Displays information about a pet.""" print(f"I have a {animal_type}") print(f"My {animal_type}'s name is {pet_name.title()}") #a dog named willie describe_pet('willie') #a hamster named harry describe_pet('harry','hamster')...
""" Utility functions for handling price data """ def get_min_prices(assets: list) -> list: min_price = min([asset.get("price") for asset in assets]) return [asset for asset in assets if asset.get("price") == min_price] def get_average_price(assets: list) -> float: num_assets = len(assets) return sum...
class AncapBotError(Exception): pass class InsufficientFundsError(AncapBotError): pass class NonexistentUserError(AncapBotError): pass
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Build Tower #Problem level: 6 kyu def tower_builder(n_floors): return [' '*(n_floors-x)+'*'*(2*x-1)+' '*(n_floors-x) for x in range(1,n_floors+1)]
class Solution: def hitBricks(self, grid: List[List[int]], hits: List[List[int]]) -> List[int]: def dfs(y, x): if y < 0 or y > m-1 or x < 0 or x > n-1 or grid[y][x]!=1: return 0 grid[y][x] =2 ret = 1 return ret + sum(dfs(y+shift_y, x+shift_x) f...
class Handler: def __init__(self): self.trace = [] def handle(self, data): self.trace.append(f'HANDLE {data}') return data
largura = float(input('Digite a largura da parede: ')) altura = float(input('Digite a altura da parede: ')) area = altura * largura tinta = area / 2 print('Area: {} m2'.format(area)) print('Com as medidas {:.2f}x{:.2f} a quantidade de litros de tinta necessários é: {:.2f} L'.format(altura,largura,tinta))
""" 字段 含义 数据类型 说明 SecurityID 证券代码 STRING DateTime 日期时间 NUMBER 20151123091630 PreClosePx 昨收价 NUMBER(3) OpenPx 开始价 NUMBER(3) HighPx 最高价 NUMBER(3) LowPx 最低价 NUMBER(3) LastPx 最新价 NUMBER(3) TotalVolumeTrade 成交总量 NUMBER 股票:股 基金:份 债券:手指数:手 TotalValueTrade 成交总金额 NUMBER(2) 元 InstrumentStatus 交易状态 STRING BidPrice[10] 申买十价 NUM...
description = 'Verify that the user cannot log in if username value is missing' pages = ['login'] def setup(data): pass def test(data): go_to('http://localhost:8000/') send_keys(login.password_input, 'admin') click(login.login_button) capture('Verify the correct error message is shown') veri...
__description__ = 'lamuda common useful tools' __license__ = 'MIT' __uri__ = 'https://github.com/hanadumal/lamud' __version__ = '21.6.28' __author__ = 'hanadumal' __email__ = 'hanadumal@outlook.com'
""" Ex - 048 - Faça um programa que calcule a soma entre todos os números impares que são múltipços de três e que se encotram no intervalo de 1 até 500""" # Como eu Fiz print(f'{"> Soma Dos Números Multiploes de 3 <":=^40}') # Criar laço de repetição s = 0 for n in range(3, 501, 3):...
# encoding=utf-8 """ tweet_data_dict contains CONSTANTS and word lists for nlp processing. tw2vec is a pretrained vector model trained on a tweet corpus from google ADDITIONAL SUB-DIRECTORIES OFF GSTWEET FOR THIS PROJECT: ./project/ - articles and documents on this topic ./twitter/ - files with batches of tweets, js...
# Just taken from terminal_service.py for Seeker # Will modify based on this as a template #from xmlrpc.client import Fault class TerminalService: """ A service that handles terminal operations. The responsibility of a TerminalService is to provide input and output operations for the terminal. ...
{ "includes": [ "common.gypi", ], "targets": [ { "target_name": "colony", "product_name": "colony", "type": "executable", 'cflags': [ '-Wall', '-Wextra', '-Werror' ], "sources": [ '<(runtime_path)/colony/cli.c', ], 'xcode_settings': { 'OTHER_LDFL...
def int_to_bytes(n, num_bytes): return n.to_bytes(num_bytes, 'big') def int_from_bytes(bites): return int.from_bytes(bites, 'big') class fountain_header: length = 6 def __init__(self, encode_id, total_size=None, chunk_id=None): if total_size is None: self.encode_id, self.total_...
''' 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...
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") def _maybe(repo_rule, name, **kwargs): if name not in native.existing_rules(): repo_rule(name = name, **kwargs) def load_bark(): _maybe( native.local_repository, name = "bark_project", path="/home/chenyang/bark", ) #_...
#then look for the enumerated Intel Movidius NCS Device();quite program if none found. devices = mvnc.EnumerateDevice(); if len(devices) == 0: print("No any Devices found"); quit; #Now get a handle to the first enumerated device and open it. device = mvnc.Device(devices[0]); device.OpenDevice();
def mirror(text): words = text.split(" ") nwords = [] for w in words: nw = w[::-1] nwords.append(nw) return " ".join(nwords) print(mirror("s'tI suoregnad ot eb thgir nehw eht tnemnrevog si .gnorw"))
UNK_TOKEN = '<unk>' PAD_TOKEN = '<pad>' BOS_TOKEN = '<s>' EOS_TOKEN = '<\s>' PAD, UNK, BOS, EOS = [0, 1, 2, 3] LANGUAGE_TOKENS = {lang: '<%s>' % lang for lang in sorted(['en', 'de', 'fr', 'he'])}
"""This is a test script.""" def hello_world(): """Function that prints Hello World.""" print("Hello World") if __name__ == "__main__": hello_world()
# https://www.codewars.com/kata/550f22f4d758534c1100025a/train/python # Once upon a time, on a way through the old wild mountainous west,… # … a man was given directions to go from one point to another. The # directions were "NORTH", "SOUTH", "WEST", "EAST". Clearly "NORTH" # and "SOUTH" are opposite, "WEST" and "E...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def list_sort(func): def inner(s): return sorted(func(s)) return inner @list_sort def get_list(s): return [int(i) for i in s.split()] if __name__ == '__main__': print(get_list(input('Введите числа через пробел: ')))
def get_prime_numbers(max_number): # Crear una lista que contiene el estado (tachado/no tachado) # de cada número desde 2 hasta max_number. numbers = [True, True] + [True] * (max_number-1) # Se comienza por el 2. Esta variable siempre tiene un # número primo. last_prime_number = 2 # Esta var...
class Argument(object): def __init__(self, name=None, names=(), kind=bool, default=None): if name and names: msg = "Cannot give both 'name' and 'names' arguments! Pick one." raise TypeError(msg) if not (name or names): raise TypeError("An Argument must have at lea...
# The Pipelines section. Pipelines group related components together by piping the output # of one component into the input of another. This is a good place to write your # package / unit tests as well as initialize your flags. Package tests check that the input # received by a component is of the right specification...
#List comprehension """ The concept of list comprehension takes in three parameters - expression - iteration - codition (This usually optional) syntax of list comprehension list_of_numbers_from_1_to_10 = [expression iteration condition] """ #example of list comprehension with without condition list_of_num...
""" append and extend""" first_line = [1,2,3,4,5] first_line.append(6) print(first_line) # first_line.append(7,8,9) #doesn't work first_line.append([7,8,9]) print(first_line) correct_list = [1,2,3,4,5] correct_list.extend([6,7,8,9,10]) print(correct_list) """ insert """ print() correct_list.insert(0, 100) print(...
pjesma = '''\ Programiranje je zabava Kada je posao gotov ako zelis da ti posao bude razbirbriga korisit Python! ''' f = open("pjesma.txt", "w") #otvara fajl sa w-pisanje f.write(pjesma) #upisuje tekst u fajl f.close() #zatvara fajl f = open("pjesma.txt") #ako nismo naveli podazumjevno je r-citanje fajla while True: ...
# from __future__ import division class WarheadTypeEnum(object): UNDEFINED = 0 CONE_WARHEAD = 1 ARC_WARHEAD = 2 CARMEN_WARHEAD = 3 class SternTypeEnum(object): UNDEFINED = 0 CONE_STERN = 1 ARC_STERN = 2 class BaseMissile(object): def __init__(self): self.para_dict = {'type_...
CREATED_AT_KEY = "created_at" TITLE_KEY = "title" DESCRIPTION_KEY = "description" PUBLISHED_AT = "published_at" LIMIT_KEY = "limit" OFFSET_KEY = "offset" # Data query limiters DEFAULT_OFFSET = 0 DEFAULT_PER_PAGE_LIMIT = 20 INDEX_KEY = "video_index" VIDEO_ID_KEY = "video_id" VIDEOS_SEARCH_QUERY_KEY = "video_search_q...
""" contest 12/21/2019 """ class Solution: def maxFreq(self, s: str, maxLetters: int, minSize: int, maxSize: int) -> int: freq = {} count_dict = {} def count_letters(word): if word in count_dict: return count_dict[word] unq = {} for i...
#!/usr/bin/env python # -*- coding: utf-8 -*- """This module contains project version information.""" __version__ = "v22.03.4"
# Longest Name. # Create a program that takes an unknown amount of names and outputs the longest name. You will know that the inputs are done when the user has inputted a string of X user_input = '' # Empty string longest_name = '' length = 0 while user_input != 'X': user_input = input('Enter a name: ') i...
# This program is open source. For license terms, see the LICENSE file. class Movie(): """Creates a Movie object with the possibility to define information about its title, poster URL and YouTube trailer. Attributes: title: The title of the movie. poster_image_url: URL to the poster of t...
# -*- coding: utf-8 -*- { "name": "WeCom Portal", "author": "RStudio", "website": "https://gitee.com/rainbowstudio/wecom", "sequence": 608, "installable": True, "application": True, "auto_install": False, "category": "WeCom/WeCom", "version": "15.0.0.1", "summary": """ We...
class Solution(object): def getSum(self, a, b): """ :type a: int :type b: int :rtype: int """ MAX_INT = 0x7FFFFFFF MIN_INT = 0x80000000 MASK = 0x100000000 while b: a, b = (a ^ b) % MASK, ((a & b) << 1) % MASK return a if a <...
# Container for information about the project class Project(object): def __init__(self, origin='', commit='', owner='', name=''): self.origin = origin self.commit = commit self.owner = owner self.name = name def _asdict(self): return self.__dict__ def __dir__(self)...
with open("my_files_ex1.txt") as f: file = f.read() print(file)
class NewsModel: title = None url = None def __init__(self, __title__, __url__): self.title = __title__ self.url = __url__ def __str__(self): return '''["%s", "%s"]''' % (self.title, self.url)
class Operation: __slots__ = ['session', '_sql', '_table', '_stable', '_col_lst', '_tag_lst', '_operation_history'] def __init__(self, session): self.session = session self._sql = [] self._table = None self._stable = None self._col_lst = None self._tag_lst = None...
""" The Data recording and processing program with the use of a derived class of `list` data structure. """ # Classes: class Athlete(list): def __init__(self, arg_name, arg_dob=None, arg_times=[]): """ :param arg_name: The name of the athlete :param arg_dob: The Date of birth of the athlete :param arg_time...
jogador = dict() jogador['Nome'] = str(input('digite o nome do jogador: ')).strip().capitalize() jogador['Jogos'] = int(str(input('digite a quantidade de jogos do jogador: ')).strip().capitalize()) tot = 0 for c in range(0, jogador['Jogos']): jogador[f'partida {c+1}'] = int(input(f'quantos gols o jogador {jogad...
def main(): space = " " item = "o" buffer = "" for x in range(2): spacing = "" for y in range(50): spacing += space buffer = spacing + item print(buffer) for z in range(50): spacing -= space buffer = item + spacin...
__name__ = "ratter" __version__ = "0.1.0-a0" __author__ = "Fabian Meyer" __maintainer__ = "Fabian Meyer" __email__ = "fabian.meyer@ise.fraunhofer.de" __copyright__ = "Copyright 2020, Fraunhofer ISE" __license__ = "BSD 3-clause" __url__ = "https://github.com/fa-me/ratter" __summary__ = """calculate reflection, absorptio...
def x(city, name): city = open(city,'r').read() city = city.replace('\n', ';') city = city.split(';') success = [] for i in city: if i: success.append(i.lstrip().rstrip()) success = {k: v for k, v in zip(success[::2], success[1::2])} file = open('{0}.txt'.format(name), 'w...
users = [ {"first_name": "Helen", "age": 39}, {"first_name": "anni", "age": 9}, {"first_name": "Buck", "age": 10}, ] def get_user_name(users): """Get name of the user in lower case""" return users["first_name"].lower() def get_sorted_dictionary(users): """Sort the nested dictionary""" if...
'''Libraries used by the main program All the libraries that will be used by the main program will be placed here. Contains Library with functions to create latex report. '''
""" Author: Ao Wang Date: 08/27/19 Description: Brute force decryption of the Simplified Columnar Cipher w/o asking the key """ LETTERS_AND_SPACE = "abcdefghijklmnopqrstuvwxyz" + ' \t\n' # The function returns a list of words from two word text files def loadDictionary(): with open("words.txt", "r") as f1: ...
_base_ = [ '../_base_/models/retinanet_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/default_runtime.py' ] cudnn_benchmark = True norm_cfg = dict(type='BN', requires_grad=True) model = dict( pretrained='torchvision://resnet50', backbone=dict( type='ResNet', depth=50, ...
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ # Write your code here n = int(input()) s = input().strip() ans = ...
""" Name : Breaking the records Category : Implementation Difficulty : Easy Language : Python3 Question Link : https://www.hackerrank.com/challenges/breaking-best-and-worst-records/problem """ n = int(input()) score = list(map(int, input().split())) a = b = score[0] r1 = r2 = 0 for i in score[...
"""Crie um programa que leia uma frase qualquer e diga se ela é um palíndromo, desconsiderando os espaços. Exemplos de palíndromos: APOS A SOPA, A SACADA DA CASA, A TORRE DA DERROTA, O LOBO AMA O BOLO, ANOTARAM A DATA DA MARATONA.""" frase = str(input('Digite uma frase (sem pontuação ou acento): ')).strip().upper().re...
# # PySNMP MIB module HH3C-SESSION-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-SESSION-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:16:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
def getYears(): """Return a list of years for which data is available.""" years = [1900, 1901, 1902, 1903, 1905, 1905, 1906, 1907, 1908, 1909, 1910] return years def getSentencesForYear(year): """Return list of sentences in given year. Each sentence is a list of words. Each word is a string. ...
# class object to store neural signal data class NeuralBit: def __init__(self, value): self.value = value def bit(self): return self.value class NeuralWave: def __init__(self, path, label, output_matrix_size): """ Specify the path to the data set, upload the data points""...
file_path = 'D12/input.txt' #file_path = 'D12/test.txt' #file_path = 'D12/test2.txt' with open(file_path) as f: text = f.read().split('\n') def reset(text): data = [] for i in text: data.append(i.split('-')) distinctNodes = [] for i in data: if i[0] not in distinctNodes: ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Написать программу, которая считывает текст из файла и выводит на экран все его # предложения в обратном порядке if __name__ == '__main__': with open('text.txt', 'r') as f: text = f.read().split() i = len(text) - 1 while i >= 0: p...
'''num = [] for n in range(0, 4): num.append(int(input(f'Digite um número na posição {n}:'))) print(f'O MAIOR número foi {max(num)} nas posiçoes ', end='') for i, v in enumerate(num): if v == max(num): print(f'{i}...', end='' ) print() print(f'O MENOR número foi {min(num)} nas posições ', end='') for i,...
def generate_permutations(perm, n): if len(perm) == n: print(perm) return for k in range(n): if k not in perm: perm.append(k) generate_permutations(perm, n) perm.pop() generate_permutations(perm=[], n=4)
hip = 'hip' thorax = 'thorax' r_hip = 'r_hip' r_knee = 'r_knee' r_ankle = 'r_ankle' r_ball = 'r_ball' r_toes = 'r_toes' l_hip = 'l_hip' l_knee = 'l_knee' l_ankle = 'l_ankle' l_ball = 'l_ball' l_toes = 'l_toes' neck_base = 'neck' head_center = 'head-center' head_back = 'head-back' l_uknown = 'l_uknown' l_shoulder = 'l_s...
# Time complexity is O(n) def leaders_to_right(iterable): """ Leaders-to-right in the iterable is defined as if an element in the iterable is greater than all other elements to it's right side :param iterable: It should be of either list or tuple types containing numbers :return: list of...
a=0 b=1 while a<10: print(a) a,b=b,a+b
class Distances(object): """description of class""" def __init__(self, root): self.root = root self.cells = {} """Root cell is distance 0""" self.cells[root] = 0 def GetCellDistance(self, cell): """Gets the cell distance from the root cell""" dist = self.ce...
#program to read the mass data and find the number of islands. c=0 def f(x,y,z): if 0<=y<10 and 0<=z<10 and x[z][y]=='1': x[z][y]='0' for dy,dz in [[-1,0],[1,0],[0,-1],[0,1]]:f(x,y+dy,z+dz) print("Input 10 rows of 10 numbers representing green squares (island) as 1 and blue squares (sea) as zeros") ...
def seq(a, d, n): res = str(a) for i in range(n-1): a += d a %= 10 res += str(a) return res[::-1] l = input() r = input() limits = set() for a in range(10): for d in range(10): limits.add(int(seq(a, d, len(l)))) limits.add(int(seq(a, d, len(r)))) res = max(99*(...
"""This is my module. Pretty pointless tbh, has only one function, welcome() Don't judge me this was a primer on using help()""" def welcome(person='Person'): """The welcome() function Takes an argument person, or defaults person to "Person", prints __name__ and welcomes the person. Now scram.""" ...
def part1(): data = [] with open("C:\\Dev\\projects\\advent-of-code\\python\\day10\\input.txt") as f: data = [int(x) for x in f.readlines()] data.append(0) data.append(max(data) + 3) data.sort() diffs = [0] * 4 for i in range(1, len(data)): d = data[i] - data[i-1] di...
class Facility: id = 0 operator = None name = None bcghg_id = None type = None naics = None description = None swrs_facility_id = None production_calculation_explanation = None production_additional_info = None production_public_info = None ciip_db_id = None def __init__(self, operator): ...
numero1=int(input("Digite Numero Uno: ")) numero2=int(input("Digite Numero Dos: ")) operador=input(" * / + - %: ") if(operador=="+"): funcion=lambda a,b: a+b elif(operador=="-"): funcion=lambda a,b: a-b elif(operador=="/"): funcion=lambda a,b:a/b elif(operador=="*"): funcion=lambda a,b:a*b elif(oper...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Date : 2019-10-13 14:21:43 # @Author : Racterub (Racter Liu) (racterub@gmail.com) # @Link : https://racterub.io # @License : MIT data = int(input("Input your dateNumber:")) #測資: 6 if data == 0: print("Sunday") elif data == 1: print("Monday") elif data ...
Lado_do_Quadrado = int(input('Digite o valor correspondente ao lado de um quadrado: ')) Perimetro_do_Quadrado = Lado_do_Quadrado * 4 Area_do_Quadrado = Lado_do_Quadrado ** 2 print(f'perímetro: {Perimetro_do_Quadrado} - área: {Area_do_Quadrado}')
a = 1 b = a+10 print(b)
n=99999 t=n while(t//10!=0): x=t sum=0 while(x!=0): sum += x%10 x=x//10 t=sum print(sum)
lista = list() cinco = False while True: lista.append(int(input('Digite um valor: '))) continuar = ' ' while continuar not in 'SN': continuar = str(input('Quer continuar?[S/N]: ')).strip().upper()[0] if continuar == 'N': break if 5 in lista: cinco = True lista.sort(reverse=True) prin...
""" persistor base class """ class PersistorBase(): def __init__(self): pass def write(self, feature, dumps, **kwargs): raise NotImplementedError("Persistor write method implementation error!") def read(self, uid, **kwargs): raise NotImplementedError("Persistor read method...
def sum_odd_numbers(numbers): total = 0 odd_numbers = [num for num in numbers if num % 2 == 0] for num in odd_numbers: total += num return total sum_odd_numbers([1, 2, 3, 4, 5, 6, 7, 8, 9])
# 247. Strobogrammatic Number II # ttungl@gmail.com # A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). # Find all strobogrammatic numbers that are of length = n. # For example, # Given n = 2, return ["11","69","88","96"]. class Solution(object): # s...
# Copyright 2000-2002 by Andrew Dalke. # Revisions copyright 2007-2010 by Peter Cock. # All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included ...
# Tot's reward lv 20 sm.completeQuest(5519) # Lv. 20 Equipment box sm.giveItem(2431876, 1) sm.dispose()