content
stringlengths
7
1.05M
# python3.5/win10 # -*- coding:utf-8 -*- ''' 元音字母 有:a,e,i,o,u五个, 写一个函数,交换字符串的元音字符位置。 假设,一个字符串中只有二个不同的元音字符。 二个测试用例: 输入 apple 输出 eppla 输入machin 输出 michan 不符合要求的字符串,输出None,比如: 输入 abca (两个元音相同) 输出 None 输入 abicod (有三个元音) 输入None ''' ''' 分析题目: 1.字符串有3个以上元音就None 2.字符串有2个相同元音就None 3.字符串没有元音输出None 4.元音数为2且是不同的元音才交换 ''' d...
##rotational constant in ground state in wavenumbers B_dict = {'O2': 1.4297, 'N2': 1.99, 'N2O': 0.4190, 'CO2': 0.3902, 'D2': 30.442, 'OCS': .2039} ##Centrifugal Distortion in ground state in wavenumbers D_dict = {'O2': 4.839e-6, 'N2': 5.7e-6, 'N2O': 0.176e-6, 'CO2': 0.135e-6, 'D2': 0, 'OCS': 0...
with open("haiku.txt", "a") as file: file.write("APPENDING LATER!") with open("haiku.txt") as file: data = file.read() print(data) with open("haiku.txt", "r+") as file: file.write("\nADDED USING r+") file.seek(20) file.write(":)") data = file.read() print(data)
GOOD_MORNING="Good Morning, %s" GOOD_AFTERNOON="Good Afternoon, %s" GOOD_EVENING="Good Evening, %s" DEFAULT_MESSAGE="Hello, World! %s" MESSAGE_REFRESH_RATE = 3600000 # 1 hour MESSAGE_TEXT_SIZE = 70
#!/usr/bin/env python # -*- coding=utf-8 -*- count = 0 while(count < 9): print('the index is :', count) count += 1 """输出结果 the index is : 0 the index is : 1 the index is : 2 the index is : 3 the index is : 4 the index is : 5 the index is : 6 the index is : 7 the index is : 8 """
# This is created from Notebook++ print("Hello, I am SKL") print("Welcome to my learning space")
#Reading lines from file and putting in a list contents = [] for line in open('rosalind_ini5.txt', 'r').readlines(): contents.append(line.strip('\n')) #Printing the even numbered lines, starting by one for i in range(1, len(contents), 2): print(contents[i])
class BaseUrlNotDefined(Exception): pass class InvalidCurrencyCode(Exception): pass class InvalidDate(Exception): pass class InvalidAmount(Exception): pass class APICallError(Exception): pass class HelperNotDefined(Exception): pass
## Escreva um programa que converta uma temperatura digitando em graus Celsius e converta para graus Fahrenheit.## c = float(input('Informe a temperatura em C:')) f = 9 * c / 5 +32 print('A temperatura em {}C corresponde a {}F!'.format(c,f))
# Copyright (c) 2018, EPFL/Human Brain Project PCO # # 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 applic...
#Άσκηση 6.2: Έλεγχος αρχείου εικόνας checkType = [] try : with open('imag', 'rb') as binfile: data = binfile.read() bdata = bytearray(data) for i in range(3): print(i+1, 'byte||', 'hexadecimal:', hex(bdata[i]), 'decimal:', int(str(hex(bdata[i])), 16) ) ...
def iguais (l1,l2): same=0 for i in range (len(l1)): if l1[i]==l2[i]: same += 1 return same testea=[1,5,6,3,2,4,8,9,6,5,3,7,5,6,4,8,3,2,5,6,4,5,4,8,9,9] testeb=[5,4,6,9,8,7,5,5,3,2,1,4,6,5,7,8,9,6,3,2,1,4,5,6,9,8] print(iguais(testea,testeb))
# Conversor de temperaturas c = float(input('Digite um valor em °C :')) f = 9 * c / 5 + 32 print('A temperatura em {}ºC corresponde a {}ºF'.format(c, f))
# coding:utf-8 note = ["螽斯羽,诜诜兮。宜尔子孙,振振兮", "天接云涛连晓雾,星河欲转千帆舞", "噫吁戏,危乎高哉", "人成各,今非昨,病魂常似秋千索", "枯藤老树昏鸦,小桥流水人家", "山一程,水一程,身向榆关那畔行。故园无此声", "说什么黄泉无店宿忠魂,争道这青山有幸埋芳洁" ] class NoteModel: def get_note(self, n): try: v = note[n] except Inde...
name = 'TaskKit' version = ('X', 'Y', 0) docs = [ {'name': "Quick Start", 'file': 'QuickStart.html'}, {'name': "User's Guide", 'file': 'UsersGuide.html'}, {'name': 'To Do', 'file': 'TODO.text'}, ] status = 'stable' requiredPyVersion = (2, 6, 0) synopsis = """TaskKit provides a framework for the...
#!/usr/bin/env python3 a = int(input()) b = int(input()) if a // 2 == b or (3 * a) + 1 == b: print("yes") else: print("no")
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class DeviceTreePartitionSlice(object): """Implementation of the 'DeviceTree_PartitionSlice' model. TODO: type model description here. Attributes: disk_file_name (string): The disk to use. length (long|int): The length of data for t...
class Cell(): def __init__(self): self.touched = False self.has_mine = False self.marked = False self.value = 0 def _place_mine(self): self.has_mine = True def touch(self): if not self.marked: self.touched = True return self.has_mine ...
# # PySNMP MIB module RUCKUS-VF2825-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RUCKUS-VF2825-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:50:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
# Created by MechAviv # ID :: [865090001] # Commerci Republic : Berry if sm.hasQuest(17613): # [Commerci Republic] The Minister's Son sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.setStandAloneMode(True) sm.setSpeakerID(9390241) sm.rem...
class Solution: def totalMoney(self, n: int) -> int: s, m, p, t = 0, 0, 0, 0 while t < n: if t % 7 == 0: m += 1 s += m p = m else: p += 1 s += p t += 1 return s
SIG_START_DEFAULT = 0 SIG_UNDEF = 'undefined' class Signal(object): def __init__(self, name, start_state=None): self.name = name if start_state is not None: self.state = start_state else: self.state = SIG_START_DEFAULT self.previous = self.state self...
class Solution: def replaceWords(self, dict, sentence): """ :type dict: List[str] :type sentence: str :rtype: str """ s = set(dict) sentence = sentence.split() for j, w in enumerate(sentence): for i in range(1, len(w)): if w...
a = float(input('Quantos km é sua viagem?')) print('Sua viagem é de {} km' .format(a)) if a > 200: print('O preço de sua viagem é R${}'.format((a) * 0.45)) else: print('O preço de sua viagem é R${}'.format((a)* 0.50))
# # PySNMP MIB module DE-OPT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DE-OPT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:21:56 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, 09:...
# Ingredient Adjuster # Ask user how many cookies he or she wants cookie = int(input("Enter the amount of cookies you want: ")) sugar = 1.5 oil = 1 pounder = 2.75 print(sugar * cookie, ' gr. sugar.\n', oil * cookie, ' gr. butter.\n', pounder * cookie, ' gr. flour.', sep="")
# -*- coding: utf-8 -*- # @Author : LG """ 执行用时:60 ms, 在所有 Python3 提交中击败了86.96% 的用户 内存消耗:15.2 MB, 在所有 Python3 提交中击败了85.68% 的用户 解题思路: 递归 """ """ # Definition for a Node. class Node: def __init__(self, val=None, children=None): self.val = val self.children = children """ class Solution: de...
""" EXAMPLE USAGE: opts = Opts(environ, opt('q', default=''), opt('pages', default=2), opt('split', default=0), opt('simple', default=0), opt('max_topics', default=40), opt('ncol', default=3), opt('save', default=False), opt('load', default=False), opt('smoothing...
# Advent of Code 2021, Day 17 # # Simple projectile simulation, with search for # velocities that achieve highest position, and total # number of possible velocity values that reach target # area; just used a simple grid search. # # AK, 17/12/2021 # Target area (x range and y range) T = ((20,30), (-10, -5)) # Samp...
# Criação de Classe pai Pessoa com atributos nome e sobrenome. class Pessoa: # Metodo construtor vazio para criação de instancias vazias. def __init__(self): super().__init__() pass # GetNome para retornar o valor de nome. def getNome(self): return self._nome # SetNo...
class Person(object): def __init__(self, name, age): self.name=name self.age=age def get_person(self,): return "Hi" print("hi")
class Book: def __init__(self, title, price, author): self.title = title self.author = author self.price = price def __eq__(self, other): if not isinstance(other,Book): raise ValueError("Couldn't compare book to non-book") return (self.title == other.title an...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012, Piston Cloud Computing, Inc. # 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/li...
''' Example 1: Input: N = 5, arr = {1, 2, 3, 2, 1} Output: 3 Explaination: Only the number 3 is single. Example 2: Input: N = 11, arr = {1, 2, 3, 5, 3, 2, 1, 4, 5, 6, 6} Output: 4 Explaination: 4 is the only single. ''' class Solution: def findSingle(self, N, arr): # code here m...
class RecordNotFound(Exception): pass class InvalidLEI(Exception): pass class InvalidISIN(Exception): pass class NotFound(Exception): pass
N=int(input("Ingresa un numero base pls:")) M=int(input("Ingresa una potencia pls:")) print("LOS RESULTADOS SON:") for i in range(0,M+1): print(f"{N}^{i} = " + str(N**i))
def main(): print("Please enter filename:") filename = input() f = open('..\\src\\main\\resources\\assets\\forbidden\\models\\item\\' + filename + '.json', mode='xt') f.write('{\n') f.write(' "parent": "forbidden:item/base_item",\n') f.write(' "textures": {\n') f.write(' "layer0": "for...
#show function logs all attempts on console and in out.txt file out = open("out.txt", 'w+') def show(line): li = "" for i in line: for j in i: li += str(j) + " " li += "\n" print(li) out.write(li) out.write("\n")
print() print("-- RELATIONS ------------------------------") print() print("GRAPH 1:\n0 0 0\n0 0 0\n0 0 0") g1 = Graph(3) print("REFLEXIVITA: " + str(is_reflexive(g1)) + " -> spravna odpoved: False") print("SYMETRIE: " + str(is_symmetric(g1)) + " -> spravna odpoved: True") print("ANTISYMETRIE: " + str(is...
# Some utility classes to represent a PDB structure class Atom: """ A simple class for an amino acid residue """ def __init__(self, type): self.type = type self.coords = (0.0, 0.0, 0.0) # Overload the __repr__ operator to make printing simpler. def __repr__(self): ret...
class _elastica_numpy: """The purpose is to throw deprecation error to people previously using _elastica_numpy module. Please remove this exception after v0.3.""" raise ImportError("The module _elastica_numpy is now deprecated.")
# Task 03. Statistics def add_to_dict(product: str, quantity: int): if product not in stock: stock[product] = quantity else: stock[product] += quantity cmd = input() stock = {} while not cmd == "statistics": key = cmd.split(': ')[0] value = cmd.split(': ')[1] add_to_dict(key, int(...
''' This problem was asked by Stripe. Given an array of integers, find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well. For example, the input [3, 4, -1...
#Main class class Characters: def __init__(self, name, lastname, age, hp, title, language, race, weakness ): # instance variable unique to each instance ...
n = int(input()) b = list(map(int, input().split(' '))) x = [0] a = [] a.append(b[0]) x.append(a[0]) i = 1 while i < n: a.append(b[i]+x[i]) if a[i] > x[i]: x.append(a[i]) else: x.append(x[i]) i += 1 str_a = [str(ele) for ele in a] print(' '.join(str_a))
class Production(object): def analyze(self, world): """Implement your analyzer here.""" def interpret(self, world): """Implement your interpreter here.""" class FuncCall(Production): def __init__(self, token, params): self.name = token[1] self.params = params self....
""" A name to avoid typosquating pytest-foward-compatibility """ __version__ = "0.1.0"
class Config: DEBUG = False SQLURI = 'postgres://tarek:xxx@localhost/db' """ >>> from flask import Flask >>> app = Flask(__name__) ...
'''Try It Yourself''' '''6-1. Person: Use a dictionary to store information about a person you know. Store their first name, last name, age, and the city in which they live. You should have keys such as first_name, last_name, age, and city. Print each piece of information stored in your dictionary.''' person = {'nombre...
#Python Program to find the sum of series: 1 + 1/2 + 1/3 + ….. + 1/N. """"Problem Solution 1. Take in the number of terms to find the sum of the series for. 2. Initialize the sum variable to 0. 3. Use a for loop ranging from 1 to the number and find the sum of the series. 4. Print the sum of the series after round...
class Solution: """ @param s: A string @return: the length of last word """ def lengthOfLastWord(self, s): return len(s.strip().split(" ")[-1])
""" This shows that Lists and Dictionaries are different """ listfootball=['messi','inesta','pique','sanchez','suarez','neymar'] listbuzzfeed=['eugene','ashley','keith','ella','sara','chris'] """ This will return false """ print(listbuzzfeed==listfootball) dictfootball={'name':'lionel','age':'26','country':'argentina...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' The MIT License (MIT) Copyright (c) 2016 Yuma.M Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitatio...
""" ......................Static................................... class Bank(): @staticmethod def Banking(Attr): print("Welcome to Banking") print("It is Static Method") print("Pass Attribute :",Attr) BB=Bank() BB.Banking("Citi") BB.Banking("BOA") .........................GarbageColl...
""" # The data in these tables were mostly sourced from Free60 and various forums and tools. # In particular the tool Le Fluffie was helpful # Some data has been verified, some changed and some has yet to be used. """ class STFSHashInfo(object): """ Whether the block represented by the BlockHashRecord is used, fr...
def valida(digitos): # digitos = [4,5,7,5,0,8,0,0,0] # digitos = [11] * 9 i = 1 soma = 0 for x in digitos: soma = soma +(i * x) i += 1 return bool( soma % 11 == 0) print(valida(1))
{ "targets": [{ "target_name": "OpenSSL_EVP_BytesToKey", "sources": [ "./test/main.cc", ], "cflags": [ "-Wall", "-Wno-maybe-uninitialized", "-Wno-uninitialized", "-Wno-unused-function", "-Wextra" ], "cflags_cc+": [ "-std=c++0x" ], "include_dirs...
class Car: """Unit under test.""" def __init__(self, speed): self.speed = speed def getSpeed(self): return self.speed def brake(self): self.speed = 0
def catalan_number(n): nm = dm = 1 for k in range(2, n+1): nm, dm = ( nm*(n+k), dm*k ) return nm/dm print([catalan_number(n) for n in range(1, 16)]) [1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845]
"""Shows options""" def show_options(): options = ["\nYour options are below.", "\nEnter: '<rooms>' to show a list of rooms", "\nEnter: '<create> room_name' to create a room and assign it a name.", "\nEnter: '<join> room_name' to join an existing chat room.", ...
prato = 5 pilha = list(range(1,prato + 1)) while True: print(' existem %d pratos na pilha '%len(pilha)) print('''pilha atual = {} digite E para adicionar um novo prato a pilha, ou D para lavar um prato. S para sair''') op = str(input('qual operaçao você deseja :'.format(pilha))).upper() if op =...
def test(): assert ( "doc1.similarity(doc2)" or "doc2.similarity(doc1)" in __solution__ ), "Você está comparando a similaridade entre os dois documentos?" assert ( 0 <= float(similarity) <= 1 ), "O valor da similaridade deve ser um número de ponto flutuante. Você fez este cálculo correta...
""" link: https://leetcode-cn.com/problems/design-snake-game problem: 模拟贪吃蛇游戏。 solution: 模拟。双端队列 + 哈希表,维护当前贪吃蛇所占的位置。 """ class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): self.foods = food self.score = 0 self.w = width self.h = height s...
"""Constants for pyskyqremote- DE.""" SCHEDULE_URL = "https://www.sky.de/sgtvg/service/getBroadcasts" LIVE_IMAGE_URL = "https://www.sky.de{0}" PVR_IMAGE_URL = "https://www.sky.de{0}" CHANNEL_IMAGE_URL = "https://www.sky.de{0}" TIMEZONE = "Europe/Berlin" CHANNEL_URL = "https://raw.githubusercontent.com/RogerSelwyn/skyq...
# 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,...
NAME = 'weather.py' ORIGINAL_AUTHORS = [ 'Gabriele Ron' ] ABOUT = ''' A plugin to get the weather of a location ''' COMMANDS = ''' >>> .weather <city> <country code> returns the weather ''' WEBSITE = ''
class Node: def __init__(self, value): self.value = value self.next = None class LinkList: def __init__(self, value): node = Node(value) self.head = node self.tail = node self.length = 1 def append(self, value): node = Node(value) if self.le...
class node: def __init__(self,val): self.val = val self.next = None self.prev = None class mylinkedlist: def __init__(self): self.head = None self.tail = None self.size = 0 def get(self,index): if index < 0 or index >= self.size: ...
#declaring variable as string phrase = str(input('Type a phrase: ')) #saving the phrase in lowercase phrase = phrase.lower() #presenting amount of lettters 'a' print('Amount of letters "a": ', phrase.count('a')) #presenting the position of firt 'a' print('Firt "A" in position: ', phrase.find('a')) #presenting the posi...
# listas ficam entre [] # listas podem ser MUTÁVEIS # lista.append(x) -- inclui o elemento 'x' ao final da lista previamente preenchida # lista.insert(0, x) -- o elemento 'x' é incluído na posição indicada '0' (e não ao final da lista), empurrando os demais elementos para frente. Sempre recebe DOIS VALORES. # del lista...
{ "targets": [ { "target_name": "json", "product_name": "json", "variables": { "json_dir%": "../" }, 'cflags!': [ '-fno-exceptions' ], 'cflags_cc!': [ '-fno-exceptions' ], 'conditions': [ ['OS=="m...
todos = [] impar = [] par = [] while True: todos.append(int(input('Digite um valor: '))) soun = str(input('Quer adicionar mais ? [S/N] ')).strip()[0] if soun in 'Nn': break for n in todos: if n % 2 == 0: par.append(n) for v in todos: if v % 2 != 0: impar.append(v) print('=' *...
class Solution(object): def countAndSay(self, n): """ :type n: int :rtype: str """ num = "1" for _ in range(1, n): digit = num[0] count = 1 newNum = "" for j in range(1, len(num)): if nu...
def print_formatted(N): width = len(bin(N)[2:]) for i in range(1, N + 1): print(' '.join(map(lambda x: x.rjust(width), [str(i), oct(i)[2:], hex(i)[2:].upper(), bin(i)[2:]]))) if __name__ == '__main__': n = int(input()) print_formatted(n)
class File: def __init__(self, hash, realName, extension, url): self.hash = hash self.realName = realName self.extension = extension self.url = url @staticmethod def from_DB(record): return File(record[0], record[1], record[2], record[3])
""" This module contains the utility functions for the main module. """ def request_type(request): """ If the request is for multiple addresses, build a str with separator """ if isinstance(request, list): # If the list is ints convert to string. to_string = ''.join(str(e) for e in request) ...
class TicTacToe: def __init__(self) -> None: """ Create TicTacToe Game logic """ self.tic_board = [[" ", " ", " "], [" ", " ", " "], [" ", " ", " "]] self.turn = True def play(self, x: int, y: int) -> bool: ...
class Node(object): def __init__(self, value, parent=None): self.value = value self.parent = parent def __eq__(self, other): if isinstance(other, Node): return self.value == other.value return NotImplemented def __ne__(self, other): return not self.__eq_...
''' 调用三个函数一个用来计算Y列表中最大的数最小的数第二个用来计算x列表中最大的数字和最小的数字第三个用来将y和x列表中的最大最小的数字打印出来 ''' def my_max(a): maxa = 3 for b in a: if b > maxa: maxa = b return maxa def my_min(a): mina = 100 for s in a: if s < mina: mina = s return mina def my_print(maxa, mina): pri...
class Vertex: def __init__(self, id): self.id = id self.edges = set() def outgoing_edges(self): for edge in self.edges: successor = edge.get_successor(self) if successor is not None: yield edge
''' Autor: Pedro Augusto Fatec Ferraz Objetivo: Estrutura de ifs encadeados para encontrar o mês a partir de um número ''' nmr_mes = int(input("Digite um número entre 1 e 12: ")) # deve se entrar com um valor entre 1 e 12 if nmr_mes > 0 and nmr_mes <= 12: # Com o operador end, podemos concatenar o valor ...
num = (int(input('Digite um numero: '))) tot = 0 for c in range(0, num): if num % (c + 1) == 0: print('\033[33m', end= ' ') tot = tot + 1 else: print('\033[31m', end= ' ') print(c + 1, end ='') print('', end= '\n') print('\033[mO numero {} foi divisivel {} vezes\033[m'.format(num, t...
""" Test cases for micro-grid systems The following systems are considered 1. AC micro-grid 2. DC micro-grid 3. Hybrid AC/DC micro-grid """
# -*- coding: UTF-8 -*- light = input('input a light') if light == 'red': print('GoGoGO') elif light == 'green': print('stop')
# # LogicalDOCServer.py # # Copyright 2021 Yuichi Yoshii # 吉井雄一 @ 吉井産業 you.65535.kir@gmail.com # # 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/LICE...
''' Resources/other/contact _______________________ Contact information for XL Discoverer. :copyright: (c) 2015 The Regents of the University of California. :license: GNU GPL, see licenses/GNU GPLv3.txt for more details. ''' __all__ = [ 'AUTHOR', 'AUTHOR_EMAIL', 'MAINTAINER', 'MAI...
# -* coding: utf-8 -*- """Numerical polynomial and multivariate polynomial library.""" __version__ = '0.0.1.dev0'
# Binary Tree Level Order Traversal - Breadth First Search 1 # Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level). class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left ...
# ---------- Model Setting ---------- # model = dict( type='ImageClassifier', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(3, ), style='pytorch', # frozen_stages=2, # 冻结前两层参数 init_cfg=dict( type='Pretrained', ...
# Seasons.py -- Hass helper python_script to turn a Climate entity into a smart # thermostat, with support for multiple thermostats each having their own # schedule. # # INPUTS: # * climate_unit (required): The Climate entity to be controlled # * global_mode (required): an entity whose state is the desired global clima...
# -------------- # Code starts here class_1=['Geoffrey Hinton','Andrew Ng','Sebastian Raschka','Yoshua Bengio'] class_2=['Hilary Mason','Carla Gentry','Corinna Cortes'] new_class= class_1 + class_2 print(new_class) new_class.append('Peter Warden') print(new_class) new_class.remove('Carla Gentry') print(new_class) # ...
a = 3 b = 5 print('Os valores são \033[32;44m{}\033[m e \033[31;44m{}\033[m!!!'.format(a, b))
# Init conventions for input generation ROT_DIR_REF = -1 CURRENT_DIR_REF = -1 PHASE_DIR_REF = -1 class InputError(Exception): """Raised when the input data are incomplete or incorrect""" pass
def join_bash_scripts(scripts): """ have the option of creating a wrapper script for every group of bash files to be run, or just join them on the fly. """ if len(scripts) < 2: raise NotImplementedError output_script = scripts[0] for script in scripts[1:]: output_script = ...
def cria(linhas, colunas): return {'linhas': linhas, 'colunas': colunas, 'dados': {}} #[[0,3],[1,2]] def criaLst(matriz_lst): linhas = len(matriz_lst) #2 colunas = len(matriz_lst[0]) #2 dados = {} #{(0,1): 3, (1,0):1, (1,1):2} for i in range(linhas): for j in range(colunas): if...
# -*- coding: utf-8 -*- def main(): n, l = list(map(int, input().split())) s = input() tab_count = 1 crash_count = 0 for si in s: if si == '+': tab_count += 1 else: tab_count -= 1 if tab_count > l: crash_count += 1 ...
#Autor Manuela Garcia Monsalve # 28 septiembre 2018 #Esta es la super clase Vehiculo donde se encuentran los atributos de marca, modelo y color que seran #heredados para las subclases class Vehiculo(): def __init__(self,marca,color, modelo): #Se generan los atributos para poder ser heredados self.marca = ...
widget_types = [ "textinput", # Editable text input box "textupdate", # Read only text update "led", # On/Off LED indicator "combo", # Select from a number of choice values "icon", # This field gives the URL for an icon for the whole Block "group", # Group node in a TreeView that other fie...
""" 17 Cupboards - https://codeforces.com/problemset/problem/248/A """ n = int(input()) nL, nR = 0, 0 for _ in range(n): x, y = map(int, input().split()) nL += x nR += y print(min(nL, n - nL) + min(nR, n - nR))
def cookie(x): if isinstance(x, str): cookie_eater = "Zach" elif isinstance(x, int) or isinstance(x, float): cookie_eater = "Monica" else: cookie_eater = "the dog" if x == True or x == False: cookie_eater = "the dog" return "Who ate the last cookie? It was %s!" % cookie_eater print(cookie("Ryan...