content
stringlengths
7
1.05M
# https://github.com/cthoyt/cookiecutter-snekpack how to make folder structure # https://bmcbioinformatics.biomedcentral.com/articles/10.1186/1471-2105-14-340 article for this analysis CRED = '\033[91m' CEND = '\033[0m' EXPRESSION = "../../data/GSE161533.top.table.tsv" EXPRESSION2 = "../../data/GGSE54129.top.table.tsv...
f = [0,1] n = int(input("numar:")) for i in range(2, n+1): f.append(f[i-1]+f[i-2]) print(f)
# -*- coding: utf-8 -*- # Scrapy settings for tech163 project # # For simplicity, this file contains only the most important settings by # default. All the other settings are documented here: # # http://doc.scrapy.org/en/latest/topics/settings.html # BOT_NAME = 'money163' SPIDER_MODULES = ['money163.spiders'] NE...
# -*- coding: utf-8 -*- """ Created on Wed Sep 11 20:49:06 2019 @author: foolwolf0068 """ ''' # 4.1 from math import sqrt a, b, c = eval(input('Enter a, b, c: ')) delta = b*b-4*a*c if(delta<0): print('The equation has no real roots') elif(delta>0): r1 = 0.5*(-b+sqrt(delta))/a r2 = 0.5*(-b-sqrt(delta))/a ...
def first_letter_of_word(current_word): digits = [] new_current_word = [] for letter in current_word: if letter.isdigit(): digits.append(letter) elif letter.isalpha(): new_current_word.append(letter) first_letter = chr(int("".join(digits))) new_current_word.in...
N = int(input()) line = [] for a in range(N): line.append(int(input())) total = 0 curIter = 1 while min(line) < 999999: valleys = [] for a in range(N): if line[a] < 999999: if (a == 0 or line[a] <= line[a - 1]) and (a == N - 1 or line[a] <= line[a + 1]): valleys.append...
def invert_binary_tree(node): if node: node.left, node.right = invert_binary_tree(node.right), invert_binary_tree(node.left) return node class BinaryTreeNode(object): def __init__(self, value, left=None, right=None): self.value = value self.left = None self.right = None...
#!/usr/bin/env python3 def selection_sort(lst): length = len(lst) for i in range(length - 1): least = i for k in range(i + 1, length): if lst[k] < lst[least]: least = k lst[least], lst[i] = (lst[i], lst[least]) return lst print(selection_sort([5, 2, 4, ...
# -*- coding: utf8 -*- # Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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...
class EmailTypes(object): AUTH_WELCOME_EMAIL = "auth__welcome_email" AUTH_VERIFY_SIGNUP_EMAIL = "auth__verify_signup_email" EMAILS = {} EMAILS[EmailTypes.AUTH_WELCOME_EMAIL] = { "is_active": False, "html_template": "emails/action-template.html", "text_template": "emails/action-template.txt", ...
test = { 'name': 'q3_1_8', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" >>> genre_and_distances.labels == ('Genre', 'Distance') True """, 'hidden': False, 'locked': False }, { 'code': r""" >>>...
count = input('How many people will be in the dinner group? ') count = int(count) if count > 8: print('You\'ll have to wait for a table.') else: print('The table is ready.')
# Automatically generated # pylint: disable=all get = [{'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3, 'DefaultVCpus': 1, 'DefaultCores': 1, 'DefaultThreadsPerCore': 1, 'ValidCores': [1], 'ValidThreadsPerCore': [1], 'SizeInMiB': 2048, 'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supp...
# https://stockmarketmba.com/globalstockexchanges.php exchanges = { 'USA': None, 'Germany': 'XETR', 'Hong Kong': 'XHKG', 'Japan': 'XTKS', 'France': 'XPAR', 'Canada': 'XTSE', 'United Kingdom': 'XLON', 'Switzerland': 'XSWX', 'Australia': 'XASX', 'South Korea': 'XKRX', 'The Net...
def SC_DFA(y): N = len(y) tau = int(np.floor(N/2)) y = y - np.mean(y) x = np.cumsum(y) taus = np.arange(5,tau+1) ntau = len(taus) F = np.zeros(ntau) for i in range(ntau): t = int(taus[i]) x_buff = x[:N - N % t] x_buff = x_buff.reshape((int(N / t),t)) ...
''' Formula for area of circle Area = pi * r^2 where pi is constant and r is the radius of the circle ''' def findarea(r): PI = 3.142 return PI * (r*r); print("Area is %.6f" % findarea(5));
class Take(object): def __init__(self, stage, unit, entity, not_found_proc, finished_proc): self._stage = stage self._unit = unit self._entity = entity self._finished_proc = finished_proc self._not_found_proc = not_found_proc def enact(self): if ...
""" Author: CaptCorpMURICA Project: 100DaysPython File: module1_day04_variables.py Creation Date: 6/2/2019, 8:55 AM Description: Learn about using variables in python. """ # Variables need to start with a letter or an underscore. Numbers can be used in the variable name...
rows = [] with open("C:\\Privat\\advent_of_code20\\puzzle14\\input1.txt") as f: for line in f: rows.append(line.strip()) #print(rows) memory = {} currentMask = "" for line in rows: split = line.split(' = ') if 'mask' in split[0]: currentMask = split[1].strip() else: # value in...
startHTML = ''' <html> <head> <style> table { border-collapse: collapse; height: 100%; width: 100%; } table, th, td { border: 3px solid black; } @media print { table { page-break-after: always; ...
#!/usr/bin/python3 class InstructionNotRecognized(Exception): ''' Exception to throw when an instruction does not have defined conversion code ''' pass reg_labels = """ .section .tdata REG_BANK: .dword 0 .dword 0 .dword 0 .dword 0 .dword 0 .dword 0 ...
# Copyright 2022, Kay Hayen, mailto:kay.hayen@gmail.com # # Part of "Nuitka", an optimizing Python compiler that is compatible and # integrates with CPython, but also works on its own. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complianc...
# Use snippet 'summarize_a_survey_module' to output a table and a graph of # participant counts by response for one question_concept_id # The snippet assumes that a dataframe containing survey questions and answers already exists # The snippet also assumes that setup has been run # Update the next 3 lines survey_df =...
class LOG: def info(message): print("Info: " + message) def error(message): print("Error: " + message) def debug(message): print("Debug: " + message)
if __name__ == '__main__': # Fill in the code to do the following # 1. Set x to be a non-negative integer (no decimals, no negatives) # 2. If x is divisible by 3, print 'Fizz' # 3. If x is divisible by 5, print 'Buzz' # 4. If x is divisible by both 3 and 5, print 'FizzBuzz' # 5. If x is divisib...
# # 如果目标值存在返回下标,否则返回 -1 # @param nums int整型一维数组 # @param target int整型 # @return int整型 # class Solution: def search(self, nums, target): begin, end = 0, len(nums) - 1 while begin < end: mid = (begin + end) // 2 if nums[mid] >= target: end = mid else...
class Solution: def rotate(self, matrix) -> None: result = [] for i in range(0,len(matrix)): store = [] for j in range(len(matrix)-1,-1,-1): store.append(matrix[j][i]) result.append(store) for i in range(0,len(result)): mat...
provinces = [ # ["nunavut", 2], # ["yukon", 4], # ["Northwest%20Territories",2], # ["Prince%20Edward%20Island", 6], # ["Newfoundland%20and%20Labrador", 12], # ["New%20Brunswick", 28], # ["Nova%20Scotia", 36], # ["Saskatchewan", 34], # ["Manitoba", 40], # ["Alberta", 167], # [...
# Copyright 2019 Open Source Robotics Foundation, Inc. # # 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 Estrella: def __init__(self,galaxia ="none",temperatura = 0,masa = 0): self.galaxia = galaxia self.temperatura = temperatura self.masa = masa
L = int(input()) Tot = 0 Med = 0 T = str(input()).upper() M = [[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,...
######################### # DO NOT MODIFY ######################### # SETTINGS.INI C_MAIN_SETTINGS = 'Main_Settings' P_DIR_IGNORE = 'IgnoreDirectories' P_FILE_IGNORE = 'IgnoreFiles' P_SRC_DIR = 'SourceDirectory' P_DEST_DIR = 'DestinationDirectories' P_BATCH_SIZE = 'BatchProcessingGroupSize' P_FILE_BUFFER = 'FileReadBuf...
def bubble_sort(iterable): return sorted(iterable) def selection_sort(iterable): return sorted(iterable) def insertion_sort(iterable): return sorted(iterable) def merge_sort(iterable): return sorted(iterable) def quicksort(iterable): return sorted(iterable)
class Payload: def __init__(self, host,port, strs): self.host,self.port,self.strs = host,port,strs def create(self): return """ conn = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) conn.connect(('{host}' , int({port}))) from os import walk\nfrom string import ascii_lower as a for l in a:\n\t...
class Author: @property def surname(self): return self._surname @property def firstname(self): return self._firstname @property def affiliation(self): return self._affiliation @property def identifier(self): return self._identifier @firstname.sett...
# “价值 2 个亿”的 AI 代码 while True: print('AI: 你好,我是价值 2 个亿 AI 智能聊天机器人! 有什么想问的的吗?') message = input('我: ') print('AI: ' + message.replace('吗','').replace('?','!'))
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2017, Jon Hawkesworth (@jhawkesworth) <jhawkesworth@protonmail.com> # Copyright: (c) 2017, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) DOCUMENTATION = r''' --- module: win_toast short_descriptio...
VERSION = "1.4.4" if __name__ == "__main__": print(VERSION, end="")
party_size = int(input()) days = int(input()) total_coins = 0 for day in range (1, days + 1): if day % 10 == 0: party_size -= 2 if day % 15 == 0: party_size += 5 total_coins += (50 - (2 * party_size)) if day % 3 == 0: total_coins -= (3 * party_size) if day % 5 == 0: ...
num = int(input("Digite o número a ser convertido: ")) base = int(input("Digite a base que deseja converter(2, 8 ou 16): ")) if base == 2: print("O número em binário é: {}".format(bin(num))) elif base == 8: print("O número em octal é: {}".format(oct(num))) else: print("O número em hexadecimal é: {}".forma...
#break for i in range(1,10,1): if(i==5): continue print(i)
@bot.on(events.NewMessage(incoming=True)) @bot.on(events.MessageEdited(incoming=True)) async def common_incoming_handler(e): if SPAM: db=sqlite3.connect("spam_mute.db") cursor=db.cursor() cursor.execute('''SELECT * FROM SPAM''') all_rows = cursor.fetchall() for row in all_rows: i...
"""Helper module for bitfields manipulation""" class BitField(int): """Stores an int and converts it to a string corresponding to an enum""" to_string = lambda self, enum: " ".join([i for i, j in enum._asdict().items() if self & j])
class ElectionFraudDiv2: def IsFraudulent(self, percentages): ra, rb = 0, 0 for p in percentages: a, b = 10001, 0 for i in xrange(10001): if int(round(i*100.0 / 10000)) == p: a, b = min(a, i), max(b, i) if not b: ...
# SPDX-FileCopyrightText: 2020 FoamyGuy for Adafruit Industries # # SPDX-License-Identifier: MIT def wrap_nicely(string, max_chars): """ From: https://www.richa1.com/RichardAlbritton/circuitpython-word-wrap-for-label-text/ A helper that will return the string with word-break wrapping. :param str string: Th...
""" 1. Clarification 2. Possible solutions - Recursive - Iterative - Morris traversal 3. Coding 4. Tests """ # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right # T=...
class Solution: def removeStones(self, stones: List[List[int]]) -> int: graph = collections.defaultdict(list) n = len(stones) for i in range(n): for j in range(n): if i == j: continue if stones[i][0] == stones[j][0] or stones[i]...
""" [M] Given a Bitonic array, find if a given ‘key’ is present in it. An array is considered bitonic if it is monotonically increasing and then monotonically decreasing. Monotonically increasing or decreasing means that for any index i in the array arr[i] != arr[i+1]. Write a function to return the index of the...
''' Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. Note: A leaf is a node with no children. Example: Given the below binary tree and sum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ \ 7 2 ...
class Solution: def majorityElement(self, nums: List[int]) -> List[int]: nums_dict = {} for num in nums: if num in nums_dict: nums_dict[num] += 1 else: nums_dict[num] = 1 return [key for key, value in nums_dict.items() if value > len(nu...
# -*- python -*- load("@drake//tools/workspace:github.bzl", "github_archive") def scs_repository( name, mirrors = None): github_archive( name = name, repository = "cvxgrp/scs", # When updating this commit, see drake/tools/workspace/qdldl/README.md. commit = "v2.1.3"...
while True: ans = sorted([int(n) for n in input().split()]) if sum(ans) == 0: break print(*ans)
{ "object_templates": [ { "name": "fridge", "description": ["Fridge desc."], "container": [10] }, { "type_name": "barrel", "description": ["Barrel desc."], "interest": [5], "sound": { "OPEN": 2 }, "container": [5], }...
# -*- coding: utf-8 -*- HOME_DIR = r"D:\\Documents\\Data\\MSL\\FRBG3_1\\rgbd_dataset_freiburg3_long_office_household\\" RGB_FILE_PATH = HOME_DIR + "rgb\\" #Path where the RGB files are stored DEPTH_FILE_PATH = HOME_DIR + "depth\\" #Path where the depth maps are stored...
class WsContext: """ 被动事件里携带的上下文信息,目前仅有部分事件支持 """ def __init__(self, event_type: str, event_id: str): self.event_type = str(event_type or "") self.event_id = str(event_id or "")
# card_hold_href is the stored href for the CardHold card_hold = balanced.CardHold.fetch(card_hold_href) debit = card_hold.capture( appears_on_statement_as='ShowsUpOnStmt', description='Some descriptive text for the debit in the dashboard' )
''' Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? ''' class Solution: def singleNumber(self, nums: List[i...
def euler013(): # 関数euler013の定義 q = [] # qに空のリストを代入 a = str(sum(q)) # aにqの要素の総和の文字列表現を代入 ret = "" # retに空文字列を代入 for i, ch in enumerate(a): # chをaの各要素、iをその番号として if i < 10: # もしiが10未満であれば ret += ch # retにchを追加 return ret # retを返す def euler013_front_n_slice(s, n): # sとnを引数とする関数euler013_front_n_sliceを定義 ret = ""...
time = ('Internacional', 'Flamengo', 'Atlético-MG','Fluminense', 'São Paulo', 'Santos', 'Palmeiras', 'Fortaleza', 'Grêmio', 'Ceará', 'Atlético-GO', 'Sport', 'Corinthians', 'Bahia', 'Bragantino', 'Botafogo', 'Vasco', 'Athletico-PR', 'Coritiba', 'Goiás') print('='*50) print('Tabela dos times do br...
class Android: # adb keyevent KEYCODE_ENTER = "KEYCODE_DPAD_CENTER" KEYCODE_RIGHT = "KEYCODE_DPAD_RIGHT" KEYCODE_LEFT = "KEYCODE_DPAD_LEFT" KEYCODE_DOWN = "KEYCODE_DPAD_DOWN" KEYCODE_UP = "KEYCODE_DPAD_UP" KEYCODE_SPACE = "KEYCODE_SPACE" # adb get property PROP_LANGUAGE = "persist.s...
"""CUBRID FIELD_TYPE Constants These constants represent the various column (field) types that are supported by CUBRID. """ CHAR = 1 VARCHAR = 2 NCHAR = 3 VARNCHAR = 4 BIT = 5 VARBIT = 6 NUMERIC = 7 INT = 8 SMALLINT = 9 MONETARY = 10 BIGINT = 21 FLOAT = 11 DOUBLE = 12 DATE = 13 TIME = 14 T...
class BearToy: def __init__(self, name, size, color): # 在实例化时自动执行 self.name = name self.size = size self.color = color def sing(self): print('I am %s, lalala...' % self.name) if __name__ == '__main__': # 把参数传给__init__, 实例本身,如tidy,自动作为第一个参数传递 tidy = BearToy('tidy', 'mid...
gainGyroAngle = 1156*1.4 gainGyroRate = 146*0.85 gainMotorAngle = 7*1 gainMotorAngularSpeed = 9*0.95 gainMotorAngleErrorAccumulated = 0.6
# Upper makes a string completely capitalized. parrot = "norwegian blue" print ("parrot").upper()
file = open('binaryBoarding_input.py', 'r') tickets = file.readlines() total_rows = 128 total_columns = 8 def find_row(boarding_pass): min_row = 0 max_row = total_rows - 1 for letter in boarding_pass[:7]: if letter == 'F': max_row = max_row - int((max_row - min_row) / 2) - 1 e...
x = int(input()) y = int(input()) NotMult = 0 if x<y: for c in range(x, y+1): if (c%13)!=0: NotMult += c if x>y: for c in range(y, x+1): if (c%13)!=0: NotMult += c print(NotMult)
# Control all of the game settings. # Imports class Settings(): """Class to store all game settings.""" # Initalize game settings def __init__(self): # Screen Settings self.screen_width = 1200 self.screen_height = 800 self.bgColor = (230,230,230) # Ship settings ...
#!/usr/bin/env python # -*- coding: UTF-8 -*- def test1(): print('\ntest1') x = 10 y = 1 result = x if x > y else y print(result) def max2(x, y): return x if x > y else y def test2(): print('\ntest2') print(max2(10, 20)) print(max2(2, 1)) def main(): test1() test2() ...
n = int(input('Digite um número: ')) u = n // 1 % 10 d = n // 10 % 10 c = n // 100 % 10 m = n // 1000 % 10 print("""Analisando {} ele tem: {} unidade; {} dezenas; {} centenas; {} milhares. """.format(n, u, d, c, m))
"""pytest is unhappy if it finds no tests""" def test_nothing(): """An empty test to keep pytest happy"""
name = input("What is your name?") quest = input("What is your quest?") color = input("What is your favorite color?") print(f"So your name is {name}.\nYou seek to {quest}.\nYour favorite color is {color}.\nYou may cross!")
class Rectangle(object): def __init__(self, length, width): self.length = length self.width = width def area(self): return self.length * self.width def perimeter(self): return 2 * self.length + 2 * self.width class Square(Rectangle): def __init__(self, length): ...
a = list(map(int,input().split())) b = list(map(int,input().split())) for i in range(a[0]): if b[i] < a[1]: print(b[i],end='') print(" ",end='')
def main(): n = int(input()) v = list(map(int, input().split())) m = dict() res = 0 for i in v: if i not in m: m[i] = 0 m[i] += 1 k = v.copy() for i in range(n - 1, 0, -1): k[i - 1] = k[i] + k[i - 1] for i in range(0, n - 1): res += -(n - i ...
expected_output = { "main": { "chassis": { "C9407R": { "name": "Chassis", "descr": "Cisco Catalyst 9400 Series 7 Slot Chassis", "pid": "C9407R", "vid": "V01", "sn": "******", } }, "TenGiga...
a = int(input()) s = list(range(1, a+1)) k = len(s) while k > 1: if k & 1: s = s[::2] del s[0] else: s = s[::2] k = len(s) print(s[0])
ANONYMOUS = 'Anonymous User' PUBLIC_NON_REQUESTER = 'Public User - Non-Requester' PUBLIC_REQUESTER = 'Public User - Requester' AGENCY_HELPER = 'Agency Helper' AGENCY_OFFICER = 'Agency FOIL Officer' AGENCY_ADMIN = 'Agency Administrator' POINT_OF_CONTACT = 'point_of_contact'
class Solution: def partition(self, head, x): h1 = l1 = ListNode(0) h2 = l2 = ListNode(0) while head: if head.val < x: l1.next = head l1 = l1.next else: l2.next = head l2 = l2.next head = head...
# Python 2.7 Coordinate Generation MYARRAY = [] INCREMENTER = 0 while INCREMENTER < 501: MYARRAY.append([INCREMENTER, INCREMENTER*2]) INCREMENTER += 1
#: attr1 attr1: str = '' #: attr2 attr2: str #: attr3 attr3 = '' # type: str class _Descriptor: def __init__(self, name): self.__doc__ = "This is {}".format(name) def __get__(self): pass class Int: """An integer validator""" @classmethod def __call__(cls,x): return int(x)...
""" Given a time represented in the format "HH:MM", form the next closest time by reusing the current digits. There is no limit on how many times a digit can be reused. You may assume the given input string is always valid. For example, "01:34", "12:09" are all valid. "1:34", "12:9" are all invalid. Example 1: Inp...
class PlayerInfo: """ Detail a Granade event Attributes: tick (int) : Game tick at time of kill sec (float) : Seconds since round start player_id (int) : Player's steamID player_name (int) : Player's username player_x_viz (float...
# Copyright (c) 2011 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. { 'includes': [ '../../build/common.gypi', ], 'target_defaults': { 'variables': { 'chromium_code': 1, 'version_py_path': '../.....
#coding=utf-8 ''' Created on 2017年4月18日 @author: ethan ''' class MongoFile(object): file_name="" file_real_name="" content_type=""
# -*- coding: utf-8 -*- '''Snippets for string. Available functions: - to_titlecase: Convert the character string to titlecase. ''' def to_titlecase(s: str) -> str: '''For example: >>> 'Hello world'.title() 'Hello World' Args: str: String excluding apostrophes in contra...
t = int(input()) for t_itr in range(t): n = int(input()) count = 0 for i in range(n+1): if i%2 == 0: count+=1 else: count*=2 print(count)
# Aula 19 - Desafio 93: Cadastro de jogador de futebol # Ler o nome do jogador e quantas partidas ele jogou. Depois ler a quantidade de gols em cada partida # (colocar a quantidade de gols numa lista). # No final, tudo isso sera guardado num dicionario incluindo o total de gols feitos durante o campeonato. cadastro = ...
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER # Copyright (c) 2018 Juniper Networks, Inc. # All rights reserved. # Use is subject to license terms. # # Author: cklewar class AMQPMessage(object): # ------------------------------------------------------------------------ # property: message_ty...
class DaemonEvent(object): def __init__(self, name, params) -> None: super().__init__() self.name = name self.params = params @classmethod def from_json(cls, json): return DaemonEvent(json["event"], json["params"])
# -*- coding: utf-8 -*- """ @author: salimt """ #Problem 3 #20.0/20.0 points (graded) #You are creating a song playlist for your next party. You have a collection of songs that can be represented as a list of tuples. Each tuple has the following elements: #name: the first element, representing the song name ...
#func-with-var-args.py def addall(*nums): ttl=0 for num in nums: ttl=ttl+num return ttl total=addall(10,20,50,70) print ('Total of 4 numbers:',total) total=addall(11,34,43) print ('Total of 3 numbers:',total)
seq=[1,2,3,4,5] for item in seq: print (item); print ("Hello") i=1 while i<5: print('i is :{}',format(i)) #i is always smaller than 5 i=i+1 #otherwise inifite loop for x in seq: print(x) for x in range(0,5): print(x) #short way to do the loop list(range(10)) x=[1,2,3,4] out=[] for num in x: out...
"""Singly linked list. """ class SinglyLinkedListException(Exception): """ Base class for linked list module. This will make it easier for future modifications """ class SinglyLinkedListIndexError(SinglyLinkedListException): """ Invalid/Out of range index""" def __init__(self, message="linke...
#!/usr/bin/env python __all__ = ["test_bedgraph", "test_clustal", "test_fasta"] __author__ = "" __copyright__ = "Copyright 2007-2020, The Cogent Project" __credits__ = [ "Rob Knight", "Gavin Huttley", "Sandra Smit", "Marcin Cieslik", "Jeremy Widmann", ] __license__ = "BSD-3" __version__ = "2020.2.7...
BOT_NAME = 'tabcrawler' SPIDER_MODULES = ['tabcrawler.spiders'] NEWSPIDER_MODULE = 'tabcrawler.spiders' DOWNLOAD_DELAY = 3 ITEM_PIPELINES = ['scrapy.contrib.pipeline.images.ImagesPipeline'] IMAGES_STORE = '/Users/jinzemin/Desktop/GuitarFan/tabcrawler/tabs' # ITEM_PIPELINES = [ # 'tabcrawler.pipelines.ArtistPipeli...
frase = str(input('Escreva uma frase: ')).strip() print('A letra A aparece {} vezes na frase'.format(frase.lower().count('a'))) print('A letra A aparece a primeira vez na posição {}'.format(frase.lower().find('a') + 1)) print('A letra A aparece a última vez na posição {}'.format(frase.lower().rfind('a') + 1))
my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] counter = 0 for number in my_list: counter = counter + number print(counter)
''' It's Christmas time! To share his Christmas spirit with all his friends, the young Christmas Elf decided to send each of them a Christmas e-mail with a nice Christmas tree. Unfortunately, Internet traffic is very expensive in the North Pole, so instead of sending an actual image he got creative and drew the tree us...
cpicker = lv.cpicker(lv.scr_act(),None) cpicker.set_size(200, 200) cpicker.align(None, lv.ALIGN.CENTER, 0, 0)
""" Python implementation of a Circular Doubly Linked List With Sentinel. In this version the Node class is hidden hence the usage is much more similar to a normal list. """ class CDLLwS(object): class Node(object): def __init__(self, data): self.data = data self.prev = None self.next = None def __st...