content
stringlengths
7
1.05M
# -*- coding: utf-8 -*- """ This module recieves an ForecastIO object and holds the currently weather conditions. It has one class for this purpose. """ class FIOCurrently(object): """ This class recieves an ForecastIO object and holds the currently weather conditions. """ currently = None d...
"""Module providing logic for retrieving bibitems via xml2rfc-style paths, and serializing them to xml2rfc-style RFC 7991 XML. """
# # PySNMP MIB module AILUXCONNECT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AILUXCONNECT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:00:39 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
''' 用户登录的三次机会 ‪‬‪‬‪‬‪‬‪‬‮‬‪‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‪‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‪‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‪‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬ 描述 给用户三次输入用户名和密码的机会,要求如下:‪‬‪‬‪‬‪‬‪‬‮‬‪‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‪‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‪‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‪‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬ 1)如输入第一行输入用户名为‘Kate’,第二行输入密码为‘666666’,输出‘登录成功!’,退出程序;‪‬‪‬‪‬‪‬‪‬‮‬‪‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬...
def test_get_custom_properties(exporters, mocker): blender_data = mocker.MagicMock() vector = mocker.MagicMock() vector.to_list.return_value = [0.0, 0.0, 1.0] blender_data.items.return_value = [ ['str', 'spam'], ['float', 1.0], ['int', 42], ['bool', False], ['vect...
{ 'includes': [ '../common.gypi' ], 'targets': [ { 'target_name': 'shbench', 'product_name': 'shbench', 'type' : 'executable', 'conditions': [ ['OS=="linux"', { 'ldflags': [ '-pthread' ] }], ], 'defines': [ 'SYS_MULTI_TH...
# coding=utf-8 font = { "black": "\033[30m{content}\033[0m", "red": "\033[31m{content}\033[0m", "green": "\033[32m{content}\033[0m", "yellow": "\033[33m{content}\033[0m", "blue": "\033[34m{content}\033[0m", "purple ": "\033[35m{content}\033[0m", "celeste": "\033[36m{content}\033[0m", "w...
# # Copyright (c) 2019 Intel Corporation # # 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 to...
class AST: """ Base class for abstract syntax trees """ pass class BinOp(AST): """ Binary operation for abstract syntax trees """ def __init__(self, left, op, right): self.left = left self.op = op self.right = right class Num(AST): """ Node for numbers in abstract syntax...
data = [['accesstoken', 'title', 'tab', 'content'], ['6eb92a53-9392-4dc5-a10a-3a853cad6e2c', 'helloworld', 'share', 'hshahdhsahashhdhahda']] def parse_data(): json_data ={} for i in range(len(data)): for j in range(len(data[i])): json_data[data[0][j]] = data[1][j] print(json_dat...
# Wrapper node Model # Holds the rules and associated key class Node: def __init__(self, rules, key) -> None: self.rules = rules self.key = key
# binary search tree # author: D1N3SHh # https://github.com/D1N3SHh/algorithms class Red_black_tree(): def __init__(self): self.nil = Node(0, 'black', None, None) self.root = self.nil def __repr__(self): return str(self.root) def left_rotate(self, x): y = x.right ...
# -*- coding: utf-8 -*- """Top-level package for pyDarknetServer.""" __author__ = """Lionel Atty""" __email__ = 'yoyonel@hotmail.com' __version__ = '0.2.0'
# -*- coding: utf-8 -*- '''A completely generic, data-driven, configuration dialog''' class ConfigDialog(QtGui.QDialog): def __init__(self, parent): QtGui.QDialog.__init__(self, parent) # Set up the UI from designer self.ui=UI_ConfigDialog() self.ui.setupUi(self) pages=[] sections=[] sel...
# The XPATH to determine if the main page has fully loaded HOME_PAGE_XPATH: str = '/html/body/center/table/tbody/tr[2]/td/center/table[1]/tbody/tr/td[3]' + \ '/table/tbody/tr/td/ul[1]/li[1]/a' # The XPATH on the main page to the table listing the kits KITS_XPATH: str = '/html/body/center/table/...
""" 09: See my workflow as a graph ------------------------------- """
# -*- coding: utf-8 -*- """ Created on Mon Mar 14 14:43:55 2022 @author: D.Albert-Weiss """ spec_win1D = [ ('win', int32), ]
def test_parameter_exclusion_empty(api_client, api_prefix): response = api_client.get(f"{api_prefix}/parameters/1/exclusions/") assert response.status_code == 200 json_dict = response.json expected = { "message": "exclusions for parameter 1", "parameter": {"excluded": [], "excluded_by":...
g = int(input()) l = list(map(int,input().split())) mi = min(l) ma = max(l) y=0 for i in l: if i == ma: break y+=1 l.remove(ma) l.insert(0,ma) x = l[-1::-1] for j in x: if j==mi: break y+=1 print(y)
TITLE = 'Красивое место' STATEMENT = ''' Солнце над Зоной — редкое явление. Но в те дни, когда оно пробивается из-за туч, можно заметить интересную особенность: его свет не похож на то, к чему привыкли люди до катастрофы. Более того, порой оно высвечивает то, что сложно увидеть в обычном сумраке затянутого облаками н...
def vsota_stevk(n): s = str(n) vsota = 0 for x in s: vsota += int(x) return vsota def euler56(): najvecja_vsota = 0 for a in range(1,100): for b in range(1,100): st = a ** b s = vsota_stevk(st) if s > najvecja_vsota: ...
def newArr(arr): """ MapReduce: O(n^2) 1. Map: construct the Map with Key is each element and Value is the array 2. Reduce: product all element of Value except the key """ result = [] hashmap = {} for i in arr: hashmap[i] = arr for key, value in hashmap.items(): ...
""" Dados n e uma seqüência de n números inteiros, determinar a soma dos números pares. """
# this one needs to be a multiple of 8 bitsString = "1111111101111111001111110001111100001111000001110000001100000001" # store here the hex values bhex = list() # check the size of bitsString if len(bitsString) % 8 != 0 : print("Invalid string len provided") # split, convert to 8 and append to a string (make this more ...
#TRATANDO VÁRIOS VALORES total = soma = numb = 0 numb = int(input('digite o numero [999 para parar]: ')) while numb != 999: total += 1 soma = numb + soma numb = int(input('digite o numero [999 para parar]: ')) print(f'voce digitou {total} numeros e a soma entre eles é {soma}')
def gcd(a, b): while b: a, b = b, a % b return a def isPrimeMR(n): d = n - 1 d = d // (d & -d) L = [2] for a in L: t = d y = pow(a, t, n) if y == 1: continue while y != n - 1: y = (y * y) % n if y == 1 or t == n - 1: return 0 t ...
x=int(input()) for i in range(0,x): a,b=map(int,input().split()) print(a+b)
suppressions = [ # This one cannot be covered by any Python language test because there is # no code pathway to it. But it is part of the C API, so must not be # excised from the code. [ r".*/multiarray/mapping\.", "PyArray_MapIterReset" ], # PyArray_Std trivially forwards to and appears to be sup...
""" * Assignment: FuncProg Closure Define * Complexity: easy * Lines of code: 4 lines * Time: 5 min English: 1. Define function `check` with `func: Callable` as a parameter 2. Define closure function `wrapper` inside `check` 3. Function `wrapper` takes `*args` and `**kwargs` as arguments 4. Function `w...
# _*_coding:utf-8_*_ class Solution: def get_maybe(self, index, pushV): maybe = [None] j = index - 1 while j >= 0: if None is not pushV[j]: maybe[0] = j break j -= 1 j = index + 1 while j < len...
# 2020.07.09 # Problem Statement: # https://leetcode.com/problems/longest-palindromic-substring/ class Solution: def longestPalindrome(self, s: str) -> str: # discuss corner cases if len(s) == 0: return "" elif len(s) == 1: return s elif len(s) == 2: ...
""" Data model module. In this module the data types used in CGnal framework are defined. """
###Titulo: Lista ###Função: Este programa forma uma terceira lista a partir das duas primeiras ###Autor: Valmor Mantelli Jr. ###Data: 31/12/2018 ###Versão: 0.0.2 ### Declaração de variáve list1 = [] list2 = [] list3 = [] n = 0 x = 0 ### Atribuição de valor while True: n = int(input("Digite os valores da list...
# -*- coding: utf-8 -*- """Top-level package for Tractography Meta-Pipeline Command Line Tool (TRAMPOLINO).""" __author__ = """Matteo Mancini""" __email__ = 'ingmatteomancini@gmail.com' __version__ = '0.1.9'
class Solution: @staticmethod def naive(nums,target): l,r = 0,len(nums)-1 while l<=r: m = (l+r)//2 if nums[m]==target: return m if nums[l]<=nums[m]: if target>=nums[l] and target<nums[m]: r=m-1 ...
step( """ create unique index unq_image_tag_image_id_tag_id on image_tag (image_id, tag_id) """, """ drop index unq_image_tag_image_id_tag_id """ )
consumer_key = 'gdLsE3urZ6HqjE2RjiwaFBwag' consumer_secret = 'rubc1WvJoYOnsBoUMXXV660MUOhw685uTFjqnYmrRWdqoq6Y48' access_token = '846813944186650627-CpBzbP1i8ag3pREHkd6YcGQeMHbaLOx' access_secret = 'rX2ikxxtI4zplBp9kbEEpibWVKyCwKJmvuxTiKxFgeJKA'
# Programa que inverte a sequência de itens de uma lista através do loop while utilizando um contador reverso (len(lista) - 1) lista = [66, 78, 2, 45, 97, 17, 34, 105, 44, 52] x = len(lista) - 1 nova_lista = [] while x >= 0: nova_lista.append(lista[x]) x -= 1 print(nova_lista) # fim do programa
""" The Notebook module. """ class Notebook: """ This notebook does... """ def run(self): """ Your notebook code goes here. """ notebook = Notebook() notebook.run()
save_dir = './logs' # miniImageNet_path = '../../semifew_data/miniImagenetFullSize' miniImageNet_path = '/home/ojas/projects/unsupervised-meta-learning/data/untarred/miniImagenetFullSize' ISIC_path = "../../semifew_data/ISIC" ChestX_path = "../../semifew_data/chestX" CropDisease_path = "...
class Result(object): ''' Simple wrapper object to contain result of single iteration MPI computation ''' def __init__(self, rank, idx): self.rank = rank self.idx = idx self.result = None def __repr__(self): return "rank: %d idx: %s result: %s" % (self.rank, self.idx...
# Copyright 2020 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
option='y' while option=='y': print("Enter the number whose factorial to find") num=int(input()) fac=1 while(num!=1): fac=fac*num num=num-1 print("Factorial is "+str(fac)) print("Do you want to continue?(y/n)") option=input() print('Thank you for using this program...
def poly(a, x): val = 0 for ai in reversed(a): val *= x val += ai return val def diff(a): return [a[i + 1] * (i + 1) for i in range(len(a) - 1)] def divroot(a, x0): b, a[-1] = a[-1], 0 for i in reversed(range(len(a) - 1)): a[i], b = a[i + 1] * x0 + b, a[i] a.p...
tickers = [ 'aapl', 'tsla', ]
LAMBDA_232 = 4.934E-11#Amelin and Zaitsev, 2002. # LAMBDA_232 = 4.9475E-11 #old value, used in isoplot ERR_LAMBDA_232 = 0.015E-11#Amelin and Zaitsev, 2002. LAMBDA_235 = 9.8485E-10 #ERR_LAMBDA_235 = LAMBDA_238 = 1.55125E-10 #ERR_LAMBDA_238 = U238_U235 = 137.817 #https://doi.org/10.1016/j.gca.2018.06.014 # U238_U235 =...
#! /usr/bin/python # -*- coding:utf-8 -*- """ Author: AsherYang Email: ouyangfan1991@gmail.com Date: 2018/5/30 Desc: 商品排序 sort: 排序字段,根据 "综合","销量","价格"排序 """ # 综合排序,处理为按照上新时间排列,最新的展示在最前面(_id 越大说明上新时间越近,_id 降序) SORT_COMMON = 0 # 价格降序排序 SORT_PRICE_DOWN = 1 # 价格升序排序 SORT_PRICE_UP = 2 # 按销量排序,从高到低 SORT_SALE_COUNT = ...
# Bar chart # a graph that represents the category of data with rectangular bars with lengths and heights that are proportional # to the values which they represent. # Can be vertical or horizontal. Can also be grouped. # matplotlib fig, ax = plt.subplots(1, figsize=(24,14)) plt.bar(wrestling_count.index, wrestling_...
# “ab”是地址(Address)簿(Book)的缩写 ab = { 'Swaroop': 'swaroop@swaroopch.com', 'Larry': 'larry@wall.org', 'Matsumoto': 'matz@ruby-lang.org', 'Spammer': 'spammer@hotmail.com' } print("Swaroop's address is",ab['Swaroop']) del ab['Spammer'] print('\n There are {} contacts in the address-book\n'.format(len(ab))) for name,addr...
print('\033[34m-=\033[m'*12) print('Analisador de Trianulo') print('\033[34m-=\033[m'*12) a = float(input('Informe a primeira reta: ')) b = float(input('Informe a segunda reta: ')) c = float(input('Informe a terceira reta: ')) if a + b > c and a + c > b and b + c > a: print(f'Com essas retas {a} X {b} X {c} conse...
{ "targets": [ { "target_name": "gles3", "sources": [ "src/node-gles3.cpp" ], 'include_dirs': [ 'src', 'src/include' ], 'cflags':[], 'conditions': [ ['OS=="mac"', { 'libraries': [ '-lGLEW', '-framework OpenGL' ...
''' Created on 7 jan. 2013 @author: sander ''' # The following Key ID values are defined by this specification as used # in any packet type that references a Key ID field: # # Name Number Defined in #----------------------------------------------- # None 0 n/a # ...
#!/usr/bin/env python # coding: utf-8 # In[1]: days_dict = {1:31, 2:29, 3:31, 4:30, 5:31, 6:30, 7:31,8:31, 9:30, 10:31, 11:30, 12:31} start_week = {1:3, 2:6, 3:0, 4:3, 5:5, 6:1, 7:3, 8:6, 9:2, 10:4, 11:0, 12:2} with open('Q3-output.txt', 'w') as f: for i in range(1,13): print('\n\n\t\t\t%d月'%i, file = f)...
#!/usr/bin/python3 # ref: https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange#Cryptographic_explanation # ref: https://en.wikipedia.org/wiki/RSA_(cryptosystem) shared_modulus = 23 shared_base = 5 print("shared modulus: %s" % shared_modulus) print("shared base: %s" % shared_base) print("-"*40) alice_sec...
#!/usr/bin/env python # @Time : 2019-06-03 # @Author : hongshu BUFF_SIZE = 32 * 1024
'''Faça um programa que mostre a tabuada de varios numeros, um de cada vez, para cada valor digitado pelo usuario. O programa sera interrompido quando u número solicitado for negativo''' while True: n = int(input('Quer ver a taboada de qual valor: ')) print('-' * 35) if n < 0: break for c in ra...
########################### # 6.0002 Problem Set 1b: Space Change # Name: # Collaborators: # Time: # Author: charz, cdenise #================================ # Part B: Golden Eggs #================================ # Problem 1 def dp_make_weight(egg_weights, target_weight, memo = {}): """ Find number of eggs t...
# from functools import wraps # def debugMethod(func, cls=None): # '''decorator for debugging passed function''' # @wraps(func) # def wrapper(*args, **kwargs): # print({ # 'class': cls, # class object, not string # 'method': func.__qualname__, # method name, string # ...
#!/usr/bin/env python3 """Solves problem xxx from the Project Euler website""" def solve(): """Solve the problem and return the result""" oneToNine = sum( [len('one'), len('two'), len('three'), len('four'), len('five'), len('six'), ...
class NCBaseError(Exception): def __init__(self, message) -> None: super(NCBaseError, self).__init__(message) class DataTypeMismatchError(Exception): def __init__(self, provided_data, place:str=None, required_data_type:str=None) -> None: message = f"{provided_data} datatype isn't supported for...
class Node: def __init__(self, data): self.data= data self.previous= None self.next= None class DoublyLinkedList: def __init__(self): self.head= None def create_list(self, arr): start= self.head n= len(arr) temp= st...
# The ranges below are as specified in the Yellow Paper. # Note: range(s, e) excludes e, hence the +1 valid_opcodes = [ *range(0x00, 0x0b + 1), *range(0x10, 0x1d + 1), 0x20, *range(0x30, 0x3f + 1), *range(0x40, 0x48 + 1), *range(0x50, 0x5b + 1), *range(0x60, 0x6f + 1), *range(0x70, 0x7f ...
QUESTIONS = { 'a1': { 'Q': 'What is the chemical symbol for gold?', 'A': 'au' }, 'a2': { 'Q': '', 'A': '' }, 'a3': { 'Q': '', 'A': '' }, 'a4': { 'Q': '', 'A': '' }, 'b1': { 'Q': '', 'A'...
#Multilevel Inner Classes #In multilevel inner classes, the inner class contains another class which inner classes to the previous one. class Outer: """Outer Class""" def __init__(self): ## instantiating the 'Inner' class self.inner = self.Inner() ## instantiating the multilevel 'Inn...
# Дуэль + Выигрышные номера нескольких тиражей def test_duel_winning_numbers_for_several_draws(app): app.ResultAndPrizes.open_page_results_and_prizes() app.ResultAndPrizes.click_game_duel() app.ResultAndPrizes.click_the_winning_numbers_for_several_draws() app.ResultAndPrizes.click_ok_for_several_draw...
#!/usr/bin/python3 ''' Collects Weather Forecast by Indian Meterological Department, by parsing webpages :) ''' __version__ = '0.2.0' __author__ = 'Anjan Roy<anjanroy@yandex.com>'
# Contains all the basic info about awards class Award: count = 0 def __init__(self, url, number, name, type, application, restrictions, renewable, value, due, description, sequence): self.url = url self.number = number self.name = name self.type = type self.application = applica...
""" """ load("@bazel_skylib//lib:paths.bzl", "paths") load("@fbcode_macros//build_defs/lib/thrift:thrift_interface.bzl", "thrift_interface") load("@fbcode_macros//build_defs/lib:common_paths.bzl", "common_paths") load("@fbcode_macros//build_defs/lib:src_and_dep_helpers.bzl", "src_and_dep_helpers") load("@fbcode_macros...
# Cracking the Coding Interview 6th Edition # Chapter 1 - Arrays and Strings. Page 88 # Question 1.2 # Solved by Yong Lin Wang """ Given two strings, write a method to decide if one is a permutation of the other. """ def check_permutation(str1, str2): """ If two strings are permutation to one another,...
# 题意:给你两个 非空 的链表,表示两个非负的整数。它们每位数字都是按照 逆序 的方式存储的,并且每个节点只能存储 一位 数字。请你将两个数相加,并以相同形式返回一个表示和的链表。你可以假设除了数字 0 之外,这两个数都不会以 0 开头。 # 解法1: 用while来迭代。考虑两点:进位和不同长两个情况,分别采用:设置一个进位变量,和当某个输入为None(短的已遍历完)时输入的val为0. 对于链表移动,需要先初始化节点,再赋值给一个空指针,在循环内部用next迭代节点。 # 解法2: dfs思路递归。除了判断边界情况,与迭代的while循环不同的是,这里不用初始化,每次递归先给当前节点赋值,再令节点的next和下一个递归结果相等...
class Solution: def productExceptSelf(self, nums): """ :type nums: List[int] :rtype: List[int] """ if (not nums): return None n = len(nums) result = [1] * n prod = 1 for i in range(n): result[i] = result[i] * pr...
class Solution: def dailyTemperatures(self, T: List[int]) -> List[int]: warmer_day = [0]*len(T) recent_day = [2**31-1]*101 MAXLEN = 30000 for i in range(len(T)-1, -1, -1): minday = 2**31-1 for warmer_temp in range(T[i]+1, 101): if recent_day[wa...
""" 046 Ask the user to enter a number. Keep asking until they enter a value over 5 and then display the message “The last number you entered was a [number]” and stop the program """ number = 0 while number < 5 : number = float(input("Enter a number : ")) print("The last number you entered was ", number)
# encoding: utf-8 class Animals(object): def __init__(self, sound): self.sound = sound def speak(self): return self.sound
# Classes are a form of complex data that combines data and functions. # ML Libraries frequently provide classes as one of the main features, # where each model is a class that has an internal state as well as some # useful functions for fitting/training the model and using it to make # predictions. # Classes are us...
"""Top-level package for Calorimeter.""" __author__ = """Jonathon Vandezande""" __email__ = 'jevandezande@gmail.com' __version__ = '0.2.1'
f = open('graph.dot') def find_between( s, first, last ): try: start = s.index( first ) + len( first ) end = s.index( last, start ) return s[start:end] except ValueError: return "" s1 = "digraph " s2 = """ { graph [ rankdir="RL" ] """ s3 = "}" for line in f: name = find_betw...
# coding: utf-8 class Partitioner(object): @staticmethod def partition(array): """ Берем певый в качастве Pivot """ IDX_PIVOT = 0 # Возможно лучше выбрать последний # тогда будет проще работать с индексами pivot_value = array[IDX_PIVOT] i = 1 ...
lista = [] cont = cinco = 0 print('Digite 999 para encerrar') while True: n = [int(input('escolha um número: '))] if n == [999]: print(f'foram digitados {cont} vezes') lista.sort(reverse=True) print(lista) if [5] in lista: print(f'o valor 5 foi digitado e está na list...
# Copyright 2021 Nokia # Licensed under the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause class ApiVersion(object): def __init__(self, group: str, version: str): self.group = group self.version = version class Kind(ApiVersion): def __init__(self, group: str, version: str, kind...
class Accessor(object): """""" pass class WriteThru(Accessor): """Implement write-thru access pattern.""" pass class WriteAround(Accessor): """Implement write-around access pattern.""" pass class WriteBack(Accessor): """Implement write-back access pattern.""" pass
_base_ = '../cascade_rcnn/cascade_mask_rcnn_r50_fpn_mstrain_3x_coco.py' model = dict( backbone=dict( type='ResNeXt', depth=101, groups=32, base_width=8, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=Fa...
def find_missing(S): if len(S) > 0: m = max(S) vals = [ 0 for i in range(m)] for x in S: if x < 0: print("Warning {} is <0. Ignoring it.".format(x)) else: vals[x-1] += 1 return [x+1 for x in range(m) if vals[x] == 0] else: ...
def solution(inpnum): upnum = int(str(9)*inpnum) lownum = int(str(1)+(str(0)*(inpnum-1))) ansnum = None for i in range(upnum,lownum,-1): if len(str(i))==len(set(str(i))): if 2**(i-1)%i==1: ansnum = i break return ansnum
def visualize(**images): """PLot images in one row.""" n = len(images) plt.figure(figsize=(16, 5)) for i, (name, image) in enumerate(images.items()): plt.subplot(1, n, i + 1) plt.xticks([]) plt.yticks([]) plt.title(' '.join(name.split('_')).title()) plt.imshow(ima...
""" USO DO JOIN """ string = 'O brasil é penta.' lista = string.split(' ') strint_2 = ','.join(lista) print(string) print(lista) print(strint_2)
class Solution: def toHex(self, num: int) -> str: if num == 0: return '0' chars, result = '0123456789abcdef', [] if num < 0: num += (1 << 32) while num > 0: result.insert(0, chars[num % 16]) num //= 16 return ''.join(result)
#!/usr/bin/python3 """ Class check module Functions: is_kind_of_class: checks if obj is inherit from determined class """ def is_kind_of_class(obj, a_class): """ checks class inheritance Args: obj: object to evaluate a_class: suspect father """ return i...
# Space: O(1) # Time: O(n) # 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 diameterOfBinaryTree(self, root): self.res = 0 self.dfs(ro...
''' this is the file holding the description texts to be inserted this file is imported to the src.py ''' bf_desc = [ "Brute-Force Algorithm:", " ", "Summary:", "The brute force algorithm is very aggressive.", "It checks every single line segment against every other line segment for an intersection...
try: n = int(input("Enter number")) print(n*n) except: print("Non integer entered")
height = int(input()) for i in range(0,height+1): for j in range(0,i+1): if(j == i): print(i,end=" ") else: print("*",end=" ") print() # Sample Input :- 5 # Output :- # 0 # * 1 # * * 2 # * * * 3 # * * * * 4 # * * * * * 5
statement_one = False statement_two = True credits = 120 gpa = 1.8 if not credits >= 120: print('You do not have enough credits to graduate.') if not gpa >= 2.0: print('Your GPA is not high enough to graduate.') if not (credits >= 120) and not (gpa >= 2.0): print('You do not meet either require...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Day 8: Dictionaries and Maps Source : https://www.hackerrank.com/challenges/30-dictionaries-and-maps/problem """ n = int(input()) book = dict([input().split() for _ in range(n)]) for _ in range(n): name = input() print("%s=%s" % (name, book[name]) if name in b...
LOCALHOST_EQUIVALENTS = frozenset(( 'localhost', '127.0.0.1', '0.0.0.0', '0:0:0:0:0:0:0:0', '0:0:0:0:0:0:0:1', '::1', '::', ))
"""The Carian alphabet. Sources: - `<https://www.unicode.org/charts/PDF/U102A0.pdf>` - Adiego, Ignacio, J. (2007) The Carian Language """ __author__ = [ "Caio Geraldes <caio.geraldes@usp.br>"] VOWELS = [ "\U000102A0", # 𐊠 CARIAN LETTER A "\U000102A7", # 𐊧 CARIAN LETTER A2 "\U000102AB", # 𐊫 CAR...
count = int(input()) for i in range(count): print("@"*(count*5)) for i in range(count*3): print("@"*(count)," "*(count*3),"@"*(count),sep="") for i in range(count): print("@"*(count*5))
des = ('Desafio-005 número antecessor e sucessor') print ('{}.'.format(des)) #Desafio-05 >>> Faça um programa que leia um numero inteiro e mostre na tela o seu antecessor e seu sucessor. n1 = int(input('Digite um número: ')) n2 = (1) s1 = (n1+n2) s2 = (n1-n2) print ('Você digitou o número {}, \nO número antecessor de...
# Altere o programa anterior permitindo ao usuario informar as populações e as taxas de crescimento iniciais. Valide a entrada # e permita repetir a operação def calculo_populacional(pais_A, pais_B, cresc_A, cresc_B): cont_anos = 0 if (pais_A < pais_B): validar = True if (pais_A >= pais_B) else F...
a = input("Enter some list of numbers =") for i in a: print(i) print(type(a))