content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
num1=int(input('Enter the first number:')) num2=int(input('Enter the second number:')) sum=lambda num1,num2:num1+num2 diff=lambda num1,num2:num1-num2 mul=lambda num1,num2:num1*num2 div=lambda num1,num2:num1//num2 print("Sum is:",sum(num1,num2)) print("Difference is:",diff(num1,num2)) print("Multiply is",mul(num1,num2...
num1 = int(input('Enter the first number:')) num2 = int(input('Enter the second number:')) sum = lambda num1, num2: num1 + num2 diff = lambda num1, num2: num1 - num2 mul = lambda num1, num2: num1 * num2 div = lambda num1, num2: num1 // num2 print('Sum is:', sum(num1, num2)) print('Difference is:', diff(num1, num2)) pri...
SECRET_KEY='development-key' MYSQL_DATABASE_USER='root' MYSQL_DATABASE_PASSWORD='classroom' MYSQL_DATABASE_DB='Ascott_InvMgmt' MYSQL_DATABASE_HOST='dogfood.coxb3venarbl.ap-southeast-1.rds.amazonaws.com' UPLOADS_DEFAULT_DEST = 'static/img/items/' UPLOADS_DEFAULT_URL = 'http://localhost:5000/static/img/items/' UPLOADE...
secret_key = 'development-key' mysql_database_user = 'root' mysql_database_password = 'classroom' mysql_database_db = 'Ascott_InvMgmt' mysql_database_host = 'dogfood.coxb3venarbl.ap-southeast-1.rds.amazonaws.com' uploads_default_dest = 'static/img/items/' uploads_default_url = 'http://localhost:5000/static/img/items/' ...
class ThreadModule(object): '''docstring for ThreadModule''' def __init__(self, ): super().__init__()
class Threadmodule(object): """docstring for ThreadModule""" def __init__(self): super().__init__()
# Copyright (c) 2014, MapR Technologies # # 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 agree...
oozie = 'Oozie' hive = 'Hive' hive_metastore = 'HiveMetastore' hive_server2 = 'HiveServer2' cldb = 'CLDB' file_server = 'FileServer' zookeeper = 'ZooKeeper' resource_manager = 'ResourceManager' history_server = 'HistoryServer' is_m7_enabled = 'Enable MapR-DB' general = 'general' jobtracker = 'JobTracker' node_manager =...
def Analysis(cipherText): alphabet = dict(zip('ABCDEFGHIJKLMNOPQRSTUVWXYZ', [0] * 27)) for letter in cipherText: if letter.isalpha(): alphabet[letter] += 1 for key, value in alphabet.items(): alphabet[key] = value * (value - 1) IC = sum(alphabet.values()) / (len(cipherT...
def analysis(cipherText): alphabet = dict(zip('ABCDEFGHIJKLMNOPQRSTUVWXYZ', [0] * 27)) for letter in cipherText: if letter.isalpha(): alphabet[letter] += 1 for (key, value) in alphabet.items(): alphabet[key] = value * (value - 1) ic = sum(alphabet.values()) / (len(cipherText)...
# find nth fibonacci number using recursion. # sample output: # 21 def findnthfibnumber(n, map={1: 0, 2: 1}): if n in map: return map[n] else: map[n] = findnthfibnumber(n-1, map) + findnthfibnumber(n-2, map) return map[n] print (findnthfibnumber(9))
def findnthfibnumber(n, map={1: 0, 2: 1}): if n in map: return map[n] else: map[n] = findnthfibnumber(n - 1, map) + findnthfibnumber(n - 2, map) return map[n] print(findnthfibnumber(9))
class Solution: def countElements(self, arr: List[int]) -> int: d = {} count = 0 for i in arr: d[i] = 1 for x in arr: if x+1 in d.keys(): count += 1 return count
class Solution: def count_elements(self, arr: List[int]) -> int: d = {} count = 0 for i in arr: d[i] = 1 for x in arr: if x + 1 in d.keys(): count += 1 return count
def part_1() -> None: h_pos: int = 0 v_pos: int = 0 with open("../data/day2.txt", "r") as dFile: for row in dFile.readlines(): value: int = int(row.split(" ")[1]) match row.split(" ")[0]: case "forward": h_pos += ...
def part_1() -> None: h_pos: int = 0 v_pos: int = 0 with open('../data/day2.txt', 'r') as d_file: for row in dFile.readlines(): value: int = int(row.split(' ')[1]) match row.split(' ')[0]: case 'forward': h_pos += value case...
pkgname = "libffi8" pkgver = "3.4.2" pkgrel = 0 build_style = "gnu_configure" configure_args = [ "--includedir=/usr/include", "--disable-multi-os-directory", "--with-pic" ] hostmakedepends = ["pkgconf"] # actually only on x86 and arm (tramp.c code) but it does not hurt makedepends = ["linux-headers"] checkdepends =...
pkgname = 'libffi8' pkgver = '3.4.2' pkgrel = 0 build_style = 'gnu_configure' configure_args = ['--includedir=/usr/include', '--disable-multi-os-directory', '--with-pic'] hostmakedepends = ['pkgconf'] makedepends = ['linux-headers'] checkdepends = ['dejagnu'] pkgdesc = 'Library supporting Foreign Function Interfaces' m...
# # PySNMP MIB module HPN-ICF-L2VPN-PWE3-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-L2VPN-PWE3-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:27:17 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_union, single_value_constraint, constraints_intersection) ...
{ "targets": [ { "target_name": "gameLauncher", "conditions": [ ["OS==\"win\"", { "sources": [ "srcs/windows/GameLauncher.cpp" ] }], ["OS==\"linux\"", { "sources": [ "srcs/linux/GameLauncher.cpp" ] }] ...
{'targets': [{'target_name': 'gameLauncher', 'conditions': [['OS=="win"', {'sources': ['srcs/windows/GameLauncher.cpp']}], ['OS=="linux"', {'sources': ['srcs/linux/GameLauncher.cpp']}]]}]}
# pylint: disable=undefined-variable ## Whether to include output from clients other than this one sharing the same # kernel. # Required for jupyter-vim, see: # https://github.com/jupyter-vim/jupyter-vim#jupyter-configuration c.ZMQTerminalInteractiveShell.include_other_output = True ## Text to display before the f...
c.ZMQTerminalInteractiveShell.include_other_output = True c.ZMQTerminalInteractiveShell.banner = 'Jupyter console {version}' c.ZMQTerminalInteractiveShell.highlighting_style = 'solarized-dark' c.ZMQTerminalInteractiveShell.history_load_length = 1000 c.ZMQTerminalInteractiveShell.true_color = True
# Function to count number of substrings # with exactly k unique characters def countkDist(str1, k): n = len(str1) # Initialize result res = 0 # Consider all substrings beginning # with str[i] for i in range(0, n): dist_count = 0 # Initializing array with 0 cnt = [0] ...
def countk_dist(str1, k): n = len(str1) res = 0 for i in range(0, n): dist_count = 0 cnt = [0] * 27 for j in range(i, n): if cnt[ord(str1[j]) - 97] == 0: dist_count += 1 cnt[ord(str1[j]) - 97] += 1 if dist_count == k: ...
def check_order(scale_list): ascending_list = sorted(scale_list) descending_list = sorted(scale_list, reverse=True) if scale_list == ascending_list: return "ascending" elif scale_list == descending_list: return "descending" else: return "mixed" def main(): scale_list = i...
def check_order(scale_list): ascending_list = sorted(scale_list) descending_list = sorted(scale_list, reverse=True) if scale_list == ascending_list: return 'ascending' elif scale_list == descending_list: return 'descending' else: return 'mixed' def main(): scale_list = i...
#! /usr/bin/env python3 # -*- coding: UTF-8 -*- #------------------------------------------------------------------------------ def asSeparator () : return "//" + ("-" * 78) + "\n" #------------------------------------------------------------------------------ def generateInterruptSection (interruptSectionName) : ...
def as_separator(): return '//' + '-' * 78 + '\n' def generate_interrupt_section(interruptSectionName): s_code = as_separator() s_code += '// INTERRUPT - SECTION: ' + interruptSectionName + '\n' s_code += as_separator() + '\n' s_code += ' .section .text.interrupt.' + interruptSectionName + ', "a...
in_str = list(str(input())) str_len = len(in_str) # letters set set_letters = set(in_str) set_len = len(set_letters) if str_len == set_len: print("Unique") else: print("Deja Vu")
in_str = list(str(input())) str_len = len(in_str) set_letters = set(in_str) set_len = len(set_letters) if str_len == set_len: print('Unique') else: print('Deja Vu')
# Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project au...
{'includes': ['../build/common.gypi'], 'targets': [{'target_name': 'peerconnection_unittests', 'type': '<(gtest_target_type)', 'dependencies': ['<(DEPTH)/testing/gmock.gyp:gmock', '<(webrtc_root)/api/api.gyp:libjingle_peerconnection', '<(webrtc_root)/base/base_tests.gyp:rtc_base_tests_utils', '<(webrtc_root)/common.gyp...
txtFile=open("/Users/chenchaoyang/Desktop/python/Python/content/content.txt","r") while True: line=txtFile.readline() if not line: break else: print(line) txtFile.close()
txt_file = open('/Users/chenchaoyang/Desktop/python/Python/content/content.txt', 'r') while True: line = txtFile.readline() if not line: break else: print(line) txtFile.close()
# Extra parsing for markdown (Highlighting and alert boxes) def parse(rtxt, look, control): txtl = rtxt.split(look) i, j = 0, 0 ret_text = "" while i < len(txtl): if j == 0: # This is the start before the specified tag, add it normally ret_text += control.start(txtl[i]) ...
def parse(rtxt, look, control): txtl = rtxt.split(look) (i, j) = (0, 0) ret_text = '' while i < len(txtl): if j == 0: ret_text += control.start(txtl[i]) j += 1 elif j == 1: ret_text += control.inner(txtl[i]) j += 1 else: ...
# Copyright 2021, 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 agreed to in writing, sof...
def handle_webhook(request): req = request.get_json() response_text = '' intent = req['queryResult']['intent']['displayName'] if intent == 'Default Welcome Intent': response_text = 'Hello from a GCF Webhook' elif intent == 'get-agent-name': response_text = 'My name is Flowhook' e...
class TxtReader: def __init__(self, f): self.f = f def parse(self): file = open(self.f) line = file.readline() while line: print(line) line = file.readline() file.close #t = TxtReader('sample.txt') #t.parse()
class Txtreader: def __init__(self, f): self.f = f def parse(self): file = open(self.f) line = file.readline() while line: print(line) line = file.readline() file.close
# -*- coding: utf-8 -*- def greet(name): i =0 # while True: # i +=1 first_name, surname = name.split(' ') return 'Hello {0}, {1}'.format(surname, first_name) def suggest_travel(distance): if distance > 5: return 'You should take the train.' elif distance > 2: return...
def greet(name): i = 0 (first_name, surname) = name.split(' ') return 'Hello {0}, {1}'.format(surname, first_name) def suggest_travel(distance): if distance > 5: return 'You should take the train.' elif distance > 2: return 'You should cycle.' else: return 'Stop being la...
# Para criar uma lista com 5 elementos '_' # ex. ['_', '_', '_', '_', '_'] print("Lista com elementos iguais") lista = [] for i in range(5): lista.append('_') print("Lista: ", lista) # Alternativa lista_alternativa = ['_' for i in range(5)] print("Modo Alternativdo de criar lista: ", lista_alternativa) # Para cr...
print('Lista com elementos iguais') lista = [] for i in range(5): lista.append('_') print('Lista: ', lista) lista_alternativa = ['_' for i in range(5)] print('Modo Alternativdo de criar lista: ', lista_alternativa) print('Lista com numeros na sequencia') lista = [] for i in range(6): lista.append(i) print('List...
#hack RSA, caluclate the p,q,d in order by given t,n,e def finitePrimeHack(t, n, e): res_list = [] # find p & q for i in range(2, t): if n % i == 0: p = i q = n//p res_list.append(p) res_list.append(q) #sort the list as p <= q res_list.sort() # find the d whic...
def finite_prime_hack(t, n, e): res_list = [] for i in range(2, t): if n % i == 0: p = i q = n // p res_list.append(p) res_list.append(q) res_list.sort() d = 0 y = 1 far = (p - 1) * (q - 1) while (far * y + 1) % e != 0: y += 1 d = (far * y + 1) // ...
n1 = int(input()) n2 = int(input()) n3 = int(input()) if n1 > n2 > n3: print(n3) print(n2) print(n1) elif n2 > n1 > n3: print(n3) print(n1) print(n2) elif n1 > n3 > n2: print(n2) print(n3) print(n1) elif n2 > n3 > n1: print(n1) print(n3) print(n2) elif n3 > n2 > n1: ...
n1 = int(input()) n2 = int(input()) n3 = int(input()) if n1 > n2 > n3: print(n3) print(n2) print(n1) elif n2 > n1 > n3: print(n3) print(n1) print(n2) elif n1 > n3 > n2: print(n2) print(n3) print(n1) elif n2 > n3 > n1: print(n1) print(n3) print(n2) elif n3 > n2 > n1: p...
# https://codeforces.com/problemset/problem/959/A n = int(input()) print('Mahmoud' if n%2 == 0 else 'Ehab')
n = int(input()) print('Mahmoud' if n % 2 == 0 else 'Ehab')
# # Copyright (c) 2017-2018 Joy Diamond. All rights reserved. # @gem('Sapphire.Parse1Atom') def gem(): show = 7 @share def parse1_map_element(): if qk() is not none: #my_line('qk: %r', qk()) raise_unknown_line() token = parse1_atom() if token.is_right_b...
@gem('Sapphire.Parse1Atom') def gem(): show = 7 @share def parse1_map_element(): if qk() is not none: raise_unknown_line() token = parse1_atom() if token.is_right_brace: return token if token.is_special_operator: raise_unknown_line() ...
def calculateFuel(weight): return int(weight / 3)-2 # Part 1 total = 0 with open("/Users/a318196/Code/AdventOfCode2020/20191201/input.txt") as file: for line in file: total += calculateFuel(int(line)) print ('Total part 1: ' + str(total)) # Part 2 total = 0 with open("/Users/a318196/Code/AdventOfCode20...
def calculate_fuel(weight): return int(weight / 3) - 2 total = 0 with open('/Users/a318196/Code/AdventOfCode2020/20191201/input.txt') as file: for line in file: total += calculate_fuel(int(line)) print('Total part 1: ' + str(total)) total = 0 with open('/Users/a318196/Code/AdventOfCode2020/20191201/inpu...
class FLAG_OPTIONS: MUTLIPLE_SEGMENTS_EXIST = 0x1 ALL_PROPERLY_ALIGNED = 0x2 SEG_UNMAPPED = 0x4 NEXT_SEG_UNMAPPED = 0x8 SEQ_REV_COMP = 0x10 NEXT_SEQ_REV_COMP = 0x20 FIRST_SEQ_IN_TEMP = 0x40 LAST_SEQ_IN_TEMP = 0x80 SECONDARY_ALG = 0x100 POOR_QUALITY = 0x200 DUPLICATE_READ = 0x...
class Flag_Options: mutliple_segments_exist = 1 all_properly_aligned = 2 seg_unmapped = 4 next_seg_unmapped = 8 seq_rev_comp = 16 next_seq_rev_comp = 32 first_seq_in_temp = 64 last_seq_in_temp = 128 secondary_alg = 256 poor_quality = 512 duplicate_read = 1024 supplementar...
secure_log_path = "/var/log/secure"; secure_log_score_tokens = \ { "Invalid user": 3, "User root": 5, "Failed password": 2 }; secure_log_score_limit = 10; #firewall-cmd --permanent --ipset=some_set --add-entry=xxx.xxx.xxx.xxx firewalld_ipset_name = "ips2drop"; ##########################################...
secure_log_path = '/var/log/secure' secure_log_score_tokens = {'Invalid user': 3, 'User root': 5, 'Failed password': 2} secure_log_score_limit = 10 firewalld_ipset_name = 'ips2drop' ip_address_pattern = '[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}' abuse_report_mail_pattern = 'abuse@[a-zA-Z]+\\.[a-zA-Z]+'
a, b, c, d = map(int, input().split()) s = a + b + c + d a, b, c, d = map(int, input().split()) t = a + b + c + d print(max(s, t))
(a, b, c, d) = map(int, input().split()) s = a + b + c + d (a, b, c, d) = map(int, input().split()) t = a + b + c + d print(max(s, t))
# Copyright (c) Nikita Sychev, 29.04.2017 # Licensed by MIT a = input() b = input() c = input() n = len(a) a_new = "" b_new = "" c_new = "" for i in range(n): unused = chr(ord('A') + ord('B') + ord('C') + ord('?') - ord(a[i]) - ord(b[i]) - ord(c[i])) if a[i] == '?': a_new += u...
a = input() b = input() c = input() n = len(a) a_new = '' b_new = '' c_new = '' for i in range(n): unused = chr(ord('A') + ord('B') + ord('C') + ord('?') - ord(a[i]) - ord(b[i]) - ord(c[i])) if a[i] == '?': a_new += unused else: a_new += a[i] if b[i] == '?': b_new += unused e...
def sum(x,y): print("sum"," =",(x+y)) def subtract(x,y): print("difference"," =",(x-y)) def divide(x,y): print("division"," =",(x/y)) def multiply(x,y): print("multiplication"," =",(x/y))
def sum(x, y): print('sum', ' =', x + y) def subtract(x, y): print('difference', ' =', x - y) def divide(x, y): print('division', ' =', x / y) def multiply(x, y): print('multiplication', ' =', x / y)
# 110. Balanced Binary Tree # Runtime: 3232 ms, faster than 5.10% of Python3 online submissions for Balanced Binary Tree. # Memory Usage: 17.6 MB, less than 100.00% of Python3 online submissions for Balanced Binary Tree. # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=Non...
class Solution: def is_balanced(self, root: TreeNode) -> bool: if not root: return True else: def get_depth(node: TreeNode) -> int: if not node: return 0 else: return max(get_depth(node.left), get_depth...
# Link: https://leetcode.com/problems/reverse-substrings-between-each-pair-of-parentheses/ # Time: O(N) # Space: O(N) def reverse_parentheses(s): stack, queue = [], [] for char in s: if char == ")": while stack[-1] != "(": queue.append(stack.pop()) stack.pop() ...
def reverse_parentheses(s): (stack, queue) = ([], []) for char in s: if char == ')': while stack[-1] != '(': queue.append(stack.pop()) stack.pop() while queue: stack.append(queue.pop(0)) else: stack.append(char) ...
x = input("Enter a string") y = input("Enter a string") z = input("Enter a string") for i in range(10): print("This is some output from the lab ",i) print("Your input was " + x) print("Your input was " + y) print("Your input was " + z)
x = input('Enter a string') y = input('Enter a string') z = input('Enter a string') for i in range(10): print('This is some output from the lab ', i) print('Your input was ' + x) print('Your input was ' + y) print('Your input was ' + z)
class Solution: def reverseBits(self, n): result = 0 for i in range(32): result <<= 1 if n & 1 > 0: result += 1 n >>= 1 return result
class Solution: def reverse_bits(self, n): result = 0 for i in range(32): result <<= 1 if n & 1 > 0: result += 1 n >>= 1 return result
i = 1 n = 1 S = int(0) while i <= 39: somar = i/n S = S + somar n = n*2 i = i + 2 print('%.2f'%S)
i = 1 n = 1 s = int(0) while i <= 39: somar = i / n s = S + somar n = n * 2 i = i + 2 print('%.2f' % S)
''' Class to define a LIFO Stack ''' class UnderflowException(Exception): ''' Raised when any element access operation is attempted on an empty stack. ''' pass class Stack(object): ''' Implements a Stack or a LIFO-style collection of elements. ''' def __init__(self): self....
""" Class to define a LIFO Stack """ class Underflowexception(Exception): """ Raised when any element access operation is attempted on an empty stack. """ pass class Stack(object): """ Implements a Stack or a LIFO-style collection of elements. """ def __init__(self): self....
#!/usr/bin/env python3 def eval_jumps1(jumps): cloned = list(jumps) pc = 0 i = 0 while 0 <= pc < len(cloned): old_pc = cloned[pc] cloned[pc] += 1 pc += old_pc i += 1 return i def eval_jumps2(jumps): cloned = list(jumps) pc = 0 i = 0 while 0 <= pc <...
def eval_jumps1(jumps): cloned = list(jumps) pc = 0 i = 0 while 0 <= pc < len(cloned): old_pc = cloned[pc] cloned[pc] += 1 pc += old_pc i += 1 return i def eval_jumps2(jumps): cloned = list(jumps) pc = 0 i = 0 while 0 <= pc < len(cloned): old_...
class Solution: def solve(self, n, k): ans = [] for i in range(k): ans.append(x := max(1,n-26*(k-i-1))) n -= x return "".join(chr(ord('a')+x-1) for x in ans)
class Solution: def solve(self, n, k): ans = [] for i in range(k): ans.append((x := max(1, n - 26 * (k - i - 1)))) n -= x return ''.join((chr(ord('a') + x - 1) for x in ans))
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web") load(":tools/ngsw_config.bzl", _ngsw_config = "ngsw_config") def pkg_pwa( name, srcs, index_html, ngsw_config, additional_root_paths = []): pkg_web( name = "%s_web" % name, srcs = srcs + ["@npm//:node_m...
load('@build_bazel_rules_nodejs//:index.bzl', 'pkg_web') load(':tools/ngsw_config.bzl', _ngsw_config='ngsw_config') def pkg_pwa(name, srcs, index_html, ngsw_config, additional_root_paths=[]): pkg_web(name='%s_web' % name, srcs=srcs + ['@npm//:node_modules/@angular/service-worker/ngsw-worker.js', '@npm//:node_modul...
def calculate_amstrong_numbers_3_digits(): result = [] for item in range(100, 1000): sum = 0 for number in str(item): sum += int(number) ** 3 if sum == item: result.append(item) return result print("3-digit Amstrong Numbers:") print(calculate_amstrong_numb...
def calculate_amstrong_numbers_3_digits(): result = [] for item in range(100, 1000): sum = 0 for number in str(item): sum += int(number) ** 3 if sum == item: result.append(item) return result print('3-digit Amstrong Numbers:') print(calculate_amstrong_numbers_...
def int_to_Roman(num): val = [ 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 ] syb = [ "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" ] roman_num = '' i = 0 while num > 0: for _ in range(num...
def int_to__roman(num): val = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1] syb = ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'] roman_num = '' i = 0 while num > 0: for _ in range(num // val[i]): roman_num += syb[i] num -= val[i] ...
class A: def f(self): return B() a = A() a.f() # NameError: name 'B' is not defined b = B() # NameError: name 'B' is not defined def f(): b = B() f() # NameError: name 'B' is not defined class B: pass
class A: def f(self): return b() a = a() a.f() b = b() def f(): b = b() f() class B: pass
def reverse_list(items): start = 0 end = len(items) - 1 while start < end: items[start], items[end] = items[end], items[start] start += 1 end -= 1 return items if __name__ == '__main__': items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] print(reverse_list(items))
def reverse_list(items): start = 0 end = len(items) - 1 while start < end: (items[start], items[end]) = (items[end], items[start]) start += 1 end -= 1 return items if __name__ == '__main__': items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] print(reverse_list(items))
#!/usr/bin/python3 # # MAGIC_SEED = 1956 #PATH TRAIN_PATH = 'train' PREDICT_PATH = 'predict' # Dataset properties CSV_PATH="C:\\Users\\dmitr_000\\.keras\\datasets\\Imbalance_data.csv" # Header names DT_DSET ="Date Time" RCPOWER_DSET= "Imbalance" DISCRET =10 # The time cutoffs for the formation of the validation ...
magic_seed = 1956 train_path = 'train' predict_path = 'predict' csv_path = 'C:\\Users\\dmitr_000\\.keras\\datasets\\Imbalance_data.csv' dt_dset = 'Date Time' rcpower_dset = 'Imbalance' discret = 10 test_cut_off = 60 val_cut_off = 360 log_file_name = 'Imbalance' epochs = 10 n_steps = 32 n_features = 1 lstm_possible_type...
def unsupervised_distr(distr): variables = {k: k + '_u' for k in distr.var + distr.cond_var if k != 'z'} distr_unsupervised = distr.replace_var(**variables) return distr_unsupervised, variables def unsupervised_distr_no_var(distr): variables = {k: k + '_u' for k in distr.var + distr.cond_var if k != '...
def unsupervised_distr(distr): variables = {k: k + '_u' for k in distr.var + distr.cond_var if k != 'z'} distr_unsupervised = distr.replace_var(**variables) return (distr_unsupervised, variables) def unsupervised_distr_no_var(distr): variables = {k: k + '_u' for k in distr.var + distr.cond_var if k != ...
class Solution: def uniqueMorseRepresentations(self, words: List[str]) -> int: table = [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."] return len({''.join(table[ord(c) - ord('a')] for c ...
class Solution: def unique_morse_representations(self, words: List[str]) -> int: table = ['.-', '-...', '-.-.', '-..', '.', '..-.', '--.', '....', '..', '.---', '-.-', '.-..', '--', '-.', '---', '.--.', '--.-', '.-.', '...', '-', '..-', '...-', '.--', '-..-', '-.--', '--..'] return len({''.join((ta...
expected_output = { "list_of_neighbors": ["192.168.197.254"], "vrf": { "default": { "neighbor": { "192.168.197.254": { "address_family": { "ipv4 unicast": { "advertise_bit": 0, ...
expected_output = {'list_of_neighbors': ['192.168.197.254'], 'vrf': {'default': {'neighbor': {'192.168.197.254': {'address_family': {'ipv4 unicast': {'advertise_bit': 0, 'bgp_table_version': 1, 'dynamic_slow_peer_recovered': 'never', 'index': 0, 'last_detected_dynamic_slow_peer': 'never', 'last_received_refresh_end_of_...
def check_paranthesis(inp): stack = [] c = 1 for i in inp: if i in ['(','[','{']: stack.append(i) c += 1 else: if len(stack) == 0: return c elif (i == ')' and stack[-1] == '(') or (i == ']' and stack[-1] == '[') or (i == '}' and...
def check_paranthesis(inp): stack = [] c = 1 for i in inp: if i in ['(', '[', '{']: stack.append(i) c += 1 elif len(stack) == 0: return c elif i == ')' and stack[-1] == '(' or (i == ']' and stack[-1] == '[') or (i == '}' and stack[-1] == '{'): ...
# Bazel macro that instantiates a native cc_test rule for an S2 test. def s2test(name, deps = [], size = "small"): native.cc_test( name = name, srcs = ["%s.cc" % (name)], copts = [ "-Iexternal/gtest/include", "-DS2_TEST_DEGENERACIES", "-DS2_USE_GFLAGS", ...
def s2test(name, deps=[], size='small'): native.cc_test(name=name, srcs=['%s.cc' % name], copts=['-Iexternal/gtest/include', '-DS2_TEST_DEGENERACIES', '-DS2_USE_GFLAGS', '-DS2_USE_GLOG', '-DHASH_NAMESPACE=std', '-Wno-deprecated-declarations', '-Wno-format', '-Wno-non-virtual-dtor', '-Wno-parentheses', '-Wno-sign-co...
# # PySNMP MIB module CT-DAWANDEVCONN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CT-DAWANDEVCONN-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:28:40 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, constraints_union, constraints_intersection, single_value_constraint) ...
class Node(object): def __init__(self, item): self.item = item self.next = None def get_item(self): return self.item def get_next(self): return self.next def set_item(self, new_item): self.item = new_item def set_next(self, new_next): self.next = n...
class Node(object): def __init__(self, item): self.item = item self.next = None def get_item(self): return self.item def get_next(self): return self.next def set_item(self, new_item): self.item = new_item def set_next(self, new_next): self.next = ...
# The major optimization is to do arithmetic in base 10 in the main loop, avoiding division and modulo def compute(): # Initialize n = 1000000000 # The pattern is greater than 10^18, so start searching at 10^9 ndigits = [0] * 10 # In base 10, little-endian temp = n for i in range(len(ndigits)): ndigits[i] = ...
def compute(): n = 1000000000 ndigits = [0] * 10 temp = n for i in range(len(ndigits)): ndigits[i] = temp % 10 temp //= 10 n2digits = [0] * 19 temp = n * n for i in range(len(n2digits)): n2digits[i] = temp % 10 temp //= 10 while not is_concealed_square(n2d...
def parse_string_time(input_time: str) -> float: total_amount = 0 times = _slice_input_times(input_time) for _amount, duration_type in times: amount = _to_float(_amount) multiplier = _parse_multiplier(duration_type) total_amount += amount * multiplier return total_amount def...
def parse_string_time(input_time: str) -> float: total_amount = 0 times = _slice_input_times(input_time) for (_amount, duration_type) in times: amount = _to_float(_amount) multiplier = _parse_multiplier(duration_type) total_amount += amount * multiplier return total_amount def _...
HITBOX_OCTANE = 0 HITBOX_DOMINUS = 1 HITBOX_PLANK = 2 HITBOX_BREAKOUT = 3 HITBOX_HYBRID = 4 HITBOX_BATMOBILE = 5
hitbox_octane = 0 hitbox_dominus = 1 hitbox_plank = 2 hitbox_breakout = 3 hitbox_hybrid = 4 hitbox_batmobile = 5
N, M = map(int, input().split()) A = list(map(int, input().split())) threshold = sum(A) / (4 * M) if len([a for a in A if a >= threshold]) >= M: print('Yes') else: print('No')
(n, m) = map(int, input().split()) a = list(map(int, input().split())) threshold = sum(A) / (4 * M) if len([a for a in A if a >= threshold]) >= M: print('Yes') else: print('No')
class Solution: def longestCommonPrefix(self, strs: List[str]) -> str: # exception if len(strs) == 0: return "" # sort first! strs.sort() # strategy # compare first and last string in sorted strings! # pick first element ...
class Solution: def longest_common_prefix(self, strs: List[str]) -> str: if len(strs) == 0: return '' strs.sort() pick = strs[0] prefix = '' for i in range(len(pick)): if strs[len(strs) - 1][i] == pick[i]: prefix += strs[len(strs) - 1]...
class Node: def __init__(self, data): self.data = data self.left = None self.right = None class BST: def __init__(self): self.root = None def _add(self, node, data): if data <= node.data: if node.left: self._add(node.left, data) ...
class Node: def __init__(self, data): self.data = data self.left = None self.right = None class Bst: def __init__(self): self.root = None def _add(self, node, data): if data <= node.data: if node.left: self._add(node.left, data) ...
class SymbolMapper(object): def __init__(self): self.symbolmap = {0: '0', 1: '+', -1: '-'} @staticmethod def normalize(value): return 0 if value == 0 else value / abs(value) def inputs2symbols(self, inputs): return map( lambda value: self.symbolmap[SymbolMapper.nor...
class Symbolmapper(object): def __init__(self): self.symbolmap = {0: '0', 1: '+', -1: '-'} @staticmethod def normalize(value): return 0 if value == 0 else value / abs(value) def inputs2symbols(self, inputs): return map(lambda value: self.symbolmap[SymbolMapper.normalize(value)...
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- # (c)2021 .direwolf <kururinmiracle@outlook.com> # Licensed under the MIT License. class AffNoteTypeError(Exception): pass class AffNoteIndexError(Exception): pass class AffNoteValueError(Exception): pass class AffSceneTypeError(Exception): pass cl...
class Affnotetypeerror(Exception): pass class Affnoteindexerror(Exception): pass class Affnotevalueerror(Exception): pass class Affscenetypeerror(Exception): pass class Affreaderror(Exception): pass
# Ignore file list ignore_filelist = [ 'teslagun.activeitem', 'teslagun2.activeitem', ] ignore_filelist_patch = [ ]
ignore_filelist = ['teslagun.activeitem', 'teslagun2.activeitem'] ignore_filelist_patch = []
# funcao como parametro de funcao # so imprime se o numero estiver correto def imprime_com_condicao(num, fcond): if fcond(num): print(num) def par(x): return x % 2 == 0 def impar(x): return not par(x) # Programa Principal # neste caso nao imprimira imprime_com_condicao(5, par)
def imprime_com_condicao(num, fcond): if fcond(num): print(num) def par(x): return x % 2 == 0 def impar(x): return not par(x) imprime_com_condicao(5, par)
n = int(input().strip()) a = list(map(int, input().strip().split(' '))) swaps = 0 for i in range(n): temp=0 for j in range(n-1): if a[j] > a[j+1]: temp = a[j] a[j] = a[j+1] a[j+1] = temp swaps+=1 if swaps==0: print("Array is sorted in", swaps, "swaps."...
n = int(input().strip()) a = list(map(int, input().strip().split(' '))) swaps = 0 for i in range(n): temp = 0 for j in range(n - 1): if a[j] > a[j + 1]: temp = a[j] a[j] = a[j + 1] a[j + 1] = temp swaps += 1 if swaps == 0: print('Array is sorted in', s...
t = int(input()) for i in range(t): r = int(input()) length = r*5 width = length*0.6 left = -1*length*0.45 right = length*0.55 w = width/2 # print coordinates print('Case '+str(i+1)+':') # upper left print("%.0f %.0f" % (left, w)) # upper right print("%.0f %.0f" % (right,...
t = int(input()) for i in range(t): r = int(input()) length = r * 5 width = length * 0.6 left = -1 * length * 0.45 right = length * 0.55 w = width / 2 print('Case ' + str(i + 1) + ':') print('%.0f %.0f' % (left, w)) print('%.0f %.0f' % (right, w)) print('%.0f %.0f' % (right, -1 *...
myString = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj." inTab = "yzabcdefghijklmnopqrstuvwx" outTab = "abcdefghijklmnopqrstuvwxyz" transTab = str.maketrans(i...
my_string = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj." in_tab = 'yzabcdefghijklmnopqrstuvwx' out_tab = 'abcdefghijklmnopqrstuvwxyz' trans_tab = str.maketrans...
def sortByHeight(a): heights = [] # Store all the heights in a list for i in range(len(a)): if a[i] != -1: heights.append(a[i]) # Sort the heights heights = sorted(heights) # Replace the heights in the original list j = 0 for i in range(len(a)): if a[i] != ...
def sort_by_height(a): heights = [] for i in range(len(a)): if a[i] != -1: heights.append(a[i]) heights = sorted(heights) j = 0 for i in range(len(a)): if a[i] != -1: a[i] = heights[j] j += 1 return a
class Solution: def reverseWords(self, set): return ' '.join(set.split()[::-1]) if __name__ == "__main__": solution = Solution() print(solution.reverseWords("the sky is blue")) print(solution.reverseWords(" hello world! "))
class Solution: def reverse_words(self, set): return ' '.join(set.split()[::-1]) if __name__ == '__main__': solution = solution() print(solution.reverseWords('the sky is blue')) print(solution.reverseWords(' hello world! '))
class SleuthError(Exception): pass class SleuthNotFoundError(SleuthError): pass
class Sleutherror(Exception): pass class Sleuthnotfounderror(SleuthError): pass
def insertion_sort(nums: list[float]) -> list[float]: for start in range(1, len(nums)): index = start while nums[index] < nums[index - 1] and index > 0: nums[index], nums[index - 1] = nums[index - 1], nums[index] index -= 1 return nums
def insertion_sort(nums: list[float]) -> list[float]: for start in range(1, len(nums)): index = start while nums[index] < nums[index - 1] and index > 0: (nums[index], nums[index - 1]) = (nums[index - 1], nums[index]) index -= 1 return nums
# Copyright 2019 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
bing_edge = {'color': {'color': '#228372'}, 'title': 'Bing-related Parsing Functions', 'label': 'B'} def run(unfurl, node): if node.data_type == 'url.query.pair': if 'bing' in unfurl.find_preceding_domain(node): if node.key == 'pq': unfurl.add_to_queue(data_type='descriptor', ke...
class Term(str): @property def is_variable(self): return self[0] == "?" @property def is_constant(self): return self[0] != "?" @property def arity(self): return 0 class ListTerm(tuple): def __init__(self, *args): self.is_function = None tuple.__ini...
class Term(str): @property def is_variable(self): return self[0] == '?' @property def is_constant(self): return self[0] != '?' @property def arity(self): return 0 class Listterm(tuple): def __init__(self, *args): self.is_function = None tuple.__in...
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( a , b , k ) : c1 = ( b - a ) - 1 c2 = ( k - b ) + ( a - 1 ) if ( c1 == c2 ) : return 0 retu...
def f_gold(a, b, k): c1 = b - a - 1 c2 = k - b + (a - 1) if c1 == c2: return 0 return min(c1, c2) if __name__ == '__main__': param = [(83, 98, 86), (3, 39, 87), (11, 96, 30), (50, 67, 48), (40, 16, 32), (62, 86, 76), (40, 78, 71), (66, 11, 74), (6, 9, 19), (25, 5, 5)] n_success = 0 f...
def get_locale_name(something, lang): if type(something) == str: pass if type(something) == list: pass if type(something) == dict: pass
def get_locale_name(something, lang): if type(something) == str: pass if type(something) == list: pass if type(something) == dict: pass
phoneNumber = {} x = int(input()) for i in range(x): name, number = input().split() phoneNumber[name] = number for i in range(x): query_name = input() if query_name in phoneNumber.keys(): print(query_name + "=" + phoneNumber[query_name]) else: print("Not found")
phone_number = {} x = int(input()) for i in range(x): (name, number) = input().split() phoneNumber[name] = number for i in range(x): query_name = input() if query_name in phoneNumber.keys(): print(query_name + '=' + phoneNumber[query_name]) else: print('Not found')
AVAILABLE = [ { 'account_name': 'ExampleTwitterMarkovBot', # derived from https://twitter.com/ExampleTwitterMarkovBot 'corpora': ('example_corpus1', 'example_corpus2'), 'description': 'An example configuration for a bot instance', 'twitter_key': '', # twitter app API key 'twi...
available = [{'account_name': 'ExampleTwitterMarkovBot', 'corpora': ('example_corpus1', 'example_corpus2'), 'description': 'An example configuration for a bot instance', 'twitter_key': '', 'twitter_secret': ''}]
if __name__ == "__main__": with open("input.txt", "r") as f: input_list = f.readlines() x = 0 y = 0 for input in input_list: command, string_val = input.split(" ") val = int(string_val) if command == "forward": x += val ...
if __name__ == '__main__': with open('input.txt', 'r') as f: input_list = f.readlines() x = 0 y = 0 for input in input_list: (command, string_val) = input.split(' ') val = int(string_val) if command == 'forward': x += val ...
class TransactionError(Exception): pass class TransactionTimeoutError(Exception): pass class TransactionFinished(Exception): pass
class Transactionerror(Exception): pass class Transactiontimeouterror(Exception): pass class Transactionfinished(Exception): pass
class AdvancedArithmetic(object): def divisorSum(n): raise NotImplementedError class Calculator(AdvancedArithmetic): def divisorSum(self, n): divisor_sum = 0 for divisor in range(2, n): if n % divisor == 0: divisor_sum += divisor return divisor_sum +...
class Advancedarithmetic(object): def divisor_sum(n): raise NotImplementedError class Calculator(AdvancedArithmetic): def divisor_sum(self, n): divisor_sum = 0 for divisor in range(2, n): if n % divisor == 0: divisor_sum += divisor return divisor_su...
def gcd(a: int, b: int) -> int: # supposed a >= b if b > a: return gcd(b, a) elif a % b == 0: return b return gcd(b, a % b)
def gcd(a: int, b: int) -> int: if b > a: return gcd(b, a) elif a % b == 0: return b return gcd(b, a % b)
def data_loader(f_name, l_name): with open(f_name, mode='r', encoding='utf-8') as f: data = list(set(f.readlines())) label = [l_name for i in range(len(data))] return data, label
def data_loader(f_name, l_name): with open(f_name, mode='r', encoding='utf-8') as f: data = list(set(f.readlines())) label = [l_name for i in range(len(data))] return (data, label)
def in_order_traversal(node, visit_func): if node is not None: in_order_traversal(node.left, visit_func) visit_func(node.data) in_order_traversal(node.right, visit_func) def pre_order_traversal(node, visit_func): if node is not None: visit_func(node.data) pre_order_trave...
def in_order_traversal(node, visit_func): if node is not None: in_order_traversal(node.left, visit_func) visit_func(node.data) in_order_traversal(node.right, visit_func) def pre_order_traversal(node, visit_func): if node is not None: visit_func(node.data) pre_order_trave...
''' Desenvolva um algoritmo que solicite seu ano de nacimento e o ano anoAtual Calcule a idade e apresente na tela. Para fins de simplificacao, despreze o dia e mes do ano. Apos o calculo verifique se a idade e maior ou igual a 18 anos e apresente na tela a mensagen informando que ja e possivel tirar a carteira de mot...
""" Desenvolva um algoritmo que solicite seu ano de nacimento e o ano anoAtual Calcule a idade e apresente na tela. Para fins de simplificacao, despreze o dia e mes do ano. Apos o calculo verifique se a idade e maior ou igual a 18 anos e apresente na tela a mensagen informando que ja e possivel tirar a carteira de mot...
class Feature: def __init__(self, name, selector, data_type, number_of_values, patterns): self.name = name self.selector = selector self.pattern = patterns[data_type] self.multiple_values = number_of_values != 'single'
class Feature: def __init__(self, name, selector, data_type, number_of_values, patterns): self.name = name self.selector = selector self.pattern = patterns[data_type] self.multiple_values = number_of_values != 'single'
def get_multiples(num=1,c=10): # if n > 0: (what about negative multiples?) a = 0 num2 = num while a < c: if num2%num == 0: yield num2 num2 += 1 a += 1 else: num2 += 1 multiples_two = get_multiples(2,3) for i in multiples_two: print(i) default_multiples = get_multiples() multiples_5 = g...
def get_multiples(num=1, c=10): a = 0 num2 = num while a < c: if num2 % num == 0: yield num2 num2 += 1 a += 1 else: num2 += 1 multiples_two = get_multiples(2, 3) for i in multiples_two: print(i) default_multiples = get_multiples() multiples...
# Copyright 2010-2011, RTLCores. All rights reserved. # http://rtlcores.com # See LICENSE.txt class CmdArgs(list): def __init__(self, value=[], cmd=None): list.__init__(self, value) self.cmd = cmd def conv(self): if(self.cmd == None): return self else: r...
class Cmdargs(list): def __init__(self, value=[], cmd=None): list.__init__(self, value) self.cmd = cmd def conv(self): if self.cmd == None: return self else: return self.cmd(self)
def main() -> None: n, m = map(int, input().split()) g = [[] for _ in range(n)] for _ in range(m): u, v = map(int, input().split()) u -= 1 v -= 1 g[u].append(v) g[v].append(u) INF = 1 << 60 min_length = [INF] * (1 << n) remain = 1 << n mi...
def main() -> None: (n, m) = map(int, input().split()) g = [[] for _ in range(n)] for _ in range(m): (u, v) = map(int, input().split()) u -= 1 v -= 1 g[u].append(v) g[v].append(u) inf = 1 << 60 min_length = [INF] * (1 << n) remain = 1 << n min_length[0...
# import libraries and modules # provide a class storing the configuration of the back-end engine class LXMconfig: # constructor of the class def __init__(self): self.idb_c1 = None self.idb_c2 = None self.idb_c3 = None self.lxm_conf = {} self.program_name = "lx_allocator...
class Lxmconfig: def __init__(self): self.idb_c1 = None self.idb_c2 = None self.idb_c3 = None self.lxm_conf = {} self.program_name = 'lx_allocator' self.lxm_conf['header_request_id'] = 0 self.lxm_conf['header_forwarded_for'] = 1 self.lxm_conf['service...
{ "targets": [ { "target_name": "priorityqueue_native", "sources": [ "src/priorityqueue_native.cpp", "src/ObjectHolder.cpp", "src/index.d.ts"], "cflags": ["-Wall", "-std=c++11"], 'xcode_settings': { 'OTHER_CFLAGS': [ '-std=c++11' ], }, "conditions": [ ...
{'targets': [{'target_name': 'priorityqueue_native', 'sources': ['src/priorityqueue_native.cpp', 'src/ObjectHolder.cpp', 'src/index.d.ts'], 'cflags': ['-Wall', '-std=c++11'], 'xcode_settings': {'OTHER_CFLAGS': ['-std=c++11']}, 'conditions': [['OS=="mac"', {'xcode_settings': {'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', 'OTHER_C...
''' ''' print('\nNested Function\n') def function_1(text): text = text def function_2(): print(text) function_2() if __name__ == '__main__': function_1('Welcome') print('\n closure Function \n') def function_1(text): text = text def function_2(): print(text) return function_2 if __name__ == '__main__...
""" """ print('\nNested Function\n') def function_1(text): text = text def function_2(): print(text) function_2() if __name__ == '__main__': function_1('Welcome') print('\n closure Function \n') def function_1(text): text = text def function_2(): print(text) return funct...
# def mul(a=1,b=3): # c=a*b # return c # def add(a=1,b=2): # c=a+b # return c class Student: def __init__(self,first,last,kid): self.fname = first self.lname = last self.kid = kid self.email = first + '.' + last +'@tamuk.edu' def firstname(self): retur...
class Student: def __init__(self, first, last, kid): self.fname = first self.lname = last self.kid = kid self.email = first + '.' + last + '@tamuk.edu' def firstname(self): return self.fname stu_1 = student('ashwitha', 'devireddy', 'k00442409') stu_2 = student('santosh'...
def get_initial(name): initial = name[0:1].upper() return initial first_name = input('Enter your first name: ') first_name_initial = get_initial (first_name) middle_name = input('Enter your middle name: ') middle_name_initial = get_initial (middle_name) last_name = input('Enter your last name: ') last_name_...
def get_initial(name): initial = name[0:1].upper() return initial first_name = input('Enter your first name: ') first_name_initial = get_initial(first_name) middle_name = input('Enter your middle name: ') middle_name_initial = get_initial(middle_name) last_name = input('Enter your last name: ') last_name_initia...
class Password: ''' class of the password file ''' def __init__(self, page, password): self.page = page self.password = password ''' function for class properties ''' ''' user properties ''' user_password = [] def save_page(self): Password.user_passwords.append(self) ''' save pas...
class Password: """ class of the password file """ def __init__(self, page, password): self.page = page self.password = password '\nfunction for class properties\n' '\nuser properties\n' user_password = [] def save_page(self): Password.user_passwords.append(self) '\n save password creat...
while True: try: e = str(input()).strip() c = e.replace('.', '').replace('-', '') s = 0 for i in range(9): s += int(c[i]) * (i + 1) b1 = s % 11 b1 = 0 if b1 == 10 else b1 s = 0 if b1 == int(e[-2]): for i in range(9): ...
while True: try: e = str(input()).strip() c = e.replace('.', '').replace('-', '') s = 0 for i in range(9): s += int(c[i]) * (i + 1) b1 = s % 11 b1 = 0 if b1 == 10 else b1 s = 0 if b1 == int(e[-2]): for i in range(9): ...
# Intersection of 2 arrays class Solution: def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]: counter = None result = [] if len(nums1) < len(nums2): counter = collections.Counter(nums1) for n in nums2: ...
class Solution: def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]: counter = None result = [] if len(nums1) < len(nums2): counter = collections.Counter(nums1) for n in nums2: if n in counter and counter[n] > 0: c...
class propertyDecorator(object): def __init__(self, x): self._x = x @property def x(self): return self._x @x.setter def x(self, value): self._x = value pd = propertyDecorator(100) print(pd.x) pd.x = 10 print(pd.x)
class Propertydecorator(object): def __init__(self, x): self._x = x @property def x(self): return self._x @x.setter def x(self, value): self._x = value pd = property_decorator(100) print(pd.x) pd.x = 10 print(pd.x)
countries = ["USA", "Spain", "France", "Canada"] for country in countries: print(country) data = "Hello from python" for out in data: print(out) for numero in range(8): print(numero)
countries = ['USA', 'Spain', 'France', 'Canada'] for country in countries: print(country) data = 'Hello from python' for out in data: print(out) for numero in range(8): print(numero)
# X = { # "0xFF": { # "id": 255, # "name": "meta", # "0x00": { # "type_id": 0, # "type_name": "sequence_number", # "length": 2, # "params": [ # "nmsb", # "nlsb" # ], # "dtype": "int", # ...
x = {255: {0: {'dtype': 'int', 'length': 2, 'mask': (255, 255), 'params': ('nmsb', 'nlsb'), 'type_id': 0, 'type_name': 'sequence_number', 'default': [0, 0]}, 1: {'dtype': 'str', 'length': -1, 'mask': 127, 'params': 'text', 'type_id': 1, 'type_name': 'text_event', 'default': 'Enter the Text'}, 2: {'dtype': 'str', 'lengt...
def make_car(car_manufacturer,car_model,**Other_attributes): Other_attributes['car_model']=car_model Other_attributes['car_manufacturer']=car_manufacturer return Other_attributes print(make_car('Toyota','Rav 4',color='blue'))
def make_car(car_manufacturer, car_model, **Other_attributes): Other_attributes['car_model'] = car_model Other_attributes['car_manufacturer'] = car_manufacturer return Other_attributes print(make_car('Toyota', 'Rav 4', color='blue'))