content
stringlengths
7
1.05M
nome = input('Digite seu nome: ') name = input('Type your name: ') print('É um prazer te conhecer, {}{}{}!'.format('\033[1;36m', nome, '\033[m')) print('It is nice to meet you, {}{}{}!'.format('\033[4;30m', name, '\033[m'))
class ATMOS(object): ''' class ATMOS - attributes: - self defined - methods: - None ''' def __init__(self,info): self.info = info for key in info.keys(): setattr(self, key, info[key]) def __repr__(self): return 'Instance of class AT...
t=int(input()) if not (1 <= t <= 100000): exit(-1) dp=[0]*100001 dp[3]=3 for i in range(4,100001): if i%3==0 or i%7==0: dp[i]=i dp[i]+=dp[i-1] query=[*map(int,input().split())] if len(query)!=t: exit(-1) for i in query: if not (10 <= int(i) <= 80000): exit(-1) print(dp[int(i)]) succ=False try: input(...
""" Define the environment paths """ #Path variables TEMPLATE_PATH = "/home/scom/documents/opu_surveillance_system/monitoring/master/" STATIC_PATH = "/home/scom/documents/opu_surveillance_system/monitoring/static/"
N = int(input()) A = list(map(int, input().split())) ans = 0 for a in A: if a > 10: ans += a - 10 print(ans)
#!/usr/bin/env python # encoding: utf-8 def run(whatweb, pluginname): whatweb.recog_from_content(pluginname, "espcms") whatweb.recog_from_file(pluginname, "templates/wap/cn/public/footer.html", "espcms")
vetor = [] entradaUsuario = int(input()) repetir = 1000 indice = 0 adicionar = 0 while(repetir > 0): vetor.append(adicionar) adicionar += 1 if(adicionar == entradaUsuario): adicionar = 0 repetir -= 1 repetir = 1000 while(repetir>0): repetir -= 1 print("N[{}] = {}".format(indice, vetor[indice])) indic...
# -*- coding: utf-8 -*- """ eve-app settings """ # Use the MongoHQ sandbox as our backend. MONGO_HOST = 'localhost' MONGO_PORT = 27017 MONGO_USERNAME = '' MONGO_PASSWORD = '' MONGO_DBNAME = 'notifications' # also, correctly set the API entry point # SERVER_NAME = 'localhost' # Enable reads (GET), inserts (POS...
# AUTHOR = PAUL KEARNEY # DATE = 2018-02-05 # STUDENT ID = G00364787 # EXERCISE 03 # # filename= gmit--exercise03--collatz--20180205d.py # # the Collatz conjecture print("The COLLATZ CONJECTURE") # define the variables num = "" x = 0 # obtain user input num = input("A start nummber: ") x = int(...
#Faça um programa que calcule a soma entre todos os números ímpares que são múltiplos de 3 e que se encontram # no intervalo de 1 até 500. soma = 0 cont = 0 for c in range(1,501,2): if c % 3 == 0: cont = cont + 1 soma = soma + c print('A soma dos números solicitados {} são {}'.format(cont, soma))
"""django-livereload""" __version__ = '1.7' __license__ = 'BSD License' __author__ = 'Fantomas42' __email__ = 'fantomas42@gmail.com' __url__ = 'https://github.com/Fantomas42/django-livereload'
DEFAULT_TEXT_TYPE = "mrkdwn" class BaseBlock: def generate(self): raise NotImplemented("Subclass missing generate implementation") class TextBlock(BaseBlock): def __init__(self, text, _type=DEFAULT_TEXT_TYPE): self._text = text self._type = _type def __repr__(self): retu...
""" CPF = 079.004.419-64 ---------------------- 0 * 10 = 0 # 0 * 11 = 0 7 * 9 = 63 # 7 * 10 = 70 9 * 8 = 72 # 9 * 9 = 81 0 * 7 = 0 # 0 * 8 = 0 0 * 6 = 0 # 0 * 7 = 0 4 * 5 = 20 # 4 * 6 = 24 4 * 4 = 16 # 4 * 5 =...
#Script to calc. area of circle. print("enter the radius") r= float(input()) area= 3.14*r**2 print("area of circle is",area)
#doc4 #1. print([1, 'Hello', 1.0]) #2 print([1, 1, [1,2]][2][1]) #3. out: 'b', 'c' print(['a','b', 'c'][1:]) #4. weekDict= {'Sunday':0,'Monday':1,'Tuesday':2,'Wednesday':3,'Thursday':4,'Friday':5,'Saturday':6, } #5. out: 2 if you replace D[k1][1] with D['k1][1] D={'k1':[1,2,3]} print(D['k1'][1]) #6. tup = ( ...
description = 'Resi instrument setup' group = 'basic' includes = ['base']
def quick_sort(array): ''' Prototypical quick sort algorithm using Python Time and Space Complexity: * Best: O(n * log(n)) time | O(log(n)) space * Avg: O(n * log(n)) time | O(log(n)) space * Worst: O(n^2) time | O(log(n)) space ''' return _quick_sort(array, 0, len(array)-1) def _quick_sort(arr...
def loops(): # String Array names = ["Apple", "Orange", "Pear"] # \n is a newline in a string print('\n---------------') print(' For Each Loop') print('---------------\n') # For Each Loop for i in names: print(i) print('\n---------------') print(' For Loop') prin...
def solution(participant, completion): answer = '' # sort하면 시간절약이 가능 participant.sort() # [a, a, b] completion.sort() # [a, b] print(participant) print(completion) for i in range(len(completion)): if participant[i] != completion[i]: answer = participant[i] bre...
class Node: def __init__(self, value, next_p=None): self.next = next_p self.value = value def __str__(self): return f'{self.value}' class InvalidOperationError(Exception): pass class Stack: def __init__(self): self.top = None def push(self, value): curren...
def main(): number = int(input("Enter number (Only positive integer is allowed)")) print(f'{number} square is {number ** 2}') # Press the green button in the gutter to run the script. if __name__ == '__main__': main()
number_of_computers = int(input()) number_of_sales = 0 real_sales = 0 made_sales = 0 counter_sales = 0 total_ratings = 0 for i in range (number_of_computers): rating = int(input()) rating_scale = rating % 10 possible_sales = rating // 10 total_ratings += rating_scale if rating_scale == 2: r...
""" Created: 2001/08/05 Purpose: Turn PythonCard into a package __version__ = "$Revision: 1.1.1.1 $" __date__ = "$Date: 2001/08/06 19:53:11 $" """
def main(): valid_passwords_by_range_policy = 0 valid_passwords_by_position_policy = 0 with open('input') as f: for line in f: policy_string, password = parse_line(line.strip()) policy = Policy.parse(policy_string) if policy.is_valid_by_range_policy(password): ...
# LTE using two pointers O(n**3) class Solution(object): def fourSumCount(self, A, B, C, D): # corner case: if len(A) == 0: return 0 A.sort() B.sort() C.sort() D.sort() count = 0 for i in range(len(A)): for j in range(len(B)...
def tree_16b(features): if features[12] <= 0.0026689696301218646: if features[2] <= 0.00825153129312639: if features[19] <= 0.005966400067336508: if features[19] <= 0.0029812112336458085: if features[17] <= 0.001915214421615019: return 0 else: # if features[17] > 0.0...
class Employee: def __init__(self, name, emp_id, email_id): self.__name=name self.__emp_id=emp_id self.__email_id=email_id def get_name(self): return self.__name def get_emp_id(self): return self.__emp_id def get_email_id(self): return self.__email_id ...
class tablecloumninfo: col_name="" data_type="" comment="" def __init__(self,col_name,data_type,comment): self.col_name=col_name self.data_type=data_type self.comment=comment
class GraphLearner: """Base class for causal discovery methods. Subclasses implement different discovery methods. All discovery methods are in the package "dowhy.causal_discoverers" """ def __init__(self, data, library_class, *args, **kwargs): self._data = data self._labels = list(self._data.columns) self...
""" aiida_crystal_dft AiiDA plugin for running the CRYSTAL code """ __version__ = "0.8"
class attributes_de: def __init__(self,threshold_list,range_for_r): self.country_name = 'Germany' self.population = 83190556 self.url = 'https://opendata.arcgis.com/datasets/dd4580c810204019a7b8eb3e0b329dd6_0.geojson' self.contains_tests=False self.csv=False # if the resource...
""" Common bazel version requirements for tests """ CURRENT_BAZEL_VERSION = "5.0.0" OTHER_BAZEL_VERSIONS = [ "4.2.2", ] SUPPORTED_BAZEL_VERSIONS = [ CURRENT_BAZEL_VERSION, ] + OTHER_BAZEL_VERSIONS
# See also examples/example_track/track_meta.py for a longer, commented example track = dict( author_username='dansbecker', course_name='Machine Learning', course_url='https://www.kaggle.com/learn/intro-to-machine-learning' ) lessons = [ dict( topic='Your First BiqQuery ML Model', ...
class Solution: def canThreePartsEqualSum(self, A: List[int]) -> bool: # Since all the three parts are equal, if we sum all element of arrary it should be a multiplication of 3 # so the sum of each part must be equal to sum of all element divided by 3 quotient, remainder = divmod(sum(A), 3) ...
STATE_CITY = "fluids_state_city" OBS_QLIDAR = "fluids_obs_qlidar" OBS_GRID = "fluids_obs_grid" OBS_BIRDSEYE = "fluids_obs_birdseye" OBS_NONE = "fluids_obs_none" BACKGROUND_CSP = "fluids_background_csp" BACKGROUND_NULL = "fluids_background_null" REWARD_PATH = "fluids_reward_path" REWARD_NONE = "fluids_rew...
class Solution: def generate(self, num_rows): if num_rows == 0: return [] ans = [1] result = [ans] for _ in range(num_rows - 1): ans = [1] + [ans[i] + ans[i + 1] for i in range(len(ans[:-1]))] + [1] result.append(ans) return result
for testcase in range(int(input())): n = int(input()) dict = {} comb = 1 m = (10**9)+7 for x in input().split(): no = int(x) try: dict[no] = dict[no] + 1 except: dict[no] = 1 dict = list(dict.items()) dict.sort(key=lambda x: x[0], reverse=Tru...
class Timer: def __init__(self, duration, ticks): self.duration = duration self.ticks = ticks self.thread = None def start(self): pass # start Thread here
#MAIN PROGRAM STARTS HERE: num = int(input('Enter the number of rows and columns for the square: ')) for x in range(1, num + 1): for y in range(1, num - 2 + 1): print ('{} {} '.format(x, y), end='') print()
class PrivilegeNotHeldException(UnauthorizedAccessException): """ The exception that is thrown when a method in the System.Security.AccessControl namespace attempts to enable a privilege that it does not have. PrivilegeNotHeldException() PrivilegeNotHeldException(privilege: str) PrivilegeNotHeldExcepti...
def segmented_sieve(n): # Create an boolean array with all values True primes = [True]*n for p in range(2,n): #If prime[p] is True,it is a prime and its multiples are not prime if primes[p]: for i in range(2*p,n,p): # Mark every multiple of a prime as not prim...
# Fonte: https://leetcode.com/problems/string-to-integer-atoi/ # Autor: Bruno Harlis # Data: 03/08/2021 """ Implemente a função myAtoi(string s), que converte uma string em um inteiro assinado de 32 bits (semelhante à função C / C ++ atoi). O algoritmo para myAtoi(string s) é o seguinte: Leia e ignore qualquer espaç...
def test_test(): """A generic test :return: """ assert True
class AuxPowMixin(object): AUXPOW_START_HEIGHT = 0 AUXPOW_CHAIN_ID = 0x0001 BLOCK_VERSION_AUXPOW_BIT = 0 @classmethod def is_auxpow_active(cls, header) -> bool: height_allows_auxpow = header['block_height'] >= cls.AUXPOW_START_HEIGHT version_allows_auxpow = header['version'] & cls.B...
#!/usr/bin/env python3 #filter sensitive words in user's input def replace_sensitive_words(input_word): s_words = [] with open('filtered_words','r') as f: line = f.readline() while line != '': s_words.append(line.strip()) line = f.readline() for word in s_words: ...
#Faça um algoritimo que leia o preço de um produto e mostre o seu novo preço com 5% de desconto. price = float(input("Digite o preço do produto: ")) sale = price - (price * 0.05) print("O valor bruto do produto é: {:.2f}R$.".format(price)) print("Com o desconto de 5%: {:.2f}R$".format(sale))
#Calcular el salario neto de un tnrabajador en fucion del numero de horas trabajadas, el precio de la hora #y el descuento fijo al sueldo base por concepto de impuestos del 20% horas = float(input("Ingrese el numero de horas trabajadas: ")) precio_hora = float(input("Ingrese el precio por hora trabajada: ")) sueldo_ba...
# Copyright 2017 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
class Runtime: @staticmethod def v3(major: str, feature: str, ml_type: str = None, scala_version: str = "2.12"): if ml_type and ml_type.lower() not in ["cpu", "gpu"]: raise ValueError('"ml_type" can only be "cpu" or "gpu"!') return "".join( [ f"{major}.", ...
s = 'abc'; print(s.isupper(), s) s = 'Abc'; print(s.isupper(), s) s = 'aBc'; print(s.isupper(), s) s = 'abC'; print(s.isupper(), s) s = 'abc'; print(s.isupper(), s) s = 'ABC'; print(s.isupper(), s) s = 'abc'; print(s.capitalize().isupper(), s.capitalize())
#!/usr/bin/env python ''' Global Variables convention: * start with UpperCase * have no _ character * may have mid UpperCase words ''' Debug = True Silent = True Verbose = False CustomerName = 'customer_name' AuthHeader = {'Content-Type': 'application/json'} BaseURL = "https://firewall-api.d-zone.ca" ...
"""Base observer class for weighmail operations. """ class BaseObserver(object): """Base observer class; does nothing.""" def searching(self, label): """Called when the search process has started for a label""" pass def labeling(self, label, count): """Called when the labelling p...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2021/12/4 22:00 # @Author : weihuchao def insert_sort(data): """ 从前往后遍历, 假定前面部分已经有序, 查看当前元素应该在前面部分的哪个位置 """ for idx in range(1, len(data)): tmp = data[idx] j = idx - 1 while j >= 0 and tmp < data[j]: data[j ...
# # PySNMP MIB module FUNI-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FUNI-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:03:03 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:23:1...
x = 5 x |= 3 print(x)
## CUDA blocks are initialized here! ## Created by: Aditya Atluri ## Date: Mar 03 2014 def bx(blocks_dec, kernel): if blocks_dec == False: string = "int bx = blockIdx.x;\n" kernel = kernel + string blocks_dec = True return kernel, blocks_dec def by(blocks_dec, kernel): if blocks_dec == False: string = "int...
# test unicode in identifiers # comment # αβγδϵφζ # global identifiers α = 1 αβγ = 2 bβ = 3 βb = 4 print(α, αβγ, bβ, βb) # function, argument, local identifiers def α(β, γ): δ = β + γ print(β, γ, δ) α(1, 2) # class, method identifiers class φ: def __init__(self): pass def δ(self, ϵ): ...
def sample(name, custom_package): native.android_binary( name = name, deps = [":sdk"], srcs = native.glob(["samples/" + name + "/src/**/*.java"]), custom_package = custom_package, manifest = "samples/" + name + "/AndroidManifest.xml", resource_files = native.glob(["sa...
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class TenantProxy(object): """Implementation of the 'TenantProxy' model. Specifies the data for tenant proxy which has been deployed in tenant's enviroment. Attributes: constituent_id (long|int): Specifies the constituent id of the prox...
# generated from catkin/cmake/template/order_packages.context.py.in source_root_dir = '/home/sim2real/ep_ws/src' whitelisted_packages = ''.split(';') if '' != '' else [] blacklisted_packages = ''.split(';') if '' != '' else [] underlay_workspaces = '/home/sim2real/carto_ws/devel_isolated/cartographer_rviz;/home/sim2rea...
# # PySNMP MIB module CISCOSB-RMON (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCOSB-RMON # Produced by pysmi-0.3.4 at Wed May 1 12:23:18 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,...
#!/usr/bin/env/ python3 """SoloLearn > Code Coach > Hovercraft""" sales = int(input('How many did you sell? ')) * 3 expense = 21 if sales > expense: print('Profit') elif sales < expense: print('Loss') else: print('Broke Even')
class SearchResult(object): """Class representing a return object for a search query. Attributes: path: An array representing the path from a start node to the end node, empty if there is no path. path_len: The length of the path represented by path, 0 if path is empty. ele_gain: The cu...
class Stats: writes: int reads: int accesses: int def __init__(self) -> None: self.reset() def reset(self) -> None: self.writes = 0 self.reads = 0 self.accesses = 0 def add_reads(self, count: int = 1) -> None: self.reads += count self.accesses +...
colors = ['black', 'white'] sizes = ['S', 'M', 'L'] tshirts = [ (color, size) for color in colors for size in sizes ] print(f"Cartesian products from {colors} and {sizes}: {tshirts}")
class Eventseverity(basestring): """ EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFORMATIONAL|DEBUG Possible values: <ul> <li> "emergency" - System is unusable, <li> "alert" - Action must be taken immediately, <li> "critical" - Critical condition, <li> "error" ...
MAX_SENTENCE = 30 MAX_ALL = 50 MAX_SENT_LENGTH=MAX_SENTENCE MAX_SENTS=MAX_ALL max_entity_num = 10 num = 100 num1 = 200 num2 = 100 npratio=4
#Faça um programa que calcule e escreva o valor de S # S=1/1+3/2+5/3+7/4...99/50 u=1 valores=[] for c in range(1,100): if(c%2==1): valores.append(round(c/u,2)) u+=1 print(valores) print(f"S = {sum(valores)}")
""" File defining the classes Normalize and Standardize used respectively to normalize and standardize the data set. """ class Normalize(object): """ Data pre-processing class to normalize data so the values are in the range [new_min, new_max]. """ def __init__(self, min_, max_, new_min=0, new_max=1)...
n=1 def f(x): print(n) f(0)
# creates a list and prints it days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] # traversing without an index for day in days: print(day) # traversing with an index for i in range(len(days)): print(f"Day {i} is {days[i]}") days[1] = "Lunes" print("Day[1] is now ...
# -*- coding: utf-8 -*- # Memory addresses ADDRESS_R15 = 0x400f ADDRESS_ADC_POWER = 0x4062 ADDRESS_ADC_BATTERY = 0x4063 ADDRESS_LEVELA = 0x4064 ADDRESS_LEVELB = 0x4065 ADDRESS_PUSH_BUTTON = 0x4068 ADDRESS_COMMAND_1 = 0x4070 ADDRESS_COMMAND_2 = 0x4071 ADDRESS_MA_MIN_VALUE = 0x4086 ADDRESS_MA_MAX_VALUE = 0x4087 ADDRESS_...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jun 13 11:34:33 2019 @author: manninan """
r""" .. include::../README.md :start-line: 1 """
# http://www.codewars.com/kata/55f73f66d160f1f1db000059/ def combine_names(first_name, last_name): return "{0} {1}".format(first_name, last_name)
class DefaultPreferences(type): """The type for Default Preferences that cannot be modified""" def __setattr__(cls, key, value): if key == "defaults": raise AttributeError("Cannot override defaults") else: return type.__setattr__(cls, key, value) def __delattr__(c...
# ------------------------------------------ # # Program created by Maksim Kumundzhiev # # # email: kumundzhievmaxim@gmail.com # github: https://github.com/KumundzhievMaxim # ------------------------------------------- BATCH_SIZE = 10 IMG_SIZE = (160, 160) MODEL_PATH = 'checkpoints/model'
#1 num = int(input("Enter a number : ")) largest_divisor = 0 #2 for i in range(2, num): #3 if num % i == 0: #4 largest_divisor = i #5 print("Largest divisor of {} is {}".format(num,largest_divisor))
# Description # 中文 # English # Given a string(Given in the way of char array) and an offset, rotate the string by offset in place. (rotate from left to right) # offset >= 0 # the length of str >= 0 # Have you met this question in a real interview? # Example # Example 1: # Input: str="abcdefg", offset = 3 # Output:...
class ObjectProperties: def __init__(self, object_id, extra_data=None, ticket_type=None, quantity=None): if extra_data: self.extraData = extra_data self.objectId = object_id if ticket_type: self.ticketType = ticket_type if quantity: self.quantity =...
class Solution: def lengthOfLongestSubstring(self, s: str) -> int: if len(s) == 0: return 0 m = 1 for _ in range(len(s)): i = 0 S = set() for x in range(_, len(s)): if s[x] not in S: S.add(s...
lookup = [ (10, "x"), (9, "ix"), (5, "v"), (4, "iv"), (1, "i"), ] def to_roman(integer): # """ """ for decimal, roman in lookup: if decimal <= integer: return roman + to_roman(integer - decimal) return "" def main(): print(to_roman(1)) print(to_ro...
class Stack: def __init__(self): self.items = [] def is_empty(self): # test to see whether the stack is empty. return self.items == [] def push(self, item): # adds a new item to the top of the stack. self.items.append(item) def pop(self): # removes the top item from the sta...
class Book: def __init__(self, title, author, location): self.title = title self.author = author self.location = location self.page = 0 def turn_page(self, page): self.page = page
class Entity(object): ''' An entity has: - energy - position(x,y) - size(length, width) An entity may have a parent entity An entity may have child entities ''' def __init__( self, p, parent=None, children=None): ...
""" https://leetcode.com/problems/longest-substring-without-repeating-characters/ Given a string, find the length of the longest substring without repeating characters. """ class Solution: def lengthOfLongestSubstring(self, s): longest = 0 longest_substr = "" for ch in s: if...
N = int(input()) A = list(map(int, input().split())) d = {} for i in range(N - 1): if A[i] in d: d[A[i]].append(i + 2) else: d[A[i]] = [i + 2] for i in range(1, N + 1): if i in d: print(len(d[i])) else: print(0)
GENERIC = [ 'Half of US adults have had family jailed', 'Judge stopped me winning election', 'Stock markets stabilise after earlier sell-off' ] NON_GENERIC = [ 'Leicester helicopter rotor controls failed', 'Pizza Express founder Peter Boizot dies aged 89', 'Senior Tory suggests vote could be d...
class Solution: def uniqueLetterString(self, S: str) -> int: idxes = {ch : (-1, -1) for ch in string.ascii_uppercase} ans = 0 for idx, ch in enumerate(S): i, j = idxes[ch] ans += (j - i) * (idx - j) idxes[ch] = j, idx for i, j in idxes.values(): ...
#!/usr/bin/python #coding=utf-8 ''' @author: sheng @license: ''' SPELL=u'yìfēng' CN=u'翳风' NAME=u'yifeng41' CHANNEL='sanjiao' CHANNEL_FULLNAME='SanjiaoChannelofHand-Shaoyang' SEQ='SJ17' if __name__ == '__main__': pass
class Image_Anotation: def __init__(self, id, image, path_image): self.id = id self.FOV = [0.30,0.60] self.image = image self.list_roi=[] self.list_compose_ROI=[] self.id_roi=0 self.path_image = path_image def set_image(self, image): self.imag...
# Hashcode 2021 # Team Depresso # Problem - Traffic Signaling ## Data Containers class Street: def __init__(self,start,end,name,L): self.start = start self.end = end self.name = name self.time = L def show(self): print(self.start,self.end,self.name,self.time) class Car: def __init__(sel...
NEO_HOST = "seed3.neo.org" MAINNET_HTTP_RPC_PORT = 10332 MAINNET_HTTPS_RPC_PORT = 10331 TESTNET_HTTP_RPC_PORT = 20332 TESTNET_HTTPS_RPC_PORT = 20331
# first.n.squares.manual.method.py def get_squares_gen(n): for x in range(n): yield x ** 2 squares = get_squares_gen(3) print(squares.__next__()) # prints: 0 print(squares.__next__()) # prints: 1 print(squares.__next__()) # prints: 4 # the following raises StopIteration, the generator is exhausted, # a...
class binary_tree: def __init__(self): pass class Node(binary_tree): __field_0 : int __field_1 : binary_tree __field_2 : binary_tree def __init__(self, arg_0 : int , arg_1 : binary_tree , arg_2 : binary_tree ): self.__field_0 = arg_0 self.__field_1 = arg_1 self.__fi...
class WindowInteropHelper(object): """ Assists interoperation between Windows Presentation Foundation (WPF) and Win32 code. WindowInteropHelper(window: Window) """ def EnsureHandle(self): """ EnsureHandle(self: WindowInteropHelper) -> IntPtr Creates the HWND of the window if the HWND has ...
def main(): _ = input() string = input() if _ == 0 or _ == 1: return 0 if _ == 2: if string[0] == string[1]: return 1 return 0 last = string[0] cnt = 0 for i in range(1, len(string)): if string[i] == last: cnt += 1 last = str...
num = int(input("Enter a number: ")) sum = 0; size = 0; temp = num; temp2 = num while(temp2!=0): size += 1 temp2 = int(temp2/10) while(temp!=0): remainder = temp%10 sum += remainder**size temp = int(temp/10) if(sum == num): print("It's an armstrong number") else: print("It's not an arms...
#!/usr/bin/env python3 """This is a simple python3 calculator for demonstration purposes some to-do's but we'll get to that""" __author__ = "Sebastian Meier zu Biesen" __copyright__ = "2000-2019 by MzB Solutions" __email__ = "smzb@mitos-kalandiel.me" class Calculator(object): @property def isDebug(self): ...
''' Напишите программу, которая объявляет переменную: "name" и присваивает ей значение "Python". Программа должна напечатать в одну строку, разделяя пробелами: Строку "name" Значение переменной "name" Число 3 Число 8.5 Sample Input: Sample Output: name Python 3 8.5 ''' name = 'Python' print('name', name, 3, 8.5)