content
stringlengths
7
1.05M
short_name = "anl" name = "Accidental Noise Library" major = 2 minor = 2 status = "dev"
""" Exercise 4 """ def exercise(now, alarm): return (now + (alarm % 24)) % 12 now = 3 alarm = 62 time = exercise(now, alarm) print(time) # second version now = int(input("Now time: ")) alarm = int(input("Waiting time: ")) time = exercise(now, alarm) print(time)
a= "sharad" b=25 c=3.18 d=True print(type(a)) print(type(b)) print(type(c)) print(type(d))
# -*- coding: utf-8 -*- """ gutils/constants """ class AugmentationType: """ Holds the augmentation transforms types """ PIXEL_LEVEL = 0 # Pixel-level transforms SPATIAL_LEVEL = 1 # Spatial-level transforms
class Solution: def multiply(self, num1: str, num2: str) -> str: if not num1 or not num2 or num1[0] == '0' or num2[0] == '0': return '0' nums = [[], []] for i, num in enumerate([num1, num2]): while True: num, sub = num[:-4], num[-4:] nums[i].append...
#----------------------------------------------------------------------------- # Runtime: 36ms # Memory Usage: # Link: #----------------------------------------------------------------------------- class Solution: def isValid(self, s: str) -> bool: result = [] for ch in s: if ch == ')...
# -*- coding: utf-8 -*- class OrganizationJSONPresenter: """Present an organization in the JSON format returned by API requests.""" def __init__(self, organization_context): self.context = organization_context self.organization = organization_context.organization def asdict(self): ...
a=int(input()) k=a%8 if k==1: print(1) elif k==2 or k==0: print(2) elif k==3 or k==7: print(3) elif k==4 or k==6: print(4) else: print(5)
def parse_profile(profile): kargs = {} try: for kv in profile.split(','): k, v = kv.split('=') kargs[k] = v except ValueError: # more informative error message raise ValueError( f"Failed to parse profile: {profile}. The expected format is:" " \"key1=value1,key2=value2,[...]\"" ...
class _BaseOptimizer: def __init__(self, learning_rate=1e-4, reg=1e-3): self.learning_rate = learning_rate self.reg = reg def update(self, model): pass def apply_regularization(self, model): ''' Apply L2 penalty to the model. Update the gradient dictionary in the mo...
# Space: O(n) # Time: O(n) # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def isPalindrome(self, head): if not head: return True if head.next is None: return True temp ...
# Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water. # Note: You ma...
# -*- coding: utf-8; -*- # # @file __init__.py # @brief coll-gate messenger project init # @authors Frédéric SCHERMA (INRA UMR1095) # @date 2017-10-06 # @copyright Copyright (c) 2017 INRA/CIRAD # @license MIT (see LICENSE file) # @details __title__ = "INRA Coll-Gate" __copyright__ = "Copyright (c) 2017 INRA/CIRAD" __o...
""" i2c interface part of hwpy: an OO hardware interface library home: https://www.github.com/wovo/hwpy """ class i2c_interface: """ I2C interface Implementations should implement at least the methods defined here. """ def read_command(self, address: int, command: int, n: int) -> list: r...
def multiple(a, b): """Return the smallest number n that is a multiple of both a and b. >>> multiple(3, 4) 12 >>> multiple(14, 21) 42 """ "*** YOUR CODE HERE ***" base = 2 number = 1 while True: if a==1 and b==1: return number elif a%base==0: ...
# Copyright 2019, OpenTelemetry Authors # # 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...
class QueryDeviceGroupMembersInDTO(object): def __init__(self): self.devGroupId = None self.accessAppId = None self.pageNo = None self.pageSize = None def getDevGroupId(self): return self.devGroupId def setDevGroupId(self, devGroupId): self.devGroupId = dev...
# A non class to hold various constants # Plane colors colors = { 0 : 'r', 1 : 'g' , 2 : 'b' } cm2tick = 17.94 cm2wire = 3.3333
def p_e_m_disamb_redirect_wikinameid_maps(): wall_start = time.time() redirections = dict() with open(config.base_folder + "data/basic_data/wiki_redirects.txt") as fin: redirections_errors = 0 for line in fin: # line = line[:-1] line = line.rstrip() tr...
num = 1 while num > 0: num = int( input() ) print(num) ######################### a = ['I', 3, 0.1, 'choongam'] for i in a: print(i) ######################### for i in range(-6, 5): print(i)
VERSION = "2.0.0" CONTRIBUTORS = [ { "name": "Kyuunex", "url": "https://github.com/Kyuunex", "role": "BDFL" }, { "name": "-Keitaro", "url": "https://github.com/rorre", "role": "some technical help" }, { "name": "eenpersoon64", "url": "...
class Cache: def __init__(self): self.data = [] def has_data(self, inp): if not self.data: [] else: for x in self.data: if x[0] == inp: return x[1] return [] def computation_val(self, inp, output):...
class VaultInitError(Exception): pass class NotEnoughtKeysError(VaultInitError): def __init__(self, mandatory_count, used_count): self.mandatory = mandatory_count self.used = used_count def __str__(self): return f'NotEnoughKeys excepted {self.mandatory}, used {self.used}' class ...
print('Bem vindo ao 53') print('Crie um programa que leia uma frase qualquer e diga se ela é um palindromo') # Palavra que é lida tanto na frente quanto atrás e dá igual frase = str(input('Informe uma frase')).strip().upper() palavras = frase.split() # Aqui ela divide todas as palavras juntas = ''.join(palavras) inv...
#!/usr/bin/env python """ version of prettypublictest ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Use this for the version of the package. """ __version__ = "0.0.1"
#!/usr/bin/python3 """ 2.1 Shapes Build a class hierarchy for a primitive graphic editor figures data model. Two basic entities of a graphic editor are a Color and a Coordinates which are building blocks for all other entities. Coordinates can be defined in several ways (Linear, Cyllindric, Spheric) through static m...
username = '' # production user TOKEN = "" # production bot URL = "" # production server google_credentials = 'production/production_credentials.json' # prod credentials google_oath = 'production/production_oa...
__version__ = "2.1.6"
class DimensionError(Exception): pass class MultivectorError(Exception): pass class FunctionError(Exception): pass class DiferentialFormError(Exception): pass class CasimirError(Exception): pass
def take_beer(fridge, number=1): if not isinstance(fridge, dict): raise TypeError("Invalid fridge") if "beer" not in fridge: raise ValueError("No more beer:(") if number > fridge["beer"]: raise ValueError("Not enough beer:(") fridge["beer"] -= number if __name__ == "__main__...
default_prefix = "COCOS" known_chains = { "COCOS": { "chain_id": "7d89b84f22af0b150780a2b121aa6c715b19261c8b7fe0fda3a564574ed7d3e9", "core_symbol": "COCOS", "prefix": "COCOS"}, # "COCOS": { # "chain_id": "9fc429a48b47447afa5e6618fde46d1a5f7b2266f00ce60866f9fdd92236e137", # ...
class uart_interface(): # def __init__(self, ser): # pass def serial_read(self, ser, message, file, first_read=False): pass def serial_write(self, ser, message, file=None): pass
# パスカルの三角形 N, K = map(int, input().split()) m = 1000000007 n = max(K, N - K + 1) c = [[0] * (n + 1) for _ in range(n + 1)] c[0][0] = 1 for i in range(1, n + 1): c[i][0] = 1 for j in range(1, i + 1): c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % m result = [] for i in range(1, K + 1): result.append(...
# David Markham 2019-02-17 # Solution to problem number 1 # Write a program that asks the user to input any positive integer # And outputs the sum of all numbers between one and that number. # Asks the user to input a positive integer number i = int(input("Please enter a positive integer")) # This will prevent the u...
""" 复习 跨类调用 行为不同用类区分 数据不同用对象区分 方法1: class A: def func01(): b = B() b.func02() class B: def func02(): ... 方法2: class A: ...
# -*- coding:utf-8 -*- ''' Created on 2013/07/31 @author: Jimmy Liu ''' DAY_PRICE_COLUMNS = ['date','open','high','close','low','amount','price_change','p_change','ma5','ma10','ma20','v_ma5','v_ma10','v_ma20','turnover'] TICK_COLUMNS = ['time','price','change','volume','cash','type'] TICK_PRICE_URL = 'http://market.f...
def is_valid(isbn): digits = [ch if ch != 'X' else '10' for ch in isbn if ch != '-'] if len(digits) != 10 or '10' in digits[:9] or any(not n.isdigit() for n in digits): return False return sum(int(n) * i for n, i in zip(digits, range(10, 0, -1))) % 11 == 0
""" Fixtures automatically available when this plugin is installed. """ pytest_plugins = ['vws_test_fixtures.images']
""" Write a function - long_common_prefix to find and return the longest common prefix in a list of strings. If no common prefix is found, return an empty string. Example: input_list => [firecode, fireacb, fireac] commonPrefix(input_list) ==> "fir" """ def longestCommonPrefix(self, input_list): if not input_list: ...
STOPWORDS = ['I', 'A', 'ABOVE', 'AFTER', 'AGAINST', 'ALL', 'ALONE', 'ALWAYS', 'AM', 'AMOUNT', 'AN', 'AND', 'ANY', 'ARE', 'AROUND', ...
def numberToRoman(self, number): digits = [ 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 ] symbolRoman = [ "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" ] romanNumber = '' i = 0 while number > 0: ...
#!/usr/bin/env python3 def main(): print("Todo")
#!/usr/bin/env python3 # -*- coding: utf-8 -*- classmates = ['Michael', 'Bob', 'Tracy'] print('classmates=',classmethod) print('len(classmates) =',len(classmates)) print('classmates[0]',classmates[0]) print('classmates[1]',classmates[1]) print('classmates[-1]',classmates[-1]) classmates.pop() print('classmates=',clas...
# @file # # Copyright 2020, Verizon Media # SPDX-License-Identifier: Apache-2.0 # Test.Summary = ''' Multiple Remap Configurations. ''' # Point of this is to test two remap configs in isolation and then both as separate remap configs. tr = Test.TxnBoxTestAndRun("Multiple remap configurations", "multi-cfg.replay.yaml",...
numero = int(input('Insíra um número inteiro para saber se ele é par ou ímpar: ')) if numero%2==0: print('O número {} é par!'.format(numero)) else: print('O número {} é ímpar!'.format(numero))
LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'debug': { 'format': '%(asctime)s %(name)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S', }, 'simple': { 'format': '%(asctime)s ...
# encoding: utf-8 # module Tekla.Structures.Forming calls itself Forming # from Tekla.Structures,Version=2017.0.0.0,Culture=neutral,PublicKeyToken=2f04dbe497b71114 # by generator 1.145 # no doc # no imports # no functions # classes class DeformingType(Enum): """ enum DeformingType,values: DEFORMED (1),NOT...
""" Given string str, transform it according to the following rules: Delete all the vowels from the string. Insert # in front of all the consonants. Change the case of all the letters of the string. Input: str = aBAcAba Output: #b#C#B Explanation: Vowels at position 0,2,4,6 are deleted. '#' is added before consonants...
class DataPreprocessor: types = ['fr_en', 'ja_en', 'zh_en'] sourceKG = { 'before': ['attrs_1', 'ent_ids_1'], 'after': ['att_triple_1', 'att2id_1', 'att_val2id_1'] } targetKG = { 'before': ['attrs_2', 'ent_ids_2'], 'after': ['att_triple_2', 'att2id_2', 'att_val2id_2'] ...
# Task 09. Factorial Division def factorial(n): if n > 1: return n * factorial(n-1) return 1 first_num = int(input()) second_num = int(input()) result = factorial(first_num) / factorial(second_num) print(f"{result:.2f}")
def repl(re,ye,word): for y in range(len(c)): if c[y]==word: n=input('yes or no') if n=="yes": c[y]=re else: pass k=' '.join(c) print(k) y=open(a,"w") y.write(k) y.close() ...
# # PySNMP MIB module RADLAN-DIGITALKEYMANAGE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-DIGITALKEYMANAGE-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:46:21 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python versio...
# Time: O(n) # Space: O(t), t is the number of nodes in trie # In English, we have a concept called root, which can be followed by # some other words to form another longer word - let's call this word successor. # For example, the root an, followed by other, which can form another word another. # # Now, given a dicti...
# # PySNMP MIB module HUAWEI-EASY-OPERATION-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-EASY-OPERATION-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:44:20 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
class Solution(): def minmoves(self, nums: list) -> int: steps = 0 min_num = min(nums) for num in nums: steps += abs(min_num - num) return steps def minmoves(self, nums: list) -> int: max_element = max(nums) res = 0 for i in range(len(nums)): ...
# # PySNMP MIB module Nortel-MsCarrier-MscPassport-AtmMpeMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-AtmMpeMIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:19:44 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4...
num = soma = cont = 0 while num != 999: num = int(input('Digite um número [999 para parar]: ')) soma += num cont += 1 print(f'Você digitou {cont - 1} número e a soma foi {soma - 999}')
# -*- coding: utf-8 -*- """Package errors.""" class Error(Exception): """Base class for exceptions in this module.""" pass class RequestError(Error): """Exception raised for errors with http requests. Typically these are the result of malformed SPARQL queries. Parameters ---------- res...
# -*- coding: utf-8 -*- """Top-level package for md2bibtex.""" __author__ = """Owen McGill""" __email__ = 'owen@owenmcgill.com' __version__ = '0.1.0'
class IntIdSequence: def __init__(self): self.next_id = 0 def __next__(self): self.next_id += 1 return self.next_id class RepositoryIterator: def __init__(self, repo): self.items = repo.find_all() self.next_id = -1 def __next__(self): self.next_id += 1...
class ServiceNotFound(Exception): """Raised when a horseback service is not found.""" class ServicesDict(dict): """Dictionary of services. Only differs by raising a ServiceNotFound error instead of KeyError if key is not found. """ def __getitem__(self, key: str): try: r...
""" According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970." Given a board with m by n cells, each cell has an initial state live (1) or dead (0). Each cell interacts with its eight neighbors (horizonta...
""" По данному числу N распечатайте все целые степени двойки, не превосходящие N, в порядке возрастания.Операцией возведения в степень пользоваться нельзя! Формат ввода Вводится натуральное число. """ N = int(input()) k = 1 while k <= N: print(k, end=' ') k = k*2
# coding=utf-8 """ chimera.leetcode_43 ~~~~~~~~~~~~~~~~~~~ Multiply Strings Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2. Note: 1. The length of both num1 and num2 is < 110. 2. Both num1 and num2 contains only digits 0-9. 3. Both num1 and num2...
def contaDigtos(d): cont = 0 for _ in d: cont += 1 return cont def ehBissexto(i): if contaDigtos(i) == 4: i = int(i) if i % 4 == 0 and i % 100 != 0 or i % 400 == 0: return True else: return False def Menssagem(z): if ehBissexto(z): ...
# (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) class ModuleDocFragment(object): DOCUMENTATION = """ options: show_skipped_hosts: name: Show skipped hosts description: "Toggle to control displaying skipped task/host...
class InnerWidget: _index = 0 def __init__(self, master, WidgetClass) -> None: self.innerWidget = WidgetClass(master) self.index = self._index InnerWidget._index += 1
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def sortedArrayToBST(self, nums: List[int]) -> TreeNode: def BSTBuild(start: int, end: int) -> TreeNode: if start > e...
class Language: def __init__(self, name, extension, macro_prefix, generated_suffix, columns): self.name = name self.extension = extension self.macro_prefix = macro_prefix self.generated_suffix = generated_suffix self.columns = columns languages = [ Langu...
#!/usr/bin/env python ''' Author : Jonathan Lurie Email : lurie.jo@gmail.com Version : 0.1 Licence : MIT description : Declare some EXIF tag code we will need with piexif. ''' COPYRIGHT_FIELD = ("0th", 33432) DESCRIPTION_FIELD = ("0th", 270) DATE_FIELD = ("0th", 306)
class Solution(object): def threeSum(self, nums): res = [] amount = [0] * 200001 nums2 = sorted(nums) for v in nums: amount[v + 100000] += 1 # 3 different numbers for i in range(len(nums2)): if i > 0 and nums2[i] == nums...
class MedianFinder: def __init__(self): self.stream = [] self.size = 0 def addNum(self, num: int) -> None: self.stream.append(num) self.size += 1 def findMedian(self) -> float: self.stream.sort() # first retrieve midpoint of stream mid = (s...
def dict_interdiff(d1, d2): ''' d1, d2: dicts whose keys and values are integers Returns a tuple of dictionaries according to the instructions above ''' intersection = {} difference = {} shorterDict = (lambda x, y: x if len(x) <= len(y) else y)(d1, d2) longerDict = (lambda x, y: x if len...
# 21.05.31 ''' 1. '부산'에 해당하는 value 출력 2. '천안' key가 존재하는지 확인 3. key 리스트 생성 4. value 리스트 생성 ''' filename_areacode = { '서울':'02', '대전':'042', '부산':'051', '광주':'062', '제주':'064' } # 1. print( filename_areacode ['부산'] ) # 딕셔너리변수['키값'] = value 값 출력 # 2. print( '천안' in filename_areacode ) ...
""" Multiples of 3 and 5 Problem 1 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. """ sum=0 for x in range(1, 1000): if x%3==0 or x%5==0: sum=sum+x print (sum)
def extractWuxiaLovers(item): """ Wuxia Lovers """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol or frag) or 'preview' in item['title'].lower(): return None if item['title'].startswith('CGA Chapter') or item['title'].startswith('CGA: Chapter'): return buildReleas...
def createFile(): f= open("loginInfo.txt", "w+") print("Input your username") f.write(input()+"\n") print("Input your password") f.write(input()+"\n") f.close()
#Escreva um programa que leia a velocidade de um carro. Se ele ultrapassar 80Km/h, #mostre uma mensagem dizendo que ele foi multado. A multa vai custar R$7,00 por cada Km acima do limite. v = int(input('Qual é a velocidade atual do carro: ')) if v > 80: print('\033[31m MULTADO! Você excedeu o limite permitido que...
print() ''' 编写一个程序,当用户输入文件名和行数后,将该文件的前N行内容打印到屏幕上 如: 文件【xx】的前xx行的内容如下: XXXXX ''' def printLine(fileName,lines): f=open('resources/%s'%fileName) lines=int(lines) print('\n文件【%s】的前%d行的内容如下:\n'%(fileName,lines)) for i in range(lines): 'readline()也是需要用print打印出来的' print(f.readl...
class Network(object): def __init__(self, variables, domains, constraints): self.variables = variables self.domains = domains self.constraints = constraints def copy(self): return Network(self.variables, self.domains.copy(), se...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def import_data(path): count = 0 result = [] train_path, train_dirs, train_files = next(os.walk(path)) train_files.sort() for i in range(len(train_files)): if "csv" in train_files[i]: try: result.append(pd.read_csv(t...
''' Instructions You are going to write a program that automatically prints the solution to the FizzBuzz game. Your program should print each number from 1 to 100 in turn. When the number is divisible by 3 then instead of printing the number it should print "Fizz". When the number is divisible by 5, the...
# Copyright (c) 2020 Hartmut Kaiser # # SPDX-License-Identifier: BSL-1.0 # Distributed under the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) # This cmake-format configuration file is a suggested configuration file for # formatting CMake...
def Solve(N,A): # write your code here # return your answer min_diff, res_dict = None, dict() for i in A: if i==0: return 0 sign = -1 if i<0 else 1 min_diff = i*sign if min_diff is None else min(i*sign, min_diff) if min_diff==(i*sign): if (min_diff...
def maior(* num): cont = 0 for valor in num: cont = cont + 1 if cont == 1: maiore = valor else: if valor > maiore: maiore = valor print(f'analizando os valores passados.....') print(f'{num} foram informados {len(num)} ao todo.') print(f...
#!/usr/bin/env python3 """ Settings - modfy as you like encoding_format: the encoding_format may change on different os - tested on windows exiftool_directory: put here path/to/exiftool.exe (download: https://sno.phy.queensu.ca/~phil/exiftool/) if unset is same directory as settings googlemaps_api_key: if you want to ...
num1 = int(input("Me de um número ae meu chapa\n")) num2 = int(input("Me de outro número ae meu chapa\n")) print('Soma: ', num1 + num2)
# # PySNMP MIB module ZYXEL-OUT-OF-BAND-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-OUT-OF-BAND-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:45:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
""" Class description goes here. """ __author__ = 'Alex Barcelo <alex.barcelo@bsc.es>' __copyright__ = '2015 Barcelona Supercomputing Center (BSC-CNS)' class DataClaySerializable(object): __slots__ = ()
# -*- coding: utf-8 -*- YEAR_CHOICES = ( ('', '---------'), ('1', 'Freshman'), ('2', 'Sophmore'), ('3', 'Junior'), ('4', 'Senior'), ) GRADUATE_DEGREE = ( ('M.S.', 'M.S.'), ('Ph.D', 'Ph.D'), ('M.D.', 'M.D.'), ('Other', 'Other'), ) GRANTS_PROCESS_STAGES = ( ('', '---------'), ...
legacy_dummy_settings = { "name": "Rosalind Franklin", "version": 42, "steps_per_mm": "M92 X80.00 Y80.00 Z400 A400 B768 C768", "gantry_steps_per_mm": {"X": 80.00, "Y": 80.00, "Z": 400, "A": 400}, "acceleration": {"X": 3, "Y": 2, "Z": 15, "A": 15, "B": 2, "C": 2}, "z_retract_distance": 2, "ti...
#!/usr/bin/env python # -*- coding: utf-8 -*- # LeetCode 1832. Check if the Sentence Is Pangram # https://leetcode.com/problems/check-if-the-sentence-is-pangram/ class CheckIfTheSentenceIsPangram: def checkIfPangram(self, sentence: str) -> bool: return len(set(sentence)) == 26 if __name__ == "__main__": ...
#TODO: Complete os espaços em branco com uma solução possível n = int(input()) for i in range(n): num = int(input()) sum = 0 for j in range(1, (num+1)): if num%j == 0: sum += 1 if sum != (2): print( '{} nao eh primo'.format(num)) else: print( '{} eh pr...
x = int(input('Digite o primeiro lado do triangulo: ')) y = int(input('Digite o segundo lado do triangulo: ')) z = int(input('Digite o terceiro lado do triangulo: ')) if x >= y + z or y >= z + x or z >= x + y: print('Não é um triangulo!') else: print('É um triangulo.') if x == y and x == z: print('É um tria...
#!/usr/bin/env python # Justin's shot at optimizing QAOA parameters def optimize_obj(obj_val, params=None): beta = 0.5 gamma = 0.7 return ( beta, gamma, obj_val(beta, gamma) ) # return some optimization trace. It will eventually go into optimize.optimize_modularity, so it should at least cont...
__title__ = 'evernote2' __description__ = 'another Evernote SDK for Python' __url__ = 'https://github.com/JackonYang/evernote2' __version__ = '1.0.0' # __build__ = 0x022500 __author__ = 'Jackon Yang' __author_email__ = 'i@jackon.me' __license__ = 'BSD' __copyright__ = 'Copyright 2020 Jackon Yang'
lw = np.linspace(.5, 15, 8) for i in xrange(8): plt.plot(x, i*y, colors[i], linewidth=lw[i]) plt.ylim([-1, 8]) plt.show()
# -*- coding: utf-8 -*- def main(): a = int(input()) b = int(input()) c = int(input()) d = int(input()) diff = a * b - c * d print('DIFERENCA =', diff) if __name__ == '__main__': main()
list_sv = { "A1": {"masv":"2017603001","name":"Hoang Xuan Thai","lop":"CNTT3","khoa":"12","vt":'A1',"check":"0"}, "A2": {"masv":"2017603002","name":"Tran Van Son","lop":"CNTT3","khoa":"12","vt":'A2',"check":"0"}, "A3": {"masv":"2017603003","name":"Doan Phung Tu","lop":"CNTT3","khoa":"12","vt":'A3',...
class Solution: # Optimised Row by Row (Accepted), O(n) time and space, where n = total elems in pascal triangle def generate(self, numRows: int) -> List[List[int]]: n, res = 1, [[1]] while n < numRows: n += 1 l = [1]*n for i in range((n-1)//2): ...