content
stringlengths
7
1.05M
''' function : default value ''' def my_func(a=20, b=10): return a - b print(my_func()) print(my_func(30)) print(my_func(40, 5)) def my_func2(a, b=10): return a + b # default parameter value가 non-default paramter 보다 먼저 올 수 없다. # def my_func3(a=20, b): # return a + b ''' function : tuple paramete...
"""This module contains rules for the startup c library.""" load("//lib/bazel:c_rules.bzl", "makani_c_library") def _get_linkopts(ld_files): return (["-Tavionics/firmware/startup/" + f for f in ld_files]) def startup_c_library(name, deps = [], ld_files = [], linkopts = [], **kwargs): makani_c_library( ...
DATA = [ {"gender":"male","name":{"title":"mr","first":"brian","last":"watts"},"location":{"street":"8966 preston rd","city":"des moines","state":"virginia","postcode":15835},"dob":"1977-03-11 11:43:34","id":{"name":"SSN","value":"003-73-8821"},"picture":{"large":"https://randomuser.me/api/portraits/men/68.jpg","medium...
def init() -> None: pass def run(raw_data: list) -> list: return [{"result": "Hello World"}]
def can_build(env, platform): return platform=="android" def configure(env): if (env['platform'] == 'android'): env.android_add_java_dir("android") env.android_add_res_dir("res") env.android_add_asset_dir("assets") env.android_add_dependency("implementation files('../../../modules/oppo/android/libs/...
# -*- coding: utf-8 -*- def main(): r, c, d = map(int, input().split()) a = [list(map(int, input().split())) for _ in range(r)] ans = 0 # See: # https://www.slideshare.net/chokudai/arc023 for y in range(r): for x in range(c): if (x + y <= d) and ((x + y) % 2 ==...
""" LECTURE D'UN FICHIER TEXTE """ """ QUESTION 1 """ with open("texte1", "r+") as f: print(f.read(11), end="\n\n") """ QUESTION 2 """ with open("texte1", "r+") as f: print(f.readline(), end="\n\n") f.readline() print(f.readline(), end="\n\n") """ QUESTION 3 """ with open("texte1", "r+") ...
#https://leetcode.com/problems/largest-rectangle-in-histogram/ #(Asked in Amazon SDE1 interview) class Solution: def largestRectangleArea(self, heights: List[int]) -> int: sta,finalL=[],[] it=0 for i in heights: #code for next smallest left it+=1 if st...
""" A simple program to calculate a chaotic function. This program will calculate the first ten values of a chaotic function with the form k(x)(1-x) where k=3.9 and x is provided by the user. """ def main(): """ Calculate the values of the chaotic function. """ x = float(input("Enter a number between ...
class AppSettings: types = { 'url': str, 'requestIntegration': bool, 'authURL': str, 'usernameField': str, 'passwordField': str, 'buttonField': str, 'extraFieldSelector': str, 'extraFieldValue': str, 'optionalField1': str, 'optionalFie...
class WikiPage: def __init__(self, title, uri=None, text=None, tags=None): self.title = title self.text = text or "" self.tags = tags or {} self.uri = uri or title self.parents = [] self.children = [] def add_child(self, page): self.children...
numbers = [12, 18, 128, 48, 2348, 21, 18, 3, 2, 42, 96, 11, 42, 12, 18] print(numbers) # Insert the number 5 to the beginning of the list. numbers.insert(0, 5) print(numbers) # Remove the number 2348 based on its value (as opposed to a hard-coded index of 4) from the list. numbers.remove(2348) print(numbers) # Creat...
class pbox_description: def __init__(self, pdb_id): self.pdb_id = pdb_id def get_pdb_id(self): return self.pdb_id
# -*- coding: utf-8 -*- # @Author: 何睿 # @Create Date: 2019-02-02 23:27:58 # @Last Modified by: 何睿 # @Last Modified time: 2019-02-02 23:29:33 class Solution: def addDigits(self, num): """ :type num: int :rtype: int """ if num == 0: return 0 b = n...
# Getting an input from the user x = int(input("How tall do you want your pyramid to be? ")) while x < 0 or x > 23: x = int(input("Provide a number greater than 0 and smaller than 23: ")) for i in range(x): z = i+1 # counts the number of blocks in the pyramid in each iteration y = x-i # counts the num...
class Solution: def reverseOnlyLetters(self, s: str) -> str: i = 0 j = len(s)-1 m = list(range(65, 91))+list(range(97, 123)) while i < j: if ord(s[i]) not in m: i += 1 continue if ord(s[j]) not in m: j -= 1 ...
'''Returns unmodifiable sets of "uninteresting" (e.g., not drug like) ligands. References ---------- - `D3R Project <https://github.com/drugdata/D3R/blob/master/d3r/filter/filtering_sets.py`_ ''' METAL_CONTAINING = set(['CP', 'NFU', 'NFR', 'NFE', 'NFV', 'FSO', 'WCC', 'TCN', 'FS2', 'PDV', 'CPT...
#!/usr/bin/env python # Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC # (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. # Government retains certain rights in this software. class ResultsWriters: def __init__(self): "" self.writers = [] def...
# -*- coding: utf-8 -*- """ Created on Tue Oct 30 00:36:25 2018 @author: Ja4rsPC """ x = int(input('Please input integer 1:' )) y = int(input('Please input integer 2: ')) def maxVAlue(m,n): if m>n or m==n: return m else: return n print(maxVAlue(x,y), ' Is greatest') #Scoping def f(x): ...
# Marcelo Campos de Medeiros # ADS UNIFIP 2020.1 # Patos-PB 17/03/2020 ''' Faça um Programa que calcule a área de um quadrado, em seguida mostre o dobro desta área para o usuário. ''' print('='*43) print('PROGRAMA DA ÁREA DO QUADRADO E SEU DOBRO') print('='*43,'\n') # variável valor do lado do quadrado print('='*43)...
n = int(input()) s = [] for i in range(n): s.append(input()) # [d1, d2, d3, ..., dN] m = [] a = [] r = [] c = [] h = [] for i in s: if i[0] == "M": m.append(i) elif i[0] == "A": a.append(i) elif i[0] == "R": r.append(i) elif i[0] == "C": c.append(i) elif i[0] == "...
""" Problem statement: We are given with N coins having value val_1 ... val_n , where n is even. We are playing a game with an opponent in alternating turns. In each particular turm one player selects one or last coin. We remove the coin from the row and get the value of the coin. Find the max possinle amoint of m...
# Section 9.3.2 snippets with open('accounts.txt', mode='r') as accounts: print(f'{"Account":<10}{"Name":<10}{"Balance":>10}') for record in accounts: account, name, balance = record.split() print(f'{account:<10}{name:<10}{balance:>10}') #############################################...
"""Core module of the project.""" def add(x: int, y: int) -> int: """Add two int numbers.""" return x + y
"""misc utils for training neural networks""" class HyperParameterScheduler(object): def __init__(self, initial_val, num_updates, final_val=None, func='linear', gamma=0.999): """ Initialize HyperParameter Scheduler class :param initial_val: initial value of the hyper-parameter :pa...
#Array of numbers numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] #Prints out every number in array for number in numbers: print(number) print('') #Adds 1 to every number in array for number in numbers: number += 20 print(number)
""" #teste >>> motor = Motor() >>> motor.velocidade 0 >>> motor.acelerar() >>> motor.velocidade 1 >>> motor.acelerar() >>> motor.velocidade 2 >>> motor.acelerar() >>> motor.velocidade 3 >>> motor.frear() >>> motor.velocidade 1 >>> motor.frear() >>> motor.velocidade 0 >>> direcao = Direcao() >>> direcao.valor 'Norte' >>...
# Wrong answer 10% name = input() YESnames = [] NOnames = [] first = "" biggestName = 0 habay = "" while name != "FIM": name, choice = name.split() if choice == "YES": if first == "": first = name l = len(name) if biggestName < l: biggestName = l if ...
# -*- coding: utf-8 -*- __author__ = 'Huang, Hua' class CSV: def __init__(self, csv_line, sep): self.csv_line = csv_line self.content_list = csv_line.split(sep) if csv_line and isinstance(csv_line, str) else None def get_property(self, ind): if self.content_list and len(self.content_l...
pi = { "00": { "value": "00", "description": "Base" }, "02": { "value": "02", "description": "POS" } }
class IntervalSchedulingInterval: """interval to schedule in interval scheduling""" def __init__(self, name: str, start_time: int, end_time: int): self.name = name self.start_time = start_time self.end_time = end_time def __repr__(self) -> str: return f"{self.name}({self.st...
#decorators for functions def audio_record_thread(func): def inner(s): print("AudioCapture: Started Recording Audio") func(s) print("AudioCapture: Stopped Recording Audio") return return inner def file_saving(func, filename): def wrap(s, filename): print("Saving...
# -*- coding: utf-8 -*- """ ----------Phenix Labs---------- Created on Sat Jan 23 23:47:00 2021 @author: Gyan Krishna Topic: """ n = 6 #pattern 1 for i in range(n): for j in range(n-i): print("", end=" ") for j in range(i): print("*", end=" ") print("") print("\n\n") #pattern 2 curr = ...
# In case of ASCII horror, # need to get rid of this in the future. def ascii_saver(s): try: s = s.encode('ascii', errors='ignore') except: print('ascii cannot save', s) return s
''' Python program to round a fl oating-point number to specifi ednumber decimal places ''' #Sample Solution-1: def setListOfIntegerOptionOne (order_amt): print('\nThe total order amount comes to %f' % float(order_amt)) print('The total order amount comes to %.2f' % float(order_amt)) print() def setLis...
# -*- coding: utf-8 -*- """ Created on Thu Jan 16 11:07:19 2020 @author: 766810 """ x=int(input('Enter number 1: ')) y=int(input('Enter number 2: ')) sum1=0 sum2=0 for i in range(1,x): if x%i==0: sum1+=i for j in range(1,y): if y%j==0: sum2+=j if(sum1==y and sum2==x): pri...
class Solution(object): def lengthLongestPath(self, input): """ :type input: str :rtype: int """ maxLen = 0 curLen = 0 stack = [] dfa = {"init": 0, "char": 1, "escapeCMD": 2, "file": 3} state = 0 start = 0 level = 0 ...
class PermissionsMixin: @classmethod def get_permissions(cls, info): return [permission(info) for permission in cls._meta.permission_classes] @classmethod def check_permissions(cls, info): for permission in cls.get_permissions(info): if not permission.has_permission(): ...
## private settings SECRET_KEY = '' # UPDATE with random string ALLOWED_HOSTS = [ # local 'localhost', '127.0.0.1', # staging '35.232.16.182', ] INTERNAL_IPS = ['127.0.0.1'] ## for local and test servers TEST_ENV = True ## for prod server # TEST_ENV = False ## project info PROJECT_NAME = 'Sour...
""" Project version and meta informations. """ __version__ = "0.3.6dev2" __title__ = "msiempy" __description__ = "msiempy - McAfee SIEM API Python wrapper" __author__ = "andywalden, tristanlatr, mathieubeland, and other contributors. " __author_email__ = "" __license__ = "The MIT License" __url__ = "https://github.com...
def bs(arr,target,s,e): if (s>e): return -1 m= int((s+e)/2) if arr[m]==target: return m elif target>arr[m]: return bs(arr,target,m+1,e) else: return bs(arr,target,s,m-1) if __name__ == "__main__": l1=[1, 2, 3, 4, 55, 66, 78] target = 67 print(bs(l1,...
#!/usr/bin/env python # Copyright Contributors to the Open Shading Language project. # SPDX-License-Identifier: BSD-3-Clause # https://github.com/AcademySoftwareFoundation/OpenShadingLanguage command += testshade("-g 16 16 -od uint8 -o Cout out0.tif wrcloud") command += testshade("-g 16 16 -od uint8 -o Cout out0_tr...
PARAM_DESCR = { 'epochs': 'How many epochs to train.', 'learning rate': 'Optimizer learning rate.', 'batch size': 'The number of samples to use in one training batch.', 'decay': 'Learning rate decay.', 'early stopping': 'Early stopping delta and patience.', 'dropout': 'Dropout rate.', 'layer...
"""Problem 2 - Paying Debt Off in a Year Now write a program that calculates the minimum fixed monthly payment needed in order 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 mon...
""" 9.3 – Usuários: Crie uma classe chamada User. Crie dois atributos de nomes first_name e last_name e, então, crie vários outros atributos normalmente armazenados em um perfil de usuário. Escreva um método de nome describe_user() que apresente um resumo das informações do usuário. Escreva outro método chamado greet_u...
def username_generator(first,last): counter = 0 username = "" for i in first: if counter <= 2: counter += 1 username += i counter = 0 for j in last: if counter <= 3: counter += 1 username += j return username def password_generator(username="testin"): password = "" count...
# -*- coding: utf-8 -*- class Controller(object): def __init__(self, router, view): self.router = router self.view = view def show(self): if self.view: self.view.show() else: raise Exception("None view") def hide(self): if self.view: ...
def geometric_eq(p,k): return (1-p)**k*p class GeometricDist: def __init__(self,p): self.p = p self.mean = (1-p)/p self.var = (1-p)/p**2 def __getitem__(self,k): return geometric_eq(self.p,k)
class letterCombinations: def letterCombinationsFn(self, digits: str) -> List[str]: # If the input is empty, immediately return an empty answer array if len(digits) == 0: return [] # Map all the digits to their corresponding letters letters = {"2": "abc", "3": "...
class Solution: def uniquePaths(self, m: int, n: int) -> int: dp = [[0]*n for i in range(m)] for i in range(m): dp[i][n-1] = 1 for i in range(n): dp[m-1][i] = 1 for i in range(m-2,-1,-1): for j in range(n-2,-1,-1): ...
n,m = list(map(int,input().split(' '))) coins = list(map(int,input().split(' '))) dp =[ [-1 for x in range(m+1)] for y in range(n+1) ] def getCount(amount,index): if amount == 0: return 1 if index == 1: coin = coins[0] if amount%coin == 0: return 1 else: r...
class TableNotFound: def title(self): return "Table Not Found" def description(self): return "You are trying to make a query on a table that cannot be found. Check that :table migration exists and that migrations have been ran with 'python craft migrate' command." def regex(self): ...
# Copyright (C) 2014-2015 LiuLang <gsushzhsosgsu@gmail.com> # Use of this source code is governed by GPLv3 license that can be found # in http://www.gnu.org/licenses/gpl-3.0.html ''' 网盘错误代码对应的提示信息 ''' o = { 0: '成功', -1: '用户名和密码验证失败', -2: '备用', -3: '用户未激活(调用init接口)', -4: 'COOKIE中未找到host_key&user_k...
c.NotebookApp.ip = '*' c.NotebookApp.token = '' c.NotebookApp.password = '' c.NotebookApp.open_browser = False c.NotebookApp.port = 8081 c.NotebookApp.allow_remote_access = True c.NotebookApp.allow_origin_pat = '(^https://8081-dot-[0-9]+-dot-devshell\.appspot\.com$)|(^https://colab\.research\.google\.com$)'
prova1 = float ( input()) prova2 = float ( input ()) prova3 = float (input ()) media = (((prova1 * 2.0) + (prova2 * 3.0) + (prova3 * 5.0)) / 10 ) print("MEDIA = %0.1F" % media )
""" Faça um Programa para uma loja de tintas. O programa deverá pedir o tamanho em metros quadrados da área a ser pintada. Considere que a cobertura da tinta é de 1 litro para cada 6 metros quadrados e que a tinta é vendida em latas de 18 litros, que custam R$ 80,00 ou em galões de 3,6 litros, que custam R$ 25,00. Info...
# https://www.codechef.com/problems/DEVUGRAP for T in range(int(input())): N,K=map(int,input().split()) n,ans=list(map(int,input().split())),0 for i in range(N): if(n[i]>=K): ans+=min(n[i]%K,K-n[i]%K) else: ans+=K-n[i]%K print(ans)
class Pattern(object): """ [summary] """ @staticmethod def default() -> str: """[summary] Returns: pattern (str): [{level}][{datetime}] - {transaction} - {project_name}.{class_name}.{function_name} - _message: traceback """ _message = "{message}" ...
_first_index_in_every_row_list = list() def _build_first_index_in_every_row_list(): global _first_index_in_every_row_list _first_index_in_every_row_list.clear() _first_index_in_every_row_list.append(0) for delta in range(199, 1, -1): _first_index_in_every_row_list.append(_first_index_in_every_...
# Function for finding if it possible # to obtain sorted array or not def fun(arr, n, k): v = [] # Iterate over all elements until K for i in range(k): # Store elements as multiples of K for j in range(i, n, k): v.append(arr[j]); # Sort the elements ...
# _*_ coding: utf-8 _*_ # 整数 age = 100_000 print('age:', age) # 浮点数 salary = 1000.02 print('salary:', salary) salary = 1.00002e3 print('salary:', salary) # 字符串 print("It's OK") print('It\'s OK') # 通过r表名引号中的所有字段都直接输出 print(r'It\\\'s OK') # 通过三个引号,可以输入多行字符串 print('''line1 line2 line3 ''') # 布尔值 is_good = True is_happy...
# -*- coding: utf-8 -*- """ Created on Tue Feb 19 20:59:13 2019 @author: sudar """ class url_feeder(object): def __init__(self, section): """initialize the feeder""" self.section = section def feeder(self): """We going to get the URL through each section over-view ...
# day_3/classes.py """ Classes are a way to encapsulate code. It is a way of keeping functions and data that represent something together and is a core concept to understand for object oreinted programing. """ class Person: def __init__(self, name: str, age: int) -> None: """ Initializes the pers...
#coding = 'utf-8' # 打开文件,读取文件生成一维数组 with open('report.txt') as f: lines = f.readlines() # lines # 生成包含各科成绩的二维数组 scores = [] for line in lines: data = line.split() scores.append(data) # scores # 计算每位学生的总分和平均分 scores[0].extend(['总分','平均分']) stu_avg = 0 for grade in scores[1:]: stu_sum = 0 for s in...
class Pessoa: menbros_superiores = 2 menbro_inferiores=2 def __init__(self,*familia,name=None,idade=17): self.name= name self.familia= list(familia) self.idade= idade def comprimentar(self): return 'hello my code' def despedisir(self): return 'diz tcha...
print('{:=^40}'.format(' LOJAO DO PYTHON ')) n = float(input('Preço das compras: R$')) print('''FORMAS DE PAGAMENTO 1. Á vista dinheiro/cheque 2. Á vista cartão 3. 2x no cartão 4. 3x ou mais no cartão''') m = int(input('Qual é a modo de pagamento? ')) if m ==1: total = n - (n * 10 / 100) elif m == 2: total =...
# Given a non-negative number represented as an array of digits, # plus one to the number. # The digits are stored such that the most significant # digit is at the head of the list. def plusOne(digits): """ :type digits: List[int] :rtype: List[int] """ digits[-1] = digits[-1] + 1 res = [] ...
# coding: utf-8 def is_bool(var): return isinstance(var, bool) if __name__ == '__main__': a = False b = 0 print(is_bool(a)) print(is_bool(b))
class GameStats(): """跟踪游戏的统计信息""" def __init__(self,ai_settings): """初始化统计信息""" self.ai_settings=ai_settings self.reset_states() #游戏刚启动时处于活动状态 self.game_active=False #在任何情况下都不应该重置最高分得分 self.high_score=0 def reset_states(self): """初始化在游戏运行期间可能变化的统计信息""" self.ships_left = self.ai_settings.sh...
alpha = { 'en-US': '^[A-Z]+$', 'az-AZ': '^[A-VXYZÇƏĞİıÖŞÜ]+$', 'bg-BG': '^[А-Я]+$', 'cs-CZ': '^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$', 'da-DK': '^[A-ZÆØÅ]+$', 'de-DE': '^[A-ZÄÖÜß]+$', 'el-GR': '^[Α-ώ]+$', 'es-ES': '^[A-ZÁÉÍÑÓÚÜ]+$', 'fa-IR': '^[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی]+$', 'fi-FI': '^[...
""" 面试题 32(二):分行从上到下打印二叉树 题目:从上到下按层打印二叉树,同一层的结点按从左到右的顺序打印,每一层 打印到一行。 """ class BinaryTreeNode: def __init__(self, val): self.val = val self.left = None self.right = None def connect_binarytree_nodes(parent: BinaryTreeNode, left: BinaryTreeNode, ...
class Conta: def __init__(self, numero, nome, saldo=0): self._numero = numero self._nome = nome self._saldo = saldo def atualiza(self, taxa): self._saldo += self._saldo * taxa def deposita(self, valor): self._saldo += valor - 0.10 class ContaCorrente(Conta): ...
# -*- coding: utf-8 -*- # Coded by Sungwook Kim # 2020-12-13 # IDE: Jupyter Notebook def Fact(a): res = 1 for i in range(a): res = res * (i + 1) return res T = int(input()) for i in range(T): r, n = map(int, input().split()) a = Fact(n) b = Fact(r) c = Fact(n-r) print(...
# The base class for application-specific states. class SarifState(object): def __init__(self): self.parser = None self.ppass = 1 # Taking the easy way out. # We need something in case a descendent wants to trigger # on change to ppass. def set_ppass(self, ppass): self.ppas...
# store the input from the user into age age = input("How old are you? ") # store the input from the user into height height = input(f"You're {age}? Nice. How tall are you? ") # store the input from the user into weight weight = input("How much do you weigh? ") # print the f-string with the age, height and weight prin...
def loss_layer(self, predicts, labels, scope='loss_layer'): with tf.variable_scope(scope): predict_classes = tf.reshape(predicts[:, :self.boundary1], [self.batch_size, self.cell_size, self.cell_size, self.num_class]) predict_scales = tf.reshape(predicts[:, self.b...
# -*-- coding: utf-8 -* def discretize(self, Npoint=-1): """Returns the discretize version of the SurfRing Parameters ---------- self: SurfRing A SurfRing object Npoint : int Number of point on each line (Default value = -1 => use the line default discretization) Returns --...
# AKSHITH K # BUBBLE SORT IMPLEMENTED IN PYTHON RECURSIVELY. def bubblesort(arr, n): # checking if the array does not need to be sorted and has a length of 1. if n <= 1: return # creating a for-loop to iterate for the elements in the array. for i in range(0, n - 1): # c...
__author__ = 'Claudio' """Demonstrate how to use Python’s list comprehension syntax to produce the list [0, 2, 6, 12, 20, 30, 42, 56, 72, 90]. """ def demonstration_list_comprehension(): return [idx*x for idx, x in enumerate(range(1,11))]
## Problem 10.2 # write a program to read through the mbox-short.txt # and figure out the distribution by hour of the day for each of the messages. file_name = input("Enter file:") file_handle = open(file_name) hour_list = list() for line in file_handle: # pull the hour out from the 'From ' line # From stephe...
#!/usr/bin/env python3 def f(*cs): ''' args : cotes, ou liste de cotes output : probabilités, fraction de marge ''' if len(cs)==1: cs=cs[0] ks=[1/c for c in cs] t=sum(ks) return [k/t for k in ks], 1-1/t def g(m1,m2,c2): return 100*(-m1+(1-m2)*(1-1/c2)) def h(m1,m2): # ...
#nome = input('digite seu nome: ') #if nome == 'artur': # print('que nome bonito {}'.format(nome)) #elif nome in 'carol andre carlos': # print('nome legal') #else: # print('nome coco') valor=int(input('qual o valor da casa? ')) salario=int(input('digite o valor do seu salario: ')) prazo=int(input('em quanto te...
# Copyright 2006 James Tauber and contributors # Copyright (C) 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net> # Copyright (C) 2010 Serge Tarkovski <serge.tarkovski@gmail.com> # Copyright (C) 2010 Rich Newpol (IE override) <rich.newpol@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # y...
# WAP to show the use of if..elif..else season= input("Enter season : ") print(season) if season == 'spring': print('plant the garden!') elif season == 'summer': print('water the garden!') elif season == 'fall': print('harvest the garden!') elif season == 'winter': print('stay indoors!') e...
# # PySNMP MIB module HH3C-L2TP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-L2TP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:14:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
kuukiondo = 70 shitsudo = 100 if kuukiondo >= 100: print("A") elif kuukiondo >= 92 and shitsudo > 75: print("B") elif kuukiondo > 88 and shitsudo >= 85: print("C") elif kuukiondo == 75 and shitsudo <= 65: print("D") else: print("E")
class Solution1: def maxSubArray(self, nums: List[int]) -> int: total_max, total = -1e10, 0 for i in range( len(nums) ): if total > 0: total += nums[i] else: total = nums[i] if total > total_max: t...
""" ID: tony_hu1 PROG: sort3 LANG: PYTHON3 """ def check_swap(current_num): global unsorted global sorted global num global steps global area for i in range(num): if sorted[i] > current_num: return if sorted[i] == current_num: if unsorted[i] == current_nu...
################################################################################ # # # ____ _ # # | _ \ ___ __| |_ __ _ _ _ __ ___ ...
class Base(object): def __secret(self): print("don't tell") def public(self): self.__secret() class Derived(Base): def __secret(self): print("never ever") if __name__ == "__main__": print("Base class members:", dir(Base)) print("Derived class members:", dir(Derived)) ...
# Basic script to find primer candidates # Hits are 20bp in length, with 50-55% GC content, GC clamps in the 3' end, and no more than 3xGC at the clamp # Paste the target exon sequences from a FASTA sequence with no white spaces # Exon 1 is where forward primer candidates will be identified exon1 = "GCAGTGTCACTAG...
# Objective # Today we're discussing scope. Check out the Tutorial tab for learning materials and an instructional video! # The absolute difference between two integers, # and , is written as . The maximum absolute difference between two integers in a set of positive integers, , is the largest absolute difference betw...
#another way of doing recursive palindrome def is_palindrome(s): ln = len(s) if s != '': if s[ln-1] == s[0]: return True and is_palindrome(s[1:ln-1]) return False return True assert is_palindrome('abab') == False assert is_palindrome('abba') == True assert is_palindrome('madam')...
lista_cadastro = [] def placa_v(): if len(lista_cadastro) > 0: print('tem placa ') else: print('não tem placa')
class Profile(object): @property def name(self): return self.__name @property def trustRoleArn(self): return self.__trustRoleArn @property def sourceProfile(self): return self.__sourceProfile @property def credentials(self): return self.__credentials ...
# f_name = 'ex1.txt' f_name = 'input.txt' all_ingredients = set() possible_allergens = dict() recipes = list() with open(f_name, 'r') as f: for i, line in enumerate(f.readlines()): # get a list of the ingredients and record the food recipe as a set of the # ingredients (recipes = [{'aaa', 'bbb'}, ...
S = 0 T = 0 L = [] for i in range(11): L.append(list(map(int,input().split()))) L.sort(key = lambda t:(t[0],t[1])) for i in L: T+=i[0] S += T + i[1]*20 print(S)
# Evaluacion de expresiones print(3+5) print(3+2*5) print((3+2)*5) print(2**3) print(4**0.5) print(10%3) print('abra' + 'cadabra') print('ja'*3) print(1+2) print(1.0+2.0) print(1.0+2) print(1/2) print(1//2) print(1.0//2.0) print('En el curso hay ' + str(30) + ' alumnos') print('100'+'1') print(int('100') +1) # Variabl...
# pytest -v --sudo --ssh-config=.ssh/config --ansible-inventory=inventory --hosts='ansible://appservers' tests/test_appserver.py # パッケージがインストールされている def test_installed_default_package(host): assert host.package('docker-ce').is_installed # 起動すべきサービスが起動している def test_running_default_service(host): assert host.se...
class GameStats(): """TRACK STATISTICS FOR FROM ANOTHER WORLD""" def __init__(self, ai_settings): """INITIALIZE STATISTICS""" self.ai_settings = ai_settings self.reset_stats() # START GAME IN AN INACTIVE STATE self.game_active = False def reset_stats(self): ...