content
stringlengths
7
1.05M
""" Module: 'esp32' on esp32 1.11.0 """ # MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-324-g40844fd27 on 2019-07-17', machine='ESP32 module with ESP32') # Stubber: 1.2.0 class ULP: '' RESERVE_MEM = 0 def load_binary(): pass def run(): pass def set_wake...
def isEscapePossible(self, blocked, source, target): blocked = set(map(tuple, blocked)) def dfs(x, y, target, seen): if ( not (0 <= x < 10 ** 6 and 0 <= y < 10 ** 6) or (x, y) in blocked or (x, y) in seen ): return False seen.add((x, y)) ...
# (c) Copyright IBM Corp. 2019. All Rights Reserved. """Class to handle manipulating the ServiceNow Records Data Table""" class ServiceNowRecordsDataTable(object): """Class that handles the sn_records_dt datatable""" def __init__(self, res_client, incident_id): self.res_client = res_client self...
def compute(dna_string1: str, dna_string2: str) -> int: hamming_distance = 0 for index in range(0, len(dna_string1)): if dna_string1[index] is not dna_string2[index]: hamming_distance += 1 return hamming_distance
class Graph(): def __init__(self): self.numberOfNodes = 0 self.adjacentList = {} def __str__(self): return str(self.__dict__) def addVertex(self, node): self.adjacentList[node] = [] self.numberOfNodes += 1 def addEdge(self, nodeA, nodeB): self.adjacentList[nodeA].append(nodeB) self.adjacentList[no...
""" # -*- coding: UTF-8 -*- # **********************************************************************************# # File: CONSTANT file. # Author: Myron # **********************************************************************************# """ AVAILABLE_DATA_FIELDS = [ 'cadd', 'cadw', 'cadm', 'cadq', 'scdh1'...
nome = input('Nome: ') senha = input('Senha: ') while (senha == nome): print ('erro! Faça novamente.') nome = input('Nome: ') senha = input('Senha: ') print("Finish")
message = "zulkepretest make simpletes cpplest" translate = '' i = len(message) - 1 while i >= 0: translate = translate + message[i] i = i - 1 print("enc message is :"+ translate) print("message :"+ message)
#!python #coding: utf-8 #把字典转换成.属性的访问方式.如d['key'] -> d.key class DictObj: def __init__(self,d:dict): if not isinstance(d,(dict,)): self.__dict__['_dict'] = {} else: self.__dict__['_dict'] = d def __getattr__(self,item): try: return self._dict[item] ...
def whats_up_world(): print("What's up world?") if __name__ == "__main__": whats_up_world()
# list(map(int, input().split())) # int(input()) mod = 998244353 # 貰うDP # Pythonで普通に通った. # Aのような累積, のようなものを使って復元して高速化するケースはよくあるらしい. def main(N, S): dp = [0 if n != 0 else 1 for n in range(N)] # dp[i]はマスiに行く通り数. (答えはdp[-1]), dp[0] = 1 (最初にいる場所だから1通り) A = [0 if n != 0 else 1 for n in range(N)] # dp[i] ...
""" Faça um programa que leia um numero inteiro positivo N e imprima os numeros naturais de 0 ate N em ordem crescente. """ n = int(input('Digite um numero positivo: ')) print('Contagem ate o numero digitado:', end=' ') for i in range(0, n+1): print(f'{i}', end=' ')
# exception.py class InvalidSystemClock(Exception): """ 时钟回拨异常 """ pass
# -*- coding: utf-8 -*- featureInfo = dict() featureInfo['m21']=[ ['P22','Quality','Set to 0 if the key signature indicates that a recording is major, set to 1 if it indicates that it is minor and set to 0 if key signature is unknown. Music21 addition: if no key mode is found in the piece, analyze the piece to discove...
class Animal: def __init__(self, age, name): self.age = age # public attribute self.name = name # public attribute def saluda(self, saludo='Hola', receptor = 'nuevo amigo'): print(saludo + " " + receptor) @staticmethod def add(a, b): if isinstance(a, int) and isinstance(...
""" Undefined-Complete-Key A key whose binding is Empty. """ class UndefinedCompleteKey( CompleteKey, ): pass
'''' Лекция 11.1 Магические методы класса !!! Почему так велется лекция, почему преподователь не гтовится заранее, а на средине лекции меняеются начальные условия и потом идут исправления по всему коду Как вот так... преподователь что то делает делает а потом говорит видимо не получается... ПОчему? ''' # Часть 1 ...
class Filenames: class models: base = './res/models/player/' player = base + 'bicycle.obj' base = './res/models/oponents/' player = base + 'bicycle.obj' class textures: base = './res/textures/' floor_tile = base + 'floor.png' ...
#!/usr/bin/env python # -*- coding: utf-8 -*- class PodiumEventDevice(object): """ Object that represents a device at an event. **Attributes:** **eventdevice_id** (str): Unique id for device at this event **uri** (str): URI for this device at this event. **channels** (l...
"""Exceptions for event processor.""" class EventProcessorError(BaseException): """General exception for the event-processor library.""" class FilterError(EventProcessorError): """Exception for failures related to filters.""" class InvocationError(EventProcessorError): """Exception for failures in inv...
class Recursion: def PalindromeCheck(self, strVal, i, j): if i>j: return True return self.PalindromeCheck(strVal, i + 1, j - 1) if strVal[i] == strVal[j] else False strVal = "q2eeeq" obj = Recursion() print(obj.PalindromeCheck(strVal, 0, len(strVal)-1))
# Identity vs. Equality # - is vs. == # - working with literals # - isinstance() a = 1 b = 1.0 c = "1" print(a == b) print(a is b) print(c == "1") print(c is "1") print(b == 1) print(b is 1) print(b == 1 and isinstance(b, int)) print(a == 1 and isinstance(a, int)) # d = 100000000000000000000000000000000 d = float...
# 54. Spiral Matrix # O(n) time | O(n) space class Solution: def spiralOrder(self, matrix: [[int]]) -> [int]: """ Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Input: [ [ 1, 2, 3 ], [...
age=input("How old ara you?") height=input("How tall are you?") weight=input("How much do you weigth?") print("So ,you're %r old , %r tall and %r heavy ." %(age,height,weight))
# my_nameという変数に「にんじゃわんこ」という文字列を代入してください my_name = "にんじゃわんこ" # my_nameを用いて、「私はにんじゃわんこです」となるように変数と文字列を連結して出力してください print ("私は" + my_name + "です")
class Room(): """ A room to give lectures in. """ def __init__(self, number, lectures, timeslots): """ Constructor """ self.number = number self._lectures = lectures self._timeslots = timeslots def can_be_used_for(self, lecture): """ ...
def compute_bag_of_words(dataset,lang,domain_stopwords=[]): d = [] for index,row in dataset.iterrows(): text = row['title'] #texto do evento text2 = remove_stopwords(text, lang,domain_stopwords) text3 = stemming(text2, lang) d.append(text3) matrix = CountVectorizer(max_features=1000) X = m...
def generator(): try: yield except RuntimeError as e: print(e) yield 'hello after first yield' g = generator() next(g) result = g.throw(RuntimeError, 'Broken') assert result == 'hello after first yield'
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
favorite_fruits = ['apple', 'orange', 'pineapple'] if 'apple' in favorite_fruits: print("You really like apples!") if 'grapefruit' in favorite_fruits: print("You really like grapefruits!") else: print("Why don't you like grapefruits?") if 'orange' not in favorite_fruits: print("Why don't you like ora...
expected_output = { "vrf": { "default": { "local_label": { 24: { "outgoing_label_or_vc": { "No Label": { "prefix_or_tunnel_id": { "10.23.120.0/24": { ...
#============================================================= # modules for HSPICE sim #============================================================= #============================================================= # varmap definition #------------------------------------------------------------- # This ...
"""This module holds string constants to be used in conjunction with API calls to MapRoulette.""" # Query string parameters QUERY_PARAMETER_Q = "q" QUERY_PARAMETER_PARENT_IDENTIFIER = "parentId" QUERY_PARAMETER_LIMIT = "limit" QUERY_PARAMETER_PAGE = "page" QUERY_PARAMETER_ONLY_ENABLED = "onlyEnabled" # Common URIs URI...
""" set:是一个非常有用的数据结构,它与列表的行为类似,区别在于set不能包含重复的值。 """ some_list = ["a", "b", "c", "d", "b", "m", "n", "n"] duplicates = [] for value in some_list: if some_list.count(value) > 1: if value not in duplicates: duplicates.append(value) print(duplicates) set_duplicates = set([x for x in some_list if ...
print("Programa que imprime a tabuada") numero = 5 while numero <= 255: print("\n\n\n") for n in range(1, 11): resultado = numero * n print(numero, "X", n, "=", resultado) numero = numero + 1 print("Fim do programa")
# faça um programa que que o usuario pode digitar vários valores numericos e cadastre-os em uma lista. # Caso o numero já estiver lá dentro ele não sera adicionado # No final serão exibidos em ordem crescente valores = [] conti = cont = 0 while True: conti += 1 num = int(input('Digite um valor: ')) if num n...
""" quest-0 t - number of tests c - number of packages k - capacity w - package weight """ t = int(input()) for i in range(t): task_input = input().split() task_input = [float(variable) for variable in task_input] c, k, w = task_input[0], task_input[1], task_input[2], if c * w <= k: print("yes...
# This sample tests the special-case handle of the multi-parameter # form of the built-in "type" call. # pyright: strict X1 = type("X1", (object,), {}) X2 = type("X2", (object,), {}) class A(X1): ... class B(X2, A): ... # This should generate an error because the first arg is not a stri...
# Copyright (c) 2014 Brocade Communications Systems, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
#!/usr/bin/env python3 # Python 3.5.3 (default, Jan 19 2017, 14:11:04) # [GCC 6.3.0 20170118] on linux def fibo(n): W = [1, 1] for i in range(n): W.append(W[i] + W[i+1]) return(W) def inpt(): n = int(input("steps: ")) print(fibo(n)) inpt()
'''Find the area of the largest rectangle inside histogram''' def pop_stack(current_max, pos, stack): '''Remove item from stack and return area and start position''' start, height = stack.pop() return max(current_max, height * (pos - start)), start def largest_rectangle(hist): '''Find area of largest ...
""" Provides a series of solutions to the challenge provided at the following link: https://therenegadecoder.com/code/how-to-iterate-over-multiple-lists-at-the-same-time-in-python/#challenge """ def next_pokemon_1(pokemon, levels, fainted): best_level = -1 best_choice = pokemon[0] for curr_pokemon, level,...
""" Eliminate Odd Numbers within a List Published by Sri in Python Create a function that takes a list of numbers and returns only the even values. Examples [1, 2, 3, 4, 5, 6, 7, 8] ➞ [2, 4, 6, 8] [43, 65, 23, 89, 53, 9, 6] ➞ [6] [718, 991, 449, 644, 380, 440] ➞ [718, 644, 380, 440] """ def noOdds(lst): return [i ...
print('*'*16) print('Sequência de Fibonacci') print('*'*16) n = int(input('Quantos elementos você quer mostrar? ')) t1 = 0 t2 = 1 if n == 0: exit() elif n == 1: print(t1) elif n == 2: print(t1, ' ► ', t2) else: print(t1, '►', t2, '► ', end='') cont = 3 while cont <= n: t3...
# MIT License # ----------- # Copyright (c) 2021 Sorn Zupanic Maksumic (https://www.usn.no) # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitatio...
pd = int(input()) num = pd while True : rev = 0 temp = num + 1 while temp>0 : rem = temp%10; rev = rev*10 + rem temp = temp//10 if rev == num+1 : print(num+1) break num += 1
DAL_VIEW_PY = """# generated by appcreator from django.db.models import Q from dal import autocomplete from . models import * {% for x in data %} class {{ x.model_name }}AC(autocomplete.Select2QuerySetView): def get_queryset(self): qs = {{ x.model_name }}.objects.all() if self.q: qs = ...
""" https://adventofcode.com/2018/day/14 """ def readFile(): with open(f"{__file__.rstrip('code.py')}input.txt", "r") as f: return f.read() def part1(vals): border = int(vals) scores = [3, 7] elf1 = 0 elf2 = 1 i = 2 while i < border + 10: new = scores[elf1] + scores[elf2] ...
n=int(input()) count=n sumnum=0 if n==0: print("No Data") else: while count>0: num=float(input()) sumnum+=num count-=1 print(sumnum/n)
__config_version__ = 1 GLOBALS = { 'serializer': '{{major}}.{{minor}}.{{patch}}{{status if status}}', } FILES = [{ 'path': 'README.rst', 'serializer': '{{major}}.{{minor}}.{{patch}}'}, 'docs/conf.py', 'setup.py', 'src/oemof/tabular/__init__.py'] VERSION = ['major', 'minor', 'patch', ...
#!/bin/python3 """What is the first Fibonacci number to contain N digits""" #https://www.hackerrank.com/contests/projecteuler/challenges/euler025/problem #First line T number of test cases, then T lines of N values #Constraints: 1 <= T <= 5000; 2 <= N <= 5000 #fibNums = [1,1] fibIndex = [1] #fibIndex[n-1] has the ind...
__version__ = '0.1.2' NAME = 'atlasreader' MAINTAINER = 'Michael Notter' EMAIL = 'michaelnotter@hotmail.com' VERSION = __version__ LICENSE = 'MIT' DESCRIPTION = ('A toolbox for generating cluster reports from statistical ' 'maps') LONG_DESCRIPTION = ('') URL = 'http://github.com/miykael/{name}'.format(n...
# -*- coding: utf-8 -*- class BaseError(Exception): """Base Error in project """ pass
def apply_mode(module, mode): if mode == 'initialize' and 'reset_parameters' in dir(module): module.reset_parameters() for param in module.parameters(): if mode == 'freeze': param.requires_grad = False elif mode in ['fine-tune', 'initialize']: param.requires_grad...
reactions_irreversible = [ # FIXME Automatic irreversible for: Cl- {"CaCl2": -1, "Ca++": 1, "Cl-": 2, "type": "irrev", "id_db": -1}, {"NaCl": -1, "Na+": 1, "Cl-": 1, "type": "irrev", "id_db": -1}, {"KCl": -1, "K+": 1, "Cl-": 1, "type": "irrev", "id_db": -1}, {"KOH": -1, "K+": 1, "OH-": 1, "type": "i...
class FirstOrderFilter: # first order filter def __init__(self, x0, rc, dt, initialized=True): self.x = x0 self.dt = dt self.update_alpha(rc) self.initialized = initialized def update_alpha(self, rc): self.alpha = self.dt / (rc + self.dt) def update(self, x): if self.initialized: ...
# Move to the treasure room and defeat all the ogres. while True: hero.moveUp(4) hero.moveRight(4) hero.moveDown(3) hero.moveLeft() enemy = hero.findNearestEnemy() hero.attack(enemy) hero.attack(enemy) enemy2 = hero.findNearestEnemy() hero.attack(enemy2) hero.attack(enemy2) e...
# Copyright 2017 Intel Corporation # # 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 in wri...
class Solution: def numUniqueEmails(self, emails): """ :type emails: List[str] :rtype: int """ res = [] for email in emails: at_index = email.find("@") temp = email[:at_index].replace(".","") + email[at_index:] at_index = temp.find(...
class SqlAlchemyMediaException(Exception): """ The base class for all exceptions """ pass class MaximumLengthIsReachedError(SqlAlchemyMediaException): """ Indicates the maximum allowed file limit is reached. """ def __init__(self, max_length: int): super().__init__( ...
#! /usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) CloudZero, Inc. All rights reserved. # Licensed under the MIT License. See LICENSE file in the project root for full license information. """ `cloudzero-awstools` tests package. """
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # ------------------------------------------------------------ # File: const.py # Created Date: 2020/6/24 # Created Time: 0:13 # Author: Hypdncy # Author Mail: hypdncy@outlook.com # Copyright (c) 2020 Hypdncy # ------------------------------------------------------------ # ...
# SPDX-FileCopyrightText: 2021 Carter Nelson for Adafruit Industries # # SPDX-License-Identifier: MIT # This file is where you keep secret settings, passwords, and tokens! # If you put them in the code you risk committing that info or sharing it secrets = { # tuples of name, sekret key, color 't...
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") def python3(): http_archive( name = "python3", build_file...
# Python program that uses classes and objects to represent realworld entities class Book(): # A class is a custom datatype template or blueprint title="" # Attribute author="" pages=0 book1 = Book() # An object is an instance of a class book2 = Book() book1.title = "Harry Potter" # The objects attribute ...
note = """ I do not own the pictures, I simply provide for you a connection from your Discord server to Gelbooru using both legal and free APIs. I am not responsible in any way for the content that GelBot will send to the chat. Keep in mind YOU are the one who type the tags. """ help = """ The usage of GelBot is simp...
# INSERTION OF NODE AT END , BEGGINING AND AT GIVEN POS VALUE class linkedListNode: def __init__(self, value, nextNode=None): self.value = value self.nextNode = nextNode class linkedList: def __init__(self, head=None): self.head = head def printList(self): currentNode =...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' @Author: Adam @Date: 2020-04-13 16:48:59 @LastEditTime: 2020-04-17 16:07:33 @LastEditors: Please set LastEditors @Description: In User Settings Edit @FilePath: /LearnPython/python3_senior.py ''' # 高级特征 # ---------------------------------------- start -----------------...
# -*- coding: utf-8 -*- # This file is generated from NI-FAKE API metadata version 1.2.0d9 functions = { 'Abort': { 'codegen_method': 'public', 'documentation': { 'description': 'Aborts a previously initiated thingie.' }, 'parameters': [ { 'dir...
word = "Python" assert "Python" == word[:2] + word[2:] assert "Python" == word[:4] + word[4:] assert "Py" == word[:2] assert "on" == word[4:] assert "on" == word[-2:] assert "Py" == word[:-4] # assert "Py" == word[::2] assert "Pto" == word[::2] assert "yhn" == word[1::2] assert "Pt" == word[:4:2] assert "yh" == word...
a=input() a=a.lower() if(a==a[::-1]): print("String is a PALINDROME") else: print("String NOT a PALINDROME")
class BaseFilter: """The base class to define unified interface.""" def hard_judge(self, infer_result=None): """predict function, and it must be implemented by different methods class. :param infer_result: prediction result :return: `True` means hard sample, `False` mea...
# GIS4WRF (https://doi.org/10.5281/zenodo.1288569) # Copyright (c) 2018 D. Meyer and M. Riechert. Licensed under MIT. geo_datasets = { "topo_10m": ("USGS GTOPO DEM", 0.16666667), "topo_5m": ("USGS GTOPO DEM", 0.08333333), "topo_2m": ("USGS GTOPO DEM", 0.03333333), "topo_30s": ("USGS GTOPO DEM", 0.00833...
class Solution: def minRemoveToMakeValid(self, s: str) -> str: # step 1: 1st pass, traverse the string from left to right lcounter = 0 rcounter = 0 marker = 0 toremove1 = [] for i,char in enumerate(s): if char == '(': lcou...
a = int(input()) b = int(input()) r = a * b while True: if b == 0: break print(a * (b % 10)) b //= 10 print(r)
""" This program displays 'Hello World' on the console by Bailey Nichols dated 1-29-2021 """ print('Hello World')
class ReportGenerator(object): u""" Top-level class that needs to be subclassed to provide a report generator. """ filename_template = 'report-%s-to-%s.csv' mimetype = 'text/csv' code = '' description = '<insert report description>' def __init__(self, **kwargs): if...
# Copyright 2014 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...
# Interface for the data source used in queries. # Currently only includes query capabilities. class Source: def __init__(self): None def isQueryable(self): return False # Check if the source will support the execution of an expression, # given that clauses have already been pushed into it. def su...
# me - this DAT # par - the Par object that has changed # val - the current value # prev - the previous value # # Make sure the corresponding toggle is enabled in the Parameter Execute DAT. def onValueChange(par, prev): if par.name == 'Heartbeatrole': parent().Role_setup(par) else: pass return def onPuls...
# -*- coding:utf-8; -*- class Solution: """ 解题思路:递归 """ def invertTree(self, root): if not root: return root.left, root.right = self.invertTree(root.right), self.invertTree(root.left) return root
def fibonacci(n): if n == 0: return 0 elif n == 1: return 1 fn1 = 0 fn2 = 1 for i in range(1, n): tmp = fn2 fn2 = fn1 + fn2 fn1 = tmp return fn2 if __name__ == '__main__': print(fibonacci(100))
# -*- coding: utf-8 -*- # Settings_Export: control which project settings are exposed to templates # See: https://github.com/jakubroztocil/django-settings-export SETTINGS_EXPORT = [ "SITE_NAME", "DEBUG", "ENV" ] # Settings can be accessed in templates via `{{ '{{' }} settings.<KEY> {{ '}}' }}`.
# Dataset information LABELS = [ 'Atelectasis', 'Cardiomegaly', 'Effusion', 'Infiltration', 'Mass', 'Nodule', 'Pneumonia', 'Pneumothorax', 'Consolidation', 'Edema', 'Emphysema', 'Fibrosis', 'Pleural_Thickening', 'Hernia' ] USE_COLUMNS = ['Image Index', 'Finding Labels', 'Patient ID'] N_CLASSES = len(LABELS)...
#!/bin/python3 DISK_SIZE = 272 INIT_STATE = '00111101111101000' def fill_disk(state, max_size): if len(state) > max_size: return state[:max_size] temp_state = state state += '0' for i in range(1, len(temp_state)+1): state += str(abs(int(temp_state[-i])-1)) return fill_disk(state...
## Valid Phone Number Checker def num_only(): ''' returns the user inputed phone number in the form of only ten digits, and prints the string 'Thanks!' if the number is inputted in a correct format or prints the string 'Invalid number.' if the input is not in correct form num_only: None -> Str...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jul 9 14:20:17 2019 @author: Sven Serneels, Ponalytics """ __name__ = "dicomo" __author__ = "Sven Serneels" __license__ = "MIT" __version__ = "1.0.2" __date__ = "2020-12-20"
envs_dict = { # "Standard" Mujoco Envs "halfcheetah": "gym.envs.mujoco.half_cheetah:HalfCheetahEnv", "ant": "gym.envs.mujoco.ant:AntEnv", "hopper": "gym.envs.mujoco.hopper:HopperEnv", "walker": "gym.envs.mujoco.walker2d:Walker2dEnv", "humanoid": "gym.envs.mujoco.humanoid:HumanoidEnv", "swimm...
#!/usr/bin/env python # _*_ coding:utf-8 _*_ """ testlink.testlink """ class TestSuite(object): def __init__(self, name='', details='', testcase_list=None, sub_suites=None): """ TestSuite (TODO(devin): there is an infinite recursive reference problem with initializing an empty list) :par...
# This file MUST be configured in order for the code to run properly # Make sure you put all your input images into an 'assets' folder. # Each layer (or category) of images must be put in a folder of its own. # CONFIG is an array of objects where each object represents a layer # THESE LAYERS MUST BE ORDERED. # Each...
''' http://pythontutor.ru/lessons/for_loop/problems/factorial/ Факториалом числа n называется произведение 1 × 2 × ... × n. Обозначение: n!. По данному натуральному n вычислите значение n!. Пользоваться математической библиотекой math в этой задаче запрещено. ''' n = int(input()) f = 1 for i in range(1, n+1): f *=...
def setData(field, value, path): f = open(path, "r") lines = f.readlines() f.close() f = open(path, "w+") for line in lines: if (line.find(field) != -1): f.write(field + "=" + str(value) + "\n") else: f.write(line) f.close() return True def getDat...
class Event: def __init__(self): self.handlers = [] def call(self, *args, **kwargs): for h in self.handlers: h(*args, **kwargs) def __call__(self, *args, **kwargs): self.call(*args, **kwargs)
""" module for menus and ascii arts """ ascii_art = """ 8888888b. .d8888b. .d88888b. 888 888 Y88b d88P Y88b d88P" "Y88b 888 888 888 Y88b. 888 888 888 888 d88P 888 888 "Y888b. 888 888 888 8888888P" 888 888 "Y88b. 888 888 888 ...
class ExampleJob: def __init__(self, id): self.id = id self.retry_count = 10 self.retry_pause_sec = 10 def run(self, runtime): pass
#! /usr/bin/env python __author__ = 'Tser' __email__ = '807447312@qq.com' __project__ = 'jicaiauto' __script__ = '__version__.py' __create_time__ = '2020/7/15 23:21' VERSION = (0, 0, 2, 0) __version__ = '.'.join(map(str, VERSION))
_base_ = './pascal_voc12.py' # dataset settings data = dict( samples_per_gpu=2, train=dict( ann_dir=['SegmentationClass', 'SegmentationClassAug'], split=[ 'ImageSets/Segmentation/train.txt', 'ImageSets/Segmentation/aug.txt' ]))
""" Staircase """ def staircase(n): i = 1 while (n + 1) - i: blanks = " " * (n-i) pattern = "#" * i print(blanks+pattern) i += 1 if __name__ == "__main__": staircase(4)
# Copyright 2018 Contributors to Hyperledger Sawtooth # # 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 ...
class StatusWirelessStaRemoteUnms: status: int timestamp: str def __init__(self, data): self.status = data.get("status") self.timestamp = data.get("timestamp")