content
stringlengths
7
1.05M
# from sw_site.settings.components import BASE_DIR, config # SECURITY WARNING: keep the secret key used in production secret! # SECRET_KEY = config('DJANGO_SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True CORS_ORIGIN_WHITELIST = ( 'localhost:8000', '127.0.0.1:8000',...
"""Define subproblems – Let Dij be the length of the LCS of x1...i and y1...j ◮ Find the recurrence – If xi = yj , they both contribute to the LCS ◮ Dij = Di−1,j−1 + 1 – Otherwise, either xi or yj does not contribute to the LCS, so one can be dropped ◮ Dij = max{Di−1,j , Di,j−1} – Find and solve the base cases: Di0 = D...
# -*- coding: utf-8 -*- # @Author : LG """ 执行用时:48 ms, 在所有 Python3 提交中击败了83.86% 的用户 内存消耗:14.8 MB, 在所有 Python3 提交中击败了62.52% 解题思路: 对拼消耗,摩尔投票 时间复杂度为 O(N),空间复杂度为 O(1) 不同数字一一对拼消耗,如果有剩余,则存在主要元素(人数最多,且,人数在一半以上) 具体实现见代码注释 """ class Solution: def majorityElement(self, nums: List[int]) -> int: n = ...
class TransferPeriodEnum: """ Переченисление периодов переноса """ OLD = 'old' NEW = 'new' values = { OLD: 'Старый период', NEW: 'Новый период', }
def get_context_user(context): if 'user' in context: return context['user'] elif 'request' in context: return getattr(context['request'], 'user', None)
APP_NAME = "PythonCef.Vue.Vuetify2 Template" APP_NAME_NO_SPACE = APP_NAME.replace(' ', '') APP_VERSION = '0.0.1' APP_DESCRIPTION = "Template using PythonCef, Flask, Vue, webpack"
def count_substring(string, sub_string): c = 0 for i in range(0, len(string)): ss = string[i:len(sub_string)+i] if sub_string == ss: c += 1 return c print(count_substring('ABCDCDC', 'CDC')) print(count_substring('I am an Indian, by birth', 'Birth')) print(count_substring('Th...
class PortData(object): def __init__(self, from_port, to_port, protocol, destination): """ec2_session :param from_port: to_port-start port :type from_port: int :param to_port: from_port-end port :type to_port: int :param protocol: protocol-can be UDP or TCP :...
a=int(input("Input an integer :")) n1=int("%s"%a) n2=int("%s%s"%(a,a)) n3=int("%s%s%s"%(a,a,a)) print(n1+n2+n3)
def jogador(nom="<desconhecido>", nG=0): print(f'O jogador {nom} fez {nG} gol(s) no compeonato.') # Programa principal: print('-' * 30) nome = str(input('Nome do jogador: ')).strip().capitalize() nGols = str(input('Número de gols: ')).strip() if nome == '' and not nGols.isnumeric(): jogador() elif nome == '':...
class Solution: def hasPathSum(self, root, target): def check(curr_node, curr_val): calc_val = curr_val + curr_node.val if calc_val == target and curr_node.left is None and curr_node.right is None: return True elif curr_node.left is not None and check(curr...
#Boolean is like telling Python to do something based on conditions: #if this is true, do this; else do something different. #conditional logic in Python is written using booleans (True and False), along with if statements. user = 'James Bond' if user == 'James Bond': print('Awesome!') elif user == 'Ethan Hunt...
##Patterns: W0109 ##Warn: W0109 cities = { 'CA': 'San Francisco', 'MI': 'Detroit', 'FL': 'Jacksonville', 'MI': 'Detroit' }
""" Reminders depending on the day of the week """ monday_msg = ["I hope you planned this week on Friday evening itself. If not, please do it now. Send out all the calendar events that you need to for this week. Accept (or reject) the calendar invites you received. Know at least two of your top priorities.", "Did you ...
""" Write a Python program to swap cases of a given string. Sample Output: pYTHON eXERCISES jAVA nUMpy """ def swap_case_string(str1): result_str = "" for item in str1: if item.isupper(): result_str += item.lower() else: result_str += item.upper() return result_str pr...
matriz = ([0,0,0], [0,0,0], [0,0,0]) par = terceira = maior = 0 for l in range(0,3): for c in range(0,3): matriz[l][c] = int(input(f'Type a value for [{l}, {c}]: ')) if matriz[l][c] % 2 == 0: par += matriz[l][c] print('=-'*15) for l in range (0,3): for c in range(0,3): print(...
class Constant: __excludes__ = [] class ConstantError(Exception): pass def __setattr__(self, name, value): exclude = name in Constant.__excludes__ if self.__dict__.get(name, None) and not exclude: raise Constant.ConstantError("Property %s is not mutable" % name) ...
even = int(input("total even number : ")) print(even, "first even number : ",end="") for i in range(2,even*2,2): print (i,end=", ") print(even*2)
class Alphabet: """ Bijective mapping from strings to integers. >>> a = Alphabet() >>> [a[x] for x in 'abcd'] [0, 1, 2, 3] >>> list(map(a.lookup, range(4))) ['a', 'b', 'c', 'd'] >>> a.stop_growth() >>> a['e'] >>> a.freeze() >>> a.add('z') Traceback (most recent call last)...
# break 和 continue 在Python中只能用于循环语句 # break:用来结束整个循环 # continue:用来结束本轮循环,开启下一轮循环 while True: username = input('请输入用户名:') password = input('请输入密码:') if username == 'zs' and password == '123': break
WHAT_IS_SATZIFY = ( "Satzify is a simple tool to help with analysing sentences in a given language. " "It helps with visualising and highlighting the different parts " "of a sentence according to the selected categories and parts to annotate. " "Initially and predominantly it has been created to be used...
#!/usr/bin/env python # -*- coding=utf-8 -*- def lev_dist(source, target): if source == target: return 0 #words = open(test_file.txt,'r').read().split(); # Prepare matrix slen, tlen = len(source), len(target) dist = [[0 for i in range(tlen+1)] for x in range(slen+1)] for i in range(slen+1...
__all__ = ["mi_enb_decoder"] PACKET_TYPE = { "0xB0A3": "LTE_PDCP_DL_Cipher_Data_PDU", "0xB0B3": "LTE_PDCP_UL_Cipher_Data_PDU", "0xB173": "LTE_PHY_PDSCH_Stat_Indication", "0xB063": "LTE_MAC_DL_Transport_Block", "0xB064": "LTE_MAC_UL_Transport_Block", "0xB092": "LTE_RLC_UL_AM_All_PDU", "0xB082": "LTE_RLC_D...
# Python - 2.7.6 eval_object = lambda v: { '+': v['a'] + v['b'], '-': v['a'] - v['b'], '/': v['a'] / v['b'], '*': v['a'] * v['b'], '%': v['a'] % v['b'], '**': v['a'] ** v['b'] }.get(v['operation'], 0)
frase = str(input('Digite uma frase: ')) m5 = ' '.join(frase.replace(' ', '')) print(m5.split())
# Кириллов, ИУ7-12, вариант 2 N = int(input('Задайте размер массива (число N): ')) t = float(input('Задайте коэффициент t: ')) A = list() maxA = 0 otrA = -1 otr = vozr = ub = True for i in range(N): A.append(((i + 1 - t)**2)/2 - 3) if A[i] > A[maxA] or i == 0: maxA = i if otr ...
# varia class Sleep: def NREM(self): print('NREM') def REM(self): print('REM') class Awake: def act(self): print('act')
#Init records_storage = dict() line_break = "-----------------------------------------------\n" run_program = True # Define Functions def add_item(key, value): records_storage[key] = value def delete_item(key): try: del records_storage[key] except KeyError: print(f"Key '{key}' could not be f...
def example1(): g = ig.load("data/out_1.graphml") # whichever file you would like dend = g.community_fastgreedy() #get the clustering object c = dend.as_clustering() result = metrics.run_analysis(c) print(c)
class Player(object): def __init__(self): self.name = None self.results = dict() self.rolls = [] self.scores = dict() # # set pins scores for a frame. # def set_result(self, frame, result): self.results[frame] = result def calculate_scor...
class PyttmanProjectInvalidException(BaseException): """ Exception class for internal use. Raise this exception in situations when a user project is incorrectly configured in whatever way. """ pass class TypeConversionFailed(BaseException): """ Exception class for internal use. Ra...
# Exercise # Exercise # Interpreting coefficients # Remember that origin airport, org, has eight possible values (ORD, SFO, JFK, LGA, SMF, SJC, TUS and OGG) which have been one-hot encoded to seven dummy variables in org_dummy. # The values for km and org_dummy have been assembled into features, which has eight column...
#--------------------------------- # BATCH DEFAULTS #--------------------------------- # The default options applied to each stage in the shell script. These options # are overwritten by the options provided by the individual stages in the next # section. # Stage options which Rubra will recognise are: # - distribute...
class Diamond: START_LETTER = 'A' ENTER = '\n' SPACE = ' ' BLANK = '' def __init__(self, upTo): self.upTo = upTo def show(self): top = self.BLANK bottom = self.BLANK for c in range(ord(self.START_LETTER), ord(self.upTo)+1): line = self....
class ContentElement(DependencyObject,IInputElement,IAnimatable): """ Provides a WPF core-level base class for content elements. Content elements are designed for flow-style presentation,using an intuitive markup-oriented layout model and a deliberately simple object model. ContentElement() """ def AddHa...
# https://docs.google.com/document/d/1Ljm9S29J-mFOZ3fwrkGohMDrn9fORVteWjzucuZfyaM/edit?usp=sharing # Huu Hung Nguyen # 12/12/2021 # Nguyen_HuuHung_accounts.py # The program stores the Account class, the SavingAccount class, and # the CreditCardAccount class. class Account: ''' Account class for representing and ...
path = "data/DataPoints.txt" lines_path = "data/lines.txt" index_and_slope_delim = ';' slope_and_intercept_delim = ":" delim = ","
routers = dict( BASE = dict( default_application = "webremote", default_controller = "webremote", default_function = "index", ) )
# # PySNMP MIB module BIANCA-BRICK-TOKEN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BIANCA-BRICK-TOKEN-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:21:46 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' def evalFile(f1, f2): op = open(f1) plain = op.read() op.close() op = open(f2) imperfect = op.read() op.close() list1 = [] list2 = [] for letter in plain: if letter.upper() in LETTERS: if letter.upper() not in list1: ...
''' You work for an airline, and your manager has asked you to do a competitive analysis and see how often passengers flying on other airlines are involuntarily bumped from their flights. You got a CSV file (airline_bumping.csv) from the Department of Transportation containing data on passengers that were involuntarily...
# LIFO Stack DS using Python Lists (Arrays) class StacksArray: def __init__(self): self.stackArray = [] def __len__(self): return len(self.stackArray) def isempty(self): return len(self.stackArray) == 0 def display(self): print(self.stackArray) def top(self):...
HISTOGRAM_CHARS = ['▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'] HISTOGRAM_WIDTH = 6 def get_time_distribution(durations): if not durations: return '' _max, _min = max(durations), min(durations) n = HISTOGRAM_WIDTH step = (_max - _min) / float(n) r = [0] * (n + 1) for i in range(n + 1): ...
class ClassDictionary: def __init__(self, value): self.dict_value = value def __getattribute__(self, name): if name == "dict_value": return super().__getattribute__(name) result = self.dict_value.get(name) return result def __setattr__(self, name, value): ...
# String Rotation: Assume you have a method isSubstringwhich checks if one word is a substring # of another. Given two strings, sl and s2, write code to check if s2 is a rotation of sl using only one # call to isSubstring (e.g., "waterbottle" is a rotation of "erbottlewat") def is_substring(s1, s2): return s2 in s...
''' @description 2019/09/16 21:56 ''' persons = [ {"username": "zhangsan", "age": 20}, {"username": "lisi", "age": 18}, {"username": "zhaoliu", "age": 21}, {"username": "wangwu", "age": 20} ] def cmp(x): return x.get('age') # 根据年龄进行排序 ''' [ {'username': 'zhaoliu', 'age': 21}, {'username'...
#Exericio04 #Faça um Programa que peça um número e então mostre a mensagem "O número informado foi: [número] """ while True: numero = int(input("Digite um numero: ")) print("O numero digitado foi:",numero, "\n") """ #Exercicio05 """ while True: word1 = input("Digita uma palavra com é:\n") print(word1.repla...
""" I, Andy Le, student number 000805099, certify that all code submitted is my own work; that i have not copied it from any other source. I also certify that I have not allowed my work to be copied by others. """ def score(earnedPercent, overallWeight): if (earnedPercent == -1): return -1 else...
"""Given an array nums. We define a running sum of an array as runningSum[i] = sum(nums[0]…nums[i]). Return the running sum of nums. Example 1: Input: nums = [1,2,3,4] Output: [1,3,6,10] Explanation: Running sum is obtained as follows: [1, 1+2, 1+2+3, 1+2+3+4]. Example 2: Input: nums = [1,1,1,1,1] Output: [1,2,3,4,5]...
# Name: 785 A. Anton and Polyhedrons # URL: https://codeforces.com/problemset/problem/785/A # Language: Python 3.x def main(): # Variable fuer Summe der Flächen sum_faces = 0 # Einlesen des Inputs als Integer n = int(input()) # Erstellung eines Dictionaries mit Keys als String und Values as Integ...
__author__ = 'fabian' __all__ = ['handler']
class AccountNotFoundError(Exception): pass class TransactionError(Exception): pass class AccountClosedError(TransactionError): pass class InsufficientFundsError(TransactionError): pass
text = input().split() times_seen = {} for word in text: if word not in times_seen: times_seen[word] = 0 print(times_seen[word], end=' ') times_seen[word] += 1
# 수리공 항승 n, l = map(int, input().split()) hole = list(map(int, input().split())) hole_list = sorted(hole, reverse=True) temp = hole_list[0] for i in range(1, len(hole_list)): if l > temp - hole_list[i]: n -= 1 else: temp = hole_list[i] print(n)
def LeftView(root): ''' :param root: root of given tree. :return: print the left view of tree, dont print new line ''' # code here res = [] while root: res.append(root.data) if root.left: root = root.left elif root.right: root = root.right ...
#Verifica se possui SANTO no começo do nome da cidade cidade = input("Qual a cidade que você mora: ") cidadelista = cidade.split() print("Santo" in cidadelista[0])
# # PySNMP MIB module APPIAN-PPORT-SONET-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/APPIAN-PPORT-SONET-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:23:54 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
cont = 0 pares = 0 for c in range(1, 7): num = int(input('Digite um número: ')) if num % 2 == 0: pares += num cont += 1 print(f'Você informou {cont} números PARES e a soma foi {pares}')
class Solution: def longestConsecutive(self, nums): nums_set = set(nums) longest_seq = 0 for num in nums_set: # Don't need to check if there is a - 1 smaller in the list. if num - 1 not in nums_set: current_num = num current_seq = 1 ...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
def test(): # Here we can either check objects created in the solution code, or the # string value of the solution, available as __solution__. A helper for # printing formatted messages is available as __msg__. See the testTemplate # in the meta.json for details. # If an assertion fails, the message...
# Section 5.16 Self Check snippets # Exercise 4 t = [[10, 7, 3], [20, 4, 17]] total = 0 items = 0 for row in t: for item in row: total += item items += 1 total / items total = 0 items = 0 for row in t: total += sum(row) items += len(row) total / items #######################...
# Nícolas Ramos # desenvolvido para ser igual ao pedido no desafio print('====== DESAFIO 1 ======') primeiro = int(input('Primeiro número ')) segundo = int(input('Segundo número ')) print(f'A soma é {primeiro + segundo}')
""" Test getting repo functions. """ # pylint: disable=invalid-sequence-index def test_get_repos(ghh): """ Default get repos. """ ghh.get_requested_object("ckear1989") ghh.requested_object.get_repos() assert "github" in [repo.name for repo in ghh.requested_object.repos] def test_ignore(ghh):...
''' Created on 2018年4月15日 @author: bomber ''' class Field(object): def __init__(self, name, column_type, primary_key, default): self.name = name self.column_type = column_type self.primary_key = primary_key self.default = default def __str__(self): ...
def minion_game(string): # your code goes here Kevin = 0 Stuart = 0 word = list(string) x = len(word) vowels = ['A','E','I','O','U'] for inx, w in enumerate(word): if w in vowels: Kevin = Kevin + x else: Stuart = Stuart + x x = x - 1 ...
class UndergroundSystem: def __init__(self): self.enterstation = {} self.leavestation = {} def checkIn(self, id: int, stationName: str, t: int) -> None: if stationName not in self.enterstation: self.enterstation[stationName] = [[id, t]] else: self.enters...
#! /usr/bin/python3 -i # coding=utf-8 tradify={ "𫍟":"𧦧", "𰾵":"𨬟", "𫮃":"墠", "𪪼":"彃", "𢭏":"擣", "𥐟":"礒", "𬘝":"紾", "𫄨":"絺", "𮉪":"緅", "𰬸":"繐", "𫄸":"纁", "𮉡":"纑", "𫄥":"纚", "𦰏":"蓧", "𫉁":"薆", "𧦧":"訑", "𫍥":"誂", "𬤊":"諟", "𬤣":"譈", "𫐄":"軏", "𫐐":"輗", "𬨎":"輶", "𫓧"...
no_exists = '{}_does_not_exists' already_exists = '{}_already_exists' exception_occurred = 'exception_occurred' no_modification_made = 'mo_modification_made' no_required_args = 'no_required_args' add_success = 'add_{}_success' delete_success = 'delete_{}_success' __all__ = ['no_exists', 'exception_occurred', 'no_modi...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' ***************************************** Author: zhlinh Email: zhlinhng@gmail.com Version: 0.0.1 Created Time: 2016-03-21 Last_modify: 2016-03-21 ****************************************** ''' ''' Compare two version numbers version1 and v...
class RetrievalMethod(): def __init__(self,db): self.db = db def get_sentences_for_claim(self,claim_text,include_text=False): pass
''' WRITTEN BY Ramon Rossi PURPOSE Consider the Fionacci sequence. It is a sequence of natural numbers defined recursively as follows: * the first element is 0 * the second is 1 * each next element is the sum of the previous two elements This function will sum all even elements of the Fibona...
def caesarCipherEncryptor(string, key): # To solve this problem, we need first to break the string into a list of chars, and then apply a function # basically transform each letter the key shifted, and then join them together. Obviously creating the list will take O(n) time and space # the function can be impleme...
f = open("test_data.txt", "r") fout = open("test_data_commas.txt", "w") for line in f: fout.write(line.replace(" ", ",")) f.close() fout.close()
class Menu: def __init__(self, Requests, log, presences): self.Requests = Requests self.log = log self.presences = presences def get_party_json(self, GamePlayersPuuid, presencesDICT): party_json = {} for presence in presencesDICT: if presence["puuid"] in...
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "/home/suntao/workspace/gorobots/utils/real_robots/stbot/catkin_ws/src/lilistbot/msg/Jy901imu.msg" services_str = "" pkg_name = "lilistbot" dependencies_str = "std_msgs" langs = "gencpp;geneus;genlisp;gennodejs;genpy" dep_include_paths_str = "lilistbot...
pirate_ship_status = [int(i) for i in input().split('>')] warship_status = [int(i) for i in input().split('>')] health_capacity = int(input()) while True: command_nosplit = input() if command_nosplit == "Retire": break command = command_nosplit.split() if "Fire" in command: index = int(...
#Crie uma tupla preenchuda com os 20 primeiros colocados da tabela do Campeonato Brasileiro de Futebol, na ordem de colocação. # Depois mostre: # A) Apenas os 5 primeiros colocados # B) os 4 últimos colocados da tabela. # C) Uma lista com os times em ordem alfabética. # D) Em que posição na tabela está o time da chapec...
class Solution(object): def findDisappearedNumbers(self, nums): return list(set(range(1,len(nums)+1)) - set(nums)) nums = [4, 6, 2, 6, 7, 2, 1] def test(): assert Solution().findDisappearedNumbers(nums) == [3, 5]
# Copyright (c) OpenMMLab. All rights reserved. _base_ = './i_base.py' item_cfg = {'b': 2} item6 = {'cfg': item_cfg}
# listでとってきてsortとして小さい順から二つ足していく list = list(map(int, input().split())) list.sort() print(list[0]+list[1])
# type: ignore __all__ = [ "datatipinfo", "deprpt", "dbstep", "arrayviewfunc", "openvar", "workspace", "commandwindow", "runreport", "fixcontents", "projdumpmat", "urldecode", "renameStructField", "dbcont", "checkcode", "publish", "urlencode", "uiimpo...
#!/usr/bin/env python ######################################################################## # Copyright 2012 Mandiant # Copyright 2014 FireEye # # Mandiant licenses this file to you under the Apache License, Version # 2.0 (the "License"); you may not use this file except in compliance with the # License. You may obt...
def loop(subject: int, loop_size: int) -> int: value = 1 for i in range(loop_size): value *= subject value = value % 20201227 return value def find_loopsize(public_key: int) -> int: value = 1 subject = 7 for i in range(100_000_000): value *= subject value = valu...
soma = 0 while True: n = int(input('Digite um número: ')) if n == 999: break soma += n #print('A soma entre os números digitados é igual a {}'.format(soma)) print(f'A soma vale {soma}') nome = 'José' idade = 33 salário = 987.3 ok = 'ok' print(f'O {nome:->20} tem {idade:-^20} anos e ganha R${salário:...
def findDecision(obj): #obj[0]: Passanger, obj[1]: Weather, obj[2]: Temperature, obj[3]: Time, obj[4]: Coupon, obj[5]: Coupon_validity, obj[6]: Gender, obj[7]: Age, obj[8]: Maritalstatus, obj[9]: Children, obj[10]: Education, obj[11]: Occupation, obj[12]: Income, obj[13]: Bar, obj[14]: Coffeehouse, obj[15]: Restaurantl...
"""while loops, also known as indefinite loops""" # n = 5 # while n > 0: # print(n) # n = n - 1 # print('Blastoff') # print(n) # breaking out of loops # while True: # line = input('> ') # if line == 'done': # break #ends loop and jumps to the end of the code # print(line) # print('Done!') # whi...
class Solution: def minDistance(self, word1: str, word2: str) -> int: m,n=len(word1),len(word2) dp=[[0 for _ in range(0,n+1)] for _ in range(0,m+1)] for _ in range(0,m+1):dp[_][0]=_ for _ in range(0,n+1):dp[0][_]=_ for i in range(1,m+1): ...
# -*- coding: utf-8 -*- """ TradingStrategy __author__ = ‘Administrator‘ __mtime__ = 2016/12/19 """
""" 1. Keyword param """ def foo(a = 100, b = 10): print(a) print(b) foo(b=200, a=1000) foo(1, b=15) # Problem # SyntaxError: positional argument # follows keyword argument # foo(b=30, 1) """ 1. key word argument needs to place after position argument 2. 根据我查资料总结结果,很多 python 内置的函数都不支持 keyword 参数...
#!/usr/bin/env python # Code Listing #5 """ Borg - Pattern which allows class instances to share state without the strict requirement of Singletons """ class Borg: """ I ain't a Singleton """ # クラス変数として dict を持つ __shared_state = {} def __init__(self): self.__dict__ = self.__shared_state #...
a = 999 b = 999 palindromes = [] for n in range(1,1000): for m in range(1,1000): num = m*n if str(num) == str(num)[::-1]: palindromes.append(num) print(max(palindromes))
def fileNaming(names): outnames = [] for name in names: if name in outnames: k = 1 while "{}({})".format(name, k) in outnames: k += 1 name = "{}({})".format(name, k) outnames.append(name) return outnames
print("Hello World") print("Hello Again") print("I Like typing this") print("This is fun.") print("Yay! Printing.") print("I'd much rather you 'not'.") print('I"said" do not touch this.') print("how to fix github")
#!/usr/env/bin python # https://www.hackerrank.com/challenges/array-left-rotation # Python 2 # first_input = '5 4' # second_input = '1 2 3 4 5' first_input = raw_input() second_input = raw_input() n, d = map(lambda x: int(x), first_input.split(' ')) items = second_input.split(' ') for i in xrange(d): item = item...
""" Remember that joint probability can generally be expressed as 𝑃(𝑎,𝑏)=𝑃(𝑎|𝑏)𝑃(𝑏) 𝑃(ℎ+,𝑣+)=𝑃(ℎ+|𝑣+)𝑃(𝑣+)=0.1∗0.3=0.03 """
# Reading lines from file and putting in a content string for line in open('rosalind_iev.txt', 'r').readlines(): contents = line.rsplit() AA_AA = float(contents[0]) AA_Aa = float(contents[1]) AA_aa = float(contents[2]) Aa_Aa = float(contents[3]) Aa_aa = float(contents[4]) aa_aa = float(contents[5]) def iev_p...
#usando strip para eliminar espaços vazios nas bordas de uma string. Equivalente ao trim() arquivo = open('pessoas.csv') for linha in arquivo: print('Nome: {}, Idade: {}'.format(*linha.strip().split(','))) #Usando * irá extrair os elementos de uma coleção de dados (lista, tuplas dicionários, sets, etc) arquivo....
#------------------------------------------------------------------------------ # Custom whitespace stripping -- Append to bottom of ~/.jupyter/jupyter_notebook_config.py # Found here: https://github.com/jupyter/notebook/issues/1455#issuecomment-519891159 #--------------------------------------------------------------...
""" --- Day 2: 1202 Program Alarm --- -- Part One -- An Intcode program is a list of integers separated by commas (like 1,0,0,3,99). To run one, start by looking at the first integer (called position 0). Here, you will find an opcode - either 1, 2, or 99. The opcode indicates what to do; for example, 99 means that th...