content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# -*- coding: utf-8 -*- # pygada_runtime's package version information __version_major__ = "0.4" __version__ = "{}a".format(__version_major__) __version_long__ = "{}a".format(__version_major__) __status__ = "Alpha" __author__ = "Jeremy Morosi" __author_email__ = "jeremymorosi@hotmail.com" __url__ = "https://github.com...
__version_major__ = '0.4' __version__ = '{}a'.format(__version_major__) __version_long__ = '{}a'.format(__version_major__) __status__ = 'Alpha' __author__ = 'Jeremy Morosi' __author_email__ = 'jeremymorosi@hotmail.com' __url__ = 'https://github.com/gadalang/pygada-runtime'
# -*- coding: utf-8 -*- # Simple Bot (SimpBot) # Copyright 2016-2017, Ismael Lugo (kwargs) class channel: def __init__(self, channel_name): self.channel_name = channel_name self.maxstatus = False self.users = [] self.list = {} def __iter__(self): return iter(self.user...
class Channel: def __init__(self, channel_name): self.channel_name = channel_name self.maxstatus = False self.users = [] self.list = {} def __iter__(self): return iter(self.users) def __len__(self): return len(self.users) def append(self, user): ...
# iam configuration # HARDCODED !! CHANGE THIS !! trainset_file = '/media/ncsr/bee4cbda-e313-4acf-9bc8-817a69ad98ae/IAM/set_split/trainset.txt' testset_file = '/media/ncsr/bee4cbda-e313-4acf-9bc8-817a69ad98ae/IAM/set_split/testset.txt' line_file = '/media/ncsr/bee4cbda-e313-4acf-9bc8-817a69ad98ae/IAM/ascii/lines.txt...
trainset_file = '/media/ncsr/bee4cbda-e313-4acf-9bc8-817a69ad98ae/IAM/set_split/trainset.txt' testset_file = '/media/ncsr/bee4cbda-e313-4acf-9bc8-817a69ad98ae/IAM/set_split/testset.txt' line_file = '/media/ncsr/bee4cbda-e313-4acf-9bc8-817a69ad98ae/IAM/ascii/lines.txt' word_file = '/media/ncsr/bee4cbda-e313-4acf-9bc8-81...
# Time: O(m * n) # Space: O(m + n) class Solution(object): # @param dungeon, a list of lists of integers # @return a integer def calculateMinimumHP(self, dungeon): DP = [float("inf") for _ in dungeon[0]] DP[-1] = 1 for i in reversed(xrange(len(dungeon))): DP...
class Solution(object): def calculate_minimum_hp(self, dungeon): dp = [float('inf') for _ in dungeon[0]] DP[-1] = 1 for i in reversed(xrange(len(dungeon))): DP[-1] = max(DP[-1] - dungeon[i][-1], 1) for j in reversed(xrange(len(dungeon[i]) - 1)): min_h...
# Find the kth largest element in an unsorted array. This will be the kth # largest element in sorted order, not the kth distinct element. def kthLargestElement(nums, k): nums.sort() return nums[-k]
def kth_largest_element(nums, k): nums.sort() return nums[-k]
# VIOLET: We do not have 'traceback' module # import traceback a = 2 b = 2 + 4 if a < 5 else 'boe' assert b == 6 c = 2 + 4 if a > 5 else 'boe' assert c == 'boe' d = lambda x, y: x > y assert d(5, 4) e = lambda x: 1 if x else 0 assert e(True) == 1 assert e(False) == 0 try: a = "aaaa" + \ "bbbb" 1/0 except ZeroDi...
a = 2 b = 2 + 4 if a < 5 else 'boe' assert b == 6 c = 2 + 4 if a > 5 else 'boe' assert c == 'boe' d = lambda x, y: x > y assert d(5, 4) e = lambda x: 1 if x else 0 assert e(True) == 1 assert e(False) == 0 try: a = 'aaaa' + 'bbbb' 1 / 0 except ZeroDivisionError as ex: tb = ex.__traceback__ assert tb.tb_l...
#credit: freecodecamp Youtube Channel class Question: def __init__ (self, prompt, answer): self.prompt = prompt self.answer = answer
class Question: def __init__(self, prompt, answer): self.prompt = prompt self.answer = answer
class Solution: def maximum69Number (self, num: int) -> int: num = [n for n in str(num)] for i, n in enumerate(num): if n == '6': num[i] = '9' break return int(''.join(num))
class Solution: def maximum69_number(self, num: int) -> int: num = [n for n in str(num)] for (i, n) in enumerate(num): if n == '6': num[i] = '9' break return int(''.join(num))
# good example of using map # from kata here # https://www.codewars.com/kata/beginner-lost-without-a-map def maps(a): return list(map(lambda x: x * 2, a))
def maps(a): return list(map(lambda x: x * 2, a))
h,w,*hw = open(0).read().split() h=int(h) w=int(w) e=h+w-1 a=sum([l.count('#') for l in hw]) if e==a: print('Possible') else: print('Impossible')
(h, w, *hw) = open(0).read().split() h = int(h) w = int(w) e = h + w - 1 a = sum([l.count('#') for l in hw]) if e == a: print('Possible') else: print('Impossible')
for i in range(1,11,1): print(i) # limit=int(input('Enter the limit:')) # sum=0 # for i in range(1,limit+1,1): # print(i) # sum=sum+i # print("sum of numbers:",sum) # for i in range(11,10,1): # if(i==5): # continue # print(i) # else: # print("Hello")
for i in range(1, 11, 1): print(i)
for _ in range(int(input())): n = int(input()) l = list(map(int,input().split())) l.sort() print(l[0]+l[1])
for _ in range(int(input())): n = int(input()) l = list(map(int, input().split())) l.sort() print(l[0] + l[1])
def kvadrat(x): return x**2 + 1 def test_kvadrat(): assert kvadrat(2) == 4
def kvadrat(x): return x ** 2 + 1 def test_kvadrat(): assert kvadrat(2) == 4
#!/usr/bin/env python3 # terminal input: 1 def read_value(pc, prog, mode): if mode == 0: return prog[prog[pc]] elif mode == 1: return prog[pc] else: raise Exception("unknown mode: %d" % mode) def write_value(pc, prog, mode, value): if mode != 0: raise Exception("only...
def read_value(pc, prog, mode): if mode == 0: return prog[prog[pc]] elif mode == 1: return prog[pc] else: raise exception('unknown mode: %d' % mode) def write_value(pc, prog, mode, value): if mode != 0: raise exception('only position mode for writes: %d' % mode) prog...
fig, axs = plt.subplots(3, sharex=True, gridspec_kw={'hspace': 0}) axs[0].plot(ffp, 10*np.log10(Pxp)) axs[0].set_ylim([-80, 25]) axs[0].set_xlim([-0.2, 0.2]) axs[1].plot(ffn, 10*np.log10(Pxn)) axs[1].set_ylim([-80, 25]) axs[1].set_ylabel('Power Spectral Density (dB/Hz)') axs[2].plot(ff_out, 10*np.log10(Px_out)) axs[...
(fig, axs) = plt.subplots(3, sharex=True, gridspec_kw={'hspace': 0}) axs[0].plot(ffp, 10 * np.log10(Pxp)) axs[0].set_ylim([-80, 25]) axs[0].set_xlim([-0.2, 0.2]) axs[1].plot(ffn, 10 * np.log10(Pxn)) axs[1].set_ylim([-80, 25]) axs[1].set_ylabel('Power Spectral Density (dB/Hz)') axs[2].plot(ff_out, 10 * np.log10(Px_out))...
#input vertices are defined here inputs = [[22, 6], [20, 11], [18, 6], [16, 5], [15, 8], [20, 13], [18, 15],\ [15, 13], [13, 8], [9, 13], [3, 9], [6, 2], [6, 5], [11, 6], [16, 1]] x_p = [] y_p = [] x = 0 y = 1 px = input("Enter point x: ") py = input("Enter point y: ") crossing = 0 ranges = range(0, len(inputs)) size =...
inputs = [[22, 6], [20, 11], [18, 6], [16, 5], [15, 8], [20, 13], [18, 15], [15, 13], [13, 8], [9, 13], [3, 9], [6, 2], [6, 5], [11, 6], [16, 1]] x_p = [] y_p = [] x = 0 y = 1 px = input('Enter point x: ') py = input('Enter point y: ') crossing = 0 ranges = range(0, len(inputs)) size = len(inputs) for i in ranges: ...
a,b,x=map(int,input().split()) l=0 r=10**9+1 ans=10**9 while r-l>=2: n1=l+(r-l)//2 n2=n1+1 p1=a*n1+b*len(str(n1)) p2=a*n2+b*len(str(n2)) if p1 <= x < p2: ans=n1 break elif p1 < x: l=n1 else: r=n1 if p1>x: print(0) else: print(ans)
(a, b, x) = map(int, input().split()) l = 0 r = 10 ** 9 + 1 ans = 10 ** 9 while r - l >= 2: n1 = l + (r - l) // 2 n2 = n1 + 1 p1 = a * n1 + b * len(str(n1)) p2 = a * n2 + b * len(str(n2)) if p1 <= x < p2: ans = n1 break elif p1 < x: l = n1 else: r = n1 if p1 >...
''' An implementation of the `Annotation store API <http://docs.annotatorjs.org/en/v1.2.x/storage.html.>`_ for `Annotator.js <http://annotatorjs.org/>`_. '''
""" An implementation of the `Annotation store API <http://docs.annotatorjs.org/en/v1.2.x/storage.html.>`_ for `Annotator.js <http://annotatorjs.org/>`_. """
# GENERATED VERSION FILE # TIME: Wed Aug 26 17:17:32 2020 __version__ = '0.0.0rc0+unknown' short_version = '0.0.0rc0'
__version__ = '0.0.0rc0+unknown' short_version = '0.0.0rc0'
class AllResponses: def __init__(self, identifier, query_title, project_id=None, query_id=None): self.id = identifier self.scopus_abstract_retrieval = None self.unpaywall_response = None self.altmetric_response = None self.scival_data = None self.query_title = query_...
class Allresponses: def __init__(self, identifier, query_title, project_id=None, query_id=None): self.id = identifier self.scopus_abstract_retrieval = None self.unpaywall_response = None self.altmetric_response = None self.scival_data = None self.query_title = query_...
def rotate_index(arr, k, src_ind, src_num, count=0): if count == len(arr): return des_ind = (src_ind + k) % len(arr) des_num = arr[des_ind] arr[des_ind] = src_num rotate_index(arr, k, des_ind, des_num, count + 1) def rotate_k(arr, k): if k < 1: return arr start = 0 ...
def rotate_index(arr, k, src_ind, src_num, count=0): if count == len(arr): return des_ind = (src_ind + k) % len(arr) des_num = arr[des_ind] arr[des_ind] = src_num rotate_index(arr, k, des_ind, des_num, count + 1) def rotate_k(arr, k): if k < 1: return arr start = 0 rotat...
# Grace Foster # ITP 100-01 # EXERCISE: 06 # ageclass.py # ---------------------------------------------------------------- print("Age Classification program") print("-----------------------------------------------") age = 1 while age > 0: age = float(input(f"Enter the age: ")) if age != 0: if age ...
print('Age Classification program') print('-----------------------------------------------') age = 1 while age > 0: age = float(input(f'Enter the age: ')) if age != 0: if age <= 1: print('This person is an Infant') elif 2 <= age <= 13: print('This person is a Child') ...
class InadequateArgsCombination(Exception): pass
class Inadequateargscombination(Exception): pass
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # 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...
__all__ = ('AdAssetPolicySummary', 'AdImageAsset', 'AdMediaBundleAsset', 'AdScheduleInfo', 'AdTextAsset', 'AdVideoAsset', 'AddressInfo', 'AffiliateLocationFeedItem', 'AgeRangeInfo', 'AppAdInfo', 'AppEngagementAdInfo', 'AppFeedItem', 'AppPaymentModelInfo', 'AssetInteractionTarget', 'BasicUserListInfo', 'BidModifierSimul...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def levelOrderBottom(self, root: TreeNode): result, level = [], [root] while root and level: result.append([n.val for n...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def level_order_bottom(self, root: TreeNode): (result, level) = ([], [root]) while root and level: result.append([n.val for n in level]) level...
# Demonstration of basic Python functions beginning on page 16 # # Basic addition x =44+11*4-6/11 print(x) m = 60*24*7 print("Number of minutes in a week: ", m) times = 2304811//47 #Integer division remainder = 2304811 - (times*47) print("Remainder of 2304811 divided by 47 without using modulo: ", remainder) print(2...
x = 44 + 11 * 4 - 6 / 11 print(x) m = 60 * 24 * 7 print('Number of minutes in a week: ', m) times = 2304811 // 47 remainder = 2304811 - times * 47 print('Remainder of 2304811 divided by 47 without using modulo: ', remainder) print(2304811 % 47) print(5 == 4) print(4 == 4) print(True and (not 5 == 4)) x = -9 y = 1 / 2 v...
class Bridge: __ipaddress = None __username = None def __init__(self): pass def discover_bridges(self): pass
class Bridge: __ipaddress = None __username = None def __init__(self): pass def discover_bridges(self): pass
# # PySNMP MIB module SONUS-REDUNDANCY-SERVICES-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SONUS-REDUNDANCY-SERVICES-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:02:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ve...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, constraints_intersection, value_size_constraint) ...
def TSMC_Tech_Map(depth, width) -> dict: ''' Currently returns the tech map for the single port SRAM, but we can procedurally generate different tech maps ''' ports = [] single_port = { 'data_in': 'D', 'addr': 'A', 'write_enable': 'WEB', 'cen': 'CEB', 'cl...
def tsmc__tech__map(depth, width) -> dict: """ Currently returns the tech map for the single port SRAM, but we can procedurally generate different tech maps """ ports = [] single_port = {'data_in': 'D', 'addr': 'A', 'write_enable': 'WEB', 'cen': 'CEB', 'clk': 'CLK', 'data_out': 'Q', 'alt_sigs': ...
# A simple while loop example user_input = input('Hey how are you ') while user_input != 'stop copying me': print(user_input) user_input = input() else: print('UGHH Fine')
user_input = input('Hey how are you ') while user_input != 'stop copying me': print(user_input) user_input = input() else: print('UGHH Fine')
# # PySNMP MIB module ALCATEL-IND1-ISIS-SPB-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-ISIS-SPB-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:18:13 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
(routing_ind1_isis_spb,) = mibBuilder.importSymbols('ALCATEL-IND1-BASE', 'routingIND1IsisSpb') (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, sin...
# # @lc app=leetcode.cn id=236 lang=python3 # # [236] lowest-common-ancestor-of-a-binary-tree # None # @lc code=end
None
#!/usr/bin/env python3 CI_CONFIG = { "build_config": [ { "compiler": "clang-13", "build_type": "", "sanitizer": "", "package_type": "deb", "bundled": "bundled", "splitted": "unsplitted", "alien_pkgs": True, "tid...
ci_config = {'build_config': [{'compiler': 'clang-13', 'build_type': '', 'sanitizer': '', 'package_type': 'deb', 'bundled': 'bundled', 'splitted': 'unsplitted', 'alien_pkgs': True, 'tidy': 'disable', 'with_coverage': False}, {'compiler': 'clang-13', 'build_type': '', 'sanitizer': '', 'package_type': 'performance', 'bun...
# import pytest class TestTime: def test___str__(self): # synced assert True def test_shift(self): # synced assert True def test_to_isoformat(self): # synced assert True def test_to_format(self): # synced assert True def test_now(self): # synced ass...
class Testtime: def test___str__(self): assert True def test_shift(self): assert True def test_to_isoformat(self): assert True def test_to_format(self): assert True def test_now(self): assert True def test_from_time(self): assert True de...
def main(): data = open("day9/input.txt", "r") data = [int(line.strip()) for line in data] answer = 0 for i in range(25, len(data)): value = data[i] found = False spliced_data = data[i - 25 : i] for num in spliced_data: num2 = value - num if num2 ...
def main(): data = open('day9/input.txt', 'r') data = [int(line.strip()) for line in data] answer = 0 for i in range(25, len(data)): value = data[i] found = False spliced_data = data[i - 25:i] for num in spliced_data: num2 = value - num if num2 in ...
# # PySNMP MIB module BSUCLK-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BSUCLK-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:41:36 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:...
(bsu,) = mibBuilder.importSymbols('ANIROOT-MIB', 'bsu') (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, single_value_con...
# # @lc app=leetcode id=557 lang=python3 # # [557] Reverse Words in a String III # # https://leetcode.com/problems/reverse-words-in-a-string-iii/description/ # # algorithms # Easy (66.26%) # Likes: 778 # Dislikes: 80 # Total Accepted: 166.2K # Total Submissions: 248.5K # Testcase Example: `"Let's take LeetCode c...
class Solution: def reverse_words(self, s: str) -> str: lst = s.split(' ') return ' '.join([w[::-1] for w in lst])
dvs = [] for i in range(9): dvs.append(int(input())) for i in dvs: for j in dvs: if i != j and i + j == sum(dvs) - 100: dvs.remove(i) dvs.remove(j) break print(*dvs)
dvs = [] for i in range(9): dvs.append(int(input())) for i in dvs: for j in dvs: if i != j and i + j == sum(dvs) - 100: dvs.remove(i) dvs.remove(j) break print(*dvs)
def put(data,location): f = open(location,"w") for i in data: f.write(i+"\n\n--------------====================--------------\n\n") f.close()
def put(data, location): f = open(location, 'w') for i in data: f.write(i + '\n\n--------------====================--------------\n\n') f.close()
def main(): print(not 1) if __name__ == "__main__": main()
def main(): print(not 1) if __name__ == '__main__': main()
#!/usr/bin/python3 magic = [0x47, 0xCD, 0x40, 0xC6, 0x7A, 0xD9, 0x45, 0xD9, 0x45, 0xAF, 0x2F, 0xAF, 0x50, 0xC0, 0x50, 0xFC] x = 1 for i in magic: print(chr(i ^ x), end = '') x ^= 0x80
magic = [71, 205, 64, 198, 122, 217, 69, 217, 69, 175, 47, 175, 80, 192, 80, 252] x = 1 for i in magic: print(chr(i ^ x), end='') x ^= 128
DATA = [ '210.153.84.0/24', '210.136.161.0/24', '210.153.86.0/24', '124.146.174.0/24', '124.146.175.0/24', '202.229.176.0/24', '202.229.177.0/24', '202.229.178.0/24']
data = ['210.153.84.0/24', '210.136.161.0/24', '210.153.86.0/24', '124.146.174.0/24', '124.146.175.0/24', '202.229.176.0/24', '202.229.177.0/24', '202.229.178.0/24']
''' In order to get the Learn credentials, they do not to open a case on behind the blackboard nor email developers@blackboard.com. They need to go to developer.blackboard.com and register from there to grab the Learn credentials for their application, it is also imperative to remind them that they are creating an app...
""" In order to get the Learn credentials, they do not to open a case on behind the blackboard nor email developers@blackboard.com. They need to go to developer.blackboard.com and register from there to grab the Learn credentials for their application, it is also imperative to remind them that they are creating an app...
#!/usr/bin/env python class Bee: def __init__(self, bee_id, tag_id, length_tracked): self.bee_id = bee_id self.tag_id = tag_id self.length_tracked = length_tracked self.last_path_id = None self.path_length = None self.last_x = None self.last_y = None ...
class Bee: def __init__(self, bee_id, tag_id, length_tracked): self.bee_id = bee_id self.tag_id = tag_id self.length_tracked = length_tracked self.last_path_id = None self.path_length = None self.last_x = None self.last_y = None self.list_speeds = [] ...
good_ops = {'+': '-', '-': '+', '=<': '==', '>=': '==', '==': '=/=', '=/=': '==', '<':'>', '>': '<'} def count(ast): if ast.expr_name == "binary_operator": return 1 if ast.text in good_ops else 0 if ast.children: return sum(map(count, ast.children)) return 0 def inverse(number,...
good_ops = {'+': '-', '-': '+', '=<': '==', '>=': '==', '==': '=/=', '=/=': '==', '<': '>', '>': '<'} def count(ast): if ast.expr_name == 'binary_operator': return 1 if ast.text in good_ops else 0 if ast.children: return sum(map(count, ast.children)) return 0 def inverse(number, ast, filen...
''' The MIT License(MIT) Copyright(c) 2016 Copyleaks LTD (https://copyleaks.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights ...
""" The MIT License(MIT) Copyright(c) 2016 Copyleaks LTD (https://copyleaks.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights ...
#suma de dos digitos print(1+2) #multiplicacion de dos digitos print (3*4) #division de dos digitos print(3/2) #division estricta, sin decimales, de dos digitos print(81//2) #Potencia de un digito print(3**2)
print(1 + 2) print(3 * 4) print(3 / 2) print(81 // 2) print(3 ** 2)
class Player: VERSION = "fuck" def betRequest(self, game_state): return 10000000 def showdown(self, game_state): pass
class Player: version = 'fuck' def bet_request(self, game_state): return 10000000 def showdown(self, game_state): pass
class WL(object): def __init__(self,data=None): if data: self.id = data['id'] self.title = data['title'] self.created_at = data['created_at'] def get_id(self): return self.id def get_title(self): return self.title def get_cre...
class Wl(object): def __init__(self, data=None): if data: self.id = data['id'] self.title = data['title'] self.created_at = data['created_at'] def get_id(self): return self.id def get_title(self): return self.title def get_created_at(self):...
# Title: Array Partition 1 # Link: https://leetcode.com/problems/array-partition-i/ class Solution: def array_pair_sum(self, nums: list) -> int: nums = sorted(nums) s = 0 for i in range(0, len(nums), 2): s += nums[i] return s def solution(): nums = [1,4,3,2] ...
class Solution: def array_pair_sum(self, nums: list) -> int: nums = sorted(nums) s = 0 for i in range(0, len(nums), 2): s += nums[i] return s def solution(): nums = [1, 4, 3, 2] sol = solution() return sol.array_pair_sum(nums) def main(): print(solution...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def swapPairs(self, head: ListNode) -> ListNode: pre, pre.next = self, head while pre.next and pre.next.next: a = pre.next b ...
class Solution: def swap_pairs(self, head: ListNode) -> ListNode: (pre, pre.next) = (self, head) while pre.next and pre.next.next: a = pre.next b = a.next (pre.next, b.next, a.next) = (b, a, b.next) pre = a return self.next
#!/usr/bin/env python3 passphrases = [] try: while True: passphrases.append(input()) except EOFError: pass s1 = 0 for passphrase in passphrases: words = set() for word in passphrase.split(): if word in words: break words.add(word) else: s1 += 1 s2=0 fo...
passphrases = [] try: while True: passphrases.append(input()) except EOFError: pass s1 = 0 for passphrase in passphrases: words = set() for word in passphrase.split(): if word in words: break words.add(word) else: s1 += 1 s2 = 0 for passphrase in passphras...
a3 = int(input("a3=")) a2 = int(input("a2=")) a1 = int(input("a1=")) b2 = int(input("b2=")) b1 = int(input("b1=")) c3 = a3 c2 = a2 + b2 c1 = a1 + b1 print("????? ????? ?????: {0} {1} {2}. ".format(c3 , c2 , c1))
a3 = int(input('a3=')) a2 = int(input('a2=')) a1 = int(input('a1=')) b2 = int(input('b2=')) b1 = int(input('b1=')) c3 = a3 c2 = a2 + b2 c1 = a1 + b1 print('????? ????? ?????: {0} {1} {2}. '.format(c3, c2, c1))
def main(filepath): #file input with open(filepath) as file: rows = [x.strip().split("contain") for x in file.readlines()] #####---start of input parsing---##### #hash = {bag: list of contained bags} #numberhash = {bag: list of cardinalities of contained bags} #numberhash maps o...
def main(filepath): with open(filepath) as file: rows = [x.strip().split('contain') for x in file.readlines()] numbershash = {} for i in range(len(rows)): rows[i][0] = rows[i][0].split(' bags')[0] rows[i][1] = rows[i][1].split(',') numbershash[rows[i][0]] = [] for j i...
class TaskException(Exception): def __init__(self, message): self.message = message class TaskDelayResource(TaskException): def __init__(self, message=None, resource=None, delay=60*60): self.message = message self.resource = resource self.delay = delay class TaskError(TaskExcep...
class Taskexception(Exception): def __init__(self, message): self.message = message class Taskdelayresource(TaskException): def __init__(self, message=None, resource=None, delay=60 * 60): self.message = message self.resource = resource self.delay = delay class Taskerror(TaskE...
def sum_triangular_numbers(n): sum_trian = 0 if n < 0: return 0 for i in range(n+1): sum_trian += i*(i+1) // 2 return sum_trian print(sum_triangular_numbers(4))
def sum_triangular_numbers(n): sum_trian = 0 if n < 0: return 0 for i in range(n + 1): sum_trian += i * (i + 1) // 2 return sum_trian print(sum_triangular_numbers(4))
class Cat: def __init__(self, name): self.name = name self.fed = False self.sleepy = False self.size = 0 def eat(self): if self.fed: raise Exception('Already fed.') self.fed = True self.sleepy = True self.size += 1 def sleep(self): if not self.fed: raise Excepti...
class Cat: def __init__(self, name): self.name = name self.fed = False self.sleepy = False self.size = 0 def eat(self): if self.fed: raise exception('Already fed.') self.fed = True self.sleepy = True self.size += 1 def sleep(self...
#!/usr/bin/env python # -*- coding: utf-8 -*- class VolatileCookie(dict): def __reduce__(self): return (VolatileCookie.__new__, (VolatileCookie,)) def __deepcopy__(self, memo): '''Deep copy of a volatile cookie is intentionally nullified.''' return type(self)()
class Volatilecookie(dict): def __reduce__(self): return (VolatileCookie.__new__, (VolatileCookie,)) def __deepcopy__(self, memo): """Deep copy of a volatile cookie is intentionally nullified.""" return type(self)()
# -*- coding: UTF-8 -*- defaults = dict( BACKEND='django_datawatch.backends.synchronous', RUN_SIGNALS=True, SHOW_ADMIN_DEBUG=True)
defaults = dict(BACKEND='django_datawatch.backends.synchronous', RUN_SIGNALS=True, SHOW_ADMIN_DEBUG=True)
"These are constants used for Toolbox testing." # 'name', 'state', 'end_user_registration_required', 'backend_version', # 'deployment_option', 'buyer_can_select_plan', # 'buyer_key_regenerate_enabled', 'buyer_plan_change_permission', # 'buyers_manage_apps', 'buyers_manage_keys', 'custom_keys_enabled','intentions_requi...
"""These are constants used for Toolbox testing.""" service_cmp_attrs = {'created_at', 'id', 'links', 'system_name', 'support_email', 'updated_at'} proxy_config_content_cmp_attrs = {'account_id', 'backend_authentication_value', 'created_at', 'id', 'proxy', 'support_email', 'tenant_id', 'updated_at'} proxy_config_conten...
code_to_state = { 'AK': {'name': 'ALASKA', 'fips': '02'}, 'AL': {'name': 'ALABAMA', 'fips': '01'}, 'AR': {'name': 'ARKANSAS', 'fips': '05'}, 'AS': {'name': 'AMERICAN SAMOA', 'fips': '60'}, 'AZ': {'name': 'ARIZONA', 'fips': '04'}, 'CA': {'name': 'CALIFORNIA', 'fips': '06'}, 'CO': {'name': 'CO...
code_to_state = {'AK': {'name': 'ALASKA', 'fips': '02'}, 'AL': {'name': 'ALABAMA', 'fips': '01'}, 'AR': {'name': 'ARKANSAS', 'fips': '05'}, 'AS': {'name': 'AMERICAN SAMOA', 'fips': '60'}, 'AZ': {'name': 'ARIZONA', 'fips': '04'}, 'CA': {'name': 'CALIFORNIA', 'fips': '06'}, 'CO': {'name': 'COLORADO', 'fips': '08'}, 'CT':...
class TestGames(object): def __init__(self, game_id): self.game_id = game_id @classmethod def create(self, game_id, highScoreNames=None, maxEntries=None, onlyKeepBestEntry=None, socialNetwork=None): return True @classmethod def delete(self, game_id): return ...
class Testgames(object): def __init__(self, game_id): self.game_id = game_id @classmethod def create(self, game_id, highScoreNames=None, maxEntries=None, onlyKeepBestEntry=None, socialNetwork=None): return True @classmethod def delete(self, game_id): return True def g...
# Copyright (c) 2021 by Cisco Systems, Inc. # All rights reserved. expected_output = { 'evi': { 1: { 'bd_id': { 11: { 'eth_tag': { 0 : { 'mac_addr':{ '0050.56a9.f5af': { ...
expected_output = {'evi': {1: {'bd_id': {11: {'eth_tag': {0: {'mac_addr': {'0050.56a9.f5af': {'esi': '0000.0000.0000.0000.0000', 'next_hops': ['11.11.11.2']}, 'b4a8.b902.32d6': {'esi': '0000.0000.0000.0000.0000', 'next_hops': ['Gi1/0/3:11']}}}}}}}}}
# Copyright 2016-2022 Swiss National Supercomputing Centre (CSCS/ETH Zurich) # ReFrame Project Developers. See the top-level LICENSE file for details. # # SPDX-License-Identifier: BSD-3-Clause # # Hooks specific to the CSCS GPU microbenchmark tests. # def set_gpu_arch(self): '''Set the compile options for the gp...
def set_gpu_arch(self): """Set the compile options for the gpu microbenchmarks.""" cs = self.current_system.name cp = self.current_partition.fullname self.gpu_arch = None self.gpu_build = 'cuda' if cs in {'dom', 'daint'}: self.gpu_arch = '60' if self.current_environ.name not in {...
HTML_VOID_TAGS = [ 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr', ] HTML_TAGS = [ 'a', 'address', 'applet', 'area', 'article', 'aside', 'b', 'base', ...
html_void_tags = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'] html_tags = ['a', 'address', 'applet', 'area', 'article', 'aside', 'b', 'base', 'basefont', 'bgsound', 'big', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'code', 'c...
#!/usr/bin/env python # -*- coding: UTF-8 -*- # https://docs.python.org/3/library/functions.html#bool # https://docs.python.org/3/library/stdtypes.html#truth # class bool([x]) # Return a Boolean value, i.e. one of True or False. def test1(): print(bool(0)) print(bool(0.0)) print(bool('')) print(bo...
def test1(): print(bool(0)) print(bool(0.0)) print(bool('')) print(bool(None)) print(bool([])) print(bool({})) print(bool(())) print(bool(set())) print(bool(range(0))) print(bool(False)) def test2(): print(bool(100)) print(bool(100.99)) print(bool('huangjian')) p...
#!/usr/bin/env python3 # 7.1 Interconvert Strings and Integers # Implement the atoi and itoa functions. def atoi(s): sum = 0 for c in s: ordc = ord(c) if 0x30 <= ordc <= 0x39: n = ordc - 0x30 sum = (sum * 10) + n if sum > 0 and s[0] == '-': sum *= -1 ...
def atoi(s): sum = 0 for c in s: ordc = ord(c) if 48 <= ordc <= 57: n = ordc - 48 sum = sum * 10 + n if sum > 0 and s[0] == '-': sum *= -1 return sum def itoa(i): if i == 0: return '0' rstr = '' neg = i < 0 i = abs(i) while i >...
class DragoneyeException(Exception): def __init__(self, message, error: str = None): super().__init__(message) self.error: str = error
class Dragoneyeexception(Exception): def __init__(self, message, error: str=None): super().__init__(message) self.error: str = error
pkgname = "bsdpatch" pkgver = "0.99.1" pkgrel = 0 build_style = "makefile" pkgdesc = "FreeBSD patch(1) utility" maintainer = "q66 <q66@chimera-linux.org>" license = "BSD-2-Clause" url = "https://github.com/chimera-linux/bsdpatch" source = f"https://github.com/chimera-linux/bsdpatch/archive/refs/tags/v{pkgver}.tar.gz" s...
pkgname = 'bsdpatch' pkgver = '0.99.1' pkgrel = 0 build_style = 'makefile' pkgdesc = 'FreeBSD patch(1) utility' maintainer = 'q66 <q66@chimera-linux.org>' license = 'BSD-2-Clause' url = 'https://github.com/chimera-linux/bsdpatch' source = f'https://github.com/chimera-linux/bsdpatch/archive/refs/tags/v{pkgver}.tar.gz' s...
class TestFlow: def __init__(self, perceive, act, observe): self.perceive = perceive self.act = act self.observe = observe def __str__(self): output = "" if self.perceive and len(self.perceive) > 0: output += str(self.perceive) if self.act and len(s...
class Testflow: def __init__(self, perceive, act, observe): self.perceive = perceive self.act = act self.observe = observe def __str__(self): output = '' if self.perceive and len(self.perceive) > 0: output += str(self.perceive) if self.act and len(se...
objname = "" subobj = 0 faces = 0 with open("model.obj",'r') as openfileobject: lines = 0 for line in openfileobject: lines = lines+1 if 'f' in line: faces = faces+1 if 'o' in line: subobj = 0 faces = 0 name = line.strip() name = name.strip('o') objname = name #print(name) if 'usemtl' i...
objname = '' subobj = 0 faces = 0 with open('model.obj', 'r') as openfileobject: lines = 0 for line in openfileobject: lines = lines + 1 if 'f' in line: faces = faces + 1 if 'o' in line: subobj = 0 faces = 0 name = line.strip() ...
INSTALLED_APPS = ["athanor_job"] GLOBAL_SCRIPTS = dict() GLOBAL_SCRIPTS['job'] = { 'typeclass': 'athanor_job.controllers.AthanorJobManager', 'repeats': -1, 'interval': 60, 'desc': 'Job API for Job System', 'locks': "admin:perm(Admin)", }
installed_apps = ['athanor_job'] global_scripts = dict() GLOBAL_SCRIPTS['job'] = {'typeclass': 'athanor_job.controllers.AthanorJobManager', 'repeats': -1, 'interval': 60, 'desc': 'Job API for Job System', 'locks': 'admin:perm(Admin)'}
def convertTimeToReqStr(timeObj): dateStr = timeObj.strftime('%d/%m/%Y') timeStr = "{0}/{1}:{2}:00".format(dateStr, makeTwoDigits( timeObj.hour), makeTwoDigits(timeObj.minute)) return timeStr def makeTwoDigits(num): if(num < 10): return "0"+str(num) return num
def convert_time_to_req_str(timeObj): date_str = timeObj.strftime('%d/%m/%Y') time_str = '{0}/{1}:{2}:00'.format(dateStr, make_two_digits(timeObj.hour), make_two_digits(timeObj.minute)) return timeStr def make_two_digits(num): if num < 10: return '0' + str(num) return num
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def deleteDuplicates(self, head: ListNode) -> ListNode: pointer = head while pointer and pointer.next: if pointer.val == ...
class Solution: def delete_duplicates(self, head: ListNode) -> ListNode: pointer = head while pointer and pointer.next: if pointer.val == pointer.next.val: pointer.next = pointer.next.next else: pointer = pointer.next return head
# -*- coding: utf-8 -*- ''' Author: Hannibal Data: Desc: local data config NOTE: Don't modify this file, it's build by xml-to-python!!! ''' buffinfo_map = {}; buffinfo_map[1] = {"id":1,"aid":30003,"icon":0,}; buffinfo_map[201] = {"id":201,"aid":30001,"icon":201,}; buffinfo_map[202] = {"id":202,"aid":30002,"icon":20...
""" Author: Hannibal Data: Desc: local data config NOTE: Don't modify this file, it's build by xml-to-python!!! """ buffinfo_map = {} buffinfo_map[1] = {'id': 1, 'aid': 30003, 'icon': 0} buffinfo_map[201] = {'id': 201, 'aid': 30001, 'icon': 201} buffinfo_map[202] = {'id': 202, 'aid': 30002, 'icon': 202} buffinfo_map[1...
def dict2keys(d=dict()): return sorted(d.keys()) def dict2kvpairs(d=dict(), d2k=dict2keys): return map(lambda k: (k, d[k]), d2k(d)) def dict2str(d=dict(), s1=":", s2=";", d2k=dict2keys): return s2.join( map( lambda t: s1.join(map(str, t)), dict2kvpairs(d, d2k) ) ) def dict2csv(d=dict(), c=",", d2k=dict2k...
def dict2keys(d=dict()): return sorted(d.keys()) def dict2kvpairs(d=dict(), d2k=dict2keys): return map(lambda k: (k, d[k]), d2k(d)) def dict2str(d=dict(), s1=':', s2=';', d2k=dict2keys): return s2.join(map(lambda t: s1.join(map(str, t)), dict2kvpairs(d, d2k))) def dict2csv(d=dict(), c=',', d2k=dict2keys)...
X = int(input()) Y = float(input()) consumo = X / Y print("%.3f km/l" %consumo)
x = int(input()) y = float(input()) consumo = X / Y print('%.3f km/l' % consumo)
valor = float(input("Digite o valor do premio:")) imposto = valor- 7/100 valornovo = valor - imposto primeiro= valornovo * 46/100 segundo = valornovo * 32/100 terceiro = valornovo - (primeiro + segundo) print("o Premio foi de r$ {}, o valor desconto ficou R$ {} o imposto ficou R$ {}".format(valor, valornovo, imposto)) ...
valor = float(input('Digite o valor do premio:')) imposto = valor - 7 / 100 valornovo = valor - imposto primeiro = valornovo * 46 / 100 segundo = valornovo * 32 / 100 terceiro = valornovo - (primeiro + segundo) print('o Premio foi de r$ {}, o valor desconto ficou R$ {} o imposto ficou R$ {}'.format(valor, valornovo, im...
pkgname = "libnma" pkgver = "1.8.38" pkgrel = 0 build_style = "meson" configure_args = [ "-Dgtk_doc=false", "-Dlibnma_gtk4=true", ] hostmakedepends = [ "meson", "pkgconf", "gobject-introspection", "vala", "glib-devel", "gettext-tiny", ] makedepends = [ "networkmanager-devel", "gcr-devel", "gtk+3-devel",...
pkgname = 'libnma' pkgver = '1.8.38' pkgrel = 0 build_style = 'meson' configure_args = ['-Dgtk_doc=false', '-Dlibnma_gtk4=true'] hostmakedepends = ['meson', 'pkgconf', 'gobject-introspection', 'vala', 'glib-devel', 'gettext-tiny'] makedepends = ['networkmanager-devel', 'gcr-devel', 'gtk+3-devel', 'gtk4-devel', 'mobile-...
class Settings(): def __init__(self): self.screen_width = 800 self.screen_height = 500 self.bg_color = (29, 17, 53) self.ship_speed_factor = 1.5
class Settings: def __init__(self): self.screen_width = 800 self.screen_height = 500 self.bg_color = (29, 17, 53) self.ship_speed_factor = 1.5
class Solution: def solve(self, nums, k): pq = [] for num in nums: heappush(pq,-num) for i in range(k): num = heappop(pq) heappush(pq,num+1) return -pq[0]
class Solution: def solve(self, nums, k): pq = [] for num in nums: heappush(pq, -num) for i in range(k): num = heappop(pq) heappush(pq, num + 1) return -pq[0]
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, }, 'targets': [{ 'target_name': 'win_window', 'type': '<(component)', 'dependencies': [ '../...
{'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'win_window', 'type': '<(component)', 'dependencies': ['../../../base/base.gyp:base', '../../../skia/skia.gyp:skia', '../../events/events.gyp:events', '../../gfx/gfx.gyp:gfx', '../../gfx/gfx.gyp:gfx_geometry', '../platform_window.gyp:platform_window'], 'de...
def wage_increase(group): ''' Calculates a new wage given a 10% increase for each element in a list and return a list of containing the new salaries and a list of the raise increases Parameters ---------- group : list a list containing a group of people's wages Returns ...
def wage_increase(group): """ Calculates a new wage given a 10% increase for each element in a list and return a list of containing the new salaries and a list of the raise increases Parameters ---------- group : list a list containing a group of people's wages Returns ...
class Solution: def solve(self, blocks): dp = defaultdict(int) for a,b in blocks: dp[b] = max(dp[b], dp[a]+1) return max(dp.values(),default=0)
class Solution: def solve(self, blocks): dp = defaultdict(int) for (a, b) in blocks: dp[b] = max(dp[b], dp[a] + 1) return max(dp.values(), default=0)
class GenericRequest(object): # object represnting the generic request, do not use directly (unless on errors)! # either use the EndpointRequest subclass for request invloving endpoint data or the DiscoveryRequest subclass for discovery requests # do not use error responses for discovery requests, either return a...
class Genericrequest(object): def __init__(self, request, init_namespace, init_name): self._rawRequest = request self._namespace = init_namespace self._name = init_name self._payloadVersion = request['directive']['header']['payloadVersion'] self._messageId = request['directi...
# https://leetcode.com/problems/find-peak-element/ class Solution: def findPeakElement(self, nums: List[int]) -> int: #use binary search to find peak element def bin_search(nums, left, right): if left == right: return left ...
class Solution: def find_peak_element(self, nums: List[int]) -> int: def bin_search(nums, left, right): if left == right: return left mid = (left + right) // 2 if nums[mid] > nums[mid + 1]: return bin_search(nums, left, mid) e...
# Databricks notebook source MDPSXIUUIQYSSW VRVXHMDRNPKGDKNMLPZZRZMBPZYSWPUYULCTFVAFAOYCHIOLJLKDATHTIAHBGKLANOGGVIKKOYUIDZGKZARPBYIKTWWIVQVXOZKILOMZSUVXRZJNETULRTGWKJTNSIELVVOIWLCRXJMKALJKJOKRJHPKFGXCQDBPYDNBDJRUCCELIHMEWEZIVOZJZOPMUKKUPCMIBYNMRRZMVCJNNWATBBNKWMGRLRIBTZMDDBCBXLDCJBVNPBOVRXUXDQQKYRECIIGEEROPJSYLCLBRTWHD...
MDPSXIUUIQYSSW VRVXHMDRNPKGDKNMLPZZRZMBPZYSWPUYULCTFVAFAOYCHIOLJLKDATHTIAHBGKLANOGGVIKKOYUIDZGKZARPBYIKTWWIVQVXOZKILOMZSUVXRZJNETULRTGWKJTNSIELVVOIWLCRXJMKALJKJOKRJHPKFGXCQDBPYDNBDJRUCCELIHMEWEZIVOZJZOPMUKKUPCMIBYNMRRZMVCJNNWATBBNKWMGRLRIBTZMDDBCBXLDCJBVNPBOVRXUXDQQKYRECIIGEEROPJSYLCLBRTWHDHLBJZOTEQZZYENWGEDYSBAXKCWLSL...
wavelet_type = 'dmey' reconstr_points = 50 model = dict(type='WLNet', backbone=dict(type='mmdet.ResNet', depth=50, num_stages=4, out_indices=(1, 2, 3), frozen_stages=-1, n...
wavelet_type = 'dmey' reconstr_points = 50 model = dict(type='WLNet', backbone=dict(type='mmdet.ResNet', depth=50, num_stages=4, out_indices=(1, 2, 3), frozen_stages=-1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='pytorch', dcn=dict(type='DCNv2', deform_groups=2, fallback_on_stride=False), init...
def quick_sort(arr): #base case if(len(arr) < 2): return arr pivot = arr[0] less = [i for i in arr[1:] if i < pivot] greater = [i for i in arr[1:] if i >= pivot] return quick_sort(less) + [pivot] + quick_sort(greater) test_list = [44, 2056, 2, 2, 41, 109, 33, 32, 22, 67] result = quick_sort(test_list) print(re...
def quick_sort(arr): if len(arr) < 2: return arr pivot = arr[0] less = [i for i in arr[1:] if i < pivot] greater = [i for i in arr[1:] if i >= pivot] return quick_sort(less) + [pivot] + quick_sort(greater) test_list = [44, 2056, 2, 2, 41, 109, 33, 32, 22, 67] result = quick_sort(test_list) p...
def Linear_Search(lst, x): i = 0 n = len(lst) while(i < n): if lst[i] == x: return i i += 1 return -1 while True: lst = [1,2,3,4,5,6,7,89,90,67,45,34] x = int(input()) index = Linear_Search(lst, x) print(index) if index == -1: print("Not Found") else: print("Found in ", index) ''' ......F...
def linear__search(lst, x): i = 0 n = len(lst) while i < n: if lst[i] == x: return i i += 1 return -1 while True: lst = [1, 2, 3, 4, 5, 6, 7, 89, 90, 67, 45, 34] x = int(input()) index = linear__search(lst, x) print(index) if index == -1: print('No...
x = 1 print(x) x = x+1 print(x) x = 1 x += (x+1) #x = x + (x+1) print(x) x=2 for i in range(10): x*=2 print(x)
x = 1 print(x) x = x + 1 print(x) x = 1 x += x + 1 print(x) x = 2 for i in range(10): x *= 2 print(x)
T =int(input()) #number of tests case if T in range (0,21): for _ in range(T): num_a = input() #number of elements' A set A = set(input().split()) num_b = input() B = set(input().split()) #number of elements' B set if len(A)>0 and len(A)<1001: if len(B) > 0 and le...
t = int(input()) if T in range(0, 21): for _ in range(T): num_a = input() a = set(input().split()) num_b = input() b = set(input().split()) if len(A) > 0 and len(A) < 1001: if len(B) > 0 and len(B) < 1001: print(A.issubset(B))
number = 1 + 2 * 3 / 4.0 print(number) remainder = 11 % 3 print(remainder) squared = 7 ** 2 cubed = 2 ** 3 print(squared) print(cubed) helloworld = "hello" + " " + "world" print(helloworld) lotsofhellos = "hello" * 10 print(lotsofhellos) even_numbers = [2,4,6,8] odd_numbers = [1,3,5,7] all_numbers = odd_numbers + ...
number = 1 + 2 * 3 / 4.0 print(number) remainder = 11 % 3 print(remainder) squared = 7 ** 2 cubed = 2 ** 3 print(squared) print(cubed) helloworld = 'hello' + ' ' + 'world' print(helloworld) lotsofhellos = 'hello' * 10 print(lotsofhellos) even_numbers = [2, 4, 6, 8] odd_numbers = [1, 3, 5, 7] all_numbers = odd_numbers +...
#!/usr/bin/env python3 ballot = {} # TODO: Complete the "voting algorithm" to # 1. Accept inputs one and a time, either: # a. Incrementing candidate's vote count by 1 in ballot # b. Setting the candidate's vote count to 1 in ballot for the first vote # 2. Stop accepting inpus if the N ch...
ballot = {} winner = None max_votes = 0 print(f'The winner is {winner} -- with {max_votes} votes.')
class StageDisplay: def __init__(self, index, name, is_current_display=False, client=None): self.index = index self.name = name self.is_current_display = is_current_display self.client = client def send_message(self, message): if self.client: command = { ...
class Stagedisplay: def __init__(self, index, name, is_current_display=False, client=None): self.index = index self.name = name self.is_current_display = is_current_display self.client = client def send_message(self, message): if self.client: command = {'act...
def solution(n): answer = [] flag = True while flag: if n // 10 == 0: answer.append(n % 10) flag = False else: r = n % 10 d = n // 10 n = d answer.append(r) return answer print(solution(12345))
def solution(n): answer = [] flag = True while flag: if n // 10 == 0: answer.append(n % 10) flag = False else: r = n % 10 d = n // 10 n = d answer.append(r) return answer print(solution(12345))
''' modifier: 03 eqtime: 10 ''' def main(): info("Jan Cocktail Pipette x1") gosub('jan:WaitForMiniboneAccess') gosub('jan:PrepareForAirShot') open(name="Q", description="Quad Inlet") gosub('jan:EvacPipette1') gosub('common:FillPipette1') gosub('jan:PrepareForAirShotExpansion') gosub('co...
""" modifier: 03 eqtime: 10 """ def main(): info('Jan Cocktail Pipette x1') gosub('jan:WaitForMiniboneAccess') gosub('jan:PrepareForAirShot') open(name='Q', description='Quad Inlet') gosub('jan:EvacPipette1') gosub('common:FillPipette1') gosub('jan:PrepareForAirShotExpansion') gosub('co...
d=int(input()) if d==61: print("Brasilia") elif d==71: print("Salvador") elif d==11: print("Sao Paulo") elif d==21: print(" Rio de Janeiro") elif d==32: print(" Juiz de Fora") elif d==19: print("Campinas") elif d==27: print("Vitoria") elif d==31: print("Belo Horizonte") else: ...
d = int(input()) if d == 61: print('Brasilia') elif d == 71: print('Salvador') elif d == 11: print('Sao Paulo') elif d == 21: print(' Rio de Janeiro') elif d == 32: print(' Juiz de Fora') elif d == 19: print('Campinas') elif d == 27: print('Vitoria') elif d == 31: print('Belo Horizonte')...
class ConfigException(Exception): def __init__(self, text, trace=None): super().__init__(text) self.text = text self.trace = trace class InvalidValueException(ConfigException): pass class EnvironmentVarMissingException(ConfigException): pass class RequiredVarMissingException(ConfigException): ...
class Configexception(Exception): def __init__(self, text, trace=None): super().__init__(text) self.text = text self.trace = trace class Invalidvalueexception(ConfigException): pass class Environmentvarmissingexception(ConfigException): pass class Requiredvarmissingexception(Conf...
# Internet Archive # https://archive.org/services/docs/api/index.html # https://archive.org/account/s3.php # Used for mirroring uploaded files to the Internet Archive. IA_ACCESS = "" IA_SECRET = "" # Patreon # Beta site credentials are displayed on user profiles for Patrons # Password values are used for non-logged in...
ia_access = '' ia_secret = '' beta_username = '' beta_password = '' password2_dollars = '' password5_dollars = '' twitter_consumer_key = '' twitter_consumer_secret = '' twitter_oauth_token = '' twitter_oauth_secret = '' webhook_url = '' new_upload_webhook_url = '' banned_ips = [''] unregistered_supporters = [{'name': '...