content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#forLoopWithoutIndexer.py list1 = ["red", "blue", "orange", "black", "white", "golden"] list2 = [] for x in list1: list2.append(x) print("list1", "\tlist2", sep = "") if len(list1) == len(list2): for i in range(0, len(list1)): print(list1[i], "\t", list2[i],sep="")
list1 = ['red', 'blue', 'orange', 'black', 'white', 'golden'] list2 = [] for x in list1: list2.append(x) print('list1', '\tlist2', sep='') if len(list1) == len(list2): for i in range(0, len(list1)): print(list1[i], '\t', list2[i], sep='')
class Solution: """ @param: num: a positive number @return: true if it's a palindrome or false """ def isPalindrome(self, num): # write your code here string = str(num) l = list(string) length = len(l) i = 1 while i < length / 2 + 1: if l[...
class Solution: """ @param: num: a positive number @return: true if it's a palindrome or false """ def is_palindrome(self, num): string = str(num) l = list(string) length = len(l) i = 1 while i < length / 2 + 1: if l[i - 1] != l[-i]: ...
with open('resources/day1', 'r') as f: line = f.readline() total = 0 line_length = len(line) next_distance = int(line_length / 2) for i in range(line_length): to_check = (i + next_distance) % line_length if line[i] == line[to_check]: total = total + int(line[to_check]) ...
with open('resources/day1', 'r') as f: line = f.readline() total = 0 line_length = len(line) next_distance = int(line_length / 2) for i in range(line_length): to_check = (i + next_distance) % line_length if line[i] == line[to_check]: total = total + int(line[to_check]) ...
#!/usr/bin/python3 -tt # -*- coding: utf-8 -*- pass # vim:set sw=4 ts=4 et:
pass
config = { "root_directory": "D:\\dFL", "main_server": { "ip": "127.0.0.1", "port": 5000, "url": "http://127.0.0.1:5000", "encryption_key": "2d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d436f77425159444b325675417945413531744d7137345949476543742b5a5059554b6d364e526f7a697470477467576f564c6d...
config = {'root_directory': 'D:\\dFL', 'main_server': {'ip': '127.0.0.1', 'port': 5000, 'url': 'http://127.0.0.1:5000', 'encryption_key': '2d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d436f77425159444b325675417945413531744d7137345949476543742b5a5059554b6d364e526f7a697470477467576f564c6d662f694d4d6a413d0a2d2d2...
################################################################################################################################ ## constants.py ## Contains various constants and defaults used both on the urscript side and the python side ## The defaults can be oveeriden when calling utils.load_script, by including the...
ur_zero = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ur_state_entries_count = 72 ur_protocol_version = 0.1 ur_cmd_kind_read = 0 ur_cmd_kind_move_joints_speed = 1 ur_cmd_kind_move_tool_pose = 2 ur_cmd_kind_move_joints_position = 3 ur_cmd_kind_move_tool_linear = 4 ur_cmd_kind_config = 9 ur_cmd_id = 0 ur_cmd_kind = 1 ur_cmd_config_ma...
input = "56729875333539561996296839415645286462625671174334615477477939283229586467798324846891741519182615516892217561655988984287367821945116278293557184937239613232721364525179874713513818819468835282486116112586561998129986326826687496835885153629469944158523371967184762191621249788365373489245919571888279297534178...
input = '56729875333539561996296839415645286462625671174334615477477939283229586467798324846891741519182615516892217561655988984287367821945116278293557184937239613232721364525179874713513818819468835282486116112586561998129986326826687496835885153629469944158523371967184762191621249788365373489245919571888279297534178...
'''Crie um programa que leia o nome de uma pessoa e diga se ela tem "Silva" no nome''' name = str(input('Digite seu nome: ')).lower().strip() search = str(input('Sua busca: ')).lower() print(search in name)
"""Crie um programa que leia o nome de uma pessoa e diga se ela tem "Silva" no nome""" name = str(input('Digite seu nome: ')).lower().strip() search = str(input('Sua busca: ')).lower() print(search in name)
while 1: x=int(input()) if x==0: break while x>9: t=0 while x: t+=x%10 x//=10 x=t print(x)
while 1: x = int(input()) if x == 0: break while x > 9: t = 0 while x: t += x % 10 x //= 10 x = t print(x)
# ex:set ts=4 sw=4: <- for vim # # EPANET Output File Tool Plugin support # # Plugins can listen to messages from the coordinating process and do whatever # is necessary. # # Messages are sent by calling specific functions in the plugin. # This class defines all the functions and their arguments. # A plugin inheritin...
class Eoftplugin: def __init__(self): self.parser = None self.options = None pass def init(self, parser): """ Callback message: initialise plugin eg. add command line options (called once in life of plugin) """ pass def test(self, eof): """ Callback message...
# Foobar Level 2, Challenge 2. def answer(xs): # Notably, in Python 2.5 and beyond, large numbers are already supported # without need to cast them to a string. positives = [num for num in xs if num>0] negatives = [num for num in xs if num<0] npos = len(positives) nneg = len(negatives) ener...
def answer(xs): positives = [num for num in xs if num > 0] negatives = [num for num in xs if num < 0] npos = len(positives) nneg = len(negatives) energy = 1 if npos == 0 and nneg == 1 or (npos == 0 and nneg == 0): return xs[0] elif npos == 0: if nneg % 2 == 1: neg...
# # PySNMP MIB module ASCEND-LANMODEM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-LANMODEM-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:26:13 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(slots, lan_modem_group) = mibBuilder.importSymbols('ASCEND-MIB', 'slots', 'lanModemGroup') (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection,...
class Solution(): def longestCommonSubstring(self, string1, string2, n1, n2): dp = [[0]*(n2+1) for i in range(n1+1)] count = 0 outputString = "" for i in range(1, n1+1): for j in range(1, n2+1): if string1[i-1] == string2[j-1]: ...
class Solution: def longest_common_substring(self, string1, string2, n1, n2): dp = [[0] * (n2 + 1) for i in range(n1 + 1)] count = 0 output_string = '' for i in range(1, n1 + 1): for j in range(1, n2 + 1): if string1[i - 1] == string2[j - 1]: ...
# noinspection PyUnusedLocal def pytest_ignore_collect(path, config): """Ignore all files in this test subdirectory.""" return True
def pytest_ignore_collect(path, config): """Ignore all files in this test subdirectory.""" return True
class JobStatus: def __init__(self): pass SCHEDULING = 'scheduling' RUNNING = 'running' PAUSED = 'paused' PENDING = 'pending' SUCCESS = 'success' FAILED = 'failed'
class Jobstatus: def __init__(self): pass scheduling = 'scheduling' running = 'running' paused = 'paused' pending = 'pending' success = 'success' failed = 'failed'
iidk_id = "1" iidk_port = "1030" # "1030" local_host_ip = "172.16.11.102" # "172.16.20.101" slave_ip = "172.16.11.102" rest_port = "8887" cam_id = "202" defocus_id = "202" grabber_name = "grab 202" cam_name = "cam 202" detector_name = "det 202" slave = "VQA-2" headers = {"Content-Type": "application/json"} time_zone_...
iidk_id = '1' iidk_port = '1030' local_host_ip = '172.16.11.102' slave_ip = '172.16.11.102' rest_port = '8887' cam_id = '202' defocus_id = '202' grabber_name = 'grab 202' cam_name = 'cam 202' detector_name = 'det 202' slave = 'VQA-2' headers = {'Content-Type': 'application/json'} time_zone_id = '1.1' cam_zone_id = '202...
''' You are to write a function that accepts two arguments, a plain-text message and a number of letters to shift in the cipher. The function will return an encrypted string with all letters transformed and all punctuation and whitespace remaining unchanged. ''' def cipher(message, n=1): message = message.lower(...
""" You are to write a function that accepts two arguments, a plain-text message and a number of letters to shift in the cipher. The function will return an encrypted string with all letters transformed and all punctuation and whitespace remaining unchanged. """ def cipher(message, n=1): message = message.lower() ...
#Special Pythagorean triplet# """ A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a^2 + b^2 = c^2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. """ #since a < b < c and a + b + c = 1000 #stop at 4...
""" A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a^2 + b^2 = c^2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. """ for a in range(1, 400): for b in range(1, 400): c = 1000 - a - b ...
input = """ % Perform a backward propagation upon #count{V : a(V,2)} =1. % The aggregate predicate should be F, so the undefined aux predicate % inside it should be derived as F in order to violate the aggregate. a(1,1) v a(1,2). :- #count{V : a(V,2)} >=1, not #count{T: a(T,2)} > 1. bug(X,2) :- a(X,2). """ output =...
input = '\n% Perform a backward propagation upon #count{V : a(V,2)} =1.\n% The aggregate predicate should be F, so the undefined aux predicate\n% inside it should be derived as F in order to violate the aggregate.\n\na(1,1) v a(1,2).\n\n:- #count{V : a(V,2)} >=1, not #count{T: a(T,2)} > 1.\n\nbug(X,2) :- a(X,2).\n' out...
def problem_19(): "How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?" # Calculate the length of the month using the day and the year def month_length_calc(m, y): # If the month is February... if m == 2: # If the year is div...
def problem_19(): """How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?""" def month_length_calc(m, y): if m == 2: if y % 4 == 0 and y % 100 != 0: return 29 elif y % 100 == 0 and y % 400 == 0: ...
class Solution: def candy(self, ratings: List[int]) -> int: n = len(ratings) candies = [1]*n for i in range(1,n): if ratings[i]>ratings[i-1]: candies[i] = candies[i-1]+1 for i in range(n-2,-1,-1): if ratings[i]>ratings[i+1]: can...
class Solution: def candy(self, ratings: List[int]) -> int: n = len(ratings) candies = [1] * n for i in range(1, n): if ratings[i] > ratings[i - 1]: candies[i] = candies[i - 1] + 1 for i in range(n - 2, -1, -1): if ratings[i] > ratings[i + 1]:...
class Config: """Documentation for Config """ SECRET_KEY = 'something-really-secret' MY_BLUEPRINTS = [] class devConfig(Config): ASSETS_DEBUG = True DEBUG = True class prodConfig(Config): # just to make sure when an idiot messes with # our Config class ASSETS_DEBUG = False ...
class Config: """Documentation for Config """ secret_key = 'something-really-secret' my_blueprints = [] class Devconfig(Config): assets_debug = True debug = True class Prodconfig(Config): assets_debug = False debug = True
# !/usr/bin/env python # coding: utf-8 # version: 1.0 # author: Fennel # contact: gongkangjia@gmail.com # date: 2021/5/28 def get_proj(grid): pass def get_map(grid): pass
def get_proj(grid): pass def get_map(grid): pass
#------------------------------------------------------------------------------- def ParseList(List): """Parse lists (e.g. 0,1,3-8,9)""" Res = list() if ( str(List).isdigit() ): Res.append(int(List)) else: for Element in List.split(','): if '-' in Element: x1,x2 = Element.split('-') Res.extend(list...
def parse_list(List): """Parse lists (e.g. 0,1,3-8,9)""" res = list() if str(List).isdigit(): Res.append(int(List)) else: for element in List.split(','): if '-' in Element: (x1, x2) = Element.split('-') Res.extend(list(range(int(x1), int(x2) + ...
# -*- coding: utf-8 -*- class BaseStore: _store = None def __init__(self, store): self._store = store def dispatch(self, action): return self._store['dispatch'](action) def get_state(self): return self._store['get_state']() class Store(BaseStore): _store = None de...
class Basestore: _store = None def __init__(self, store): self._store = store def dispatch(self, action): return self._store['dispatch'](action) def get_state(self): return self._store['get_state']() class Store(BaseStore): _store = None def __init__(self, store): ...
str1 = 'malaayalam' str2 = 'malaayalam' def check_palindrome(str1, str2): if len(str1) != len(str2): return False for i in range(len(str1)): if str1[i] != str2[len(str2) - i - 1]: return False return True print(check_palindrome(str1, str2))
str1 = 'malaayalam' str2 = 'malaayalam' def check_palindrome(str1, str2): if len(str1) != len(str2): return False for i in range(len(str1)): if str1[i] != str2[len(str2) - i - 1]: return False return True print(check_palindrome(str1, str2))
# This file was converted from the original C source: # lzhuf.c # written by Haruyasu Yoshizaki 11/20/1988 # some minor changes 4/6/1989 # comments translated by Haruhiko Okumura 4/7/1989 # LZHUF.C (c)1989 by Haruyasu Yoshizaki, Haruhiko Okumura, and Kenji Rikitake. # All rights reserved. Permission granted for no...
n = 4096 f = 60 threshold = 2 n_char = 256 - THRESHOLD + F t = N_CHAR * 2 - 1 r = T - 1 max_freq = 16384 n_mask = N - 1 def decompress_buffer(buffer: bytearray, textsize: int) -> bytearray: buffer_pos = 0 buffer_size = len(buffer) def getcz(): nonlocal buffer_pos, buffer_size if buffer_pos...
a = 13 b = 7 c = 5 result = ((a + c)*b + c - a) print(result)
a = 13 b = 7 c = 5 result = (a + c) * b + c - a print(result)
# -*- coding: utf-8 -*- """ Created on Wed Oct 4 17:07:53 2017 @author: ASuzanovich """ A = [[1,2,3], [4,5,6], [7,8,9]] num_rows = len(A) num_cols = len(A[0]) for i in range(int(num_rows/2) + 1): for j in range(int(num_cols/2) + 1): tmp = A[i][j] A[i][j] = A[num_rows - j - 1][num_cols...
""" Created on Wed Oct 4 17:07:53 2017 @author: ASuzanovich """ a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] num_rows = len(A) num_cols = len(A[0]) for i in range(int(num_rows / 2) + 1): for j in range(int(num_cols / 2) + 1): tmp = A[i][j] A[i][j] = A[num_rows - j - 1][num_cols - i - 1] A[num_row...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Dec 7 10:25:06 2019 @author: jens """ stack = [0] class intcode: def __init__(self, program): with open(program) as file: self.memory = file.readline() self.memory = self.memory.split(',') self.memory = lis...
""" Created on Sat Dec 7 10:25:06 2019 @author: jens """ stack = [0] class Intcode: def __init__(self, program): with open(program) as file: self.memory = file.readline() self.memory = self.memory.split(',') self.memory = list(map(int, self.memory)) self.original_memo...
""" 994. Rotting Oranges You are given an m x n grid where each cell can have one of three values: 0 representing an empty cell, 1 representing a fresh orange, or 2 representing a rotten orange. Every minute, any fresh orange that is 4-directionally adjacent to a rotten orange becomes rotten. Return the mi...
""" 994. Rotting Oranges You are given an m x n grid where each cell can have one of three values: 0 representing an empty cell, 1 representing a fresh orange, or 2 representing a rotten orange. Every minute, any fresh orange that is 4-directionally adjacent to a rotten orange becomes rotten. Return the mi...
description = 'fallback for fail save' group = 'special' _expcolumn = Column( Block('Experiment fallback for fail save =src', [ BlockRow( Field(name='Proposal', key='exp/proposal', width=7), Field(name='Title', key='exp/title', width=20, istext=True, maxlen=20), ...
description = 'fallback for fail save' group = 'special' _expcolumn = column(block('Experiment fallback for fail save =src', [block_row(field(name='Proposal', key='exp/proposal', width=7), field(name='Title', key='exp/title', width=20, istext=True, maxlen=20), field(name='Current status', key='exp/action', width=50, is...
class AUAException(Exception): def __init__(self, status, message) -> None: self.status = status self.message = message error_code = { "-1": "invalid username or usercode", "-2": "invalid usercode", "-3": "user not found", "-4": "too many users", "-5": "invalid songname or song...
class Auaexception(Exception): def __init__(self, status, message) -> None: self.status = status self.message = message error_code = {'-1': 'invalid username or usercode', '-2': 'invalid usercode', '-3': 'user not found', '-4': 'too many users', '-5': 'invalid songname or songid', '-6': 'invalid so...
def solution(n): ret = [[0] * n for i in range(n)] i, j, move = 0, -1, next(it := get_next_move()) for num in range(1, n * n + 1): if (-1 < i + move[0] < n and -1 < j + move[1] < n and ret[i + move[0]][j + move[1]] == 0): # everything is okay, nothing needs to be done. ...
def solution(n): ret = [[0] * n for i in range(n)] (i, j, move) = (0, -1, next((it := get_next_move()))) for num in range(1, n * n + 1): if -1 < i + move[0] < n and -1 < j + move[1] < n and (ret[i + move[0]][j + move[1]] == 0): pass else: move = next(it) i += ...
"""Provides version information.""" VERSION = '9.1.0' VERSIONARRAY = VERSION.split('.') SHORTVERSION = 'v' + str(VERSIONARRAY[0])
"""Provides version information.""" version = '9.1.0' versionarray = VERSION.split('.') shortversion = 'v' + str(VERSIONARRAY[0])
"""Hold tax code list.""" tax_codes = ["D0000000", "D9999999", "DA010000", "DA030000", "DA040000", "DA040100", "DA051011", "DA051012", "DA051013", "DA059399", "DB010000", "DB020000", "DB031013", "DB031014", "DB031015", "DB031016", "DC010000", "DC010100", "DC010200", "DC010300", "DC010400", "DC010500", "DC010600", "DC0...
"""Hold tax code list.""" tax_codes = ['D0000000', 'D9999999', 'DA010000', 'DA030000', 'DA040000', 'DA040100', 'DA051011', 'DA051012', 'DA051013', 'DA059399', 'DB010000', 'DB020000', 'DB031013', 'DB031014', 'DB031015', 'DB031016', 'DC010000', 'DC010100', 'DC010200', 'DC010300', 'DC010400', 'DC010500', 'DC010600', 'DC01...
red = 0 green = 1 blue = 2 yellow = 3 black = 4 all = [red, green, blue, yellow, black] all_str = ["red", "green", "blue", "yellow", "black"] def botstr(b): return all_str[b];
red = 0 green = 1 blue = 2 yellow = 3 black = 4 all = [red, green, blue, yellow, black] all_str = ['red', 'green', 'blue', 'yellow', 'black'] def botstr(b): return all_str[b]
""" Python 3 """ class Solution: # @param A : list of integers # @param B : list of integers # @return an integer def cover_points(self, A, B): mn = 0 for i in range(1, len(A)): mn += max(abs(A[i] - A[i - 1]), abs(B[i] - B[i - 1])) return mn """ Testing Code for ...
""" Python 3 """ class Solution: def cover_points(self, A, B): mn = 0 for i in range(1, len(A)): mn += max(abs(A[i] - A[i - 1]), abs(B[i] - B[i - 1])) return mn '\nTesting Code for this problem\n' s = solution() a = [0, 1, 1] b = [0, 1, 2] print(s.cover_points(A, B))
def test_always_true(): assert 1 == 1
def test_always_true(): assert 1 == 1
# This file contains helper functions for the Hack Assembler. def allocate_memory(memory: dict, var: str): """ Find a free place in memory and allocate var to it If there is no available memory raise an exception """ for i in range(16, 16384): # if i is free in memory allocated_memo...
def allocate_memory(memory: dict, var: str): """ Find a free place in memory and allocate var to it If there is no available memory raise an exception """ for i in range(16, 16384): allocated_memory = memory.values() if i not in allocated_memory: memory[var] = i ...
score = input("Enter Score: ") sco = float(score) if sco>=0.9: print("A") elif sco>=0.8: print("B") elif sco>= 0.7: print("C") elif sco>= 0.6: print("D") elif sco< 0.6: print("F") else: print("Error")
score = input('Enter Score: ') sco = float(score) if sco >= 0.9: print('A') elif sco >= 0.8: print('B') elif sco >= 0.7: print('C') elif sco >= 0.6: print('D') elif sco < 0.6: print('F') else: print('Error')
# -*- coding: utf-8 -*- __version_info__ = '0.5.0' __version__ = '0.5.0' version = '0.5.0' def get_version(): return version # pragma: no cover default_app_config = 'stagesetting.apps.StageSettingAppConfig'
__version_info__ = '0.5.0' __version__ = '0.5.0' version = '0.5.0' def get_version(): return version default_app_config = 'stagesetting.apps.StageSettingAppConfig'
# PEMANFAATAN LIST COMPREHENSION kata = "missisippi" jumlah_huruf_i = [1 for huruf in kata if huruf == "i"] print(sum(jumlah_huruf_i)) kumpulan_kata = ["aezakmi", "hesoyam", "rocketman", "abogoboga", "lumberjack"] kumpulan_kata_o = [kata for kata in kumpulan_kata if "o" in kata] print(kumpulan_kata_o)
kata = 'missisippi' jumlah_huruf_i = [1 for huruf in kata if huruf == 'i'] print(sum(jumlah_huruf_i)) kumpulan_kata = ['aezakmi', 'hesoyam', 'rocketman', 'abogoboga', 'lumberjack'] kumpulan_kata_o = [kata for kata in kumpulan_kata if 'o' in kata] print(kumpulan_kata_o)
# -*- coding: utf-8 -*- # 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 in writing, softw...
traits = ['MD_CLEAR', 'PCID', 'SPEC_CTRL', 'SSBD', 'VMX']
""" Support for Legacy SMS Application """ default_app_config = 'legacysms.apps.Config'
""" Support for Legacy SMS Application """ default_app_config = 'legacysms.apps.Config'
l = [0]*31 l[0] = 1 for _ in range(28): l[int(input())] = 1 for i in range(len(l)): if l[i] == 0: print(i)
l = [0] * 31 l[0] = 1 for _ in range(28): l[int(input())] = 1 for i in range(len(l)): if l[i] == 0: print(i)
PYDANTIC_IMPORTS = [ "abc", "collections", "collections.abc", "colorsys", "configparser", "contextlib", "copy", "dataclasses", "datetime", "decimal", "enum", "fractions", "functools", "ipaddress", "itertools", "json", "math", "os", "pathlib", ...
pydantic_imports = ['abc', 'collections', 'collections.abc', 'colorsys', 'configparser', 'contextlib', 'copy', 'dataclasses', 'datetime', 'decimal', 'enum', 'fractions', 'functools', 'ipaddress', 'itertools', 'json', 'math', 'os', 'pathlib', 'pickle', 're', 'sys', 'types', 'typing', 'typing_extensions', 'uuid', 'warnin...
class StringIdentifierException(Exception): ''' Raised if a String identifier (e.g. an observation "name") does not match our constraints. See the utilities method for those expectations/constraints. ''' pass class AttributeValueError(Exception): ''' Raised by the attribute subclasses...
class Stringidentifierexception(Exception): """ Raised if a String identifier (e.g. an observation "name") does not match our constraints. See the utilities method for those expectations/constraints. """ pass class Attributevalueerror(Exception): """ Raised by the attribute subclasses ...
"""Protocols to avoid direct inheritance.""" # from typing import Protocol # from PyQt5.QtCore import pyqtSignal, pyqtSlot # import numpy as np # from utility.data_structures import ParameterSet # TODO Check if we use this somewhere and think about if we want to redo this. # class ImageAnalyser(Protocol): # """A...
"""Protocols to avoid direct inheritance."""
root = Tk() root.configure(background='light green') root.title("registration form") root.geometry("500x300") heading = Label(root, text="Form", bg="light green") name = Label(root, text="Name", bg="light green") course = Label(root, text="Course", bg="light green") sem = Label(root, text="Semester", bg="light ...
root = tk() root.configure(background='light green') root.title('registration form') root.geometry('500x300') heading = label(root, text='Form', bg='light green') name = label(root, text='Name', bg='light green') course = label(root, text='Course', bg='light green') sem = label(root, text='Semester', bg='light green') ...
n = int(input()) registrar = {} for act in range(n): command = input().split() if command[0] == "register": if command[1] in registrar and registrar[command[1]] != command[2]: print(f"ERROR: already registered with plate number {registrar[command[1]]}") else: regi...
n = int(input()) registrar = {} for act in range(n): command = input().split() if command[0] == 'register': if command[1] in registrar and registrar[command[1]] != command[2]: print(f'ERROR: already registered with plate number {registrar[command[1]]}') else: registrar[co...
class Clock: def __init__(self, fpsSpec): self.fpsSpec = fpsSpec def tick(self): raise NotImplementedError
class Clock: def __init__(self, fpsSpec): self.fpsSpec = fpsSpec def tick(self): raise NotImplementedError
def reciprocal_cycles(upper_limit): max_val = -1 max_i = -1 for i in range(1, upper_limit + 1): i_reciprocal_cycle_len = _reciprocal_cycle_length(i) if i_reciprocal_cycle_len > max_val: max_val = i_reciprocal_cycle_len max_i = i return max_i def _reciprocal_cycl...
def reciprocal_cycles(upper_limit): max_val = -1 max_i = -1 for i in range(1, upper_limit + 1): i_reciprocal_cycle_len = _reciprocal_cycle_length(i) if i_reciprocal_cycle_len > max_val: max_val = i_reciprocal_cycle_len max_i = i return max_i def _reciprocal_cycle...
friends= ["ian", "marica", "socils", "bad"] for i in range(len(friends)): friend= friends[i] print("Happy new year", friend, i)
friends = ['ian', 'marica', 'socils', 'bad'] for i in range(len(friends)): friend = friends[i] print('Happy new year', friend, i)
#Advent of Code 18a # Duet file = open('input18.txt','r') #file = open('inputTest.txt','r') input = file.read().split('\n') file.close() registerLetters = 'abcdefghijklmnop' registerLetterLength = len( registerLetters ) registerValues = [] for letter in registerLetters: registerValues.append( 0 ) def getR...
file = open('input18.txt', 'r') input = file.read().split('\n') file.close() register_letters = 'abcdefghijklmnop' register_letter_length = len(registerLetters) register_values = [] for letter in registerLetters: registerValues.append(0) def get_register_position(input): for x in range(0, registerLetterLength)...
LEFT_TOP = 1 LEFT_CENTER = 2 LEFT_BOTTOM = 3 RIGHT_TOP = 4 RIGHT_CENTER = 5 RIGHT_BOTTOM = 6 SOCKET_INPUT = 1 SOCKET_OUTPUT = 2 SOCKET_TYPE_DATA = 1 SOCKET_TYPE_VALUE = 2 SOCKET_DATA_DF = 3
left_top = 1 left_center = 2 left_bottom = 3 right_top = 4 right_center = 5 right_bottom = 6 socket_input = 1 socket_output = 2 socket_type_data = 1 socket_type_value = 2 socket_data_df = 3
class ObjectDict(dict): def __getattr__(self, key): if key in self.__dict__: return self.__dict__[key] dict.__getattribute__(self, key) def __setattr__(self, key, value): self[key] = value self.__dict__[key] = value @staticmethod def from_dict(d): ob...
class Objectdict(dict): def __getattr__(self, key): if key in self.__dict__: return self.__dict__[key] dict.__getattribute__(self, key) def __setattr__(self, key, value): self[key] = value self.__dict__[key] = value @staticmethod def from_dict(d): o...
begin = {"message": "Welcome to the experiment, please enter your participant id and click next"} instruction = {"message": "You be presented with 6 health issues and a question about a treatment. " "Your task is to decide if the treatment is helpful, undecided or not helpful"} static = {...
begin = {'message': 'Welcome to the experiment, please enter your participant id and click next'} instruction = {'message': 'You be presented with 6 health issues and a question about a treatment. Your task is to decide if the treatment is helpful, undecided or not helpful'} static = {'message': 'Enjoy the experime...
class C1(object): x = 23 def method_one(): print("C1: {}".format(C1.x*2)) class C2(object): def __init__(self, n): self.x = n def double_value(self): return 2*self.x class C3(object): def hello_there(self): print("General Kenobi!") class Singleton(object): ...
class C1(object): x = 23 def method_one(): print('C1: {}'.format(C1.x * 2)) class C2(object): def __init__(self, n): self.x = n def double_value(self): return 2 * self.x class C3(object): def hello_there(self): print('General Kenobi!') class Singleton(object): ...
''' https://practice.geeksforgeeks.org/problems/positive-and-negative-elements/0 ''' def pos_neg_pairs(A): pos = [] neg = [] for i in A: if i >= 0: pos.append(i) else: neg.append(i) return [ele for tup in zip(pos,neg) for ele in tup]
""" https://practice.geeksforgeeks.org/problems/positive-and-negative-elements/0 """ def pos_neg_pairs(A): pos = [] neg = [] for i in A: if i >= 0: pos.append(i) else: neg.append(i) return [ele for tup in zip(pos, neg) for ele in tup]
student_scores = input("Enter a list of student scores : ").split() max_score = student_scores[0] for score in student_scores: if max_score < score : max_score = score print("The Highest Score in the class : ",max_score)
student_scores = input('Enter a list of student scores : ').split() max_score = student_scores[0] for score in student_scores: if max_score < score: max_score = score print('The Highest Score in the class : ', max_score)
""" https://leetcode.com/problems/valid-palindrome/ Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note: For the purpose of this problem, we define empty string as valid palindrome. Example 1: Input: "A man, a plan, a canal: Panama" Output: true Example ...
""" https://leetcode.com/problems/valid-palindrome/ Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note: For the purpose of this problem, we define empty string as valid palindrome. Example 1: Input: "A man, a plan, a canal: Panama" Output: true Example ...
mylines = [] with open('resume.txt', 'rt') as myfile: for myline in myfile: mylines.append(myline.strip('\n')) j = 0 length = len(mylines) for i in range(length): if(mylines[i] == "EDUCATION"): while (j < length): if mylines[i + j] == "POSITIONS OF RESPONSIBILITY": ...
mylines = [] with open('resume.txt', 'rt') as myfile: for myline in myfile: mylines.append(myline.strip('\n')) j = 0 length = len(mylines) for i in range(length): if mylines[i] == 'EDUCATION': while j < length: if mylines[i + j] == 'POSITIONS OF RESPONSIBILITY': break...
class Solution(object): def kLengthApart(self, nums, k): """ :type nums: List[int] :type k: int :rtype: bool """ # Runtime: 460 ms # Memory: 17.7 MB try: last_1_idx = nums.index(1) except ValueError: return True ...
class Solution(object): def k_length_apart(self, nums, k): """ :type nums: List[int] :type k: int :rtype: bool """ try: last_1_idx = nums.index(1) except ValueError: return True for idx in range(last_1_idx + 1, len(nums)): ...
class LambdaError(Exception): def __init__(self, error_dict: dict): self.error_dict = error_dict class NoSignatureError(LambdaError): def __init__(self): self.error_dict = { 'statusCode': 401, 'body': 'No X-Hub-Signature in HTTP header.' } class InvalidSignatu...
class Lambdaerror(Exception): def __init__(self, error_dict: dict): self.error_dict = error_dict class Nosignatureerror(LambdaError): def __init__(self): self.error_dict = {'statusCode': 401, 'body': 'No X-Hub-Signature in HTTP header.'} class Invalidsignatureerror(LambdaError): def __i...
__all__ = ['Colors'] class Colors: """Enum class of colors""" # Server OKCYAN = '\033[96m' OKGREEN = '\033[92m' WARNING = '\033[93m' WARNING_BOLD = '\033[1;33;40' FAIL = '\033[91m' BOLD = '\033[1m' UNDERLINE = '\033[4m' TITLE = '\033[6;32;40m' # Users M...
__all__ = ['Colors'] class Colors: """Enum class of colors""" okcyan = '\x1b[96m' okgreen = '\x1b[92m' warning = '\x1b[93m' warning_bold = '\x1b[1;33;40' fail = '\x1b[91m' bold = '\x1b[1m' underline = '\x1b[4m' title = '\x1b[6;32;40m' magenta = '\x1b[95m' blue = '\x1b[94m' ...
# Let's say we have 2 tuples - we need to convert it into a hashmap t1 = (1, 2, 3) t2 = (4, 5, 6) mapping = dict(zip(t1, t2))
t1 = (1, 2, 3) t2 = (4, 5, 6) mapping = dict(zip(t1, t2))
""" Circuit breaker design pattern: ------------------------------ Circuit breaker is a design pattern used in software development. It is used to detect failures and encapsulates the logic of preventing a failure from constantly recurring, during maintenance, temporary external system failure or unexpected system...
""" Circuit breaker design pattern: ------------------------------ Circuit breaker is a design pattern used in software development. It is used to detect failures and encapsulates the logic of preventing a failure from constantly recurring, during maintenance, temporary external system failure or unexpected system dif...
# Muro de tijolos (colchetes) :: github.com/sliatecinos # ===================================================== # Ref. externa : https://www.facebook.com/groups/pypcom/permalink/1668364116833984/ tijolo_curto = '[ ]' tijolo_longo = '[ ]' l = int(input('Informe largura: ')) h = int(input('Informe altura: ')...
tijolo_curto = '[ ]' tijolo_longo = '[ ]' l = int(input('Informe largura: ')) h = int(input('Informe altura: ')) for i in range(h): if i % 2 == 0: print(tijolo_longo * (l // 2), end='') if l % 2 > 0: print(tijolo_curto, end='') print() else: print(tijolo_curto + ti...
testinfra_hosts = ["ansible://extra_opts"] def test_include_exclude(host): script = host.file("/usr/local/bin/borg-backup") assert script.contains("/var/cache") assert script.contains("--exclude '/var/cache/apt'") assert script.user == "root" assert script.group == "root" def test_pre_post_comma...
testinfra_hosts = ['ansible://extra_opts'] def test_include_exclude(host): script = host.file('/usr/local/bin/borg-backup') assert script.contains('/var/cache') assert script.contains("--exclude '/var/cache/apt'") assert script.user == 'root' assert script.group == 'root' def test_pre_post_command...
def impkw(): print('impkw2') def my_third_keyword(): print('my_third_keyword2')
def impkw(): print('impkw2') def my_third_keyword(): print('my_third_keyword2')
# Implement a merge sort with recursion items = [6, 20, 8, 19, 56, 23, 87, 41, 49, 53] def mergesort(dataset): if len(dataset) > 1: # We have broken down the array untill we have no elements, then we start the merging process mid = len(dataset) // 2 leftarr = dataset[:mid] # Breaking down ...
items = [6, 20, 8, 19, 56, 23, 87, 41, 49, 53] def mergesort(dataset): if len(dataset) > 1: mid = len(dataset) // 2 leftarr = dataset[:mid] rightarr = dataset[mid:] mergesort(leftarr) mergesort(rightarr) i = 0 j = 0 k = 0 while i < len(leftarr...
class ValidationError(Exception): """ Error to signal something does not pass a validation check. """ pass
class Validationerror(Exception): """ Error to signal something does not pass a validation check. """ pass
# Web domain = 'mockbox.io' useSSL = False keyFile = 'keys/privkey.pem' certFile = 'keys/cacert.pem' httpPort = 80 httpsPort = 443 # SMTP bindingPort = 587 bindingIP = '0.0.0.0' # dropSize in bytes dropSize = 10000000 # General # warning! This can fill your disk up really quickly. logEmail = False
domain = 'mockbox.io' use_ssl = False key_file = 'keys/privkey.pem' cert_file = 'keys/cacert.pem' http_port = 80 https_port = 443 binding_port = 587 binding_ip = '0.0.0.0' drop_size = 10000000 log_email = False
datasets = { "BLASTCHAR": { "PATH": "./data/blastchar.csv", "POSITIVE_CLASS": "Yes", "CONT_COUNT": 2 }, "INCOME": { "PATH": "./data/income_evaluation.csv", "POSITIVE_CLASS": " >50K", "CONT_COUNT": 5 }, "BANK": { "PATH": "./data/bank-full.csv", ...
datasets = {'BLASTCHAR': {'PATH': './data/blastchar.csv', 'POSITIVE_CLASS': 'Yes', 'CONT_COUNT': 2}, 'INCOME': {'PATH': './data/income_evaluation.csv', 'POSITIVE_CLASS': ' >50K', 'CONT_COUNT': 5}, 'BANK': {'PATH': './data/bank-full.csv', 'POSITIVE_CLASS': 'yes', 'CONT_COUNT': 5}}
"""Top-level package for User profile ontology.""" __author__ = """Miguel-Angel Sicilia""" __email__ = 'msicilia@gmail.com' __version__ = '0.1.0'
"""Top-level package for User profile ontology.""" __author__ = 'Miguel-Angel Sicilia' __email__ = 'msicilia@gmail.com' __version__ = '0.1.0'
# # @lc app=leetcode id=874 lang=python3 # # [874] Walking Robot Simulation # # @lc code=start class Solution: def robotSim(self, commands: List[int], obstacles: List[List[int]]) -> int: res = 0 obs = set() for x, y in obstacles: obs.add((x, y)) directions = [(0, 1), (1,...
class Solution: def robot_sim(self, commands: List[int], obstacles: List[List[int]]) -> int: res = 0 obs = set() for (x, y) in obstacles: obs.add((x, y)) directions = [(0, 1), (1, 0), (0, -1), (-1, 0)] (x, y, i) = (0, 0, 0) for c in commands: ...
def normalize_formats(filepaths): pass def split_stereo(input_file, output_file_left, output_file_right): """Split a stereo file into separate mono files. Parameters ---------- input_file : str Path to stereo audio file. output_file_left : str Path to output of left channel. ...
def normalize_formats(filepaths): pass def split_stereo(input_file, output_file_left, output_file_right): """Split a stereo file into separate mono files. Parameters ---------- input_file : str Path to stereo audio file. output_file_left : str Path to output of left channel. ...
class SubTreeAlreadyExistsException(Exception): def __init__(self, key): super(SubTreeAlreadyExistsException, self).__init__(key)
class Subtreealreadyexistsexception(Exception): def __init__(self, key): super(SubTreeAlreadyExistsException, self).__init__(key)
# Class describing a pair of adjacent tiles # Used as index into walls map, cleaner than using a 4-tuple class AdjPair(object): def __init__(self, t1, t2): (x1,y1) = t1 (x2,y2) = t2 if x1 != x2 and y1 != y2: raise ValueError("Attempted to create a pair of tiles not adjacent to e...
class Adjpair(object): def __init__(self, t1, t2): (x1, y1) = t1 (x2, y2) = t2 if x1 != x2 and y1 != y2: raise value_error('Attempted to create a pair of tiles not adjacent to each other') if abs(x1 - x2) > 1 or abs(y1 - y2) > 1: raise value_error('Attempted ...
# https://leetcode.com/problems/triangle/ # Given a triangle array, return the minimum path sum from top to bottom. # For each step, you may move to an adjacent number of the row below. More # formally, if you are on index i on the current row, you may move to either index # i or index i + 1 on the next row. #######...
class Solution: def minimum_total(self, triangle: List[List[int]]) -> int: n_row = len(triangle) dp = triangle[-1] for row_idx in range(n_row - 2, -1, -1): for i in range(row_idx + 1): dp[i] = min(dp[i], dp[i + 1]) + triangle[row_idx][i] return dp[0]
with open("input.txt") as x: numbers, *bingo = x.read().split("\n\n") numbers = [int(num) for num in numbers.split(",")] boards = [[[int(v) for v in row.split()] for row in board.splitlines()] for board in bingo] def test_win(board: list[list[int]], called: list[int]) -> bool: cols = list(zip(*board))...
with open('input.txt') as x: (numbers, *bingo) = x.read().split('\n\n') numbers = [int(num) for num in numbers.split(',')] boards = [[[int(v) for v in row.split()] for row in board.splitlines()] for board in bingo] def test_win(board: list[list[int]], called: list[int]) -> bool: cols = list(zip(*board)...
class ParcryptProject: # Can be: # 'running' # 'done' # 'paused' def get_state(self): raise Exception('get_state() must be implemented by subclass') def get_type(self): raise Exception('get_type() must be implemented by subclass') def write_info(self): raise Exception('wr...
class Parcryptproject: def get_state(self): raise exception('get_state() must be implemented by subclass') def get_type(self): raise exception('get_type() must be implemented by subclass') def write_info(self): raise exception('write_info() must be implemented in subclass')
datafolder = "D:/Ahotsak/" awbuser = "DavidL_bot" with open(datafolder+'wikibase/DavidL_bot_pwd.txt', 'r', encoding='utf-8') as pwdfile: awbuserpass = pwdfile.read() # with open(datafolder+'zoteroapi/zotero_api_key.txt', 'r', encoding='utf-8') as pwdfile: # zotero_api_key = pwdfile.read() sparql_prefixes = """ PRE...
datafolder = 'D:/Ahotsak/' awbuser = 'DavidL_bot' with open(datafolder + 'wikibase/DavidL_bot_pwd.txt', 'r', encoding='utf-8') as pwdfile: awbuserpass = pwdfile.read() sparql_prefixes = '\nPREFIX awb: <http://datuak.ahotsak.eus/entity/>\nPREFIX adp: <http://datuak.ahotsak.eus/prop/direct/>\nPREFIX ap: <http://datua...
mc_version = "1.7.10" mc_file_md5 = "e6b7a531b95d0c172acb704d1f54d1b3" of_file_name = "1.7.10_HD_U_D1" of_json_name = "1.7.10_HD_U_D1" of_file_md5 = "57c724fe8335c82aef8d54c101043e60" minecrift_version_num = "1.7.10" minecrift_build = "jrbudda-40r12" of_file_extension = ".jar" mcp_version = "mcp908" mcp_uses_generics =...
mc_version = '1.7.10' mc_file_md5 = 'e6b7a531b95d0c172acb704d1f54d1b3' of_file_name = '1.7.10_HD_U_D1' of_json_name = '1.7.10_HD_U_D1' of_file_md5 = '57c724fe8335c82aef8d54c101043e60' minecrift_version_num = '1.7.10' minecrift_build = 'jrbudda-40r12' of_file_extension = '.jar' mcp_version = 'mcp908' mcp_uses_generics =...
class Solution: def judgeCircle(self, moves: str) -> bool: x = (moves.count('L') == moves.count('R')) y = (moves.count('U') == moves.count('D')) return x and y
class Solution: def judge_circle(self, moves: str) -> bool: x = moves.count('L') == moves.count('R') y = moves.count('U') == moves.count('D') return x and y
size = int(input('How many numbers do you want? ')) numbers = list() # [7, 15, 16, 1, 30, 29, 14, 15, 22, 37] aux, great = 0, 0 for _ in range(size): numbers.append(float(input(f'Type a number ({_ + 1} of {size}): '))) for _ in range(1, size): if numbers[_] > numbers[_ - 1]: aux += 1 if ...
size = int(input('How many numbers do you want? ')) numbers = list() (aux, great) = (0, 0) for _ in range(size): numbers.append(float(input(f'Type a number ({_ + 1} of {size}): '))) for _ in range(1, size): if numbers[_] > numbers[_ - 1]: aux += 1 if great < aux: great = aux + 1 ...
arr = [] c = 1 for i in range(1,1001): arr.append(c) c += i matrix = [] matrix.append(arr) k = 2 for i in range(2,1001): newarr = [] c = k for j in matrix[-1]: newarr.append(j + c) c += 1 matrix.append(newarr) k += 1 for t in range(int(input())): x1,y1,x2,y2 = map(...
arr = [] c = 1 for i in range(1, 1001): arr.append(c) c += i matrix = [] matrix.append(arr) k = 2 for i in range(2, 1001): newarr = [] c = k for j in matrix[-1]: newarr.append(j + c) c += 1 matrix.append(newarr) k += 1 for t in range(int(input())): (x1, y1, x2, y2) = map(...
class Solution: def numUniqueEmails(self, emails: List[str]) -> int: unique = set() for email in emails: [localname, domainname] = email.split("@") localname = "".join(localname.split("+")[0].split(".")) unique.add(localname+domainname) ...
class Solution: def num_unique_emails(self, emails: List[str]) -> int: unique = set() for email in emails: [localname, domainname] = email.split('@') localname = ''.join(localname.split('+')[0].split('.')) unique.add(localname + domainname) return len(uni...
def flatten_dict(dct: dict, parent_key: str = "", sep: str = ".") -> dict: """ Flatten a nested dictionary. Parameters ---------- dct : dict Dictionary to flatten. parent_key : str, default "" Parent key. sep : str, default "." Key separator. Examples ------...
def flatten_dict(dct: dict, parent_key: str='', sep: str='.') -> dict: """ Flatten a nested dictionary. Parameters ---------- dct : dict Dictionary to flatten. parent_key : str, default "" Parent key. sep : str, default "." Key separator. Examples -------- ...
"""MiniDna : an introduction to Bioinformatics MiniDna is a python project to discover the incredible world of Bioinformatics. This module provides some basic functions to compare, translate and study DNA sequences Author: Arthur Correnson Email: arthur.correnson@gmail.com (c) 2018 MiniDna may be ...
"""MiniDna : an introduction to Bioinformatics MiniDna is a python project to discover the incredible world of Bioinformatics. This module provides some basic functions to compare, translate and study DNA sequences Author: Arthur Correnson Email: arthur.correnson@gmail.com (c) 2018 MiniDna may be ...
def display_dict(dictionary: dict) -> None: """ Prints a dictionary line by line in console :param dictionary: dictionary to be displayed :return: None """ if isinstance(dictionary, dict): for text_info_component_key, text_info_component_value in dictionary.items(): if te...
def display_dict(dictionary: dict) -> None: """ Prints a dictionary line by line in console :param dictionary: dictionary to be displayed :return: None """ if isinstance(dictionary, dict): for (text_info_component_key, text_info_component_value) in dictionary.items(): if text...
# This file is a simple implementation of a Fraction class i made to help refresh my understanding of Python OOP # class Fraction: def __init__(self, top, bottom): self.num = top self.den= bottom def __str__(self): return str(self.num) + '/' + str(self.den) if __name__ == '__main__': ...
class Fraction: def __init__(self, top, bottom): self.num = top self.den = bottom def __str__(self): return str(self.num) + '/' + str(self.den) if __name__ == '__main__': my_frac = fraction(1, 4) print(f'I ate {myFrac} of the pizza we ordered last night.')
@dataclass class Astronaut: firstname: str lastname: str missions: list def __iadd__(self, other): self.missions.append(other) return self @dataclass class Mission: year: int name: str
@dataclass class Astronaut: firstname: str lastname: str missions: list def __iadd__(self, other): self.missions.append(other) return self @dataclass class Mission: year: int name: str
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def partition(self, head: ListNode, x: int) -> ListNode: assert isinstance(x, int) if not head: return b_head =...
class Solution: def partition(self, head: ListNode, x: int) -> ListNode: assert isinstance(x, int) if not head: return b_head = list_node(0) a_head = list_node(0) (a, b) = (a_head, b_head) while head: if head.val < x: b.next = ...
#HUGHXIE #slice.py #ORIGINAL LIST source = ["A","B","C","D","E","F","G","H","I","J"] #SLICE FUNCTION def slicelist(mylist,x,y): newlist = [] while True: #CHECKS IF VALUE IS ACCEPTABLE IN LIST if (x < 0) or ( x > (len(mylist))-1 ): break #CHECK IF VALUE IS ACCEPTABLE IN LIST...
source = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'] def slicelist(mylist, x, y): newlist = [] while True: if x < 0 or x > len(mylist) - 1: break if y < 0 or y > len(mylist) - 1: break for i in range(x, y + 1): newlist.append(mylist[i]) ...
class Solution: def largestNumber(self, nums: list[int]) -> str: for i in range(len(nums)): for j in range(len(nums)): num1, num2 = str(nums[i]), str(nums[j]) if num1 + num2 > num2 + num1: nums[i], nums[j] = nums[j], nums[i] result = '...
class Solution: def largest_number(self, nums: list[int]) -> str: for i in range(len(nums)): for j in range(len(nums)): (num1, num2) = (str(nums[i]), str(nums[j])) if num1 + num2 > num2 + num1: (nums[i], nums[j]) = (nums[j], nums[i]) r...
# -*- coding: utf-8 -*- # Copyright (c) 2020 shmilee hiddenimports = ['scipy.special.cython_special']
hiddenimports = ['scipy.special.cython_special']
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Oct 14 15:44:08 2020 @author: zuoxichen """ def main_args(a,b): if (a%b!=0): o=a//b+1 else: o=a//b return o a=input() list1=list(a.split(' ')) m=int(list1[0]) n=int(list1[1]) a=int(list1[2]) length=main_args(m, a) wide=main_a...
""" Created on Wed Oct 14 15:44:08 2020 @author: zuoxichen """ def main_args(a, b): if a % b != 0: o = a // b + 1 else: o = a // b return o a = input() list1 = list(a.split(' ')) m = int(list1[0]) n = int(list1[1]) a = int(list1[2]) length = main_args(m, a) wide = main_args(n, a) print(len...
def _tmpnam(): """Implementation of POSIX tmpnam() in list context""" ntf = tempfile.NamedTemporaryFile(delete=False) return (ntf, ntf.name)
def _tmpnam(): """Implementation of POSIX tmpnam() in list context""" ntf = tempfile.NamedTemporaryFile(delete=False) return (ntf, ntf.name)