content
stringlengths
7
1.05M
""" Faça um programa que leia um numero inteiro positivo ímpar N e imprima todos os numeros impares de 1 ate N em ordem decrescente. """ n = int(input('Digiete um valor positivo impar para iniciar o programa: ')) while n % 2 == 0 or n < 0: print('Valor invalido.') n = int(input('Digiete um valor positivo impar ...
#Tipos Primitivos e Saída de Dados# n1 = int(input('Digite um numero: ')) n2 = int(input('Digite mais um numero: ')) s = n1+n2 print('A soma vale ',s) #print('A soma vale {}'.format(s))
"""Timedelta formatter. This script allows to format a given timedelta to a specific look. This file can also be imported as a module and contains the following functions: * format_timedelta - formats timedelta to hours:minutes:seconds """ def format_timedelta(td): """Format timedelta to hours:minutes:secon...
def euler(): d = True x = 1 while d == True: x += 1 x_1 = str(x) x_2 = f"{2 * x}" x_3 = f"{3 * x}" x_4 = f"{4 * x}" x_5 = f"{5 * x}" x_6 = f"{6 * x}" if len(x_1) != len(x_6): continue sez1 = [] sez2 =...
# Given a string s, return the longest palindromic substring in s. # # Example 1: # Input: s = "babad" # Output: "bab" # Note: "aba" is also a valid answer. # lets first check if s a palindrome def palindrome(s): mid = len(s) // 2 if len(s) % 2 != 0: if s[:mid] == s[:mid:-1]: return s ...
def algo(load, plants): row = 0 produced = 0 names = [] p = [] for i in range(len(plants)): if row < len(plants): battery = plants.iloc[row, :] names.append(battery["name"]) if load > produced: temp = load - produced ...
# note the looping - we set the initial value for x =10 and when the first for loop is # executed, it is evaluated at that time, so changing the variable x in the loop # does not effect that loop. Now the next time that for loop is executed at that # time the new value of x is used! x = 10 for i in range(0,x): pr...
# -*- coding: utf-8 -*- """ Created on Thu May 23 10:05:43 2019 @author: Parikshith.H """ L = [10,20,30,40,50] n = len(L) print("number of elements =",n) for i in range(n): print(L[i]) # ============================================================================= # #output: # number of elements = 5 # 10 # 20 #...
# This is a variable concept ''' a = 10 print(a) print(type(a)) a = 10.33 print(a) print(type(a)) a = "New Jersey" print(a) print(type(a)) ''' #a = input() #print(a) name = input("Please enter your name : ") print("Your name is ",name) print(type(name)) number = int(input("Enter your number : ")) #Explicit type ...
def vowels(word): if (word[0] in 'AEIOU' or word[0] in 'aeiou'): if (word[len(word) - 1] in 'AEIOU' or word[len(word) - 1] in 'aeiou'): return 'First and last letter of ' + word + ' is vowel' else: return 'First letter of ' + word + ' is vowel' else: return 'Not a...
""" Author: Andreas Finkler Created: 23.12.2020 """
dist = [] for num in range(1, 1000): if (num % 3 == 0) or (num % 5 == 0): dist.append(num) print(sum(dist))
seg1 = float(input('Segmento 1: ')) seg2 = float(input('Segmento 2: ')) seg3 = float(input('Segmento 3: ')) if seg1 < seg2 + seg3 and seg2 < seg1 + seg3 and seg3 < seg1 + seg2: if seg1 == seg2 == seg3: print('Este triângulo é um triângulo equilátero!') elif seg1 == seg2 or seg1 == seg3 or seg2 == seg3:...
add_init_container = [ { 'op': 'add', 'path': '/some/new/path', 'value': 'some-value', }, ]
def get_persistent_id(node_unicode_proxy, *args, **kwargs): return node_unicode_proxy def get_type(node, *args, **kwargs): return type(node) def is_exact_type(node, typename, *args, **kwargs): return isinstance(node, typename) def is_type(node, typename, *args, **kwargs): return typename in ['Tran...
age = 20 if age >= 20 and age == 30: print('age == 30') elif age >= 20 or age == 30: print(' age >= 20 or age == 30') else: print('...')
"""Default configuration settings""" DEBUG = True TESTING = False # Logging LOGGER_NAME = 'api-server' LOG_FILENAME = 'api-server.log' # PostgreSQL USE_POSTGRESQL = True POSTGRESQL_DATABASE = 'my_resume' POSTGRESQL_USER = 'learn' POSTGRESQL_PASSWORD = 'pass.word' POSTGRESQL_HOST = 'localhost' POSTGRESQL_PORT = '54...
# coding: utf-8 userdetails = {'nickname': 'Glycos Shadow', 'password': 'pokem9nb2', 'avatar': '119'} rooms = ['botdevelopment'] # Add rooms here devs = ['pokem9n'] # Keep the usernames in id format, users here can access all commands. server = 'sim3.psim.us' # Socket Address of the ser...
class Solution(object): def lastStoneWeight(self, stones): """ :type stones: List[int] :rtype: int """ #helper function def remove_largest(): #locate the index of the element with max value heaviest_1_idx = stones.index(max(stones)) ...
def namta(p=1): for i in range(1, 11): print(p, "x", i, "=", p*i) namta(5) namta()
num_waves = 2 num_eqn = 2 # Conserved quantities pressure = 0 velocity = 1
#Faça um programa que leia um número de 0 a 9999 e mostre na tela cada um dos #dígitos separados. num = str(input("Digite um número de 0 a 9999: ")) print('Analisando o número!') x = 0 tam = len(num) while(x<tam): print("O {}° número é: {}".format(x+1,num[x])) x+=1
# Defining our main object of interation game = [[0,0,0], [0,0,0], [0,0,0]] #printing a column index, printing a row index, now #we have a coordinate to make a move, like c2 def game_board(player=0, row=1, column=1, just_display=False): print(' 1 2 3') if not just_display: game[row...
def function_2(x): return x[0]**2 + x[1]**2 def numerical_diff(f, x): h = 1e-4 return (f(x+h) - f(x-h)) / (2*h) def function_tmp1(x0): return x0*x0 + 4.0**2 def function_tmp2(x1): return 3.0**2.0 + x1*x1 print(numerical_diff(function_tmp1, 3.0)) print(numerical_diff(function_tmp2, 4.0))
def preencherinventario(lista): resp = 'S' while resp == 'S': equipamento = [input('Equipamento: '), float(input('Valor? ')), int(input('Digite o sérial: ')), input('Departamento: ')] lista.append(equipamento) resp = in...
""" >>> motor = Motor() >>> motor.acelerar() >>> motor.velocidade 1 """ # TODO: ajustar o doctest class Carro: def __init__(self, motor, direcao): self.motor = motor self.direcao = direcao def calcular_velocidade(self): return self.motor.velocidade def acelerar...
JOBS_RAW = { 0: { "Name": "Farmer" }, 1: { "Name": "Baker" }, 2: { "Name": "Lumberjack" }, 3: { "Name": "Carpenter" } }
class ApiException(Exception): """ Generic Catch-all for API Exceptions. """ status_code = None def __init__(self, status_code=None, msg=None, *args, **kwargs): self.status_code = status_code super(ApiException, self).__init__(msg, *args, **kwargs)
class AutowiringError(Exception): """ Error indicating autowiring of a function failed. """ ...
def work(x): x = x.split("cat ") #"cat " is a delimiter for the whole command dividing the line on two parts f = open(x[1], "r") #the second part is a filename or path (in the future) print(f.read()) #outputs the content of the specified file
#calculodeSalario salario= int(input('Digite o valor do seu salário : ')) if salario < 1250: salario = salario *1.15 print ('Seu novo sálario passa a ser de R${:.2f}'.format(salario)) else: salario > 1250 salario =salario *1.10 print('Seu novo salário passa a ser de R${:.2f}'.format(salario))
def un_avg_pool(name, l_input, k, images_placeholder, test_images): """ the input is an 5-D array: batch_size length width height channels """ input_shape = l_input.get_shape().as_list() batch_size = input_shape[0] length = input_shape[1] width = input_shape[2] height = input_shape[3] channels = inp...
num = int(input('Enter a number:')) count = 0 while num != 0: num //= 10 count += 1 print("Total digits are: ", count)
#!/usr/bin/python # -*- coding: utf-8 -*- class Answer(object): def __init__(self, p_id, username, datetime_from, content): self.p_id = p_id self.username = username self.datetime_from = datetime_from self.content = content """docstring for Answer""" # def __init__(self, arg): # super(Answer,...
class MetodoDeNewton(object): def __init__(self, f, f_derivada, x0, precisao=0.001, max_interacoes=15): self.__X = [x0] self.__interacoes = 0 while self.interacoes < max_interacoes: self.__X.append(self.X[-1] - f(self.X[-1]) / f_derivada(self.X[-1])) ...
S = input() t = ''.join(c if c in 'ACGT' else ' ' for c in S) print(max(map(len, t.split(' '))))
# Crie um programa que vai ler vários números e colocar em uma lista. Depois disso, crie duas listas extras que # conterão apenas os valores pares e os valores ímpares digitados, respectivamente. Ao final, mostre o conteúdo das três # listas geradas. list = [] odd = [] pair = [] while True: num = int(input('Di...
""" Helper functions for both simulator and solver. """ __author__ = "Z Feng" def pattern_to_similarity(pattern: str) -> int: """ Convert a pattern of string consisting of '0', '1' and '2' to a similarity rating. '2': right letter in right place '1': right letter in wrong place '0': wrong letter ...
# Criar um programa onde o usuário irá escrever uma expressão qualquer que use parênteses. # Seu aplicativo deverá analisar se a expressão passada está com os parênteses abertos e fechados na ordem correta. expressao = input('Digite a expressão: ') lista = [] for elementos in expressao: if elementos =='(': ...
# coding=utf-8 def point_inside(p, bounds): return bounds[3] <= p[0] <= bounds[1] and bounds[0] <= p[1] <= bounds[2]
#Python Operators x = 9 y = 3 #Arithmetic operators print(x+y) #Addition print(x-y) #Subtraction print(x*y) #Multiplication print(x/y) #Division print(x%y) #Modulus print(x**y) #Exponentiation x = 9.191823 print(x//y) #Floor division #Assignment operators x = 9 x += 3 print(x) x = 9 x -= 3 print(x) x *= 3 print(x) x...
test = { 'name': 'lab1_p1a', 'suites': [ { 'cases': [ { 'code': r""" >>> # It looks like your variable is not named correctly. >>> # Remember, we want to save the value of pi as a variable. >>> # What type should the variable be? >>> # Start the v...
"""This problem was asked by Google. You're given a string consisting solely of (, ), and *. * can represent either a (, ), or an empty string. Determine whether the parentheses are balanced. For example, (()* and (*) are balanced. )*( is not balanced. """
# 2020.04.27 # https://leetcode.com/problems/add-two-numbers/submissions/ # works # Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: # def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: def addTwoNumbers(...
KNOWN_PATHS = [ "/etc/systemd/*", "/etc/systemd/**/*", "/lib/systemd/*", "/lib/systemd/**/*", "/run/systemd/*", "/run/systemd/**/*", "/usr/lib/systemd/*", "/usr/lib/systemd/**/*", ] KNOWN_DROPIN_PATHS = { "user.conf": [ "/etc/systemd/%unit%.d/*.conf", "/run/systemd/%unit%.d/...
"""Top-level package for NewlineCharacterConv.""" __author__ = """NewlineCharacterConv""" __email__ = 'qin__xuan@yeah.net' __version__ = '0.1.0'
# -*- coding: UTF-8 -*- """ @Project :Random_Choose_Play @File :config.py @Author :ChengXiaozhao @Date :2021/7/27 下午8:38 @Desc : """ ALL_TASKS = { "学习": { "看书": ["《计算机系统》", "《C++ Primer》", "《机器学习》"], "看课程视频": ["李宏毅-强化学习课程", "机器学习课程", "Web前端开发"], }, "娱乐": { "逛B站": ["欣赏舞蹈视...
# Created by MechAviv # ID :: [101000010] # Ellinia : Magic Library sm.warp(101000000, 4)
class scrimp(object): DOWNLOAD_START = "Give Me Some Time..." UPLOAD_START = "Starting to upload..." AFTER_SUCCESSFUL_UPLOAD_MSG = "**Thank you for Using Me > © @KitaxRobot **" SAVED_RECVD_DOC_FILE = "File Downloaded Successfully 😎" CUSTOM_CAPTION_UL_FILE = " "
def format_change_kind(kind): return { ('new'): '已上架', ('notice'): '可预定', }[kind]
class SubrectangleQueries: def __init__(self, rectangle: List[List[int]]): self.rectangle = rectangle def updateSubrectangle(self, row1: int, col1: int, row2: int, col2: int, newValue: int) -> None: self.row1, self.col1, self.row2, self.col2, self.newValue = row1, col1, row2, col2, newValue ...
#UTF-8 salario = int(input('Digite seu salário: ')) idade = int(input('Digite sua idade: ')) imposto = 'você deve pagar os impostos'if salario >= 1200 and idade >= 20 else 'você não paga os impostos' print(f'resultado {imposto}')
# 2nd Solution i = 4 d = 4.0 s = 'HackerRank ' a = int(input()) b = float(input()) c = input() print(i+a) print(d+b) print(s+c)
{ 'includes': [ 'common.gyp', 'amo.gypi', ], 'targets': [ { 'target_name': 'amo', 'product_name': 'amo', 'type': 'none', 'sources': [ '<@(source_code_amo)', ], 'dependencies': [ ] ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ MATH6005 Lecture 6. Functions Revision. # ============================================================================= # Example: Scope of a variable # # The code below attempts to double the value of the 'my_salary' variable # but FAILS. This is because within doub...
def imprime_quadro(numeros): print('.' * (len(numeros) + 2)) maior_numero = max(numeros) numeros_traduzidos = [] for numero in numeros: numeros_traduzidos.append(['|' if n < numero else ' ' for n in range(maior_numero)][::-1]) for linha in zip(*numeros_traduzidos): print('.' + ''.join(linha) + '.') print('.' ...
### Task 5.6 #Implement a Pagination class helpful to arrange text on pages and list content on given page. #The class should take in a text and a positive integer which indicate how many symbols will be allowed per each page (take spaces into account as well). #You need to be able to get the amount of whole symbols i...
""" This function converts given hexadecimal number to decimal number """ def hexa_decimal_to_decimal(number: str) -> int: # check if the number is a hexa decimal number if not is_hexa_decimal(number): raise ValueError("Invalid Hexa Decimal Number") # convert hexa decimal number to decimal ...
# a, b = 10, 10 print(a == b) print(a is b) print(id(a), id(b)) a1 = [1, 2, 3, 4] b1 = [1, 2, 3, 4] print(a1 == b1) print(a1 is b1) print(id(a1), id(b1))
print ("Moi je m\'appelle \'Lolita\'") print ("Lo ou bien Lola, du pareil au même") print ("je m\'appelle \'lolita\'") print ("Quand je rêve aux loups, c\'est Lola qui saigne") print ("[...]") print ("C\'est pas ma faute") print ("Et quand je donne ma langues aux chats je vois les autres ") print ("Tout prêts à se jete...
total = 0 media = 0.0 for i in range(6): num = float(input()) if num > 0.0: total += 1 media += num print('{} valores positivos'.format(total)) print('{:.1f}'.format(media/total))
"""This file contains a function that returns the int that apears an odd number of times in a list of integers, the best practice solution was: def find_it(seq): for i in seq: if seq.count(i)%2!=0: return i """ def find_it(seq): """This func...
# http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/JIS0201.TXT JIS0201_map = { '20' : 0x0020, # SPACE '21' : 0x0021, # EXCLAMATION MARK '22' : 0x0022, # QUOTATION MARK '23' : 0x0023, # NUMBER SIGN '24' : 0x0024, # DOLLAR SIGN '25' : 0x0025, # PERCENT SIGN '26' : 0x0...
#it is collection of data and methods. class gohul: a=100 b=200 def func(self): print("Inside function") print(gohul.func(1)) object=gohul() print(object.a) print(object.b) print(object.func()) object1=gohul() print(object1.a)
# Description: 给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。 # 如果目标值不存在于数组中,返回它将会被按顺序插入的位置。 # # 你可以假设数组中无重复元素。 # # Examples: 输入: [1,3,5,6], 5, 输出: 2 # 输入: [1,3,5,6], 2, 输出: 1 # 输入: [1,3,5,6], 7, 输出: 4 # 输入: [1,3,5,6], 0, 输出: 0 # # Difficulty: Simpl...
# Array # An array is monotonic if it is either monotone increasing or monotone decreasing. # # An array A is monotone increasing if for all i <= j, A[i] <= A[j]. An array A is monotone decreasing if for all i <= j, A[i] >= A[j]. # # Return true if and only if the given array A is monotonic. # # # # Example 1: # # In...
class Solution: """ @param matrix: an integer matrix @return: the length of the longest increasing path """ def longestIncreasingPath(self, matrix): if not matrix or len(matrix) == 0 or len(matrix[0]) == 0: return 0 n = len(matrix) m = len(matrix[0]) long...
# -*- coding: utf-8 -*- """Top-level package for NeuroVault Collection Downloader.""" __author__ = """Chris Gorgolewski""" __email__ = 'krzysztof.gorgolewski@gmail.com' __version__ = '0.1.0'
class LandingPage: @staticmethod def get(): return 'Beautiful UI'
class Peptide: def __init__(self, sequence, proteinID, modification, mass, isNterm): self.sequence = sequence self.length = len(self.sequence) self.proteinID = [proteinID] self.modification = modification self.massArray = self.getMassArray(mass) self.totalResidueMass = self.getTotalResidueMass() self.pm ...
def fatorial(n): if n==1: return n return fatorial(n-1) * n print(fatorial(5)) """n = 5 --> ret = 1*2*3*4*5 n = 4 --> fatorial(4) = 1*2*3*4 n = 3 --> fatorial(3) = 1*2*3 n = 2 --> fatorial(2) = 1*2 n = 1 --> fatorial(1) = 1""" print(fatorial(4))
#CMPUT 410 Lab1 by Chongyang Ye #This program allows add courses and #corresponding marks for a student #and count the average score class Student: courseMarks={} name= "" def __init__(self,name,family): self.name = name self.family = family def addCourseMark(self, course, m...
def super_reduced_string(s): """Hackerrank Problem: https://www.hackerrank.com/challenges/reduced-string/problem Steve has a string of lowercase characters in range ascii[‘a’..’z’]. He wants to reduce the string to its shortest length by doing a series of operations. In each operation he selects a pair of ...
{ "targets": [{ "target_name": "defaults", "sources": [ ], "conditions": [ ['OS=="mac"', { "sources": [ "src/defaults.mm", "src/json_formatter.h", "src/json_formatter.cc" ], }] ], 'include_dirs': [ "<!@(node -p \"require('node-addon-a...
#!/usr/bin/env python # -*- encoding: utf-8; py-indent-offset: 4 -*- register_rule("agents/" + _("Agent Plugins"), "agent_config:nvidia_gpu", DropdownChoice( title = _("Nvidia GPU (Linux)"), help = _("This will deploy the agent plugin <tt>nvidia_gpu</tt> to collect GPU utilization values."), ...
# -*- coding: utf-8 -*- """ Taken from Data Structures and Algorithms using Python """ def matrix_chain(d): n = len(d) - 1 N =[[0]*n for i in range(n)] for b in range(1,n): for i in range(n-b): j = i+b N[i][j] = min(N[i][j]+N[k+1][j]+d[i]*d[k+1]*d[j+1] for k in range(i,j)) ...
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @文件 :data_constant.py @说明 : @时间 :2020/07/30 15:36:45 @作者 :Riven @版本 :1.0.0 ''' DATA_DB_PATH = '/app_server/data/data_base.db' ACCOUNT_DB_TABLE_NAME = 'account_table' ACCOUNT_DB_TABLE_KEYS = ['phone', 'password', 'name', 'token']
#Nicolas Andrade de Freitas - Turma 2190 #Exercicio 10 km = float(input("Digite um velocidade em km/h: ")) ms = km / 3.6 print("{}KM/H são {:.2f} M/S".format(km, ms))
#!/usr/bin/env python types = [ ("bool", "Bool", "strconv.FormatBool(bool(*%s))", "*%s == false"), ("uint8", "Uint8", "strconv.FormatUint(uint64(*%s), 10)", "*%s == 0"), ("uint16", "Uint16", "strconv.FormatUint(uint64(*%s), 10)", "*%s == 0"), ("uint32", "Uint32", "strconv.FormatUint(uint64(*%s), 10)", ...
"""# `//ll:driver.bzl` Convenience function to select the C or C++ driver for compilation. """ def compiler_driver(ctx, toolchain_type): driver = ctx.toolchains[toolchain_type].c_driver for src in ctx.files.srcs: if src.extension in ["cpp", "hpp", "ipp", "cl", "cc"]: driver = ctx.toolchain...
#!/usr/bin/env python counts = dict() mails = list() fname = input("Enter file name:") fh = open(fname) for line in fh: if not line.startswith("From "): continue # if line.startswith('From:'): # continue id = line.split() mail = id[1] mails.append(mail) freq_mail = max(mails, k...
class OriginEPG(): def __init__(self, fhdhr): self.fhdhr = fhdhr def update_epg(self, fhdhr_channels): programguide = {} for fhdhr_id in list(fhdhr_channels.list.keys()): chan_obj = fhdhr_channels.list[fhdhr_id] if str(chan_obj.number) not in list(programgui...
class TrieNode: def __init__(self): self.children = {} self.endOfString = False class Trie: def __init__(self): self.root = TrieNode() def insert(self, word): currNode = self.root for char in word: if char not in currNode.children: currN...
def get_capabilities(): return [ "bogus_capability" ] def should_ignore_response(): return True
#Desenvolva um programa que leia o primeiro termo de uma PA. No final mostre os 10 primeiros termos dessa progressão. p = int(input('Digite o primeiro termo: ')) r = int(input('Digite a razão: ')) d = p + (10 - 1) * r for c in range(p, d + r, r): print('{}'. format(c), end= ' -> ') print('ACABOU')
class ExportModuleToFile(object): def __init__(self, **kargs): self.moduleId = kargs["moduleId"] if "moduleId" in kargs else None self.exportType = kargs["exportType"] if "exportType" in kargs else None
años = int(input()) planet = str(input()) planetas = dict([('Mercury', 88), ('Venus', 225), ('Earth', 365), ( 'Mars', 687), ('Jupiter', 4333), ('Saturn', 10759), ('Uranus', 30689), ('Neptune', 60182)]) print(años*planetas[planet]//365)
class Preprocessor: def __init__(self, title): self.title = title def evaluate(self, value): return value
s=input() li=list(map(int,s.split(' '))) while(li!=sorted(li)): n=(len(li)//2) for i in range(n): li.pop() print(li)
#!/usr/bin/env python3 #Take a list, say for example this one: a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] and write a program that prints out all the elements of the list that are less than 5. #Extras: #Instead of printing the elements one by one, make a new list that has all the elements less than 5 from this list in...
# Прикуп + Выигрышные номера тиража + предыдущий тираж к примеру 58570 def test_prikup_winning_draw_numbers_for_previous_draw(app): app.ResultAndPrizes.open_page_results_and_prizes() app.ResultAndPrizes.click_game_prikup() app.ResultAndPrizes.click_winning_draw_numbers() app.ResultAndPrizes.select_dr...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Apr 18 11:53:23 2020 @author: chris """ __version__ = "0.3.2" __status__ = "Alpha"
# -*- coding: utf-8 -*- """ Created on Tue Sep 15 01:38:54 2020 @author: abhi0 """ class Solution: def numTimesAllBlue(self, light: List[int]) -> int: tempLight=sorted(light) cnt=0 sum1=0 sum2=0 for i in range(len(light)): sum1=sum1+light[i] ...
#! /usr/bin/python3 # p76 print("Let's preatice everything.") print("You\'d need to know \'about escapes with \\ that do \n newlines and \t tabs.") poem = """ \tThe lovely world with logic so firmly planted cannot discern \n the needs of love nor comprehend passion from intuition and requires an explanation \n\t\twhe...
FI_MUNICIPALITIES = [ 'Alajärvi', 'Alavieska', 'Alavus', 'Asikkala', 'Askola', 'Aura', 'Akaa', 'Brändö', 'Eckerö', 'Enonkoski', 'Enontekiö', 'Espoo', 'Eura', 'Eurajoki', 'Evijärvi', 'Finström', 'Forssa', 'Föglö', 'Geta', 'Haapajärvi', '...
# Given a date, return the corresponding day of the week for that date. # The input is given as three integers representing the day, month and year respectively. # Return the answer as one of the following values # {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}. # Example 1: # Input: d...
# # Example file for working with loops # def main(): x = 0 # define a while loop while (x<5): print(x) x+=1 # define a for loop for i in range(5): x -= 1 print(x) # use a for loop over a collection days = ["Mon","Tue","Wed",\ "Thurs","Fri","Sat","Sun"] for day in days: ...
def solution(S): hash1 = dict() count = 0 ans = -0 ans_final = 0 if(len(S)==1): print("0") pass else: for i in range(len(S)): #print(S[i]) if(S[i] in hash1): #print("T") value = hash1[S[i]] hash1[S[i]] = i if(value > i): ans = value - i count = 0 else: ans = i - va...
# 022: Crie um programa que leia o nome completo de uma pessoa e mostre: # - O nome com todas as letras maiúsculas e minúsculas. # - Quantas letras no total (sem considerar os espaços). # - Quantas letras tem o primeiro nome. nome = str(input('Digite o seu nome: ')).strip() print(f'maiusculas: {nome.upper()}') print(...
Size = (400, 400) Position = (0, 0) ScaleFactor = 1.0 ZoomLevel = 50.0 Orientation = 0 Mirror = 0 NominalPixelSize = 0.12237 filename = '' ImageWindow.Center = None ImageWindow.ViewportCenter = (1.4121498000000001, 1.2090156) ImageWindow.crosshair_color = (255, 0, 255) ImageWindow.boxsize = (0.1, 0.06) ImageWindow.box_...