content
stringlengths
7
1.05M
print('Sequência de Fibonacci') print('-'*35) n = int(input('Quantos termos você quer mostrar? ')) i1 = 0 i2 = 1 print(f'{i1} -> {i2} -> ', end = '') cont = 3 while cont <= n: i3 = i1 + i2 print(f'{i3}', end = ' -> ') i1 = i2 i2 = i3 cont += 1 print('Fim') print(f'A soma de todos os \033[36m{n}\033[...
t=int(input()) while(t): t=t-1 a=list(map(int,input())) a1=a[::-1] if(a.count(1)<1): print("NO") else: b1=int(a.index(1)) b2=a1.index(1) b2=int(len(a)-b2) b3=a[b1:b2] if(int(sum(b3))==b2-b1): print("YES") else: print("NO...
enter = input() new_list = "" explosion = 0 length = 0 while length < len(enter): for i in range(len(enter)): if not enter[i] == ">" and explosion > 0: explosion -= 1 elif enter[i] == ">": explosion += int(enter[i + 1]) new_list += enter[i] else: ...
s1 = "geeksforgeeks" s2 = "geeks" # Check If s2 is substring of s1 s2SubStrS1 = s2 in s1 print(s2SubStrS1) # Concatenation s3 = s1 + s2 print(s3) # Find First Occurence Index of Substring s2 # NOTE : s2 must be Substring -> else gives an error print(s1.index(s2)) # Find Last Occurence Index of Substring s2 # NOT...
#!/usr/bin/env python3 # Day 8: Power of Two # # Given an integer, write a function to determine if it is a power of two. class Solution: def isPowerOfTwo(self, n: int) -> bool: return n > 0 and (n & (n - 1)) == 0 # Tests assert Solution().isPowerOfTwo(1) == True assert Solution().isPowerOfTwo(16) == Tru...
#Faça um Programa que peça as 4 notas bimestrais e mostre a média. n1 = float(input('Digite a 1º nota: ')) n2 = float(input('Digite a 2º nota: ')) n3 = float(input('Digite a 3º nota: ')) n4 = float(input('Digite a 4º nota: ')) media = (n1+n2+n3+n4)/4 print(f'A média é {media:.2f}.')
# 'ctb6' classlist = ['O', 'E-NR', 'E-OD', 'B-SP', 'S-AS', 'I-P', 'I-JJ', 'E-IJ', 'S-OD', 'I-OD', 'I-VA', 'E-ETC', 'B-CC', 'S-MSP', 'B-LC', 'E-VA', 'E-VC', 'E-DT', 'I-VC', 'S-PN', 'E-MSP', 'I-PU', 'E-VE', 'B-DT', 'S-CC', 'S-DT', 'S-DER', 'B-AD', 'S-VV', 'S-NR', 'B-OD', 'S-VE', 'B-NN-SHORT', 'S-LB', 'S-CS', 'I-CC', 'E-...
# -*- coding: utf-8 -*- """038 - Conversor de Bases Numéricas Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1pIfJpkGhz-bPEbuO2ea93R6Ba18s437l """ n = int(input('Digite um valor decimal: ')) escolha = int(input('Digite: \n- 1 para binário: \n- 2 para ...
""" [Weekly #23] Computational Complexity and Algorithm Design https://www.reddit.com/r/dailyprogrammer/comments/36iufn/weekly_23_computational_complexity_and_algorithm/ # [](#WeeklyIcon) Dynamic Programming and Algorithm Design Programming is fundamentally tied to computer science, which involves the design and opti...
# Copyright 2019 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, ...
# 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 countNodes(self, root: TreeNode) -> int: if not root: return 0 queue = [roo...
# Check for Prime Numbers check_prime = [26, 39, 51, 53, 57, 79, 85] # iterate through the check_prime list for num in check_prime: # search for factors, iterating through numbers ranging from 2 to the number itself for i in range(2, num): # number is not prime if modulo is 0 if (num % i) == 0: ...
f=input('Enter file name: ') try: file=open(f,'r') except: print('File can not be opened: ',f) quit() print('File opened successfully!') file.close()
count = 0 def tower(num , source , auxiliary , destination): global count if num == 1 : print("\nMove disk 1 from" , source , "to", destination ) # Base case count = count + 1 return tower(num-1 , source , destination , auxiliary) print("move disk" , num , "from" , source , "to" , destination) count = coun...
def id_function(x): """ >>> id_function(10) 10 """ return x
class Player: """ A player. In addition to being a token that allows moves to happen, also has events that trigger on certain game states. """ def __init__(self, name, print_debug=False): self.name = name self.print_debug = print_debug def __str__(self): return self.na...
def sudoku_printer(array): for i in range(len(array)): #print(i % 3 == 2) if (i % 3) != 0 or i == 0: print("%s %s %s|%s %s %s|%s %s %s|" % tuple(array[i])) else: print("-" * 18) print("%s %s %s|%s %s %s|%s %s %s|" % tuple(array[i]))
"""Globally defined colors for consistency in plots XKCD color reference: <https://xkcd.com/color/rgb/> Matplotlib list of named colors: <https://matplotlib.org/stable/gallery/color/named_colors.html> """ red = focal = 'tab:red' blue = visible = 'tab:blue' grey = occluded = invisible = 'xkcd:grey' lightgrey = shadow =...
construction_set = { 'type': 'ConstructionSetAbridged', 'name': 'Construction Set', 'wall_set': { 'type': 'WallSetAbridged', 'exterior_construction': 'Exterior Wall ASHRAE 2009' }, 'floor_set': { 'type': 'FloorSetAbridged', 'interior_construction': 'Internal Floor' ...
class Solution: def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: if not matrix: return False row, col = len(matrix), len(matrix[0]) r, c = row - 1, 0 while r >= 0 and c < col: tmp = matrix[r][c] if tmp == target: ...
def notas(*notas, sit=False): """ -> Função para analisar notas e situações de vários alunos :param notas: uma ou mais notas dos alunos (aceita várias) :param sit: valor opcional, indicando se deve ou não adicionar a situação :return: dicionário com várias informações sobre a situação da turma "...
#!/usr/bin/env python # encoding:utf8; """ * Author:ChenJun * Time:2020/12/24 * description: """ def start(): print("import successful") CRC_4_ITU = 'CRC-4/ITU' CRC_5_EPC = 'CRC-5/EPC' CRC_5_ITU = 'CRC-5/ITU' CRC_5_USB = 'CRC-5/USB' CRC_6_ITU = 'CRC-6/ITU' CRC_7_MMC = 'CRC-7/MMC' CRC_8 = 'CRC-8' CRC_8_...
# https://codeforces.com/problemset/problem/1350/A t = int(input()) cases = [tuple(map(int, input().split())) for _ in range(t)] for case in cases: n, m = map(int, case) if n == 1 or m == 1: print('YES') elif n == 2 and m == 2: print('YES') else: print('NO')
# -*- coding: UTF-8 -*- __author__ = 'Ivan' # # class EmailGroupDao(): # # def get_all(self): # # return EmailGroup.query.all() # # # # class EmailTemplateDao(): # # def get(self,id): # # return EmailTemplate.query.get(id) # # def get_all(self): # return EmailTemplate.query.all(...
def fatorial(n, show=False): """ -> Calcula o Fatorial de um número :param n: O número a ser calculado :param show: (opicional) mostrar ou não a conta :return: Mostrar o reultado """ f = 1 for c in range(n, 0, -1): if show: print(f'{c} ', end='') if c > 1:...
gravity = 5 def Gravity(data): global gravity if data != None: gravity = data[0] radius = 5 def Radius(data): global radius if data != None: radius = data[0] # 設定 def setup(): profile = { 'dm_name' : 'BallFreeFall', 'idf_list': [], 'odf_list' : ['Gravity', ...
# This is the class of the input root. Do not edit it. class BinaryTree: def __init__(self, value): self.value = value self.left = None self.right = None # O(n) time | O(n) space worst | O(log(n)) space average def TraverseBSTAndSumOne(node, sum_array, current_sum): current_sum += node....
def tag(): return select({ "//platforms:k8_cpu_jammy_opt": "amd64_22.04", "//platforms:aarch64_cpu_jammy_opt": "arm64_22.04", "//platforms:k8_cpu_jammy_dbg": "amd64_22.04_debug", "//platforms:aarch64_cpu_jammy_dbg": "arm64_22.04_debug", "//platforms:k8_cpu_focal_opt": "amd64_...
width = float(input("Width: ")) height = float(input("Height: ")) area = width * height print("Area: ",area)
s = '我的名字叫Bob' print(s) b = s.encode('utf-8') print(b) print(b.decode('utf-8'))
def action_handler_relation_action_popup(context, action, relation_type, to_entity_type, to_entity_id, **args): try: form_args = { 'to_entity_type' : to_entity_type, 'to_entity_id' : to_entity_id, 'relation_type' : relation_type, 'from_entity_type' : 'Nabar', 'from_entity_id' : context.nabar.id,...
rows = 5 num = rows for i in range(rows, 0, -1): for j in range(0, i): print(num, end=' ') print("\r")
# Añadir un elemento set_one = {'a', True, (45, 45), 'anartz', 34.34} # {'a', True, (45, 45), 'anartz', 34.34} set_one.add("Mario Bros") # {'a', True, (45, 45), 'anartz', 34.34, 'Mario Bros'} set_one.add("Super Pang") # # {'a', True, (45, 45), 'anartz', 34.34, 'Mario Bros', 'Super Pang'} # Añadir un conjunto al conju...
cave = { 1: [2, 5, 8], 2: [10, 3, 1], 3: [2, 4, 12], 4: [3, 5, 14], 5: [1, 4, 6], 6: [5, 7, 15], 7: [6, 8, 17], 8: [1, 7, 9], 9: [8, 10, 18], 10: [11, 9, 2], 11: [10, 12, 19], 12: [3, 11, 13], 13: [12, 14, 20], ...
# métodos de teste n = input('Digite um valor:') print(type(n)) algo = input('Digite algo:') print(n.isnumeric()) # O método isnumeric diz se é possível converter o valor em int. print(n.isalnum()) # O método isalnum diz se é possível converter o valor em str. print(n.isalpha()) print(n.isupper()) print...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' """Скрипт для генерации похожих внешне слов.""" SIMILAR_SYMBOLS_LIST = [ # ('B', 'E'), # ('B', 'H'), # ('B', 'K'), # ('B', 'O'), # ('B', 'P'), # ('C', 'O'), # ('C', 'Q'), # ('E', 'H'), # ('E', 'K'), # ('K...
class Solution(object): def topKFrequent(self, nums, k): number_frequency = {} frequency_list = {} for i in nums: if i not in number_frequency: number_frequency[i] = 1 else: number_frequency[i] += 1 for key, value in number_freq...
g = str(input("Informe seu sexo: [M/F] ")).strip().upper()[0] while g not in 'MF': g = str(input("Dado invalido,digite novamente:")).strip().upper()[0] #print("Ta maluco,pora?? repita") print('Registrado com sucesso,seu cisgenero')
#Given a non-empty string like "Code" return a string like "CCoCodCode". #string_splosion('Code') → 'CCoCodCode' #string_splosion('abc') → 'aababc' #string_splosion('ab') → 'aab' def string_splosion(string): answer = '' for i in range(len(string)): answer += string[:i] return answer+string print...
# Copyright 2018-present Facebook, 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 required by applicable law or agreed to i...
num, res = int(input('Enter N: ')), [] for i in range(num): temp = '' for j in input(): if not j in temp: temp += j res.append(temp) for x in res: print(x)
""" A collection of JSON response schemes from http://Worldtimeapi.org """ class JsonScheme: """ Base JSON response scheme class. Use children instead. """ def __init__(self,**jsonObj): self._data = {} for key,item in jsonObj.items(): if isinstance(self,DateTimeJson): ...
# -*- coding: utf-8 -*- def ClearChar(x): if x != "[" or x != "]" or x != "'" or x != ",": return False else: return True while True: a = [] try: nr = list(map(int, input().split())) b = list(map(int, input().split())) a = list(range(1, nr[0] + 1)) ...
""" num = 0 raiz = 0 """ num = 0 real = 0 num = int(input('digite um numero')) if num < 0: print('Escreva um numero valido') raiz = num ** (1/2) print (f'a raiz calculada é: {raiz}')
routers = dict( BASE = dict(default_application='Rastema', default_controller='default'), )
class SandboxError(Exception): pass class CompileError(SandboxError): pass class ExecuteError(SandboxError): def __init__(self, *args, **kwargs): if 'execution_log' in kwargs: self.execution_log = kwargs.pop('execution_log') super().__init__(*args, **kwargs)
class AmbiguousStage(ValueError): pass class AmbiguousPlan(ValueError): pass
# 4. Создать (не программно) текстовый файл со следующим содержимым: # One — 1 # Two — 2 # Three — 3 # Four — 4 # Необходимо написать программу, открывающую файл на чтение и считывающую построчно данные. При этом английские # числительные должны заменяться на русские. Новый блок строк должен записываться в новый тексто...
# 辞書における繰り返し d = {'key1': 1, 'key2': 2, 'key3': 3} # キーのみの取得 for k in d: print(k) # 値のみの取得 for v in d.values(): print(v) # キーと値両方の取得 for k, v in d.items(): print(k, v)
#!/usr/bin/python # base class for building components class Component: # generate a new logic gate def __init__ (self, position=(0,0), stamp_off=None, stamp_on=None, inputs=[], outputs=[]): self.active = False self.position = position self.stamp_off = stamp_off self.stamp_on = stamp_on # [?] we...
# File: browserlessio_consts.py # # Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) # # Constants relating to '_get_error_message_from_exception' ERR_CODE_MSG = "Error code unavailable" ERR_MSG_UNAVAILABLE = "Error message unavailable. Please check the asset configuration and|or action para...
#import numpy as np MIN_SIZE=-1 """This is the minimum size allowed!""" _pro_min_size=-2 __pri_min_size=-3 def mini(x, y): """ Take the max between two numbers **Parameters** > **x:** `float` -- Description of parameter `x`. > **y:** `float` -- Description of parameter `y`. **Returns** ...
n = int(input()) string = '' for i in range(n): string += input() if string == string[::-1]: print("YES") else: print("NO")
# 国际在线 TASK_NAME = 'cri_net' # 起始URL START_URL = 'http://www.cri.cn/' # 控制域,必须为list格式 DOMAIN = ['cri.cn'] # 请求头 HEADERS = { 'Host': 'news.cri.cn', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0', 'Accept': '*/*', 'Accept-Language': 'zh-CN,zh;q=0.8,en-...
class DataNormalizer: def __init__(self): pass def normalize(self, data): return data
# # PySNMP MIB module Unisphere-Data-BGP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-BGP-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:30:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
class Solution: # def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: def findMedianSortedArrays(self, nums1, nums2) -> float: n = nums1 + nums2 n.sort() l = len(n) return n[l // 2] if l % 2 == 1 else (n[l // 2] + n[l // 2 - 1]) / 2 if __name__ == '__...
database_name = 'verben.db' VERBEN = [ 'bleiben', 'gedeihen', 'leihen', 'meiden', 'preisen', 'reiben', 'reihen', 'scheiden', 'scheinen', 'schneen', 'schneien', 'schreiben', 'schreien', 'schweigen', 'speien', 'speisen', 'steigen', 'treiben', 'weisen', 'zeihen', 'beißen', 'bleichen', 'gleichen', 'gleiten...
courses = {} data = input().split(" : ") while "end" not in data: course = data[0] user = data[1] if course not in courses: courses[course] = [] courses[course].append(user) else: courses[course].append(user) data = input().split(" : ") courses = dict(sorted(courses.items...
# Dynamic typing: Create a variable and when values will be given to it, # then it will automatically know whether the value # given would be an int, float, or char or even a str. # Duck-typing != Dynamic typing: # Types: int, float, str, bytes # INTEGER # var_int = None # print(var_int) # print(type(var_int)) # var_i...
""" Copyright 2018 Jason Litzinger See LICENSE for details. """ class MQTTParseError(Exception): """Parse error""" class MQTTMoreDataNeededError(Exception): """Parse Error when more data is needed.""" class MQTTInvalidPacketError(Exception): """Invalid packet"""
class Solution: """ @param nums: the given array @param s: the given target @return: the number of ways to assign symbols to make sum of integers equal to target S """ def findTargetSumWays(self, nums, s): val_cnts = self.dfs(nums, s, 0) if s not in val_cnts: return 0...
# defined by force, span (tuple with start and end point) # and angle of force load_1 = UDL(force=1000, span=(1,2), angle = 0) load_2 = UDL(force=1000, span=(3,4), angle = 45) load_3 = UDL(force=1000, span=(5,6), angle = 90) # Plotting the loads beam = Beam(7) beam.add_loads( load_1, load_2, load_3 ) fig...
#!/usr/bin/env python """Representation of the Ackermann function in python. Caleb Levy, 2014. """ def Ackermann(m, n): if m == 0: return n+1 elif m > 0 and n == 0: return Ackermann(m-1, 1) elif m > 0 and n > 0: return Ackermann(m-1, Ackermann(m, n-1)) if __name__ == '__main__'...
""" Extraer el ID host del router """ bandera = 0 archivo = open("show_ip_route.txt", "r") while bandera != 1: cadena = archivo.readline() posicion = cadena.find("#") if posicion >= 0: bandera = 1 cadena_final = cadena archivo.close() print ("P: %d " % posicion) print (cadena_final) hostnam...
#Desafio: desenvolva um programa que leia o nome, idade e sexo de 4 pessoas. #No final do programa, mostre: a média de idade do grupo, qual é o nome do homem mais velho e quantas mulheres têm menos de 20 anos. lista_idade = [] maior_idade_homem = 0 nome_velho = '' mulheres20 = 0 for c in range(1,5): nome = str(in...
# # PySNMP MIB module TERMINAL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TERMINAL-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:08:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
# Python program to count Even # and Odd numbers in a List # list of numbers list1 = [1,2,3,4,5,6,7,8,9] even_count, odd_count = 0, 0 # iterating each number in list for num in list1: # checking condition if num % 2 == 0: even_count += 1 else: odd_...
N = int(input()) p = list(map(int, input().split())) z = 0 for i in range(N): if p[i] != i + 1: z += 1 if z <= 2: print('YES') else: print('NO')
class InvalidWordErr(Exception): def __init__(self,message="Invalid Word"): self.message = message super().__init__(self.message) class TargetNotFoundErr(Exception): def __init__(self,message="Target not found"): self.message = message super().__init__(self.message)
def enc_input_to_sentence(enc_inputs, idx, vocab): sentence = [] for idx2 in range(len(enc_inputs[idx])): id = int(enc_inputs[idx][idx2]) if vocab.IdToPiece(id) == "[PAD]": break sentence.append(vocab.IdToPiece(id)) return " ".join(sentence)+"\n" def test_one_by_one(model...
# 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: ans = 0 def height(self, root): if not root: return 0 left = self.height(r...
# # PySNMP MIB module OLD-CISCO-MEMORY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/OLD-CISCO-MEMORY-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:32:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
# Ardin (2101003) | The Town of Ariant (260000200) duel = 3933 backStreet = 926000000 if sm.hasQuest(duel): response = sm.sendAskYesNo("Are you ready to fight my other self?") if response: sm.sendNext("Good. I like your confidence.") sm.warpInstanceIn(backStreet, False) else: sm.se...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' """ Лямбда функции предоставляют нам удобный способ создать функцию «прямо на месте». Но иногда, когда нужно создавать много однотипных лямбда функций, еще удобнее будет создать функцию, которая будет их генерировать. Реализуйте функцию mod_chec...
with open('text', 'r') as s: count=0 for i in s: line=i.split() b,e=line[0].split('-') if int(b) <= line[2].count(line[1][0]) <= int(e): count+=1 print(count) with open('text', 'r') as s: count=0 for i in s: line=i.split() b,e=line[0].split...
def wears_jacket_with_if(temp,raining): if temp<= 60 or raining: return True else: return False def wears_jacket(temp,raining): return temp<=60 or raining def is_prime(n): if n == 1: return False else: num = n-1 flag = True while num!=1: ...
TRADE = { 'access': 'trade_pub_key', 'secret': 'trade_pri_key' } CASHIER = { 'access': 'trade_pub_key', 'secret': 'trade_pub_key' }
class Node(): def __init__(self,value='',left=None,right=None): self.value = value self.left = left self.right = right self.next = None def __str__(self): return str(self.value) class BinaryTree(): def __init__(self, node=None): self.root = node # CC15 def pre_order(self)...
# model settings model = dict( type='SimMIM', backbone=dict( type='MIMResNet', depth=50, mask_layer=0, mask_token='learnable', num_stages=4, out_indices=(3,), # no conv-1, x-1: stage-x norm_cfg=dict(type='SyncBN'), style='pytorch'), neck=dict(type='Si...
#Programa que cria uma matriz 3x3 com números inseridos pelo usuário array = [] temp = [] x = y = 0 for i in range (0,9): if i <= 2: x = 0 if i > 2 and i <= 5: x = 1 if i > 5 and i <= 8: x = 2 temp.append(int(input(f'Digite o número para a posição [{x},{y}] '))) array.ap...
# 286. WALLS AND GATES # You are given a m x n 2D grid initialized with these three possible values. # # -1 – A wall or an obstacle. # 0 – A gate. # INF – Infinity means an empty room. # We use the value 2^31 - 1 = 2147483647 to represent INF # as you may assume that the distance to a gate is less than 2147483647. # ...
class Session: def __init__(self, uid: int, current_dir, id: int) -> None: """ A open shell session in a given `Computer` Args: uid (int): The UID of the user logging in to the given `Session` current_dir (Directory): The current directory that the user is interacting...
#!/usr/bin/env python # vim: set fileencoding=utf-8 : # Tiago de Freitas Pereira <tiago.pereira@idiap.ch> """SGE QUEUES""" QUEUE_DEFAULT = { "default": { "queue": "q_1day", "memory": "8GB", "io_big": False, "resource_spec": "", "max_jobs": 128, "resources": {"default...
'''3.Faça um Programa que verifique se uma letra digitada é "F" ou "M". Conforme a letra escrever: F - Feminino, M - Masculino, Sexo Inválido. ''' sexo = input('Informe o sexo: (M ou F) ') if sexo.upper() == 'M': print('Masculino') elif sexo == 'F': print('Feminino') else: print('Sexo não definido.')
''' Your function should take in a single parameter (a string `word`) Your function should return a count of how many occurences of ***"th"*** occur within `word`. Case matters. Your function must utilize recursion. It cannot contain any loops. ''' ''' Your function should take in a single parameter (a string `word`) Y...
class A: def f(self): pass class B(A): def f(self): super().f()
#!/usr/bin/env python # coding: utf-8 # ## Fabricación de ropa # # Una costurera fabrica y vende faldas y pantalones de mezclilla, para lo cual cada semana compra un # rollo de 50 metros de mezclilla. Para hacer un pantalón requiere 2 metros de tela, mientras que para # una falda, 1.5 metros. # # Por lo general, ell...
# Given an array of integers, find the pair of adjacent elements that has the largest product and return that product. # Example # For inputArray = [3, 6, -2, -5, 7, 3], the output should be # adjacentElementsProduct(inputArray) = 21. # 7 and 3 produce the largest product. # Input/Output # [execution time limit] 4...
#!/usr/bin/env python # -*- coding:utf-8 -*- #business name db_info = 'testdb' # mysql connect info my_ip = '1.1.3.111' my_usr = 'compare' my_pass = 'ZAQ_xsw2' my_port = 3306 my_db = 'otpstest' #os info os_data_ip = '1.1.3.200' os_user = 'oracle' os_pass = 'oracle22222' # oracle connect info ora_ip = '1.1.3.200' ora_us...
# # PySNMP MIB module Wellfleet-LLC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-LLC-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:40:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
f = True o = True x = True y = True p = False p1 = False k = False k1 = False g = False g1 = False m = False m1 = False t = False t1 = False while f: while o: try: weight = int(input("weight :=> ")) o = False except ValueError: print("type an integer") ...
# -*- coding: utf-8 -*- value1 = input() value2 = input() mult = value1*value2 print("PROD = %d" %mult)
species( label = 'C4rad(5)', structure = SMILES('[CH2]CCC'), E0 = (63.0573,'kJ/mol'), modes = [ HarmonicOscillator(frequencies=([2750,2783.33,2816.67,2850,1425,1450,1225,1275,1270,1340,700,800,300,400,2750,2800,2850,1350,1500,750,1050,1375,1000,3000,3100,440,815,1455,1000,180],'cm^-1')), ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 14 13:25:26 2020 @author: hamishgibbs """
# by Kami Bigdely # Consolidate duplicate conditional fragments class Drink: def __init__(self): self._mix = [] @property def mix(self): return self._mix @mix.setter def mix(self, addons): if len(self.mix) > 1: print(f'mixed {self.mix} with {addons}') se...
# THIS FILE IS GENERATED FROM SIGPROFILERSIMULATOR SETUP.PY short_version = '1.1.3' version = '1.1.3'
num=int(input("enter the number")) i=1 fact=1 while(i<=num): fact=fact*i i = i + 1 print(fact)
# Databricks notebook source print('I love Azure Databricks') # COMMAND ---------- # MAGIC %scala # MAGIC println("I Love Azure Databricks") # COMMAND ---------- # MAGIC %sql # MAGIC SELECT "I Love Azure Databricks" as message # COMMAND ---------- # MAGIC %md # MAGIC This is my first notebook using the magic comm...
class Config(object): DEBUG = False TESTING = False PRODUCTION = False LOGGING_LEVEL = "ERROR" LOGGING_FORMAT = '%(asctime)s - %(levelname)-7s - %(module)s:%(filename)s:%(lineno)d - %(message)s' COUNTRY_LOCATION_ID = 1 class Production(Config): PRODUCTION = True class Development(Conf...