content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#encoding:utf-8 subreddit = 'bikinimoe' t_channel = '@BikiniMoe' def send_post(submission, r2t): return r2t.send_simple(submission)
subreddit = 'bikinimoe' t_channel = '@BikiniMoe' def send_post(submission, r2t): return r2t.send_simple(submission)
simType='sim_file' symProps = [ {'set': 'memory', 'RBs': [{'higher_order': False, 'pred_name': 'non_exist', 'P': 'non_exist', 'object_name': 'bar_0.703780466095', 'pred_sem': [], 'object_sem': [['X', 1, 'X', 'nil', 'state'], ['X_0.790476190476', 1, 'X', 0.79047619047619044, 'value'], ['Y', 1, 'Y', 'nil', 'state'], ['Y_...
sim_type = 'sim_file' sym_props = [{'set': 'memory', 'RBs': [{'higher_order': False, 'pred_name': 'non_exist', 'P': 'non_exist', 'object_name': 'bar_0.703780466095', 'pred_sem': [], 'object_sem': [['X', 1, 'X', 'nil', 'state'], ['X_0.790476190476', 1, 'X', 0.7904761904761904, 'value'], ['Y', 1, 'Y', 'nil', 'state'], ['...
# Given the mapping a = 1, b = 2, ... z = 26, and an encoded message, count the # number of ways it can be decoded. # For example, the message '111' would give 3, since it could be decoded as # 'aaa', 'ka', and 'ak'. # You can assume that the messages are decodable. For example, '001' is not # allowed. ALPHA...
alphabet = [chr(i) for i in range(97, 123)] def decode_number(nums): codes = [] def helper(nums, message): if not nums: codes.append(message) for i in range(1, len(nums) + 1): code = int(nums[:i]) if code == 0 or code > 26: break ...
service_entry = """ --- apiVersion: networking.istio.io/v1alpha3 kind: ServiceEntry metadata: name: {cfg[name]}-backend-redirect spec: hosts: - {cfg[upstream][host]} location: MESH_EXTERNAL ports: - number: 443 name: tcp protocol: TLS resolution: DNS """ virtual_service = """ --- apiVersion: netwo...
service_entry = '\n---\napiVersion: networking.istio.io/v1alpha3\nkind: ServiceEntry\nmetadata:\n name: {cfg[name]}-backend-redirect\nspec:\n hosts:\n - {cfg[upstream][host]}\n location: MESH_EXTERNAL\n ports:\n - number: 443\n name: tcp\n protocol: TLS\n resolution: DNS\n' virtual_service = '\n---\napiVer...
N = int(input()) c = 0 for i in range(0, N // 5 + 1): for j in range(0, N // 4 + 1): five, four = 5 * i, 4 * j if five + four == N: c += 1 print(c)
n = int(input()) c = 0 for i in range(0, N // 5 + 1): for j in range(0, N // 4 + 1): (five, four) = (5 * i, 4 * j) if five + four == N: c += 1 print(c)
num1 = 10 num2 = 14 num3 = 12 if (num1 >= num2) and (num1 >= num3): largest = num1 elif (num2 >= num1) and (num2 >= num3): largest = num2 else: largest = num3 print("The largest number between",num1,",",num2,"and",num3,"is",largest)
num1 = 10 num2 = 14 num3 = 12 if num1 >= num2 and num1 >= num3: largest = num1 elif num2 >= num1 and num2 >= num3: largest = num2 else: largest = num3 print('The largest number between', num1, ',', num2, 'and', num3, 'is', largest)
day = int(input()) even = int(input()) end = int(input()) plan_a = round(max(0, day - 100) * 0.25 + even * 0.15 + end * 0.2, 2) plan_b = round(max(0, day - 250) * 0.45 + even * 0.35 + end * 0.25, 2) print('Plan A costs {:2}'.format(plan_a)) print('Plan B costs {:2}'.format(plan_b)) if plan_a < plan_b: print('Plan ...
day = int(input()) even = int(input()) end = int(input()) plan_a = round(max(0, day - 100) * 0.25 + even * 0.15 + end * 0.2, 2) plan_b = round(max(0, day - 250) * 0.45 + even * 0.35 + end * 0.25, 2) print('Plan A costs {:2}'.format(plan_a)) print('Plan B costs {:2}'.format(plan_b)) if plan_a < plan_b: print('Plan A...
#Check if the number entered is special '''a=int(input("Enter a number: ")) b=a fact=1 s=0 while a!=0: d=a%10#5;4;1 print(a,d) for i in range(1,d+1): fact*=i s+=fact#120;144;145 fact=1 a=a//10 if s==b: print("The given number, ", b,"is a special number") else: print("The given nu...
"""a=int(input("Enter a number: ")) b=a fact=1 s=0 while a!=0: d=a%10#5;4;1 print(a,d) for i in range(1,d+1): fact*=i s+=fact#120;144;145 fact=1 a=a//10 if s==b: print("The given number, ", b,"is a special number") else: print("The given number, ", b,"is not a special number")"""...
# MAXIMISE GCD def gcd(a,b): if a%b==0: return(b) if b%a==0: return(a) if a==b: return(a) if a>b: return gcd(a%b,b) if b>a: return gcd(a,b%a) n = int(input()) Arr = list(map(int, input().strip().split())) x = Arr[n-1] mx = 1 j = 0 for i ...
def gcd(a, b): if a % b == 0: return b if b % a == 0: return a if a == b: return a if a > b: return gcd(a % b, b) if b > a: return gcd(a, b % a) n = int(input()) arr = list(map(int, input().strip().split())) x = Arr[n - 1] mx = 1 j = 0 for i in range(n - 1, -1...
class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def getAllElements(self, root1, root2): """ :type root1: TreeNode :type root2: TreeNode :rtype: List[int] """ ans = [] ...
class Treenode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def get_all_elements(self, root1, root2): """ :type root1: TreeNode :type root2: TreeNode :rtype: List[int] """ ans = ...
## ## # File auto-generated against equivalent DynamicSerialize Java class class NewAdaptivePlotRequest(object): def __init__(self): self.fileContents = None self.fileName = None self.bundleName = None self.description = None def getFileContents(self): return self.fil...
class Newadaptiveplotrequest(object): def __init__(self): self.fileContents = None self.fileName = None self.bundleName = None self.description = None def get_file_contents(self): return self.fileContents def set_file_contents(self, fileContents): self.file...
load("@rules_scala_annex//rules:external.bzl", "scala_maven_import_external") load("//repos:rules.bzl", "overlaid_github_repository") def singularity_scala_repositories(): com_chuusai_shapeless_repository() com_github_mpilquist_simulacrum_repository() eu_timepit_refined_repository() io_circe_circe_repo...
load('@rules_scala_annex//rules:external.bzl', 'scala_maven_import_external') load('//repos:rules.bzl', 'overlaid_github_repository') def singularity_scala_repositories(): com_chuusai_shapeless_repository() com_github_mpilquist_simulacrum_repository() eu_timepit_refined_repository() io_circe_circe_repo...
cipher = '11b90d6311b90ff90ce610c4123b10c40ce60dfa123610610ce60d450d000ce61061106110c4098515340d4512361534098509270e5d09850e58123610c9' pubkey = [99, 1235, 865, 990, 5, 1443, 895, 1477] flag = "" for i in range(0, len(cipher), 4): c = int(cipher[i:i+4], 16) for m in range(0x100): test = 0 for p...
cipher = '11b90d6311b90ff90ce610c4123b10c40ce60dfa123610610ce60d450d000ce61061106110c4098515340d4512361534098509270e5d09850e58123610c9' pubkey = [99, 1235, 865, 990, 5, 1443, 895, 1477] flag = '' for i in range(0, len(cipher), 4): c = int(cipher[i:i + 4], 16) for m in range(256): test = 0 for p ...
#coding:utf-8 ''' filename:vowel_counts.py chap:4 subject:9 conditions:chap3_35 string solution:count a,e,i,o,u ''' text = '''You raise me up,so I can stand on mountains You raise me up to walk on stromy seas I am strong when I am on your shoulders You raise me up to more than I can be''' v...
""" filename:vowel_counts.py chap:4 subject:9 conditions:chap3_35 string solution:count a,e,i,o,u """ text = 'You raise me up,so I can stand on mountains\nYou raise me up to walk on stromy seas\nI am strong when I am on your shoulders\nYou raise me up to more than I can be' vowels = ('a', 'e', ...
# reading ocntents from file # fp=open('file.txt') fp=open('file.txt','r') # by default it opens in read mode text=fp.read() print(text)
fp = open('file.txt', 'r') text = fp.read() print(text)
class Entry(object): def __init__(self): self.name = '' self.parent = '' self.created = 0 self.lastUpdate = 0 self.lastAccess = 0 def create(self): pass def delete(self): pass def getFullPath(self): if not self.parent: return...
class Entry(object): def __init__(self): self.name = '' self.parent = '' self.created = 0 self.lastUpdate = 0 self.lastAccess = 0 def create(self): pass def delete(self): pass def get_full_path(self): if not self.parent: ret...
class HashMap: def __init__(self): self.bucket = {} def put(self, key: int, value: int) -> None: self.bucket[key] = value def get(self, key: int) -> int: if key in self.bucket: return self.bucket[key] return -1 def remove(self, key: int) -> None: i...
class Hashmap: def __init__(self): self.bucket = {} def put(self, key: int, value: int) -> None: self.bucket[key] = value def get(self, key: int) -> int: if key in self.bucket: return self.bucket[key] return -1 def remove(self, key: int) -> None: i...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
default_rules = list() default_rules.append('event["eventName"] == "ConsoleLogin" ' + 'and event["additionalEventData.MFAUsed"] != "Yes" ' + 'and "assumed-role/AWSReservedSSO" not in event.get("userIdentity.arn", "")') default_rules.append('event.get("errorCode", "") == "UnauthorizedOperation"') default_rules.append('e...
# -*- coding: UTF-8 -*- # # You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. # # You may assume the two numbers do not contain any leading zero, exce...
class Addtwonumbers(object): def add_two_numbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ tmp1 = l1.next tmp2 = l2.next result = list_node((l1.val + l2.val) % 10) results = [] add_one = l1.val + l2....
class DisjointSet: def __init__(self, elements): self.parent = [0] * elements self.size = [0] * elements def make_set(self, value): self.parent[value] = value self.size[value] = 1 def find(self, value): while self.parent[value] != value: value = self.pa...
class Disjointset: def __init__(self, elements): self.parent = [0] * elements self.size = [0] * elements def make_set(self, value): self.parent[value] = value self.size[value] = 1 def find(self, value): while self.parent[value] != value: value = self.pa...
def factor(num1: float, num2: float): if num1 % num2 == 0: return f"{num2} is a factor of {num1}" else: return f"{num2} is not a factor of {num1}" num1 = int(input("Enter a number: ")) num2 = int(input("Enter a number: ")) print(factor(num1, num2))
def factor(num1: float, num2: float): if num1 % num2 == 0: return f'{num2} is a factor of {num1}' else: return f'{num2} is not a factor of {num1}' num1 = int(input('Enter a number: ')) num2 = int(input('Enter a number: ')) print(factor(num1, num2))
n = input() cnt = 0 for i in n: if 'A' <= i <= 'C': cnt += 3 elif 'D' <= i <= 'F': cnt += 4 elif 'G' <= i <= 'I': cnt += 5 elif 'J' <= i <= 'L': cnt += 6 elif 'M' <= i <= 'O': cnt += 7 elif 'P' <= i <= 'S': cnt += 8 elif 'T' <= i <= 'V': ...
n = input() cnt = 0 for i in n: if 'A' <= i <= 'C': cnt += 3 elif 'D' <= i <= 'F': cnt += 4 elif 'G' <= i <= 'I': cnt += 5 elif 'J' <= i <= 'L': cnt += 6 elif 'M' <= i <= 'O': cnt += 7 elif 'P' <= i <= 'S': cnt += 8 elif 'T' <= i <= 'V': ...
class ClosestDistanceInfo: def __init__(self, first, second, neighbours): self.mFirst = first self.mSecond = second self.mNeighbours = neighbours
class Closestdistanceinfo: def __init__(self, first, second, neighbours): self.mFirst = first self.mSecond = second self.mNeighbours = neighbours
# -*- coding: utf-8 -*- { 'actualizada': ['actualizadas'], 'eliminada': ['eliminadas'], 'fila': ['filas'], 'seleccionado': ['seleccionados'], }
{'actualizada': ['actualizadas'], 'eliminada': ['eliminadas'], 'fila': ['filas'], 'seleccionado': ['seleccionados']}
"""sample scripts for covariance related stuff""" def cov(v1, v2): assert len(v1) == len(v2), "vectors should be of same size" m1 = sum(v1) / (len(v1)) m2 = sum(v2) / (len(v2)) cov = 0 for i in range(0, len(v1)): cov += (v1[i] - m1)*(v2[i]-m2) return cov / (len(v1) -1 ) def cov_matri...
"""sample scripts for covariance related stuff""" def cov(v1, v2): assert len(v1) == len(v2), 'vectors should be of same size' m1 = sum(v1) / len(v1) m2 = sum(v2) / len(v2) cov = 0 for i in range(0, len(v1)): cov += (v1[i] - m1) * (v2[i] - m2) return cov / (len(v1) - 1) def cov_matrix(...
""" Here's some complexity: what if the user gives us a letter in input() and not a number? Or what if it's an decimal (float) instead of an integer? We need to validate our inputs. """ def get_values(): """ Retrieves two values to multiply """ user_values = input("On the next line, enter the values t...
""" Here's some complexity: what if the user gives us a letter in input() and not a number? Or what if it's an decimal (float) instead of an integer? We need to validate our inputs. """ def get_values(): """ Retrieves two values to multiply """ user_values = input('On the next line, enter the values to...
#! /usr/bin/env python3 description =""" Counting Sundays Problem 19 You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, ...
description = '\nCounting Sundays\nProblem 19\nYou are given the following information, but you may prefer to do some research for yourself.\n\n1 Jan 1900 was a Monday.\nThirty days has September,\nApril, June and November.\nAll the rest have thirty-one,\nSaving February alone,\nWhich has twenty-eight, rain or shine.\n...
class node(object): def __init__(self, data): self.data = data self.next = None def get_data(self): return self.data def set_next(self, next): self.next = next def get_next(self): return self.next def has_next(self): return self.next...
class Node(object): def __init__(self, data): self.data = data self.next = None def get_data(self): return self.data def set_next(self, next): self.next = next def get_next(self): return self.next def has_next(self): return self.next != None clas...
# Longest common sub sequence: def find_length_lcs(a1, a2): N = len(a1) dp = [[0 for i in range(N + 1)] for j in range(N + 1)] for i in range(1, N + 1): for j in range(1, N + 1): if a1[i - 1] == a2[j - 1]: dp[i][j] = 1 + dp[i - 1][j - 1] else: ...
def find_length_lcs(a1, a2): n = len(a1) dp = [[0 for i in range(N + 1)] for j in range(N + 1)] for i in range(1, N + 1): for j in range(1, N + 1): if a1[i - 1] == a2[j - 1]: dp[i][j] = 1 + dp[i - 1][j - 1] else: dp[i][j] = max(dp[i - 1][j], dp...
entries = [ { 'env-title': 'atari-alien', 'env-variant': 'No-op start', 'score': 5778, 'stddev': 2189, }, { 'env-title': 'atari-amidar', 'env-variant': 'No-op start', 'score': 3537, 'stddev': 521, }, { 'env-title': 'atari-assaul...
entries = [{'env-title': 'atari-alien', 'env-variant': 'No-op start', 'score': 5778, 'stddev': 2189}, {'env-title': 'atari-amidar', 'env-variant': 'No-op start', 'score': 3537, 'stddev': 521}, {'env-title': 'atari-assault', 'env-variant': 'No-op start', 'score': 11231, 'stddev': 503}, {'env-title': 'atari-asterix', 'en...
class CacheData: def __init__(self, cache=None, root=None,hit=None,full=None): self.cache = cache self.root = root self.hit = hit self.full = full
class Cachedata: def __init__(self, cache=None, root=None, hit=None, full=None): self.cache = cache self.root = root self.hit = hit self.full = full
## # This software was developed and / or modified by Raytheon Company, # pursuant to Contract DG133W-05-CQ-1067 with the US Government. # # U.S. EXPORT CONTROLLED TECHNICAL DATA # This software product contains export-restricted data whose # export/transfer/disclosure is restricted by U.S. law. Dissemination # to ...
verdir = '/data/verify' editareas = 'EditAreas.dat' percent_color = 'Warm To Cold' griddays = 200 statdays = 500 obsmodels = ['Obs', 'RFCQPE'] verconfig = {} VERCONFIG['T'] = (0, 0, 3, (1, 3, 5, 7, 10), 0.5, 20, 'BV_Change1', 'T') VERCONFIG['MaxT'] = (0, 0, 0, (1, 3, 5, 7, 10), 0.5, 20, 'BV_Change1', 'MaxT') VERCONFIG[...
validators = { "departure location": [[45, 609], [616, 954]], "departure station": [[32, 194], [211, 972]], "departure platform": [[35, 732], [744, 970]], "departure track": [[40, 626], [651, 952]], "departure date": [[44, 170], [184, 962]], "departure time": [[49, 528], [538, 954]], "arriva...
validators = {'departure location': [[45, 609], [616, 954]], 'departure station': [[32, 194], [211, 972]], 'departure platform': [[35, 732], [744, 970]], 'departure track': [[40, 626], [651, 952]], 'departure date': [[44, 170], [184, 962]], 'departure time': [[49, 528], [538, 954]], 'arrival location': [[36, 448], [464...
# This module implements the public interface to the "counter" package. def reset(): """ Reset our counter. This should be called before we start counting. """ global _counts _counts = {} # Maps value to number of occurrences. def add(value): """ Add the given value to our counter. "...
def reset(): """ Reset our counter. This should be called before we start counting. """ global _counts _counts = {} def add(value): """ Add the given value to our counter. """ global _counts try: _counts[value] += 1 except KeyError: _counts[value] = 1 def t...
class Solution: def recoverTree(self, root: Optional[TreeNode]) -> None: def swap(x: Optional[TreeNode], y: Optional[TreeNode]) -> None: temp = x.val x.val = y.val y.val = temp def inorder(root: Optional[TreeNode]) -> None: if not root: return inorder(root.left) ...
class Solution: def recover_tree(self, root: Optional[TreeNode]) -> None: def swap(x: Optional[TreeNode], y: Optional[TreeNode]) -> None: temp = x.val x.val = y.val y.val = temp def inorder(root: Optional[TreeNode]) -> None: if not root: ...
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. class VersionUpdateItem: def __init__(self, id, new_version): self.id = id self.new_version = new_version def __str__(self): return '[id: {}; new_version: {}]'.format(self.id, self.new_versio...
class Versionupdateitem: def __init__(self, id, new_version): self.id = id self.new_version = new_version def __str__(self): return '[id: {}; new_version: {}]'.format(self.id, self.new_version)
# -*- coding: utf-8 -*- """ Created on Wed Jan 27 21:02:58 2016 @author: amylo #""" print("HELLO WORLD!") print('HELLO MAYAN!') print('''this is the first line jfklds fjkdlsjfl''') age = 3 name = "Dou Dou" print("{0} was {1} years old".format(name,age)) print(name + " was " + str(age) + " years old ")
""" Created on Wed Jan 27 21:02:58 2016 @author: amylo #""" print('HELLO WORLD!') print('HELLO MAYAN!') print('this is the first line\njfklds\nfjkdlsjfl') age = 3 name = 'Dou Dou' print('{0} was {1} years old'.format(name, age)) print(name + ' was ' + str(age) + ' years old ')
""" This package is a place for your business logic. Please, do not create any other files inside your app package. Place all files here, including: logic, forms, serializers. Decoupling is a good thing. We need more of that. """
""" This package is a place for your business logic. Please, do not create any other files inside your app package. Place all files here, including: logic, forms, serializers. Decoupling is a good thing. We need more of that. """
class Solution: def minimumTotal(self, triangle: List[List[int]]) -> int: arr = [0x7fffffff] * len(triangle) arr[0] = triangle[0][0] for i in range(1, len(triangle)): arr[i] = arr[i - 1] + triangle[i][i] for j in range(i - 1, 0, -1): arr[j] = min(arr[j...
class Solution: def minimum_total(self, triangle: List[List[int]]) -> int: arr = [2147483647] * len(triangle) arr[0] = triangle[0][0] for i in range(1, len(triangle)): arr[i] = arr[i - 1] + triangle[i][i] for j in range(i - 1, 0, -1): arr[j] = min(arr...
def invert_dict(d): """more concise version of invert_dict with setdefault""" inverse = dict() for key in d: val = d[key] inverse.setdefault(val, []) inverse[val].append(key) return inverse inverse = invert_dict({'a': 1, 'p': 1, 'r': 2, 't': 1, 'o': 1}) print(inverse)
def invert_dict(d): """more concise version of invert_dict with setdefault""" inverse = dict() for key in d: val = d[key] inverse.setdefault(val, []) inverse[val].append(key) return inverse inverse = invert_dict({'a': 1, 'p': 1, 'r': 2, 't': 1, 'o': 1}) print(inverse)
prn_out = { 1: [2, 6], 2: [3, 7], 3: [4, 8], 4: [6, 9], 5: [1, 9], 6: [2, 10], 7: [1, 8], 8: [2, 9], 9: [3, 10], 10: [2, 3], 11: [3, 4], 12: [5, 6], 13: [6, 7], 14: [7, 8], 15: [8, 9], 16: [9, 10], 17: [1, 4], 18: [2, 5], 19: [3, 6], ...
prn_out = {1: [2, 6], 2: [3, 7], 3: [4, 8], 4: [6, 9], 5: [1, 9], 6: [2, 10], 7: [1, 8], 8: [2, 9], 9: [3, 10], 10: [2, 3], 11: [3, 4], 12: [5, 6], 13: [6, 7], 14: [7, 8], 15: [8, 9], 16: [9, 10], 17: [1, 4], 18: [2, 5], 19: [3, 6], 20: [4, 7], 21: [5, 8], 22: [6, 9], 23: [1, 3], 24: [4, 6], 25: [5, 7], 26: [6, 8], 27:...
""" Class representing Nodes of a tree data structure """ class Node: latest_move: list[dict] def __init__(self, latest_move: dict, evaluation): self.latest_move = [latest_move] if latest_move else list() self.child_nodes = list() self.board_evaluation: float = evaluation def add...
""" Class representing Nodes of a tree data structure """ class Node: latest_move: list[dict] def __init__(self, latest_move: dict, evaluation): self.latest_move = [latest_move] if latest_move else list() self.child_nodes = list() self.board_evaluation: float = evaluation def add_...
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def berty_go_repositories(): # utils maybe( git_repository, name = "bazel_skylib", re...
load('@bazel_tools//tools/build_defs/repo:git.bzl', 'git_repository') load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe') def berty_go_repositories(): maybe(git_repository, name='bazel_skylib', remote='https://github.com/bazelbuild/baz...
y: Tuple[int, ...] x: Tuple[int] z: Tuple[Union[int, str]] for ([y, (x, (z))]) in \ undefined(): pass
y: Tuple[int, ...] x: Tuple[int] z: Tuple[Union[int, str]] for [y, (x, z)] in undefined(): pass
class Solution: def findLadders(self, beginWord: str, endWord: str, wordList: List[str]) -> List[List[str]]: words = set(wordList) if endWord not in words: return [] frontier = collections.deque([(beginWord)]) mn_cost = math.inf costs = {w : math.inf for w in word...
class Solution: def find_ladders(self, beginWord: str, endWord: str, wordList: List[str]) -> List[List[str]]: words = set(wordList) if endWord not in words: return [] frontier = collections.deque([beginWord]) mn_cost = math.inf costs = {w: math.inf for w in words...
if __name__ == '__main__': stlist = [] marks = set() lower_name = [] for _ in range(int(input())): name = input() score = float(input()) stlist.append([name, score]) marks.add(score) # Increasing order sec = sorted(marks)[1] # print(sec) for name, scor...
if __name__ == '__main__': stlist = [] marks = set() lower_name = [] for _ in range(int(input())): name = input() score = float(input()) stlist.append([name, score]) marks.add(score) sec = sorted(marks)[1] for (name, score) in stlist: if score == sec: ...
#printing fibonacci number until 'n' using python n=int(input("enter the value of 'n': ")) a=0 b=1 sum=0 count=1 print("fibonacci:",end = " ") while(count<=n): print(sum,end=" ") count +=1 a=b b=sum sum=a+b
n = int(input("enter the value of 'n': ")) a = 0 b = 1 sum = 0 count = 1 print('fibonacci:', end=' ') while count <= n: print(sum, end=' ') count += 1 a = b b = sum sum = a + b
DEBUG = True PORT = 8080 SECRET_KEY = "secret" WTF_CSRF_ENABLED = True baseUrl = "https://hp8xm3yzr0.execute-api.us-east-2.amazonaws.com/prod/"
debug = True port = 8080 secret_key = 'secret' wtf_csrf_enabled = True base_url = 'https://hp8xm3yzr0.execute-api.us-east-2.amazonaws.com/prod/'
class DigestConfig: def __init__(self): self.digest_AAs = "KR" self.Nterm = False self.min_len = 9 self.max_len = 30 self.max_miss_cleave = 2 self.cleave_type = "full" def digest(protein, pepset, conf): if conf.cleave_type == "full": return digest_full(...
class Digestconfig: def __init__(self): self.digest_AAs = 'KR' self.Nterm = False self.min_len = 9 self.max_len = 30 self.max_miss_cleave = 2 self.cleave_type = 'full' def digest(protein, pepset, conf): if conf.cleave_type == 'full': return digest_full(p...
def split(str): splitted=str.split(" ") return splitted def join(str): joined="-".join(str) return joined str="Geeks For Geeks" splitted=split(str) print(splitted) print(join(splitted))
def split(str): splitted = str.split(' ') return splitted def join(str): joined = '-'.join(str) return joined str = 'Geeks For Geeks' splitted = split(str) print(splitted) print(join(splitted))
def normalise_total_cozie(dataframe, group, threshold): cluster_df = dataframe.copy(deep=True) # remapping cluster_df['prefer_cooler'] = cluster_df['thermal_cozie'][cluster_df.thermal_cozie == 11.0] #Too Hot cluster_df['prefer_warmer'] = cluster_df['thermal_cozie'][cluster_df.thermal_cozie == 9.0] # To...
def normalise_total_cozie(dataframe, group, threshold): cluster_df = dataframe.copy(deep=True) cluster_df['prefer_cooler'] = cluster_df['thermal_cozie'][cluster_df.thermal_cozie == 11.0] cluster_df['prefer_warmer'] = cluster_df['thermal_cozie'][cluster_df.thermal_cozie == 9.0] cluster_df['thermaly_comfy...
def stage(hub, name): ''' Take the highdata and reconcoile the extend keyword ''' high, errors = hub.idem.extend.reconcile(hub.idem.RUNS[name]['high']) hub.idem.RUNS[name]['high'] = high hub.idem.RUNS[name]['errors'] = errors
def stage(hub, name): """ Take the highdata and reconcoile the extend keyword """ (high, errors) = hub.idem.extend.reconcile(hub.idem.RUNS[name]['high']) hub.idem.RUNS[name]['high'] = high hub.idem.RUNS[name]['errors'] = errors
# Formatting configuration for locale sv_SE languages={'gv': 'manx gaeliska', 'gu': 'gujarati', 'rom': 'romani', 'ale': 'aleutiska', 'sco': 'skotska', 'mni': 'manipuri', 'gd': 'skotsk gaeliska', 'ga': u'irl\xe4ndsk gaeliska', 'osa': 'osage', 'gn': u'guaran\xed', 'gl': 'galiciska', 'mwr': 'marwari', 'ty': 'tahitiska', ...
languages = {'gv': 'manx gaeliska', 'gu': 'gujarati', 'rom': 'romani', 'ale': 'aleutiska', 'sco': 'skotska', 'mni': 'manipuri', 'gd': 'skotsk gaeliska', 'ga': u'irländsk gaeliska', 'osa': 'osage', 'gn': u'guaraní', 'gl': 'galiciska', 'mwr': 'marwari', 'ty': 'tahitiska', 'tw': 'twi', 'tt': 'tatariska', 'tr': 'turkiska',...
N = int(input()) count = 0 for i in range(1, N+1, 2): yakusuu = 0 for j in range(1, i+1, 2): if i % j == 0: yakusuu += 1 if yakusuu == 8: count += 1 print(count)
n = int(input()) count = 0 for i in range(1, N + 1, 2): yakusuu = 0 for j in range(1, i + 1, 2): if i % j == 0: yakusuu += 1 if yakusuu == 8: count += 1 print(count)
""" Data Structures :: LRU Cache """ class ListNode: def __init__(self, key, value, prev=None, next=None): """A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed by key. :param pre...
""" Data Structures :: LRU Cache """ class Listnode: def __init__(self, key, value, prev=None, next=None): """A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed by key. :param pre...
# @Time : 2019/6/24 23:21 # @Author : shakespere # @FileName: Implement Trie (Prefix Tree).py ''' 208. Implement Trie (Prefix Tree) Medium Implement a trie with insert, search, and startsWith methods. Example: Trie trie = new Trie(); trie.insert("apple"); trie.search("apple"); // returns true tri...
""" 208. Implement Trie (Prefix Tree) Medium Implement a trie with insert, search, and startsWith methods. Example: Trie trie = new Trie(); trie.insert("apple"); trie.search("apple"); // returns true trie.search("app"); // returns false trie.startsWith("app"); // returns true trie.insert("app"); trie.search("a...
""" 44. Wildcard Matching Example 1: Input: s = "aa" p = "a" Output: false Explanation: "a" does not match the entire string "aa". Example 2: Input: s = "aa" p = "*" Output: true Explanation: '*' matches any sequence. Example 3: Input: s = "cb" p = "?a" Output: false Explanation: '?' matches ...
""" 44. Wildcard Matching Example 1: Input: s = "aa" p = "a" Output: false Explanation: "a" does not match the entire string "aa". Example 2: Input: s = "aa" p = "*" Output: true Explanation: '*' matches any sequence. Example 3: Input: s = "cb" p = "?a" Output: false Explanation: '?' matches 'c', but the second let...
class reverse_iter: def __init__(self, elements): self.elements = elements self.start = len(self.elements) - 1 def __iter__(self): return self def __next__(self): if self.start < 0: raise StopIteration index = self.start self.start -= 1 ...
class Reverse_Iter: def __init__(self, elements): self.elements = elements self.start = len(self.elements) - 1 def __iter__(self): return self def __next__(self): if self.start < 0: raise StopIteration index = self.start self.start -= 1 ...
# syms =['["2_x00"]', '["2_0y0"]', '["2_00z"]', # '["2_xx0"]', '["2_x0x"]', '["2_0yy"]', # '["2_xmx0"]', '["2_mx0x"]', '["2_0myy"]', # # '["3_xxx"]', '["3_xmxmx"]', # '["3_mxxmx"]', '["3_mxmxx"]', # # '["m3_xxx"]', '["m3_xmxmx"]', # '["m3_mxxmx"]', '["m3_mxmxx"]', # # '["4_x00"]', '["4_0y0"]', '["4_00z"]', # # '["-4_x0...
syms_hex = ['["i_000"]', '["hex_m_x2xz"]', '["hex_m_2xxz"]', '["hex_m_x0z"]', '["hex_m_0yz"]', '["hex_2_x00"]', '["hex_2_0y0"]', '["hex_2_x2x0"]', '["hex_2_2xx0"]', '["3_00z"]', '["m3_00z"]', '["6_00z"]', '["m6_00z"]'] text = 'import matrices_new_extended as mne\nimport numpy as np\nimport sympy as sp\nfrom equality_ch...
class NetstorageError(Exception): def __init__(self, response, *args, **kwargs): super(NetstorageError, self).__init__(response) self.msg = kwargs.get('message') class NotFoundError(NetstorageError): def __init__(self, response, *args, **kwargs): message = ('Can occur if the targeted ...
class Netstorageerror(Exception): def __init__(self, response, *args, **kwargs): super(NetstorageError, self).__init__(response) self.msg = kwargs.get('message') class Notfounderror(NetstorageError): def __init__(self, response, *args, **kwargs): message = 'Can occur if the targeted o...
""" Rinzler's exceptions module :author: Rinzler<github.com/feliphebueno> :date: 14/07/2018 """ __author__ = "Rinzler<github.com/feliphebueno>" class RinzlerHttpException(BaseException): """ Rinzler's base HTTP Exception, all other HTTP Exceptions must subclass this class as well as override it's properti...
""" Rinzler's exceptions module :author: Rinzler<github.com/feliphebueno> :date: 14/07/2018 """ __author__ = 'Rinzler<github.com/feliphebueno>' class Rinzlerhttpexception(BaseException): """ Rinzler's base HTTP Exception, all other HTTP Exceptions must subclass this class as well as override it's propertie...
# numbers to letters small = ['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen'] tens = ['mistake0','mistake1','twenty','thirty','forty','fifty','sixty','seventy','eighty','ninety'] # simple algori...
small = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'] tens = ['mistake0', 'mistake1', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'] def conver...
ALPHABET = 'abcdefghijklmnopqrstuvwxyz' def increment(word: str) -> str: last_index = len(word) - 1 if word[last_index] != 'z': return word[:last_index] + ALPHABET[ALPHABET.find(word[last_index]) + 1] elif len(word) == 1: return "aa" else: return increment(word[:last_index]) + ...
alphabet = 'abcdefghijklmnopqrstuvwxyz' def increment(word: str) -> str: last_index = len(word) - 1 if word[last_index] != 'z': return word[:last_index] + ALPHABET[ALPHABET.find(word[last_index]) + 1] elif len(word) == 1: return 'aa' else: return increment(word[:last_index]) + '...
DB_CONFIG_DEV = {'host': 'host', 'usuario':'usr_pesquisabr', 'senha':'senhapesquisabr', 'database': 'pesquisabr' } DB_CONFIG_PROD = {'host': 'host', 'usuario':'usr_pesquisabr', 'senha':'senhapesquisabr', 'database': 'pesquisabr' } ...
db_config_dev = {'host': 'host', 'usuario': 'usr_pesquisabr', 'senha': 'senhapesquisabr', 'database': 'pesquisabr'} db_config_prod = {'host': 'host', 'usuario': 'usr_pesquisabr', 'senha': 'senhapesquisabr', 'database': 'pesquisabr'}
def diag_diff(matr): sum1 = 0 sum2 = 0 length = len(matr[0]) for i in range(length): for j in range(length): if i == j: sum1 = sum1 + matr[i][j] if i == length - j - 1: sum2 = sum2 + matr[i][j] return sum1 - sum2
def diag_diff(matr): sum1 = 0 sum2 = 0 length = len(matr[0]) for i in range(length): for j in range(length): if i == j: sum1 = sum1 + matr[i][j] if i == length - j - 1: sum2 = sum2 + matr[i][j] return sum1 - sum2
# # PySNMP MIB module HH3C-DOT11-RRM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-DOT11-RRM-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:26:18 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, single_value_constraint, value_range_constraint, constraints_intersection) ...
class Solution: """ @param source: @param target: @return: return the index """ def strStr(self, source, target): l = len(target) for i in range(len(source) - l + 1): if source[i:i+l] == target: return i return -1
class Solution: """ @param source: @param target: @return: return the index """ def str_str(self, source, target): l = len(target) for i in range(len(source) - l + 1): if source[i:i + l] == target: return i return -1
change = 91 coin = 25 print('how many quarters in 91 cents? 3') print('how much change is left after 3 quarters taken out of 91cents? 16') print(91 / 25, 'is not the awnser to either question') print(91//25) print(91%25)
change = 91 coin = 25 print('how many quarters in 91 cents? 3') print('how much change is left after 3 quarters taken out of 91cents? 16') print(91 / 25, 'is not the awnser to either question') print(91 // 25) print(91 % 25)
"""from django.contrib import admin from .models import Status @admin.register(Status) class StatusAdmin(admin.ModelAdmin): list_display = ('shape', 'created_at') admin.site.register(Status, StatusAdmin) """
"""from django.contrib import admin from .models import Status @admin.register(Status) class StatusAdmin(admin.ModelAdmin): list_display = ('shape', 'created_at') admin.site.register(Status, StatusAdmin) """
# binary search def binarySearchRec(sort: list, target: int, start: int, stop: int, value: bool): """binary search with recursion""" if start > stop: if value: return None # not found value else: return -1 # not found index else: mid = (start + stop) // 2 ...
def binary_search_rec(sort: list, target: int, start: int, stop: int, value: bool): """binary search with recursion""" if start > stop: if value: return None else: return -1 else: mid = (start + stop) // 2 if target == sort[mid]: if value: ...
a = input("Enter a number: ") prev = None flag = True if len(a)==1: flag = False for elm in a: if prev == None: prev = int(elm) else: if prev > int(elm): prev = int(elm) else: flag = False break print(flag)
a = input('Enter a number: ') prev = None flag = True if len(a) == 1: flag = False for elm in a: if prev == None: prev = int(elm) elif prev > int(elm): prev = int(elm) else: flag = False break print(flag)
BATTERY_UUID = "0000ec08-0000-1000-8000-00805f9b34fb" DEVICE_USER_NAME_UUID = "0000ec01-0000-1000-8000-00805f9b34fb" UPDATED_AT_UUID = "0000ec09-0000-1000-8000-00805f9b34fb" MODEL_NUMBER_UUID = "00002a24-0000-1000-8000-00805f9b34fb" MANUFACTURER_UUID = "00002a29-0000-1000-8000-00805f9b34fb" VALVE_MANUAL_SETTINGS_UUID ...
battery_uuid = '0000ec08-0000-1000-8000-00805f9b34fb' device_user_name_uuid = '0000ec01-0000-1000-8000-00805f9b34fb' updated_at_uuid = '0000ec09-0000-1000-8000-00805f9b34fb' model_number_uuid = '00002a24-0000-1000-8000-00805f9b34fb' manufacturer_uuid = '00002a29-0000-1000-8000-00805f9b34fb' valve_manual_settings_uuid =...
""" Quetion 29 : Define a function that can accept two string as input and then print it in console. Hints : Ues + to concatenate the strings. """ # Solution : def print_value(s1, s2): print(s1 + s2) print_value("3", "4") """ Output : 34 """
""" Quetion 29 : Define a function that can accept two string as input and then print it in console. Hints : Ues + to concatenate the strings. """ def print_value(s1, s2): print(s1 + s2) print_value('3', '4') '\nOutput :\n 34\n'
""" PSET-7 Part 3: Filtering At this point, you can run ps7.py, and it will fetch and display Google and Yahoo news items for you in little pop-up windows. How many news items? All of them. Right now, the code we've given you in ps7.py gets all of the feeds every minute, and displays the result. This is nice, but,...
""" PSET-7 Part 3: Filtering At this point, you can run ps7.py, and it will fetch and display Google and Yahoo news items for you in little pop-up windows. How many news items? All of them. Right now, the code we've given you in ps7.py gets all of the feeds every minute, and displays the result. This is nice, but,...
GIT_ACTION_RESULT = 'result' GIT_ACTION_ADVERTISEMENT = 'advertisement' GIT_ACTIONS = [GIT_ACTION_ADVERTISEMENT, GIT_ACTION_RESULT] def is_valid_git_action(action): """ Returns true if the given action is one of git valid actions. """ return action in GIT_ACTIONS
git_action_result = 'result' git_action_advertisement = 'advertisement' git_actions = [GIT_ACTION_ADVERTISEMENT, GIT_ACTION_RESULT] def is_valid_git_action(action): """ Returns true if the given action is one of git valid actions. """ return action in GIT_ACTIONS
# CSC 110 - Practice Activity #2 # Tip Calculator # Section 03 # Justin Clark # 1/14/2020 # input billAmountEntered = float(input('Enter bill amount $: ')) tipPercentEntered = float(input('Enter tip %: ')) # processing tipCalculated = billAmountEntered * (tipPercentEntered / 100) amountToPay = billAmountEntered + tip...
bill_amount_entered = float(input('Enter bill amount $: ')) tip_percent_entered = float(input('Enter tip %: ')) tip_calculated = billAmountEntered * (tipPercentEntered / 100) amount_to_pay = billAmountEntered + tipCalculated receipt = '--------------------------' + '\n' + 'Receipt\n-------------------' + '\n' + 'Bill E...
# -*- coding: utf-8 -*- __version__ = (1, 0, 0) default_app_config = "taiga_contrib_fan.apps.TaigaContribFanAppConfig"
__version__ = (1, 0, 0) default_app_config = 'taiga_contrib_fan.apps.TaigaContribFanAppConfig'
i = 0 n = int(input()) while (n > 0): i += n n -= 1 print('Sum is',i)
i = 0 n = int(input()) while n > 0: i += n n -= 1 print('Sum is', i)
class Point: def __init__(self, x, y): self._cluster = 0 # Not classified yet self._visited = False self._x = x self._y = y def get_cluster(self): return self._cluster def set_cluster(self, cluster): self._cluster = cluster def get_values(...
class Point: def __init__(self, x, y): self._cluster = 0 self._visited = False self._x = x self._y = y def get_cluster(self): return self._cluster def set_cluster(self, cluster): self._cluster = cluster def get_values(self): return (self._x, se...
#! /usr/bin/env python3 def add_verticle(a, b) : global verticles if a in verticles : verticles[a].append(b) else : verticles[a] = [b] return verticles def all_paths_util(u, path = []) : global verticles if u in path and not u.upper() == u : return [] path.append(u) if u == 'end...
def add_verticle(a, b): global verticles if a in verticles: verticles[a].append(b) else: verticles[a] = [b] return verticles def all_paths_util(u, path=[]): global verticles if u in path and (not u.upper() == u): return [] path.append(u) if u == 'end': re...
class SingleLed(object): """Represents a single LED that is connected to the ESP32""" def __init__(self, pin): self.pin = pin def write_on(self, is_on): print("Setting LED on pin {} to {}".format(self.pin, is_on)) # TODO: Actually call MicroPython code to set the output
class Singleled(object): """Represents a single LED that is connected to the ESP32""" def __init__(self, pin): self.pin = pin def write_on(self, is_on): print('Setting LED on pin {} to {}'.format(self.pin, is_on))
class Solution: def totalHammingDistance(self, nums: List[int]) -> int: total = 0 for b in zip(*map('{:030b}'.format, nums)): zeros = b.count('0') total += zeros * (len(b) - zeros) return total
class Solution: def total_hamming_distance(self, nums: List[int]) -> int: total = 0 for b in zip(*map('{:030b}'.format, nums)): zeros = b.count('0') total += zeros * (len(b) - zeros) return total
# # PySNMP MIB module HUAWEI-VO-GENERAL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-VO-GENERAL-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:49:30 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, constraints_intersection, value_size_constraint) ...
class Solution: def minPathSum(self, grid): """ :type grid: List[List[int]] :rtype: int """ # DP problem if not grid or not grid[0]: return 0 dp = [grid[0][0]] for num in grid[0][1:]: dp.append(dp[-1] + num) m, n = len(g...
class Solution: def min_path_sum(self, grid): """ :type grid: List[List[int]] :rtype: int """ if not grid or not grid[0]: return 0 dp = [grid[0][0]] for num in grid[0][1:]: dp.append(dp[-1] + num) (m, n) = (len(grid), len(grid[...
#!/usr/bin/env python3 # Day 22: Subarray Sum Equals K # # Given an array of integers and an integer k, you need to find the total # number of continuous subarrays whose sum equals to k. class Solution: def subarraySum(self, nums: [int], k: int) -> int: count = 0 ways_to_sum = {} current_s...
class Solution: def subarray_sum(self, nums: [int], k: int) -> int: count = 0 ways_to_sum = {} current_sum = 0 for number in nums: current_sum += number if current_sum == k: count += 1 if current_sum - k in ways_to_sum: ...
class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def reorderList(self, head): """ :type head: ListNode :rtype: None Do not return anything, modify head in-place instead. """ if not head: ret...
class Listnode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def reorder_list(self, head): """ :type head: ListNode :rtype: None Do not return anything, modify head in-place instead. """ if not head: r...
gamemat = [0] * 4 for i in range(4): gamemat[i] = [0] * 4 player = 1 gameEnd = False gameResult = None def readInput(currentPlayer): print("Player " + str(currentPlayer) + " (input x and y, seperated with a space): ", end = "") try: x,y = input().split() x = int(x) y = int(y) ex...
gamemat = [0] * 4 for i in range(4): gamemat[i] = [0] * 4 player = 1 game_end = False game_result = None def read_input(currentPlayer): print('Player ' + str(currentPlayer) + ' (input x and y, seperated with a space): ', end='') try: (x, y) = input().split() x = int(x) y = int(y) ...
## # check_if_correct: # def check_if_correct(): ''' @summary reusable while loop to check if alarm time is correct @desc Infinitely loops as long as the user does not input a "Y" or "N" @author Brandon Benefield @since v1.0.0 @param {void} @return {void} ...
def check_if_correct(): """ @summary reusable while loop to check if alarm time is correct @desc Infinitely loops as long as the user does not input a "Y" or "N" @author Brandon Benefield @since v1.0.0 @param {void} @return {void} """ acceptable = False ...
# python3: CircuitPython 3.0 # Author: Gregory P. Smith (@gpshead) <greg@krypto.org> # # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache....
"""A monochrome bitmap to represent display frame buffers.""" class Monobitmap: """A monochrome bitmap stored compactly. Attributes: bit_buf: The raw bitmap buffer bytearray. Do not resize! width: The width. Do not modify. height: The height. Do not modify. Usage: hidden_cat = ...
class Suggestion: """ Object containing the data to suggest """ def __init__( self, email_address, name, content, ): self.email_address = email_address self.name = name self.content = content def __hash__(self): return hash((self.email_address, self.name...
class Suggestion: """ Object containing the data to suggest """ def __init__(self, email_address, name, content): self.email_address = email_address self.name = name self.content = content def __hash__(self): return hash((self.email_address, self.name, self.content)...
# coding: utf-8 __author__ = 'deff' # Andoid-afl.https://github.com/ele7enxxh/android-afl # Fuzzing with libFuzzer. # Droid: Android application fuzzing framework.https://github.com/ajinabraham/Droid-Application-Fuzz-Framework # Writing the worlds worst Android fuzzer, and then improving it, by Gamozo 2018. # Fuzzing...
__author__ = 'deff'
def pig_latin(text_input): final = "" # create final string, couples, and split text_input couples = ['bl', 'br', 'ch', 'cl', 'cr', 'dr', 'fl', 'fr', 'gh', 'gl', 'gr', 'ph', 'pl', 'pr', 'qu', 'sh', 'sk', 'sl', 'sm', 'sn', 'sp', 'st', 'sw', 'th', 'tr', 'tw', 'wh', 'wr'] split_t...
def pig_latin(text_input): final = '' couples = ['bl', 'br', 'ch', 'cl', 'cr', 'dr', 'fl', 'fr', 'gh', 'gl', 'gr', 'ph', 'pl', 'pr', 'qu', 'sh', 'sk', 'sl', 'sm', 'sn', 'sp', 'st', 'sw', 'th', 'tr', 'tw', 'wh', 'wr'] split_text = text_input.strip().lower().split() for i in range(len(split_text)): ...
lista = [1, 3, 5, 7] lista_animal = ['cachorro', 'gato', 'elefante'] print(lista) print(lista_animal[1]) #Resultado: gato for x in lista_animal: print(x)
lista = [1, 3, 5, 7] lista_animal = ['cachorro', 'gato', 'elefante'] print(lista) print(lista_animal[1]) for x in lista_animal: print(x)
def add(x, y): '''Add two given numbers together ''' return x+y def subtract(x, y): ''' function to substrct x from y and return the remaining value''' return y - x
def add(x, y): """Add two given numbers together """ return x + y def subtract(x, y): """ function to substrct x from y and return the remaining value""" return y - x
# https://leetcode.com/problems/verifying-an-alien-dictionary/ class Solution: def isAlienSorted(self, words: [str], order: str) -> bool: m = {} for i, o in enumerate(order): m[o] = i def is_sorted(w1, w2): for c1, c2 in zip(w1, w2): if ...
class Solution: def is_alien_sorted(self, words: [str], order: str) -> bool: m = {} for (i, o) in enumerate(order): m[o] = i def is_sorted(w1, w2): for (c1, c2) in zip(w1, w2): if m[c1] == m[c2]: continue return m[...
# Character Picture Grid Practice Project # Chapter 4 - Lists (Automate the Boring Stuff with Python) # Developer: Valeriy B. def picture_grid(grid): # Creating result list resulted_list = [] # Looping through grid columns for column in range(len(grid[0])): # Creating row string ...
def picture_grid(grid): resulted_list = [] for column in range(len(grid[0])): row_grid = '' for row in range(len(grid)): row_grid += grid[row][column] resulted_list.append(row_grid + '\n') print(''.join(resulted_list)[:-1]) grid = [['.', '.', '.', '.', '.', '.'], ['.', '0...
def index(query): query = query.strip("/") fd = open("css/" + query, "r") return fd.read()
def index(query): query = query.strip('/') fd = open('css/' + query, 'r') return fd.read()
""" Implementation of Array from the ground up. We have lists in python that compares to an array data structure and should be used instead of building an array data structure from scratch. """ class Array: # __init__ is a special method called whenever you try to make # an instance of a class. As you heard, ...
""" Implementation of Array from the ground up. We have lists in python that compares to an array data structure and should be used instead of building an array data structure from scratch. """ class Array: def __init__(self): self.length = 0 self.data = {} def __str__(self): return s...
""" Given a string s of lower and upper case English letters. A good string is a string which doesn't have two adjacent characters s[i] and s[i + 1] where: - 0 <= i <= s.length - 2 - s[i] is a lower-case letter and s[i + 1] is the same letter but in upper-case or vice-versa. ...
""" Given a string s of lower and upper case English letters. A good string is a string which doesn't have two adjacent characters s[i] and s[i + 1] where: - 0 <= i <= s.length - 2 - s[i] is a lower-case letter and s[i + 1] is the same letter but in upper-case or vice-versa. ...
"""A number of dictionaries that map IDs to a label. """ # Maps Device EUI to a Label dev_lbls = dict( A81758FFFE0523DB = 'Tyler ELT-Lite 23DB', A81758FFFE05368E = '122 N Bliss', A81758FFFE05368F = '122 N Bliss Unit', A81758FFFE05569F = '3414 E 16th', A81758FFFE0556A0 = '3424 E 18th', A81758FFF...
"""A number of dictionaries that map IDs to a label. """ dev_lbls = dict(A81758FFFE0523DB='Tyler ELT-Lite 23DB', A81758FFFE05368E='122 N Bliss', A81758FFFE05368F='122 N Bliss Unit', A81758FFFE05569F='3414 E 16th', A81758FFFE0556A0='3424 E 18th', A81758FFFE05569D='3148 E. 19th', A81758FFFE05569E='1826 Columbine', A81758...