content
stringlengths
7
1.05M
# add this file to your .gitignore file of the project LOCAL_SETTINGS = dict( media_root='/Users/user/projects/project/media', path='/Users/user/projects/project', virtualenv_path='/Users/user/virtualenvs/project', )
# Copyright (c) 2022 {{cookiecutter.author_name}} # # This software is released under the MIT License. # https://opensource.org/licenses/MIT """Version information for {{cookiecutter.project_name}}. This file is imported by ``{{cookiecutter.package_name}}.__init__``, and parsed by ``setup.py``. """ # Note, that dev...
""" Application ID: 512001308941. Публичный ключ приложения: COAKPIKGDIHBABABA. Секретный ключ приложения: 95C3FB547F430B544E82D448. Вечный session_key:tkn14YgWQ279xMzvjdfJtJuRajPvJtttKSCdawotwIt7ECm6L0PzFZLqwEpBQVe3xGYr7 Session_secret_key:b2208fc58999b290093183f6fdfa6804 """
media_locale = {} _NEW_PARTICIPANT = { 'ADD_HUMAN_TITLE': 'Agregar una nueva fuente humana', 'SEL_AGE_RANGE': 'Seleccione el rango de edad del participante:', 'AGE_0_6': '3 meses - 6 años', 'AGE_7_12': '7-12 años', 'AGE_13_17': '13-17 años', 'AGE_18': '18+ años', # TODO: DO NOT MERGE WITHO...
def tw(f,t,st): for x in range(t): f.write("\t") nl = True if st[-1] == "#": nl = False st = st[:-1] f.write(st) if nl: f.write("\n") def write_property_lua(f, tab, name, value, pref = ""): tw(f, tab, '%s{ name = "%s",' % (pref, name)) tab = tab + 1 if (type(value)==str): tw(f, tab, 'value = "%s...
fileout = open("requests.sh", "w") for i in range(1,57): if i >= 10: s = "0" + str(i) else: s = "00" + str(i) fileout.write("curl -s -H 'Content-Type: application/json' -H " + '"Authorization: Bearer `gcloud auth print-access-token`"' + " https://speech.googleapis.com/v1/speech:recognize -d" + ''' "{'config': ...
def define_env(env): "Definition of the module" @env.macro def feedback(title, section, slug): email_address = f"{section}+{slug}@technotes.jakoubek.net" md = "\n\n## Feedback / Kontakt\n\n" md += f"Wenn Sie Fragen oder Anregungen zum Artikel *{title}* haben, senden Sie mir bitte ei...
class Solution: # # Greedy (Accepted), O(n) time, O(1) space # def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool: # plots = len(flowerbed) # flowerbed.append(0) # prev = planted = 0 # for i in range(plots): # if flowerbed[i] == 0: # if pr...
# PyZ3950_parsetab.py # This file is automatically generated. Do not edit. _lr_method = 'SLR' _lr_signature = '\xfc\xb2\xa8\xb7\xd9\xe7\xad\xba"\xb2Ss\'\xcd\x08\x16' _lr_action_items = {'QUOTEDVALUE':([18,12,14,0,26,],[1,1,1,1,1,]),'LOGOP':([3,5,20,4,6,27,19,24,25,13,22,1,],[-5,-8,-4,-14,14,14,14,-9,-6,-13,-7,-12,]...
# Copyright (c) 2021 Paweł Piskorz # Licensed under the MIT License # See attached LICENSE file __all__ = ('__title__', '__summary__', '__uri__', '__version_info__', '__version__', '__author__', '__maintainer__', '__email__', '__copyright__', '__license__') __title__ = "CComponentCreator"...
# # PySNMP MIB module RSPAN-MGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RSPAN-MGMT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:50:21 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
class Node: def __init__(self, declaration_list): self.declaration_list = declaration_list def visit(self): context = {"type": "program"} return self.declaration_list.visit(context)
""" Problem Description The program takes a list from the user and finds the cumulative sum of a list where the ith element is the sum of the first i+1 elements from the original list. Problem Solution 1. Declare an empty list and initialise to an empty list. 2. Consider a for loop to accept values for the list....
"""Application deployment configuration parameters.""" PROTOCOL = 'http' HOSTNAME = 'localhost' PORT = 6040
# -*- coding: utf-8 -*- """ Created on Tue Jun 22 11:20:42 2021 @author: Keisha """ class Bird: def intro(self): print("There are man y types of birds.") def flight(self): print("Most of the birds can fly ut some caqnnot.") class sparrow(Bird): def flight(s...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def _diameterBTree(self,root): if not root: return 0 l = self._diameterBTree(root.left) r = self._diameterBTree...
# Description # 中文 # English # Given two integers a and b, an operator, choices: # +, -, *, / # Calculate a <operator> b. # Use switch grammar to solve it # Have you met this question in a real interview? # Example # Example 1: # Input: a = 1, b = 2, operator = + # Output: 3 # Explanation: # return the res...
a = 15 b = 10 if a < b : print("A é menor do que B") r = a + b print(f"A soma de {a} + {b} é igual a {r}!") else : print("A é maior do que B") r = a - b print(f"A subtração de {a} - {b} é igual a {r}!") codigo_compra = 5111 if codigo_compra == 5222: print("Compra à vista.") elif codigo_compra == ...
class Modification: def __init__(self): self.AAs=[] self.mass=0.0 self.NL={} self.DI={} self.factor=1 self.name="" self.ID=-1 def setAAs(self, newAAlist): self.AAs=newAAlist return True def getAAs(self): return self.AAs d...
class Node: def __init__(self,data): self.data=data self.next=None class LinkedList: def __init__(self): self.head=None def append(self,newdata): new_node=Node(newdata) if self.head is None: self.head=new_node return temp=se...
""" AS PYTHON DOESN'T HAVE CONSTANT DECLARATION, THE NEXT METHODS RETURN THE VALUES WHO NEED CONSTANT BEHAVIOR. """ def VGL_SHAPE_NCHANNELS(): return 0 def VGL_SHAPE_WIDTH(): return 1 def VGL_SHAPE_HEIGHT(): return 2 def VGL_SHAPE_LENGTH(): return 3 def VGL_MAX_DIM(): return 10 def VGL_ARR_SHAPE_SIZE(): r...
def simplest_numbers_generator(): """Simplest Number Generator, yielding only two values - 1 and 2. Disclaimer: Use it just to trace how next and yield operators works. This example is not useful in real world! """ num = 1 print("Yielding", num) yield num num +=1 print("Yielding", nu...
""" --- What is wrong with this family? --- Simple You have a list of family relationships between father and son. Every element on this list has two elements. The first is the father's name, the second is a son's name. All names in the family are unique. Check if the family tree is correct. There are no strangers in ...
"""CSP (Constraint Satisfaction Problems) problems and solvers. (Chapter 6).""" # CLASS FROM https://github.com/aimacode/aima-python/ slightly modified for performance (see tag @modified) # the proof about performance can be found in the files original_results.txt and modified_results.txt # @modified: removed unused i...
class Error(Exception): message = None def __str__(self): return repr(self.message) class GSLZeroDivision(Error): message = "GSL encountered zero division" class GSLFailure(Error): message = "GSL failed" class GSLMemoryFailure(Error): message = "GSL failed to allocate necessary memory" ...
""" Tema: Recursividad y Factoriales. Curso: Pensamiento computacional. Plataforma: Platzi. Profesor: David Aroesti. Alumno: @edinsonrequena. """ def factorial(n): """Calcula el factorial de n n int > 0 returns n! """ print(n) if n == 1: return 1 return n * factorial(n ...
# coding=utf-8 class TestTeamcityMessages: def testPass(self): pass def testAssertEqual(self): assert (True == True) def testAssertEqualFails(self): assert 1 == 2 def testAssertFalse(self): assert False def testException(self): raise Exception("some exce...
#Elabore um programa que calcule o valor a ser pago por um produto, # considerando o seu preço normal e condição de pagamento: #– à vista dinheiro/cheque: 10% de desconto #– à vista no cartão: 5% de desconto #– em até 2x no cartão: preço formal #– 3x ou mais no cartão: 20% de juros valor = float(input('Digite o valor a...
volatile = False log_norm = False # Maximal sequence length in training data max_seq_len = 50 ''' Embedding layer ''' # Size of word embedding of source word and target word src_wemb_size = 512 trg_wemb_size = 512 ''' Encoder layer ''' # Size of hidden units in encoder enc_hid_size = 512 ''' Attention layer ''' #...
# PROBLEM # # Now write a program that calculates the minimum fixed monthly payment needed # in order to pay off a credit card balance within 12 months. By a fixed # monthly payment, we mean a single number which does not change each month, # but instead is a constant amount that will be paid each month. # # In this...
##Hello World Example #!/user/bin/env python3 print("Hello", "world!")
buttons = { "brightness up": [9097, 4455, 635, 495, 629, 502, 632, 499, 636, 494, 630, 500, 603, 528, 627, 503, 632, 500, 603, 1628, 599, 1632, 606, 1625, 602, 1627, 600, 530, 604, 1626, 601, 1630, 628, 1603, 603, 529, 606, 525, 599, 532, 602, 530, 604, 528, 607, 524, 599, 532, 603, 528, 606, 1625, 610, 1622, 608, 1624...
# Haystack settings for running tests. DATABASE_ENGINE = 'sqlite3' DATABASE_NAME = 'haystack_tests.db' INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'haystack', 'core', ] ROOT_URLCONF = 'c...
def first_method(): """First sibling package method.""" return 1 def second_method(): """Second sibling package method.""" return 2
""" https://stackoverflow.com/questions/13650293/understanding-pythons-is-operator Her tester jeg forskjellen på (is og is not) vs == """ playerOne = { 'name': 'Jørund', 'speciality': 'grit', 'age': 38, } shadow = { 'name': 'Jørund', 'speciality': 'grit', 'age': 38, } copyCat = playerOne playerTwo = { 'n...
# Python program for implementation of MergeSort(Implement Divide and conquer) # MergeSort(arr[], l, r) # If r > l # 1. Find the middle point to divide the array into two halves: # middle m = l+ (r-l)/2 # 2. Call mergeSort for first half: # Call mergeSort(arr, l, m) # ...
# -*- coding: utf-8 -*- """Class to represent binary data as hexadecimal.""" class Hexdump(object): """Class that defines a hexadecimal representation formatter (hexdump).""" @classmethod def _FormatDataLine(cls, data, data_offset, data_size): """Formats binary data in a single line of hexadecimal represen...
class Component(object): _env = None _di = None _args = None _kwargs = None def setDi(self, di): self._di = di def getDi(self): return self._di def getEnv(self): return self._env def setEnv(self, env): self._env = env def setAr...
with open('F:\\url.txt', 'r') as f: list1 = f.readlines() def remain720p(args): return args.find('720P') > 0 list2 = filter(remain720p, list1) with open('F:\\url2.txt', 'w') as f2: for str2 in list2: f2.writelines(str2)
""" This contains emperically derived constants from Hutto and Gilbert (2014) """ # (empirically derived mean sentiment intensity rating increase for booster words) B_INCR = 0.293 B_DECR = -0.293 # (empirically derived mean sentiment intensity rating increase for using ALLCAPs to emphasize a word) C_INCR = 0.733 # c...
# -*- coding: utf-8 -*- { 'name': "onesphere_assembly_industry", 'summary': """ 智能装配行业扩展模块""", 'description': """ 智能装配行业扩展模块 """, 'author': "上海文享信息科技有限公司", 'website': "http://www.oneshare.com.cn", # Categories can be used to filter modules in modules listing # Check h...
def fib(i: int) -> int: if i == 0 or i == 1: return 1 return fib(i - 1) + fib(i - 2) if __name__ == "__main__": # Using a variable to workaround # https://github.com/adsharma/py2many/issues/64 rv = fib(5) print(rv)
print('===== DESAFIO 42 =====') l1 = float(input('Digite o comprimento da reta 01: ')) l2 = float(input('Digite o comprimento da reta 02: ')) l3 = float(input('Digite o comprimento da reta 03: ')) tri = (l1 < l2 + l3) and (l2 < l1 + l3) and (l3 < l1 + l2) if tri is True: print('As retas podem formar um triângulo!')...
"""Constants for the Shelly integration.""" COAP = "coap" DATA_CONFIG_ENTRY = "config_entry" DEVICE = "device" DOMAIN = "shelly" REST = "rest" CONF_COAP_PORT = "coap_port" DEFAULT_COAP_PORT = 5683 # Used in "_async_update_data" as timeout for polling data from devices. POLLING_TIMEOUT_SEC = 18 # Refresh interval fo...
"""Hass.io const variables.""" ATTR_DISCOVERY = 'discovery' ATTR_ADDON = 'addon' ATTR_NAME = 'name' ATTR_SERVICE = 'service' ATTR_CONFIG = 'config' ATTR_UUID = 'uuid' ATTR_USERNAME = 'username' ATTR_PASSWORD = 'password' X_HASSIO = 'X-HASSIO-KEY' X_HASS_USER_ID = 'X-HASS-USER-ID' X_HASS_IS_ADMIN = 'X-HASS-IS-ADMIN'
#!/usr/bin/env python3 # coding=utf-8 # author: @netmanchris # -*- coding: utf-8 -*- """ This module contains functions for authenticating to the Attelani Brid Air Purifier Device API. """ class BridAuth: """ Object to hold the authentication data for the Brid API Note currently, the Brid API requires no...
class Defaults(object): window_size = 7 hidden_sizes = [300] hidden_activation = 'relu' max_vocab_size = 1000000 optimizer = 'sgd' # 'adam' learning_rate = 0.1 # 1e-4 epochs = 20 iobes = True # Map tags to IOBES on input max_tokens = None # Max dataset size in tokens encodi...
ATOM_COLORS = { "C": "#c8c8c8", "H": "#ffffff", "N": "#8f8fff", "S": "#ffc832", "O": "#f00000", "F": "#ffff00", "P": "#ffa500", "K": "#42f4ee", "G": "#3f3f3f", } CHAIN_COLORS = { "A": "#320000", "B": "#8a2be2", "C": "#ff4500", "D": "#00bfff", "E": "#ff00ff", ...
"""Ubuntu Laptop Monitoring - Django project to display laptop hardware status. .. moduleauthor:: Alexander Dupuy <alex.dupuy@mac.com> """
class Config: EPS = 1e-14 RPN_CLOBBER_POSITIVES = False RPN_NEGATIVE_OVERLAP = 0.3 RPN_POSITIVE_OVERLAP = 0.7 RPN_FG_FRACTION = 0.5 RPN_BATCHSIZE = 300 RPN_BBOX_INSIDE_WEIGHTS = (1.0, 1.0, 1.0, 1.0) RPN_POSITIVE_WEIGHT = -1.0 RPN_PRE_NMS_TOP_N = 12000 RPN_POST_NMS_TOP_N = 1000 ...
hps = { "0351291110650853": { "ott_len": 35, "ott_percent": 129, "ott_bw_up": 111, "tps_qty_index": 65, "max_risk_long": 85 }, "0561821341040643": { "ott_len": 56, "ott_percent": 182, "ott_bw_up": 134, "tps_qty_index": 104, "max_risk_long": 64 }, "0351291110200403": { "ott_len": 35, "ott_pe...
#!/usr/bin/env python # source venv/bin/activate --> To be in Python Virtual Env class PlotGraph(GraphScene): CONFIG = { "y_max" : 50, "y_min" : 20, "x_max" : 7, "x_min" : 4, "y_tick_frequency" : 5, "x_tick_frequency" : 0.5, "axes_color" : BLUE, ...
""" A variety of examples to showcase useage of pix. Note that some libraries or other thirdparty resources may be required to run an example. """
class linkedListNode(object): # ListNode继承object中的方法 def __init__(self, initData): self.data = initData self.next = None def _getData(self): return self.data def _getNext(self): return self.next def _setData(self, newData): self.data = newData def _setNe...
class Configuration(object): def __init__(self, **kwargs): for key, value in kwargs.items(): if isinstance(value, dict): value = Configuration(**value) setattr(self, key, value) def to_dict(self): rv = {} for key, value in self.__dict__.items(): ...
product = input() day = input() quantity = float(input()) price = 0 isError = False if day == 'Saturday' or day == 'Sunday': if product == 'banana': price = 2.7 elif product == 'apple': price = 1.25 elif product == 'orange': price = 0.9 elif product == 'grapefruit':...
# -*- coding: utf-8 -*- class Precipitation(object): def __init__(self, precipitation): self.value = float(precipitation['value']) try: self.minValue = float(precipitation['minvalue']) except KeyError: self.minValue = None try: self.maxValue = fl...
def run(): r.setpos(0,0,0)
class Command: TO_CN = 1 TO_EN = 2 JSON_FORMAT = 3 URL_ENCODE = 4 URL_DECODE = 5
# Выполнить логические побитовые операции «И», «ИЛИ» и др. над числами 5 и 6. # Выполнить над числом 5 побитовый сдвиг вправо и влево на два знака. # Объяснить полученный результат. print("5 & 6 = %d" % (5 & 6)) # Бинарное И 101 & 110 = 100 print("5 | 6 = %d" % (5 | 6)) # Бинарное ИЛИ 101 & 110 = 111 print("5 ^ 6 = %d"...
# checking for armstrong number a = input("Enter a number") n = int(a) S = 0 while n > 0: d = n % 10 S = S + d * d * d n = n / 10 if int(a) == S: print("Armstrong Number") else: print("Not an Armstrong Number")
class BuildEnvironmentError(Exception): def __init__(self, msg, build_env): self.msg = msg self.build_env = build_env def __str__(self): return "{}({})".format(self.__class__.__name__, repr(self.msg)) class VariantDBConnectionError(BuildEnvironmentError): def __init__(self, connec...
""" 假设有打乱顺序的一群人站成一个队列。 每个人由一个整数对(h, k)表示,其中h是这个人的身高,k是排在这个人前面且身高大于或等于h的人数。 编写一个算法来重建这个队列。 注意: 总人数少于1100人。 示例 输入: [[7,0], [4,4], [7,1], [5,0], [6,1], [5,2]] 输出: [[5,0], [7,0], [5,2], [6,1], [4,4], [7,1]] """ class Solution: def reconstructQueue(self, people): people.sort(key=lambda x: (x[0], -x[1])) ...
""" Definition of ListNode class ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next """ class Solution: """ @param l1: the first list @param l2: the second list @return: the sum list of l1 and l2 """ def addLists(self, l1, l2): dumm...
#Advanced string syntax #Multiple ways to type strings print('Hello') print("That is Alice's cat") #To use a single quote throughout your code #put in a / before the quotation print('Here is the example (\')') print('Do you see how the quotation \' is shown?') #Example of types of "Escape Characters" # \' ...
class Queue: def __init__(self): self.queue = list() def enqueue(self,data): if data not in self.queue: self.queue.insert(0,data) return True return False def dequeue(self): if len(self.queue)>0: return self.queue.pop() return ("Queue ...
class Solution(object): def findDuplicate(self, nums): """ :type nums: List[int] :rtype: int """ n = len(nums) - 1 start, end = 1, n while start + 1 < end: mid = start + (end - start) / 2 count = 0 for num in nums...
class TerminalSet: NODE_TYPE = 'terminal' @classmethod def is_terminal_value(cls, node): return node['node_type'] == cls.NODE_TYPE and node.has_key('value') and (node['type'] in ['int', 'float']) @classmethod def terminal_value(cls, value): return {'node_type': cls.NODE_TYPE, 'name': str(value), 'va...
""" Parameters exchanged client <-> server and client <-> compensator Copyright 2021 Reza NasiriGerdeh and Reihaneh TorkzadehMahani. 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 ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/ # Written by Bastian Schnell <bastian.schnell@idiap.ch> # class EmbeddingConfig(object): def __init__(self, f_get_emb_index, num_embeddings, embedding_dim, name=None, **args): assert calla...
y=int(input("Enter The year: ")) if(((y%2==0)or (y%400==0))and y%100!=0): print("leap Year") else: print("Not Leap year")
class Notifier: def __init(self): pass def notify(self, msg): print(msg) def message(self, msg): print(msg) def message2(self, msg2): print(msg2)
# -*- coding: utf-8 -*- """Version information for the bioregistry.""" __all__ = [ 'VERSION', ] VERSION = '0.1.4-dev'
class Solution: def reverseWords(self, s: str) -> str: list1 = s.split(' ')[::-1] new_string = "" for i in range(0,len(list1)): if(list1[i]!=""): if(len(new_string)>0): new_string+=" " new_string+=list1[i] return new_str...
# fig03_03.py """Using nested control statements to analyze examination results.""" # initialize variables passes = 0 # number of passes failures = 0 # number of failures # process 10 students for student in range(10): # get one exam result result = int(input('Enter result (1=pass, 2=fail): ')) if resu...
""" Write a program which accepts an integer value as command line and print “Ok” if value is between 1 to 50 (both inclusive) otherwise it prints ”Out of range”. """ number = int(input("Enter a number: ")) if number > 0 and number < 51: print("Ok") else: print("Out of range")
def relay_states_registar_value(relay_states): num = 0 n = 8 for relay_state in relay_states: if relay_state: num += 2**n n += 1 return num def relay_states_from_register_value(value): relay_states = [] num = value for i in range(11, 7, -1): if...
"""User variables to use toolkit for Dynatrace""" FULL_SET = { "CLUSTER_NAME": { "url":"URL GOES HERE (EVEN FOR SAAS)", "tenant": { "tenant1": "TENANT UUID GOES HERE", "tenant2": "TENANT UUID GOES HERE" }, "api_token": { "tenant1": "API TOKEN GOES ...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (C) 2012 Yahoo! Inc. All Rights Reserved. # Copyright (C) 2012 New Dream Network, LLC (DreamHost) All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the Licens...
# for loop # Iterating over a list print("List Iteration") l = ["Ankit", "Gupta"] for i in l: print(i) # Iterating over a tuple (immutable) print("\nTuple Iteration") t = ("ankit", "gupta") for i in t: print(i) # Iterating over a String print("\nString Iteration") s = "Ankit" for i in s: print(i...
''' Created on 2015年12月12日 @author: Darren '''
with open('html_file.html','r') as rf: with open('output.txt','w') as of: for string in rf.readlines(): if "<a href=" in string : of.write(string) #Some Better Solution for video lecture no. 223
#!/usr/bin/env python input = input("Enter IP address: ") octets = input.split(".") first_octet = bin(int(octets[0])) second_octet = bin(int(octets[1])) third_octet = bin(int(octets[2])) forth_octet = bin(int(octets[3])) print("%-20s%-20s%-20s%-20s" % ("First Octet", "Second Octet", "T...
class Worker(): def __init__(self, isim,maas,departman): print("çalışan sınıfının init fonksiyonu") self.isim = isim self.maas = maas self.departman = departman def bilgilerigoster(self): print("çalışan sınıfının bilgileri") print("isim : {}\nMaaş : {}\nDepartman...
class Region: def __init__ (self, bbox, region_): self.bbox = bbox # [xmin, ymin, xmax, ymax] float self.region_ = region_ # (d_region)
# Copyright 2018 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...
def metade(x): s = x / 2 return s def dobro(n): return 2 * n def aumentar(n, p): return (n * (p / 100)) + n
# Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible. # Note: # The length of num is less than 10002 and will be ≥ k. # The given num does not contain any leading zero. # Example 1: # Input: num = "1432219", k = 3 # Output: "1219" ...
""" Bir sayının çift olup olmadığını sorgulayan bir fonksiyon yazın. Bu fonksiyon, eğer sayı çift ise return ile bu değeri dönsün. Ancak sayı tek sayı ise fonksiyon raise ile ValueError hatası fırlatsın. Daha sonra, içinde çift ve tek sayılar bulunduran bir liste tanımlayın ve liste üzerinde gezinerek ekrana sadece çif...
# -*- coding: utf-8 -*- ''' Package containing network handshakes '''
def _merge(a, b): members = set() members.update(a.members if isinstance(a, TagSet) else {a}) members.update(b.members if isinstance(b, TagSet) else {b}) return TagSet(members) class Tag: def __init__(self, name): self.name = name __and__ = _merge __rand__ = _merge def __repr...
'''Unstamp Mail Submission Agent Server This server receives outgoing mail from the email client, and gives it to the Mail Transfer Agent to send. '''
#!/usr/bin/python3 sites = ["Baidu", "Google","Runoob","Taobao"] for site in sites: if site == "Runoob": print("菜鸟教程!") break print("循环数据 " + site) else: print("没有循环数据!") print("完成循环!")
# Copyright 2013 Locaweb. # 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 appli...
class Settings: def __init__(self): # Rotors = Moveable wheels self.rotors = { "I": {"sequence": "ekmflgdqvzntowyhxuspaibrcj", "notches": ["r"]}, "II": {"sequence": "ajdksiruxblhwtmcqgznpyfvoe", "notches": ["f"]}, "III": {"sequence": "bdfhjlcprtxvznyeiwgakmusqo", ...
# Man kan ændre globale variabler i funktioner # Any variable which is changed or created inside of a function is local, if it hasn’t been declared as a global variable. # (brug nonlocal for ydre namespace) a = 1 b = 2 print("a =",a) print("b =",b) # Parameter er lokal variabel def forsøg4( a ): global b a = a + ...
# Copyright 2019 Nicole Borrelli # # 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...
#!/usr/bin/env python3 #encoding=utf-8 #------------------------------------------------- # Usage: python3 4-getattribute_to_compute_attribute.py # Description: attribute management 4 of 4 # Same, but with generic __getattribute__ all attribute interception #----------------------------------------------...
#!/usr/bin/python3 # files.py by Bill Weinman [http://bw.org/] # This is an exercise file from Python 3 Essential Training on lynda.com # Copyright 2010 The BearHeart Group, LLC def main(): f = open('lines.txt') for line in f: print(line, end = '') if __name__ == "__main__": main()
"""Common functions.""" __all__ = ['rshift'] def rshift(integer: int, shift: int) -> int: """Logical right binary shift.""" if integer >= 0: return integer >> shift return (integer + 0x100000000) >> shift