content
stringlengths
7
1.05M
""" Write a function that takes an integer as input, and returns the number of bits that are equal to one in the binary representation of that number. You can guarantee that input is non-negative. Example: The binary representation of 1234 is 10011010010, so the function should return 5 in this case. """ def count_bit...
#!/usr/bin/env python # coding: utf-8 # # *section 2: Basic Data Type* # # ### writer : Faranak Alikhah 1954128 # ### 4. Lists : # # In[ ]: if __name__ == '__main__': N = int(input()) my_list=[] for i in range(N): A=input().split(); if A[0]=="sort": my_list.sort()...
class Solution: def hasZeroSumSubarray(self, nums: List[int]) -> bool: vis = set() x = 0 for n in nums : x+=n if x==0 or x in vis : return 1 vis.add(x) return 0
# -*- coding: utf-8 -*- # File defines a single function, a set cookie that takes a configuration # Use only if the app cannot be imported, otherwise use .cookies def set_cookie(config, response, key, val): response.set_cookie(key, val, secure = config['COOKIES_SECURE'], ...
class Solution: def minSwaps(self, data: List[int]) -> int: k = data.count(1) ones = 0 # ones in window maxOnes = 0 # max ones in window for i, num in enumerate(data): if i >= k and data[i - k]: ones -= 1 if num: ones += 1 maxOnes = max(maxOnes, ones) return k...
class DNSimpleException(Exception): def __init__(self, message=None, errors=None): self.message = message self.errors = errors
polygon = [ [2000, 1333], [2000, 300], [500, 900], [0, 1333], [2000, 1333] ] ''' polygon = [ [0, 0], [0, 600], [900, 600], [1800, 0], [0, 0] ] '''
class A: def __init__(self): self._x = 5 class B(A): def display(self): print(self._x) def main(): obj = B() obj.display() main()
""" Ideas: 1. The widest container (using first and last line) is a good candidate, because of its width. Its water level is the height of the smaller one of first and last line. 2. All other containers are less wide and thus would need a higher water level in order to hold more water. 3. The smaller one of first and ...
arr = [] for x in range(100): arr.append([]) arr[x] = [0 for i in range(100)] n = int(input()) ans=0 for x in range(n): a, b, c, d = map(int, input().split()) ans=ans+(c-a+1)*(d-b+1) print(ans)
alp = "abcdefghijklmnopqrstuvwxyz" res = "" while True: s = __import__('sys').stdin.readline().strip() if s == "#": break x, y, z = s.split() t = "" for i in range(len(x)): dif = (ord(y[i]) - ord(x[i]) + 26) % 26 t += alp[(ord(z[i]) - ord('a') + dif) % 26] res += s + " " ...
# Faça um Programa que peça dois números e imprima a soma. # Ivo Dias # Recebe os numeros primeiroNumero = int(input("Informe um numero: ")) segundoNumero = int(input("Informe outro numero: ")) # Faz a soma soma = primeiroNumero + segundoNumero # Mostra na tela print("A soma do numero %s com %s é %s" % (primeiroNume...
class Day10: ILLEGAL_CHAR_TO_POINTS = { ")": 3, "]": 57, "}": 1197, ">": 25137, } def __init__(self, input="src/input/day10.txt"): self.INPUT = input def read_input(self): input = [] with open(self.INPUT, "r") as fp: lines = fp.readl...
def ways(n, m): grid = [[None]*m]*n for i in range(m): grid[n-1][i] = 1 for i in range(n): grid[i][m-1] = 1 for i in range(n-2,-1,-1): for j in range(m-2,-1,-1): grid[i][j] = grid[i][j+1] + grid[i+1][j] return grid[0][0] if __name__ == "__main__": t = int(input("Number of times you want to run thi...
message = input().split() def asci_change(message): numbers = [num for num in i if num.isdigit()] numbers_in_chr = chr(int(''.join(numbers))) letters = [letter for letter in i if not letter.isdigit()] letters_split = ''.join(letters) final_word = numbers_in_chr + str(letters_split) return fina...
star_wars = [125, 1977] raiders = [115, 1981] mean_girls = [97, 2004] def distance(movie1, movie2): length_difference = (movie1[0] - movie2[0]) ** 2 year_difference = (movie1[1] - movie2[1]) ** 2 distance = (length_difference + year_difference) ** 0.5 return distance print(distance(star_wars, raiders)) print(...
# Annotaion(함수나 클래스의 인자값 또는 반환값의 형태를 알려주기 위해 타입을 지정하는 방법)을 위한 클래스 # bool 타입의 ok class BooleanOk: @staticmethod def __type__(): return bool # dict 타입의 uses class DictionaryUser: @staticmethod def __type__(): fields = { "_id": str, "user_id": str, "us...
def get_distribution_steps(distribution): i = 0 distributed_loaves = 0 while i < len(distribution): if distribution[i] % 2 == 0: i += 1 continue next_item_index = i + 1 if next_item_index == len(distribution): return -1 ...
class File: def __init__( self, name: str, display_str: str, short_status: str, has_staged_change: bool, has_unstaged_change: bool, tracked: bool, deleted: bool, added: bool, has_merged_conflicts: bool, has_inline_merged_conflic...
with open('input') as f: instructions = [] for line in f: op, arg = line.split() instructions.append((op, int(arg))) # Part 1 executed = [False] * len(instructions) accumulator = 0 i = 0 while i < len(instructions): if executed[i]: break executed[i] = True op, n = instructions[i] ...
# encoding: utf-8 SECRET_KEY = 'a unique and long key' TITLE = 'Riki' HISTORY_SHOW_MAX = 30 PIC_BASE = '/static/content/' CONTENT_DIR = '///D:\\School\\Riki\\content' USER_DIR = '///D:\\School\\Riki\\user' NUMBER_OF_HISTORY = 5 PRIVATE = False
############################################################### # LeetCode Problem Number : 622 # Difficulty Level : Medium # URL : https://leetcode.com/problems/design-circular-queue/ ############################################################### class CircularQueue: def __init__(self, size): """initializ...
while True: T = int(input('Digite um número para mostrar a tabuada:')) if T > 0: print(f"""{T} X 1 = {T*1} {T} X 2 = {T*2} {T} X 3 = {T*3} {T} X 4 = {T*4} {T} X 5 = {T*5} {T} X 6 = {T*6} {T} X 7 = {T*7} {T} X 8 = {T*8} {T} X 9 = {T*9} {T} X 10 = {T*10}""") elif T < 0: break print('Obrigado p...
""" STIX 2.0 open vocabularies and enums """ ATTACK_MOTIVATION_ACCIDENTAL = "accidental" ATTACK_MOTIVATION_COERCION = "coercion" ATTACK_MOTIVATION_DOMINANCE = "dominance" ATTACK_MOTIVATION_IDEOLOGY = "ideology" ATTACK_MOTIVATION_NOTORIETY = "notoriety" ATTACK_MOTIVATION_ORGANIZATIONAL_GAIN = "organizational-gain" ATTA...
#!/usr/bin/env python OUTPUT_FILENAME = "output" TOTAL_OF_FILES = 2 if __name__ == "__main__": # make an array of files of size 100 results = [] for i in range(1, TOTAL_OF_FILES+1): a = open("./{}{}.txt".format(OUTPUT_FILENAME, i), 'r') text = a.read() a.close() text = text...
def func(word): word = word.split(", ") dic = {"Magic":[],"Normal":[]} for elm in word: decide = "" first = elm[0] first = int(first) sum1 = 0 for sval in elm[1::]: sum1 += int(sval) if first == sum1: decide = "Magic" e...
def contador(i,f,p): """ Faz a contagem e mostra na tela :param i: inicio da contagem :param f: fim da contagem :param p: passo da contagem :return: sem retorno """ c=i while c<=f: print(f'{c} ', end='') c +=p print('FIMMM') contador(2,10,2) help(contador)
#!/usr/bin/python3 #-*- coding: utf8 -*- # @author : Sébastien LOZANO """ Générer les parties communes aux fichiers HTML. On met les constantes dans des chaînes. """ pass docTypeHead = ( """ <!doctype html> <html lang=\"fr\"> <head> <meta charset=\"UTF-8\"> <meta http-equiv="content-type" content="tex...
class Node: def __init__(self, data): self.data = data # Assign the data here self.next = None # Set next to None by default. class LinkedList: def __init__(self): self.head = None # Display the list. Linked list traversal. def display(self): temp = self.head d...
"""This program takes a score between 0.0 and 1.0 and returns an appropriate grade for score inputted""" try: grade = float(input('Enter your score: ')) if grade < 0.6: print('Your score', grade, 'is F') elif 0.6 <= grade <= 0.7: print('Your score', grade, 'is D') elif 0.7 <= grade <= 0....
# You can gen a bcrypt hash here: ## http://bcrypthashgenerator.apphb.com/ pwhash = 'bcrypt' # You can generate salts and other secrets with openssl # For example: # $ openssl rand -hex 16 # 1ca632d8567743f94352545abe2e313d salt = "141202e6b20aa53596a339a0d0b92e79" secret_key = 'fe65757e00193b8bc2e18444fa51d87...
''' * 오름차순이 이므로 max를 체크할 필요가 없다. ''' N = int(input()) data = list(map(int, input().split())) data.sort() # debug print(N) print(data) result = 0 max = 0 count = 0 for num in data: if max == 0: max = num elif max < num: max = num count += 1 if max == count: result += 1 ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def shell_sort(list_: list) -> list: """Returns a sorted list, by shell sort method :param list_: The list to be sorted :type list_: list :rtype: list :return: Sorted list, by shell sort method """ half = len(list_) // 2 while half > 0: ...
sbox = [ 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76, 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0, 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15, 0x04, 0xC7, 0x23, 0...
""" Syntax Scoring https://adventofcode.com/2021/day/10 """ MATCHES = { '<': '>', '(': ')', '{': '}', '[': ']' } ERROR_SCORE = { ')': 3, ']': 57, '}': 1197, '>': 25137, } AUTOCOMPLETE_SCORE = { ')': 1, ']': 2, '}': 3, '>': 4, } def find_error(line): """returns ...
TAG_TYPE = "#type" TAG_XML = "#xml" TAG_VERSION = "@version" TAG_UIVERSION = "@uiVersion" TAG_NAMESPACE = "@xmlns" TAG_NAME = "@name" TAG_META = "meta" TAG_FORM = 'form' ATTACHMENT_NAME = "form.xml" MAGIC_PROPERTY = 'xml_submission_file' RESERVED_WORDS = [TAG_TYPE, TAG_XML, TAG_VERSION, TAG_UIVERSION, TAG_NAMESPA...
def Merge_Sort(list): n= len(list) if n > 1 : mid = int(n/2) left =list[0:mid] right = list[mid:n] Merge_Sort(left) Merge_Sort(right) Merge (left, right, list) return list def Merge(left, right, list): i = 0 j = 0 k = 0 while i < len(left) a...
#!python def merge(items1, items2): """Merge given lists of items, each assumed to already be in sorted order, and return a new list containing all items in sorted order. TODO: Running time: ??? Why and under what conditions? TODO: Memory usage: ??? Why and under what conditions?""" merge_list = ...
def default_copts(ignored = []): opts = [ "-std=c++20", "-Wall", "-Werror", "-Wextra", "-Wno-ignored-qualifiers", "-Wvla", ] ignored_map = {opt: opt for opt in ignored} return [opt for opt in opts if ignored_map.get(opt) == None]
{ "targets": [ { "target_name": "usb", "conditions": [ [ "OS==\"win\"", { "sources": [ "third_party/usb/src/win.cc" ], "librarie...
# Challenge 4 : Create a function named movie_review() that has one parameter named rating. # If rating is less than or equal to 5, return "Avoid at all costs!". # If rating is between 5 and 9, return "This one was fun.". # If rating is 9 or above, return "Outstanding!" # Date...
# Exercício Python 52: Faça um programa que leia um número inteiro e diga se ele é ou não um número primo. n = int(input("Digite um número inteiro: ")) co = 0 for c in range(1, n + 1): if n % c == 0: co += 1 if co == 2: print(f"{n} é primo.") else: print(f"{n} não é primo.")
colors = {"clean": "\033[m", "red": "\033[31m", "green": "\033[32m", "yellow": "\033[33m", "blue": "\033[34m", "purple": "\033[35m", "cian": "\033[36m"} msg = "Hello World!!!" print("{}{}".format(colors["cian"], msg))
def difference(a, b): c = [] for el in a: if el not in b: c.append(el) return c ll = [1, 2, 3, 4, 5] ll2 = [4, 5, 6, 7, 8] # print(difference(ll, ll2)) # = CTRL + / set1 = {1, 2, 3, 4, 5} set2 = {4, 5, 6, 7, 8} set_difference = set1.difference(set2) # print(set_difference) # print(d...
# -- # File: a1000_consts.py # # Copyright (c) ReversingLabs Inc 2016-2018 # # This unpublished material is proprietary to ReversingLabs Inc. # All rights reserved. # Reproduction or distribution, in whole # or in part, is forbidden except by express written permission # of ReversingLabs Inc. # # -- A1000_JSON_BASE_UR...
# Provided by Dr. Marzieh Ahmadzadeh & Nick Cheng. Edited by Yufei Cui class DNode(object): '''represents a node as a building block of a double linked list''' def __init__(self, element, prev_node=None, next_node=None): '''(Node, obj, Node, Node) -> NoneType construct a Dnode as building blo...
a = 256 b = 256 print(a is b) """ output:True """ c = 257 d = 257 print(id(c),id(d))
class ProductLabels(object): def __init__(self, labels, labels_tags, labels_fr): self.Labels = labels self.LabelsTags = labels_tags self.LabelsFr = labels_fr def __str__(self): return self .Labels
def dds_insert(d, s, p, o): if d.get(s) is None: d[s] = {} if d[s].get(p) is None: d[s][p] = set() d[s][p].add(o) def dds_remove(d, s, p, o): if d.get(s) is not None and d[s].get(p) is not None: d[s][p].remove(o) if not d[s][p]: del d[s][p] if not d[s]: del d[s] class JsonL...
# BGR colors WHITE = (255, 255, 255) BLACK = (0, 0, 0) GRAY25 = (64, 64, 64) GRAY50 = (128, 128, 128) GRAY75 = (192, 192, 192) GRAY33 = (85, 85, 85) GRAY66 = (170, 170, 170) BLUE = (255, 0, 0) GREEN = (0, 255, 0) RED = (0, 0, 255) CYAN = (255, 255, 0) MAGENTA = (255, 0, 255) YELLOW = (0, 255, 255) ORANGE = (0, 12...
#Altere o programa anterior para mostrar no final a soma dos números. n1 = int(input("Digite um número: ")) n2 = int(input("Digite outro número: ")) for i in range(n1 + 1, n2): print(i) for i in range(n2 + 1, n1): print(i) print("Soma dos números: ", i + i)
class Node(object): value = None left_child = None right_child = None def __init__(self, value, left=None, right=None): self.value = value if left: self.left_child = left if right: self.right_child = right def __str__(self): return self.value...
# START LAB EXERCISE 04 print('Lab Exercise 04 \n') # SETUP city_state = ["Detroit|MI", "Philadelphia|PA", "Hollywood|CA", "Oakland|CA", "Boston|MA", "Atlanta|GA", "Phoenix|AZ", "Birmingham|AL", "Houston|TX", "Tampa|FL"] # END SETUP # PROBLEM 1.0 (5 Points) # PROBLEM 2.0 (5 Points) # PROBL...
# -*- coding: utf-8 -*- string1 = "Becomes" string2 = "becomes" string3 = "BEAR" string4 = " bEautiful" string1 = string1.lower() # (string2 will pass unmodified) string3 = string3.lower() string4 = string4.strip().lower() print(string1.startswith("be")) print(string2.startswith("be")) print(string3.startswith("be")) p...
class Node(object): def __init__(self, data=None, left=None, right=None): self.data = data self.left = left self.right = right class BinarySearchTree(object): def __init__(self, root=None): self.root = root def get_root(self): return self.root def insert(self,...
input = """af AND ah -> ai NOT lk -> ll hz RSHIFT 1 -> is NOT go -> gp du OR dt -> dv x RSHIFT 5 -> aa at OR az -> ba eo LSHIFT 15 -> es ci OR ct -> cu b RSHIFT 5 -> f fm OR fn -> fo NOT ag -> ah v OR w -> x g AND i -> j an LSHIFT 15 -> ar 1 AND cx -> cy jq AND jw -> jy iu RSHIFT 5 -> ix gl AND gm -> go NOT bw -> bx jp...
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class CentrifySchemaEnum(object): """Implementation of the 'CentrifySchema' enum. Specifies the schema of this Centrify zone. The below list of schemas and their values are taken from the document Centrify Server Suite 2016 Windows API Programmer...
# Quebrando um número '''Minha Solução''' '''from math import floor valor = float(input('Digite um valor: ')) numQuebrado = floor(valor) print('O valor digitado foi {} e a sua porção inteira é {}'.format(valor, numQuebrado))''' '''Solução Professor ''' '''from math import trunc num = float(input('Digite um valor: '))...
def ask_question(): print("Who is the founder of Facebook?") option=["Mark Zuckerberg","Bill Gates","Steve Jobs","Larry Page"] for i in option: print(i) ask_question() i=0 while i<100: ask_question() i+=1 def say_hello(name): print ("Hello ", name) print ("Aap kaise ho?") say_hello("jai") def a...
input_file = open("input.txt","r") lines = input_file.readlines() count = 0 answers = set() for line in lines: if line == "\n": count += len(answers) print(answers) answers.clear() for character in line: #print(character) if character != "\n": answers.add(cha...
def fn(): num1=1 num3=20 sum=num1+num2 print(sum) num=10 def school(): students=1000 classes=12 avg=students/classes return avg num1=school() if num1>500: print('人数很好')
class BankAccount: def __init__(self): self.accountNum = 0 self.accountOwner = "" self.accountBalance = 0.00 def ModifyAccount(self, id, name, balance): self.accountNum = id self.accountOwner = name self.accountBalance = balance account = BankAccount() acco...
# Tai Sakuma <tai.sakuma@gmail.com> ##__________________________________________________________________|| def expand_path_cfg(path_cfg, alias_dict={ }, overriding_kargs={ }): """expand a path config Args: path_cfg (str, tuple, dict): a config for path alias_dict (dict): a dict for aliases ...
class Solution: def maxDepth(self, root): if root is None: return 0 return 1 + max(self.maxDepth(root.left), self.maxDepth(root.right))
""" Extension 3 (ext3) Used primarily for concurrent Linux systems (ext2 + journalling) """
termo1 = int(input('Digite o 1º termo da P.A: ')) razao = int(input('Digite a razão desta P.A: ')) decimo = termo1 + (10 - 1) * razao for i in range(termo1, decimo + 1, razao): print(i, end=' ')
lis = [] for i in range (10): num = int(input()) lis.append(num) print(lis) for i in range (len(lis)): print(lis[i])
n = int(input('enter number to find the factorial: ')) fact=1; for i in range(1,n+1,1): fact=fact*i print(fact)
"""Configuration package. This package handle all information that could be given to pycodeanalyzer in the configuration. """
Automoviles=['Dodge Challeger', 'VW Gti', 'Jeep Rubicon', 'Alfa Romeo Quadro', 'Ford ST', 'Dodge RAM', 'Ford FX4'] M1="Me gustaria compar un " + Automoviles[0].title()+"." M2="Mi vecino choco su nuevo " + Automoviles[1].title() + "." M3="El nuevo " + Automoviles[2].title()+ " es mucho mas economico." M4="Hay una gran d...
class Stock: def __init__(self, symbol, name): self.__name = name self.__symbol = symbol self.__stockPlate = [] self.__carePlate = [] @property def name(self): return self.__name @property def symbol(self): return self.__symbol @property def...
#Programa para evaluar si un numero es feliz numero_a_evaluar = input("Introduce el numero a evaluar: ") n = numero_a_evaluar suma = 2 primer_digito = 0 segundo_digito = 0 tercer_digito = 0 cuarto_digito = 0 while suma > 1: primer_digito = numero_a_evaluar[0] primer_digito = int(primer_digito) print(prim...
# -*- coding: utf-8 -*- # Copyright 2018, IBM. # # This source code is licensed under the Apache License, Version 2.0 found in # the LICENSE.txt file in the root directory of this source tree. """ A property set is maintained by the PassManager to keep information about the current state of the circuit """ class Pr...
def read_label_pbtxt(label_path: str) -> dict: with open(label_path, "r") as label_file: lines = label_file.readlines() labels = {} for row, content in enumerate(lines): labels[row] = {"id": row, "name": content.strip()} return labels
co2 = input("Please input air quality value: ") co2 = int(co2) if co2 > 399 and co2 < 698: print("Excelent") elif co2 > 699 and co2 < 898: print("Good") elif co2 > 899 and co2 < 1098: print("Fair") elif co2 > 1099 and co2 < 1598: print("Mediocre, contaminated indoor air") elif co2 > 1599 and c...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"GH_HOST": "00_core.ipynb", "GhApi": "00_core.ipynb", "date2gh": "00_core.ipynb", "gh2date": "00_core.ipynb", "print_summary": "00_core.ipynb", "GhApi.delete_relea...
def wypisz(par1, par2): print('{0} {1}'.format(par1, par2)) def sprawdz(arg1, arg2): if arg1 > arg2: return True else: return False
ce,nll=input("<<") lx=ce*(nll/1200) print("The interest is",lx)
valor1 = int(input('Digite um valor:')) valor2 = int(input('Digite outro valor:')) soma = valor1 + valor2 print(f'A soma entre os valores {valor1} e {valor2} é igual a {soma}!')
class Edge: def __init__(self, src, dst, line): self.src = src self.dst = dst self.line = line assert src != dst, f"Source and destination are the same!" def reverse(self): return Edge(self.dst, self.src, self.line.reverse()) def to_dict(self): return { ...
def to_url_representation(path: str) -> str: """Convert path to a representation that can be used in urls/queries""" return path.replace("_", "-_-").replace("/", "__") def from_url_representation(url_rep: str) -> str: """Reconvert url representation of path to actual path""" return url_rep.replace("__...
with open('log', 'r') as logfile: for line in logfile: if line.__contains__('LOG'): print(line) #pvahdatn@cs-arch-20:~/git/dandelion-lib$ sbt "testOnly dataflow.test03Tester" > log
''' Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Given linked list -- head = [4,5,1,9], which looks like following: Example 1: Input: head = [4,5,1,9], node = 5 Output: [4,1,9] Explanation: You are given the second node with value 5, the linked list s...
class SortStrategy: def sort(self, dataset): pass class BubbleSortStrategy(SortStrategy): def sort(self, dataset): print('Sorting using bubble sort') return dataset class QuickSortStrategy(SortStrategy): def sort(self, dataset): print('Sorting using quick sort') re...
''' BF C(n,k)*n O(n!) LeetCode 516 DP find the longest palindrome sequence O(n^2) ''' class Solution: def isValidPalindrome(self, s: str, k: int) -> bool: n = len(str) dp = [[0]*n for _ in range(n)] for i in range(n-2, -1, -1): dp[i][i] = 1 for j in range(i+1, n)...
def calcula_se_um_numero_eh_par(numero): if type(numero) == int: if numero % 2 == 0: return True return False
class StompError(Exception): def __init__(self, message, detail): super(StompError, self).__init__(message) self.detail = detail class StompDisconnectedError(Exception): pass class ExceededRetryCount(Exception): pass
""" BiNode: Consider a simple data structure called BiNode, which has pointers to two other nodes. The data structure BiNode could be used to represent both a binary tree (where nodel is the left node and node2 is the right node) or a doubly linked list (where nodel is the previous node and node2 is the next node)....
def count_votes(reactions): """ takes in a string with reactions from discord parses it and return a tuple of the toal votes on each alternative """ positive_vote = "👍" negative_vote = "👎" alternatives = [positive_vote, negative_vote] results={} for a in alternatives: posi...
class ParticleDataAccessor(object): """ This class provides access to the underlying data model. """ LINE_STYLE_SOLID = 0 LINE_STYLE_DASH = 1 LINE_STYLE_WAVE = 2 LINE_STYLE_SPIRAL = 3 LINE_VERTEX = 4 def id(self, object): """ Returns an id to identify given object. ...
description = 'setup for the NICOS collector' group = 'special' devices = dict( CacheKafka=device( 'nicos_ess.devices.cache_kafka_forwarder.CacheKafkaForwarder', dev_ignore=['space', 'sample'], brokers=configdata('config.KAFKA_BROKERS'), output_topic="nicos_cache", update_int...
class Solution: def kLengthApart(self, nums: List[int], k: int) -> bool: if 1 not in nums: return True start, end = nums.index(1), nums.index(1)+1 while end < len(nums): if nums[start] == 1 and nums[end] == 1 and end - start <= k: return False elif num...
""" This module contains all notification payload objects.""" class BaseMsg(dict): """The BaseClass of all objects in notification payload.""" apns_keys = [] def __init__(self, custom_fields={}, **apn_args): super(BaseMsg, self).__init__(custom_fields, **apn_args) if custom_fields: ...
# Copyright https://www.globaletraining.com/ # List comprehensions provide a concise way to create lists. my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] def main(): final_list = [] for n in my_list: final_list.append(n + 10) print(final_list) # TODO: Using Comprehension final_list_comp1 = [n...
"""Win animation frames for Mystery Mansion. Animation from: http://www.angelfire.com/ca/mathcool/fireworks.html """ win_animation = [ """ .| | | |'| ._____ ___ | | |. |' .---"| _ .-' ...
#!/usr/local/bin/python3 def main(): for i in range(1, 8): print("============================") print("Towers of Hanoi: {} Disks".format(i)) towers_of_hanoi(i) print("Number of moves: {}".format(2**i - 1)) print("============================") return 0 def towers_of...
def domino(): """Imprime todas las fichas de domino""" a = 0 b = 0 for k in range (0,7): a = k for i in range (a, 7): b = i print (a, b)
# -*- coding: utf-8 -*- """PACKAGE INFO This module provides some basic information about the package. """ # Set the package release version version_info = (0, 0, 0) __version__ = '.'.join(str(c) for c in version_info) # Set the package details __author__ = 'Jonah Crawford' __email__ = 'jonah.crawford@icloud.com' ...
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "/home/tekmen0/meturone_egitim/src/meturone_egitim/msg/Dummy.msg;/home/tekmen0/meturone_egitim/src/meturone_egitim/msg/answer.msg" services_str = "" pkg_name = "meturone_egitim" dependencies_str = "std_msgs" langs = "gencpp;geneus;genlisp;gennodejs;gen...
XK_Greek_ALPHAaccent = 0x7a1 XK_Greek_EPSILONaccent = 0x7a2 XK_Greek_ETAaccent = 0x7a3 XK_Greek_IOTAaccent = 0x7a4 XK_Greek_IOTAdiaeresis = 0x7a5 XK_Greek_OMICRONaccent = 0x7a7 XK_Greek_UPSILONaccent = 0x7a8 XK_Greek_UPSILONdieresis = 0x7a9 XK_Greek_OMEGAaccent = 0x7ab XK_Greek_accentdieresis = 0x7ae XK_Greek...