content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
enum_ = ''' [COMMENT_LINE_IMPORTS] # System from enum import Enum [COMMENT_LINE] [COMMENT_LINE_CLASS_NAME] class [CLASS_NAME](Enum): [TAB]Template = 0 [COMMENT_LINE] '''.strip()
enum_ = '\n[COMMENT_LINE_IMPORTS]\n\n# System\nfrom enum import Enum\n\n[COMMENT_LINE]\n\n\n\n[COMMENT_LINE_CLASS_NAME]\n\nclass [CLASS_NAME](Enum):\n[TAB]Template = 0\n\n\n[COMMENT_LINE]\n'.strip()
phones = [ {"id": 6, "latitude": 40.1011685523957, "longitude": -88.2200390954902}, {"id": 7, "latitude": 40.0963186128832, "longitude": -88.2255865263258}, {"id": 8, "latitude": 40.1153308841568, "longitude": -88.223901994968}, ] def get_phones(): return phones bad_data = [ {"id": 6, "longitude...
phones = [{'id': 6, 'latitude': 40.1011685523957, 'longitude': -88.2200390954902}, {'id': 7, 'latitude': 40.0963186128832, 'longitude': -88.2255865263258}, {'id': 8, 'latitude': 40.1153308841568, 'longitude': -88.223901994968}] def get_phones(): return phones bad_data = [{'id': 6, 'longitude': -88.2200390954902}, ...
ies = [] ies.append({ "iei" : "2C", "value" : "IMEISV", "type" : "5G mobile identity", "reference" : "9.10.3.4", "presence" : "O", "format" : "TLV", "length" : "11"}) ies.append({ "iei" : "7D", "value" : "NAS message container", "type" : "message container", "reference" : "9.10.3.31", "presence" : "O", "format" : "TLV-...
ies = [] ies.append({'iei': '2C', 'value': 'IMEISV', 'type': '5G mobile identity', 'reference': '9.10.3.4', 'presence': 'O', 'format': 'TLV', 'length': '11'}) ies.append({'iei': '7D', 'value': 'NAS message container', 'type': 'message container', 'reference': '9.10.3.31', 'presence': 'O', 'format': 'TLV-E', 'length': '...
# Write a program that reads an integer and displays, using asterisks, a filled and hol- # low square, placed next to each other. For example if the side length is 5, the pro gram # should display # ***** ***** # ***** * * # ***** * * # ***** * * # ***** ***** side = int(input("Ente...
side = int(input('Enter side length: ')) line_num = 1 dot_num = 1 for i in range(side): dot_num = 1 for i in range(side): print('*', end='') print(end=' ') for i in range(side): if lineNum == 1 or lineNum == side: print('*', end='') elif dotNum == 1 or dotNum == side:...
class Solution: def countBits(self, num: int) -> List[int]: result = [0] * (1 + num) for i in range(1, 1 + num): result[i] = result[i&(i - 1)] + 1 return result
class Solution: def count_bits(self, num: int) -> List[int]: result = [0] * (1 + num) for i in range(1, 1 + num): result[i] = result[i & i - 1] + 1 return result
# function to check if two strings are # anagram or not def anagram(s1, s2): # the sorted strings are checked if(sorted(s1)== sorted(s2)): print("The strings are anagrams.") else: print("The strings aren't anagrams.") #commonCharacterCount def commonC...
def anagram(s1, s2): if sorted(s1) == sorted(s2): print('The strings are anagrams.') else: print("The strings aren't anagrams.") def common_character_count(s1, s2): s = list(set(s1)) sum1 = 0 for i in s: sum1 += min(s1.count(i), s2.count(i)) return sum1 def is_bananagra...
# -*- coding: utf-8 -*- """ Created on Sun Feb 16 12:03:24 2020 @author: tsdj """
""" Created on Sun Feb 16 12:03:24 2020 @author: tsdj """
#!/usr/bin/env python # -*- coding: utf-8 -*- # Back of envelope calculations for a precious metals mining company try: oz_per_yr = int(input("How many ounces will be produced annually?: ")) price_per_oz = int(input("What is the estimated USD price per ounce for the year?: ")) aisc = int(input("What is t...
try: oz_per_yr = int(input('How many ounces will be produced annually?: ')) price_per_oz = int(input('What is the estimated USD price per ounce for the year?: ')) aisc = int(input('What is the USD AISC?: ')) exchange_rate = float(input('What is the USD/CAD exchange rate?: ')) shrs_out = int(input('H...
class MergeSort: def __init__(self,array): self.array = array def result(self): self.sort(0,len(self.array)-1) return self.array def sort(self,front,rear): if front>rear or front == rear: return mid = int((front+rear)/2) self.sort(front,mid) ...
class Mergesort: def __init__(self, array): self.array = array def result(self): self.sort(0, len(self.array) - 1) return self.array def sort(self, front, rear): if front > rear or front == rear: return mid = int((front + rear) / 2) self.sort(fr...
#!/usr/bin/python def find_max_palindrome(min=100,max=999): max_palindrome = 0 a = 999 while a > 99: b = 999 while b >= a: prod = a*b if prod > max_palindrome and str(prod)==(str(prod)[::-1]): max_palindrome = prod b -= 1 a -= 1 ...
def find_max_palindrome(min=100, max=999): max_palindrome = 0 a = 999 while a > 99: b = 999 while b >= a: prod = a * b if prod > max_palindrome and str(prod) == str(prod)[::-1]: max_palindrome = prod b -= 1 a -= 1 return max_pal...
def write(): systemInfo_file = open("writeTest.txt", "a") systemInfo_file.write("\nTEST DATA2") systemInfo_file.close()
def write(): system_info_file = open('writeTest.txt', 'a') systemInfo_file.write('\nTEST DATA2') systemInfo_file.close()
# Problem Statement: https://www.hackerrank.com/challenges/exceptions/problem for _ in range(int(input())): try: a, b = map(int, input().split()) print(a // b) except (ZeroDivisionError, ValueError) as e: print(f'Error Code: {e}')
for _ in range(int(input())): try: (a, b) = map(int, input().split()) print(a // b) except (ZeroDivisionError, ValueError) as e: print(f'Error Code: {e}')
""" Support for local Luftdaten sensors. Copyright (c) 2020 Mario Villavecchia Licensed under MIT. All rights reserved. https://github.com/lichtteil/local_luftdaten/ Support for Ecocity Airhome sensors. AQI sensor Mykhailo G """
""" Support for local Luftdaten sensors. Copyright (c) 2020 Mario Villavecchia Licensed under MIT. All rights reserved. https://github.com/lichtteil/local_luftdaten/ Support for Ecocity Airhome sensors. AQI sensor Mykhailo G """
class ApplicationException(Exception): """Base Exception class for all exceptions across the application""" def __init__(self, err_code: int, err_msg: str) -> None: super(ApplicationException, self).__init__(err_code, err_msg) self.err_code = err_code self.err_msg = err_msg def __s...
class Applicationexception(Exception): """Base Exception class for all exceptions across the application""" def __init__(self, err_code: int, err_msg: str) -> None: super(ApplicationException, self).__init__(err_code, err_msg) self.err_code = err_code self.err_msg = err_msg def __s...
class BaseContext(dict): """ warning: This is a singletone object. Don't create a instance of this object directly """ context_obj: 'BaseContext' = None initial_data: dict = { } def initialize(self): """ Initializes the context with default data """ self.update(self.initia...
class Basecontext(dict): """ warning: This is a singletone object. Don't create a instance of this object directly """ context_obj: 'BaseContext' = None initial_data: dict = {} def initialize(self): """ Initializes the context with default data """ self.update(self.initial_data...
class Location: __slots__ = 'name', '_longitude', '_latitude' def __init__(self, name, longitude, latitude): self._longitude = longitude self._latitude = latitude self.name = name @property def longitude(self): return self._longitude @property d...
class Location: __slots__ = ('name', '_longitude', '_latitude') def __init__(self, name, longitude, latitude): self._longitude = longitude self._latitude = latitude self.name = name @property def longitude(self): return self._longitude @property def latitude(se...
class Solution: def longestConsecutive(self, nums: List[int]) -> int: if not nums: return 0 nums.sort() count = 1 longest_streak = [] for index, value in enumerate(nums): if index + 1 >= len(nums): break if nums[index + 1]...
class Solution: def longest_consecutive(self, nums: List[int]) -> int: if not nums: return 0 nums.sort() count = 1 longest_streak = [] for (index, value) in enumerate(nums): if index + 1 >= len(nums): break if nums[index + ...
jobs = {} class JobInfo(object): def __init__(self, jobId): self.jobId = jobId self.data = None self.handlers = []
jobs = {} class Jobinfo(object): def __init__(self, jobId): self.jobId = jobId self.data = None self.handlers = []
#!/usr/bin/env python3 # ---------------------------------------------------------------------------- # Copyright (c) 2020--, Qiyun Zhu. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------...
"""Functions for parsing alignment / mapping files. Notes ----- A parser function operates on a single line in the input file. A parser function returns a tuple of: str : query Id str : subject Id float : alignment score, optional int : alignment length, optional start : alignment start (5') coordi...
print(list(enumerate([]))) print(list(enumerate([1, 2, 3]))) print(list(enumerate([1, 2, 3], 5))) print(list(enumerate([1, 2, 3], -5))) print(list(enumerate(range(10000))))
print(list(enumerate([]))) print(list(enumerate([1, 2, 3]))) print(list(enumerate([1, 2, 3], 5))) print(list(enumerate([1, 2, 3], -5))) print(list(enumerate(range(10000))))
class Latex: def __init__(self, ssh): """ latex """ self.bash = ssh.bash # https://github.com/James-Yu/LaTeX-Workshop/wiki/Compile#latex-recipe #pdflatex -> bibtex -> pdflatex X 2 # Recipe step 1 # def compile(self, path, src, params): try: ...
class Latex: def __init__(self, ssh): """ latex """ self.bash = ssh.bash def compile(self, path, src, params): try: r = self.bash.run('cd {} && latexmk {} -synctex=1 -interaction=nonstopmode -file-line-error {}.tex -outdir="."'.format(path, params, src))...
programming_dictonary = { "Bug":"An error in program that prevents the program running as expected", "Function":"A piece of code that you can call over and over again", } # Retreive print(programming_dictonary["Bug"]) # Adding items programming_dictonary["Loop"] = "The action of doing something again and again...
programming_dictonary = {'Bug': 'An error in program that prevents the program running as expected', 'Function': 'A piece of code that you can call over and over again'} print(programming_dictonary['Bug']) programming_dictonary['Loop'] = 'The action of doing something again and again' empty_list = [] empty_dictonary = ...
# ========== base graph node class / generic knowledge representation (AST/ASG) class Object(): # node constructor with scalar initializer def __init__(self, V): # node class/type tag self.type = self.__class__.__name__.lower() # node name / scalar value self.value = V ...
class Object: def __init__(self, V): self.type = self.__class__.__name__.lower() self.value = V self.slot = {} self.nest = [] def __repr__(self): return self.dump() def test(self): return self.dump(test=True) def dump(self, cycle=[], depth=0, prefix=''...
""" Samples below are intended to get us started with Python. Did you notice this is a multi-line comment :-) and yes being the first one and before code, it qualifies to be documentation as well. How Cool!!! In order to be a docstring it had to be multi-line """ # print hello world :-), Hey this is a single line com...
""" Samples below are intended to get us started with Python. Did you notice this is a multi-line comment :-) and yes being the first one and before code, it qualifies to be documentation as well. How Cool!!! In order to be a docstring it had to be multi-line """ print('Hello, World') '\nWe can define strings using \'...
class PiecewiseError(Exception): """Base error class for framework.""" def __init__(self, message=""): self._message = message def __str__(self): return self._message class InternalError(PiecewiseError): """Error indicating internal bug or logical flaw, not meant to be raised unde...
class Piecewiseerror(Exception): """Base error class for framework.""" def __init__(self, message=''): self._message = message def __str__(self): return self._message class Internalerror(PiecewiseError): """Error indicating internal bug or logical flaw, not meant to be raised unde...
# Python - 3.6.0 def tickets(people): moneys = {k: 0 for k in [25, 50, 100]} for cost in people: if cost == 50: if moneys[25] < 1: return 'NO' moneys[25] -= 1 elif cost == 100: if moneys[50] >= 1: if moneys[25] < 1: ...
def tickets(people): moneys = {k: 0 for k in [25, 50, 100]} for cost in people: if cost == 50: if moneys[25] < 1: return 'NO' moneys[25] -= 1 elif cost == 100: if moneys[50] >= 1: if moneys[25] < 1: return 'N...
class Error(Exception): """Generic error class for invalid wordnet operations.""" # reset the module so the user sees the public name __module__ = 'wn' class Warning(Warning): """Generic warning class for dubious worndet operations.""" # reset the module so the user sees the public name __m...
class Error(Exception): """Generic error class for invalid wordnet operations.""" __module__ = 'wn' class Warning(Warning): """Generic warning class for dubious worndet operations.""" __module__ = 'wn'
def calculate_age(year_of_birth: int, current_year: int) -> str: """Year report depending on year of birth and current year.""" def year_str(y:int) -> str: return "1 year" if y == 1 else str(y)+" years" delta = current_year - year_of_birth if delta == 0: return "You were born this very y...
def calculate_age(year_of_birth: int, current_year: int) -> str: """Year report depending on year of birth and current year.""" def year_str(y: int) -> str: return '1 year' if y == 1 else str(y) + ' years' delta = current_year - year_of_birth if delta == 0: return 'You were born this ve...
LANGS = ["hi,my,fa,tk,vi,zh,ka,zh_yue,hy,ru", "hi,my,fa,vi,zh,tk,zh_yue,ru,bxr,cdo", "hi,my,fa,vi,tk,jv,zh_yue,id,zh,am", "is,en,se,et,fi,fr,kv,cs,de,eu", "et,lv,fi,en,se,cs,de,fr,is,hu", "cs,en,de,fr,lv,et,hu,fi,la,eu", "lv,et,cs,hu,de,el,fi,myv,mhr,tr", "hu,el,cs,de,lv,tr,la,et,xmf,myv", "el,hu,tr,la,cs,de,xmf,lv,hy,...
langs = ['hi,my,fa,tk,vi,zh,ka,zh_yue,hy,ru', 'hi,my,fa,vi,zh,tk,zh_yue,ru,bxr,cdo', 'hi,my,fa,vi,tk,jv,zh_yue,id,zh,am', 'is,en,se,et,fi,fr,kv,cs,de,eu', 'et,lv,fi,en,se,cs,de,fr,is,hu', 'cs,en,de,fr,lv,et,hu,fi,la,eu', 'lv,et,cs,hu,de,el,fi,myv,mhr,tr', 'hu,el,cs,de,lv,tr,la,et,xmf,myv', 'el,hu,tr,la,cs,de,xmf,lv,hy,...
class Solution(object): def mySqrt(self, x): """ :type x: int :rtype: int """ left = 0 right = x while left <= right: middle = (left + right) / 2 sqrt = middle * middle if x == sqrt: return middle ...
class Solution(object): def my_sqrt(self, x): """ :type x: int :rtype: int """ left = 0 right = x while left <= right: middle = (left + right) / 2 sqrt = middle * middle if x == sqrt: return middle ...
a = [-11, -2, -4, -10, -9, 4, -5, -18, -16, 5, -6, -19, 0, -7, 11, -17, 11, 9, -7, -11, 19, -16, -11, -4, 19, -6, -6, -15, 1, 11, -1, -16, 12, 0, -15, -13, 11, -19, -15, -18, -20, 7, -8, 17, -4, 16, 6, -5, -3, -8, 17, -2, 2, 1, -2, 19, -6, 13, -7, -8, 9, -13, 4, -19, -4, 20, 20, -10, 9, 13, 18, 15, -15, -16, 20, 15, 1...
a = [-11, -2, -4, -10, -9, 4, -5, -18, -16, 5, -6, -19, 0, -7, 11, -17, 11, 9, -7, -11, 19, -16, -11, -4, 19, -6, -6, -15, 1, 11, -1, -16, 12, 0, -15, -13, 11, -19, -15, -18, -20, 7, -8, 17, -4, 16, 6, -5, -3, -8, 17, -2, 2, 1, -2, 19, -6, 13, -7, -8, 9, -13, 4, -19, -4, 20, 20, -10, 9, 13, 18, 15, -15, -16, 20, 15, 19...
BASE_STATS = { 1: { "Monster": {"HP": 7, "Attack": 5, "Defence": 5, "Scaling": 0.05}, "Player": {"HP": 5, "Attack": 2, "Defence": 2}, }, 30: { "Monster": {"HP": 15, "Attack": 10, "Defence": 10, "Scaling": 0.1}, "Player": {"HP": 9, "Attack": 6, "Defence": 5}, }, 60: { ...
base_stats = {1: {'Monster': {'HP': 7, 'Attack': 5, 'Defence': 5, 'Scaling': 0.05}, 'Player': {'HP': 5, 'Attack': 2, 'Defence': 2}}, 30: {'Monster': {'HP': 15, 'Attack': 10, 'Defence': 10, 'Scaling': 0.1}, 'Player': {'HP': 9, 'Attack': 6, 'Defence': 5}}, 60: {'Monster': {'HP': 37, 'Attack': 20, 'Defence': 20, 'Scaling'...
class Solution: def rotate(self, matrix: List[List[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ ''' T: O(m * n) and S: O(1) ''' if not matrix: return n = len(matrix) i, j = 0, n - 1 while i < ...
class Solution: def rotate(self, matrix: List[List[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ '\n T: O(m * n) and S: O(1)\n ' if not matrix: return n = len(matrix) (i, j) = (0, n - 1) whil...
# Atharv Kolhar # Python Bytes """ Questions: 1. Create a Set of even numbers up to 20. 2. Create another list of number multiple of 3 up to 30 3. Find Intersection, Union, and Difference between the above two sets 4. Declare an Empty set and add the first 4 prime numbers to it. """
""" Questions: 1. Create a Set of even numbers up to 20. 2. Create another list of number multiple of 3 up to 30 3. Find Intersection, Union, and Difference between the above two sets 4. Declare an Empty set and add the first 4 prime numbers to it. """
# Sum vs XOR # https://www.hackerrank.com/challenges/sum-vs-xor/problem def sumXor(n): if n == 0: return 1 return 1 << f'{n:b}'.count('0') n = int(input().strip()) result = sumXor(n) print (result)
def sum_xor(n): if n == 0: return 1 return 1 << f'{n:b}'.count('0') n = int(input().strip()) result = sum_xor(n) print(result)
################################################################## # Mocked returns for patched functions that access web resources # ################################################################## GET_POLICE_STATION_API_MOCK = { "displayFieldName": "NAME", "fieldAliases": { "OBJECTID": "OBJECTID",...
get_police_station_api_mock = {'displayFieldName': 'NAME', 'fieldAliases': {'OBJECTID': 'OBJECTID', 'FACILITYID': 'Facility Identifier', 'NAME': 'Name of Facility', 'OWNER': 'Owner Name', 'OWNTYPE': 'Owner Type', 'SUBTYPEFIELD': 'Subtype Field', 'FEATURECODE': 'Feature Code', 'FULLADDR': 'Full Address', 'AGENCYURL': 'W...
#https://www.hackerrank.com/contests/w35/challenges/lucky-purchase/problem books= {} ; n= int(input()) ; for a0 in range(n): string = input().split() ; books[string[0]] = string[1] ; books = list(books.items()) ; mini = books[0] ; for pair in books: if pair[1].count('7')+pair[1].count('4')!=len(pair[1]):...
books = {} n = int(input()) for a0 in range(n): string = input().split() books[string[0]] = string[1] books = list(books.items()) mini = books[0] for pair in books: if pair[1].count('7') + pair[1].count('4') != len(pair[1]): continue if pair[1].count('7') == pair[1].count('4'): if int(pa...
n = int(input("_gram? - ")) s = input("words: ") grams = [] for i in range(len(s)): op = "" for x in range(i, i + n): if x >= len(s): op = "" break op += s[x] if op != "": grams.append(op) print(op) grams.sort() print(grams)
n = int(input('_gram? - ')) s = input('words: ') grams = [] for i in range(len(s)): op = '' for x in range(i, i + n): if x >= len(s): op = '' break op += s[x] if op != '': grams.append(op) print(op) grams.sort() print(grams)
VERSION = '0.1.6b0' ENV_LIST = ['clustering-v0', 'clustering-v1', 'clustering-v2', 'clustering-v3', 'classification-v0']
version = '0.1.6b0' env_list = ['clustering-v0', 'clustering-v1', 'clustering-v2', 'clustering-v3', 'classification-v0']
# Solution A # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def reverseList(self, head: ListNode) -> ListNode: prev = None cur = head while cur: tmp = cur.next ...
class Solution: def reverse_list(self, head: ListNode) -> ListNode: prev = None cur = head while cur: tmp = cur.next cur.next = prev prev = cur cur = tmp return prev class Solution: def reverse_list(self, head: ListNode) -> ListN...
a=[2, 3, 5, 7] print(a) a.reverse() print(a)
a = [2, 3, 5, 7] print(a) a.reverse() print(a)
# Copyright (C) 2018 O.S. Systems Software LTDA. """ This is the updatehub agent package SDK for the Python language. With this package it's possible to access information about a running updatehub agent, such as current states, log information and also force a new version probe. For more information please access htt...
""" This is the updatehub agent package SDK for the Python language. With this package it's possible to access information about a running updatehub agent, such as current states, log information and also force a new version probe. For more information please access http://docs.updatehub.io/ """ __version__ = '2.0.0' ...
def binarySearch(arr, x, left, right): if right <= left: if right + 1 <= len(arr): return right + 1 return -1 mid = (left + right) // 2 if x <= arr[mid]: return binarySearch(arr, x, left, mid) else: return binarySearch(arr, x, mid + 1, right) def read_input(...
def binary_search(arr, x, left, right): if right <= left: if right + 1 <= len(arr): return right + 1 return -1 mid = (left + right) // 2 if x <= arr[mid]: return binary_search(arr, x, left, mid) else: return binary_search(arr, x, mid + 1, right) def read_inpu...
river = { 'nile': 'egypt', 'huang': 'china', 'mississippi':'USA' } for key, value in river.items(): print("The " + key + "runs through " + value +".") for name in (river.keys()): print(name) for country in (river.values()): print(country)
river = {'nile': 'egypt', 'huang': 'china', 'mississippi': 'USA'} for (key, value) in river.items(): print('The ' + key + 'runs through ' + value + '.') for name in river.keys(): print(name) for country in river.values(): print(country)
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ This package provides the packages and modules to perform IO from various input file formats and pymatgen objects. """
""" This package provides the packages and modules to perform IO from various input file formats and pymatgen objects. """
# (C) Datadog, Inc. 2022-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) __version__ = '1.1.0'
__version__ = '1.1.0'
def printList(): li=list() for i in range(1,21): li.append(i**2) print(li) printList()
def print_list(): li = list() for i in range(1, 21): li.append(i ** 2) print(li) print_list()
def count_substring(string, sub_string): res = 0 len_sub = len(sub_string) for i in range(len(string) - len_sub + 1): if string[i:i + len_sub] == sub_string: res += 1 i += 1 return res
def count_substring(string, sub_string): res = 0 len_sub = len(sub_string) for i in range(len(string) - len_sub + 1): if string[i:i + len_sub] == sub_string: res += 1 i += 1 return res
class shell_colors(object): """ Short hand for shell colors """ magenta = "\033[95m" cyan = "\033[94m" green = "\033[92m" warn = "\033[93m" err = "\033[91m" end = "\033[0m" bold = "\033[1m" undeline = "\033[4m"
class Shell_Colors(object): """ Short hand for shell colors """ magenta = '\x1b[95m' cyan = '\x1b[94m' green = '\x1b[92m' warn = '\x1b[93m' err = '\x1b[91m' end = '\x1b[0m' bold = '\x1b[1m' undeline = '\x1b[4m'
name = "hyperparameter" """ The hyperparameter module """
name = 'hyperparameter' '\nThe hyperparameter module\n'
"""19_sum_of_squares_of_first_n_natural_numbers.py.""" print("---- Sum of Squares of first n Natural numbers ----") print("TODO")
"""19_sum_of_squares_of_first_n_natural_numbers.py.""" print('---- Sum of Squares of first n Natural numbers ----') print('TODO')
_base_="../base-ucmerced-config-simpleaug.py" # this will merge with the parent model=dict(pretrained='data/basetrain_chkpts/moco_v2_800ep.pth') # epoch related total_iters=5000 checkpoint_config = dict(interval=total_iters) model = dict( pretrained='data/basetrain_chkpts/moco_v2_800ep.pth', backbone=dict( n...
_base_ = '../base-ucmerced-config-simpleaug.py' model = dict(pretrained='data/basetrain_chkpts/moco_v2_800ep.pth') total_iters = 5000 checkpoint_config = dict(interval=total_iters) model = dict(pretrained='data/basetrain_chkpts/moco_v2_800ep.pth', backbone=dict(norm_train=True, frozen_stages=4)) optimizer = dict(type='...
def finferensi(berat, pinjam, harga): linguistik = [] derajat = [] for bk, bv in berat.items(): for pk, pv in pinjam.items(): for hk, hv in harga.items(): # rule 1 if bk == 'ringan' and pk == 'sebentar' and hk == 'rendah': lingui...
def finferensi(berat, pinjam, harga): linguistik = [] derajat = [] for (bk, bv) in berat.items(): for (pk, pv) in pinjam.items(): for (hk, hv) in harga.items(): if bk == 'ringan' and pk == 'sebentar' and (hk == 'rendah'): linguistik.append('kecil') ...
# Booknames.py class Booknames: def usfmBookId(self, bookName): books = { 'Genesis': 'GEN', 'Exodus': 'EXO', 'Leviticus': 'LEV', 'Numbers': 'NUM', 'Deuteronomy': 'DEU', 'Joshua': 'JOS', 'Judges': 'JDG', 'Ruth': 'RUT', '1Samuel': '1SA', '2Samuel': '2SA', '1...
class Booknames: def usfm_book_id(self, bookName): books = {'Genesis': 'GEN', 'Exodus': 'EXO', 'Leviticus': 'LEV', 'Numbers': 'NUM', 'Deuteronomy': 'DEU', 'Joshua': 'JOS', 'Judges': 'JDG', 'Ruth': 'RUT', '1Samuel': '1SA', '2Samuel': '2SA', '1Kings': '1KI', '2Kings': '2KI', '1Chronicles': '1CH', '2Chronicle...
class Blocktype(basestring): """ 32-bit|64-bit Possible values: <ul> <li> "32_bit" , <li> "64_bit" </ul> """ @staticmethod def get_api_name(): return "blocktype"
class Blocktype(basestring): """ 32-bit|64-bit Possible values: <ul> <li> "32_bit" , <li> "64_bit" </ul> """ @staticmethod def get_api_name(): return 'blocktype'
# pylint: disable=missing-function-docstring, missing-module-docstring/ a = 4 a += 5.0
a = 4 a += 5.0
# encoding: utf-8 class FastCGIError(Exception): pass # Values for type component of FCGI_Header FCGI_BEGIN_REQUEST = 1 FCGI_ABORT_REQUEST = 2 FCGI_END_REQUEST = 3 FCGI_PARAMS = 4 FCGI_STDIN = 5 FCGI_STDOUT = 6 FCGI_STDERR = 7 FCGI_DATA = 8 FCGI_GET_VALUES = 9 F...
class Fastcgierror(Exception): pass fcgi_begin_request = 1 fcgi_abort_request = 2 fcgi_end_request = 3 fcgi_params = 4 fcgi_stdin = 5 fcgi_stdout = 6 fcgi_stderr = 7 fcgi_data = 8 fcgi_get_values = 9 fcgi_get_values_result = 10 fcgi_unknown_type = 11 type_names = {FCGI_BEGIN_REQUEST: 'fcgi_begin_request', FCGI_ABOR...
match x: case Class( ): pass case Class( foo=1 ): pass case Class( foo=1, bar=2 ): pass case Class( foo=1, bar=2, ): pass
match x: case Class(): pass case Class(foo=1): pass case Class(foo=1, bar=2): pass case Class(foo=1, bar=2): pass
def deep_flatten(in_list): out_list = [] for i in in_list: if type(i) == str: out_list.append(i) elif hasattr(i,'__iter__'): out_list.extend(deep_flatten(i)) else: out_list.append(i) return out_list a = [(1,2),3,4,5,[4,4,5,6]] a = [['cats', ['car...
def deep_flatten(in_list): out_list = [] for i in in_list: if type(i) == str: out_list.append(i) elif hasattr(i, '__iter__'): out_list.extend(deep_flatten(i)) else: out_list.append(i) return out_list a = [(1, 2), 3, 4, 5, [4, 4, 5, 6]] a = [['cats'...
"""Arcs BUILD rules.""" load( "//third_party/bazel_rules/rules_kotlin/kotlin/js:js_library.bzl", _kt_js_library = "kt_js_library", ) load( "//third_party/java/arcs/build_defs/internal:kotlin.bzl", _arcs_kt_android_library = "arcs_kt_android_library", _arcs_kt_android_test_suite = "arcs_kt_android_t...
"""Arcs BUILD rules.""" load('//third_party/bazel_rules/rules_kotlin/kotlin/js:js_library.bzl', _kt_js_library='kt_js_library') load('//third_party/java/arcs/build_defs/internal:kotlin.bzl', _arcs_kt_android_library='arcs_kt_android_library', _arcs_kt_android_test_suite='arcs_kt_android_test_suite', _arcs_kt_js_library...
""" This file is just for exporting stuffs :) """ def my_decorator(f): return f @my_decorator def exported_func(abc: str, b: str = ", World!") -> str: """This is the docstring from an exported function :param abc: Describing cool parameter `abc` """ return abc + b class ExportedClass: ...
""" This file is just for exporting stuffs :) """ def my_decorator(f): return f @my_decorator def exported_func(abc: str, b: str=', World!') -> str: """This is the docstring from an exported function :param abc: Describing cool parameter `abc` """ return abc + b class Exportedclass: ...
# Default constants DF_ADSB = 17 LAT_REF = 44.807047 # TODO put reference values LONG_REF = -0.605526 NZ=15 # Default variables fe=20*10**6; Te=1/fe Ds=1*10**6; Ts=1/Ds Fse=int(round(Ts/Te)) Ns=112 # Number of points of the signal : 1000, 112 Nfft=512 # Number of points of FFT # Default TEB parameters SIG_NB_ERROR...
df_adsb = 17 lat_ref = 44.807047 long_ref = -0.605526 nz = 15 fe = 20 * 10 ** 6 te = 1 / fe ds = 1 * 10 ** 6 ts = 1 / Ds fse = int(round(Ts / Te)) ns = 112 nfft = 512 sig_nb_error = 100 max_count = 500 nteb = 11 tp = 8 * 10 ** (-6) fpe = int(round(Tp / Te)) def init_ref(lat_ref, long_ref): lat_ref = lat_ref lo...
# names of hurricanes names = ['Cuba I', 'San Felipe II Okeechobee', 'Bahamas', 'Cuba II', 'CubaBrownsville', 'Tampico', 'Labor Day', 'New England', 'Carol', 'Janet', 'Carla', 'Hattie', 'Beulah', 'Camille', 'Edith', 'Anita', 'David', 'Allen', 'Gilbert', 'Hugo', 'Andrew', 'Mitch', 'Isabel', 'Ivan', 'Emily', 'Katrina', ...
names = ['Cuba I', 'San Felipe II Okeechobee', 'Bahamas', 'Cuba II', 'CubaBrownsville', 'Tampico', 'Labor Day', 'New England', 'Carol', 'Janet', 'Carla', 'Hattie', 'Beulah', 'Camille', 'Edith', 'Anita', 'David', 'Allen', 'Gilbert', 'Hugo', 'Andrew', 'Mitch', 'Isabel', 'Ivan', 'Emily', 'Katrina', 'Rita', 'Wilma', 'Dean'...
alien_0 = {'color': 'green', 'points': 5} alien_1 = {'color': 'yellow', 'points': 10} alien_2 = {'color': 'red', 'points': 15} aliens = [alien_0, alien_1, alien_2] for alien in aliens: print(alien) print('...') aliens = [] for alien_number in range(30): new_alien = {'color': 'green', 'points': 5, 'speed': '...
alien_0 = {'color': 'green', 'points': 5} alien_1 = {'color': 'yellow', 'points': 10} alien_2 = {'color': 'red', 'points': 15} aliens = [alien_0, alien_1, alien_2] for alien in aliens: print(alien) print('...') aliens = [] for alien_number in range(30): new_alien = {'color': 'green', 'points': 5, 'speed': 'slow...
#!/usr/bin/env python3 with open("day-1/data") as f: expenses = f.readlines() founditems = [] def accounting(i): for j in expenses: j = int(j.strip('\n')) for x in expenses: x = int(x.strip('\n')) if i + j + x == 2020 and i * j * x not in founditems: pri...
with open('day-1/data') as f: expenses = f.readlines() founditems = [] def accounting(i): for j in expenses: j = int(j.strip('\n')) for x in expenses: x = int(x.strip('\n')) if i + j + x == 2020 and i * j * x not in founditems: print('3-sum: ' + str(i * j...
class Command(object): CONTINUE = 1 SKIP_REMAINING = 2 def __init__(self, args=None, explicit=False): self.explicit = explicit self._args = args or [] @property def args(self): return self._args def add_argument(self, arg): self._args.append(arg) def cmdli...
class Command(object): continue = 1 skip_remaining = 2 def __init__(self, args=None, explicit=False): self.explicit = explicit self._args = args or [] @property def args(self): return self._args def add_argument(self, arg): self._args.append(arg) def cmdli...
# -*- coding: utf-8 -*- """ Created on Mar 23 11:57 2017 @author: Denis Tome' """ __all__ = [ 'VISIBLE_PART', 'MIN_NUM_JOINTS', 'CENTER_TR', 'SIGMA', 'STRIDE', 'SIGMA_CENTER', 'INPUT_SIZE', 'OUTPUT_SIZE', 'NUM_JOINTS', 'NUM_OUTPUT', 'H36M_NUM_JOINTS', 'JOINT_DRAW_SIZE',...
""" Created on Mar 23 11:57 2017 @author: Denis Tome' """ __all__ = ['VISIBLE_PART', 'MIN_NUM_JOINTS', 'CENTER_TR', 'SIGMA', 'STRIDE', 'SIGMA_CENTER', 'INPUT_SIZE', 'OUTPUT_SIZE', 'NUM_JOINTS', 'NUM_OUTPUT', 'H36M_NUM_JOINTS', 'JOINT_DRAW_SIZE', 'LIMB_DRAW_SIZE'] visible_part = 0.001 min_num_joints = 5 center_tr = 0.4...
class SGD: """ Implements vanilla SGD update """ def update(self, w, d_w, learning_rate): """ Performs SGD update Arguments: w, np array - weights d_w, np array, same shape as w - gradient learning_rate, float - learning rate Returns: up...
class Sgd: """ Implements vanilla SGD update """ def update(self, w, d_w, learning_rate): """ Performs SGD update Arguments: w, np array - weights d_w, np array, same shape as w - gradient learning_rate, float - learning rate Returns: up...
Desc = cellDescClass("DFFNSRX4") Desc.properties["cell_footprint"] = "dffnsr" Desc.properties["area"] = "116.424000" Desc.properties["cell_leakage_power"] = "3723.759540" Desc.pinOrder = ['CKN', 'D', 'IQ', 'IQN', 'Q', 'QN', 'RN', 'SN', 'next'] Desc.add_arc("CKN","D","setup_falling") Desc.add_arc("CKN","D","hold_falling...
desc = cell_desc_class('DFFNSRX4') Desc.properties['cell_footprint'] = 'dffnsr' Desc.properties['area'] = '116.424000' Desc.properties['cell_leakage_power'] = '3723.759540' Desc.pinOrder = ['CKN', 'D', 'IQ', 'IQN', 'Q', 'QN', 'RN', 'SN', 'next'] Desc.add_arc('CKN', 'D', 'setup_falling') Desc.add_arc('CKN', 'D', 'hold_f...
class AbstractProvider(object): """Delegate class to provide requirement interface for the resolver.""" def identify(self, requirement_or_candidate): """Given a requirement, return an identifier for it. This is used to identify a requirement, e.g. whether two requirements should...
class Abstractprovider(object): """Delegate class to provide requirement interface for the resolver.""" def identify(self, requirement_or_candidate): """Given a requirement, return an identifier for it. This is used to identify a requirement, e.g. whether two requirements should have t...
def _is_socket(path): # -S if not path: return False if hasattr(path, '_mode'): return stat.S_ISSOCK(path._mode) if hasattr(path, 'fileno') and os.stat in os.supports_fd: path = path.fileno() elif hasattr(path, 'name'): path = path.name return stat.S...
def _is_socket(path): if not path: return False if hasattr(path, '_mode'): return stat.S_ISSOCK(path._mode) if hasattr(path, 'fileno') and os.stat in os.supports_fd: path = path.fileno() elif hasattr(path, 'name'): path = path.name return stat.S_ISSOCK(os.stat(path).s...
""" This package contains both data models related to points of interest (POIs): :class:`~cms.models.pois.poi.POI` and :class:`~cms.models.pois.poi_translation.POITranslation`. POIs can be used to store information which is relevant for one specific location, e.g. a place where local authorities offer a public service....
""" This package contains both data models related to points of interest (POIs): :class:`~cms.models.pois.poi.POI` and :class:`~cms.models.pois.poi_translation.POITranslation`. POIs can be used to store information which is relevant for one specific location, e.g. a place where local authorities offer a public service....
#!/usr/bin/env python3 # Write a program that prints the reverse-complement of a DNA sequence # You must use a loop and conditional dna = 'ACTGAAAAAAAAAAA' anti = "" for i in range(len(dna)): if dna[i] == 'A': anti += 'T' elif dna[i] == 'T': anti += 'A' elif dna[i] == 'C': anti += 'G' else: anti ...
dna = 'ACTGAAAAAAAAAAA' anti = '' for i in range(len(dna)): if dna[i] == 'A': anti += 'T' elif dna[i] == 'T': anti += 'A' elif dna[i] == 'C': anti += 'G' else: anti += 'C' print(anti[::-1]) '\npython3 23anti.py\nTTTTTTTTTTTCAGT\n'
""" Write a modified version of the Matrix class(that was defined in one of the example problems in this section) with an __add__ operation as well as a __sub__ operation. It should add matrices, assuming that they will be of the same length. Also, the unmodified Matrix class code will be given. """ """ This is the un...
""" Write a modified version of the Matrix class(that was defined in one of the example problems in this section) with an __add__ operation as well as a __sub__ operation. It should add matrices, assuming that they will be of the same length. Also, the unmodified Matrix class code will be given. """ '\nThis is the unmo...
num1 = 10 num2 = int(input()) def add_sum(): sum = num1+num2 print(sum) add_sum()
num1 = 10 num2 = int(input()) def add_sum(): sum = num1 + num2 print(sum) add_sum()
class ConsoleCommandFailed(Exception): pass class ConvergeFailed(Exception): pass
class Consolecommandfailed(Exception): pass class Convergefailed(Exception): pass
class Overflow( Enum, CascadeProperty, ): Visible = "visible" # initial Hidden = "hidden" Scroll = "scroll" Auto = "auto"
class Overflow(Enum, CascadeProperty): visible = 'visible' hidden = 'hidden' scroll = 'scroll' auto = 'auto'
def Y_S(a): if a == 0: return 0 else: ys = (a//30) * 10 + 10 return ys def M_S(b): if b == 0: return 0 else: ms = (b//60) * 15 + 15 return ms N=int(input()) ms_add = 0 ys_add = 0 arr = list(map(int,input().split())) for i in arr: Y = Y_S(i) M = M_S...
def y_s(a): if a == 0: return 0 else: ys = a // 30 * 10 + 10 return ys def m_s(b): if b == 0: return 0 else: ms = b // 60 * 15 + 15 return ms n = int(input()) ms_add = 0 ys_add = 0 arr = list(map(int, input().split())) for i in arr: y = y_s(i) m =...
"""79. Word Search""" class Solution(object): def exist(self, board, word): """ :type board: List[List[str]] :type word: str :rtype: bool """ # R2: if not word: return True if not board: return False m = len(board) ...
"""79. Word Search""" class Solution(object): def exist(self, board, word): """ :type board: List[List[str]] :type word: str :rtype: bool """ if not word: return True if not board: return False m = len(board) n = len(b...
""" File: hailstone.py Name: ----------------------- This program should implement a console program that simulates the execution of the Hailstone sequence, defined by Douglas Hofstadter. Output format should match what is shown in the sample run in the Assignment 2 Handout. """ def main(): """ 1. judge wheth...
""" File: hailstone.py Name: ----------------------- This program should implement a console program that simulates the execution of the Hailstone sequence, defined by Douglas Hofstadter. Output format should match what is shown in the sample run in the Assignment 2 Handout. """ def main(): """ 1. judge whethe...
animals = ['bear', 'python3.8', 'peacock', 'kangaroo', 'whale', 'platypus'] print("The animal at 1: ", animals[1]) # Python3.8 print("The third animal: ", animals[2]) # Peacock print("The first animal: ", animals[0]) # bear print("The animal at 3: ", animals[3]) # kangaroo print("The fifth (5th) animal: ", animals...
animals = ['bear', 'python3.8', 'peacock', 'kangaroo', 'whale', 'platypus'] print('The animal at 1: ', animals[1]) print('The third animal: ', animals[2]) print('The first animal: ', animals[0]) print('The animal at 3: ', animals[3]) print('The fifth (5th) animal: ', animals[4]) print('The animal at 2: ', animals[2]) p...
####################### # Dennis MUD # # rename_item.py # # Copyright 2018-2020 # # Michael D. Reiley # ####################### # ********** # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal i...
name = 'rename item' categories = ['items'] usage = 'rename item <item_id> <new_name>' description = 'Set the name of the item <item_id> which you are holding to <new_name>.\n\nYou must own the item and it must be in your inventory in order to rename it.\nWizards can rename any item from anywhere.\n\nEx. `rename item 4...
class User: def __init__(self, reddit_id, username, karma, relevant_comments, relevant_posts): self.reddit_id = reddit_id self.username = username self.karma = karma self.score = 0 self.relevant_comments = relevant_comments self.relevant_posts = relevant_posts
class User: def __init__(self, reddit_id, username, karma, relevant_comments, relevant_posts): self.reddit_id = reddit_id self.username = username self.karma = karma self.score = 0 self.relevant_comments = relevant_comments self.relevant_posts = relevant_posts
# Mathematics > Algebra > Little Gaurav and Sequence # Help Gaurav in calculating last digit of a sequence. # # https://www.hackerrank.com/challenges/little-gaurav-and-sequence/problem # def S_brutforce(n): s = 0 i = 0 while 2 ** i <= n: for j in range(0, n + 1): s += 2 ** (2 ** i + 2 ...
def s_brutforce(n): s = 0 i = 0 while 2 ** i <= n: for j in range(0, n + 1): s += 2 ** (2 ** i + 2 * j) i += 1 return s def s(n): i = n k = 0 while i != 0: i //= 2 k += 1 if k == 1: s1 = 2 else: s1 = [6, 2, 8, 4, 0][(k - 2)...
"""The configuration class used for testing using no default values""" class TestConfig(object): # pylint: disable=too-few-public-methods """The configuration class used for testing using no default values""" AZURE_STORAGE_ACCOUNT = 'TestApplicationAccount' AZURE_STORAGE_KEY = 'TestApplicationKey' AZUR...
"""The configuration class used for testing using no default values""" class Testconfig(object): """The configuration class used for testing using no default values""" azure_storage_account = 'TestApplicationAccount' azure_storage_key = 'TestApplicationKey' azure_storage_table = 'TestApplicationTable' ...
# -*- coding: utf-8 -*- # # Copyright (C) 2020 CERN. # # invenio-app-ils is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """ILS minters.""" def pid_minter(record_uuid, data, provider_cls): """Generic ILS PID minter.""" provid...
"""ILS minters.""" def pid_minter(record_uuid, data, provider_cls): """Generic ILS PID minter.""" provider = provider_cls.create(object_type='rec', object_uuid=record_uuid) data['pid'] = provider.pid.pid_value return provider.pid def dummy_pid_minter(record_uuid, data): """Dummy minter.""" ret...
"""Global values for current session""" testdir = None settings = {}
"""Global values for current session""" testdir = None settings = {}
# Solution to Mega Contest 1 Problem: Maximum Sum for testcase in range(int(input())): n, k = map(int, input().split()) array_a = list(map(int, input().split())) array_b = list(map(int, input().split())) if k>0: array_a.sort() array_b.sort() # max_sum = sum(array_a[k:]+array_b[n...
for testcase in range(int(input())): (n, k) = map(int, input().split()) array_a = list(map(int, input().split())) array_b = list(map(int, input().split())) if k > 0: array_a.sort() array_b.sort() values = array_a[k:] for val in range(k): values.append(max(arra...
N = int(input()) V = list(map(int, input().split())) C = list(map(int, input().split())) result = 0 for i in range(N): if V[i] > C[i]: result += V[i] - C[i] print(result)
n = int(input()) v = list(map(int, input().split())) c = list(map(int, input().split())) result = 0 for i in range(N): if V[i] > C[i]: result += V[i] - C[i] print(result)
class Hair(object): def __init__(self, radius): self.radius = radius self.phi = random(TAU) self.slow = random(1.15, 1.2) self.theta = asin(random(-self.radius, self.radius) / self.radius) self.z = self.radius * sin(self.theta) def render(self): oFF = (noise(mill...
class Hair(object): def __init__(self, radius): self.radius = radius self.phi = random(TAU) self.slow = random(1.15, 1.2) self.theta = asin(random(-self.radius, self.radius) / self.radius) self.z = self.radius * sin(self.theta) def render(self): o_ff = (noise(mi...
with open("input.txt") as f: numbers = list(map(int, f.readline().split())) def parse_tree_metadata(tree): num_nodes = tree[0] num_metadata = tree[1] leafs = tree[2:] total = 0 for i in range(num_nodes): leafs, sum_metadata = parse_tree_metadata(leafs) total += sum_metadata ...
with open('input.txt') as f: numbers = list(map(int, f.readline().split())) def parse_tree_metadata(tree): num_nodes = tree[0] num_metadata = tree[1] leafs = tree[2:] total = 0 for i in range(num_nodes): (leafs, sum_metadata) = parse_tree_metadata(leafs) total += sum_metadata ...
class Dough: def __init__(self, flour_type, baking_technique, weight): self.__flour_type = flour_type self.__baking_technique = baking_technique self.__weight = weight @property def flour_type(self): return self.__flour_type @flour_type.setter def flour_type(self, ...
class Dough: def __init__(self, flour_type, baking_technique, weight): self.__flour_type = flour_type self.__baking_technique = baking_technique self.__weight = weight @property def flour_type(self): return self.__flour_type @flour_type.setter def flour_type(self, ...
""" Returns starting node of the cycle if cycle exists """ def has_cycle(head): fast = slow = head while fast and fast.next and fast.next.next: slow, fast = slow.next, fast.next.next if slow is fast: slow = head while slow is not fast: slow, fast = slow....
""" Returns starting node of the cycle if cycle exists """ def has_cycle(head): fast = slow = head while fast and fast.next and fast.next.next: (slow, fast) = (slow.next, fast.next.next) if slow is fast: slow = head while slow is not fast: (slow, fast) = ...
a, b = 10, 5 print("Add: a+b = ", a+b) print("Sub: a-b = ", a-b) print("Mul: a*b = ", a*b) print("Div: a/b = ", a/b) print("Mod: a%b = ", a%b) print("Exp: a**b = ", a**b) print("Floored Div: a//b = ", a//b)
(a, b) = (10, 5) print('Add: a+b = ', a + b) print('Sub: a-b = ', a - b) print('Mul: a*b = ', a * b) print('Div: a/b = ', a / b) print('Mod: a%b = ', a % b) print('Exp: a**b = ', a ** b) print('Floored Div: a//b = ', a // b)
''' 189. Rotate Array Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: [1,2,3,4,5,6,7] and k = 3 Output: [5,6,7,1,2,3,4] Explanation: rotate 1 steps to the right: [7,1,2,3,4,5,6] rotate 2 steps to the right: [6,7,1,2,3,4,5] rotate 3 steps to the right: [5,6,7,1,2,...
""" 189. Rotate Array Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: [1,2,3,4,5,6,7] and k = 3 Output: [5,6,7,1,2,3,4] Explanation: rotate 1 steps to the right: [7,1,2,3,4,5,6] rotate 2 steps to the right: [6,7,1,2,3,4,5] rotate 3 steps to the right: [5,6,7,1,2,3...
# Definition for a undirected graph node # class UndirectedGraphNode: # def __init__(self, x): # self.label = x # self.neighbors = [] class Solution: # @param node, a undirected graph node # @return a undirected graph node def cloneGraph(self, node): graph = {} visited =...
class Solution: def clone_graph(self, node): graph = {} visited = set() def dfs(node, visited, graph): if not node or node.label in visited: return visited |= {node.label} if node.label not in graph: graph[node.label] = un...
""" Base config file to provide global settings that should be overwritten with environment specific values. """ # Flask DEBUG = False TESTING = False CSRF_ENABLED = True SECRET_KEY = '' # SQL Alchemy SQLALCHEMY_DATABASE_URI = '' SQLALCHEMY_TRACK_MODIFICATIONS = False
""" Base config file to provide global settings that should be overwritten with environment specific values. """ debug = False testing = False csrf_enabled = True secret_key = '' sqlalchemy_database_uri = '' sqlalchemy_track_modifications = False
#Assignment 1 print("welcome to the Controlroom of Hyderabad ATC") Altitude = 1500 if Altitude <= 1000: print('youre safe to land') elif Altitude <=5000: print('Please Bring Down Altitude to 1000') else : print('it is Danger now to land, please Turn around') #Assignment2 for num in range(0,200): if num > 1: ...
print('welcome to the Controlroom of Hyderabad ATC') altitude = 1500 if Altitude <= 1000: print('youre safe to land') elif Altitude <= 5000: print('Please Bring Down Altitude to 1000') else: print('it is Danger now to land, please Turn around') for num in range(0, 200): if num > 1: for i in rang...
s="2 3 4 5 66 74 33 2 3" s=s.split() s = [int(x) for x in s] s1=[] for i in s: if i not in s1: s1.append(i) s1 = sorted(s1) print(s1) for i in s1: print(i,s.count(i))
s = '2 3 4 5 66 74 33 2 3' s = s.split() s = [int(x) for x in s] s1 = [] for i in s: if i not in s1: s1.append(i) s1 = sorted(s1) print(s1) for i in s1: print(i, s.count(i))
print('This is the dummy Controller') def dummy_example(): print('This is a function in the dummy Controller') if __name__ == '__main__': print('This is printed only from __main__') dummy_example()
print('This is the dummy Controller') def dummy_example(): print('This is a function in the dummy Controller') if __name__ == '__main__': print('This is printed only from __main__') dummy_example()