content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class RequestManipulator: ''' This class can be used to inspect or manipulate output created by the sdc client. Output creation is done in three steps: first a pysdc.pysoap.soapenvelope.Soap12Envelope is created, then a (libxml) etree is created from its content, anf finally a bytestring is gene...
class Requestmanipulator: """ This class can be used to inspect or manipulate output created by the sdc client. Output creation is done in three steps: first a pysdc.pysoap.soapenvelope.Soap12Envelope is created, then a (libxml) etree is created from its content, anf finally a bytestring is generated fr...
# https://leetcode.com/problems/single-element-in-a-sorted-array/ # You are given a sorted array consisting of only integers where every element # appears exactly twice, except for one element which appears exactly once. Find # this single element that appears only once. # Follow up: Your solution should run in O(log...
class Solution: def single_non_duplicate(self, nums: List[int]) -> int: if len(nums) == 1: return nums[0] (left, right) = (0, len(nums) - 1) while left + 1 < right: mid = left + (right - left) // 2 if mid % 2 == 0: if nums[mid] == nums[mid...
class Solution: def findDuplicates(self, nums: List[int]) -> List[int]: if not len(nums): return nums l = [0 for i in range(len(nums)+1)] for i in range(len(nums)): n = nums[i] if l[n]==0: l[n]= 1 else: l[n]+=1 ...
class Solution: def find_duplicates(self, nums: List[int]) -> List[int]: if not len(nums): return nums l = [0 for i in range(len(nums) + 1)] for i in range(len(nums)): n = nums[i] if l[n] == 0: l[n] = 1 else: l[...
# terrascript/resource/at-wat/ucodecov.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:29:37 UTC) __all__ = []
__all__ = []
#Guess my number #Week 2 Finger Exercise 3 print ("Please think of a number between 0 and 100!") print ("Is your secret number 50?") s=[x for x in range (100)] i=input("Enter 'h' to indicate the guess is too high. Enter 'l' to indicate the guess is too low. Enter 'c' to indicate I guessed correctly.") j=0 k=len(s) m=50...
print('Please think of a number between 0 and 100!') print('Is your secret number 50?') s = [x for x in range(100)] i = input("Enter 'h' to indicate the guess is too high. Enter 'l' to indicate the guess is too low. Enter 'c' to indicate I guessed correctly.") j = 0 k = len(s) m = 50 while i != 'c': if i != 'l': ...
soma = 0 cont = 1 while cont <= 5: x = float(input("Digite a {} nota: ".format(cont))) soma = soma + x cont = cont + 1 media = soma / 5 print('A media final {}'.format(media))
soma = 0 cont = 1 while cont <= 5: x = float(input('Digite a {} nota: '.format(cont))) soma = soma + x cont = cont + 1 media = soma / 5 print('A media final {}'.format(media))
#A program to count the words "to" and "the" present in a text file "poem.txt". countTo = 0 countThe = 0 file = open("poem.txt", "r") listObj = file.readlines() for index in listObj: word = index.split() for search in word: if search == "to": countTo += 1 elif search == "the": ...
count_to = 0 count_the = 0 file = open('poem.txt', 'r') list_obj = file.readlines() for index in listObj: word = index.split() for search in word: if search == 'to': count_to += 1 elif search == 'the': count_the += 1 print("Number of 'to': ", countTo) print("Number of 'th...
FirstLetter = "Hello" SecondLetter = "World" print(f"{FirstLetter} {SecondLetter}!")
first_letter = 'Hello' second_letter = 'World' print(f'{FirstLetter} {SecondLetter}!')
# -*- coding: utf-8 -*- # The union() method returns a new set with all items from both sets: set1 = {"a", "b" , "c"} set2 = {1, 2, 3} set3 = set1.union(set2) print(set3) # Return a set that contains the items that exist in both set x, and set y: x = {"apple", "banana", "cherry"} y = {"google", "microsoft", "apple"} z ...
set1 = {'a', 'b', 'c'} set2 = {1, 2, 3} set3 = set1.union(set2) print(set3) x = {'apple', 'banana', 'cherry'} y = {'google', 'microsoft', 'apple'} z = x.intersection(y) print(z) x = {'apple', 'banana', 'cherry'} y = {'google', 'microsoft', 'apple'} x.symmetric_difference_update(y) print(z)
nums1 = {1, 2, 7, 3, 4, 5} nums2 = {4, 5, 6, 8} nums3 = {9, 10} distinct_nums = nums1.union(nums2, nums3) print( distinct_nums)
nums1 = {1, 2, 7, 3, 4, 5} nums2 = {4, 5, 6, 8} nums3 = {9, 10} distinct_nums = nums1.union(nums2, nums3) print(distinct_nums)
# fmt: off print(2.2j.real) print(2.2j.imag) print(1.1+0.5j.real) print(1.1+0.5j.imag)
print(2.2j.real) print(2.2j.imag) print(1.1 + 0.5j.real) print(1.1 + 0.5j.imag)
def test_get_work_film(work_object_film): details = work_object_film.get_details() if not isinstance(details, dict): raise AssertionError() if not len(details) == 17: print(len(details)) raise AssertionError() def test_rating_work_film(work_object_film): main_rating = work_obj...
def test_get_work_film(work_object_film): details = work_object_film.get_details() if not isinstance(details, dict): raise assertion_error() if not len(details) == 17: print(len(details)) raise assertion_error() def test_rating_work_film(work_object_film): main_rating = work_obj...
numbers_1 = [1, 2, 3, 4] numbers_2 = [3, 4, 5, 6] answer = [number for number in numbers_1 if number in numbers_2] print(answer) friends = ['Elie', 'Colt', 'Matt'] answer2 = [friend.lower()[::-1] for friend in friends] print(answer2)
numbers_1 = [1, 2, 3, 4] numbers_2 = [3, 4, 5, 6] answer = [number for number in numbers_1 if number in numbers_2] print(answer) friends = ['Elie', 'Colt', 'Matt'] answer2 = [friend.lower()[::-1] for friend in friends] print(answer2)
#!/usr/bin/python # Examples of function in Python 3.x # When you need a function? # When you want to perform a set of specific tasks and want to reuse that code whenever required # Also, for better modularity, readability and troubleshooting # How to write a function (Syntax)? '''def function_name(): { ...
"""def function_name(): { # some code here } """ def add_numbers(num1, num2): return num1 + num2 print(add_numbers(5, 4)) def is_even(num): if num % 2 == 0: return True return False num = 12 result = is_even(num) if result: print(f'{num} is even') else: print(f'{num} is not...
print("Welcome!") is_able_to_ride = "" first_rider_age = int(input("What is the age of the first rider? ")) first_rider_height = float(input("What is the height of the first rider? ")) is_a_second_rider = input("Is there a second rider (yes/no)? ") if is_a_second_rider == "yes": second_rider_age = int(input("Wha...
print('Welcome!') is_able_to_ride = '' first_rider_age = int(input('What is the age of the first rider? ')) first_rider_height = float(input('What is the height of the first rider? ')) is_a_second_rider = input('Is there a second rider (yes/no)? ') if is_a_second_rider == 'yes': second_rider_age = int(input('What i...
def main(): pass # Run this when called from CLI if __name__ == "__main__": main()
def main(): pass if __name__ == '__main__': main()
# test for for x in range(10): print(x) for x in range(3, 10): print(x) for x in range(1, 10, 3): print(x) for i, v in enumerate(["a", "b", "c"]): print(i, v) for x in [1,2,3,4]: print(x) for k, v in d.items(): print(x) for a, b, c in [(1,2,3), (4,5,6)]: a = a + 1 b = b * 2 c ...
for x in range(10): print(x) for x in range(3, 10): print(x) for x in range(1, 10, 3): print(x) for (i, v) in enumerate(['a', 'b', 'c']): print(i, v) for x in [1, 2, 3, 4]: print(x) for (k, v) in d.items(): print(x) for (a, b, c) in [(1, 2, 3), (4, 5, 6)]: a = a + 1 b = b * 2 c = c /...
class ErrorMessage: @staticmethod def inline_link_uid_not_exist(uid): return ( "error: DocumentIndex: " "the inline link references an " "object with an UID " "that does not exist: " f"{uid}." )
class Errormessage: @staticmethod def inline_link_uid_not_exist(uid): return f'error: DocumentIndex: the inline link references an object with an UID that does not exist: {uid}.'
''' You are given an array (which will have a length of at least 3, but could be very large) containing integers. The array is either entirely comprised of odd integers or entirely comprised of even integers except for a single integer N. Write a method that takes the array as an argument and returns this "outlier" N. ...
""" You are given an array (which will have a length of at least 3, but could be very large) containing integers. The array is either entirely comprised of odd integers or entirely comprised of even integers except for a single integer N. Write a method that takes the array as an argument and returns this "outlier" N. ...
class Plugin: max = 1 min = 0 def __init__(self, name): self.name = name
class Plugin: max = 1 min = 0 def __init__(self, name): self.name = name
def load(): data = [] targets = [] f = open('sonar.data', 'r+') line = f.readline() while line: s = line.strip().split(',') d = s[0:len(s)-1] t = 1 if s[len(s)-1] == 'M' else 0 for i in range(len(d)): d[i] = float(d[i]) data.append(d) ta...
def load(): data = [] targets = [] f = open('sonar.data', 'r+') line = f.readline() while line: s = line.strip().split(',') d = s[0:len(s) - 1] t = 1 if s[len(s) - 1] == 'M' else 0 for i in range(len(d)): d[i] = float(d[i]) data.append(d) t...
class InstrumentStatus(object): def __init__(self, actuatorCommands, commandCounter): self._actuatorCommands= actuatorCommands self._commandCounter= commandCounter def commandCounter(self): return self._commandCounter def actuatorCommands(self...
class Instrumentstatus(object): def __init__(self, actuatorCommands, commandCounter): self._actuatorCommands = actuatorCommands self._commandCounter = commandCounter def command_counter(self): return self._commandCounter def actuator_commands(self): return self._actuatorCo...
pkgname = "startup-notification" pkgver = "0.12" pkgrel = 0 build_style = "gnu_configure" configure_args = ["lf_cv_sane_realloc=yes", "lf_cv_sane_malloc=yes"] hostmakedepends = ["pkgconf"] makedepends = ["libx11-devel", "libsm-devel", "xcb-util-devel"] pkgdesc = "Library for tracking application startup" maintainer = "...
pkgname = 'startup-notification' pkgver = '0.12' pkgrel = 0 build_style = 'gnu_configure' configure_args = ['lf_cv_sane_realloc=yes', 'lf_cv_sane_malloc=yes'] hostmakedepends = ['pkgconf'] makedepends = ['libx11-devel', 'libsm-devel', 'xcb-util-devel'] pkgdesc = 'Library for tracking application startup' maintainer = '...
# the defined voltage response from a type K thermocouple # from https://srdata.nist.gov/its90/download/type_k.tab ktype = { #temp in C: millivolt response -270: -6.458, -269: -6.457, -268: -6.456, -267: -6.455, -266: -6.453, -265: -6.452, -264: -6.450, -263: -6.448, ...
ktype = {-270: -6.458, -269: -6.457, -268: -6.456, -267: -6.455, -266: -6.453, -265: -6.452, -264: -6.45, -263: -6.448, -262: -6.446, -261: -6.444, -260: -6.441, -259: -6.438, -258: -6.435, -257: -6.432, -256: -6.429, -255: -6.425, -254: -6.421, -253: -6.417, -252: -6.413, -251: -6.408, -250: -6.404, -249: -6.399, -248...
''' author : https://github.com/Harnek Prim's algorithm is a minimum-spanning-tree algorithm (for weighted undirected graph) Complexity: Performance:: Adjacency matrix = O(|V|^2) Adjacency list with heap = O(|E| log|V|) ''' def prim(s, edges, n): wt = 0 V = set(range(1,n+1)) A = set() A.add(s...
""" author : https://github.com/Harnek Prim's algorithm is a minimum-spanning-tree algorithm (for weighted undirected graph) Complexity: Performance:: Adjacency matrix = O(|V|^2) Adjacency list with heap = O(|E| log|V|) """ def prim(s, edges, n): wt = 0 v = set(range(1, n + 1)) a = set() A.ad...
''' Problem Statement : GCD Choice Link : https://www.hackerearth.com/challenges/competitive/october-easy-20/algorithm/gcd-choice-f04433f3/ Score : partially accepted - 43 pts ''' def find_gcd(x, y): while(y): x, y = y, x % y return x n = int(input()) numbers = list(map(int,input().spl...
""" Problem Statement : GCD Choice Link : https://www.hackerearth.com/challenges/competitive/october-easy-20/algorithm/gcd-choice-f04433f3/ Score : partially accepted - 43 pts """ def find_gcd(x, y): while y: (x, y) = (y, x % y) return x n = int(input()) numbers = list(map(int, input().spli...
teacher = "Mr. Zhang" print(teacher) print("53+28") print(53+28) first = 5 second = 3 print(first + second) third = first + second print(third) teacher_a="Mr. Zhang" teacher_b=teacher_a print(teacher_a) print(teacher_b) teacher_a="Mr.Yu" print(teacher_a) print(teacher_b) score=7 score = score + 1 print(score)...
teacher = 'Mr. Zhang' print(teacher) print('53+28') print(53 + 28) first = 5 second = 3 print(first + second) third = first + second print(third) teacher_a = 'Mr. Zhang' teacher_b = teacher_a print(teacher_a) print(teacher_b) teacher_a = 'Mr.Yu' print(teacher_a) print(teacher_b) score = 7 score = score + 1 print(score)
__all__ = [ "utils", "ascii_table", "astronomy", "data_plot", "h5T", "mesa", "nugridse", "ppn", "selftest", ]
__all__ = ['utils', 'ascii_table', 'astronomy', 'data_plot', 'h5T', 'mesa', 'nugridse', 'ppn', 'selftest']
## https://leetcode.com/problems/implement-strstr/ ## problem is to find where the needle occurs in the haystack. ## do this in O(n) by looping over the characters in the haystack ## and checking if the string started by that index (and as long ## as the needle) is equal to the needle. ## return -1 if we get to the ...
class Solution: def str_str(self, haystack: str, needle: str) -> int: nlen = len(needle) if not nlen: return 0 if not len(haystack): return -1 for ii in range(len(haystack) - nlen + 1): if haystack[ii:ii + nlen] == needle: return i...
value = '16b87ecc17e3568c83d2d55d8c0d7260' # https://md5.gromweb.com/?md5=16b87ecc17e3568c83d2d55d8c0d7260 print('flippit')
value = '16b87ecc17e3568c83d2d55d8c0d7260' print('flippit')
def paint(x, y): global a global pic if not (0 <= x < a and 0 <= y < a): return if pic[x][y] == '+': return pic[x][y] = '+' paint(x+1, y) paint(x-1, y) paint(x, y+1) paint(x, y-1) output = [] a = int(input()) pic = [] for i in range(a): pic.append(list(input()))...
def paint(x, y): global a global pic if not (0 <= x < a and 0 <= y < a): return if pic[x][y] == '+': return pic[x][y] = '+' paint(x + 1, y) paint(x - 1, y) paint(x, y + 1) paint(x, y - 1) output = [] a = int(input()) pic = [] for i in range(a): pic.append(list(inp...
str1 = input("Enter the postfix expression:") list1 = str1.split() stack = list() print(list1) # 2 3 1 * + 9 - here the ans is -4 def isOperator(a): if a == '+' or a == '-' or a == '/' or a == '*': return 1 else: return 0 def evaluate(a, b, c): if a == '+': return b + c elif...
str1 = input('Enter the postfix expression:') list1 = str1.split() stack = list() print(list1) def is_operator(a): if a == '+' or a == '-' or a == '/' or (a == '*'): return 1 else: return 0 def evaluate(a, b, c): if a == '+': return b + c elif a == '-': return b - c ...
# fruits = {} # # fruits["apple"] = "A sweet red fruit" # # fruits["mango"] = "King of all" # # print(fruits["apple"]) line = input() letter = {} for ch in line: if ch in letter: letter[ch] += 1 else: letter[ch] = 1 print(letter) print(letter.keys())
line = input() letter = {} for ch in line: if ch in letter: letter[ch] += 1 else: letter[ch] = 1 print(letter) print(letter.keys())
# from .initial_values import initial_values #----------STATE VARIABLE Genesis DICTIONARY--------------------------- genesis_states = { 'player_200' : False, 'player_250' : False, 'player_300' : False, 'player_350' : False, 'player_400' : False, 'game_200' : False, 'game_250' : F...
genesis_states = {'player_200': False, 'player_250': False, 'player_300': False, 'player_350': False, 'player_400': False, 'game_200': False, 'game_250': False, 'game_300': False, 'game_350': False, 'game_400': False, 'timestamp': '2018-10-01 15:16:24'}
#!/usr/bin/env vpython3 def onefile(fname): data = open(fname, 'rt').read() data = data.replace('FPDF_EXPORT', 'extern') data = data.replace('FPDF_CALLCONV', '') open(fname, 'wt').write(data) onefile('pdfium/include/fpdf_annot.h') onefile('pdfium/include/fpdf_attachment.h') onefile('pdfium/include/fpd...
def onefile(fname): data = open(fname, 'rt').read() data = data.replace('FPDF_EXPORT', 'extern') data = data.replace('FPDF_CALLCONV', '') open(fname, 'wt').write(data) onefile('pdfium/include/fpdf_annot.h') onefile('pdfium/include/fpdf_attachment.h') onefile('pdfium/include/fpdf_catalog.h') onefile('pdf...
def inequality(value): # Complete the if statement on the next line using value, the inequality operator (!=), and the number 13. if value != 13: ### Your code goes above this line ### return "Not Equal to 13" else: return "Equal to 13" print(inequality(100))
def inequality(value): if value != 13: return 'Not Equal to 13' else: return 'Equal to 13' print(inequality(100))
# -*- Mode: Python; test-case-name: test.test_pychecker_CodeChecks -*- # vi:si:et:sw=4:sts=4:ts=4 # trigger opcode 99, DUP_TOPX def duptopx(): d = {} for i in range(0, 9): d[i] = i for k in d: # the += on a dict member triggers DUP_TOPX d[k] += 1
def duptopx(): d = {} for i in range(0, 9): d[i] = i for k in d: d[k] += 1
####################################################### # # track.py # Python implementation of the Class track # Generated by Enterprise Architect # Created on: 11-Feb-2020 11:08:09 AM # Original author: Corvo # ####################################################### class track: # default constructor d...
class Track: speed = '0.00000000' def getspeed(self): return self.speed def setspeed(self, speed=0): self.speed = speed __course = '0.00000000' def getcourse(self): return self.course def setcourse(self, course=0): self.course = course
mylist=['hello',[2,3,4],[40,50,60],['hi'],'how',"bye"] print(mylist) print(mylist[1][1]) mylist=['hello',[2,3,4]] print(mylist[1][0]) num1=[0,32,444,4453,[23,43,54,12,3]] print(num1) num2=[0,32,444,4453] num2.extend([23,43,54,12,3]) print(num2)
mylist = ['hello', [2, 3, 4], [40, 50, 60], ['hi'], 'how', 'bye'] print(mylist) print(mylist[1][1]) mylist = ['hello', [2, 3, 4]] print(mylist[1][0]) num1 = [0, 32, 444, 4453, [23, 43, 54, 12, 3]] print(num1) num2 = [0, 32, 444, 4453] num2.extend([23, 43, 54, 12, 3]) print(num2)
def test(x, y): x + y test( 11111111, test(11111111, 1111111), test(11111111, 1111111), 222, 222, test(11111111, 1111111), test(11111111, 1111111), 222, test(11111111, 1111111), test(11111111, 1111111), test(11111111, 1111111), test(11111111, 1111111), test(1111...
def test(x, y): x + y test(11111111, test(11111111, 1111111), test(11111111, 1111111), 222, 222, test(11111111, 1111111), test(11111111, 1111111), 222, test(11111111, 1111111), test(11111111, 1111111), test(11111111, 1111111), test(11111111, 1111111), test(11111111, 1111111))
# # PySNMP MIB module CISCOTRAP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCOTRAP-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:24:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_union, value_range_constraint, constraints_intersection) ...
data_s3_path = "riskified-research-files/research analysts/DO/representment/win_rate_prediction/exploration" data_file_name = "disputed_chbs_targil_6.csv" cat_features = [ # 'dispute_status', 'domestic_international', 'order_submission_type', 'bill_ship_mismatch', 'is_proxy', 'order_external_st...
data_s3_path = 'riskified-research-files/research analysts/DO/representment/win_rate_prediction/exploration' data_file_name = 'disputed_chbs_targil_6.csv' cat_features = ['domestic_international', 'order_submission_type', 'bill_ship_mismatch', 'is_proxy', 'order_external_status', 'cvv_result', 'avs_result', 'mapped_sou...
# # PySNMP MIB module GMS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/GMS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:06:21 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:23:15)...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, value_size_constraint, constraints_intersection, value_range_constraint) ...
# Copyright (c) 2015 Vivaldi Technologies AS. All rights reserved { 'targets': [ { 'target_name': 'vivaldi_api_registration', 'type': 'static_library', 'msvs_disabled_warnings': [ 4267 ], 'includes': [ '../../chromium/build/json_schema_bundle_registration_compile.gypi', '....
{'targets': [{'target_name': 'vivaldi_api_registration', 'type': 'static_library', 'msvs_disabled_warnings': [4267], 'includes': ['../../chromium/build/json_schema_bundle_registration_compile.gypi', '../schema/vivaldi_schemas.gypi'], 'dependencies': ['../schema/vivaldi_api.gyp:vivaldi_chrome_api', '<(DEPTH)/content/con...
class Solution: def solve(self, nums, a, b, c): q = lambda x: a*(x**2)+b*x+c if not nums: return [] if len(nums) == 1: return list(map(q,nums)) if a == 0: if b > 0: return list(map(q,nums)) else: return list(map(q,re...
class Solution: def solve(self, nums, a, b, c): q = lambda x: a * x ** 2 + b * x + c if not nums: return [] if len(nums) == 1: return list(map(q, nums)) if a == 0: if b > 0: return list(map(q, nums)) else: ...
def Vertical_Concatenation(Test_list): Result = [] n = 0 while n != len(Test_list): temp = '' for indexes in Test_list: try: temp += indexes[n] except IndexError: pass n += 1 Result.append(temp) return Re...
def vertical__concatenation(Test_list): result = [] n = 0 while n != len(Test_list): temp = '' for indexes in Test_list: try: temp += indexes[n] except IndexError: pass n += 1 Result.append(temp) return Result test_l...
#!/usr/bin/env python3 class UserError(Exception): pass
class Usererror(Exception): pass
self.description = "check file type without mtree" self.filesystem = [ "bar/", "foo -> bar/" ] pkg = pmpkg("dummy") pkg.files = [ "foo/" ] self.addpkg2db("local",pkg) self.args = "-Qk" self.addrule("PACMAN_RETCODE=1") self.addrule("PACMAN_OUTPUT=warning.*(File type mismatch)")
self.description = 'check file type without mtree' self.filesystem = ['bar/', 'foo -> bar/'] pkg = pmpkg('dummy') pkg.files = ['foo/'] self.addpkg2db('local', pkg) self.args = '-Qk' self.addrule('PACMAN_RETCODE=1') self.addrule('PACMAN_OUTPUT=warning.*(File type mismatch)')
#Solution-7 Lisa Murray # User needs to input number that they want to calculate the square root of: num = float(input("Please enter a positive number: ")) #square root is found by raising the number to the power of a half sqroot = num**(1/2) # round the square root number to one decimal place and cast as a string a...
num = float(input('Please enter a positive number: ')) sqroot = num ** (1 / 2) ans = str(round(sqroot, 1)) print(f'The square root of {num} is approx. {ans}.')
# MadLib.py adjective = input("Please enter an adjective: ") noun = input("Please enter a noun: ") verb = input("Please enter a verb ending in -ed: ") print("Your MadLib:") print("The", adjective, noun, verb, "over the lazy brown dog.")
adjective = input('Please enter an adjective: ') noun = input('Please enter a noun: ') verb = input('Please enter a verb ending in -ed: ') print('Your MadLib:') print('The', adjective, noun, verb, 'over the lazy brown dog.')
class Node: def __init__(self,cargo,left=None,right=None): self.cargo = cargo self.left = left self.right = right def __str__(self) -> str: return str(self.cargo) def insert(root,key): if root is None: return Node(key) if root.cargo>key: if root.left is ...
class Node: def __init__(self, cargo, left=None, right=None): self.cargo = cargo self.left = left self.right = right def __str__(self) -> str: return str(self.cargo) def insert(root, key): if root is None: return node(key) if root.cargo > key: if root.l...
num1 = 1 num2 = 2 num3 = 3 num4 = 33 num6 = 66
num1 = 1 num2 = 2 num3 = 3 num4 = 33 num6 = 66
class input_format(): def __init__(self,format_tag): self.tag = format_tag def print_sample_input(self): if self.tag =='FCC_BCC_Edge_Ternary': print(''' Sample JSON for using pseudo-ternary predictions of solid solution strength by Curtin edge dislocation model. --...
class Input_Format: def __init__(self, format_tag): self.tag = format_tag def print_sample_input(self): if self.tag == 'FCC_BCC_Edge_Ternary': print('\nSample JSON for using pseudo-ternary predictions of solid solution strength by Curtin edge dislocation model. \n------------------...
def main(): a = float(input("Number a: ")) b = float(input("Number b: ")) if a > b: print("A > b") elif a < b: print("A < B") else: print("A = B") if __name__ == '__main__': main()
def main(): a = float(input('Number a: ')) b = float(input('Number b: ')) if a > b: print('A > b') elif a < b: print('A < B') else: print('A = B') if __name__ == '__main__': main()
# MYSQL CREDENTIALS mysql_user = "root" mysql_pass = "clickhouse" # MYSQL8 CREDENTIALS mysql8_user = "root" mysql8_pass = "clickhouse" # POSTGRES CREDENTIALS pg_user = "postgres" pg_pass = "mysecretpassword" pg_db = "postgres" # MINIO CREDENTIALS minio_access_key = "minio" minio_secret_key = "minio123" # MONGODB ...
mysql_user = 'root' mysql_pass = 'clickhouse' mysql8_user = 'root' mysql8_pass = 'clickhouse' pg_user = 'postgres' pg_pass = 'mysecretpassword' pg_db = 'postgres' minio_access_key = 'minio' minio_secret_key = 'minio123' mongo_user = 'root' mongo_pass = 'clickhouse' odbc_mysql_uid = 'root' odbc_mysql_pass = 'clickhouse'...
# Find cure root using bisection search num = 43 eps = 1e-6 iteration = 0 croot = num/2 _high = num _low = 1 while abs(croot**3-num)>eps: iteration+=1 cube = croot**3 if cube==num: print(f'At Iteration {iteration} : Found It!, the cube root for {num} is {croot}') break elif cube>num: ...
num = 43 eps = 1e-06 iteration = 0 croot = num / 2 _high = num _low = 1 while abs(croot ** 3 - num) > eps: iteration += 1 cube = croot ** 3 if cube == num: print(f'At Iteration {iteration} : Found It!, the cube root for {num} is {croot}') break elif cube > num: _high = croot ...
level = 3 name = 'Kertasari' capital = 'Cibeureum' area = 152.07
level = 3 name = 'Kertasari' capital = 'Cibeureum' area = 152.07
class IllegalValueException(Exception): def __init__(self, message): super().__init__(message) class IllegalCurrencyException(Exception): def __init__(self, message): super().__init__(message) class IllegalCoinException(Exception): def __init__(self, message): super().__init__(m...
class Illegalvalueexception(Exception): def __init__(self, message): super().__init__(message) class Illegalcurrencyexception(Exception): def __init__(self, message): super().__init__(message) class Illegalcoinexception(Exception): def __init__(self, message): super().__init__(m...
class Solution: @lru_cache(None) def numRollsToTarget(self, d: int, f: int, target: int) -> int: if d==1: if f>=target:return 1 return 0 count=0 for i in range(1,f+1): if i<target: count += self.numRollsToTarget(d-1,f,target-i) ...
class Solution: @lru_cache(None) def num_rolls_to_target(self, d: int, f: int, target: int) -> int: if d == 1: if f >= target: return 1 return 0 count = 0 for i in range(1, f + 1): if i < target: count += self.numRollsT...
# Tags: Implementation # Difficulty: 1.5 # Priority: 5 # Date: 08-06-2017 hh, mm = map(int, input().split(':')) a = int( input() ) % ( 60 * 24 ) mm += a hh += mm // 60 mm %= 60 hh %= 24 print('%0.2d:%0.2d' %(hh, mm))
(hh, mm) = map(int, input().split(':')) a = int(input()) % (60 * 24) mm += a hh += mm // 60 mm %= 60 hh %= 24 print('%0.2d:%0.2d' % (hh, mm))
# # PySNMP MIB module HUAWEI-BRAS-SRVCFG-DEVICE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-BRAS-SRVCFG-DEVICE-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:43:28 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ve...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, single_value_constraint, value_size_constraint, constraints_union) ...
class Solution: def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]: child = collections.defaultdict(set) parent = collections.defaultdict(int) for c, p in prerequisites: child[p].add(c) parent[c] +=1 q = collections.dequ...
class Solution: def find_order(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]: child = collections.defaultdict(set) parent = collections.defaultdict(int) for (c, p) in prerequisites: child[p].add(c) parent[c] += 1 q = collections.deque() ...
''' URL: https://leetcode.com/problems/monotonic-array/ Difficulty: Easy Title: Monotonic Array ''' ################### Code ################### class Solution: def isMonotonic(self, A: List[int]) -> bool: if len(A) in [1, 2]: return True cmp = None ...
""" URL: https://leetcode.com/problems/monotonic-array/ Difficulty: Easy Title: Monotonic Array """ class Solution: def is_monotonic(self, A: List[int]) -> bool: if len(A) in [1, 2]: return True cmp = None for i in range(len(A) - 1): diff = A[i + 1] - A[i] ...
#NUMBERS 10 #Numero Entero (integer) 10.4 #Numero Flotante (float) print(type(10)) print(type(10.4)) #INPUT age = input('Coloque su edad: ') print(type(age)) new_age = int(age) + 5 print(new_age)
10 10.4 print(type(10)) print(type(10.4)) age = input('Coloque su edad: ') print(type(age)) new_age = int(age) + 5 print(new_age)
transactions_count = int(input('Enter number of transactions: ')) total = 0 while True: if transactions_count <= 0: break transactions_cash = float(input('Enter transactions amount: ')) if transactions_cash >= 1: total += transactions_cash transactions_count -= 1 continue...
transactions_count = int(input('Enter number of transactions: ')) total = 0 while True: if transactions_count <= 0: break transactions_cash = float(input('Enter transactions amount: ')) if transactions_cash >= 1: total += transactions_cash transactions_count -= 1 continue ...
class dotRebarSplice_t(object): # no doc BarPositions=None Clearance=None LapLength=None ModelObject=None Offset=None Reinforcement1=None Reinforcement2=None Type=None
class Dotrebarsplice_T(object): bar_positions = None clearance = None lap_length = None model_object = None offset = None reinforcement1 = None reinforcement2 = None type = None
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: dummy = l3 = ListNode(0) while l1 and l2: if l1.val > l2.val: ...
class Solution: def merge_two_lists(self, l1: ListNode, l2: ListNode) -> ListNode: dummy = l3 = list_node(0) while l1 and l2: if l1.val > l2.val: l3.next = list_node(l2.val) l3 = l3.next l2 = l2.next else: l3.ne...
'''https://leetcode.com/problems/remove-duplicates-from-sorted-array/''' # class Solution: # def removeDuplicates(self, nums: List[int]) -> int: # l = len(nums) # ans = 0 # for i in range(1, l): # if nums[i]!=nums[ans]: # ans+=1 # nums[i], nums[an...
"""https://leetcode.com/problems/remove-duplicates-from-sorted-array/""" class Solution: def remove_duplicates(self, nums: List[int]) -> int: if len(nums) < 2: return len(nums) (p1, p2) = (0, 1) while p2 < len(nums): if nums[p2] != nums[p1]: p1 += 1 ...
#!/usr/bin/env python3 def lst_intersection(lst1:list, lst2:list): ''' Source: https://www.geeksforgeeks.org/python-intersection-two-lists/ ''' return [value for value in lst1 if value in set(lst2)] def main(): return lst_intersection(lst1, lst2) if __name__ == "__main__": main()
def lst_intersection(lst1: list, lst2: list): """ Source: https://www.geeksforgeeks.org/python-intersection-two-lists/ """ return [value for value in lst1 if value in set(lst2)] def main(): return lst_intersection(lst1, lst2) if __name__ == '__main__': main()
__author__ = 'huanpc' ######################################################################################################################## HOST = "25.22.28.94" PORT = 3307 USER = "root" PASSWORD = "root" DB = "opencart" TABLE_ADDRESS = 'oc_address' TABLE_CUSTOMER= 'oc_customer' #####################################...
__author__ = 'huanpc' host = '25.22.28.94' port = 3307 user = 'root' password = 'root' db = 'opencart' table_address = 'oc_address' table_customer = 'oc_customer' dir_output_path = './Test_plan' num_of_threads = 10 opencart_port = 10000 ram_up = 10 config_file_path = DIR_OUTPUT_PATH + '/config.csv' test_plan_file_path_...
def abort_if_false(ctx, param, value): if not value: ctx.abort()
def abort_if_false(ctx, param, value): if not value: ctx.abort()
HOST = "irc.twitch.tv" PORT = 6667 OAUTH = "" # generate from http://www.twitchapps.com/tmi/ IDENT = "" # twitch account for which you used the oauth CHANNEL = ""
host = 'irc.twitch.tv' port = 6667 oauth = '' ident = '' channel = ''
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): # write your code in Python 3.6 capacity = 5000-A[0] apples = sorted(A[1:]) sum = 0 total = 0 for idx,a in enumerate(apples): if a+sum > capacity: total = idx ...
def solution(A): capacity = 5000 - A[0] apples = sorted(A[1:]) sum = 0 total = 0 for (idx, a) in enumerate(apples): if a + sum > capacity: total = idx break else: sum += a return total if __name__ == '__main__': print(solution([4650, 150, 1...
whole_clinit = [ '\n' '.method static constructor <clinit>()V\n' ' .locals 1\n' '\n' ' :try_start_0\n' ' const-string v0, "nc"\n' '\n' ' invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V\n' ' :try_end_0\n' ' .catch Ljava/lang/UnsatisfiedLi...
whole_clinit = ['\n.method static constructor <clinit>()V\n .locals 1\n\n :try_start_0\n const-string v0, "nc"\n\n invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V\n :try_end_0\n .catch Ljava/lang/UnsatisfiedLinkError; {:try_start_0 .. :try_end_0} :catch_0\n\n goto :goto_0\n...
class ValidBlockNetException(Exception): pass
class Validblocknetexception(Exception): pass
''' Given two integer arrays startTime and endTime and given an integer queryTime. The ith student started doing their homework at the time startTime[i] and finished it at time endTime[i]. Return the number of students doing their homework at time queryTime. More formally, return the number of students where queryTim...
""" Given two integer arrays startTime and endTime and given an integer queryTime. The ith student started doing their homework at the time startTime[i] and finished it at time endTime[i]. Return the number of students doing their homework at time queryTime. More formally, return the number of students where queryTim...
numbers = input('Enter a list of numbers (csv): ').replace(' ','').split(',') numbers = [int(i) for i in numbers] def sum_of_three(numbers): summ = 0 for i in numbers: summ += i return summ print('Sum:', sum_of_three(numbers))
numbers = input('Enter a list of numbers (csv): ').replace(' ', '').split(',') numbers = [int(i) for i in numbers] def sum_of_three(numbers): summ = 0 for i in numbers: summ += i return summ print('Sum:', sum_of_three(numbers))
{ "targets": [{ "target_name" : "test", "defines": [ "V8_DEPRECATION_WARNINGS=1" ], "sources" : [ "test.cpp" ], "include_dirs": ["<!(node -e \"require('..')\")"] }] }
{'targets': [{'target_name': 'test', 'defines': ['V8_DEPRECATION_WARNINGS=1'], 'sources': ['test.cpp'], 'include_dirs': ['<!(node -e "require(\'..\')")']}]}
class QualifierList: def __init__(self, qualifiers): self.qualifiers = qualifiers def insert_qualifier(self, qualifier): self.qualifiers.insert(0, qualifier) def __len__(self): return len(self.qualifiers) def __iter__(self): return self.qualifiers def __str__(se...
class Qualifierlist: def __init__(self, qualifiers): self.qualifiers = qualifiers def insert_qualifier(self, qualifier): self.qualifiers.insert(0, qualifier) def __len__(self): return len(self.qualifiers) def __iter__(self): return self.qualifiers def __str__(sel...
st = input("enter the string") upCount=0 lowCount=0 vowels=0 # for i in range (0,len(st)): # print(st[i]) for i in range (0,len(st)): # print(st[i]) if(st[i].isupper()): upCount+=1 else: lowCount+=1 for i in range(0,len(st)): if(st[i]=='a') or (st[i]=='A') or (st[i]=='e') or (st[i]==...
st = input('enter the string') up_count = 0 low_count = 0 vowels = 0 for i in range(0, len(st)): if st[i].isupper(): up_count += 1 else: low_count += 1 for i in range(0, len(st)): if st[i] == 'a' or st[i] == 'A' or st[i] == 'e' or (st[i] == 'E') or (st[i] == 'i') or (st[i] == 'I') or (st[i] ...
def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Gender, obj[4]: Age, obj[5]: Children, obj[6]: Education, obj[7]: Occupation, obj[8]: Income, obj[9]: Bar, obj[10]: Coffeehouse, obj[11]: Restaurant20to50, obj[12]: Direction_same, obj[13]: Distance # {"feature": "Income", "instances": 34...
def find_decision(obj): if obj[8] <= 5: if obj[6] <= 3: if obj[7] > 2: if obj[4] <= 5: if obj[11] > 0.0: if obj[10] > 0.0: if obj[2] > 2: if obj[9] <= 2.0: ...
# (c) Copyright IBM Corp. 2010, 2020. All Rights Reserved. # Validate that incident name does not contain 'X' if 'X' in incident.name: helper.fail("The name must not contain 'X'.") # Validate length of the incident name if len(incident.name) > 100: helper.fail("The name must be less than 100 characters.")
if 'X' in incident.name: helper.fail("The name must not contain 'X'.") if len(incident.name) > 100: helper.fail('The name must be less than 100 characters.')
class VerifierError(Exception): pass class VerifierTranslatorError(Exception): pass __all__ = ["VerifierError", "VerifierTranslatorError"]
class Verifiererror(Exception): pass class Verifiertranslatorerror(Exception): pass __all__ = ['VerifierError', 'VerifierTranslatorError']
a = input() a = int(a) b = input() set1 = set() b.lower() for x in b: set1.add(x.lower()) if len(set1) == 26: print("YES") else: print("NO")
a = input() a = int(a) b = input() set1 = set() b.lower() for x in b: set1.add(x.lower()) if len(set1) == 26: print('YES') else: print('NO')
vfx = None ## # Init midi module # # @param: vfx object # @return: void ## def init(vfx_obj): global vfx vfx = vfx_obj def debug(): global vfx if(vfx.usb_midi_connected == False): print('Midi not connected') pass print("Midi trig: %s | id: %s | name: %s |active ch: %s | midi new...
vfx = None def init(vfx_obj): global vfx vfx = vfx_obj def debug(): global vfx if vfx.usb_midi_connected == False: print('Midi not connected') pass print('Midi trig: %s | id: %s | name: %s |active ch: %s | midi new: %s | clock: %s | pgm: %s | cc: %s | note: %s ' % (str(vfx.usb_midi...
def mail_send(to, subject, content): print(to) print(subject) print(content)
def mail_send(to, subject, content): print(to) print(subject) print(content)
a = 1 b = 0 c = 0 i = 0 while True: c = a + b b = a a = c if i % 100000 == 0: print(c) i += 1
a = 1 b = 0 c = 0 i = 0 while True: c = a + b b = a a = c if i % 100000 == 0: print(c) i += 1
def create_sensorinfo_file(directory): pass def create_metadata_file(directory): pass def create_delivery_note_file(directory): pass def create_data_delivery(directory): pass
def create_sensorinfo_file(directory): pass def create_metadata_file(directory): pass def create_delivery_note_file(directory): pass def create_data_delivery(directory): pass
class Plugin_OBJ(): def __init__(self, plugin_utils): self.plugin_utils = plugin_utils self.channels_json_url = "https://iptv-org.github.io/iptv/channels.json" self.filter_dict = {} self.setup_filters() self.unfiltered_chan_json = None self.filtered_chan_json = ...
class Plugin_Obj: def __init__(self, plugin_utils): self.plugin_utils = plugin_utils self.channels_json_url = 'https://iptv-org.github.io/iptv/channels.json' self.filter_dict = {} self.setup_filters() self.unfiltered_chan_json = None self.filtered_chan_json = None ...
# Chicago 106 problem # try https://e-maxx.ru/algo/levit_algorithm places, streets = list(map(int, input().split())) graph = dict() # dynamic = [-1 for i in range(places)] for i in range(streets): start, end, prob = list(map(int, input().split())) if start not in graph: graph[start] = list() if end...
(places, streets) = list(map(int, input().split())) graph = dict() for i in range(streets): (start, end, prob) = list(map(int, input().split())) if start not in graph: graph[start] = list() if end not in graph: graph[end] = list() graph[start].append(end) graph[end].append(start)
line = input() while line != "0 0 0 0": line = list(map(int, line.split())) starting = line[0] for i in range(4): line[i] = ((line[i] + 40 - starting) % 40) * 9 res = 360 * 3 + (360 - line[1]) % 360 + (360 + line[2] - line[1]) % 360 + (360 + line[2] - line[3]) % 360 print(res) line ...
line = input() while line != '0 0 0 0': line = list(map(int, line.split())) starting = line[0] for i in range(4): line[i] = (line[i] + 40 - starting) % 40 * 9 res = 360 * 3 + (360 - line[1]) % 360 + (360 + line[2] - line[1]) % 360 + (360 + line[2] - line[3]) % 360 print(res) line = input...
# # PySNMP MIB module CISCO-DOT11-WIDS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DOT11-WIDS-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:55:58 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint, constraints_union) ...
SETTING_SERVER_CLOCK = "RAZBERRY_CLOCK" SETTING_SERVER_TIME = "RAZBERRY_TIME" SETTING_LAST_UPDATE = "LAST_UPDATED" SETTING_SERVER_ADDRRESS = "RAZBERRY_SERVER" SETTING_SERVICE_TIMEOUT = "SERVICE_TIMEOUT"
setting_server_clock = 'RAZBERRY_CLOCK' setting_server_time = 'RAZBERRY_TIME' setting_last_update = 'LAST_UPDATED' setting_server_addrress = 'RAZBERRY_SERVER' setting_service_timeout = 'SERVICE_TIMEOUT'
# Example 1 i = 0 while i <= 10: print(i) i += 1 # Example 2 available_fruits = ["Apple", "Pearl", "Banana", "Grapes"] chosen_fruit = '' print("We have the following available fruits: Apple, Pearl, Banana, Grapes") while chosen_fruit not in available_fruits: chosen_fruit = input("Please choose one of the ...
i = 0 while i <= 10: print(i) i += 1 available_fruits = ['Apple', 'Pearl', 'Banana', 'Grapes'] chosen_fruit = '' print('We have the following available fruits: Apple, Pearl, Banana, Grapes') while chosen_fruit not in available_fruits: chosen_fruit = input('Please choose one of the options above: ') if ...
class PaymentError(Exception): pass class MpesaError(PaymentError): pass class InvalidTransactionAmount(MpesaError): pass
class Paymenterror(Exception): pass class Mpesaerror(PaymentError): pass class Invalidtransactionamount(MpesaError): pass
def balancedStringSplit(self, s: str) -> int: l, r = 0, 0 c = 0 for i in range(len(s)): if s[i] == "L": l += 1 if s[i] == "R": r+=1 if l == r: c+=1 return c
def balanced_string_split(self, s: str) -> int: (l, r) = (0, 0) c = 0 for i in range(len(s)): if s[i] == 'L': l += 1 if s[i] == 'R': r += 1 if l == r: c += 1 return c
def fail(): raise Exception("Ooops") def main(): fail() print("We will never reach here") try: main() except Exception as exc: print("Some kind of exception happened") print(exc)
def fail(): raise exception('Ooops') def main(): fail() print('We will never reach here') try: main() except Exception as exc: print('Some kind of exception happened') print(exc)
PREPROD_ENV = 'UAT' PROD_ENV = 'PROD' PREPROD_URL = "https://mercury-uat.phonepe.com" PROD_URL = "https://mercury.phonepe.com" URLS = {PREPROD_ENV:PREPROD_URL,PROD_ENV:PROD_URL}
preprod_env = 'UAT' prod_env = 'PROD' preprod_url = 'https://mercury-uat.phonepe.com' prod_url = 'https://mercury.phonepe.com' urls = {PREPROD_ENV: PREPROD_URL, PROD_ENV: PROD_URL}
class FanHealthStatus(object): def read_get(self, name, idx_name, unity_client): return unity_client.get_fan_health_status(idx_name) class FanHealthStatusColumn(object): def get_idx(self, name, idx, unity_client): return unity_client.get_fans()
class Fanhealthstatus(object): def read_get(self, name, idx_name, unity_client): return unity_client.get_fan_health_status(idx_name) class Fanhealthstatuscolumn(object): def get_idx(self, name, idx, unity_client): return unity_client.get_fans()
__all__ = ['authorize', 'config', 'interactive', 'process']
__all__ = ['authorize', 'config', 'interactive', 'process']