content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
""" Complex Boolean Expressions if 18.5 <= weight / height**2 < 25: print("BMI is considered 'normal'") if is_raining and is_sunny: print("Is there a rainbow?") if (not unsubscribed) and (location == "USA" or location == "CAN"): print("send email") Good and Bad Examples 1. Don't use True or False...
""" Complex Boolean Expressions if 18.5 <= weight / height**2 < 25: print("BMI is considered 'normal'") if is_raining and is_sunny: print("Is there a rainbow?") if (not unsubscribed) and (location == "USA" or location == "CAN"): print("send email") Good and Bad Examples 1. Don't use True or False...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def viterbi(obs, states, start_p, trans_p, emit_p): V = [{}] # list of dictionaries for st in states: V[0][st] = {"prob": start_p[st] * emit_p[st][obs[0]], "prev": None} # Run Viterbi when t > 0 for t in range(1, len(obs)): V.append({}) ...
def viterbi(obs, states, start_p, trans_p, emit_p): v = [{}] for st in states: V[0][st] = {'prob': start_p[st] * emit_p[st][obs[0]], 'prev': None} for t in range(1, len(obs)): V.append({}) for st in states: max_tr_prob = max((V[t - 1][prev_st]['prob'] * trans_p[prev_st][s...
# username and password # import sys # import msvcrt # passwor = '' # while True: # x = msvcrt.getch() # if x == '\r': # break # sys.stdout.write('*') # passwor +=x # print '\n'+pass username= input ("enter your username: \n") password = input ("enter your password: \n") print (" you complet...
username = input('enter your username: \n') password = input('enter your password: \n') print(' you completed your rwgestration \n welcome to the access world') user = input('what is your user name? : \n') passw = input('what is your passsword? :\n') if username == user and password == passw: print('welcome to next...
""" coding: utf-8 Created on 09/11/2020 @author: github.com/edrmonteiro From: Hackerrank challenges Language: Python Group: Warm-up challenges Title: Sales by Match Alex works at a clothing store. There is a large pile of socks that must be paired by color for sale. Given an array of integers representing the color ...
""" coding: utf-8 Created on 09/11/2020 @author: github.com/edrmonteiro From: Hackerrank challenges Language: Python Group: Warm-up challenges Title: Sales by Match Alex works at a clothing store. There is a large pile of socks that must be paired by color for sale. Given an array of integers representing the color ...
class Solution(object): def arrayPairSum(self, nums): """ :type nums: List[int] :rtype: int """ nums = sorted(nums) res = 0 for i in range(0, len(nums), 2): res += nums[i] return res
class Solution(object): def array_pair_sum(self, nums): """ :type nums: List[int] :rtype: int """ nums = sorted(nums) res = 0 for i in range(0, len(nums), 2): res += nums[i] return res
customers = [ dict(id=1, total=200, coupon_code='F20'), dict(id=2, total=150, coupon_code='P30'), dict(id=3, total=100, coupon_code='P50'), dict(id=4, total=110, coupon_code='F15'), ] for customer in customers: code = customer['coupon_code'] if code == 'F20': customer['discount'] = 20.0...
customers = [dict(id=1, total=200, coupon_code='F20'), dict(id=2, total=150, coupon_code='P30'), dict(id=3, total=100, coupon_code='P50'), dict(id=4, total=110, coupon_code='F15')] for customer in customers: code = customer['coupon_code'] if code == 'F20': customer['discount'] = 20.0 elif code == 'F...
def count_substring(string, sub_string): counter = 0; while (string.find(sub_string) >= 0): counter += 1 string = string[string.find(sub_string) + 1:] return counter if __name__ == '__main__': string = input().strip() sub_string = input().strip() count = count_substring(strin...
def count_substring(string, sub_string): counter = 0 while string.find(sub_string) >= 0: counter += 1 string = string[string.find(sub_string) + 1:] return counter if __name__ == '__main__': string = input().strip() sub_string = input().strip() count = count_substring(string, sub_...
# # PySNMP MIB module ZYXEL-BRIDGE-CONTROL-PROTOCOL-TRANSPARENCY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-BRIDGE-CONTROL-PROTOCOL-TRANSPARENCY-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:49:13 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection) ...
a = int(input()) b = int(input()) c = int(input()) d = int(input()) if b == c and a in {8, 9} and d in {8, 9}: print("ignore") else: print("answer")
a = int(input()) b = int(input()) c = int(input()) d = int(input()) if b == c and a in {8, 9} and (d in {8, 9}): print('ignore') else: print('answer')
PREFERENCES = [ ['Delivery driver', 'Haifa', 'No experience', 'Flexible'], ['Web developer', 'Tel Aviv', '5+ years', 'Full-time'], ]
preferences = [['Delivery driver', 'Haifa', 'No experience', 'Flexible'], ['Web developer', 'Tel Aviv', '5+ years', 'Full-time']]
# is_prime(9); //Is a number Prime? # //H: 5 => True, 7 => True, 11 => True, 6 => False def is_prime(number): if(number < 2): return False # check if number is divisible by 2 to number - 1 for divisor in range(2,number): if number % divisor == 0: return False return True ...
def is_prime(number): if number < 2: return False for divisor in range(2, number): if number % divisor == 0: return False return True def sum_upto_n(number): sum = 0 for i in range(1, number + 1): sum = sum + i return sum def calculate_sum_of_divisors(number...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- class HelloWorld(object): def __init__(self, id, name): self.idx = id self.namex = name def play(self): print('idx: {}, namex: {}', self.idx, self.namex) if __name__ == '__main__': HelloWorld(1, '12') print('hello world')
class Helloworld(object): def __init__(self, id, name): self.idx = id self.namex = name def play(self): print('idx: {}, namex: {}', self.idx, self.namex) if __name__ == '__main__': hello_world(1, '12') print('hello world')
# 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, software # distributed under the ...
"""Utils module for miscellaneous general functions. Small functions can go right in here. Larger collections are found in modules contained in the package. """ view_type = type({}.keys()) def flatten(alist): """Flatten a list of lists or views. """ rv = [] for val in alist: if isinstance(val,...
#! n=int(input("Enter a number")) for i in range(1,n): print(i)
n = int(input('Enter a number')) for i in range(1, n): print(i)
#!/usr/bin/env python class Solution: def maxArea(self, height): """ :type height: List[int] :rtype: int """ i, j = 0, len(height)-1 l, r = height[i], height[j] maxArea = (j - i) * min(l, r) while j > i: if l < r: while hei...
class Solution: def max_area(self, height): """ :type height: List[int] :rtype: int """ (i, j) = (0, len(height) - 1) (l, r) = (height[i], height[j]) max_area = (j - i) * min(l, r) while j > i: if l < r: while height[i] <= ...
#a stub module to have a group of functions class test_module_1(object): name = None def __init__(self, name): self.name= name def log(self, info): print('{}{}'.format('test_module_1: ',info)) def function_1(self,*args, **kwargs): self.log('args: '+'{}'.format(args)) sel...
class Test_Module_1(object): name = None def __init__(self, name): self.name = name def log(self, info): print('{}{}'.format('test_module_1: ', info)) def function_1(self, *args, **kwargs): self.log('args: ' + '{}'.format(args)) self.log('kwargs:') for k in kwa...
# -*- coding: utf-8 -*- # @Author: Damien FERRERE # @Date: 2018-05-22 21:14:37 # @Last Modified by: Damien FERRERE # @Last Modified time: 2018-05-22 21:16:10 class IPXRelaysConfig: 'IPX800 Relays configuration class' enabled_relays = [] # List of relays user want to control names_retrieved = False # indic...
class Ipxrelaysconfig: """IPX800 Relays configuration class""" enabled_relays = [] names_retrieved = False def __init__(self, enabled_relays): self.enabled_relays = enabled_relays class Ipxrelay: number = 0 name = '' _ipx = None def __init__(self, ipx, relay_no, name='', curre...
def onRequest(request, response, modules): response.send({ "urlParams": request.getQueryParams(), "bodyParams": request.getParams(), "headers": request.getHeaders(), "method": request.getMethod(), "path": request.getPath() })
def on_request(request, response, modules): response.send({'urlParams': request.getQueryParams(), 'bodyParams': request.getParams(), 'headers': request.getHeaders(), 'method': request.getMethod(), 'path': request.getPath()})
WEBSOCKET_DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ" class NewDataEvent: def __init__(self, id, topic, payload, timestamp, qos): self._type = "data-sensor" self._id = id self._topic = topic self._payload = payload self._timestamp = timestamp self._qos = qos @...
websocket_datetime_format = '%Y-%m-%dT%H:%M:%S.%fZ' class Newdataevent: def __init__(self, id, topic, payload, timestamp, qos): self._type = 'data-sensor' self._id = id self._topic = topic self._payload = payload self._timestamp = timestamp self._qos = qos @pro...
# ***************************************************************** # Copyright 2015 MIT Lincoln Laboratory # Project: SPAR # Authors: SY # Description: IBM TA2 circuit object superclass # # Modifications: # Date Name Modification # ---- ---- ...
class Ibmcircuitobject(object): """ This superclass represents any object (a wire or gate) found in an IBM circuit. This class is never meant to be instantiated; only its subclasses are. It holds some fields and methods common to all circuit objects. """ def __init__(self, displayname, D, l...
a = int(input()) c = [] for i in range(a): b = [] for x in range(4): c = input().split()[-1][::-1].lower() for n in c: if n == "a" or n == "e" or n == "i" or n == "o" or n == "u": b.append(c[:c.index(n) + 1]) break if len(b) < x + 1: ...
a = int(input()) c = [] for i in range(a): b = [] for x in range(4): c = input().split()[-1][::-1].lower() for n in c: if n == 'a' or n == 'e' or n == 'i' or (n == 'o') or (n == 'u'): b.append(c[:c.index(n) + 1]) break if len(b) < x + 1: ...
def merge_sort(alist): print(f'Splitting {alist}') if len(alist) > 1: mid = len(alist) // 2 # slice operator is O(k), this can be avoided by passing start, end # indexes into merge sort left = alist[:mid] right = alist[mid:] # Assume list is sorted merge...
def merge_sort(alist): print(f'Splitting {alist}') if len(alist) > 1: mid = len(alist) // 2 left = alist[:mid] right = alist[mid:] merge_sort(left) merge_sort(right) i = 0 j = 0 k = 0 while i < len(left) and j < len(right): if l...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 3 19:26:47 2019 @author: sercangul """ a, b = map(float, input().split()) n = float(input()) p = a/b q = 1-p result = (q**(n-1))* p print (round(result,3))
""" Created on Mon Jun 3 19:26:47 2019 @author: sercangul """ (a, b) = map(float, input().split()) n = float(input()) p = a / b q = 1 - p result = q ** (n - 1) * p print(round(result, 3))
def main(): a,b = map(int,input().split()) ans = ["",0] h = ["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW","N"] a = (a*10 + 1125) // 2250 b /= 60 ans[0] = h[a] if 0 <= b and b < 0.25: ans[1] = 0 elif b < 1.55: ans[1] = 1 elif b < ...
def main(): (a, b) = map(int, input().split()) ans = ['', 0] h = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW', 'N'] a = (a * 10 + 1125) // 2250 b /= 60 ans[0] = h[a] if 0 <= b and b < 0.25: ans[1] = 0 elif b < 1.55: a...
""" LeetCode Problem: 1247. Minimum Swaps to Make Strings Equal Link: https://leetcode.com/problems/minimum-swaps-to-make-strings-equal/ Language: Python Written by: Mostofa Adib Shakib Time Complexity: O(n) Space Complexity: O(1) Explanation: 1) Use "x_y" when x in s1 at index i and y in s2 at same index i. 2) Use...
""" LeetCode Problem: 1247. Minimum Swaps to Make Strings Equal Link: https://leetcode.com/problems/minimum-swaps-to-make-strings-equal/ Language: Python Written by: Mostofa Adib Shakib Time Complexity: O(n) Space Complexity: O(1) Explanation: 1) Use "x_y" when x in s1 at index i and y in s2 at same index i. 2) Use...
# using classes class Wing(object): #NOTE use __slots__ to avoid unintended mistakes __slots__ = ['coordroot', 'coordtip', 'span', 'sweepdeg'] def __init__(self): self.coordroot = 2 self.coordtip = 1 self.span = 20 self.sweepdeg = 30 class Fuselage(object): #NOTE use __s...
class Wing(object): __slots__ = ['coordroot', 'coordtip', 'span', 'sweepdeg'] def __init__(self): self.coordroot = 2 self.coordtip = 1 self.span = 20 self.sweepdeg = 30 class Fuselage(object): __slots__ = ['radius', 'length'] def __init__(self): self.radius = 1...
word2int_en = { "animosity":10581, "tearing":6525, "blivet":33424, "fomentation":25039, "triennial":22152, "cybercrud":33456, "flower":2250, "tlingit":29988, "invade":9976, "lamps":4886, "watercress":22874, "than":164, "woozy":28419, "lice":16885, "chirp":16036, "gracefulness":17688, "sundew":28491, "kenyan":27735, "re...
word2int_en = {'animosity': 10581, 'tearing': 6525, 'blivet': 33424, 'fomentation': 25039, 'triennial': 22152, 'cybercrud': 33456, 'flower': 2250, 'tlingit': 29988, 'invade': 9976, 'lamps': 4886, 'watercress': 22874, 'than': 164, 'woozy': 28419, 'lice': 16885, 'chirp': 16036, 'gracefulness': 17688, 'sundew': 28491, 'ke...
def isHappy(n): if len(str(n))==1 and n==1: return True seen=set() while n!=1: num = str(n) n=0 for i in range(len(num)): n +=int(num[i])**2 if n not in seen: seen.add(n) else: return False return True i...
def is_happy(n): if len(str(n)) == 1 and n == 1: return True seen = set() while n != 1: num = str(n) n = 0 for i in range(len(num)): n += int(num[i]) ** 2 if n not in seen: seen.add(n) else: return False return True if _...
# database class to manage all database related info class database: # used to setup variables with self to be used in the class def __init__(self): # student accounts self.students = [ ['anthony', 'rangers20', False, False], ["stephanie",...
class Database: def __init__(self): self.students = [['anthony', 'rangers20', False, False], ['stephanie', '2kool4school', False, False]] self.teachers = [['jack', 'JacK', True, False], ['ruth', 'iloveu', True, False], ['max', 'p@ssword!', True, False]] self.supervisors = [['principle', 'me...
entity_to_index = {} summary_to_entity = {} summary_to_entity['Shipping Date'] = 'shipped' summary_to_entity['Results Received/ NRC-PBI LIMS Request #'] = 'received' summary_to_entity['Project'] = 'project' summary_to_entity['SFF'] = 'sff' summary_to_entity['Mid Set'] = 'mid_set' summary_to_entity['Plate'] = 'plate' s...
entity_to_index = {} summary_to_entity = {} summary_to_entity['Shipping Date'] = 'shipped' summary_to_entity['Results Received/ NRC-PBI LIMS Request #'] = 'received' summary_to_entity['Project'] = 'project' summary_to_entity['SFF'] = 'sff' summary_to_entity['Mid Set'] = 'mid_set' summary_to_entity['Plate'] = 'plate' su...
class DirectiveImporter(): def extract(): pass
class Directiveimporter: def extract(): pass
# -*- coding: utf-8 -*- X1, Y1 = map(float, input().split()) X2, Y2 = map(float, input().split()) DISTANCE = ( (X2 - X1)**2 + (Y2 - Y1)**2 ) ** (0.5) print("%.4f" % (DISTANCE))
(x1, y1) = map(float, input().split()) (x2, y2) = map(float, input().split()) distance = ((X2 - X1) ** 2 + (Y2 - Y1) ** 2) ** 0.5 print('%.4f' % DISTANCE)
""" 0917. Reverse Only Letters Easy Given a string S, return the "reversed" string where all characters that are not a letter stay in the same place, and all letters reverse their positions. Example 1: Input: "ab-cd" Output: "dc-ba" Example 2: Input: "a-bC-dEf-ghIj" Output: "j-Ih-gfE-dCba" Example 3: Input: "Te...
""" 0917. Reverse Only Letters Easy Given a string S, return the "reversed" string where all characters that are not a letter stay in the same place, and all letters reverse their positions. Example 1: Input: "ab-cd" Output: "dc-ba" Example 2: Input: "a-bC-dEf-ghIj" Output: "j-Ih-gfE-dCba" Example 3: Input: "Te...
class Solution: def fizzBuzz(self, n: int) -> list: res = [] maps = {3: "Fizz", 5: "Buzz"} for i in range(1, n + 1): ans = "" for k, v in maps.items(): if i % k == 0: ans += v if not ans: ans = str(i) ...
class Solution: def fizz_buzz(self, n: int) -> list: res = [] maps = {3: 'Fizz', 5: 'Buzz'} for i in range(1, n + 1): ans = '' for (k, v) in maps.items(): if i % k == 0: ans += v if not ans: ans = str(i)...
''' Questions 1. is modulus, add, subtract, square root allowed? Observations 1. define what it means to be a power of 4 - any number of 4s must be multiplied to get that number 2. We do not need to know how many times we need to multiple 4 to get number. Only need to return true or False 3. Multiplying by 4 is the s...
""" Questions 1. is modulus, add, subtract, square root allowed? Observations 1. define what it means to be a power of 4 - any number of 4s must be multiplied to get that number 2. We do not need to know how many times we need to multiple 4 to get number. Only need to return true or False 3. Multiplying by 4 is the s...
''' Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1. set(key, value) - Set or insert the value if the key is not alre...
""" Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1. set(key, value) - Set or insert the value if the key is not already ...
# http://www.codewars.com/kata/5500d54c2ebe0a8e8a0003fd/ def mygcd(x, y): remainder = max(x, y) % min(x, y) if remainder == 0: return min(x, y) else: return mygcd(min(x, y), remainder)
def mygcd(x, y): remainder = max(x, y) % min(x, y) if remainder == 0: return min(x, y) else: return mygcd(min(x, y), remainder)
# Copyright 2016 Nidium Inc. All rights reserved. # Use of this source code is governed by a MIT license # that can be found in the LICENSE file. { 'targets': [{ 'target_name': 'nidium-server', 'type': 'executable', 'product_dir': '<(nidium_exec_path)', 'dependencies': [ ...
{'targets': [{'target_name': 'nidium-server', 'type': 'executable', 'product_dir': '<(nidium_exec_path)', 'dependencies': ['libnidiumcore.gyp:*', '<(nidium_network_path)/gyp/network.gyp:*'], 'include_dirs': ['<(third_party_path)/linenoise/', '<(nidium_src_path)'], 'cflags': ['-Wno-expansion-to-defined'], 'sources': ['<...
# -*- coding: utf-8 -*- """ Created on Tue Oct 20 18:39:06 2020 @author: xyz """ hello = "hello how are you?" splitHello = hello.split() print(splitHello) joinList = " <3 ".join(splitHello) print(joinList)
""" Created on Tue Oct 20 18:39:06 2020 @author: xyz """ hello = 'hello how are you?' split_hello = hello.split() print(splitHello) join_list = ' <3 '.join(splitHello) print(joinList)
def print_accuracy(cur_s, cur_ans): cur_true = cur_ans[cur_s] == 1 G_sub = G.subgraph(to_double_format(cur_ans[cur_true].index)) print("components in DESMAN subgraph:", nx.number_weakly_connected_components(G_sub)) right_answers = df_ref[cur_s] == cur_ans[cur_s] print("Accuracy on all edges: %.2f"...
def print_accuracy(cur_s, cur_ans): cur_true = cur_ans[cur_s] == 1 g_sub = G.subgraph(to_double_format(cur_ans[cur_true].index)) print('components in DESMAN subgraph:', nx.number_weakly_connected_components(G_sub)) right_answers = df_ref[cur_s] == cur_ans[cur_s] print('Accuracy on all edges: %.2f' ...
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def diameterOfBinaryTree(self, root): """ :type root: TreeNode :rtype: int """ ...
class Solution(object): def diameter_of_binary_tree(self, root): """ :type root: TreeNode :rtype: int """ return self.height(root)[0] def height(self, root): """Finds the height of the given tree""" if root is None: return (0, 0) (lef...
#!/usr/bin/env python3 grid = [[1]] def iter_ring(size): x = size - 1 y = size - 2 while y > 0: yield x, y y -= 1 while x > 0: yield x, y x -= 1 while y < size - 1: yield x, y y += 1 while x < size - 1: yield x, y x += 1 yiel...
grid = [[1]] def iter_ring(size): x = size - 1 y = size - 2 while y > 0: yield (x, y) y -= 1 while x > 0: yield (x, y) x -= 1 while y < size - 1: yield (x, y) y += 1 while x < size - 1: yield (x, y) x += 1 yield (x, y) def ite...
"""Syncless: asynchronous client and server library using Stackless Python. started by pts@fazekas.hu at Sat Dec 19 18:09:16 CET 2009 See the README.txt for more information. Please import submodules to get the actual functionality. Example: import socket from syncless import coio s = coio.nbsocket(socket.AF_...
"""Syncless: asynchronous client and server library using Stackless Python. started by pts@fazekas.hu at Sat Dec 19 18:09:16 CET 2009 See the README.txt for more information. Please import submodules to get the actual functionality. Example: import socket from syncless import coio s = coio.nbsocket(socket.AF_...
REGIONS = ( (1, "Northeast"), (2, "Midwest"), (3, "South"), (4, "West"), (9, "Puerto Rico and the Island Areas"), ) DIVISIONS = ( (0, "Puerto Rico and the Island Areas"), (1, "New England"), (2, "Middle Atlantic"), (3, "East North Central"), (4, "West North Central"), (5, "...
regions = ((1, 'Northeast'), (2, 'Midwest'), (3, 'South'), (4, 'West'), (9, 'Puerto Rico and the Island Areas')) divisions = ((0, 'Puerto Rico and the Island Areas'), (1, 'New England'), (2, 'Middle Atlantic'), (3, 'East North Central'), (4, 'West North Central'), (5, 'South Atlantic'), (6, 'East South Central'), (7, '...
def foo(x,y=10): z = x * y return z print(foo(10))
def foo(x, y=10): z = x * y return z print(foo(10))
img_enhanc_alg = "" input_img = [] with open("input/day20.txt") as inp: flag = True for vrst in inp: if flag: flag = False img_enhanc_alg = vrst[:-1] elif vrst == "\n": continue else: input_img.append(list(vrst[:-1])) def bin_to_int(b): ...
img_enhanc_alg = '' input_img = [] with open('input/day20.txt') as inp: flag = True for vrst in inp: if flag: flag = False img_enhanc_alg = vrst[:-1] elif vrst == '\n': continue else: input_img.append(list(vrst[:-1])) def bin_to_int(b): ...
# # PySNMP MIB module COLUBRIS-SYSTEM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/COLUBRIS-SYSTEM-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:10:01 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, single_value_constraint, constraints_intersection, value_range_constraint, constraints_union) ...
#! /usr/bin/env python3 # -*- coding: utf-8 -*- """ .. module:: TODO :platform: Unix :synopsis: TODO. .. moduleauthor:: Aljosha Friemann a.friemann@automate.wtf """ def walk(dictionary, root='.'): for key, value in dictionary.items(): if type(value) is dict: for subkey, subvalue in wal...
""" .. module:: TODO :platform: Unix :synopsis: TODO. .. moduleauthor:: Aljosha Friemann a.friemann@automate.wtf """ def walk(dictionary, root='.'): for (key, value) in dictionary.items(): if type(value) is dict: for (subkey, subvalue) in walk(value, root + '.' + key): y...
# todo: some way to automate/automatically update this algo = dict([ (0, 'Scrypt'), (1, 'SHA256'), (2, 'ScryptNf'), (3, 'X11'), (4, 'X13'), (5, 'Keccak'), (6, 'X15'), (7, 'Nist5'), (8, 'NeoScrypt'), (9, 'Lyra2RE'), (10, 'WhirlpoolX'), (11, 'Qubit'), (1...
algo = dict([(0, 'Scrypt'), (1, 'SHA256'), (2, 'ScryptNf'), (3, 'X11'), (4, 'X13'), (5, 'Keccak'), (6, 'X15'), (7, 'Nist5'), (8, 'NeoScrypt'), (9, 'Lyra2RE'), (10, 'WhirlpoolX'), (11, 'Qubit'), (12, 'Quark'), (13, 'Axiom'), (14, 'Lyra2REv2'), (15, 'ScryptJaneNf16'), (16, 'Blake256r8'), (17, 'Blake256r14'), (18, 'Blake2...
def func(a=None, b=None, /): pass func(None, 2) func()
def func(a=None, b=None, /): pass func(None, 2) func()
anchor = Input((60, 60, 3), name='anchor') positive = Input((60, 60, 3), name='positive') negative = Input((60, 60, 3), name='negative') a = shared_conv2(anchor) p = shared_conv2(positive) n = shared_conv2(negative) pos_sim = Dot(axes=-1, normalize=True)([a,p]) neg_sim = Dot(axes=-1, normalize=True)([a,n]) loss = La...
anchor = input((60, 60, 3), name='anchor') positive = input((60, 60, 3), name='positive') negative = input((60, 60, 3), name='negative') a = shared_conv2(anchor) p = shared_conv2(positive) n = shared_conv2(negative) pos_sim = dot(axes=-1, normalize=True)([a, p]) neg_sim = dot(axes=-1, normalize=True)([a, n]) loss = lam...
# Moving zeros to the end def move_zeros(arr): zero = 0 for elements in range(len(arr)): if arr[elements] != 0 or arr[elements] is False: arr[elements], arr[zero] = arr[zero], arr[elements] zero += 1 return arr x = [0, 1, 0, 3, False, 12, 5, 7, 0 ,12, 2, 3, 4] print(move_z...
def move_zeros(arr): zero = 0 for elements in range(len(arr)): if arr[elements] != 0 or arr[elements] is False: (arr[elements], arr[zero]) = (arr[zero], arr[elements]) zero += 1 return arr x = [0, 1, 0, 3, False, 12, 5, 7, 0, 12, 2, 3, 4] print(move_zeros(x))
""" Today's difficult problem is similar to challenge #64's difficult problem Baseball is very famous in the USA. Your task is write a program that retrieves the current statistic for a requested team. THIS [http://www.baseball-reference.com/] site is to be used for the reference. You are also encouraged to retrieve s...
""" Today's difficult problem is similar to challenge #64's difficult problem Baseball is very famous in the USA. Your task is write a program that retrieves the current statistic for a requested team. THIS [http://www.baseball-reference.com/] site is to be used for the reference. You are also encouraged to retrieve s...
class Question: def __init__(self,prompt,answer): self.prompt = prompt self.answer = answer
class Question: def __init__(self, prompt, answer): self.prompt = prompt self.answer = answer
class Singleton(object): def __new__(cls): if not hasattr(cls, 'instance') or not cls.instance: cls.instance = super().__new__(cls) return cls.instance obj1 = Singleton() obj2 = Singleton() print(obj1 is obj2) # True print(obj1 == obj2) # True print(type(obj1) == type(ob...
class Singleton(object): def __new__(cls): if not hasattr(cls, 'instance') or not cls.instance: cls.instance = super().__new__(cls) return cls.instance obj1 = singleton() obj2 = singleton() print(obj1 is obj2) print(obj1 == obj2) print(type(obj1) == type(obj2)) print(id(obj1) == id(obj2...
def magic(): return 'foo' # OK, returns u''' unicode() # Not OK, no encoding supplied unicode('foo') # Also not OK, no encoding supplied unicode('foo' + 'bar') # OK, positional encoding supplied unicode('foo', 'utf-8') # OK, positional encoding and error argument supplied unicode('foo', 'utf-8', 'ignore') # N...
def magic(): return 'foo' unicode() unicode('foo') unicode('foo' + 'bar') unicode('foo', 'utf-8') unicode('foo', 'utf-8', 'ignore') unicode(magic()) unicode(1, 2, 3, 4) args = ['utf-8'] unicode('foo', *ARGS) kwargs = {'encoding': 'utf-8'} unicode('foo', **KWARGS)
class Script: @staticmethod def main(): crime_rates = [749, 371, 828, 503, 1379, 425, 408, 542, 1405, 835, 1288, 647, 974, 1383, 455, 658, 675, 615, 2122, 423, 362, 587, 543, 563, 168, 992, 1185, 617, 734, 1263, 784, 352, 397, 575, 481, 598, 1750, 399, 1172, 1294, 992, 522, 1216, 815, 639, 1154, 1993, 919, 594, 11...
class Script: @staticmethod def main(): crime_rates = [749, 371, 828, 503, 1379, 425, 408, 542, 1405, 835, 1288, 647, 974, 1383, 455, 658, 675, 615, 2122, 423, 362, 587, 543, 563, 168, 992, 1185, 617, 734, 1263, 784, 352, 397, 575, 481, 598, 1750, 399, 1172, 1294, 992, 522, 1216, 815, 639, 1154, 1993, ...
#__getitem__ not implemented yet #a = bytearray(b'abc') #assert a[0] == b'a' #assert a[1] == b'b' assert len(bytearray([1,2,3])) == 3 assert bytearray(b'1a23').isalnum() assert not bytearray(b'1%a23').isalnum() assert bytearray(b'abc').isalpha() assert not bytearray(b'abc1').isalpha() # travis doesn't like this #as...
assert len(bytearray([1, 2, 3])) == 3 assert bytearray(b'1a23').isalnum() assert not bytearray(b'1%a23').isalnum() assert bytearray(b'abc').isalpha() assert not bytearray(b'abc1').isalpha() assert bytearray(b'1234567890').isdigit() assert not bytearray(b'12ab').isdigit() assert bytearray(b'lower').islower() assert not ...
"""Advent of Code Day 11 - Hex Ed""" def path(steps_string): """Find how far from the centre of a hex grid a list of steps takes you.""" # Strip and split file into a iterable list steps_list = steps_string.strip().split(',') # Break hexagon neighbours into cube coordinates x = 0 y = 0 z ...
"""Advent of Code Day 11 - Hex Ed""" def path(steps_string): """Find how far from the centre of a hex grid a list of steps takes you.""" steps_list = steps_string.strip().split(',') x = 0 y = 0 z = 0 furthest = 0 for step in steps_list: if step == 'n': x += 1 ...
def draw_cube(p): """ Draw green cube with side = 1, then set line color to blue """ p.set('linecolor', 'g') p.vector(0, 1) p.vector(1, 0) p.vector(0, -1) p.vector(-1, 0) p.draw() p.set('linecolor', 'b')
def draw_cube(p): """ Draw green cube with side = 1, then set line color to blue """ p.set('linecolor', 'g') p.vector(0, 1) p.vector(1, 0) p.vector(0, -1) p.vector(-1, 0) p.draw() p.set('linecolor', 'b')
N = int(input()) W = list(map(int, input().split())) diff = [0 for i in range(N-1)] for i in range(N-1): S1 = sum(W[:i+1]) S2 = sum(W[i+1:]) diff[i] = abs(S1 - S2) print(min(diff))
n = int(input()) w = list(map(int, input().split())) diff = [0 for i in range(N - 1)] for i in range(N - 1): s1 = sum(W[:i + 1]) s2 = sum(W[i + 1:]) diff[i] = abs(S1 - S2) print(min(diff))
# coding=utf-8 # *** WARNING: this file was generated by crd2pulumi. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** SNAKE_TO_CAMEL_CASE_TABLE = { "api_version": "apiVersion", "container_id": "containerID", "container_statuses": "containerStatuses", "ephemeral_conta...
snake_to_camel_case_table = {'api_version': 'apiVersion', 'container_id': 'containerID', 'container_statuses': 'containerStatuses', 'ephemeral_container_statuses': 'ephemeralContainerStatuses', 'exit_code': 'exitCode', 'finished_at': 'finishedAt', 'host_ip': 'hostIP', 'image_id': 'imageID', 'init_container_statuses': '...
""" @Author: yanzx @Date: 2021-09-16 08:43:36 @Desc: """
""" @Author: yanzx @Date: 2021-09-16 08:43:36 @Desc: """
num, rotation = map(int, input().split()) arr = list(map(str, input().split())) if rotation < 0: value = abs(rotation) arr = arr[value:] + arr[:value] if rotation > 0: value = abs(rotation) arr = [arr[(i - value) % len(arr)] for i, x in enumerate(arr)] arr2 = [int(i) for i in arr] for i in arr2: ...
(num, rotation) = map(int, input().split()) arr = list(map(str, input().split())) if rotation < 0: value = abs(rotation) arr = arr[value:] + arr[:value] if rotation > 0: value = abs(rotation) arr = [arr[(i - value) % len(arr)] for (i, x) in enumerate(arr)] arr2 = [int(i) for i in arr] for i in arr2: ...
class MyClass: def func3(self): pass def func2(self, a): a() def func1(self, a, b): a(b) a = MyClass() a.func1(a.func2, a.func3)
class Myclass: def func3(self): pass def func2(self, a): a() def func1(self, a, b): a(b) a = my_class() a.func1(a.func2, a.func3)
def main(): my_list = [1,"hello",True,4.5] my_dict = {'fistname' : 'luis', 'lastname':'martinez'} super_list = [ {'firstname' : 'luis', 'lastname':'martinez'}, {'firstname' : 'lizette', 'lastname':'martinez'}, {'firstname' : 'dalia', 'lastname':'martinez'} ] for i in super_...
def main(): my_list = [1, 'hello', True, 4.5] my_dict = {'fistname': 'luis', 'lastname': 'martinez'} super_list = [{'firstname': 'luis', 'lastname': 'martinez'}, {'firstname': 'lizette', 'lastname': 'martinez'}, {'firstname': 'dalia', 'lastname': 'martinez'}] for i in super_list: for (key, value...
with open('../input.txt','rt') as f: cur_line = 0 cur_shift = 0 answ = 0 tree_map = list(map(lambda line: line.rstrip('\n'), f.readlines())) for line in tree_map: if line[cur_shift%len(tree_map[0])]=='#': answ+=1 cur_line+=1 cur_shift+=3 print(answ)
with open('../input.txt', 'rt') as f: cur_line = 0 cur_shift = 0 answ = 0 tree_map = list(map(lambda line: line.rstrip('\n'), f.readlines())) for line in tree_map: if line[cur_shift % len(tree_map[0])] == '#': answ += 1 cur_line += 1 cur_shift += 3 print(answ)
class IllegalStateException(Exception): """ An error when program enter an unexpected state """ def __init__(self, message): self.message = message
class Illegalstateexception(Exception): """ An error when program enter an unexpected state """ def __init__(self, message): self.message = message
# -*- coding: utf-8 -*- """ Created on Wed Apr 10 21:40:05 2019 @author: Falble """ def reverse_pair(word_list, word): """Checks whether a reversed word appears in word_list. word_list: list of strings word: string """ rev_word = word[::-1] return in_bisect(word_list, rev_word...
""" Created on Wed Apr 10 21:40:05 2019 @author: Falble """ def reverse_pair(word_list, word): """Checks whether a reversed word appears in word_list. word_list: list of strings word: string """ rev_word = word[::-1] return in_bisect(word_list, rev_word) if __name__ == '__main__': word_lis...
""" Dictionaries containing CAT12 longitudinal segmentation output file names by key. """ #: Output file names by key. SEGMENTATION_OUTPUT = { "surface_estimation": [ "surf/lh.central.{file_name}.gii", "surf/lh.sphere.{file_name}.gii", "surf/lh.sphere.reg.{file_name}.gii", "surf/lh....
""" Dictionaries containing CAT12 longitudinal segmentation output file names by key. """ segmentation_output = {'surface_estimation': ['surf/lh.central.{file_name}.gii', 'surf/lh.sphere.{file_name}.gii', 'surf/lh.sphere.reg.{file_name}.gii', 'surf/lh.thickness.{file_name}', 'surf/rh.central.{file_name}.gii', 'surf/rh....
# Perform a 75% training and 25% test data split X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=0) # Fit the random forest model to the training data rf = RandomForestClassifier(random_state=0) rf.fit(X_train, y_train) # Calculate the accuracy acc = accuracy_score(y_test, rf.pr...
(x_train, x_test, y_train, y_test) = train_test_split(X, y, test_size=0.25, random_state=0) rf = random_forest_classifier(random_state=0) rf.fit(X_train, y_train) acc = accuracy_score(y_test, rf.predict(X_test)) print(dict(zip(X.columns, rf.feature_importances_.round(2)))) print('{0:.1%} accuracy on test set.'.format(a...
''' In this module, we implement a function which gets the intersection of two sorted arrays. ''' def intersection_sorted_arrays(arr_1, arr_2): ''' Return the intersection of two sorted arrays ''' result = [] i,j = 0,0 while i < len(arr_1) and j < len(arr_2): if arr_1[i] == arr_2[j]: result.append(arr_1[...
""" In this module, we implement a function which gets the intersection of two sorted arrays. """ def intersection_sorted_arrays(arr_1, arr_2): """ Return the intersection of two sorted arrays """ result = [] (i, j) = (0, 0) while i < len(arr_1) and j < len(arr_2): if arr_1[i] == arr_2[j]:...
def greet(): print("Hello") greet() print("------") def add_sub(x, y): c = x + y d = x - y return c, d r1, r2 = add_sub(4, 5) print(r1, r2) print("------") def sum(**three): for i, j in three.items(): print(i, j) sum(Name="'Jatin'", Age=19, Address="Delhi") # def odd_even(odd...
def greet(): print('Hello') greet() print('------') def add_sub(x, y): c = x + y d = x - y return (c, d) (r1, r2) = add_sub(4, 5) print(r1, r2) print('------') def sum(**three): for (i, j) in three.items(): print(i, j) sum(Name="'Jatin'", Age=19, Address='Delhi') x = int(input('Enter a num...
# -*- coding: utf-8 -*- def key_input(): """ Enter key to be used. Don't accept key shorter than 8 bytes. If key is longer than 8 bytes, cut it to 8 bytes. """ while True: key = input("Enter 8 byte key:") if len(key) < 8: print("Key should be 8 bytes long!") ...
def key_input(): """ Enter key to be used. Don't accept key shorter than 8 bytes. If key is longer than 8 bytes, cut it to 8 bytes. """ while True: key = input('Enter 8 byte key:') if len(key) < 8: print('Key should be 8 bytes long!') elif len(key) > 8: ...
FSenterSecretTextPos = (0, 0, -0.25) FSgotSecretPos = (0, 0, 0.46999999999999997) FSgetSecretButton = 0.059999999999999998 FSnextText = 1.0 FSgetSecret = (1.55, 1, 1) FSok1 = (1.55, 1, 1) FSok2 = (0.59999999999999998, 1, 1) FScancel = (0.59999999999999998, 1, 1) LTPDdirectButtonYesText = 0.050000000000000003 LTPDdirect...
f_senter_secret_text_pos = (0, 0, -0.25) f_sgot_secret_pos = (0, 0, 0.47) f_sget_secret_button = 0.06 f_snext_text = 1.0 f_sget_secret = (1.55, 1, 1) f_sok1 = (1.55, 1, 1) f_sok2 = (0.6, 1, 1) f_scancel = (0.6, 1, 1) ltp_ddirect_button_yes_text = 0.05 ltp_ddirect_button_no_text = 0.05 ltp_ddirect_frame_text = 0.06 sc_o...
n=int(input("enter the number")) x=[] a,b=0,1 x.append(a) x.append(b) if n==0: print(0) else: for i in range(2,n): c=a+b a=b b=c x.append(c) print(x)
n = int(input('enter the number')) x = [] (a, b) = (0, 1) x.append(a) x.append(b) if n == 0: print(0) else: for i in range(2, n): c = a + b a = b b = c x.append(c) print(x)
# Space: O(1) # Time: O(n) class Solution: def merge(self, intervals): length = len(intervals) if length <= 1: return intervals intervals.sort(key=lambda x: (x[0], x[1])) res = [] for i in range(length): if len(res) == 0: res.append(intervals[i]) ...
class Solution: def merge(self, intervals): length = len(intervals) if length <= 1: return intervals intervals.sort(key=lambda x: (x[0], x[1])) res = [] for i in range(length): if len(res) == 0: res.append(intervals[i]) eli...
x = 0 while x <= 10: print(f" 6 x {x} = {6*x}") x = x + 1
x = 0 while x <= 10: print(f' 6 x {x} = {6 * x}') x = x + 1
class Node: def __init__(self, value): self.value = value self.next = None class Enumerator: def __init__(self, linked_list): self._current = None self._list = linked_list def get_next(self): if (self._current == None): self._current = self._list._head ...
class Node: def __init__(self, value): self.value = value self.next = None class Enumerator: def __init__(self, linked_list): self._current = None self._list = linked_list def get_next(self): if self._current == None: self._current = self._list._head ...
validSettings = { "password": ".*", "cache": "^\d+$", "allow-force": "^(true|false)$", "allow-user-unregistered": "^(true|false)$", "duration": "^(year|eternity)$", "dark-mode-default": "^(true|false)$", "show-commit-mail": "^(true|false)$" }
valid_settings = {'password': '.*', 'cache': '^\\d+$', 'allow-force': '^(true|false)$', 'allow-user-unregistered': '^(true|false)$', 'duration': '^(year|eternity)$', 'dark-mode-default': '^(true|false)$', 'show-commit-mail': '^(true|false)$'}
n = int(input()) for i in range(n): (x, y) = map(int, input().split(' ')) soma = 0 if x % 2 == 0: x += 1 j = 0 while j < y * 2: soma += x + j j += 2 print(soma)
n = int(input()) for i in range(n): (x, y) = map(int, input().split(' ')) soma = 0 if x % 2 == 0: x += 1 j = 0 while j < y * 2: soma += x + j j += 2 print(soma)
# Copyright 2018-2021 Xanadu Quantum Technologies Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or...
""" This module contains basis set parameters defining Gaussian-type orbitals for a selected number of atoms. The data are taken from the Basis Set Exchange `library <https://www.basissetexchange.org>`_. The current data include the STO-3G and 6-31G basis sets for atoms with atomic numbers 1-10. """ atomic_numbers = {'...
""" https://leetcode.com/problems/flood-fill/ An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535). Given a coordinate (sr, sc) representing the starting pixel (row and column) of the flood fill, and a pixel value newColor, "flood fill" the image....
""" https://leetcode.com/problems/flood-fill/ An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535). Given a coordinate (sr, sc) representing the starting pixel (row and column) of the flood fill, and a pixel value newColor, "flood fill" the image....
scores = [ 9.5, 8.5, 7.0, 9.5, 10, 6.5, 7.5, 9.0, 10 ] sum = 0 for score in scores: sum += score average = sum/(len(scores)) print('Average Scores: ' + str(average))
scores = [9.5, 8.5, 7.0, 9.5, 10, 6.5, 7.5, 9.0, 10] sum = 0 for score in scores: sum += score average = sum / len(scores) print('Average Scores: ' + str(average))
""" Utilities for handling CoMetGeNe trails. Version: 1.0 (May 2018) License: MIT Author: Alexandra Zaharia (contact@alexandra-zaharia.org) """ def span(lst): """Returns the number of unique vertices in the input list. :param lst: list of vertices in a graph or of tuples of vertices (i.e. arcs) in i...
""" Utilities for handling CoMetGeNe trails. Version: 1.0 (May 2018) License: MIT Author: Alexandra Zaharia (contact@alexandra-zaharia.org) """ def span(lst): """Returns the number of unique vertices in the input list. :param lst: list of vertices in a graph or of tuples of vertices (i.e. arcs) in it...
numero = 4 fracao = 6.1 online = False texto = "Armando" if numero == 5: print("Hello 5") elif numero == 4 or online: print("Hello 4") else: print("Final") print("Ola estou online" if online else "Ola estou offline")
numero = 4 fracao = 6.1 online = False texto = 'Armando' if numero == 5: print('Hello 5') elif numero == 4 or online: print('Hello 4') else: print('Final') print('Ola estou online' if online else 'Ola estou offline')
dna_seq1 = 'ACCT GATC' a_count = 0 c_count = 0 g_count = 0 t_count = 0 valid_count = 0 for nucl in dna_seq1: if nucl == 'G': g_count += 1 valid_count += 1 elif nucl == 'C': c_count += 1 valid_count += 1 elif nucl == 'A': a_count += 1 valid_count += 1 el...
dna_seq1 = 'ACCT GATC' a_count = 0 c_count = 0 g_count = 0 t_count = 0 valid_count = 0 for nucl in dna_seq1: if nucl == 'G': g_count += 1 valid_count += 1 elif nucl == 'C': c_count += 1 valid_count += 1 elif nucl == 'A': a_count += 1 valid_count += 1 elif...
def min_max_sum_function(sequence): sequence_int = list(map(int, sequence)) min_value = min(sequence_int) max_value = max(sequence_int) sum_value = sum(sequence_int) print (f"The minimum number is {min_value}") print(f"The maximum number is {max_value}") print(f"The sum number is: {sum_value...
def min_max_sum_function(sequence): sequence_int = list(map(int, sequence)) min_value = min(sequence_int) max_value = max(sequence_int) sum_value = sum(sequence_int) print(f'The minimum number is {min_value}') print(f'The maximum number is {max_value}') print(f'The sum number is: {sum_value}...
# -*- coding: utf-8 -*- """ ----------Phenix Labs---------- Created on Fri Jan 29 14:07:35 2021 @author: Gyan Krishna Topic: """ class Rectangle: def __init__(self, l, b): self.length = l self.breadth = b def showArea(self): area = (self.length * self.breadth) print("area = ",...
""" ----------Phenix Labs---------- Created on Fri Jan 29 14:07:35 2021 @author: Gyan Krishna Topic: """ class Rectangle: def __init__(self, l, b): self.length = l self.breadth = b def show_area(self): area = self.length * self.breadth print('area = ', area) def show_per...
##rotational constant in ground state in wavenumbers B_dict = {'O2': 1.4297, 'N2': 1.99, 'N2O': 0.4190, 'CO2': 0.3902, 'D2': 30.442, 'OCS': .2039} ##Centrifugal Distortion in ground state in wavenumbers D_dict = {'O2': 4.839e-6, 'N2': 5.7e-6, 'N2O': 0.176e-6, 'CO2': 0.135e-6, 'D2': 0, 'OCS': 0...
b_dict = {'O2': 1.4297, 'N2': 1.99, 'N2O': 0.419, 'CO2': 0.3902, 'D2': 30.442, 'OCS': 0.2039} d_dict = {'O2': 4.839e-06, 'N2': 5.7e-06, 'N2O': 1.76e-07, 'CO2': 1.35e-07, 'D2': 0, 'OCS': 0} d_alpha_dict = {'O2': 1.1e-30, 'N2': 9.3e-31, 'N2O': 2.8e-30, 'CO2': 2.109e-30, 'D2': 2.82e-31, 'OCS': 4.1e-30} jmax_dict = {'O2': ...
with open("haiku.txt", "a") as file: file.write("APPENDING LATER!") with open("haiku.txt") as file: data = file.read() print(data) with open("haiku.txt", "r+") as file: file.write("\nADDED USING r+") file.seek(20) file.write(":)") data = file.read() print(data)
with open('haiku.txt', 'a') as file: file.write('APPENDING LATER!') with open('haiku.txt') as file: data = file.read() print(data) with open('haiku.txt', 'r+') as file: file.write('\nADDED USING r+') file.seek(20) file.write(':)') data = file.read() print(data)
GOOD_MORNING="Good Morning, %s" GOOD_AFTERNOON="Good Afternoon, %s" GOOD_EVENING="Good Evening, %s" DEFAULT_MESSAGE="Hello, World! %s" MESSAGE_REFRESH_RATE = 3600000 # 1 hour MESSAGE_TEXT_SIZE = 70
good_morning = 'Good Morning, %s' good_afternoon = 'Good Afternoon, %s' good_evening = 'Good Evening, %s' default_message = 'Hello, World! %s' message_refresh_rate = 3600000 message_text_size = 70
# This is created from Notebook++ print("Hello, I am SKL") print("Welcome to my learning space")
print('Hello, I am SKL') print('Welcome to my learning space')
#Reading lines from file and putting in a list contents = [] for line in open('rosalind_ini5.txt', 'r').readlines(): contents.append(line.strip('\n')) #Printing the even numbered lines, starting by one for i in range(1, len(contents), 2): print(contents[i])
contents = [] for line in open('rosalind_ini5.txt', 'r').readlines(): contents.append(line.strip('\n')) for i in range(1, len(contents), 2): print(contents[i])
class BaseUrlNotDefined(Exception): pass class InvalidCurrencyCode(Exception): pass class InvalidDate(Exception): pass class InvalidAmount(Exception): pass class APICallError(Exception): pass class HelperNotDefined(Exception): pass
class Baseurlnotdefined(Exception): pass class Invalidcurrencycode(Exception): pass class Invaliddate(Exception): pass class Invalidamount(Exception): pass class Apicallerror(Exception): pass class Helpernotdefined(Exception): pass
## Escreva um programa que converta uma temperatura digitando em graus Celsius e converta para graus Fahrenheit.## c = float(input('Informe a temperatura em C:')) f = 9 * c / 5 +32 print('A temperatura em {}C corresponde a {}F!'.format(c,f))
c = float(input('Informe a temperatura em C:')) f = 9 * c / 5 + 32 print('A temperatura em {}C corresponde a {}F!'.format(c, f))
# Copyright (c) 2018, EPFL/Human Brain Project PCO # # 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 applic...
class Pagination(object): def __init__(self, start_from: int=0, size: int=50): self.start_from = start_from self.size = size class Stage(str): in_progress = 'IN_PROGRESS' released = 'RELEASED' class Responseconfiguration(object): def __init__(self, return_payload=True, return_permiss...
def iguais (l1,l2): same=0 for i in range (len(l1)): if l1[i]==l2[i]: same += 1 return same testea=[1,5,6,3,2,4,8,9,6,5,3,7,5,6,4,8,3,2,5,6,4,5,4,8,9,9] testeb=[5,4,6,9,8,7,5,5,3,2,1,4,6,5,7,8,9,6,3,2,1,4,5,6,9,8] print(iguais(testea,testeb))
def iguais(l1, l2): same = 0 for i in range(len(l1)): if l1[i] == l2[i]: same += 1 return same testea = [1, 5, 6, 3, 2, 4, 8, 9, 6, 5, 3, 7, 5, 6, 4, 8, 3, 2, 5, 6, 4, 5, 4, 8, 9, 9] testeb = [5, 4, 6, 9, 8, 7, 5, 5, 3, 2, 1, 4, 6, 5, 7, 8, 9, 6, 3, 2, 1, 4, 5, 6, 9, 8] print(iguais(test...
name = 'TaskKit' version = ('X', 'Y', 0) docs = [ {'name': "Quick Start", 'file': 'QuickStart.html'}, {'name': "User's Guide", 'file': 'UsersGuide.html'}, {'name': 'To Do', 'file': 'TODO.text'}, ] status = 'stable' requiredPyVersion = (2, 6, 0) synopsis = """TaskKit provides a framework for the...
name = 'TaskKit' version = ('X', 'Y', 0) docs = [{'name': 'Quick Start', 'file': 'QuickStart.html'}, {'name': "User's Guide", 'file': 'UsersGuide.html'}, {'name': 'To Do', 'file': 'TODO.text'}] status = 'stable' required_py_version = (2, 6, 0) synopsis = 'TaskKit provides a framework for the scheduling and management o...
#!/usr/bin/env python3 a = int(input()) b = int(input()) if a // 2 == b or (3 * a) + 1 == b: print("yes") else: print("no")
a = int(input()) b = int(input()) if a // 2 == b or 3 * a + 1 == b: print('yes') else: print('no')