content
stringlengths
7
1.05M
"""Faça um programa que pergunte o preço de três produtos e Informe qual produto você deve comprar, sabendo que a decisão é sempre pelo mais barato """ preco1 = int(input('Informe o primeiro preco: ')) preco2 = int(input('Informe o segundo preco: ')) preco3 = int(input('Informe o terceiro preco: ')) if preco1 == pre...
class CDCAbstract: def __init__(self, username, pw, headless=False): self.username = username self.password = pw self.headless = headless # vars (practical) self.available_days_practical = [] self.available_days_in_view_practical = [] self.available_times_pr...
'''OrderState data structure.''' __copyright__ = "Copyright (c) 2008 Kevin J Bluck" __version__ = "$Id$" class OrderState(object): '''Data structure containing attributes to describe the status of an order. ''' def __init__(self, status="", init_margin="", maint_margin="", equity_with_loan="", ...
class Token: def __init__(self, token, start_pos=-1, action="", change_seq=0): self._token = token self._start_pos = start_pos self._action = action self._change_seq = change_seq @property def start_pos(self): return self._start_pos @start_pos.setter def sta...
class Solution(object): def rotatedDigits(self, N): """ :type N: int :rtype: int """ res = 0 vs = set([2, 5, 6, 9]) ivs = set([3, 4, 7]) for n in range(2, N + 1): v, iv = False, False while n > 0: a = n % 10 ...
#!/usr/bin/env python3 class Solution: def getRow(self, rowIndex): ret, numer, denom = [1], 1, 1 for i in range(0, rowIndex): numer *= (rowIndex-i) denom *= (1+i) ret.append(numer//denom) return ret sol = Solution() for i in range(10): print(sol.getR...
counter = 0 arr = [] while counter != 3: ss = input("Shop stock: ") if "cam" in ss.lower(): counter += 1 arr.append(ss) else: pass arr.sort(reverse=True) print(f"Proposals: {arr[0]}, {arr[1]}, {arr[2]}")
class Stack: """ ESTRUTURAS DE DADOS PILHA - Pilha é uma lista linear de acesso restrito, que permite apenas as operações de inserção (push) e retirada (pop), ambas ocorrendo no final da estrutura. - Como consequência, a pilha funciona pelo princípio LIFO (Last In, First Out - ...
#!/usr/bin/env python class ListInstance: def __attrnames(self): result = '' for attr in sorted(self.__dict__): result += '\t%s=%s\n' % (attr, self.__dict__[attr]) return result def __str__(self): return '<Instance of %s, address %s:\n%s>' % ( self._...
#from datetime import datetime #time=str(datetime.now()) #time=time[0:4]+time[5:7]+time[8:10]+time[11:13]+time[14:16]+time[17:19]+time[20:22] #print(time) print(float("01"))
#!/usr/bin/env python3 total = 0 n = int(input()) n = (n * (n % 2)) total = total + n n = int(input()) n = (n * (n % 2)) total = total + n n = int(input()) n = (n * (n % 2)) total = total + n n = int(input()) n = (n * (n % 2)) total = total + n n = int(input()) n = (n * (n % 2)) total = total + n n = int(input()...
class SinglePlayerArena(): """ An Arena class where any 2 agents can be pit against each other. """ def __init__(self, player1, game): """ Input: player 1: function that takes board as input, return action game: Game object """ self.player1 = playe...
n = 4 arr = [] for _ in range(n): s = list(input()) arr.append(s) def check(arr, paint='#'): possible = False Y = len(arr) X = len(arr[0]) for y in range(1, Y): for x in range(1, X): if arr[y-1][x] == paint and arr[y][x-1] == paint and arr[y-1][x-1] == paint: ...
chars = [0]*26 str = input().strip() odds = 0 for i in range(0, len(str)): chars[ord(str[i])-97] += 1 for i in range(0, 26): if chars[i] % 2 == 1: odds += 1 if odds > 1: print("NO") else: print("YES")
""" Help text for Suplemon """ help_text = """ # Suplemon Help *Contents* 1. General description 2. User interface 3. Default keyboard shortcuts 4. Commands ## 1. General description Suplemon is designed to be an easy, intuitive and powerful text editor. It emulates some features from Sublime Text and the user inter...
# 問題URL: https://atcoder.jp/contests/abc134/tasks/abc134_c # 解答URL: https://atcoder.jp/contests/abc134/submissions/24157973 n = int(input()) a = [int(input()) for _ in range(n)] first = max(a) if a.count(first) > 1: print(*[first] * n, sep="\n") else: second = max(ai for ai in a if ai < first) print(*[firs...
class ClientResponse(object): """Client response """
insert_route_sql = """ INSERT INTO tb_route ( INPUT_VALUE , OUTPUT_VALUE , FILTER_VALUE , INS_DATE , UPD_DATE ) VALUES ( {input_value} , {output_value} , {filter_value} , NOW() , NOW() ); """ selec...
## DP 100% class Solution: def updateMatrix(self, matrix: List[List[int]]) -> List[List[int]]: m, n = len(matrix), len(matrix[0]) dp = [[1000]*n for _ in range(m)] for i in range(m): for j in range(n): if (matrix[i][j] == 0): dp[i][j] = 0 ...
src = Split(''' fota_test.c ''') component = aos_component('fota_test', src) component.add_comp_deps('middleware/uagent/uota')
""" Sprawdz czy binarna reprezentacja liczby jest palindromem. """ def czy_palindrom_v1(liczba): odwrocona = 0 k = liczba while k > 0: odwrocona = (odwrocona << 1) | (k & 1) k >>= 1 return odwrocona == liczba if __name__ == "__main__": liczba = 0b11011 assert czy_palindr...
{ "targets": [ { "target_name": "modsecurity", "sources": [ "modsecurity_wrap.cxx" ], "include_dirs": ['usr/local/modsecurity/include/modsecurity',], "libraries": ['/usr/local/modsecurity/lib/libmodsecurity.a', '/usr/local/modsecurity/lib/libmodsecurity.dylib', '/usr/local/mods...
""" Advent of code Day 1 challenge part 2 """ element_one_index = 0 element_two_index = 1 element_three_index = 2 not_exhausted = True first_element_ignore = True sum_list = [] inc_countup = 0 with open("input.txt") as file: element_list = [int(stained_element.strip()) for stained_element in file.readlines()] w...
def candy_crush(string): char_pointer = string[0] result_string = "" counter = 1 for c in string[1:]: if not c == char_pointer: result_string += char_pointer char_pointer = c else: counter += 1 if counter == 3: counter = 1 ...
# running use IDEL: tired of waiting x=8 ans = 0 while ans**3 < abs(x): ans = ans # replace the statement ans = ans + 1 by ans = ans # ans = ans + 1 if ans**3 != abs(x): print(x, 'is not a perfect cube') else: if x < 0: ans = -ans print('Cube root of', x,'is', ans)
#!/usr/bin/env python3 class ZotlerError(Exception): pass class InvalidModeError(ZotlerError): pass
""" Wallabag entry. """ class Entry: """ The entry class. """ entry_id = 0 title = "" content = "" url = "" read = False starred = False def __init__(self, item): self.entry_id = item['id'] title = item['title'] title = title.replace("\n", "") ...
class StarwarsUniverse: # creates a member of the starwars universe def __init__(self, name, birth, gender): self._name = name self.birth = birth self.gender = gender def says(self, words): return f"{self.name} says {words}" class Robot(StarwarsUniverse): # creates a robot fro...
class Magic: def __init__(self, username, password): self.username = username self.password = password def start(self): print(self.username) print(self.password) class StartMagic(Magic): def gg(self): return self.password while True: s = StartMagic(1,2) s.start() print(s.password)
# Wencke Hartwig # 790786 # Uebungsblatt 4 # 1 Stringverarbeitung # 1.1 Merkmalsfunktionen #definieren der Funktion spelling def spelling(w) : #leerer string als "Hülle" für neues, zu ersetzendes Wort new_word = '' #definieren der Funktion, die für die Länge des eingegebenen strings alle Zeichen ausgi...
def add_num(a,b): '''Return sum of two numbers''' s=a+b return s n1=input('enter first number:') n1=int(n1) n2=input('enter second number:') n2=int(n2) s = add_num(n1,n2) print ('sum is: ',s);
""" 1. Clarification 2. Possible solutions - String 3. Coding 4. Tests """ # T=O(n), S=O(n) class Solution: def countAndSay(self, n: int) -> str: if n == 1: return '1' s = self.countAndSay(n - 1) i, j, ans = 0, 1, list() while j <= len(s): if j == len(s)...
class Transaction: def __init__(self, trans_type, amount=0): self.trans_type = trans_type self.amount = amount def display(self): print('Super class display')
# Слияние отрезков: # # Вход: [1, 3] [100, 200] [2, 4] # Выход: [1, 4] [100, 200] nums = [[1, 3], [100, 200], [2, 4], [1, 1], [0, 301]] def merge(nums): last = None output = [] for num in sorted(nums): if last is None: last = num output.append(num) else: i...
class PolishWordnetParser: __LEXICAL_UNIT = 'lexical-unit' __SYNSET_UNIT = 'synset' __LEXICAL_RELATIONS = 'lexicalrelations' __SYNSET_RELATIONS = 'synsetrelations' def __init__(self, version): self.version = version def lexical_unit(self): return self.__LEXICAL_UNIT def ...
"""Top-level package for education_math_homework_generator.""" __author__ = """Michael Shawn Marshall""" __email__ = 'physbean@gmail.com' __version__ = '0.2.0'
def register_to(bot): def sauce(*args): _, msg, _ = args msg.reply('https://gitlab.stusta.mhn.de/stustanet/prism/').send() return True bot.respond('gimme-sauce', sauce, help_text='gimme-sauce: posts the url of the source') bot.respond('invoke-gpl', sauce, help_text...
def main(N, M, A): memo = N - sum(A) if memo >= 0: return memo else: return -1 if __name__ == '__main__': N, M = list(map(int, input().split())) A = list(map(int, input().split())) # N = 314 # M = 15 # A = list(map(int, "9 26 5 35 8 9 79 3 23 8 46 2 6 43 3".split())) ...
class TEST_MODULE: def __init__(self, parent): self.parent = parent self.test = "test" self.new_commands = { "big_test": self.testf, } self.add_self() # or just # self.parent.parser.commands.update(self.new_commands) # but I figured a function would be kinda better in special use cases def testf...
# # PySNMP MIB module Wellfleet-DIFFSERV-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-DIFFSERV-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:39:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
def get_ref(db, col, identifier, obj): for doc in db.collection(col).where(identifier, u'==', obj).stream(): return doc.reference return None def get_field(ref, field): return ref.get().to_dict()[field] def update(ref, key, val): return ref.set({key: val}, merge=True) def addEntry(ref, key, v...
# ------------------------------ # 249. Group Shifted Strings # # Description: # Given a string, we can "shift" each of its letter to its successive letter, for example: "abc" -> "bcd". We can keep "shifting" which forms the sequence: # "abc" -> "bcd" -> ... -> "xyz" # Given a list of strings which contains only lower...
# MIT License # (C) Copyright 2021 Hewlett Packard Enterprise Development LP. # # vrrp : ECOS VRRP configuration def get_vrrp_interfaes( self, ne_id: str, cached: bool, ) -> list: """Get configured vrrp interfaces on appliance .. list-table:: :header-rows: 1 * - Swagger Section ...
# Momijigaoka if sm.hasQuest(57106): sm.warp(807030000, 0) elif sm.hasQuest(57107): sm.warp(807030100, 0) else: sm.systemMessage("There is nothing to see here.") #sm.warp(807030200, 0)
# 1401 - Warriors of Perion sm.setSpeakerID(1022000) # Dances with Balrog response = sm.sendAskYesNo("So you want to become a Warrior?") if response: sm.completeQuestNoRewards(parentID) sm.jobAdvance(100) sm.resetAP(False, 100) sm.giveItem(1302182) sm.sendSayOkay("You are now a #bWarrior#k.")
sm.setSpeakerID(1033210) # Great Spirit response = sm.sendAskYesNo("Are you ready to take on great power?") if response: sm.startQuest(parentID) sm.dispose()
# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def sortedArrayToBST(self, nums): """ :type nums: List[int] :rtype: TreeNode """ return se...
cont = 1 soma = 0 n = 0 #print('A soma é: ', end='') for cont in range(cont, 501): if cont % 2 != 0: if cont % 3 == 0: #print('{} + '.format(cont), end='') soma += cont n += 1 print('A soma dos {} valores solicitados é {}\n'.format(n, soma))
# Ground station location lat = 0.0 lon = 0.0 alt = 0 min_elevation = 5.0 # in degrees, in urban or heavily wooded areas, increase as appropriate # Change this to false if you don't want the realtime receiver to plot anything realtime_plotting = True
# https://leetcode-cn.com/problems/valid-parentheses/ # Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. # # An input string is valid if: # Open brackets must be closed by the same type of brackets. # Open brackets must be closed in the correct orde...
"""Data module for the Marathi languages alphabet and related characters. Marathi is written in Devnagari script """ __author__ = ['Mahesh Bhosale <bhosalems24@gmail.com>'] __license__ = ['MIT License. See LICENSE.'] #DIGITS #0 to 9 DIGITS = ['०', '१', '२', '३', '४', '५', '६', '७', '८', '९'] #VOWELS #There are 13 ...
inc="docs/floatlib.inc" f=open(inc,'r+') data=f.readlines() f.close() d=[] for i in data: if not i.startswith(" ") and not i.startswith("#") and not i.startswith("."): i=i.split(';')[0] i=i.split('=')[0] i=i.strip() if len(i)!=0: d+=[': .db "'+i.upper()+',0" \ .dw '+i+'\n'] d=sorte...
# General TITLE = "Home Control" # Security config PASSWORD = "1234" SECRET = "81dc9bdb52d04dc20036dbd8313ed055" # Server config HOST = "0.0.0.0" PORT = 8000 DEBUG = False # Switch list SWITCHES = [ { "name": "Room", "system": 8, "device": 1, "icon": "ion-ios-lightbulb", }, ...
'''primeiro = int(input('Primeiro termo: ')) razão = int(input('Razão: ')) c = 0 while c<10: print(primeiro, end='>>>') primeiro+= razão c+= 1 print('fim')''' print('Gerador de PA') print('-='*10) primeiro = int(input('Primeiro termo da PA: ')) razão = int(input('Razão da PA: ')) termo = primeiro cont = 0 w...
# Question 1. # Function to print username def hello_name(user_name): print(f"hello_{user_name}!") hello_name('Shakti') # Question 2. # Function to odd numbers from 1-100 def first_odds(): num = 0 while(num<100): num += 1 if(num % 2 != 0): print(num) else: c...
''' 给定一个整数 n,生成所有由 1 ... n 为节点所组成的 二叉搜索树 。 ''' # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def generateTrees(self, n: int) -> List[TreeNode]: ...
"""Functions that accept either a numpy array or a dask array, and return another of the matching type. Typyically invoked through ``xarray.apply_ufunc(dask='allowed'). """
################################ # # # James Bachelder # # CWCT - Python # # M01 Programming Assignment 2 # # 18 June 2021 # # # ################################ print('Guido van Rossum') print('20 February 1991') pr...
# Where memories will be temporarily kept. #SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/staticfuzz.db' # Database for memories. # # Use a sqlite database file on disk: # # SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/staticfuzz.db' # # Use sqlite memory database (never touches disk): SQLALCHEMY_DATABASE_URI = 'sqlite:...
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/test_nbdev.ipynb (unless otherwise specified). __all__ = ['test_nbdev_func'] # Cell def test_nbdev_func(): return 42
""" Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. """ class Solution(): def missingNumber(self, nums: list): summ = sum(nums) n = len(nums) arithmetic_sum = int(n * (n + 1) / 2) return arithmetic_sum - summ ...
""" URL: https://codeforces.com/problemset/problem/1339/A Author: Safiul Kabir [safiulanik at gmail.com] Tags: brute force, db, implementation, math, *900 """ t = int(input()) for _ in range(t): print(input())
# 5из36(Старая) + Результаты нескольких тиражей def test_5x36_results_for_several_draws(app): app.ResultAndPrizes.open_page_results_and_prizes() app.ResultAndPrizes.click_results_for_several_draws() app.ResultAndPrizes.click_ok_for_several_draws_modal_window() app.ResultAndPrizes.button_get_report_win...
__all__ = ["slice"] def slice(d, keys): """return dictionary with given keys""" result = dict() for k in keys: if k in d: result[k] = d[k] return result
class Shopping: def __init__(self, shop): self.shop = shop self.cart = {} def add_cart(self, item, quantity): if item in self.cart: self.cart[item] += quantity else: self.cart[item] = quantity def remove_cart(self, item, quantity): if item in self.cart: self.cart[item] -= quantity if self.c...
#!/usr/bin/env python # -*- coding: utf-8 -*- __company__ = 'Sequømics Corporation' __homepage__ = 'http://sequomics.com/' __account__ = 'heyprabhat' __githubURL__ = 'https://github.com/heyprabhat' __authors__ = [ '"Prabhat Kumar" <pranam.prabhat@gmail.com>', '"Sequømics Corporation" <admin@sequomics.com>...
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate...
# -*- coding: utf-8 -*- __all__ = [ "contact_us", "contact_us_thank_you", "feedback", "landing", "how_to_set_up_in_the_uk", "how_we_help_you_expand", "hpo", "hpo_contact_us", "hpo_contact_us_thank_you", "pixels", "uk_setup_guide_pages", ]
# -*- coding: utf-8 -*- """ Created on Wed Jan 13 2021 - 11:04 Introduction to Computation and Programming Using Python. John V. Guttag, 2016, 2nd ed CV Parser - Word Frequencies See my other example called OCW-Lecture-6-Dict-Song-Lyrics-Parser @author: Atanas Kozarev - github.com/ultraasi-atanas """ def removePunct...
#!/usr/bin/python3 """ 1-safe_print_integer """ def safe_print_list_integers(my_list=[], _x=0): """ safe_print_list_integers """ counter = 0 for i in range(_x): try: print("{:d}".format(my_list[i]), end="") counter += 1 except (ValueError, TypeError): ...
a=0 while a!=2002: a=int(input()) if a== 2002: print('Acesso Permitido') else: print('Senha Invalida')
# -*- coding: utf-8 -*- # @Time : 2018/5/23 20:53 # @Author : xiaoke # @Email : 976249817@qq.com # @File : my_test.py print(range(1)) for i in range(1): print(i)
model = dict( type='StaticUnconditionalGAN', generator=dict(type='WGANGPGenerator', noise_size=128, out_scale=128), discriminator=dict( type='WGANGPDiscriminator', in_channel=3, in_scale=128, conv_module_cfg=dict( conv_cfg=None, kernel_size=3, ...
class EndUploadEvent(object): """Event dispatched when an upload starts""" def __init__(self, filepath, uploaded_files, files_to_upload): """ Constructor :param str filepath: file uploaded :param int uploaded_files: total files uploaded count :param int files_to_upload:...
# not yet finished N = int(input()) input() for _ in range(int(input())): A, F = int(input()), int(input()) try: input() except EOFError: pass
# -*- coding: utf-8 -*- # __author__ = xiaobao # __date__ = 2019/10/17 12:17:59 # desc: # 给你一个链表,每 k 个节点一组进行翻转,请你返回翻转后的链表。 # k 是一个正整数,它的值小于或等于链表的长度。 # 如果节点总数不是 k 的整数倍,那么请将最后剩余的节点保持原有顺序。 # 示例 : # 给定这个链表:1->2->3->4->5 # 当 k = 2 时,应当返回: 2->1->4->3->5 # 当 k = 3 时,应当返回: 3->2->1->4->5 # 说明 : # 你的算法只能使用常数的额外空间。 # ...
def minion_game(string): # your code goes here vowels = "AEIOU" kevsc = 0 stusc = 0 for i in range(len(string)): if string[i] in vowels: kevsc += (len(string) - i) else: stusc += (len(string) - i) if kevsc > stusc: print("Kevin", k...
input = """ %This is an example where we can not eliminate the duplicates of the rules. %#maxint=8. p(X) | r(X) :- q(X,Y), q(A,B), s(X,A), s(Y,B). q(1,3). q(2,4). q(2,7). q(3,8). q(3,5). q(1,6). s(0,1). s(1,2). s(2,3). s(3,4). s(4,5). s(5,6). s(6,7). s(7,8). """ output = """ %This is an exampl...
class TreeNode: def __init__(self, x): self.val = x self.left = self.right = None class Solution: def isSymmetric(self, root): def isSym(left, right): if left is None or right is None: return left == right if left.val != right.val: ...
ncases = int(input()) for _ in range(ncases): X, Y, Z = map(int, input().split()) A = [X, Y] B = [X, Z] C = [Y, Z] found = False for a in A: for b in B: for c in C: if X == max(a, b) and Y == max(a, c) and Z == max(b, c): print("YES") ...
# lambda function is a different type function which does not have name # and is only used to return values # lambda functions are exclusively used to operate on inputs and return outputs def add(x, y): return x+y print(add(5, 7)) # OR def add_lambda(x, y): return x+y print(add_lambda(10, 10)) # Real Usage...
def maximum(values): large = None for value in values: if large is None or value > large: large = value return large print(maximum([9,10,100]))
def save_txt(file): saida = open('cache/data.txt','w') for line in file: saida.write(str(line.replace('\n',''))+'\n') saida.close()
f = open("Q2/inputs.txt","r") z = f.readlines() c = d = 0 for i in z: #print(i) a,b = i.split() if a == "forward": c += int(b) elif a == "down": d += int(b) else: d -= int(b) print(c*d) c = d = 0 aim = 0 for i in z: #print(i) a,b = i.split() if a == "forward": ...
#when we cretae a tuple , we normally assign values to it this is called packing a tuple fruits=("apple","banana","cherry") (green,yellow,red)= fruits print(green) print(yellow) print(red) #The number of variable must match the number of values in tuple if not , you must use an asterisk to collect the remeaing value ...
def solution(board: list, moves: list) -> int: # board: 2d array # moves: column stack = [] answer = 0 row = len(board) for m in moves: for i in range(row): if board[i][m-1]: if not stack: stack.append(board[i][m-1]) else: ...
def draw_network(fname, savename): alt.data_transformers.disable_max_rows() data = pd.read_csv(fname, delimiter = '\t') character_vowels = dict(zip(data['RHYME_WORD'], data['VOWEL'])) character_vowels['慍'] = 'u' rhymes = get_rhymes(fname) pos = nx.spring_layout(rhymes) nx.set_node_...
''' Give you an integer matrix (with row size n, column size m),find the longest increasing continuous subsequence in this matrix. (The definition of the longest increasing continuous subsequence here can start at any row or column and go up/down/right/left any direction). Have you met this question in a real intervie...
def method1(n: int, l: list) -> list: n = 2 l = [i for i in range(10)] # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] return l.remove(2) # [0, 1, 3, 4, 5, 6, 7, 8, 9] def method2(n: int, l: list) -> list: n = 2 l = [i for i in range(10)] # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] return l.pop(0) # [1, 2, 3, 4, 5,...
""" The Natural Language Generator for hospital data. The generator will: a) Determine an opening line about the data b) Follow up by verbalizing some choices c) If there are more than 2 choices, it will also show tabular data d) If your highest rated option is no the closest, it will mention that fact e) Make a lexica...
''' The Vector class of Section 2.3.3 provides a constructor that takes an integer d, and produces a d-dimensional vector with all coordinates equal to 0. Another convenient form for creating a new vector would be to send the constructor a parameter that is some iterable type representing a sequence of numbers, and to...
def sort(words): # write your code here... return print(sort( ['hi', 'bye'] )) print(sort( ['abc', 'def'] )) print(sort( ['hi', 'bye', 'def', 'abc'] )) print(sort( ['add', 'some', 'more', 'words', 'here!'] ))
class CityScrapersLoggingPipeline(object): """ Dummy logging pipeline. Enabled by default, it reminds developers to turn on some kind of backend storage pipeline. """ def process_item(self, item, spider): spider.logger.warn( 'Processing {0}. Enable a database pipeline to save it...
PATHS_TO_BACKUP = ['C:\\', 'd:\\'] #case sensetive EXCLUDED_PATHS = ['C:\\Program Files (x86)', 'C:\\Program Files', 'C:\\Windows'] BACKUP_DESTINATION = 'PCBACKUP' PROGRESS_INTERNALS = 1 DRIVE_SCAN_PAGE_SIZE = 100 WORKERS = 30 UPLOAD_RETRIES = 3 LOG_LEVEL = 'INFO' # DEBUG, INFO, ERROR FULL_SYNC_EVERY = 14 * 24 ...
def main(): n = int(input()) vec = None for _ in range(n): current_vec = [int(x) for x in input().split()] if vec == None: vec = [0] * len(current_vec) vec = [vec[i] + current_vec[i] for i in range(len(current_vec))] print("NO") if set(vec) != set([0]) else print("...
def meia_noite(h, m, s): ts=((h*60)*60)+(m*60)+s r=ts-0 return r h=int(input()) m=int(input()) s=int(input()) t=meia_noite(h, m,s) def mensagem(msg): print(msg) def main(): mensagem(t) if __name__=='__main__': main()
def ciSono(parola,lettere): i = 0 lunghezza = (len(parola))-1 while i < lunghezza: a = parola[lunghezza] if a in lettere: return True lunghezza = lunghezza-1 return False def usaSolo(parola,lettere): if ciSono(parola,lettere) == True: if parola in le...
def var_args(name, *args): print(name) print(args) def var_args2(name, **kwargs): print(name) print(kwargs['description'], kwargs['feedback']) var_args('Mark', 'loves python', None, True) var_args2('Mark', description="loves python", feedback=None)
# !/usr/bin/python class Monday: def __init__(self,name): name = name xx = '1' @staticmethod def print_word(w): print(w) @classmethod def class_method(cls,x): print(x) def fn(self, y): print(y) Monday().print_word('hhh') Monday.print_word('hhhxxx') Monday....
''' - DESAFIO 036 - Escreva um programa para aprovar o empréstimo bancário para a compra de uma casa. Pergunte o valor da casa, o salário do comprador e em quantos anos ele vai pagar. A prestação mensal não pode exceder 30% do salário ou então o empréstimo será negado. ''' valor_casa = float(input('Informe o va...