content
stringlengths
7
1.05M
""" 107. Word Break https://www.lintcode.com/problem/word-break/description?_from=ladder&&fromId=160 DFS on dictionary """ class Solution: """ @param s: A string @param wordSet: A dictionary of words dict @return: A boolean """ def wordBreak(self, s, wordSet): # write your code here ...
# Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. # Input: [-2,1,-3,4,-1,2,1,-5,4], # Output: 6 # Explanation: [4,-1,2,1] has the largest sum = 6. #https://www.geeksforgeeks.org/print-the-maximum-subarray-sum/ def naive(a): ...
# cook your dish here #input n=int(input("")) resp=[] for i in range(0,n): resp.append(input("")) #print(n,resp) def validlang(req): newreq=[] for i in req: if i!=" ": newreq.append(i) needed=[newreq[0],newreq[1]] lang1=[newreq[2],newreq[3]] lang2=[newreq[4],newr...
# Time: O(nlogn) # Space: O(1) # sort class Solution(object): def maxConsecutive(self, bottom, top, special): """ :type bottom: int :type top: int :type special: List[int] :rtype: int """ special.sort() result = max(special[0]-bottom, top-special[-1]...
""" from __future__ import annotations import threading import time from typing import TYPE_CHECKING from bot import app_vars if TYPE_CHECKING: from bot import Bot class TaskScheduler(threading.Thread): def __init__(self, bot: Bot): super().__init__(daemon=True) self.name = "SchedulerThread"...
nombre = "Fulanito Fulanovsky" usa_lentes = True tiene_mascota = False edad = 25 pasatiempos = ["Correr", "Cocinar", "Leer", "Bailar"] celulares = { "xiaomi redmi": { "RAM": 3, "ROM": 32, "Procesador": 2.1 }, "iphone xs": { "RAM": 4, "ROM": 64, "Procesador": 2.6 }, } ...
alerts = [ { "uuid": "d916cb34-6ee3-48c0-bca5-3f3cc08db5d3", "type": "v1/insights/droplet/cpu", "description": "CPU is running high", "compare": "GreaterThan", "value": 70, "window": "5m", "entities": [], "tags": [], "alerts": {"slack": [], "em...
# Uses Python3 n = int(input('Enter the number for which you want fibonnaci: ')) def fibonnaci_last_digit(num): second_last = 0 last = 1 if num < 0: return 'Incorrect input' elif num == 0: return second_last elif num == 1: return last for i in range(1, num): nex...
class User: def __init__(self, name): self.name = name class SubscribedUser(User): def __init__(self, name): super(SubscribedUser, self).__init__(name) self.subscribed = True class Account: def __init__(self, user, email_broadcaster): self.user = user self.email_b...
def count_elem(array, query): def first_occurance(array, query): lo, hi = 0, len(array) -1 while lo <= hi: mid = lo + (hi - lo) // 2 if (array[mid] == query and mid == 0) or \ (array[mid] == query and array[mid-1] < query): return mid ...
#!/usr/bin/env python main = units.configure.cli.prompt if __name__ == '__main__': main()
dist = int(input('Qual a distancia em km da sua viagem? ')) if dist <= 200: preco = dist * 0.5 print('O preço da viagem sera de: {}'.format(preco)) else: preco = dist * 0.45 print('O preço da viagem sera de: {}'.format(preco))
class DatabaseFormat (object): def __init__(self, logger): self.logger = logger # Table name self.type = None # Primary key self.id = None # 1:N Relationship with records in other tables self.parent = None self.parent_type = None self.children ...
class Command: ADVANCE = 1 REVERSE = 2 ADVANCE_LEFT = 3 ADVANCE_RIGHT = 4 REVERSE_LEFT = 5 REVERSE_RIGHT = 6 OBSTACLE_FRONT = 7 OBSTACLE_BOTTOM = 8 NONE_OBSTACLE_FRONT = 9 NONE_OBSTACLE_BOTTOM = 10 BRAKE = 11 DISABLE_MOTER = 12
print('this is test3') print('add=====') print('add=====2')
# 以下の解説を参考に作成 # https://drken1215.hatenablog.com/entry/2020/11/16/204900 h, w = map(int, input().split()) field = [list(input()) for _ in range(h)] MOD = 10 ** 9 + 7 dp = [[0] * (w + 1) for _ in range(h + 1)] X = [[0] * (w + 1) for _ in range(h + 1)] Y = [[0] * (w + 1) for _ in range(h + 1)] Z = [[0] * (w + 1) for _ ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: b.lin@mfm.tu-darmstadt.de """ def CreateInputFileUpper(InputFileName,MeshFile): data = open(InputFileName,'w+') data.write("\n[Mesh]\ \n type = FileMesh\ \n file = %s \ \n construct_side_list_from_node_list = true\ \n[]\ \n[M...
def setup(): size(500,500) smooth() background(255) noStroke() colorMode(HSB) flug = True def draw(): global flug if(flug): for i in range(0,10): for j in range(0,5): fill (10, random (0, 255) , random (10, 250)) rect(j*40+50 , i*40+50 , 35...
class Vertex: def __init__(self): self.stime = None self.etime = None self.colour = "U" self.pred = None self.next = None class Node: def __init__(self, k): self.val = k self.next = None class edge: def __init__(self, v1, v2): self.e1 = v1 ...
# # Copyright 2019-2020 VMware, Inc. # # SPDX-License-Identifier: BSD-2-Clause # # Flask configurations DEBUG = True # Application configurations OBJECT_STORE_HTTPS_ENABLED = False
class FlockAIController: def __init__(self): pass def run(self): pass
class BaseError(Exception): """Base Error Management All custom error exception should inherit from this class. This base exception only handle error message. """ def __init__(self): self._message = None @property def message(self): return self._message class ContainerEr...
#!/usr/bin/python3 # --- 001 > U5W2P1_Task11_w1 def solution( a, b ): input = [a, b] larger = -float('inf') for x in input: if(larger < x): larger = x return larger if __name__ == "__main__": print('----------start------------') a = 1510 b = 7043 print(solution( a, ...
def get_converter_type_any(*args, **kwargs): """ Handle converter type "any" :param args: :param kwargs: :return: return schema dict """ schema = { 'type': 'array', 'items': { 'type': 'string', 'enum': args, } } return schema def get...
# on test start def enbale(instance): return False def action(instance): pass
TUNSETIFF = 0x400454ca IFF_TUN = 0x0001 IFACE_IP = "10.1.2.1/24" MTU = 65000 ServerIP = "199.230.109.242" debug = True updateSeqno = 105 Runloc = "/home/icmp/"
#Desafio: Calculadora do amor print("Calculadora do amor") print("<3 "*7) #solicita ao usuario o nome de duas pessoas #converte os nomes para minúsculos e tira os espaços nomes = input("Digite o nome de 2 pessoas: ").strip().lower() #atribui o valor zero para a variável placar placar = 0 #o laço de repetição realiz...
class Slides_Menu(): def Slides_Menu_Active(self,paths,subdir): cgipaths=self.Slides_CGI_Paths() rpaths=list(paths) rpaths.append(subdir) res=False if ( len(cgipaths)>len(paths) ): res=True for i in range( len(rpaths) ): if (...
class Solution: def reorderSpaces(self, text: str) -> str: spaces = text.count(" ") words = [w for w in text.split(" ") if w] l = len(words) if l == 1: return words[0] + " " * spaces each, remaining = divmod(spaces, l - 1) return (" " * each).join(words) +...
{ 'targets': [ { 'target_name': 'freetype2', 'dependencies': [ 'gyp/libfreetype.gyp:libfreetype' ], 'sources': [ 'src/freetype2.cc', 'src/fontface.cc' ], "include_dirs" : [ "<!(node -e \"require('nan')\")" ], } ] }
class Solution: def findRestaurant(self, list1: List[str], list2: List[str]) -> List[str]: d = {} matches = {} for i, name in enumerate(list1): d[name] = i for i, name in enumerate(list2): if name in d: matches[name] = i + d[name] ...
bakeQty = int(input()) bakeCapacity = int(input()) CurniEatOnHour = int(input()) GanioEatOnHour = int(input()) hours = int(input()) productivityOnHour = bakeCapacity-CurniEatOnHour-GanioEatOnHour if productivityOnHour*hours>=bakeQty: print('YES') else: print('NO-',"{:.0f}".format(bakeQty-productivityOnHour*hou...
# -*- coding: utf-8 -*- """ Created on Fri Jul 12 19:36:35 2019 @author: Rob """ # Find how many times throughout the show each Friend is saying name # of some other Friend # Include nicknames: Pheebs, Rach, Mon, Joseph, # Create nested dictionary with a Friend and for each friend # place how many t...
weight_list=[] price_list=[] def knapsack(capacity,weight_list,price_list): x=list(range(len(price_list))) ratio=[v/w for v,w in zip(price_list,weight_list)] x.sort(key=lambda i:ratio[i],reverse=True) Maximum_profit=0 for i in x: if(weight_list[i]<=capacity): Maximum_p...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Aug 27 22:37:42 2018 @author: owen """
# _*_ coding: utf-8 _*_ """ python_metaclass.py by xianhu """ class Foo(object): def hello(self): print("hello world!") return foo = Foo() print(type(foo)) # <class '__main__.Foo'> print(type(foo.hello)) # <class 'method'> print(type(Foo)) # <class 'type'> temp = Foo ...
# Exercício Python #001 - Somando dois números n1 = int(input('Digite um numero: ')) n2 = int(input('Digite outro valor: ')) s = n1 + n2 print('A soma ente {} e {} é igual a {}!' .format(n1, n2, s))
############################################################################### # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. ############################################################################### d...
testcases = int(input()) for t in range(testcases): rounds = int(input()) chef_points = 0 morty_points = 0 for round in range(rounds): chef, morty = list(map(int, input().split())) chef_sum = 0 morty_sum = 0 while(chef != 0): r = int(chef % ...
nomes = ("Alexandre", "Eduardo", "Henrique", "Murilo", "Theo", "André", "Enrico", "Henry", "Nathan", "Thiago", "Antônio", "Enzo", "Ian", "Otávio", "Thomas", "Augusto", "Erick", "Isaac", "Pietro", "Vicente", "Breno", "Felipe", "João", "Rafael", "Vinícius", "Bruno", "Fernando", "Kaique", "Raul", "Vito...
class Solution: def fizzBuzz(self, n: int) -> List[str]: d = {3: 'Fizz', 5: 'Buzz'} return [''.join([d[k] for k in d if i % k == 0]) or str(i) for i in range(1, n + 1)]
print(0) # 0 print(-0) # 0 print(0 == -0) # True print(0 is -0) # True print(0.0) # 0.0 print(-0.0) # -0.0 print(0.0 == -0.0) # True print(0.0 is -0.0) # False
""" Write a function that takes a string as input and reverse only the vowels of a string. Example: Input: "hello" Output: "holle" Example: Input: "leetcode" Output: "leotcede" Note: - The vowels does not include the letter "y". """ #Difficulty: Easy #481 / 481 test cases...
frase = 'Curso em vídeo Python' frase2 = frase.replace('Python','Teste') print(frase[9::2]) print(len(frase)) print(frase.count('o',0,21)) print(frase.find('deo')) print(frase.find('android')) print('Curso' in frase) print('Hoje' in frase) print(frase) print(frase2) print(frase.upper()) print(frase.lower()) print(frase...
def update_param(name, param): if name == 'distribution': param['values'].remove('custom') return param return None # param untouched def class_extensions(): @property def Lambda(self): """DEPRECATED. Use ``self.lambda_`` instead""" return self._parms["lambda"] if "lam...
# Calling the following function like so def print_date(year, month, day): joined = str(year) + '/' + str(month) + '/' + str(day) print(joined) result = print_date(1871, 3, 19) print('result of call is:', result) # prints the following output, in that order: # 1871/3/19 # result of call is: None # Explain...
""" Day 01 - Solution 01 Puzzle input as file to read. """ def main() -> None: """ Call the functions and display. """ expense_list = import_list() print(f"Part 1: {find_sum_two(expense_list)}") print(f"Part 2: {find_sum_three(expense_list)}") def import_list() -> list: """ Read fil...
#!/usr/bin/env python # encoding: utf-8 # @author: Zhipeng Ye # @contact: Zhipeng.ye19@xjtlu.edu.cn # @file: permutation.py # @time: 2020-03-18 22:46 # @desc: def permute(nums): paths = [] def record_path(path,nums_copy): if len(nums_copy) ==1: path.append(nums_copy[0]) paths.a...
"""The code template to supply to the front end. This is what the user will be asked to complete and submit for grading. Do not include any imports. This is not a REPL environment so include explicit 'print' statements for any outputs you want to be displayed back to the user. Use triple single q...
def spread_bunnies(lair, rows, columns): b_ees = [] for i in range(rows): for j in range(columns): if lair[i][j] == 'B': b_ees.append([i, j]) for b in b_ees: i = b[0] j = b[1] if i - 1 >= 0: lair[i - 1][j] = 'B' if i ...
# ... client initialization left out data_client = client.data file_path = "experiments/data.xrdml" dataset_id = 1 ingester_list = data_client.list_ingesters() xrdml_ingester = ingester_list.find_by_id("citrine/ingest xrdml_xrd_converter") # Printing the ingester's arguments, we can see it requires an argument with ...
class Action: def __init__(self, target, full, title, short): self.target = target self.full = full self.title = title self.short = short def __repr__(self): return '{"destructive":0, "full":"%s", "title":"%s", "short":"%s","identifier":"%s"}'%(self.title, self.full, se...
### SELF-ORGANIZING MAPS (SOM) CLUSTERING ON TIME-HORIZON ### # INITIALIZE TRANSFORMED DATA & SELECTED SERIES/CHANNELS df = data.copy() list_channel = ['CBS', 'NBC', 'ABC', 'FOX', 'MSNBC', 'ESPN' ,'CNN', 'UNI', 'DISNEY CHANNEL', 'MTV'] list_target = ['18+', 'F18-34'] list_day_part = ['Morning', 'Daytime', 'Early Fring...
# FUNCTION decimal range step value def drange(start, stop, step): r = start while r < stop: yield r r += step
""" Problem 20: Factorial digit sum n! means n × (n − 1) × ... × 3 × 2 × 1 For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800, and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. Find the sum of the digits in the number 100! """ def factorial(n): if n == 1: retur...
# -*- coding: utf-8 -*- """ Ian O'Rourke Created on Sun Feb 7 17:57:23 2021 Python 2 - DAT 129 - SP21 Homework Week 1 Icon Creator """ def wheeler(ten_set,this_list): '''Ensure the user inputs 10 characters.''' # Setting up while loop so the user can be prompted again if more # or less than 10...
del_items(0x8012EA14) SetType(0x8012EA14, "void PreGameOnlyTestRoutine__Fv()") del_items(0x80130AEC) SetType(0x80130AEC, "void DRLG_PlaceDoor__Fii(int x, int y)") del_items(0x80130FC0) SetType(0x80130FC0, "void DRLG_L1Shadows__Fv()") del_items(0x801313D8) SetType(0x801313D8, "int DRLG_PlaceMiniSet__FPCUciiiiiii(unsigne...
# -*- coding: utf-8 -*- description = "Gauss meter setup" group = "optional" tango_base = "tango://phys.maria.frm2:10000/maria" devices = dict( field = device("nicos.devices.entangle.AnalogInput", description = "Lakeshore LS455, DSP Gauss Meter", tangodevice = tango_base + "/ls455/field", ), ...
"""Main module.""" class TemplateCollection: def __init__(self, list_of_templates): self.list_of_templates = list_of_templates def write(self, filename, header=None): with open(filename, 'w') as fi: if header: fi.write(header+"\n\n\n") for ntemp, t in ...
""" Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it. Follow up: Could you do it without any loop/recursion in O(1) runtime? Hint: A naiv...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ n = ListNode(l1.val +...
#x+x^2/2!+x^3/3!+x^4/4!...... x=int(input("Enter a number ")) n=int(input("Enter number of terms in the series ")) sum=0 fact=1 for y in range(1,n+1): fact=fact*y sum=sum+pow(x,y)/fact print(sum)
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def minDiffInBST(self, root: TreeNode) -> int: def inorder(node): if node: inorder(node.left) ...
# -*- coding: utf-8 -*- ''' torstack.config.builder config builder definition. :copyright: (c) 2018 by longniao <longniao@gmail.com> :license: MIT, see LICENSE for more details. '''
class StaticPoliceBaseError(Exception): pass class StaticPoliceBaseNotice(Exception): pass # # Generic errors # class FunctionNotFoundError(StaticPoliceBaseError): pass class StaticPoliceTypeError(StaticPoliceBaseError): pass class StaticPoliceKeyNotFoundError(StaticPoliceBaseError): pass # #...
class Config(object): '''parent configuration file''' DEBUG = True SECRET_KEY = 'hardtoguess' ENV = 'development' TESTING = False class DevelopmentConfig(Config): DEBUG = True url = "dbname = 'stackoverflow_db' user = 'postgres' host = 'localhost' port = '5432' password = 'admin'" clas...
km = float(input("Digite a quantidade de km rodados: ")); dias = int(input("Digite a quantidade de dias em que carro foi alugado:")); valor = ((0.15 * km) + (60 * dias)); print(f"O valor a ser pago pelos {dias} dias e {km}km é R${valor:.2f}");
class NumberException(Exception): pass class Number: # all hex numbers _number_map = "0123456789ABCDEF" def __init__(self, str_number="0", base=10): self._number_list = ["0"] self._number_base = 10 self._number_str = "0" self.set_number(str_number, base) def get_...
{ 'targets': [ { 'target_name': 'sophia', 'product_prefix': 'lib', 'type': 'static_library', 'include_dirs': ['db'], 'link_settings': { 'libraries': ['-lpthread'], }, 'direct_dependent_settings': { 'include_dirs': ['db'], }, 'sources': [ ...
''' Leetcode problem No 416 Parition Equal Subset Sum Solution written by Xuqiang Fang on 4 April ''' class Solution(object): def canPartition(self, nums): s = 0; for i in nums: s += i if((s & 1) == 1): return False s >>= 1 dp = [0]*(s+1) d...
# -*- python -*- # Copied from the drake project # https://github.com/RobotLocomotion/drake/blob/17423f8fb6f292b4af0b4cf3c6c0f157273af501/tools/workspace/generate_include_header.bzl load(":pathutils.bzl", "output_path") # Generate a header that includes a set of other headers def _generate_include_header_impl(ctx): ...
name = input("请输入用户名:") pwd = input("请输入用户密码:") if name == "admin" : if pwd == "admin2020" : print("用户名和密码都正确,可以成功登录!") else : print("用户名正确,密码不正确!") else : if pwd == "admin2020" : print("用户名不正确,密码正确!") else : print("用户名和密码都不正确!")
print('b') for i in range(2): print(i)
####################################### # 文字列の操作 ####################################### def f(a, b): # 数値aとbの和を計算しxに代入せよ # (次の行を書き換える) x = 0 return x def g(a, b): # 数値aとbの積を計算し、xに代入せよ # (次の行を書き換える) x = 0 return x assert f(3, 5) == 8 assert g(2, 3) == 6 print("OK")
cat_colors=[(212,212,212),(100,100,100),(90,70,100),(70,3,89),(60,30,100),(58,83,139),(50,181,122),(175,220,46),(253,181,36),(255,62,76)] for i, col in enumerate(cat_colors): print("""#extinction_category label:nth-child(%i){ background-color: #%s }"""%(i+1,"".join(("{:02x}".format(c) for c in col))))
string = 'hehhhEhehehehehHHHHeeeeHHHehHHHeh' # string = string.replace('h', 'H', string.count('h') - 1).replace('H', 'h',1) # print(string) string1 = string[:string.find('h') + 1] string2 = string[string.rfind('h'):] string3 = string[string.find('h') + 1:string.rfind('h')] string3 = string3.replace('h', 'H') print(s...
# Time: O(n) # Space: O(n) class Solution(object): def distributeCandies(self, candies): """ :type candies: List[int] :rtype: int """ lookup = set(candies) return min(len(lookup), len(candies)/2)
while True: cont=int(input(" ")) if(cont==2002): print("Acceso Permitido") break else: print("Acceso Denegado")
class HondaInputOutputController: def __init__(self, send_func): self.send = send_func def left_turn_signal(self, on): if on: msg = b"\x30\x0a\x0f\x00\x00\x00\x00\x00" else: msg = b"\x20" self.send(0x16f118f0, msg) def right_turn_signal(self, on): if on: msg = b"\x30\x0b\x...
#!/usr/bin/env python # ############################################################################### # Author: Greg Zynda # Last Modified: 12/09/2019 ############################################################################### # BSD 3-Clause License # # Copyright (c) 2019, Greg Zynda # All rights reserved. # # ...
''' author: juzicode address: www.juzicode.com 公众号: juzicode/桔子code date: 2020.6.11 ''' print('\n') print('-----欢迎来到www.juzicode.com') print('-----公众号: juzicode/桔子code\n') print('流程控制实验:if-elif-else') a = input('请输入:') if a == 'Q': print('输入的字符为Q') elif a == 'X': print('输入的字符为X') elif a == 'Z': print('...
class queue(object): """ A queue is a container of objects (a linear collection) that are inserted and removed according to the first-in first-out (FIFO) principle. >>> from pydsa import queue >>> q = queue() >>> q.enqueue(5) >>> q.enqueue(8) >>> q.enqueue(19) >>> q.dequeue() ...
# format example : [일반] 편한식사 (보랏빛소) - 7800원 https://ridibooks.com/v2/Detail?id=2129000044 FORMAT_PRINT_BOOK_MSG = '[%s] %s (%s) - %s원 https://ridibooks.com/v2/Detail?id=%s' # format example : [만화] 새로운 이벤트 : 온다 리쿠 최고의 걸작! 《꿀벌과 천둥》 출간 이벤트 https://ridibooks.com/event/6880 FORMAT_PRINT_EVENT_MSG = '[%s] 새로운 이벤트 : %s %s' H...
def average(array): array = set(array) sumN = 0 for x in array: sumN = sumN + x return(sumN/len(array))
# Using Sorting # Overall complexity: O(n log n ) as sorted() has that complexity def unique2(S): temp = sorted(S) for j in range(1, len(S)): # O(n) if temp[j-1] == temp[j]: # O(1) return False return True if __name__ == "__main__": a1 = [1, 2, 3, 5, 7, 9, 4] print("The eleme...
def get_city_year(p0,perc,delta,target): years = 0 if p0 * (perc/100) + delta <= 0: return -1 while p0 < target: p0 = p0 + p0 * (perc/100) + delta years += 1 return years # a = int(input("Input current population:")) # b = float(input("Input percentage increase:")) # c = int(i...
class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: map = { } for i in range(len(nums)): if target - nums[i] in map: return [map[target - nums[i]] , i] else: map[nums[i]] = i
def rectangle(width, height): answer = width * height answer = int(answer) return answer print(rectangle(int(input()), int(input())))
""" 1021. Remove Outermost Parentheses Easy A valid parentheses string is either empty (""), "(" + A + ")", or A + B, where A and B are valid parentheses strings, and + represents string concatenation. For example, "", "()", "(())()", and "(()(()))" are all valid parentheses strings. A valid parentheses string S is ...
a=int(input("Enter the number:")) if a %2 == 0: print('Number is Even') else: print("Number is Odd")
def same_frequency(num1, num2): """Do these nums have same frequencies of digits? >>> same_frequency(551122, 221515) True >>> same_frequency(321142, 3212215) False >>> same_frequency(1212, 2211) True """ for num in str(num1): if str(num1).count(num...
expected_output = { "src":{ "31.1.1.2":{ "dest":{ "31.1.1.1":{ "interface":"GigabitEthernet0/0/0/0", "location":"0/0/CPU0", "session":{ "state":"UP", ...
""":mod:`krcurrency` --- 한국은행 원화대비 외화환율 조회 라이브러리 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2015 SuHun Han (ssut). :license: MIT License, see LICENSE for more details. """ __author__ = 'ssut' __author_email__ = 'ssut@ssut.me' __version__ = '1.0.0' __license__ = 'MIT' __url__ = 'https:...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def list(students): for idx, student in enumerate(students, 1): print( '{:>7}: ФИО: {}, Номер группы: {}, Русский язык: {}, Математика: {}, Информатика: {}, История: {}, Физика: {};'.format( idx, student.get(...
# Copyright 2020 The StackStorm Authors. # Copyright 2019 Extreme Networks, Inc. # # 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 ...
REDIS_OPTIONS = {'db': 0} TEST_REDIS_OPTIONS = {'db': 0} DEBUG = False LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'default': { 'level': 'INFO', 'class': 'logging.StreamHandler', }, }, 'loggers': { 'aiohttp.access': { ...
# p41.py def find_n(n): if n == 1: return 1 elif n/2 == int(n/2): return find_n(n/2) else: return find_n(n-1) + 1 num1 = int(input()) print(find_n(num1))
nome = str(input('Digite o seu nome: ')) dividido = nome.split() print('='*25) print(nome.upper()) print(nome.lower()) print('O seu nome tem {} letras.'.format(len(''.join(dividido)))) print('O seu primeiro nome tem {} letras.'.format(len(dividido[0]))) print('='*25)
""" Crie um programa que crie uma matriz de dimensão 3x3 e preencha com valores lidos pelo teclado. No final, mostre a matriz na tela, com a formatação correta. """ matriz = [] print('='*50) for coluna in range(0, 3): matriz.append(list()) for linha in range(0, 3): matriz[coluna].append(int(input(f'Dig...
class Solution: """ https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/ Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such ...