content
stringlengths
7
1.05M
def str_without_separators(sentence): #separators = ",.?;: " #str1 = "".join(char if char not in separators else "" for char in sentence) str1 = "".join(char if char.isalnum() else "" for char in sentence) return str1 def is_palindrome(sentence): str1 = str_without_separators(sentence) return...
c = int(input('\nHow many rows do you want? ')) print() a = [[1]] for i in range(c): b = [1] for j in range(len(a[-1]) - 1): b.append(a[-1][j] + a[-1][j + 1]) b.append(1) a.append(b) for i in range(len(a)): for j in range(len(a[i])): a[i][j] = str(a[i][j]) d = ' '.join(a[i]) for ...
name = "pymum" version = "3" requires = ["pydad-3"]
def proportion(a,b,c): try: a = int(a) b = int(b) c = int(c) ratio = a/b propor = c/ratio return propor except ZeroDivisionError: print("Error: Dividing by Zero is not valid!!") except ValueError: print ("Error: Only Numeric Values are valid!!"...
datasets={'U1001': {'135058': 1,'135038': 3,'135032': 3,'135084': 2,'135076':2}, 'U1002': {'135058': 2,'135038': 2,'135032': 1,'135084': 1,'135076':3}, 'U1003': {'135058': 2,'135038': 1,'135032': 2,'135084': 3,'135076':3}, 'U1004': {'135058': 1,'135038': 3,'135032': 3,'135084': 3,'135076':3}, 'U1005': {'135058': 1...
def isolateData(selector,channel,labels,data): selected=[] for i in range(len(labels)): if labels[i]==selector: selected.append(data[str(i)+'c'+str(channel)])#epochs with class AGMSY5 return selected
#!/usr/bin/python3 class Material: def __init__(self, color): """ A material has color as basic propriety :param color: the color of the material """ self.color = color
# ,---------------------------------------------------------------------------, # | This module is part of the krangpower electrical distribution simulation | # | suit by Federico Rosato <federico.rosato@supsi.ch> et al. | # | Please refer to the license file published together with this code. | ...
# Faça um programa que tenha uma função chamada área(), # que receba as dimensões de um terreno retangular (largura e comprimento) e mostre a área do terreno. cores = {'limpa':'\033[m', 'bverde':'\033[1;32m', 'bvermelho': '\033[1;31m', 'pretoebranco':'\033[7:30m'} print('-=-'*10)...
peso = float(input('Indique o seu peso (Kg) - ')) alt = float(input('Indique a sua altura (m) - ')) IMC = peso / (alt ** 2) if IMC <= 18.5: print('O seu IMC é de {:.1f} e está com EXCESSO DE MAGREZA.') elif 18.5 < IMC <= 25: print('O seu IMC é de {:.1f} e está com PESO NORMAL') elif 25 < IMC <= 30: print(...
factors_avro = { 'namespace': 'com.gilt.cerebro.job', 'type': 'record', 'name': 'AvroFactors', 'fields': [ {'name': 'id', 'type': 'string'}, {'name': 'factors', 'type': {'type': 'array', 'items': 'float'}}, {'name': 'bias', 'type': 'float'}, ...
def fibonacci_number(num): f = 0 s = 1 for i in range(num + 1): if i <= 1: nxt = i else: nxt = f +s f = s s = nxt print (nxt) print(fibonacci_number(int(input("Enter the number:"))))
######################### # 演示字典(key value) ######################### # 字典:字典存储的是键值对,不会记住存入元素的顺序 alien = {'a': "EA", "b": "阿凡达", 'c': "异形"} print(alien) print(type(alien)) # 获取元素 print(alien['a']) # 在我们不确定字典中是否存在某个键而又想获取其值时,可以使用get方法 unknown = alien.get('f') print("unknown = %s" % type(unknown)) # 还可以设置默认值 unknown ...
{ "cells": [ { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "ename": "ValueError", "evalue": "operands could not be broadcast together with shapes (4,) (100,) (4,) ", "output_type": "error", "traceback": [ "\u001b[0;31m--------------------------...
''' You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Note: Given n will be a positive integer. Example 1: Input: 2 Output: 2 Explanation: There are two ways to climb to the top. 1. 1 step + 1 step 2....
"""Top-level package for lsmPy.""" __author__ = """Shruti Anna Samuel""" __email__ = 'annasam13@gmail.com' __version__ = '0.0.1'
with open("source.txt") as filehandle: lines = filehandle.readlines() with open("source.txt", 'w') as filehandle: lines = filter(lambda x: x.strip(), lines) filehandle.writelines(lines)
""" ******************************************************************************************************************* | | Name : __version__.py | Module : risksense_api | Description : Version information for risksense_api. | Copyright : (c) RiskSense, Inc. | License : Apache-2.0 (https://...
#break.py for s in 'python' : if s == 't' : continue print(s,end=" ") print("over")
arr = list(range(8)) def func(x): return x*2 print(list(map(func, arr))) print(list(map(lambda x: x**3, arr)))
list1=list(map(int,input().rstrip().split())) N=list1[0] list2=list1[2:] res=[] for j in list2: if j not in res: res.append(j) for i in range(len(list2)): if list2[i] in res: res.remove(list2[i]) print(*res)
#!/bin/env python3 def puzzle1(): tree = {} acceptedBags = ['shiny gold'] foundNew = True with open('input.txt', 'r') as input: for line in input: if line[-1:] == "\n": line = line[:-1] bags = line.split(',') partName = bags[0].split(' ') ...
# -*- coding: utf-8 -*- """ Parameter-related utilities. """
LinearRegression_Params = [ {"name": "fit_intercept", "type": "select", "values": [True, False], "dtype": "boolean", "accept_none": False}, {"name": "positive", "type": "select", "values": [False, True], "dtype": "boolean", "accept_none": False} ] Ridge_Params = [ {"name": "alpha", "type": "input", "values...
class Person: __key = None __cipher_algorithm = None def get_key(self): return self.__key def set_key(self, new_key): self.__key = new_key def operate_cipher(self, encrypted_text): pass def set_cipher_algorithm(self, cipher_algorithm): self.__cipher_algorithm ...
# coding: utf-8 # ファイル名を"my_key.py"にリネームし、 # 下記のキーをセットしておいてください。 consumer_key = "ここにコンシューマー・キーを貼り付けてください" consumer_secret = "コンシューマー・シークレットを貼り付けてください" access_token_key = "アクセス・トークン・キーを貼り付けてください" access_token_secret = "アクセス・トークン・シークレットを貼り付けてください"
def sum_list_values(list_values): return sum(list_values) def symbolic_to_octal(perm_string): perms = {"r": 4, "w": 2, "x": 1, "-": 0} string_value = [] symb_to_octal = [] slicing_values = {"0": perm_string[:3], "1": perm_string[3:6], "2":perm_string[6:9]} for perms_key, value in perms.items(...
print(str(b'ABC'.count(b'A'))) print(str(b'ABC'.count(b'AB'))) print(str(b'ABC'.count(b'AC'))) print(str(b'AbcA'.count(b'A'))) print(str(b'AbcAbcAbc'.count(b'A', 3))) print(str(b'AbcAbcAbc'.count(b'A', 3, 5))) print() print(str(bytearray(b'ABC').count(b'A'))) print(str(bytearray(b'ABC').count(b'AB'))) print(str(bytearr...
"""Definition for updatesrc_diff_and_update macro.""" load("@bazel_skylib//rules:diff_test.bzl", "diff_test") load(":updatesrc_update.bzl", "updatesrc_update") def updatesrc_diff_and_update( srcs, outs, name = None, update_name = "update", diff_test_prefix = "", diff_te...
"""Core exceptions""" class RPGTKBaseException(Exception): pass class DiceException(RPGTKBaseException): pass
""" philoseismos: with passion for the seismic method. This file is needed to run pytest from a repository directory and avoid any PYTHONPATH related import issues. @author: Ivan Dubrovin e-mail: dubrovin.io@icloud.com """
""" Given a unsorted array with integers, find the median of it. A median is the middle number of the array after it is sorted. If there are even numbers in the array, return the N/2-th number after sorted. Example Given [4, 5, 1, 2, 3], return 3 Given [7, 9, 4, 5], return 5 Challenge O(n) time. """ __author__ = '...
config ={ 'CONTEXT' : 'We are in DEV context', 'Log_bucket' : 'gc://bucketname_great', 'versionNR' : 'v12.236', 'zone' : 'europe-west1-d', }
def classify(number): if number < 1: raise ValueError("Value too small") aliquot = 0 for i in range(number-1): if number % (i+1) == 0: aliquot += i+1 return "perfect" if aliquot == number else "abundant" if aliquot > number else "deficient"
# File: taniumrest_consts.py # Copyright (c) 2019-2021 Splunk Inc. # # Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) SESSION_URL = "/api/v2/session/login" TANIUMREST_GET_SAVED_QUESTIONS = "/api/v2/saved_questions" TANIUMREST_GET_QUESTIONS = "/api/v2/questions" TANIUMREST_GET_QUESTION_RESU...
class MlflowException(Exception): """Base exception in MLflow.""" class IllegalArtifactPathError(MlflowException): """The artifact_path parameter was invalid.""" class ExecutionException(MlflowException): """Exception thrown when executing a project fails.""" pass
Text = 'text' Audio = 'audio' Document = 'document' Animation = 'animation' Game = 'game' Photo = 'photo' Sticker = 'sticker' Video = 'video' Voice = 'voice' VideoNote = 'video_note' Contact = 'contact' Dice = 'dice' Location = 'location' Venue = 'venue' Poll = 'poll' NewChatMembers = 'new_chat_members' LeftChatMember ...
class A: def met(self): print("this is a method from class A") class B(A): def met(self): print("this is a method from class B") class C(A): def met(self): print("this is a method from class C") class D(C,B): def met(self): print("this is a method from class D"...
# -*- coding: utf-8 -*- class Solution: def nthPersonGetsNthSeat(self, n): return 1 if n == 1 else 0.5 if __name__ == '__main__': solution = Solution() assert 1 == solution.nthPersonGetsNthSeat(1) assert 0.5 == solution.nthPersonGetsNthSeat(2) assert 0.5 == solution.nthPersonGetsNthSeat...
# Create a function that takes a number num and returns its length. def number_length(num): if num != None: count = 1 val = num while(val // 10 != 0): count += 1 val = val // 10 return count print(number_length(392))
class Node: def __init__(self, name): self.data = name self.nextnode = None def remove(self, data, previous): if self.data == data: previous.nextnode = self.nextnode del self.data else: if self.nextnode is not None: self.nextno...
#!/usr/local/bin/python3.7 # -*- coding: utf-8 -*- # Definition for single-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class MyListNode: def __init__(self, head=None): self.head = head def get(self, index: int) -> int: ...
n = float(input('Digite a velocidade do carro(KM): ')) if n > 80: multa = (n - 80) * 7 print(f'Você foi multado \nvalor da multa R${multa:.2f}') else: print(f'Sua velocidade foi de {n}KM/H, tenha um bom dia!')
expected_output = { 'vrf': {'VRF1': {'address_family': {'ipv6': {}}}, 'blue': {'address_family': {'ipv6': {'multicast_group': {'ff30::/12': {'source_address': ...
class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """ Do not return anything, modify nums1 in-place instead. """ idx1 = m - 1 idx2 = n - 1 while idx1>=0 and idx2>=0: if nums1[idx1] > nums2[idx2]: ...
# The URL we will use when accessing a gulag API instance. api_url: str = "cmyui.codes" # When set to True it will allow us to make unverified HTTPS requests. (Good for testing.) unsafe_request: bool = False
{ 'target_defaults': { 'cflags': [ '-Wunused', '-Wshadow', '-Wextra', ], }, 'targets': [ # D-Bus code generator. { 'target_name': 'dbus_code_generator', 'type': 'none', 'variables': { 'dbus_service_config': 'dbus_bindings/dbus-service-config.json', ...
# Faça um programa que leia nome e média de um aluno, guardando também a situação em um dicionário. # No final, mostre o conteúdo da estrutura na tela. cores = {'limpa':'\033[m', 'bverde':'\033[1;32m', 'bvermelho': '\033[1;31m', 'pretoebranco':'\033[7:30m'} print('-=-'*10) print(...
ENTRY_POINT = 'is_multiply_prime' FIX = """ Fix incorrect is_prime function Add more tests """ #[PROMPT] def is_multiply_prime(a): """Write a function that returns true if the given number is the multiplication of 3 prime numbers and false otherwise. Knowing that (a) is less then 100. Example: i...
class AbstractTransitionSystem: def __init__(self, num_labels): self.num_labels = num_labels def num_actions(self): raise NotImplementedError() def state(self, num_tokens): raise NotImplementedError() def is_final(self, state): raise NotImplementedError() def extr...
Import('defenv') ### Configuration options cfg = Variables() cfg.Add( ( 'NSIS_MAX_STRLEN', 'defines the maximum string length for internal variables and stack entries. 1024 should be plenty, but if you are doing crazy registry stuff, you might want to bump it up. Generally it adds about 16-32x the memory, ...
slander = { "william": "https://giphy.com/gifs/memecandy-WTcj5b17IZ8xbdCMBs\nFucking lorte baby idiot, gå tilbage til 2017 da du blev født", "emil": "https://chinesepeopledoyoustyle.files.wordpress.com/2013/08/wpid-2013-08-29-08-13-47.png\nEmil be like: 目上長通済代日慮苦真", "noah": "https://media0.giphy.com/media/YFFNfFm...
def search(text, pat): n = len(text) m = len(pat) skip = 0 right = {} for c in text: right[c] = -1 for j in range(0, m): right[pat[j]] = j i = 0 while i < n-m: skip = 0 for j in range(m-1, 0, -1): if pat[j] != text[i+j]: skip ...
class PhysicsForce : class PhysicsGG : pass def W(self, Force, Distance) : usaha = Force * Distance return usaha class PhysicsRotation : def W(self, frequency) : omega = 2 * 3.15 * frequency return omega Rinta = PhysicsForce() Usaha = Rinta.W(3,2) print(Usaha) ...
# gmail credentials gmail = dict( username='username', password='password' ) # number of centimeters considered to be acceptable trigger_distance = 10 # number of seconds spent below trigger distance before sending email alert_after = 20
def is_palindrome_permutation(string): char_set = [0] * 26 total_letter = 0 total_odd = 0 for char in string: if char >= 'A' and char <= 'Z': index = ord(char) + ord('A') elif char >= 'a' and char <= 'z': index = ord(char)-ord('a') if char is not ' ': ...
class StockError(Exception): def __init__(self, message) -> None: module_name = self.__class__.__module__ class_name = self.__class__.__name__ error_msg = f'{message} ({module_name}.{class_name})' super().__init__(error_msg) class InvalidHttpsReqError(StockError): """ This...
a = 1 b = 2 def index(): return 'hello world' def hello(): return 'hello 2018' def detail(): return 'detail info' c = 3 d = 4
class TrackingMode(object): PRINTING, LOGGING = range(0, 2) TRACKING = True TRACKING_MODE = TrackingMode.PRINTING class TimyConfig(object): DEFAULT_IDENT = 'Timy' def __init__(self, tracking=TRACKING, tracking_mode=TRACKING_MODE): self.tracking = tracking self.tracking_mode = tracking_m...
print("""\nInformación de utilidad:\n Cámara de retina, 40 minutos Código de acceso, 50 minutos Palabra clave, 30 minutos Código de acceso complejo, 70 minutos Puerta sin bloqueo, 0 minutos Zona 1: 3 cámaras retina, 1 palabra clave Zona 2: 2 puerta sin bloqueo, 5 código de acceso Zona 3: 3 puertas sin bloqueo, 1 cámara...
# two float values val1 = 100.99 val2 = 76.15 # Adding the two given numbers sum = float(val1) + float(val2) # Displaying the addition result print("The sum of given numbers is: ", sum)
with open("dane/dane.txt") as f: lines = [] for line in f: sline = line.strip() lines.append(sline) count = 0 for line in lines: if line[0] == line[-1]: count += 1 print(f"{count=}")
def decode_orientation(n_classes, train_data, train_labels, test_data, test_labels): """ Initialize, train, and test deep network to decode binned orientation from neural responses Args: n_classes (scalar): number of classes in which to bin orientation train_data (torch.Tensor): n_train x n_neurons tensor...
class Customer: def __init__(self, client): self.client = client self.logger = client.logger self.endpoint_base = '/data/v2/projects/{}/customers'.format(client.project_token) def get_customer(self, ids): path = '{}/export-one'.format(self.endpoint_base) payload = {'cust...
__author__ = 'wektor' class GenericBackend(object): def set(self, key, value): raise NotImplemented def get(self, key): raise NotImplemented def delete(self, key): raise NotImplemented
#!/usr/bin/env python """ generated source for module MetaGamingException """ # package: org.ggp.base.player.gamer.exception @SuppressWarnings("serial") class MetaGamingException(Exception): """ generated source for class MetaGamingException """ def __init__(self, cause): """ generated source for method...
# # PySNMP MIB module H3C-UNICAST-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-UNICAST-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:24:11 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
# Andrew Ratkov 11-1 15.10.2021 words ans_1a = '''Поскольку в слове ВАРЕНЬЕ 7 букв и больше слов на букву В нет, то Петя, написав первым ходом В, заведомо выйграет, так как в слове ВАРЕНЬЕ 7 (нечётное количество) букв и Вася и Петя теперь будут его дописывать. При этой стратегии может быть сыграна только одна возможна...
""" Il modulo module2 è caricato da subpackage """ def myMethod(*args,**kwargs): """ myMethod(*args,lang=en,newline=False) -- stampa un messaggio di saluto ad args in inglese e senza andare a capo dopo ogni saluto. lang=it saluta in italiano newline=True va a acapo dopo ogni saluto """ ...
''' nums: [2, 3, -2, 4] max: [2, 6, -2, 4] min: [2, 3, -12, -48] max: [2, 6, 6, 6] '''
# # @lc app=leetcode id=476 lang=python3 # # [476] Number Complement # # https://leetcode.com/problems/number-complement/description/ # # algorithms # Easy (62.87%) # Likes: 625 # Dislikes: 76 # Total Accepted: 120.1K # Total Submissions: 190.7K # Testcase Example: '5' # # Given a positive integer, output its co...
"""def ejercicio1(): cadena = input("Ingrese una cadena: ") abc = " abcdefghijklmnopqrstuvwxyz" listaLetras = [] almacen = [] if len(cadena) > 0: for i in cadena: if i in abc: listaLetras.append(i) cadenanueva = "".join(listaLetras) ...
def gmt2json(pathx,hasDescColumn=True,isFuzzy=False): wordsAll = [] # secondColumn = [] with open(pathx,'r') as gf: for line in gf: line = line.strip('\r\n\t') # if not a empty line if line: words = [] i = 0 for item in line.split('\t'): if i==0: words.append(item) els...
class Coordinates: """ Geo location coordinates. Reference: https://developer.twitter.com/en/docs/tweets/data-dictionary/overview/geo-objects#coordinates """ def __init__(self, data: dict = {}): if not data: return None self.coordinates = data.get('coordinates') ...
#!/usr/bin/env python3 # https://codeforces.com/problemset/problem/761/A # 题目是interal, 不一定是从1开始, 所以之前做错了; 但还是很无聊的题目 # 0 0 不可能, 错第二次 def f(l): a,b = l return (b==a+1 or b==a or b==a-1) and (a+b>0) l = list(map(int,input().split())) print('YES' if f(l) else 'NO')
OCM_SIZE = 2 ** 8 READ_MODE = 0 WRITE_MODE = 1 DATA_BITWIDTH = 32 WORD_SIZE = DATA_BITWIDTH / 8 instream = CoramInStream(0, datawidth=DATA_BITWIDTH, size=64) outstream = CoramOutStream(0, datawidth=DATA_BITWIDTH, size=64) channel = CoramChannel(idx=0, datawidth=32) DOWN_LEFT = 0 DOWN_PARENT = 1 DOWN_RIGHT = 2 UP_PARE...
''' Endpoints are collected from the Market Data Endpoints api section under the official binance api docs: https://binance-docs.github.io/apidocs/spot/en/#market-data-endpoints ''' # Test Connectivity: class test_ping: params = None method = 'GET' endpoint = '/api/v3/ping' security_type = 'None' # C...
## Oscillating Lambda Man ## ## Directions: ### 0: top ### 1: right ### 2: bottom ### 3: left def main(world, _ghosts): return (strategy_state(), step) def step(state, world): return (update_state(state), deduce_direction(state, world)) # Oscilation strategy state def strategy_state(): #returns (frequency, co...
url= 'http://ww.sougou.com/s?' def sougou(nets): count = 1 for net in nets: rest1 = 'res%d.txt' %count with open(rest1,'w',encoding='utf8') as f: f.write(net) print(net) count +=1 if __name__ == '__main__': nets = ('one','two','pr') sougou(nets)
class Task: def name(): raise NotImplementedError def description(): raise NotImplementedError def inputs(): raise NotImplementedError def run(inputs): raise NotImplementedError
# -------------- # Code starts here class_1 = ['Geoffrey Hinton','Andrew Ng','Sebastian Raschka','Yoshua Bengio'] class_2 = ['Hilary Mason','Carla Gentry','Corinna Cortes'] new_class = class_1 + class_2 print(new_class) new_class.append('Peter Warden') print(new_class) new_class.remove('Carla Gentry') print(new_cl...
""" Enunciado Pegue a lista gerada no exercício anterior e transforme cada um dos itens dessa lista em um float. OBS: Não é para alterar o programa anterior, mas sim a lista gerada por ele. """ lista = ['1','5','2','3','6'] lista2 = [] for c in lista: lista2.append(float(c)) print(lista2)
#Updating menu to include a save option students= [] def displayMenu(): print("what would you like to do?") print("\t(a) Add new student") print("\t(v) View students") print("\t(s) Save students") print("\t(q) Quit") choice = input("type one letter (a/v/s/q):").strip() return choice def do...
# You need the Elemental codex 1+ to cast "Haste" # You need unique hero to perform resetCooldown action # You need the Emperor's gloves to cast "Chain Lightning" hero.cast("haste", hero) hero.moveDown() hero.moveRight() hero.moveDown(0.5) enemy = hero.findNearestEnemy() hero.cast("chain-lightning", enemy) hero.resetC...
""" Module: 'flashbdev' on esp32 3.0.0 """ # MCU: (sysname='esp32', nodename='esp32', release='3.0.0', version='v3.0.0 on 2020-01-29', machine='ESP32 module with ESP32') # Stubber: 1.3.2 class Partition: '' BOOT = 0 RUNNING = 1 TYPE_APP = 0 TYPE_DATA = 1 def find(): pass def get_ne...
''' Title : String Formatting Subdomain : Strings Domain : Python Author : codeperfectplus Created : 17 January 2020 ''' def print_formatted(number): # your code goes here width = len("{0:b}".format(n)) for i in range(1,n+1): print( "{0:{width}d} {0:{width}o} {0:{width}X} {0:{width}b}".f...
class FiniteAutomata: def __init__(self): Q = [] # finite set of states E = [] # finite alphabet D = {} # transition function q0 = '' # initial state F = [] # set of final states self.clear_values() def clear_values(self): self.Q =...
class Solution: """ @param n: an integer @return: the smallest 32-bit integer which has exactly the same digits existing in the integer n and is greater in value than n """ def nextGreaterElement(self, n): digits = [i for i in str(n)] digits.sort() res = self.dfs(digits, [], ...
tup=tuple(input("Enter the tuple").split(",")) st=tuple(input("Enter the another tuple").split(",")) tup1=tup+st print(tup1)
# -*- coding: utf-8 -*- # DATA STRUCTURES cats = [ {"name": "tom", "age": 1, "size": "small"}, {"name": "ash", "age": 2, "size": "medium"}, {"name": "hurley", "age": 5, "size": "large"}, ] print(cats)
# coding=utf-8 class JavaHeap: def __init__(self): pass
# Generated by h2py from /usr/include/netinet/in.h # Included from net/nh.h # Included from sys/machine.h LITTLE_ENDIAN = 1234 BIG_ENDIAN = 4321 PDP_ENDIAN = 3412 BYTE_ORDER = BIG_ENDIAN DEFAULT_GPR = 0xDEADBEEF MSR_EE = 0x8000 MSR_PR = 0x4000 MSR_FP = 0x2000 MSR_ME = 0x1000 MSR_FE = 0x0800 MSR_FE0 = 0x0800 MSR_SE = ...
#Inputing Age age = int(input("Enter Age : ")) # condition to check if the person is an adult or a teenager or a kid if age>=18: status="Not a teenager. You are an adult" elif age>=13: status="Teenager" elif age<=12: status="You are a kid" print("You are ",status,)# Printing the r...
# # Множественное наследование # # разные названия методов class Sitter: def sit(self): print("sit") class Layer: def lay(self): print("lay") class SitterLayer(Sitter, Layer): pass # a = SitterLayer() # a.sit() # a.lay() # Одинаковые названия методов class SayerA: def say(self): ...
# -*- coding: utf-8 -*- """ Created on Fri Nov 09 19:07:20 2018 @author: techietrader """
__author__ = 'chira' # "def" as defining mathematical functions # 18-Unpacking_args gives an alternate way to pass arguments def f(x): # function name is "f". It has ONE argument y = 2*x + 3 print("f(%d) = %d" %(x,y)) def g(x): # function name is "g". It has ONE argument y = pow(x,2) ...
def list_reverse(list1): new_list = [] for i in range(len(list1)-1, -1, -1): new_list.append(list1[i]) return new_list test = [1, 2, 3, 4, 5, 6] print(test) print(list_reverse(test))
# Bot information SESSION = 'LeoMediaSearchBot' USER_SESSION = 'User_Bot' API_ID = 12345 API_HASH = '0123456789abcdef0123456789abcdef' BOT_TOKEN = '123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11' USERBOT_STRING_SESSION = '' # Bot settings MAX_RESULTS = 10 CACHE_TIME = 300 USE_CAPTION_FILTER = False # Admins, Channels & Us...
"""This problem was asked by Samsung. A group of houses is connected to the main water plant by means of a set of pipes. A house can either be connected by a set of pipes extending directly to the plant, or indirectly by a pipe to a nearby house which is otherwise connected. For example, here is a possible configur...
""" This module contains all the exceptions that ZipTaxClient can throw See http://docs.zip-tax.com/en/latest/api_response.html#response-codes """ class ZipTaxFailure(Exception): pass class ZipTaxInvalidKey(ZipTaxFailure): pass class ZipTaxInvalidFormat(ZipTaxFailure): pass class ZipTaxInvalidData(ZipTa...