content
stringlengths
7
1.05M
''' __init__.py ColorPy is a Python package to convert physical descriptions of light: spectra of light intensity vs. wavelength - into RGB colors that can be drawn on a computer screen. It provides a nice set of attractive plots that you can make of such spectra, and some other color related functions...
"""Module `true` Declares four functions: * `isTrue`: return True if b is equal to True, return False otherwise * `isFalse`: return True if b is equal to False, return False otherwise * `isNotTrue`: return True if b is not equal to True, return False otherwise * `isNotFalse`: return True if b is not equal to Fals...
# run python from an operating system command prmpt # type the following: msg = "Hello World" print(msg) # write it into a file called hello.py # open a command prompt and type "python hello.py" # this should run the script and print "Hello World" # vscode alternative; Run the following in a terminal # by selecting ...
# Backtracking # def totalNQueens(self, n: int) -> int: # diag1 = set() # diag2 = set() # used_cols = set() # # return self.helper(n, diag1, diag2, used_cols, 0) # # # def helper(self, n, diag1, diag2, used_cols, row): # if row == n: # return 1 # # solutions = 0 # # for col in range(...
######################### # EECS1015: Lab 9 # Name: Mahfuz Rahman # Student ID: 217847518 # Email: mafu@my.yorku.ca ######################### class MinMaxList: def __init__(self, initializeList): self.listData = initializeList self.listData.sort() def insertItem(self, item, printResult=False/...
''' 1560. Most Visited Sector in a Circular Track Given an integer n and an integer array rounds. We have a circular track which consists of n sectors labeled from 1 to n. A marathon will be held on this track, the marathon consists of m rounds. The ith round starts at sector rounds[i - 1] and ends at sector rounds[i...
# Based on : https://github.com/jhasegaw/phonecodes/blob/master/src/phonecode_tables.py arpabet2aline_dict = { 'AA':'ɑ', 'AE':'æ', 'AH':'ʌ', 'AH0':'ə', 'AO':'ɔ', 'AW':'aʊ', 'AY':'aɪ', 'EH':'ɛ', 'ER':'ɝ', 'EY':'eɪ', 'IH':'ɪ', 'IH0':'ɨ', 'IY':'i', 'OW':'oʊ', 'OY...
while True: X, Y = map(int, input().split()) if X == 0 or Y == 0: break else: if X > 0 and Y > 0: print('primeiro') elif X > 0 and Y < 0: print('quarto') elif X < 0 and Y < 0: print('terceiro') else: print('segundo')
# A Caesar cypher is a weak form on encryption: # It involves "rotating" each letter by a number (shift it through the alphabet) # # Example: # A rotated by 3 is D; Z rotated by 1 is A # In a SF movie the computer is called HAL, which is IBM rotated by -1 # # Our function rotate_word() uses: # ord (char to code_numbe...
r1 = float(input('Primeira reta: ')) r2 = float(input('Segunda reta: ')) r3 = float(input('Terceira reta: ')) if r1 < r2 + r3 and r2 < r1 + r3 and r3 < r1 + r2: print('Essas retas podem formar um triângulo') else: print('Essas retas não podem formar um triângulo')
expected_output = { "chassis_mac_address": "4ce1.7592.a700", "mac_wait_time": "Indefinite", "redun_port_type": "FIBRE", "chassis_index": { 1: { "role": "Active", "mac_address": "4ce1.7592.a700", "priority": 2, "hw_version": "V02", "curr...
def read_instance(f): print(f) file = open(f) width = int(file.readline()) n_circuits = int(file.readline()) DX = [] DY = [] for i in range(n_circuits): piece = file.readline() split_piece = piece.strip().split(" ") DX.append(int(split_piece[0])) DY.append(int...
n = 1024 while n > 0: print(n) n //= 2
#!/usr/bin/env python3 title: str = 'Lady' name: str = 'Gaga' # Lady Gaga is an American actress, singer and songwriter. # String concatination at its worst print(title + ' ' + name + ' is an American actress, singer and songwriter.') # Legacy example print('%s %s is an American actress, singer and songwriter.' % (...
""" Client Error HTTP Status Callables """ def HTTP404(environ, start_response): """ HTTP 404 Response """ start_response('404 NOT FOUND', [('Content-Type', 'text/plain')]) return [''] def HTTP405(environ, start_response): """ HTTP 405 Response """ start_response('405 METHOD NOT ...
class Solution: def mySqrt(self, x: int) -> int: if x == 0: return 0 ans: float = x tolerance = 0.00000001 while abs(ans - x/ans) > tolerance: ans = (ans + x/ans) / 2 return int(ans) tests = [ ( (4,), 2, ), ( (8,...
if traffic_light == 'green': pass # to implement else: stop()
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class TypeVmDirEntryEnum(object): """Implementation of the 'Type_VmDirEntry' enum. DirEntryType is the type of entry i.e. file/folder. Specifies the type of directory entry. 'kFile' indicates that current entry is of file type. 'kDirectory' i...
if window.get_active_title() == "Terminal": keyboard.send_keys("<super>+z") else: keyboard.send_keys("<ctrl>+z")
# Desafio 02 # Cri um script Python que leia o dia, o mês e o ano de nascimento # de uma pessoa e mostra uma mensagem com a data formatada. enunciado = input('=======Desafio 02 =======') print(enunciado) nome = input(' Digite seu nome: ') dia = input(' Dia = ') mes = input(' Mes = ') ano = input(' Ano = ') print(nome, ...
def naive_4() : it = 0 def get_w() : fan_in = 1 fan_out = 1 limit = np.sqrt(6 / (fan_in + fan_out)) return np.random.uniform(low =-limit , high = limit , size = (784 , 10)) w_init = get_w() b_init = np,zeros(shape(10,)) last_score = 0.0 learnin_rate = 0.1 while True : w = w_init + learning...
n = int(input()) for _ in range(n): recording = input() sounds = [] s = input() while s != "what does the fox say?": sounds.append(s.split(' ')[-1]) s = input() fox_says = "" for sound in recording.split(' '): if sound not in sounds: fox_says += " " + sou...
count = 0 while count != 5: count += 1 print(count) print('--------') counter = 0 while counter <= 20: counter = counter + 3 print(counter) print('--------') countersito = 20 while countersito >= 0: countersito -= 3 print(countersito)
def netmiko_command(device, command=None, ckwargs={}, **kwargs): if command: output = device['nc'].send_command(command, **ckwargs) else: output = 'No command to run.' return output
# ---------------------------------------------------------------------- # # Brad T. Aagaard, U.S. Geological Survey # # This code was developed as part of the Computational Infrastructure # for Geodynamics (http://geodynamics.org). # # Copyright (c) 2010-2017 University of California, Davis # # See COPYING for license...
n1 = float(input('Primeira nota do aluno:')) n2 = float(input('Segunda nota do aluno:')) print(f'A média entre {n1} e {n2} é {(n1 + n2)/2:.1f}')
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None root = TreeNode(8) root.left = TreeNode(9) root.left.left = TreeNode(5) root.left.right = TreeNode(7) root.right = TreeNode(9) root.right.left = TreeNode(7) root.right.right = TreeNode(5) class Solutio...
######## # PART 1 def read(filename): with open("event2021/day25/" + filename, "r") as file: rows = [line.strip() for line in file.readlines()] return [ch for row in rows for ch in row], len(rows[0]), len(rows) def draw(region_data): region, width, height = region_data for y in range(hei...
# This sample tests the "reportPrivateUsage" feature. class _TestClass(object): pass class TestClass(object): def __init__(self): self._priv1 = 1
# Copyright (c) 2014 OpenStack Foundation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
class Solution: def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]: ''' min_list = [] for i in range(len(nums)): count = 0 for j in range(len(nums)): if nums[j] < nums[i]: count = count + 1 min_list.append...
#calculadora 2.0v n = int(input('Informe a tabuada que vc quer: ')) for x in range(1,11): print(' {} x {:2} = {}'.format(n, x, n*x)) #(número da tabuada, laço 1-10, e a multiplicação)
# 立方 cube = [v**3 for v in range(1, 11)] print(cube)
# def parse_ranges(input_string): # # output = [] # ranges = [item.strip() for item in input_string.split(',')] # # for item in ranges: # start, end = [int(i) for i in item.split('-')] # output.extend(range(start, end + 1)) # # return output # def parse_ranges(input_string): # # ran...
""" The question is incorrect as it says you can only travserse an open path once but uses the same path repeatedly, violating its own rules """ def uniquePathsIII(grid: list[list[int]]) -> int: if not grid or not grid[0]: return 0 index = dict() for r in range(rows := len(grid)): for c in...
for row in range(4): for col in range(4): if col%3==0 and row<3 or row==3 and col>0: print('*', end = ' ') else: print(' ', end = ' ') print()
def power(integer1, integer2=3): result = 1 for i in range(integer2): result = result * integer1 return result print(power(3)) print(power(3,2))
#The values G,m1,m2,f and d stands for Gravitational constant, initial mass,final mass,force and distance respectively G = 6.67 * 10 ** -11 m1 = float(input("The value of the initial mass: ")) m2 = float(input("The value of the final mass: ")) d = float(input("The distance between the bodies: ")) F = (G * m1 * m2)/(d *...
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( arr , n ) : s = [ ] j = 0 ans = 0 for i in range ( n ) : while ( j < n and ( arr [ j ] not ...
var1 = 6 var2 = 3 if var1 >= 10: print("Bigger than 10") #mind about the indent here (can be created by pressing tab button) else: print("Smaller or equal to 10") # all the codes written under a section wth tab belongs to that section if var1 == var2: print("var1 and 2 are equal") else: print("not eq...
class KNN(): def fit(self, X_train, y_train): self.X_train = X_train self.y_train = y_train def predict(self, X_test, k=3): predictions = np.zeros(X_test.shape[0]) for i, point in enumerate(X_test): distances = self._get_distances(point...
__author__ = [ "Alexander Dunn <ardunn@lbl.gov>", "Alireza Faghaninia <alireza.faghaninia@gmail.com>", ] class BaseDataRetrieval: """ Abstract class to retrieve data from various material APIs while adhering to a quasi-standard format for querying. ## Implementing a new DataRetrieval class ...
# -*- coding: utf-8 -*- class Empty(object): """ Empty object represents emptyness state in `grappa`. """ def __repr__(self): return 'Empty' def __len__(self): return 0 # Object reference representing emptpyness empty = Empty()
__title__ = 'alpha-vantage-py' __description__ = 'Alpha Vantage Python package.' __url__ = 'https://github.com/wstolk/alpha-vantage' __version__ = '0.0.4' __build__ = 0x022501 __author__ = 'Wouter Stolk' __author_email__ = 'stolk.wouter@gmail.com' __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2021 Wouter Stolk'...
LANGUAGES = [ {"English": "English", "alpha2": "en"}, {"English": "Italian", "alpha2": "it"}, ]
def max_profit(prices) -> int: if not prices: return 0 minPrice = prices[0] maxPrice = 0 for i in range(1, len(prices)): minPrice = min(prices[i], minPrice) maxPrice = max(prices[i],maxPrice) return maxPrice arr = [100, 180, 260, 310, 40, 535, 695] print(max_profit(arr))
# Paula Daly Solution to Problem 4 March 2019 # Collatz - particular sequence always reaches 1 # Defining the function def collatz(number): # looping through and if number found is even divide it by 2 if number % 2 == 0: print(number // 2) return number // 2 # looping through and if the nu...
""" Reports: module definition """ PROPERTIES = { 'title': 'Reports', 'details': 'Create Reports', 'url': '/reports/', 'system': False, 'type': 'minor', } URL_PATTERNS = [ '^/reports/', ]
""" Datos de entrada Presupuesto-->p-->float Datos de Salida Presupuesto ginecologia-->g-->float Presupuesto traumatologiaa-->t-->float Presupuesto pediatria-->e-->float """ #entrada p=float(input("Digite el presupuesto Total: ")) #caja negra g=p*0.4 t=p*0.3 e=p*0.3 #salida print("El presupuesto dedicado a ginecologia:...
#Przygotować skrypt, w którym użytkownik będzie wprowadzał do listy wartości używając pętli, a następnie wartości z tej zostanią zrzutowane do krotki. lista=[] for i in range(5): liczba=int(input()) lista.append(liczba) print(lista) print(tuple(lista))
class ConfigBase: def __init__(self): self.zookeeper = "" self.brokers = "" self.topic = "" def __str__(self): return str(self.zookeeper + ";" + self.brokers + ";" + self.topic) def set_zookeeper(self, conf): self.zookeeper = conf def set_brokers(self, conf): ...
''' Created on May 13, 2016 @author: david ''' if __name__ == '__main__': pass
# numbers_list = [int(x) for x in input().split(", ")] def find_sum(numbers_list): result = 1 for i in range(len(numbers_list)): number = numbers_list[i] if number <= 5: result *= number elif number <= 10: result /= number return result print(find_sum([1,...
# post to the array-connections/connection-key endpoint to get a connection key res = client.post_array_connections_connection_key() print(res) if type(res) == pypureclient.responses.ValidResponse: print(list(res.items))
BOT_CONFIG = 'default' CONFIGS_DIR_NAME = 'configs' BOTS_LOG_ROOT = 'bots' LOG_FILE = 'bots.log' LOOP_INTERVAL = 60 SETTINGS = 'settings.yml,secrets.yml' VERBOSITY = 1
""" Problem Statement (Digit Fifth Power ): https://projecteuler.net/problem=30 Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits: 1634 = 1^4 + 6^4 + 3^4 + 4^4 8208 = 8^4 + 2^4 + 0^4 + 8^4 9474 = 9^4 + 4^4 + 7^4 + 4^4 As 1 = 1^4 is not a sum it is not in...
class BotLogic: def BotExit(Nachricht): print("Say Goodbye to the Bot") # Beim Bot abmelden def BotStart(Nachricht): print("Say Hello to the Bot") # Beim Bot anmelden
""" 1. Clarification 2. Possible solutions - Python built-in - Hand-crafted - Deque 3. Coding 4. Tests """ # # T=O(n), S=O(n) # class Solution: # def reverseWords(self, s: str) -> str: # if not s: return '' # return ' '.join(reversed(s.split())) # T=O(n), S=O(n) in python or O(1) in ...
# -*- coding: utf-8 -*- """ Created on Tue May 14 10:22:45 2019 @author: Lee """ __version_info__ = (0, 3, 10) __version__ = '.',join(map(str,__version_info__[:3])) if len(__version_info__) == 4: __version__+=__version_info[-1]
# class => module MODULE_MAP = { 'ShuffleRerankPlugin': 'plugins.rerank.shuffle', 'PtTransformersRerankPlugin': 'plugins.rerank.transformers', 'PtDistilBertQAModelPlugin': 'plugins.qa.distilbert' } # image => directory IMAGE_MAP = { 'alpine': '../Dockerfiles/alpine', 'pt': '../Dockerfiles/pt' } I...
# https://leetcode.com/problems/burst-balloons/ # # algorithms # Hard (46.16%) # Total Accepted: 56,690 # Total Submissions: 122,812 # 这道题是一道 dp 的题目,dp[i][j] 代表下标位 i,j 之间范围内 sum 最大的值 class Solution(object): def maxCoins(self, nums): """ :type nums: List[int] :rtype: int """ ...
''' This file was used in an earlier version; geodata does not currently use SQLAlchemy. --- This file ensures all other files use the same SQLAlchemy session and Base. Other files should import engine, session, and Base when needed. Use: from initialize_sqlalchemy import Base, session, engine ''' # # The engi...
#!/bin/python3 d1 = open("isimler1.txt") d1_satırlar = d1.readlines() d2 = open("isimler1.txt") d2_satırlar = d2.readlines() for i in d2_satırlar: if i in d1_satırlar: print(i) d1.close() d2.close()
# Copyright 2021 IBM All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
# The authors of this work have released all rights to it and placed it # in the public domain under the Creative Commons CC0 1.0 waiver # (http://creativecommons.org/publicdomain/zero/1.0/). # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRA...
tup1=(10,20,30) tup2=(5,8,8,9,8,9) tup3=tup1+tup2 print(tup3) del tup1 #删除整个元祖对象,删除后不能再调用 print(tup3[::-1]) #分片翻转元祖 print(tup2.count(8)) #统计元祖中8出现的次数 print(tup2.index(8)) #返回第一个8出现的索引位置 print(tup2.index(8,3)) #可以指定区间找出8第一次出现的位置 for x in tup3: print(x) #多层元祖 tup4=(1,5,(2,8),9) for x in tup4: print(x) ...
class EntityForm(django.forms.ModelForm): class Meta: model = Entity exclude = (u'homepage', u'image')
WHAT_IS_PAIRS = [ { # [3] "query": "What is villa la reine jeanne all about?", "result": """ statement: { target phrase: what, action: { neg: None, verb: { aux_vbs: [is], main_vb: None, modal_vb: None }, acomp_list: [] }, related phrase: villa la reine jeanne } """ }...
''' Simpler to just do the math than iterating. Break each number from 1 to 20 into its prime components. The find the maximum times each unique prime occurs in any of the numbers. Include the prime that number of times. For instance, 9 is ( 3 * 3 ) and 18 is ( 3 * 3 * 2 ), both of which are the most number of times ...
""" Mixin for returning the intersected frames. """ class IntersectedFramesMixin: """ Mixin for returning the intersected frames. """ def __init__(self): self.intersected_frames = []
n, k = map(int, input().split()) arr = list(map(int, input().split())) arr_find = list(map(int, input().split())) def bin_search(arr, el): left = -1 right = len(arr) while right - left > 1: mid = (right + left) // 2 if arr[mid] >= el: right = mid else: lef...
def default_getter(attribute=None): """a default method for missing renderer method for example, the support to write data in a specific file type is missing but the support to read data exists """ def none_presenter(_, **__): """docstring is assigned a few lines down the line""" r...
"""Calculate Net:Gross estimates""" def calculate_deep_net_gross_model(model, composition): """Calculate a net gross estimate based on the given deep composition""" net_gross = model.assign( bb_pct=lambda df: df.apply( lambda row: composition["building_block_type"][row.building_block_type]...
n = int(input()) current = 1 bigger = False for i in range(1, n + 1): for j in range(1, i + 1): if current > n: bigger = True break print(str(current) + " ", end="") current += 1 if bigger: break print()
n = int(input()) d = list() for i in range(2): k=list(map(int,input().split())) d.append(k) c = list(zip(*d)) p = [] for i in range(len(c)): p.append(c[i][0] * c[i][1]) number=sum(p)/sum(d[1]) print("{:.1f}".format(number))
# Scrapy settings for resource_library project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # https://docs.scrapy.org/en/latest/topics/settings.html # https://docs.scrapy.org/en/latest/topics/downloader-m...
queries = { "column": { "head": "select top %d %s from %s;", "all": "select %s from %s;", "unique": "select distinct %s from %s;", "sample": "select top %d %s from %s order by rand();" }, "table": { "select": "select %s from %s;", "head": "select top %d * from...
''' 完全平方数 给定正整数 n,找到若干个完全平方数(比如 1, 4, 9, 16, ...)使得它们的和等于 n。你需要让组成和的完全平方数的个数最少。 给你一个整数 n ,返回和为 n 的完全平方数的 最少数量 。 完全平方数 是一个整数,其值等于另一个整数的平方;换句话说,其值等于一个整数自乘的积。 例如,1、4、9 和 16 都是完全平方数,而 3 和 11 不是。 示例 1: 输入:n = 12 输出:3 解释:12 = 4 + 4 + 4 示例 2: 输入:n = 13 输出:2 解释:13 = 4 + 9   提示: 1 <= n <= 10^4 ''' ''' 思路:动态规划 背包问题 用背包问题的思...
def reader(): with open('day3/puzzle_input.txt', 'r') as f: return f.read().splitlines() def tree(right, down): count = 0 index = 0 lines = reader() for i in range(0, len(lines), down): line = lines[i] if line[index] == '#': count += 1 remainder = len(li...
class FPyCompare: def __readFile(self, fileName): with open(fileName) as f: lines = f.read().splitlines() return lines def __writeFile(self, resultList, fileName): with open(fileName, "w") as outfile: outfile.write("\n".join(resultList)) print(fileName + ...
print(() == ()) print(() > ()) print(() < ()) print(() == (1,)) print((1,) == ()) print(() > (1,)) print((1,) > ()) print(() < (1,)) print((1,) < ()) print(() >= (1,)) print((1,) >= ()) print(() <= (1,)) print((1,) <= ()) print((1,) == (1,)) print((1,) != (1,)) print((1,) == (2,)) print((1,) == (1, 0,)) print((1,) > ...
# Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def reverseBetween(self, head: ListNode, left: int, right: int) -> ListNode: dummy_head = sublist_head = ListNode(0,head) for _ in ra...
# Height in cm --> feet and inches # (just for ya fookin 'muricans) cm = float(input("Enter height in cm: ")) inches = cm/2.54 ft = int(inches//12) inches = int(round(inches % 12)) print("Height is about {}'{}\".".format(ft, inches))
# writing to a file : # To write to a file you need to create file stream = open('output.txt', 'wt') print('\n Can I write to this file : ' + str(stream.writable())) stream.write('H') # write a single string ... stream.writelines(['ello',' ', 'Susan']) # write multiple strings stream.write('\n') # write a new line ...
an_int = 2 a_float = 2.1 print(an_int + 3) # prints 5 # Define the release and runtime integer variables below: release_year = 15 runtime = 20 # Define the rating_out_of_10 float variable below: rating_out_of_10 = 3.5
N = int(input()) s = [input() for _ in range(5)] a = [ '.###..#..###.###.#.#.###.###.###.###.###.', '.#.#.##....#...#.#.#.#...#.....#.#.#.#.#.', '.#.#..#..###.###.###.###.###...#.###.###.', '.#.#..#..#.....#...#...#.#.#...#.#.#...#.', '.###.###.###.###...#.###.###...#.###.###.' ] result = [] for i...
# -*- coding: utf-8 -*- """ Created on Tue Sep 22 15:47:38 2020 @author: xyz """ a = 4 b = 5 c = 6 d = True e = False bool1 = (d + d) >= 2 and (not e) bool2 = (not e) and (6*d == 12/2) bool3 = (d or (e)) and (a > b) print(bool1, bool2, bool3)
# -*- coding: utf-8 -*- DESC = "iai-2018-03-01" INFO = { "DeletePersonFromGroup": { "params": [ { "name": "PersonId", "desc": "人员ID" }, { "name": "GroupId", "desc": "人员库ID" } ], "desc": "从某人员库中删除人员,此操作仅影响该人员库。若该人员仅存在于指定的人员库中,该人员将被删除,其所有的人脸信息也将被删除。" ...
# Numpy is imported; seed is set # Initialize all_walks (don't change this line) all_walks = [] # Simulate random walk 10 times for i in range(10) : # Code from before random_walk = [0] for x in range(100) : step = random_walk[-1] dice = np.random.randint(1,7) if di...
# A file to test if pyvm works from the command line. def it_works(): print("Success!") it_works()
n = "Hello" # Your function here! def string_function(s): return s + 'world' print(string_function(n))
#this software is a copyrighted product made by laba.not for resell. all right reserved.date-7th may 2018. one of the 1st software made by laba. print("Welcome to Personal dictionary by laba.\nThis ugliest software is made by most handsome man alive name laba.") print("\nThis software aims to make your process for ...
# Final Exam, Problem 4 - 2 def longestRun(L): ''' Assumes L is a non-empty list Returns the length of the longest monotonically increasing ''' maxRun = 0 tempRun = 0 for i in range(len(L) - 1): if L[i + 1] >= L[i]: tempRun += 1 if tempRun > maxRun: ...
# # @lc app=leetcode id=415 lang=python3 # # [415] Add Strings # # https://leetcode.com/problems/add-strings/description/ # # algorithms # Easy (51.34%) # Likes: 2772 # Dislikes: 495 # Total Accepted: 421.8K # Total Submissions: 820.4K # Testcase Example: '"11"\n"123"' # # Given two non-negative integers, num1 a...
def landscaper(f, generations): seen_states = {} states = [] state = f.readline().strip().split(' ')[-1] f.readline() rules = {} idx = 0 prev_sum = None for rule in f.readlines(): keys, _, res = rule.strip().split(' ') if res == '#': rules[keys] = True ...
# printing out a string print("lol") # printing out a space betwin them (\n) print("Hello\nWorld") # if you want to put a (") inside do this: print("Hello\"World\"") # if you want to put a (\) inside just type: print("Hello\World") # you can also print a variable like this; lol = "Hello World" print(lol) # y...
def funcao(x = 1,y = 1): return 2*x+y print(funcao(2,3)) print(funcao(3,2)) print(funcao(1,2))
''' author: Iuri Freire e-mail: iuricostafreire at gmail dot com local date : 2021-01-07 local time : 20:47 '''
# -*- coding: utf-8 -*- """ snaplayer ~~~~~~~~ The very basics :copyright: (c) 2015 by Alejandro Ricoveri :license: MIT, see LICENSE for more details. """ PKG_URL = 'https://github.com/axltxl/snaplayer' __name__ = 'snaplayer' __author__ = 'Alejandro Ricoveri' __version__ = '0.1.1' __licence__ = 'MIT' __copyright__...