content
stringlengths
7
1.05M
name = 'exit' usage = 'EXIT' description = 'Exits Diplomat.' def execute(query): return 'Exiting Diplomat.'
"""Args: param1 (int): byte as int value in binary Returns: True if input indicates a meta event, False if otherwise. """ def is_meta(n): # hex status byte 0xFF # dec value 255 dec_val = int(n, 2) if dec_val == 255: return True else: return False
#!/usr/bin/env python """version of the sdk """ __version__ = "1.0.0"
success = { "uuid": "8bf7e570-67cd-4670-a37c-0999fd07f9bf", "action": "EventsRouter", "result": { "success": True }, "tid": 1, "type": "rpc", "method": "detail" } fail = { "uuid": "8bf7e570-67cd-4670-a37c-0999fd07f9bf", "action": "EventsRouter", "result": { "msg"...
settings = { # add provider-specific survey settings here # e.g. how to abbreviate questions }
# coding: utf-8 s = "The string ends in escape: " s += chr(27) # add an escape character at the end of $str print(repr(s))
SERVICE_NAME = "org.bluez" AGENT_IFACE = SERVICE_NAME + '.Agent1' ADAPTER_IFACE = SERVICE_NAME + ".Adapter1" DEVICE_IFACE = SERVICE_NAME + ".Device1" PLAYER_IFACE = SERVICE_NAME + '.MediaPlayer1' TRANSPORT_IFACE = SERVICE_NAME + '.MediaTransport1' OBJECT_IFACE = "org.freedesktop.DBus.ObjectManager" PROPERTIES_IFACE =...
class Cliente: def __init__(self, nome): self.__nome = nome @property def nome(self): return self.__nome.title() def get_nome(self): print('[INFO] Getting value...') print('[INFO] Name "{}" getted sucessfully'.format(self.__nome)) return self.__nome...
class ChartModel: def score_keywords(self, dep_keywords): #mock (@todo: update after integrating training a model) keyword_scores = [] for kw in dep_keywords: keyword_scores.append({ 'keyword': kw, 'score': 0.7 }) ...
def word_permutation(s): return word_permutation_helper(list(s)) def word_permutation_helper(input_list): if len(input_list) ==0: return '' ret = [] for i in range(len(input_list)): base = input_list[i] remainder = input_list[:i]+input_list[i+1:] out = word_permu...
def solution(participant, completion): answer = "" temp = 0 dic = {} for p in participant: dic[hash(p)] = p temp += hash(p) for c in completion: temp -= hash(c) return dic[temp]
class Solution: def generateMatrix(self, n: int) -> List[List[int]]: mat = [[0] * n for _ in range(n)] left, top, right, bottom = 0, 0, n, n val = 1 while left < right and top < bottom: for i in range(left, right): mat[top][i] = val val += ...
# DROP TABLES songplay_table_drop = "DROP TABLE songplays" user_table_drop = "DROP TABLE users" song_table_drop = "DROP TABLE songs" artist_table_drop = "DROP TABLE artists" time_table_drop = "DROP TABLE time" # CREATE TABLES songplay_table_create = (""" CREATE TABLE IF NOT EXISTS songplays ( songplay_id SERIAL ...
class Solution(object): def findCircleNum(self, M): def dfs(node): visited.add(node) for person, is_friend in enumerate(M[node]): if is_friend and person not in visited: dfs(person) circle = 0 visited = set() ...
a = [1,5,4,6,8,11,3,12] even = list(filter(lambda x: (x%2 == 0), a)) print(even) third = list(filter(lambda x: (x%3 == 0), a)) print(third) b = [[0,1,8],[7,2,2],[5,3,10],[1,4,5]] b.sort(key = lambda x: x[2]) print(b) b.sort(key = lambda x: x[0]+x[1]) print(b)
""" 36. How to import only specified columns from a csv file? """ """ Difficulty Level: L1 """ """ Import ‘crim’ and ‘medv’ columns of the BostonHousing dataset as a dataframe. """ """ """
# -*- coding: utf-8 -*- """ Created on Wed Feb 5 11:02:42 2020 @author: Arthur """
# # @lc app=leetcode id=111 lang=python3 # # [111] Minimum Depth of Binary Tree # # https://leetcode.com/problems/minimum-depth-of-binary-tree/description/ # # algorithms # Easy (34.89%) # Likes: 730 # Dislikes: 394 # Total Accepted: 298.5K # Total Submissions: 844K # Testcase Example: '[3,9,20,null...
#!/usr/bin/env python3 def path_combinations(): a, b, c = 0, 1, 1 while True: yield a a, b, c = b, c, a+b+c if __name__ == '__main__': with open('input.txt', 'r') as f: adapters = sorted( int(l.strip()) for l in f.readlines() ) # part 1 difs, prev = [], 0 for joltage...
def word(str): j=len(str)-1 for i in range(int(len(str)/2)): if str[i]!=str[j]: return False j=j-1 return True str=input("Enter the string :") ans=word(str) if(ans): print("string is palindrome") else: print("string is not palindrome")
class RowMenuItem: def __init__(self, widget): # Item can have an optional id self.id = None # Item may specify a parent id (for rendering purposes, like display = 'with-parent,' perhaps) self.parent_id = None # If another item chooses to display with this item, then tha...
nome = str(input('Digite seu nome completo: ')).strip() print(nome.upper()) print(nome.lower()) print(len(nome))
#!/usr/bin/env python # encoding=utf-8 def test(): print('utils_gao, making for ml')
class Config(object): """This is the basic configuration class for BorgWeb.""" #: builtin web server configuration HOST = '127.0.0.1' # use 0.0.0.0 to bind to all interfaces PORT = 9087 # ports < 1024 need root DEBUG = True # if True, enable reloader and debugger LOG_FILE = 'prombot.log' ...
def _gen_k8s_file(ctx): odir = ctx.actions.declare_directory("tmp") ctx.actions.run( inputs = [], outputs = [odir], arguments = [], progress_message = "Converting", env = { "CDK8S_OUTDIR": odir.path, }, executable = ctx.executable.tool, ...
# # This file contains the Python code from Program 2.9 of # "Data Structures and Algorithms # with Object-Oriented Design Patterns in Python" # by Bruno R. Preiss. # # Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved. # # http://www.brpreiss.com/books/opus7/programs/pgm02_09.txt # def geometricSeries...
N, K = map(int, input().split()) a_list = list(map(int, input().split())) sum_list = [] for i in range(N): for j in range(i, N): sum_list.append(sum(a_list[i:j+1])) ans = 0 count = 0 tmp = [] for i in range(40, -1, -1): for s in sum_list: check_num = 1 << i logical_and = check_num & s ...
# Reads config/config.ini and performs sanity checks class Config(object): config = None def __init__(self, path='config/config.ini'): if not self.config: print("[WARNING] Loading placeholder config") # this has to be replaced by reading the actual .ini config file ...
''' Set data type lst = [varname, varname1, varname2] dictionary = { "key": "value", } ''' set = {"Item1", "Item2", "Item3"} print(set) # {'Item1', 'Item2', 'Item3'} # Sets do not care about the order # {'Item2', 'Item3', 'Item1'} # Sets do not care about the order s = {"Item1", "It...
""" gen123.py generate sequences from a base list, repeating each element one more time than the last. """ def gen123(m): #yield None n = 0 for item in m: n += 1 for i in range(n): yield item
class SlidingAverage: def __init__(self, window_size): self.index = 0 self.values = [0] * window_size def _previous(self): return self.values[(self.index + len(self.values) - 1) % len(self.values)] def update(self, value): self.values[self.index] = self._previous() + value ...
palavras = ('Doidera', 'Calipso', 'Yoda', 'Axt', 'Jovirone', 'Matilda', 'Schwarzenneger', 'Mustefaga', 'Instinct', 'Kobayashi', 'Ludgero', 'Salcicha', 'Scooby', 'Turtle', 'Lily', 'Toast') for palavra in palavras: print(f'Na palavra {palavra.upper()} temos ', end='') for c in range(0, len(palavra)): if p...
def specificSummator(): counter = 0 for i in range(0, 10000): if (i % 7) == 0: counter += i elif (i % 9) == 0: counter += i return counter print(specificSummator())
# WAP to accept a file from user and print shortest and longest line from that file. def PrintShortestLongestLines(inputFile): line = inputFile.readline() maxLine = line minLine = line while line != "": line = inputFile.readline() if line == "\n" or line == "": continue ...
# 로또의 최고순위와 최저순위 def solution(lottos, win_nums): correct = 0 zero_cnt = lottos.count(0) rank = {6:1,5:2,4:3,3:4,2:5,1:6,0:6} for number in lottos: if number != 0 and number in win_nums: correct += 1 return [rank[correct+zero_cnt],rank[correct]] ''' 테스트 1 〉 통과 (0.01ms, 10.2MB) 테...
# Much of the code in this file was ported from ev3dev-lang-python so we # are including the license for ev3dev-lang-python. # ----------------------------------------------------------------------------- # Copyright (c) 2015 Ralph Hempel # # Permission is hereby granted, free of charge, to any person obtaining a copy...
students = [] class Student: school_name = "Springfied Elementary" def __init__(self, name, student_id=332): self.name = name self.student_id = student_id students.append(self) def __str__(self): return "Student " + self.name def get_name_capitalize(self): r...
data_A = [1,2,3,6,7,8,9] data_B = [1,2,7,8] count = 0 for number1 in data_A: for number2 in data_B: if number1 == number2: print('{} is also appeared in {}'.format(number1,number2)) count += 1 else: pass print('There are only {} matching numbers between Data A and Data ...
class Solution(object): def rotate(self, matrix): """ :type m: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ m = matrix side = len(m) max_i = side - 1 for i in range(side // 2): y = i f...
# Publised to Explorer in private.py # Also used in measurement.py TEST_GROUPS = { "websites": ["web_connectivity"], "im": ["facebook_messenger", "signal", "telegram", "whatsapp"], "middlebox": ["http_invalid_request_line", "http_header_field_manipulation"], "performance": ["ndt", "dash"], "circumv...
# -*- coding: utf-8 -*- class VertexNotReachableException(Exception): """ Exception for vertex distance and path """ pass
class Node: def __init__(self, value): self.value = value self.l = None self.r = None class BinaryTree: def __init__(self): self.root = None def draw(self): '''Prints a preorder traversal of the tree''' self._draw(self.root) print() def _draw(se...
# 1, 2, 3, 4, 5, 6, 7, 8, 9 # 0, 1, 1, -1, -1, 2, 2, -2, -2 # 0, 0, 1, 1, -1, -1, 2, 2, -2, -2 def seq(n): a = (n - 1) // 2 b = (n + 1) // 4 if a % 2 == 0: return -b else: return b n = int(input()) x = seq(n + 1) y = seq(n) print(x, y)
# 参考大佬的代码 class Solution: def trap(self, heights: List[int]) -> int: # left是左边最高的高度 # right是右边最高的高度 left_max = right_max = water = 0 left, right = 0, len(heights) - 1 while left <= right: left_max, right_max = max(left_max, heights[left]), max(right_max, heights[r...
W = [] S = str(input('')) for i in S: if i not in W: W.append(i) if len(W) % 2 == 0: print('CHAT WITH HER!') else: print('IGNORE HIM!')
worldLists = { "desk": { "sets": ["desk"], "assume": ["des", "de"], }, "laptop": { "sets": ["laptop"], "assume": ["lapto", "lapt", "lap", "la"], }, "wall": { "sets": ["wall"], "assume": ["wal", "wa"] }, "sign": { "sets": [...
# Prova Mundo 02 # Rascunhos da Prova do Mundo 2 #Nota: 90% n = ' nilseia'.upper().strip()[0] print(n) for c in range(0, 10): print(c)
dnas = [ ['hY?9', 56, 25, 8.21, 47, 21, -2.56, {'ott_len': 43, 'ott_percent': 196, 'ott_bw': 124, 'tps_qty_index': 215}], ['st7M', 67, 43, 17.72, 55, 29, 5.52, {'ott_len': 49, 'ott_percent': 299, 'ott_bw': 84, 'tps_qty_index': 468}], ]
# This program contains a tuple stores the months of the year and # another tuple from it with just summer months # and prints out the summer months ine at a time. month = ("January", "February", "March", "April", "May", "June", "July", "August", "Septem...
default_players = { 'hungergames': [ ("Marvel", True), ("Glimmer", False), ("Cato", True), ("Clove", False), ("Foxface", False), ("Jason", True), ("Rue", False), ("Thresh", True), ("Peeta", True), ("Katniss", False) ], ...
""" 7510. 고급 수학 작성자: xCrypt0r 언어: Python 3 사용 메모리: 29,380 KB 소요 시간: 88 ms 해결 날짜: 2020년 9월 24일 """ def main(): for i in range(1, int(input()) + 1): a, b, c = sorted(map(int, input().split())) print('Scenario #{}:\n{}\n'.format(i, 'yes' if a ** 2 + b ** 2 == c ** 2 else 'no')) if __name__ == '__ma...
def main(): N, M = map(int,input().split()) for i in range(1,N,2): print(("." + "|.."*int((i-1)/2) + "|" + "..|"*int((i-1)/2) + ".").center(M,'-')) print("WELCOME".center(M,"-")) for i in range(N-2,-1,-2): print(("." + "|.."*int((i-1)/2) + "|" + "..|"*int((i-1)/2) + ".").center(M,'-')...
""" 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. Example 2: Input: s = "cbbd" Output: "bb" Example 3: Input: s = "a" Output: "a" Example 4: Input: s = "ac" Output: "a" Constraints: 1 <= s.length <= 1000 s cons...
#!/usr/bin/env python3 tls_cnt = 0 ssl_cnt = 0 with open("input.txt",'r') as f: for line in f: bracket = 0 tls_flag = 0 ABAs = [[],[]] for i in range(len(line)-2): if line[i] == '[': bracket = 1 elif line[i] == ']': bracket = 0 else: if line[i] == line[i+2] and line[i+1] not in "]": ...
"""This module defines Ubuntu Bionic dependencies.""" load("@rules_deb_packages//:deb_packages.bzl", "deb_packages") def ubuntu_bionic_amd64(): deb_packages( name = "ubuntu_bionic_amd64", arch = "amd64", packages = { "base-files": "pool/main/b/base-files/base-files_10.1ubuntu2....
# Configuration file for the Sphinx documentation builder. project = 'wwt_api_client' author = 'Peter K. G. Williams' copyright = '2019 ' + author release = '0.1.0dev0' extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode'...
class ConfigException(Exception): pass class AuthException(Exception): pass class AuthEngineFailedException(AuthException): pass class UnauthorizedAccountException(AuthException): pass class LockedUserException(UnauthorizedAccountException): pass class InvalidAuthEngineException(AuthExcept...
def tick(nums): """ Simulate one tick of passage of time nums is a list of timer counts of all fish """ # Iterate over a copy of nums as it will be modified within the loop for i, j in enumerate(nums[:]): if j == 0: nums[i] = 6 nums.append(8) else: ...
""" Copyright 2020 Tianshu AI Platform. All Rights Reserved. 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 ...
class Metadata: name: str def __init__(self, name: str): self.name = name def to_dict(self) -> dict: return { 'name': self.name, } class ConfigMap: metadata: Metadata data: dict apiVersion: str = 'v1' kind: str = 'ConfigMap' def __init__( ...
# Creating a class # Method 1 # class teddy: # quantity = 200 # print(teddy.quantity) # Method 2 class teddy: quantity = 200 quality = 90 obteddy = teddy() print(obteddy.quality) print(obteddy.quantity)
# -*- coding: utf-8 -*- """ Created on Tue Oct 9 20:09:13 2018 @author: JinJheng """ a=input() b=input() c=input() d=input() print('|%10s %10s|' %(a,b)) print('|%10s %10s|' %(c,d)) print('|%-10s %-10s|' %(a,b)) print('|%-10s %-10s|' %(c,d))
num = 10 num = 20 num = 30 num = 40 num = 50 num = 66 num = 60 num = 70
def create_HMM(switch_prob=0.1, noise_level=1e-1, startprob=[1.0, 0.0]): """Create an HMM with binary state variable and 1D Gaussian measurements The probability to switch to the other state is `switch_prob`. Two measurement models have mean 1.0 and -1.0 respectively. `noise_level` specifies the standard devia...
#!/usr/bin/env python3 def find_distance(matrix, key): """Find the distance of the nearest key for each cell """ if not matrix or not matrix[0]: return matrix rows, cols = len(matrix), len(matrix[0]) delta = [(-1, 0), (1, 0), (0, -1), (0, 1)] def shortest(matrix, row, col, key): ...
""" Utilities for the :class:`~django_mri.analysis.interfaces.fmriprep.fmriprep.FmriPrep` interface. """ #: Command line template to format for execution. COMMAND = "singularity run -e {security_options} -B {bids_parent}:/work,{destination_parent}:/output,{freesurfer_license}:/fs_license {singularity_image_root}/fmrip...
val = open('val.txt', encoding='UTF-8') out = open('out.txt', encoding='UTF-8') t = val.readline() a = out.readline() sum = 0 right = 0 while t and a: error = [] t = t.strip() a = a.strip() for i in range(len(t)): sum += 1 if t[i] == a[i]: right += 1 else: ...
#!/usr/bin/env python3 @app.route('/api/v1/weight', methods=['GET']) def weight_v1(): conn = None try: params = config() conn = psycopg2.connect(**params) cur = conn.cursor(cursor_factory = psycopg2.extras.DictCursor) cur.execute("""SELECT * FROM weights WHERE child...
URL_FANTOIR = ( "https://www.collectivites-locales.gouv.fr/competences/la-mise-disposition-gratuite-du-fichier-des-" "voies-et-des-lieux-dits-fantoir" ) URL_DOCUMENTATION = "https://docs.3liz.org/QgisCadastrePlugin/"
class JavascriptDebugRenderer: def __init__(self, debugger): self.debugger = debugger def render(self, meta=None): data = {} if meta is None: meta = [] for name, collector in self.debugger.collectors.items(): data.update({collector.name: collector.collec...
n = int(input('digite um numero: ')) if n%2 == 0: print('PAR') else: print('IMPAR')
#Factorial Number Calc num = int(input("Digite um número inteiro positivo para fazer o fatorial: ")) resultado = 1 nTemp = 1 if num < 0: #Colocar outro while print("! Por Favor, digite um número positivo maior que 0 !") elif num == 1 and num == 0: print("O Fatorial de ", num, " é -> 1") else: while( nT...
# -*- coding: utf-8 -*- """ File Name: reversePairs Author : jing Date: 2020/4/24 https://leetcode-cn.com/problems/shu-zu-zhong-de-ni-xu-dui-lcof/ 逆序对 """ class Solution: def reversePairs(self, nums) -> int: """ 小到大排序,每次取最小的,那么它在原list中的位置就代表的它前面有多少个比他大的 然后删除掉...
''' You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins. Given n, find the total number of full staircase rows that can be formed. n is a non-negative integer and fits within the range of a 32-bit signed integer. Example 1: n = 5 The coins can form...
ir_licenses = { 'names': { 'P': 'Pro', 'A': 'Class A', 'B': 'Class B', 'C': 'Class C', 'D': 'Class D', 'R': 'Rookie' }, 'bg_colors': { 'P': '#000000', 'A': '#0153DB', 'B': '#00C702', 'C': '#FEEC04', 'D': '#FC8A27', ...
pkg_dnf = { 'nfs-utils': {}, 'libnfsidmap': {}, } svc_systemd = { 'nfs-server': { 'needs': ['pkg_dnf:nfs-utils'], }, 'rpcbind': { 'needs': ['pkg_dnf:nfs-utils'], }, 'rpc-statd': { 'needs': ['pkg_dnf:nfs-utils'], }, 'nfs-idmapd': { 'needs': ['pkg_dnf:n...
class Solution(object): def multiply(self, A, B): """ :type A: List[List[int]] :type B: List[List[int]] :rtype: List[List[int]] """ m, q, n = len(A), len(B), len(B[0]) # C = [[0] * n] * m C = [[0] * n for _ in range(m)] for i in range(m): ...
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ # Write your code here n, q = map(int, input().strip().split()) a ...
# FIXME need to figure generation of bytecode class Scenario: STAGES = [ {"name": "install", "path": "build/{version}/cast_to_short-{version}.cap",}, { "name": "send", "comment": "READMEM APDU", "payload": "0xA0 0xB0 0x01 0x00 0x00", "optional": False,...
class SalesforceRouter(object): """ A router to control all database operations on models in the salesforce application. """ def db_for_read(self, model, **hints): """ Attempts to read salesforce models go to salesforce. """ if model._meta.app_label == 'salesforce': ...
class Solution: def calPoints(self, ops: List[str]) -> int: arr = [] for op in ops: #print(arr) if op.isdigit() or op[0] == '-': arr.append(int(op)) elif op == 'C' and arr: arr.pop() elif op == 'D' and arr: ...
# 153. Find Minimum in Rotated Sorted Array class Solution(object): global find_min_helper def find_min_helper(nums,left,right): # base case: if left >= right, return the first element if left >= right: return nums[0] # get middle element mid = (left+right)/2 ...
#Exercício070 total = 0 maisdemil = 0 contador = 0 barato = 0 nomebarato = '' print('\033[31m--------------------------') print('\033[32m>>>>>ATACADÃO DO M0Z1<<<<<') print('\033[31m--------------------------') while True: #Realiza a repetição para continuar cadastrando produtos produto = str(input('\033[32mNome do ...
# Configuration file for ipython. #------------------------------------------------------------------------------ # InteractiveShellApp(Configurable) configuration #------------------------------------------------------------------------------ ## lines of code to run at IPython startup. c.InteractiveShellApp.exec_lin...
#!/usr/bin/env python3 size_of_grp = 5 inp_list = "1 2 3 6 5 4 4 2 5 3 6 1 6 5 3 2 4 1 2 5 1 4 3 6 8 4 3 1 5 6 2".split() set_l = set(inp_list) cap_room = "" for element in set_l: inp_list.remove(element) if not element in inp_list: cap_room = element break print(int(cap_room))
class InferErr(Exception): def __init__(self, e): self.code = 1 self.message = "Inference Error" super().__init__(self.message, str(e)) def MiB(val): return val * 1 << 20 def GiB(val): return val * 1 << 30 class HostDeviceMem(object): def __init__(self, host...
GPU_ID = 0 BATCH_SIZE = 64 VAL_BATCH_SIZE = 100 NUM_OUTPUT_UNITS = 3000 # This is the answer vocabulary size MAX_WORDS_IN_QUESTION = 15 MAX_WORDS_IN_EXP = 36 MAX_ITERATIONS = 50000 PRINT_INTERVAL = 100 # what data to use for training TRAIN_DATA_SPLITS = 'train' # what data to use for the vocabulary QUESTION_VOCAB_SP...
""" The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? """ def largest_prime_factor(): i = 2 lst = [] number = 600851475143 while i != number: if number % i == 0: lst.append(i) number /= i i = 2 ...
state_dict = {} aug_dict = {} oneof_dict = {} def clear_dict(state): skey = 'session' if skey not in list(state_dict.keys()) or state != state_dict[skey]: state_dict.clear() state_dict.update({'session': state}) aug_dict.clear()
def reduce_to_one_dividing_by_one_or_pm_one(n): """ Given n this function computes the minimum number of operations 1. Divide by 2 when even 2. Add or subtract 1 when odd to reduce n to 1. The n input is supposed to be a string containing the decimal representation of the actual num...
# Given an array, cyclically rotate the array clockwise by one. def rotateCyclic(a): start = 0 end = 1 while(end != len(a)): temp = a[start] a[start] = a[end] a[end] = temp end += 1 a = [1,2,3,4,5,6] rotateCyclic(a) print(a)
""" You are given two arrays a1,a2,…,an and b1,b2,…,bn. In each step, you can set ai=ai−bi if ai≥bi. Determine the minimum number of steps that are required to make all a's equal. Input format First line: n Second line: a1,a2,…,an Third line: b1,b2,…,bn Output format Print the minimum number of steps that a...
# -*- coding: utf-8 -*- # Aprimore a classe do exercício anterior para adicionar o método aumentarSalario (porcentualDeAumento) # que aumente o salário do funcionário em uma certa porcentagem. class Funcionario(object): def __init__(self, nome, salario): self.nome = nome.title() self.salario = sa...
'''Leia o nome completo de uma pessoa e mostre: O nome com todas as letras maiúsculas O nome com todas as letras minusculas Quantas letras ao todo, sem considerar os espaços Quantas letras tem o primeiro nome''' nome = str(input('Escreva seu nome: ')).strip() print(nome.upper()) print(nome.lower()) print(len(nome) - no...
s = 'hello world' y =[] for i in s.split(' '): x=i[0].upper() + i[1:] y.append(x) z= ' '.join(y) print(z)
def removeTheLoop(head): ##Your code here if detectloop(head)==0: return one=head two=head while(one and two and two.next): one=one.next two=two.next.next #print(one.data,two.data) if one==two: f=one break #print(f.data) ...
#!usr/bin/env python3 def main(): print('Reading text files') f = open('lines.txt') # open returns a file object, that's an iterator. by default it opens in read & text mode for line in f: print(line.rstrip()) # Return a copy of the string with trailing whitespace removed print('\nWriting t...
def mcd(a, b): if a > b: small = b else: small = a for i in range(1, small+1): if((a % i == 0) and (b % i == 0)): mcd1 = i return mcd1 a = int(input("intrduzca un numero:")) b = int(input("intrduzca un segundo numero:")) print ("The mcd is : ",end="...
""" entradas cantidadmetros-->m-->float salidas metrosapulgadas-->pu-->float mmetrosapies-->pi-->float """ #entradas m=float(input("Ingrese la cantidad de metros: ")) #caja negra pu=round((m*39.27), 2) pi=round((pu/12), 2) #salidas print(m, " metros equivalen a ", pu, " pulgadas y ", pi, " pies")
# MenuTitle: Display all kerning group members # -*- coding: utf-8 -*- __doc__ = """ Opens a tab containing all the members of the currently selected glyphs kerning groups. """ Glyphs.clearLog() # Glyphs.showMacroWindow() lefts = dict((g.parent.leftKerningGroup, []) for g in Glyphs.font.selectedLayers if g.parent.lef...