content
stringlengths
7
1.05M
class RecentCounter: def __init__(self): self.queue = [] def ping(self, t: int) -> int: self.queue.append(t) if len(self.queue) > 3001: self.queue.pop(0) start = 0 for idx, item in enumerate(self.queue): if item >= t-3000: ...
def rearrange_digits(input_list): """ Rearrange Array Elements so as to form two number such that their sum is maximum. Args: input_list(list): Input List Returns: (int),(int): Two maximum sums """ # sort the list in descending order quicksort(input_list) # fill max with ...
#!/bin/python3 n,k = input().strip().split(' ') n,k = [int(n),int(k)] height = list(map(int, input().strip().split(' '))) max_height = max(height) if max_height - k >= 1: print (max_height-k) else: print (0)
#!/usr/local/bin/python3 s1 = "floor" s2 = "brake" print(s1) for i in range(len(s1)): if s1[i] != s2[i]: print(s2[:i+1] + s1[i+1:])
def solve() -> None: # person whose strength is i can only carry parcels whose weight is less than or equal to i. # check in descending order of degree of freedom of remained parcels. a = [0] + list(map(int, input().split())) b = [0] + list(map(int, input().split())) # for i in range(1, 6...
class WayPoint: code = None state = None location = None coordinate = None def __init__(self, code=None, state=None, location=None, coordinate=None): self.code = code self.state = state self.location = location self.coordinate = coordinate if self.code is No...
class Solution: def constructFromPrePost(self, pre: List[int], post: List[int]) -> TreeNode: if not pre: return None if len(pre) == 1: return TreeNode(pre[0]) lroot = post.index(pre[1]) l = self.constructFromPrePost(pre[1:lroot+2], post[:lroot+1]) r = ...
# # @lc app=leetcode id=430 lang=python3 # # [430] Flatten a Multilevel Doubly Linked List # # https://leetcode.com/problems/flatten-a-multilevel-doubly-linked-list/description/ # # algorithms # Medium (57.21%) # Likes: 3309 # Dislikes: 244 # Total Accepted: 212.1K # Total Submissions: 361.6K # Testcase Example: ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # 全局配置 DEBUG = True DB_HOST = '10.21.216.156' DB_PORT = 3306 DB_USER = 'root' DB_PASS = 'root' DB_NAME = 'news' DB_CHARSET = 'utf8'
BIGINT = "BIGINT" NUMERIC = "NUMERIC" NUMBER = "NUMBER" BIT = "BIT" SMALLINT = "SMALLINT" DECIMAL = "DECIMAL" SMALLMONEY = "SMALLMONEY" INT = "INT" TINYINT = "TINYINT" MONEY = "MONEY" FLOAT = "FLOAT" REAL = "REAL" DATE = "DATE" DATETIMEOFFSET = "DATETIMEOFFSET" DATETIME2 = "DATETIME2" SMALLDATETIME = "SMALLDATETIME" DA...
class Solution(object): def uniquePathsIII(self, grid): """ :type grid: List[List[int]] :rtype: int """ if not grid or not grid[0]: return 0 R = len(grid) C = len(grid[0]) ans = 0 zero_count = 0 extra_count = 0 ...
xCoordinate = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30] def setup(): size(500,500) smooth() noStroke() myInit() def myInit(): println ("New coordinates : ") for i in range(len(xCoordinate)): xCoordinate [i] = 250 + random ( -100 ,100) prin...
# # PySNMP MIB module HUAWEI-MGMD-STD-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-MGMD-STD-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:46:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
def test_get_cpu_times(device): result = device.cpu_times() assert result is not None def test_get_cpu_percent(device): percent = device.cpu_percent(interval=1) assert percent is not None assert percent != 0 def test_get_cpu_count(device): assert device.cpu_count() == 2
# Normal way def userEntity(item) -> dict: return { "fname":item["fname"], "lname":item["lname"], "email":item["email"], } def usersEntity(entity) -> list: return [userEntity(item) for item in entity]
# Copyright (c) 2013-2018 LG Electronics, 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 or agreed t...
"""@package This package enables the document usage for the database. """ class Document: """ This class defines a document (description, pdf file...). """ def __init__(self, document_id, html_content_eng, html_content_nl): """ Document initializer. :param document_id: The ID ...
def bool_func(i, w, a): if i == 0: if w == 0: return True else: return False # in case not choosing a[i-1] if bool_func(i-1, w, a): return True # in case choosing a[i-1] if bool_func(i-1, w-a[i-1], a): return True # return False if both cas...
nome = input('Qual é o seu nome? ') idade = input('Qual é a sua idade? ') peso = input('Qual é o seu peso? ') print(f'\033[4:31m{nome}\033[m, \033[4:34m{idade}\033[m, \033[4:35m{peso}\033[m')
""" Working on planning a large event (like a wedding or graduation) is often really difficult, and requires a large number of dependant tasks. However, doing all the tasks linearly isn't always the most efficient use of your time. Especially if you have multiple individuals helping, sometimes multiple people could do ...
def mid(word: str | list | tuple) -> str: return "" if len(word) % 2 == 0 else word[round(len(word) // 2)] def tests() -> None: print(mid("hello")) # "l" print(mid("12345")) # "3" print(mid("hello2")) # "" print(mid("abc")) # "b" # It also works with lists! print(mid(["a", "b", "c", "d...
def A(): q = int(input()) for i in range(q): n , a , b = map(int , input().split()) if(2*a<b): print(n*a) continue else: print(n//2*b+(n%2)*a) A()
# Archivo: variables_3_booleanas.py # Autor: Javier Garcia Algarra # Fecha: 27 de diciembre de 2017 # Descripción: Variables booleanas # Las variables booleanas son muy útiles. Sólo pueden tomar dos variables True (Verdadero) o False (Falso) booleana_1 = True booleana_2 = False print("La variable booleana_1 es",bo...
class AdministrationWarning(Warning): pass class TemporaryDirectoryDeletionWarning(Warning): pass
class TradeRecord: """数据库字段名常量""" # ID ID = "ID" # 股票代码 STOCK_CODE = "STOCK_CODE" # 股票名字 STOCK_NAME = "STOCK_NAME" # 交易时5档详情 DETAIL = "DETAIL" # 交易类型(买入:buy 卖出:sell) TRADE_TYPE = "TRADE_TYPE" # 交易价格 TRADE_PRICE = "TRADE_PRICE" # 交易数量 TRADE_AMOUNT = "TRADE_AMO...
# -*- coding: utf-8 -*- """ Created on Wed Jan 29 20:01:24 2020 @author: Tushar Saxena """ """ Algo: low:= 0 high:= n-1 while low <= high Do mid = (low + high) / 2 if arr[mid] == value: return mid elif arr[mid] < value: low = mid + 1 ...
#input # 13 # 19443 576 # 6001842 911503 # 4067 1248 # 6121885 186 # -410349 4955307 # 5375848 874 # 2770998 256 # 18765 1284 # 5813 1630 # 8212240 77 # 293304 -4580549 # 7956897 3420372 # 6775023 846 n = int(input()) for k in range(0, n): num = None for i in input().split(): if not(num): ...
# Crie um programa que leia algo e mostre seu tipo pimitivo e todas as informações possíveis sobre ele. print('=-'*7, 'DESAFIO 4', '=-'*7) n = input('Digite algo: ') print('O tipo primitivo desse valor é {}.'.format(type(n))) # Ponto de melhoria! print('Só tem espaços? {}'.format(n.isspace())) print('É um número? {}'....
with open("instructions.txt") as f: content = f.readlines() instrL = [] for line in content: if ";" in line: instr = line.split(";")[0] instr = instr.replace(" ", "") instr = instr.replace("()", "") instr = instr.replace("void", "") nr = line.split("/")[2] ...
""" Tendo como dado de entrada a altura (h) de uma pessoa, construa um algoritmo que calcule seu peso ideal, utilizando as seguintes fórmulas: Para homens: (72.7*h) - 58 Para mulheres: (62.1*h) - 44.7 """ h = float(input('Informe sua altura (em metros): ')) sexo = input('Informe seu sexo (M = Mulher / H = Homem...
""" Merge sort uses auxiliary storage """ def merge_sort(A): """Merge Sort implementation using auxiliary storage.""" aux = [None] * len(A) def rsort(lo, hi): if hi <= lo: return mid = (lo+hi) // 2 rsort(lo, mid) rsort(mid+1, hi) merge(lo, mid, hi) ...
# this is an example trial file # each line in this file is one command # there are two type of commands, phase commands and robot commands #all comamands share the same format: # name_of_command(time_to_run_command, <some number of arguments>) # time_to_run_command is the numver of seconds afte rth trial starts # ...
#!/usr/bin/python3 ''' Sequencia de Fibonacci com limite de 20mil Utilizando a funcao soma -2: = somara os dois ultimos elmentos da lista ''' # 0, 1, 1, 2, 3, 5, 8, 13, 21... def fibonacci(limite): resultado = [0, 1] while resultado[-1] < limite: resultado.append(sum(resultado[-2:])) return re...
def test_slice_bounds(s): # End out of range assert s[0:100] == s assert s[0:-100] == '' # Start out of range assert s[100:1] == '' # Out of range both sides # This is the behaviour in cpython # assert s[-100:100] == s def expect_index_error(s, index): try: s[index] exce...
""" Let's use decorators to build a name directory! You are given some information about people. Each person has a first name, last name, age and sex. Print their names in a specific format sorted by their age in ascending order i.e. the youngest person's name should be printed first. For two people of the same age, p...
def mittelwert(liste): return sum(liste)/len(liste) def mittelwert2(*liste): return sum(liste)/len(liste) print(mittelwert([3, 4, 5])) print(mittelwert2(3, 4, 5)) def ausgabe(Liste, ende="\n"): for element in Liste: print(element, end=ende) def ausgabe2(Liste, **kwargs): ende...
class DDSDeliveryPreview(object): """ A class to represent a delivery preview, without persistence. Has many of the same properties as a Delivery, and can be provided to the email generation code """ def __init__(self, from_user_id, to_user_id, project_id, transfer_id, user_message): self.f...
# Copyright 2021 The BladeDISC Authors. 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 ...
''' Runtime: 56 ms, faster than 75.06% of Python3 online submissions for Longest Substring Without Repeating Characters. Memory Usage: 12.8 MB, less than 100.00% of Python3 online submissions for Longest Substring Without Repeating Characters. ''' ''' Given a string, find the length of the longest substring with...
n, m, k = map(int, input().split()) if k < n: print(k + 1, 1) else: k -= n r = n - k // (m - 1) if r & 1: print(r, m - k % (m - 1)) else: print(r, k % (m - 1) + 2)
TASK_NAME = 'ReviewTask' JS_ASSETS = [''] JS_ASSETS_OUTPUT = 'scripts/vulyk-declarations-review.js' JS_ASSETS_FILTERS = 'yui_js' CSS_ASSETS = [''] CSS_ASSETS_OUTPUT = 'styles/vulyk-declarations-review.css' CSS_ASSETS_FILTERS = 'yui_css'
#!/usr/bin/python3 # -*-coding:utf-8-*- __author__ = "Bannings" class Solution: def decodeString(self, s: str) -> str: ans, stack, num = "", [], 0 for char in s: if char.isdigit(): num = num * 10 + int(char) elif char == "[": stack.append((nu...
''' Given a target A on an infinite number line, i.e. -infinity to +infinity. You are currently at position 0 and you need to reach the target by moving according to the below rule: In ith move you can take i steps forward or backward. Find the minimum number of moves required to reach the target. ''' class Solutio...
input = """ 3 7 61 146 73 112 115 127 130 0 0 1 146 2 0 155 73 1 155 2 0 146 73 1 148 2 0 150 115 1 150 2 0 148 115 1 148 2 0 152 112 1 152 2 0 148 112 1 152 2 0 158 127 1 158 2 0 152 127 1 155 2 0 157 61 1 157 2 0 155 61 1 158 2 0 160 130 1 160 2 0 158 130 0 0 B+ 0 B- 1 0 1 """ output = """ {} {} {} {} {} {} {} {} {} ...
def format_name(first_name,last_name): if first_name == "" and last_name == "": return "You didn't provide valid inputs" first_name = first_name.title() last_name = last_name.title() return first_name + " " + last_name name = format_name(input("Enter your first name : "),input("Enter your last...
class AnalistaContable(): def sueldo(self, horas, precio, comisiones): print("el sueldo del analista contable es:", (horas*precio)- comisiones) def Datos(self, nombre, apellido, edad): print("el nombre del analista contable es: ", nombre ," ", apellido, "\n su edad es: ", edad) ...
class Person: def __init__(self, first_name: str, last_name: str, age: int) -> None: self.first_name = first_name self.last_name = last_name self.age = age def __repr__(self) -> str: return f"{self.first_name} {self.last_name}, {self.age} y.o."
asdasdasd asdasdasdsa asdasd
dado = dict() partidas = list() galera = list() cont = 0 # Leitura de dados de todos os jogadores while True: print('-=' * 30) #Leitura dos dados de cada jogador dado['nome'] = str(input('Nome do Jogador: ')).title() tot_part = int(input(f'Quantas partidas {dado["nome"]} jogou? ')) for c in range(0, to...
''' Archivo de configuraciones del sistema, los siguientes parámetros pueden ser modificados para cambiar el funcionamiento y comportamiento de la simulación. Estos cambios solo se ven aplicados cuando se ejecuta el servidor de manera local. Autores: David Rodríguez Fragoso A01748760 Erick Hernández Silva A0175017...
class CastLibraryTable: #------------------------------ def __init__(self, castlibs): self.by_nr = {} self.by_assoc_id = {} for cl in castlibs: self.by_nr[cl.nr] = cl if cl.assoc_id>0: self.by_assoc_id[cl.assoc_id] = cl def iter_by_nr(self): ...
class TimeRecord: def __init__(self,ID,startHour,endHour,projectID,recordTypeID,description,statusID,minutes,oneNoteLink,km): self.ID = ID self.StartHour = startHour self.EndHour = endHour self.ProjectID = projectID self.RecordTypeID = recordTypeID self.Description =...
class Multi(object): ITEMS = (1, 3), (5, 8) def __getitem__(self, i): return self.ITEMS[i[0]][i[1]] def __setitem__(self, i, x): self.ITEMS[i[0]][i[1]] = x def __len__(self): return 2, 2
"""Initialization Module""" __version__ = "0.0.1" __version_info__ = tuple(__version__.split("."))
#!/usr/bin/env python3 # # --- Day 12: Passage Pathing --- # # With your submarine's subterranean subsystems subsisting suboptimally, # the only way you're getting out of this cave anytime soon is by finding # a path yourself. Not just a path - the only way to know if you've found # the best path is to find all of them...
#!/usr/bin/env python3 def read_val(): return int(input()) def count_three_addend_decompositions(n): # https://www.wolframalpha.com/input/?i=sum_k%3D0%5En+(n+-+k+%2B+1) return (n + 1) * (n + 2) // 2 for _ in range(read_val()): print(count_three_addend_decompositions(read_val()))
class Solution: """ @param n: a non-negative integer @return: the total number of full staircase rows that can be formed """ def arrangeCoins(self, n): start = 0 end = n while start + 1 < end: mid = start + (end - start) // 2 if mid * (mid + 1) // 2 > ...
ALLOWLIST_ACTIONS = [ "ip_allow_list.enable", "ip_allow_list.disable", "ip_allow_list.enable_for_installed_apps", "ip_allow_list.disable_for_installed_apps", "ip_allow_list_entry.create", "ip_allow_list_entry.update", "ip_allow_list_entry.destroy", ] def rule(event): return ( e...
class SolutionTLE: """ Solution with Time Limit Exceeded """ def maxEvents(self, events: List[List[int]]) -> int: queue = [] heapq.heapify(queue) for event in events: start, end = event heapq.heappush(queue, (start, end)) event_cnt = 0 ...
# https://leetcode-cn.com/problems/lru-cache/ class LRUCache: def __init__(self, capacity: int): self.c = capacity self.l = [] self.d = {} def get(self, key: int) -> int: if key in self.d: self.l.pop(self.l.index(key)) self.l.append(key) ret...
cost = 14.99 taxperc = 23 tax = taxperc / 100.00 salepr = cost * (1.0 + tax) print("sale price:", salepr)
{ "targets": [ { "target_name": "fortuna", "sources": [ "src/main.cpp", "src/libfortuna.cpp", "src/libfortuna/blf.c", "src/libfortuna/fortuna.c", "src/libfortuna/internal.c", "src/libfortuna/md5.c", "src/libfortuna/px.c", "src/libfortuna/random.c", "s...
a=list() with open('db.txt', 'r') as file: for i in file: a.append(i.strip()) b=input() interval=len(a) shift=0 while interval>=1: t=interval%2 interval//=2 i=interval+t print('1 - ', a[i+shift-1], ' | 2 - ', b) r=input() while r!='1' and r!='2': r=input() if r=='1': shift+=i else: if not t: inte...
# Training and prediction prediction_window = 7 # How many days in single prediction # Window optimization n_optimizer_predictions = 100 # Num of predictions to make during window optimization smallest_possible_training_window = 25 ...
# Given an array a that contains only numbers in the range from 1 to a.length, find the first duplicate number for which the second occurrence has the minimal index. In other words, if there are more than 1 duplicated numbers, return the number for which the second occurrence has a smaller index than the second occurr...
testcase = int(input()) for i in range(testcase+1): if i == 0: continue strlist = input() strlen = len(strlist) j = 0 decodestr = "Case {}: ".format(i) while j < strlen: ch = strlist[j] if ch == '\n': break else: cnt = 0 k = j + 1 while(k < strlen and strlist[k].isdigit()): cnt *= 10 c...
# -*- coding: utf-8 -*- #: Following the versioning system at http://semver.org/ #: See also docs/contributing.rst, section ``Versioning`` #: MAJOR: incremented for incompatible API changes MAJOR = 1 #: MINOR: incremented for adding functionality in a backwards-compatible manner MINOR = 0 #: PATCH: incremented for bac...
def logical_calc(array,op): while len(array) > 1: inp1 = array.pop(0) inp2 = array.pop(0) if op == "AND": array.insert(0,a(inp1,inp2)) elif op == "OR": array.insert(0,o(inp1,inp2)) elif op == "XOR": array.insert(0,x(inp1,i...
def add_native_methods(clazz): def getTotalSwapSpaceSize____(a0): raise NotImplementedError() def getFreeSwapSpaceSize____(a0): raise NotImplementedError() def getProcessCpuTime____(a0): raise NotImplementedError() def getFreePhysicalMemorySize____(a0): raise NotImplem...
dia = input("Em que dia você nasceu? ") mes = input("Em que mês você nasceu? ") ano = input("Em que ano você nasceu? ") print("Você nasceu no dia \033[32m", dia, "\033[m no mês de \033[34m", mes, "\033[m e no ano de \033[33m", ano, "\033[m😆️😆️😆️")
#!/usr/bin/env python # -*- coding: utf-8 -*- """Custom colorise exceptions.""" class NotSupportedError(Exception): """Raised when functionality is not supported."""
""" imutils/ml/optimizer/__init__.py """
#You Source Code Very Good print("Good") for i in range(1,20+1): print("It works Great!")
# Створення ітератору за допомогою функції iter() numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9] numbers_iterator = iter(numbers) print(numbers_iterator) print(next(numbers_iterator)) print("before the loop") for number in numbers_iterator: print(number) # Написання класу ітератора (методи __iter__ та __next__ обов'язк...
#!/usr/bin/env python class FLVError(Exception): pass class F4VError(Exception): pass class AMFError(Exception): pass __all__ = ["FLVError", "F4VError", "AMFError"]
def check_cnpj(value): if value == '99999999999999': is_valid = False else: # Checks if is in pattern NNNNNNNNNNNNNN is_valid_len = len(value) == 14 is_valid_num = all(char.isnumeric() for char in value) is_valid = is_valid_len and is_valid_num return not is_valid de...
class Solution(object): def rotateMatrixCounterClockwise(self, mat): if len(mat) == 0: return # To asses the size of N*M matrix top = 0 bottom = len(mat) - 1 left = 0 right = len(mat[0]) - 1 while left < right and top < bottom: pre...
# 1st solution class Solution: def findLadders(self, beginWord: str, endWord: str, wordList: List[str]) -> List[List[str]]: if endWord not in wordList: return [] wordSet = set(wordList) # faster checks against dictionary layer = {} layer[beginWord] = [[beginWord]] # ...
#!/usr/bin/env python3 # https://abc099.contest.atcoder.jp/tasks/abc099_b a, b = map(int, input().split()) d = b - a k = d * (d - 1) // 2 print(k - a)
class StringUtilities(str): def longest_word(self): word_list = self.split() longest_word_length = 0 for word in word_list: word = StringUtilities.remove_symbols(word) if len(word) > longest_word_length: longest_word_length = len(word) ...
""" Importing modules When we run a statement such as import fractions what is python doing The first thing to note is that Python """
# -*- coding: utf-8 -*- # @File : 13_order_arr_let_odd_before_even.py # @Author: cyker # @Date : 4/3/20 3:55 PM # @Desc : 输入一个整数数组,实现一个函数来调整该数组中数字的顺序 # 使得所有的奇数位于数组的前半部分,所有的偶数位于数组的后半部分,并保证奇数和奇数,偶数和偶数之间的相对位置不变。 class Solution: """ 思路一: 每次循环把奇数插到前面,第一次放到第一位,第二次放到第二位...直到没有奇数,插完后要删除原来地方的奇数 时间复杂度:O(...
# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def convertBST(self, root): """ :type root: TreeNode :rtype: TreeNode """ self.pre = Non...
""" Batching support. """ def batched(resources, batch_size, **kwargs): """ Chunk resources into batches with a common type. """ previous = 0 for index, resource in enumerate(resources): different_type = resource.type != resources[previous].type too_many = index - previous >= bat...
def result(G_ab,kmeans,kmeans_cluster_centers_mag,of_idx,of_min_x,of_min_y,n_clusters,knn,dataset): dist = np.ones(n_clusters)*100 valid = np.ones(n_clusters) for i in range(0,n_clusters): # get pixel coordinates of VP point plane cantidate y_idx,x_idx = np.unravel_index(np.argmax(G_ab[:,:,i], axis=None)...
''' * @Author: csy * @Date: 2019-04-28 13:47:18 * @Last Modified by: csy * @Last Modified time: 2019-04-28 13:47:18 ''' # with open('./pi_digits.txt') as file_object: # contents=file_object.read() # print(contents) # print(contents.rstrip()) #删除末尾空白 # # filename='pi_digits.txt' # with open(filename) ...
#!/usr/bin/env python # coding=utf-8 def ClassSchedule(DB, pam): json_data = { "code": 0, "msg": "" } if pam == "": json_data["code"] = "0" json_data["msg"] = "false" return json_data classid = pam["Pam"] # &Schedule.WID, &Schedule.Chapter, &Schedule.CourseN...
def decor(func): def wrap(): print("============") func() print("============") return wrap def print_text(): print("Hello world!") decorated = decor(print_text) decorated()
for i in range(100, 1000): base9 = '' base10 = i # Convert to base 9 for j in range(0,3): r = base10 % 9 base10 = (base10 - r) / 9 base9 = str(int(r)) + base9 # compare base 10 to reversed base9 if str(i) == str(base9)[::-1]: print('Found...
# # PySNMP MIB module EQLCONTROLLER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EQLCONTROLLER-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:05:16 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
#!/bin/python num = int(input()) possibilities = 0 while num >= 0: if num % 4 == 0: possibilities += 1 num -= 5 print(possibilities)
class Mouse(object): def __init__(self, browser): self.browser = browser def left_click( self, element=None, by_id=None, by_xpath=None, by_link=None, by_partial_link=None, by_name=None, by_tag=None, by_css=None, by_class=No...
# Theory: Kwargs # With *args you can create more flexible functions that accept # a varying number of positional arguments. You may now wonder # how to do the same with named arguments. Fortunately, in # Python, you can work with keyword arguments in a similar way. # Multiple keyword arguments # Let's get acquianted...
#!/usr/bin/env python3 # Copyright 2009-2017 BHG http://bw.org/ x = 42 y = 73 # Compares the vallue of x and y if x < y: print('x < y: x is {} and y is {}'.format(x, y)) elif x > y: print("x is greater than y") else: print("x and y are equal") if x > y: print('x > y: x is {} and y is {}'.format(x, y)...
''' 연산자(operator) - 할당(assignment): = - 산술 연산 : +,-,*,**,/,//,% - 복합 할당 : +=, -=, *=, /=, ... - 논리 연산 : and, or ,not - 비교 연산 : >, >=, <, <=, ==, != - identity 연산 : is, is not(id() 함수의 리턴값이 같은지 다른지) ''' x = 1 # 연산자 오른쪽의 값을 연산자 왼쪽의 변수에 저장(할당) # 1 = x print(2**3) #2 x 2 x 2 print(10/3) print(10//3) # 정수 나눗셈 몫 print(10%3)...
__title__ = 'Generative FSL for Covid Prediction' __version__ = '1.0.0' __author__ = 'Suvarna Kadam' __license__ = 'MIT' __copyright__ = 'Copyright 2021'
# -*- coding: utf-8 -*- class Types: """ Перечень compile-time типов """ NONE = 0 INT = 1 CHAR = 2 BOOL = 3 STRING = 4 BOXED_ARR = 5 UNBOXED_ARR = 6 OBJECT = 7 DYNAMIC = 9
print('Temperature conversion program') print(' press 1 for convert from celcius to another \n press 2 for convert from faremhit to another \n press 3 for convert from kelvin to another') choice = int(input('enter your choice number : ')) if choice >3: print('invalid choice optino...please enter from 1 to 3...
# coding: utf-8 """***************************************************************************** * Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * re...
def cipher(text, shift, encrypt=True): """ Encrypts/decrypts the alphabetical portion of python strings according to a given shift integer value Parameters ---------- text: str A python string that you wish to encrypt/decrypt shift: int A python integer which determines the valu...