content
stringlengths
7
1.05M
def trace_wire(wire_dirs): last_pos = [0, 0] grid_dict = {} length = 0 for direction in wire_dirs: way = direction[0] amount = int(direction[1:]) if way == 'R': for x in range(1,amount+1): grid_pos = '{}_{}'.format(last_pos[0]+x, last_pos[1]) ...
#Linear Seach Algorithm def linearSearch(data, number): found = False for index in range(0, len(data)): if (data[index] == number): found = True break if found: print("Element is present in the array", index) else: print("Element is not present in the ar...
i = 1 # valor inicial de I j = aux = 7 # valor inicial de J while i < 10: # equanto for menor que 10: for x in range(3): # loop: mostra as linhas consecutivas print('I={} J={}' .forma...
IOSXE_TEST = { "host": "172.18.0.11", "username": "vrnetlab", "password": "VR-netlab9", "device_type": "cisco_xe", "test_commands": ["show run", "show version"], } NXOS_TEST = { "host": "172.18.0.12", "username": "vrnetlab", "password": "VR-netlab9", "device_type": "cisco_nxos", ...
def rotate_left(list_f, step): for _ in range(step): list_f.append(list_f.pop(0)) list_s = list_f[:] return list_s
times = [{'writing_data': 6.627535581588745, 'ndvi_pc10': 27.36231303215027, 'loading_data': 109.62806057929993, 'ndvi_pc90': 21.421257734298706, 'ndvi_pc50': 27.33169937133789}, {'writing_data': 6.443411588668823, 'ndvi_pc10': 39.16243243217468, 'loading_data': 123.19368815422058, 'ndvi_pc90': 38.72961163520813, 'ndvi...
#!/usr/bin/env python3 class InitializationException(Exception): """Raise when initialization errors occur.""" class ChallengeNotFound(Exception): """Raise when challenge not found.""" class ChallengeNotCovered(Exception): """Raise when challenge not found.""" class TestNotFound(Exception): """R...
fname = input("Enter file name: ") fh = open(fname) total = 0.0 count = 0.0 for line in fh: if line.startswith("X-DSPAM-Confidence:"): total += float(line[line.find(":") + 1:]) count += 1 lf = total/count else: continue print('Average spam confidence: ',"{0:.12f}".format(round(l...
def selectmenuitem(window,object): #log("{} :not implemented yet".format(sys._getframe().f_code.co_name)) object = object.split(";") if len(object) == 2: objectHandle = getobjecthandle(window,object[0])['handle'] mousemove(window,object[0],handle=objectHandle) ldtp_extend_mouse_click...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None def kAltReverse(head, k) : current = head next = None prev = None count = 0 #1) reverse first k nodes of the linked list while (current != None ...
_base_ = "./FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_Pbr_01_ape.py" OUTPUT_DIR = "output/deepim/lmPbrSO/FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_lmPbr_SO/cat" DATASETS = dict(TRAIN=("lm_pbr_cat_train",), TEST=("lm_real_cat_test",)) # bbnc5 # objects cat Avg(1) # ad_2 19.26 19.26 # ad_5 62.48...
def main(): with open('input.txt') as f: inputs = [line.split() for line in f.readlines()] pos = (0, 0) # horiz, depth for cmd, amount in inputs: amount = int(amount) match cmd: case 'forward': pos = (pos[0] + amount, pos[1]) case 'down': ...
# Python Lists # @IdiotInside_ print ("Creating List:") colors = ['red', 'blue', 'green'] print (colors[0]) ## red print (colors[1]) ## blue print (colors[2]) ## green print (len(colors)) ## 3 print ("Append to the List") colors.append("orange") print (colors[3]) ##orange print ("Insert to the List") colors....
class Solution: def find_averages(self, k, arr): result = [] window_sum = 0 window_start = 0 for window_end in range(len(arr)): window_sum += arr[window_end] if window_end >= k - 1: result.append(window_sum / k) window_sum -= ar...
# calculting factorial using recursion def Fact(n): return (n * Fact(n-1) if (n > 1) else 1.0) #main num = int(input("n = ")) print(Fact(num))
# https://www.hackerrank.com/challenges/ctci-lonely-integer def lonely_integer(a): bitArray = 0b0 for ele in a: bitArray = bitArray ^ ele # print(ele, bin(bitArray)) return int(bitArray)
""" MiniAuth ~~~~~~~~ Simple program and library for local user authentication. :license: This software is released under the terms of MIT license. See LICENSE file for more details. """ __version__ = '0.2.0'
# -*- coding: utf-8 -*- """ File Name: 02metaclass.py Author : jynnezhang Date: 2020/12/1 9:52 上午 Description: """
class StatusesHelper(object): """ An helper on statuses operations """ values = { 0: ('none','Not Moderated',), 1: ('moderated','Being Moderated',), 2: ('accepted','Accepted',), 3: ('refused','Refused',), } @classmethod def encode(_class, enc_status_name): ...
andmed = [] nimekiri = open("nimekiri.txt", encoding="UTF-8") for rida in nimekiri: f = open(rida.strip() + ".txt", encoding="UTF-8") kirje = {} for attr in f: osad = attr.strip().split(": ") kirje[osad[0]] = osad[1] f.close() andmed.append(kirje) nimekiri.close() uus...
# window's attributes TITLE = 'Arkanoid.py' WIDTH = 640 HEIGHT = 400 ICON = 'images/ball.png'
elemDictInv = { 100:'TrivialElement', 101:'PolyElement', 102:'NullElement', 110:'DirichletNode', 111:'DirichletNodeLag', 112:'zeroVariable', 120:'NodalForce', 121:'NodalForceLine', 130:'setMaterialParam', 131:'setDamageParam', 132:'IncrementVariables', 133:'insertDeformation', 134:'insertDeformationGeneral', 140:'p...
""" Problem: Find the number of 1s in the binary representation of a number. For example: num_ones(2) = 1 --> since "10" is the binary representation of the number "2". num_ones(5) = 2 --> since "101" is the binary representation of the number "5" etc. """ # num = 2 num = 5 # num = 11 print(bin(num)) # Approach 1 ...
class Error(Exception): """Base class""" pass class TokenGenerateError(Error): """ 토큰 생성 에러 :param: message: 에러 메세지 """ def __init__(self, message): self.message = message class ConnectedIdGenerateError(Error): """ 커넥티드 아이디 생성 에러 :param: message: 에러 메세지 """ ...
"""Handler class. All handlers must inherit from it.""" class Handler: def __init__(self, alert: str): self.broker = None self.alert = alert def alert_on(self): """Will be run when alert pops up.""" pass def alert_off(self): """Will be run when alert disappears.""...
tupla = ('python', 'estudar', 'linguagem', 'curso', 'viajar', 'cinema', 'pipoca', 'futuro', 'programador', 'mercado') for c in tupla: print(f'\nNa palavra {c} temos as vogais:', end=' ') for vogais in c: if vogais.lower() in 'aeiou': print(vogais, end=' ')
#!/usr/bin/env python3 # encoding: utf-8 # author: cappyclearl class Solution(object): r_min = -2147483648 r_max = 2147483647 def myAtoi(self, str): """ :type str: str :rtype: int """ r_int = 0 sign = 1 str = str.lstrip() if str.isdigit(): ...
# Funcion de evaluacion de calidad de codigo. Devuelve un entero con un numero que representa la calidad. Cuanto mas cercano a 0 esten los valores, mayor sera la calidad. def evaluateCode(listOfRefactors): # Good code -> Close to 0 # Bad code -> Far from 0 codeQuality = 0 for refactor in listOfRe...
# Beden kütle indeksi - Sağlık göstergesi hesaplama # TBY414 03.03.2020 # ADIM 1 - Kullanıcı girdilerinden indeksi hesaplamak # ağırlık (kg) boy (metre) olacak şekilde bki = a/(b*b) agirlik = float( input("Lütfen ağırlığınızı giriniz (kg): ") ) # ^ bir sayı olması gereken bir girdi alıyoruz. boy = float...
# ==== Modos de apertura: ==== # default (read mode): 'r' # write mode: 'w' # append mode: 'a' # read and write: 'r+' filename = 'programming_languages.txt' # with open(filename, 'w') as f_obj: # f_obj.write('PHP\n') # f_obj.write('Python\n') # f_obj.write('Javascript\n') # ==== Append Mode: ==== # with ...
DIRECTIONS = { "U": (0, 1), "D": (0, -1), "L": (-1, 0), "R": (1, 0) } def wire_to_point_set(wire): s = set() d = dict() x, y, steps = 0, 0, 0 for w in wire: dx, dy = DIRECTIONS[w[0]] dist = int(w[1:]) for _ in range(dist): x += dx y += d...
def main(): print("Welcome To play Ground") # Invocation if __name__ == "__main__": main() myInt = 5 myFloat = 13.2 myString = "Hello" myBool = True myList = [0, 1, "Two", 3.4, 78, 89, 45, 67] myTuple = (0, 1, 2) myDict = {"one": 1, "Two": 2} # Random print Statements print(myDict) print(myTuple) print(myIn...
expected_output = { "version": 3, "interfaces": { "GigabitEthernet1/0/9": { "interface": "GigabitEthernet1/0/9", "max_start": 3, "pae": "supplicant", "credentials": "switch4", "supplicant": {"eap": {"profile": "EAP-METH"}}, "timeout...
#!/usr/bin/ python # -*- coding: utf-8 -*- __author__ = 'mtianyan' __date__ = '2018/11/6 18:18' """  ┏┓   ┏┓+ +        ┏┛┻━━━┛┻┓ + +        ┃       ┃          ┃   ━   ┃ ++ + + +        ████━████ ┃+        ┃       ┃ +        ┃   ┻   ┃        ┃       ┃ + +        ┗━┓   ┏━┛          ┃   ┃    ...
country_entities={ "Q1000": { "description": "equatorial country in West Africa", "label": "Gabon" }, "Q1005": { "description": "sovereign state in West Africa", "label": "The Gambia" }, "Q1006": { "description": "sovereign state in West Africa", "labe...
def isintersect(a,b): for i in a: for j in b: if i==j: return True return False class RopChain(object): def __init__(self): self.chains = [] self.dump_str = None self.payload = b"" self.base_addr = 0 self.next_call = None s...
def triplets_with_sum(number): triplets = [] for a in range(1, number // 3): l = a + 1 r = (number - a - 1) // 2 while l <= r: b = (l + r) // 2 c = number - a - b if a * a + b * b < c * c: l = b + 1 elif a * a + b * b > c...
# Exercicio 003 int print ('Faça um calculo') p1= int (input('Primeiro numero')) p2= int (input('Segundo numero')) s0= p1+p2 print('O resultado de', (p1), '+', p2, 'é igual a', s0) # BOOL pergunta01= bool (input('Digite um numero boleano:')) pergunta02= bool (input('Digite outro numero boleano:')) print ('O primeirio...
class ChangeTextState: def __init__(self): self.prev_tail = '' self.context = None _change_text_state = None def init(): global _change_text_state _change_text_state = ChangeTextState() init() def get_state() -> ChangeTextState: global _change_text_state if _change_text_state...
""" flask-wow ~~~~~~~~~ A simple CLI Generator to create flask app. :copyright: 2020 Cove :license: BSD 3-Clause License """ __version__ = '0.2.1' # def demo(): # # if args.cmd == 'addapp': # print(f'Will create Flask app with name "{args.name}"') # dir_name = os.path.dirnam...
Size = (512, 748) ScaleFactor = 0.33 ZoomLevel = 1.0 Orientation = -90 Mirror = True NominalPixelSize = 0.002325 filename = '' ImageWindow.Center = (680, 512) ImageWindow.ViewportCenter = (1.1904, 1.5774772727272726) ImageWindow.crosshair_color = (255, 0, 255) ImageWindow.boxsize = (0.1, 0.06) ImageWindow.box_color = (...
"""Constants defining gameplay.""" # dimensions SCREEN_WIDTH = 1280 SCREEN_HEIGHT = 1024 PLAYER_SPRITE_HEIGHT = 20 PLAYER_SPRITE_HOVER = 100 PLAYER_SPRITE_PADDING = 20 CLOSE_CALL_POSITION = (200, 200) # display TARGET_FRAMERATE = 60 GAME_TITLE = "Dodge" SCORE_POSITION = (20, SCREEN_HEIGHT - 50) # colors SCREEN_FILL_...
#! /usr/bin/env python3 def analyse_pattern(ls) : corresponds = {2:1,7:8,4:4,3:7} dct = {corresponds[len(i)]:i for i in ls if len(i) in [2, 3, 4, 7]} for i in range(10) : s = len(ls[i]) if s == 6 : #0 6 9 if sum(ls[i][j] in dct[4] for j in range(s)) == 3 : if sum...
class Solution: def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode: if not postorder: return root = TreeNode(postorder[-1]) rootpos = inorder.index(postorder[-1]) root.left = self.buildTree(inorder[:rootpos], postorder[:rootpos]) root.right ...
class Node: def __init__(self, data=None, next=None): self.__data = data self.__next = next @property def data(self): return self.__data @data.setter def data(self, data): self.__data = data @property def next(self): return self.__next @next.se...
def y(): raise TypeError def x(): y() try: x() except TypeError: print("x")
# nominal reactor positions data = dict([ ('YJ1', [52.5]), ('YJ2', [52.5]), ('YJ3', [52.5]), ('YJ4', [52.5]), ('YJ5', [52.5]), ('YJ6', [52.5]), ('TS1', [52.5]), ('TS2', [52.5]), ('TS3', [52.5]), ('TS4', [52.5]), ('DYB', [215.0]), ('HZ', [265.0]), ])
class Summary: def __init__(self, total_income, net_income, income_tax, employees_ni, employers_ni): self._total_income = total_income self._net_income = net_income self._income_tax = income_tax self._employees_ni = employees_ni self._employers_ni = employers...
class Solution: def reverseOnlyLetters(self, s: str) -> str: def isChar(c): return True if ord('z')>=ord(c)>=ord('a') or ord('Z')>=ord(c)>=ord('A') else False right = len(s)-1 left = 0 charArray = [c for c in s] while left<righ...
def fp(i,n) : i /= 100 return (1+i)**n def pf(i,n) : i /= 100 return 1/((1+i)**n) def fa(i,n) : i /= 100 return (((1+i)**n)-1)/i def af(i,n) : i /= 100 return i/(((1+i)**n)-1) def pa(i,n) : i /= 100 return (((1+i)**n)-1)/(i*((1+i)**n)) def ap(i,n) : i /= 100 return (i*((1+i)**n))/(((1+i)**n...
"""utility functions to read in and parse a file efficiently """ def gen_file_line(text): with open(text) as fp: for line in fp: yield line
''' Invert a binary tree. Example: Input: 4 / \ 2 7 / \ / \ 1 3 6 9 Output: 4 / \ 7 2 / \ / \ 9 6 3 1 Trivia: This problem was inspired by this original tweet by Max Howell: Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a bina...
""" 给出n对括号,求括号排列的所有可能性。 """ """ 回溯法三要素: 1、选择。在这个例子中,解就是一个合法的括号组合形式,而选择无非是放入左括号,还是放入右括号; 2、条件。在这个例子中,选择是放入左括号,还是放入右括号,是有条件约束的,不是随便放的。 而这个约束就是括号的数量。只有剩下的右括号比左括号多,才能放右括号。只有左括号数量大于0才能放入左括号。这里if的顺序会影响输出的顺序,但是不影响最终解; 3、结束。这里的结束条件很显然就是,左右括号都放完了。 """ def BackTracking(sublist,results,left_brackets,right_brackets): if left_b...
# Copyright (c) 2018 Turysaz <turysaz@posteo.org> class IoCContainer(): def __init__(self): self.__constructors = {} # {"service_key" : service_ctor} self.__dependencies = {} # {"service_key" : ["dep_key_1", "dep_key_2", ..]} constructor parameters self.__quantity = {} # {"service_...
# def isIPv4Address(inputString): # return len([num for num in inputString.split(".") if num != "" and 0 <= int(num) < 255]) == 4 # def isIPv4Address(inputString): # return len([int(num) for num in inputString.split(".") if num != "" and not num.islower() and 0 <= int(num) <= 255]) == 4 # def isIPv4Addr...
class UrlManager(): def __init__(self): """ 初始化url """ # 职位 url self.positon_url = 'https://www.lagou.com/jobs/positionAjax.json?px=default&city={}&needAddtionalResult=false' def get_position_url(self): """ 返回职位url :return: """ ret...
n = int(input()) s = input() xo = "XO" ox = "OX" count_x = s.count("X") #print(count_xo) dst = s.replace("X", "") o_length = len(s) # Oの数 x_length = n - o_length count_o = s.count("O") #print(count_ox) dst = s.replace("O","") if count_xo == 0: print(1) count = 0 elif count_ox == 0: print(2) count =...
def validTime(time): tokens = time.split(":") hours, mins = tokens[0], tokens[1] if int(hours) < 0 or int(hours) > 23: return False if int(mins) < 0 or int(mins) > 59: return False return True
# # PySNMP MIB module AT-IGMP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AT-IGMP-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:30:12 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, 0...
#!/usr/bin/env python # # Copyright (c) 2018 10X Genomics, Inc. All rights reserved. # MULTI_REFS_PREFIX = 'multi' # Constants for metasamples GENE_EXPRESSION_LIBRARY_TYPE = 'Gene Expression' VDJ_LIBRARY_TYPE = 'VDJ' ATACSEQ_LIBRARY_TYPE = 'Peaks' ATACSEQ_LIBRARY_DERIVED_TYPE = 'Motifs' DEFAULT_LIBRARY_TYPE = GENE_EX...
n = total = maior = media = cont = 0 menor = 9999999999 opcao = 'S' while opcao == 'S': n = int(input('Digite um número: ')) total += n cont += 1 if n > maior: maior = n if n < menor: menor = n opcao = str(input('Quer continuar? [S/N]: ').strip().upper()[0]) media = total / cont ...
""" File: rocket.py Name: 黃科諺 ----------------------- This program should implement a console program that draws ASCII art - a rocket. The size of rocket is determined by a constant defined as SIZE at top of the file. Output format should match what is shown in the sample run in the Assignment 2 Handout. ""...
def noOfwords(strs): l = strs.split(' ') return len(l) string = input() count = noOfwords(string) print(count)
def modular_exp(b, e, mod): if e == 0: return 1 res = modular_exp(b, e//2, mod) res = (res * res ) % mod if e%2 == 1: res = (res * b) % mod return res
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Top-level presubmit script for Skia. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about the presubmi...
# coding=utf-8 """ 下一个排列 描述:给定一个整数数组来表示排列,找出其之后的一个排列 思路: 和寻找上一个类似 这个就是找到上升点, 然后从上升点开始算从右到左找到第一个也是最小的那个比上升点前那个数大的数 然后交换位置, 然后倒置从上升点开始的那一片 """ class Solution: """ @param nums: An array of integers @return: nothing """ def nextPermutation(self, nums): # write your code here if nums...
#!C:\Python27\python.exe # EASY-INSTALL-SCRIPT: 'docutils==0.12','rst2odt_prepstyles.py' __requires__ = 'docutils==0.12' __import__('pkg_resources').run_script('docutils==0.12', 'rst2odt_prepstyles.py')
""" FIT1008 Prac 6 Task 1 Loh Hao Bin 25461257, Tan Wen Jie 25839063 @purpose: Knight in Chess File: The columns Rank: The rows @created 20140831 @modified 20140903 """ class Tour: def __init__(self,y,x): self.board = [ [0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0], ...
""" union operation """ def union(set1: list, set2: list) -> list: result = [] for s1 in set1: for s2 in set2: if s1 == s2: result.append(s1) return result if __name__ == "__main__": cases = [ {"s1": [1, 2, 3], "s2": [3, 4, 5], "ans": [3]}, {"s1"...
"""Module focussing on the `format` command. Contains the task and helpers to format the codebase given a specific formatter. """ # import pathlib # # # def bob_format(options, cwd): # folders = ['src', 'include'] # filetypes = ['*.c', '*.h', '*.cpp', '*.hpp'] # # files = [] # for f in folders: # ...
template = """ module rom32x4 ( input [4:0] addr, input clk, output [4:0] data); wire [7:0] rdata; wire [15:0] RDATA; wire RCLK; wire [10:0] RADDR; SB_RAM40_4KNR #( // negative edge readclock so we can apply and addres on the positive edge and guarantee data is available on the next posedge .WRITE_MODE(...
#!/usr/bin/env python3 def raw_limit_ranges(callback_values): data = { '__meta': { 'chart': 'cisco-sso/raw', 'version': '0.1.0' }, 'resources': [{ 'apiVersion': 'v1', 'kind': 'LimitRange', 'metadata': { 'name': 'l...
#definir variables y otros print("Ejemplo 01-Area de un triangulo") #Datos de entrada - Ingresados mediante dispositivos de entrada b=int(input("Ingrese Base:")) h=int(input("Ingrese altura")) #proceso de calculo de Area area=(b*h)/2 #Datos de salida print("El area del triangulo es:", area)
def handle_request(response): if response.error: print("Error:", response.error) else: print('called') print(response.body)
# CPP Program of Prim's algorithm for MST inf = 65000 # To add an edge def addEdge(adj, u, v, wt): adj[u].append([v, wt]) adj[v].append([u, wt]) def primMST(adj, V): # Create a priority queue to store vertices that # are being preinMST. pq = [] src = 0 # Taking vertex 0 as source #...
n,m,k = map(int,input().split()) d = list(map(int,input().split())) m = list(map(int,input().split())) ans = [] check = 10**18 for i in range(len(d)): frog=d[i] c=0 for j in range(len(m)): if m[j]%frog==0: c+=1 if c<check: ans.clear() ans.append(i+1) check=c ...
''' 位1的个数 编写一个函数,输入是一个无符号整数(以二进制串的形式),返回其二进制表达式中数字位数为 '1' 的个数(也被称为汉明重量)。 ''' ''' 思路:输入的整数右移32位,统计其1的个数。可以用n&(n-1)的技巧,更快的统计。 ''' class Solution: def hammingWeight(self, n: int) -> int: cnt = 0 while n > 0: n &= (n - 1) cnt += 1 return cnt s = Solution() print(s.ham...
# Variables age = 20 # declaring int variable temperature = 89.8 # declaring float variable name = 'John' # declaring str variable, Note: we use single quotes to store the text. model = "SD902" # declaring str variable print(model) model = 8890 # n...
# -*- coding: utf-8 -*- ''' Copyright (c) 2014 @author: Marat Khayrullin <xmm.dev@gmail.com> ''' API_VERSION_V0 = 0 API_VERSION = API_VERSION_V0 bp_name = 'api_v0' api_v0_prefix = '{prefix}/v{version}'.format( prefix='/api', # current_app.config['URL_PREFIX'], version=API_VERSION_V0 )
hex2bin = dict('{:x} {:04b}'.format(x,x).split() for x in range(16)) def float_dec2bin(n): neg = False if n < 0: n = -n neg = True hx = float(n).hex() p = hx.index('p') bn = ''.join(hex2bin.get(char, char) for char in hx[2:p]) return (('1' if neg else '0') + bn.strip('0') + hx[p...
# basicpackage/foo.py a = 10 class Foo(object): pass print("inside 'basicpackage/foo.py' with a variable in it")
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ 定制类 __call__ """ class Student(object): def __init__(self, name): self._name = name def __call__(self): print('My name is %s.' % self._name) s = Student('Walker') s()
print('{:=^90}'.format(' Desafio 008 ')) print('{:=^90}'.format(' Escrevendo um valor em metros e convertendo em centímetros e milímetros ')) print('='*90) n = float(input('Metros: ')) print('{} metro(s): \n{}km \n{}hm \n{}dam \n{:.0f}dm \n{:.0f}cm \n{:.0f}mm '.format(n, n/1000, n/100, n/10, n*10, n*100, n*1000)) #km. ...
famous_people = [] with open("/Users/coco/Documents/GitHub/python-side-projects/wikipedia-crawler/year1902-2020.txt",'r') as foo: for line in foo.readlines(): if '``' in line: famous_people.append(line) with open("famous_people.txt", "a") as f: for person in famous_people: f.wr...
class no_deps(object): pass class one_dep(object): def __init__(self, dependency): self.dependency = dependency class two_deps(object): def __init__(self, first_dep, second_dep): self.first_dep = first_dep self.second_dep = second_dep
# # PySNMP MIB module HP-ICF-ARP-PROTECT (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-ARP-PROTECT # Produced by pysmi-0.3.4 at Mon Apr 29 19:20:43 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
pkgname = "libuninameslist" pkgver = "20211114" pkgrel = 0 build_style = "gnu_configure" hostmakedepends = ["pkgconf", "automake", "libtool"] pkgdesc = "Library of Unicode names and annotation data" maintainer = "q66 <q66@chimera-linux.org>" license = "BSD-3-Clause" url = "https://github.com/fontforge/libuninameslist" ...
POSTGRESQL = 'PostgreSQL' MYSQL = 'MySQL' DEV = 'Development' STAGE = 'Staging' TEST = 'Testing' PROD = 'Production'
# 10001st prime # The nth prime number def isPrime(n): for i in range(2, int(math.sqrt(n))+1): if n%i == 0: return False return True def nthPrime(n): num = 2 nums = [] while len(nums) < n: if isPrime(num) == True: nums.append(num) num += 1 return nums[-1]
class IntervalNum: def __init__(self,a,b): if a > b: a,b = b,a self.a = a self.b = b def __str__(self): return f"[{self.a};{self.b}]" def __add__(self,other): return IntervalNum(self.a+other.a, self.b+other.b) def __sub__(self,other): re...
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'cv.sqlite', # Or path to database file if using sqlite3. 'USER': '', # Not used with sqlite3. 'PASSWORD': '', # Not used with sqlite3. 'HOS...
vehicles = { 'dream': 'Honda 250T', 'er5': 'Kawasaki ER5', 'can-am': 'Bombardier Can-Am 250', 'virago': 'Yamaha XV250', 'tenere': 'Yamaha XT650', 'jimny': 'Suzuki Jimny 1.5', 'fiesta': 'Ford Fiesta Ghia 1.4', 'roadster': 'Triumph Street Triple' } vehicles["starfighter"] = "Lockhead F-10...
class DpiChangedEventArgs(RoutedEventArgs): # no doc NewDpi=property(lambda self: object(),lambda self,v: None,lambda self: None) """Get: NewDpi(self: DpiChangedEventArgs) -> DpiScale """ OldDpi=property(lambda self: object(),lambda self,v: None,lambda self: None) """Get: OldDpi(self: DpiChangedEventAr...
#!/usr/bin/env python def start(): print("Hello, world.") if __name__ == '__main__': start()
numbers = [3, 6, 2, 8, 4, 10] max = numbers[0] for number in numbers: if number > max: max = number print(max)
class StateMachineException(Exception): def __init__(self, message_format, **kwargs): if kwargs: self.message = message_format.format(**kwargs) else: self.message = message_format self.__dict__.update(**kwargs) def __str__(self): return self.message cla...
#!/usr/bin/python3 # -*- coding: utf-8 -*- class DataSet: def __init__(self, src_channels_url: str, injection_file_name: str, out_file_name: str, out_file_encoding: str, out_file_first_line: str, out_file_format...
sys_word = {} for x in range(0,325): sys_word[x] = 0 file = open("UAD-0015.txt", "r+") words = file.read().split() file.close() for word in words: sys_word[int(word)] += 1 for x in range(0,325): sys_word[x] = sys_word[x]/int(325) file_ = open("a_1.txt", "w") for x in range(0,325): if x is 324: ...
#Soumya Pal #Assignment 2 part 4 info = { "name": "Shomo Pal", "favorite_color": "Blue", "favorite_number": 10, "favorite_movies": ["Inception","The Shashank Redemption","One Piece (Anime not movie)"], "favorite_songs" : [{'artist': 'Metallica', 'title': 'Nothing Else Matters'}, {'artist':...
print('='*18,'lojinha do zé','='*18) P = float(input('qualo valor da compra R$')) print('='*49) print('[1] para pagar a vista/cheque') print('[2] para pagar a vista no cartão') print('[3] para pagar em ate 2x no cartão') print('[4] para pagar parcelado em 3X ou mais no cartão') e = int(input('digite sua escolha')) prin...