content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def main(): # input N = int(input()) Ss = [*map(int, input().split())] Ts = [*map(int, input().split())] # compute for i in range(2*N): Ts[(i+1)%N] = min(Ts[(i+1)%N], Ts[i%N]+Ss[i%N]) # output print(Ss) print(Ts) for ans in Ts: print(ans) if __name__ == '__mai...
def main(): n = int(input()) ss = [*map(int, input().split())] ts = [*map(int, input().split())] for i in range(2 * N): Ts[(i + 1) % N] = min(Ts[(i + 1) % N], Ts[i % N] + Ss[i % N]) print(Ss) print(Ts) for ans in Ts: print(ans) if __name__ == '__main__': main()
# Ke Chen # knutchen@ucsd.edu # Zero-shot Audio Source Separation via Query-based Learning from Weakly-labeled Data # The configuration file # for model training exp_name = "exp_zs_asp_full" # the saved ckpt prefix name of the model workspace = "/home/Research/ZS_ASP/" # the folder of your code dataset_path = "/home/...
exp_name = 'exp_zs_asp_full' workspace = '/home/Research/ZS_ASP/' dataset_path = '/home/Research/ZS_ASP/data/audioset' index_type = 'full_train' idc_path = '/home/Research/ZS_ASP/' balanced_data = True resume_checkpoint = None loss_type = 'mae' gather_mode = False debug = False classes_num = 527 eval_list = [] batch_si...
class ImportInstance(Instance,IDisposable): """ An element created during either import or link operation in Autodesk Revit. """ def Dispose(self): """ Dispose(self: Element,A_0: bool) """ pass def getBoundingBox(self,*args): """ getBoundingBox(self: Element,view: View) -> BoundingBoxXYZ """ pass de...
class Importinstance(Instance, IDisposable): """ An element created during either import or link operation in Autodesk Revit. """ def dispose(self): """ Dispose(self: Element,A_0: bool) """ pass def get_bounding_box(self, *args): """ getBoundingBox(self: Element,view: View) -> Boun...
class Error(Exception): """Error personalizado para mayor control en los programas. ATRIBUTOS: type = Especifica el tipo de error, en caso de ser un error lanzado por el usuario se sugiere utilizar el valor 'validacion'. message = Descripcion del error. c...
class Error(Exception): """Error personalizado para mayor control en los programas. ATRIBUTOS: type = Especifica el tipo de error, en caso de ser un error lanzado por el usuario se sugiere utilizar el valor 'validacion'. message = Descripcion del error. co...
#!/bin/python # coding: utf-8 # Source: http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml statuscodes = [ (100, "Continue"), (101, "Switching Protocol"), (102, "Processing"), (200, "OK"), (201, "Created"), (202, "Accepted"), (203, "Non-Authoritative Information"), ...
statuscodes = [(100, 'Continue'), (101, 'Switching Protocol'), (102, 'Processing'), (200, 'OK'), (201, 'Created'), (202, 'Accepted'), (203, 'Non-Authoritative Information'), (204, 'No Content'), (205, 'Reset Content'), (206, 'Partial Content'), (207, 'Multi-Status'), (208, 'Already Reported'), (226, 'IM Used'), (300, '...
async def send_large_text(channel, contents): return_messages = [] content_lines = contents.splitlines(True) output = "" for line in content_lines: if len(output) > 1800: return_messages.append(await channel.send(output)) output = "" output += line if len(outp...
async def send_large_text(channel, contents): return_messages = [] content_lines = contents.splitlines(True) output = '' for line in content_lines: if len(output) > 1800: return_messages.append(await channel.send(output)) output = '' output += line if len(outp...
class Point: def __init__(self, x, y): self.x = x self.y = y def __str__(self): return "("+str(self.x)+","+str(self.y)+")" class Rect: def __init__(self, p1, p2): self.lowerleft = p1 self.upperright = p2 def area(self): dx = upperright.x - lowerleft.x ...
class Point: def __init__(self, x, y): self.x = x self.y = y def __str__(self): return '(' + str(self.x) + ',' + str(self.y) + ')' class Rect: def __init__(self, p1, p2): self.lowerleft = p1 self.upperright = p2 def area(self): dx = upperright.x - low...
# Copyright (c) 2020 Dell Inc. or its subsidiaries. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
"""pyu4v_performance_data.py.""" class Performancedata(object): """Performance data.""" first_date = 1555777200000 last_date = 1587399600000 perf_metrics_resp = {'resultList': {'result': [{'PercentBusy': 0.025403459, 'timestamp': first_date}, {'PercentBusy': 0.027849833, 'timestamp': last_date}], 'from...
FREQ = 10 # 1/delta_time based on recorded data SCENE_DUR = 5 # in seconds NUM_TS_PER_SCENE = FREQ * SCENE_DUR RADIUS_AROUND_AGENT = 50. # range to get surrounding objects, in meters ORDERED_COLUMNS = [ "timestamp", "id", "object_type", "center_x", "center_y", "heading", "status" ] # a ...
freq = 10 scene_dur = 5 num_ts_per_scene = FREQ * SCENE_DUR radius_around_agent = 50.0 ordered_columns = ['timestamp', 'id', 'object_type', 'center_x', 'center_y', 'heading', 'status'] max_workers = 5
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'includes': [ '../../get_vivaldi_version.gypi' ], 'variables': { 'mac_product_name': 'Vivaldi', 'mac_packaging_dir': '<(PRODUC...
{'includes': ['../../get_vivaldi_version.gypi'], 'variables': {'mac_product_name': 'Vivaldi', 'mac_packaging_dir': '<(PRODUCT_DIR)/<(mac_product_name) Packaging', 'mac_packaging_sh_dir': '${BUILT_PRODUCTS_DIR}/<(mac_product_name) Packaging', 'mac_signing_key': '<!(echo $VIVALDI_SIGNING_KEY)', 'mac_signing_id': '<!(echo...
''' 2-CLAUSE BSD Copyright (c) 2017, apple502j All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of ...
""" 2-CLAUSE BSD Copyright (c) 2017, apple502j All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of condition...
#!/usr/bin/python # -*- coding: utf-8 -*- API_METHOD_PURCHASE='wallet.trade.buy' API_METHOD_REDEEM='wallet.trade.sell' API_METHOD_QUERY='wallet.trade.query' API_METHOD_CANCEL='wallet.trade.cancel' PAYMENT_STATUS_NOTSTARTED='Not Started' PAYMENT_STATUS_PAYSUCCESS='PaySuccess' PAYMENT_STATUS_SUCCESS='Success' PAYMENT_ST...
api_method_purchase = 'wallet.trade.buy' api_method_redeem = 'wallet.trade.sell' api_method_query = 'wallet.trade.query' api_method_cancel = 'wallet.trade.cancel' payment_status_notstarted = 'Not Started' payment_status_paysuccess = 'PaySuccess' payment_status_success = 'Success' payment_status_expiredinvalid = 'Expire...
# Problem name : Plus One # Problem link : https://leetcode.com/problems/plus-one/ # Contributor : Shreeraksha R Aithal class Solution: def plusOne(self, digits: List[int]) -> List[int]: n = len(digits) i = -1 carry = 1 while i>=-n: digits[i] = digits[i] + carry ...
class Solution: def plus_one(self, digits: List[int]) -> List[int]: n = len(digits) i = -1 carry = 1 while i >= -n: digits[i] = digits[i] + carry carry = digits[i] // 10 digits[i] = digits[i] % 10 i = i - 1 if carry > 0: ...
n = int(input()) a = list(map(int, input().split())) dp = [1] * n for i in range(1, len(a)): for j in range(i - 1, -1, -1): if a[j] == a[i]: dp[i] = max(dp[i], dp[j]) if a[j] < a[i]: dp[i] = max(dp[i], dp[j] + 1) print(max(dp)) print(dp)
n = int(input()) a = list(map(int, input().split())) dp = [1] * n for i in range(1, len(a)): for j in range(i - 1, -1, -1): if a[j] == a[i]: dp[i] = max(dp[i], dp[j]) if a[j] < a[i]: dp[i] = max(dp[i], dp[j] + 1) print(max(dp)) print(dp)
"""Make this it's own package so unit tests run properly without having to mess with path variables, see: __ http://stackoverflow.com/questions/1896918/running-unittest-with-typical-test-directory-structure Note: run ``python -m unittest discover`` """
"""Make this it's own package so unit tests run properly without having to mess with path variables, see: __ http://stackoverflow.com/questions/1896918/running-unittest-with-typical-test-directory-structure Note: run ``python -m unittest discover`` """
# https://leetcode.com/problems/deepest-leaves-sum/ # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right def dl_sum_and_depth(root: TreeNode, depth: int) -> tuple[int, int]: if not roo...
class Treenode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right def dl_sum_and_depth(root: TreeNode, depth: int) -> tuple[int, int]: if not root.left and (not root.right): return (root.val, depth) (left_sum, left_depth) =...
n, p, s = map(int, input().split()) sets = list() for _ in range(s): sets.append(input().split()[1:]) for s in sets: if str(p) in s: print('KEEP') else: print('REMOVE')
(n, p, s) = map(int, input().split()) sets = list() for _ in range(s): sets.append(input().split()[1:]) for s in sets: if str(p) in s: print('KEEP') else: print('REMOVE')
def iter(n): sum = 0 sum1 = 0 for i in range(0,n,1): sum += 7*pow(10,i) for j in range(1,n,1): sum1 = (pow(10,j+1)-10-(9*j))/81 x = sum + sum1 return x
def iter(n): sum = 0 sum1 = 0 for i in range(0, n, 1): sum += 7 * pow(10, i) for j in range(1, n, 1): sum1 = (pow(10, j + 1) - 10 - 9 * j) / 81 x = sum + sum1 return x
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate...
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres...
#------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: mo-mo- # # Created: 25/08/2018 # Copyright: (c) mo-mo- 2018 # Licence: <your licence> #------------------------------------------------------------------------------- ...
(n, k) = map(int, input().split()) x = list(map(int, input().split())) b = None for i in range(n): if x[i] == 0: b = i start = True break elif x[i] > 0: b = i start = False break if not b: m = abs(x[-k]) else: if start: del x[b] k -= 1 ...
# -*- coding: utf-8 -*- """ app.views.user ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Module for initialising app user API package. :copyright: (c)2020 by rico0821 """
""" app.views.user ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Module for initialising app user API package. :copyright: (c)2020 by rico0821 """
pasta = "tomato, basil, garlic, salt, pasta, olive oil" apple_pie = "apple, sugar, salt, cinnamon, flour, egg, butter" ratatouille = "aubergine, carrot, onion, tomato, garlic, olive oil, pepper, salt" chocolate_cake = "chocolate, sugar, salt, flour, coffee, butter" omelette = "egg, milk, bacon, tomato, salt, pepper" wo...
pasta = 'tomato, basil, garlic, salt, pasta, olive oil' apple_pie = 'apple, sugar, salt, cinnamon, flour, egg, butter' ratatouille = 'aubergine, carrot, onion, tomato, garlic, olive oil, pepper, salt' chocolate_cake = 'chocolate, sugar, salt, flour, coffee, butter' omelette = 'egg, milk, bacon, tomato, salt, pepper' wo...
num1 = 1 num2 = 1 num3 = 200 num100 = 000000 num2 = 100 num4 = 000 num33 = 9998 age = 12 age1 = 123 hahah = 1320389
num1 = 1 num2 = 1 num3 = 200 num100 = 0 num2 = 100 num4 = 0 num33 = 9998 age = 12 age1 = 123 hahah = 1320389
# -*- coding: utf-8 -*- __author__ = 'Sumeet Kumar' __email__ = 'kr.sumeet@gmail.com' __version__ = '1.0.0'
__author__ = 'Sumeet Kumar' __email__ = 'kr.sumeet@gmail.com' __version__ = '1.0.0'
N = int(input()) A = list(map(int, input().split())) ans = 0 for i in range(N): if A[A[i]-1] == (i+1): ans += 1 print(ans//2)
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(N): if A[A[i] - 1] == i + 1: ans += 1 print(ans // 2)
class Solution: def repeatedSubstringPattern(self, s: str) -> bool: ans="" temp="" for i in range(0,len(s)-1): temp+=s[i] if len(s)%len(temp)==0 and temp*int((len(s)/len(temp)))==s: print(temp) return 1 ...
class Solution: def repeated_substring_pattern(self, s: str) -> bool: ans = '' temp = '' for i in range(0, len(s) - 1): temp += s[i] if len(s) % len(temp) == 0 and temp * int(len(s) / len(temp)) == s: print(temp) return 1 retur...
# GYP file to build unit tests. { 'includes': [ 'apptype_console.gypi', ], 'targets': [ { 'target_name': 'pathops_unittest', 'type': 'executable', 'suppress_wildcard': '1', 'include_dirs' : [ '../src/core', '../src/effects', '../src/lazy', '../src/pa...
{'includes': ['apptype_console.gypi'], 'targets': [{'target_name': 'pathops_unittest', 'type': 'executable', 'suppress_wildcard': '1', 'include_dirs': ['../src/core', '../src/effects', '../src/lazy', '../src/pathops', '../src/pdf', '../src/pipe/utils', '../src/utils', '../tools/'], 'includes': ['pathops_unittest.gypi']...
# ============================================================================= # # ============================================================================= x =[1,2,5]+ [3,4] x.sort() # ============================================================================= # # ===========================================...
x = [1, 2, 5] + [3, 4] x.sort() a = [[1, 2], [3, 4]] find_matrix(a) def find_matrix(a): n_rows = len(a) n_cols = len(a[0]) for row in range(n_rows): for col in range(n_cols): if row == 0 and col == 0: pass elif row == 0 and col != 0: a[row][co...
class Solution: def groupAnagrams(self, strs: list) -> list: hashmap = {} for s in strs: key = ''.join(sorted(s)) if key in hashmap: hashmap[key] += [s] else: hashmap[key] = [s] return hashmap.values() v = Solution().group...
class Solution: def group_anagrams(self, strs: list) -> list: hashmap = {} for s in strs: key = ''.join(sorted(s)) if key in hashmap: hashmap[key] += [s] else: hashmap[key] = [s] return hashmap.values() v = solution().group...
def plus_minus(arr): positive, negative, zero = 0, 0, 0 for index in arr: if index > 0: positive += 1 elif index < 0: negative += 1 else: zero += 1 print(positive/len(arr)) print(negative/len(arr)) print(zero/len(arr)) arr = [-4, 3, -9, 0,...
def plus_minus(arr): (positive, negative, zero) = (0, 0, 0) for index in arr: if index > 0: positive += 1 elif index < 0: negative += 1 else: zero += 1 print(positive / len(arr)) print(negative / len(arr)) print(zero / len(arr)) arr = [-4, ...
#!/usr/bin/python # arithmetic.py a = 10 b = 11 c = 12 add = a + b + c sub = c - a mult = a * b div = c / 3 power = (a ** 2) print (add, sub, mult, div) print (power)
a = 10 b = 11 c = 12 add = a + b + c sub = c - a mult = a * b div = c / 3 power = a ** 2 print(add, sub, mult, div) print(power)
# # LeetCode # # Problem - 206 # URL - https://leetcode.com/problems/reverse-linked-list/ # # 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: an...
class Solution: def reverse_list(self, head: ListNode) -> ListNode: ans_node = None while head != None: ans_node = list_node(head.val, ansNode) head = head.next return ansNode
# # PySNMP MIB module ARISTA-NEXTHOP-GROUP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ARISTA-NEXTHOP-GROUP-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:25:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7....
(arista_mibs,) = mibBuilder.importSymbols('ARISTA-SMI-MIB', 'aristaMibs') (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, ...
class Message: def __init__(self, chat_id=""): self.chat_id = chat_id def set_text(self, text, parse_mode=None, disable_web_page_preview=None, disable_notification=None, reply_to_message_id=None, reply_markup=None): self.text = text self.content_type = "text" se...
class Message: def __init__(self, chat_id=''): self.chat_id = chat_id def set_text(self, text, parse_mode=None, disable_web_page_preview=None, disable_notification=None, reply_to_message_id=None, reply_markup=None): self.text = text self.content_type = 'text' self.parse_mode = ...
""" Distributed under the MIT License. See LICENSE.txt for more info. """ # seconds after email verification will expire EMAIL_VERIFICATION_EXPIRY = 48 * 60 * 60
""" Distributed under the MIT License. See LICENSE.txt for more info. """ email_verification_expiry = 48 * 60 * 60
# -*- coding: utf-8 -*- __email__ = '{{ cookiecutter.author_email }}' __author__ = '{{ cookiecutter.author_name }}' __version__ = '0.0.1'
__email__ = '{{ cookiecutter.author_email }}' __author__ = '{{ cookiecutter.author_name }}' __version__ = '0.0.1'
#x = "awesome" def myfunc(): print("Python is " + x) #myfunc() '''''''''''''''''''''''''''''''''''' x = "awesome" def myfunc2(): x = "fantastic" print("Python is " + x) myfunc2() print("Python is " + x)
def myfunc(): print('Python is ' + x) '' x = 'awesome' def myfunc2(): x = 'fantastic' print('Python is ' + x) myfunc2() print('Python is ' + x)
#!/usr/bin/env python array = [ { 'fips': '01', 'abbr': 'AL', 'name': 'Alabama', }, { 'fips': '02', 'abbr': 'AK', 'name': 'Alaska', }, { 'fips': '04', 'abbr': 'AZ', 'name': 'Arizona', }, { 'fips': '05', 'abbr': 'AR', 'name': 'Arkansas', }, { 'fips': '06', 'abbr': 'CA', 'name': 'C...
array = [{'fips': '01', 'abbr': 'AL', 'name': 'Alabama'}, {'fips': '02', 'abbr': 'AK', 'name': 'Alaska'}, {'fips': '04', 'abbr': 'AZ', 'name': 'Arizona'}, {'fips': '05', 'abbr': 'AR', 'name': 'Arkansas'}, {'fips': '06', 'abbr': 'CA', 'name': 'California'}, {'fips': '08', 'abbr': 'CO', 'name': 'Colorado'}, {'fips': '09'...
def checkstyle(name, srcs=[], checkstyle_xml="//tools/config/src/main/resources:harness_checks.xml",): # checkstyle_suppressions="@com_github_mihaibojin_bazel_java_rules//checkstyle:checkstyle-suppressions.xml", # checkstyle_xpath_suppressions="@com_github_mihaibojin_bazel_jav...
def checkstyle(name, srcs=[], checkstyle_xml='//tools/config/src/main/resources:harness_checks.xml'): native.genrule(name=name, srcs=srcs, outs=['checkstyle.log'], cmd=' '.join(['java -classpath $(location @checkstyle//file)', '-Dorg.checkstyle.google.header.file=$(location ' + license_header + ')', '-Dorg.checksty...
class Solution: def isPrefixOfWord(self, sentence: str, searchWord: str) -> int: for i, w in enumerate(sentence.split(" ")): if w.startswith(searchWord): return i + 1 return -1
class Solution: def is_prefix_of_word(self, sentence: str, searchWord: str) -> int: for (i, w) in enumerate(sentence.split(' ')): if w.startswith(searchWord): return i + 1 return -1
print(", ".join(["spam", "eggs", "ham"])) #prints "spam, eggs, ham" print("Hello ME".replace("ME", "world")) #prints "Hello world" print("This is a sentence.".startswith("This")) # prints "True" print("This is a sentence.".endswith("sentence.")) # prints "True" print("This is a sentence.".upper()) # prints "THIS IS...
print(', '.join(['spam', 'eggs', 'ham'])) print('Hello ME'.replace('ME', 'world')) print('This is a sentence.'.startswith('This')) print('This is a sentence.'.endswith('sentence.')) print('This is a sentence.'.upper()) print('AN ALL CAPS SENTENCE'.lower()) print('spam, eggs, ham'.split(', '))
# Write redmonster output files # # Tim Hutchinson, , University of Utah, April 2014 # t.hutchinson@utah.edu # # July 2014 - now probably defunct, replaced by redmonster.datamgr.io.py class Output: def __init__(self, spec=None): if spec: self.set_filenames() def set_filenames(self): self.zall...
class Output: def __init__(self, spec=None): if spec: self.set_filenames() def set_filenames(self): self.zallfile = 'spZall-%s-%s.fits' % (spec.plate, spec.mjd) self.zbestfile = 'spZbest-%s-%s.fits' % (spec.plate, spec.mjd) self.zlinefile = 'spZline-%s-%s.fits' % (s...
class SplitterNotifier: def __init__(self, notifiers=None): if notifiers is None: notifiers = [] self.notifiers = notifiers def notify(self, notification, text, options=None): if options is None: options = {} for notifier in self.notifiers: no...
class Splitternotifier: def __init__(self, notifiers=None): if notifiers is None: notifiers = [] self.notifiers = notifiers def notify(self, notification, text, options=None): if options is None: options = {} for notifier in self.notifiers: n...
class Solution: def nextPermutation(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. 1. Find the first pos i from right such that nums[i] < nums[i+1] 2. Swap nums[i] with the smallest element larger than nums[i] 3. Sort nums[i+1:] ...
class Solution: def next_permutation(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. 1. Find the first pos i from right such that nums[i] < nums[i+1] 2. Swap nums[i] with the smallest element larger than nums[i] 3. Sort nums[i+1:] ...
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. class DiskPartition(object): """Implementation of the 'Disk Partition.' model. Specifies information about each partition in a physical disk. Attributes: length_bytes (long|int): Specifies the length of the block in bytes. number (l...
class Diskpartition(object): """Implementation of the 'Disk Partition.' model. Specifies information about each partition in a physical disk. Attributes: length_bytes (long|int): Specifies the length of the block in bytes. number (long|int): Specifies a unique number of the partition withi...
""" Global Tusclient exception and warning classes. """ class TusCommunicationError(Exception): """ Should be raised when communications with tus-server behaves unexpectedly. :Attributes: - message (str): Main message of the exception - status_code (int): Statu...
""" Global Tusclient exception and warning classes. """ class Tuscommunicationerror(Exception): """ Should be raised when communications with tus-server behaves unexpectedly. :Attributes: - message (str): Main message of the exception - status_code (int): Status...
class Solution(object): def findUnsortedSubarray(self, nums): """ :type nums: List[int] :rtype: int """ if not nums or len(nums) == 0: return 0 is_same = [a == b for a,b in zip(nums,sorted(nums))] return 0 if all(is_same) else len(nums) - is_same[:...
class Solution(object): def find_unsorted_subarray(self, nums): """ :type nums: List[int] :rtype: int """ if not nums or len(nums) == 0: return 0 is_same = [a == b for (a, b) in zip(nums, sorted(nums))] return 0 if all(is_same) else len(nums) - is...
x=2 def increment(number): return number + 1
x = 2 def increment(number): return number + 1
"""**TODO** .. autosummary:: :toctree: Bifunctor """ class Bifunctor(): """**TODO**"""
"""**TODO** .. autosummary:: :toctree: Bifunctor """ class Bifunctor: """**TODO**"""
LOGIN_PHASES = [ 'WaitingForAuthentication', 'WaitingForEula', 'Done', 'Disabled', 'Login', '', ] WAIT_FOR_LAUNCH_PHASES = [ 'WaitForLaunch', ] SUCCESS_PHASES = [ 'WaitForSessionExit', ] EULA_PHASES = [ 'Eula', ] CONSENT_REQUIRED_PHASES = [ 'AgeRestriction', ] BANNED_PHASES ...
login_phases = ['WaitingForAuthentication', 'WaitingForEula', 'Done', 'Disabled', 'Login', ''] wait_for_launch_phases = ['WaitForLaunch'] success_phases = ['WaitForSessionExit'] eula_phases = ['Eula'] consent_required_phases = ['AgeRestriction'] banned_phases = [] account_alias_change_phase = ['AccountAlias'] region_mi...
# coding=UTF-8 # ex:ts=4:sw=4:et=on # ------------------------------------------------------------------------- # Copyright (C) 2014 by Mathijs Dumon <mathijs dot dumon at gmail dot com> # # mvc is a framework derived from the original pygtkmvc framework # hosted at: <http://sourceforge.net/projects/pygtkmvc/> # # ...
class Observemixin(object): """ A descriptor mixin that will make the instance observe and relieve the objects set. """ def __relieve_old(self, instance, old, new): if old is not None: instance.relieve_model(old) def __observe_new(self, instance, old, new): if new i...
#!/usr/bin/python3 # -*- coding: utf-8 -*- ''' Class Parser parses clingo output ''' class Parser: next_line_facts = False def process_facts(self, facts): facts = facts.split(" ") facts.sort() return facts def process_line(self, line, model): line = line.replace("\n", "") ...
""" Class Parser parses clingo output """ class Parser: next_line_facts = False def process_facts(self, facts): facts = facts.split(' ') facts.sort() return facts def process_line(self, line, model): line = line.replace('\n', '') if 'reading' in line.lower(): ...
def turn_right(): turn_left() turn_left() turn_left() def jump(): move() turn_left() move() turn_right() move() turn_right() move() turn_left() while not at_goal(): jump()
def turn_right(): turn_left() turn_left() turn_left() def jump(): move() turn_left() move() turn_right() move() turn_right() move() turn_left() while not at_goal(): jump()
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'leftANDORleftPLUSMINUSleftTIMESDIVIDErightUMINUSleftLPARENRPARENAND DIVIDE FLOAT GE GT ID IE IN LE LIST LPAREN LT MINUS NE NONE NOT NUMBER OR PLUS RPAREN STR TIMES\n ...
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'leftANDORleftPLUSMINUSleftTIMESDIVIDErightUMINUSleftLPARENRPARENAND DIVIDE FLOAT GE GT ID IE IN LE LIST LPAREN LT MINUS NE NONE NOT NUMBER OR PLUS RPAREN STR TIMES\n expr : expr PLUS expr\n | expr MINUS expr\n | expr TIMES expr\n ...
DEFINITIONS={ "cc_clone_detection_big_clone_bench": { "class_name": "CodeXGlueCCCloneDetectionBigCloneBench", "data_dir_name": "dataset", "dataset_type": "Code-Code", "description": "CodeXGLUE Clone-detection-BigCloneBench dataset, available at https://github.com/microsoft/CodeXGLUE/...
definitions = {'cc_clone_detection_big_clone_bench': {'class_name': 'CodeXGlueCCCloneDetectionBigCloneBench', 'data_dir_name': 'dataset', 'dataset_type': 'Code-Code', 'description': 'CodeXGLUE Clone-detection-BigCloneBench dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/Clone-detection-...
""" """ def get_daily_quote(): return 'q:gdq'
""" """ def get_daily_quote(): return 'q:gdq'
################################## # import_file.json # ################################## attributes = { "type": "array", "items": { "type": "object", "properties": {"id": {"type": "integer"}, "groupId": {"type": "integer"}}, "required": ["id", "groupId"], }, } bbox ...
attributes = {'type': 'array', 'items': {'type': 'object', 'properties': {'id': {'type': 'integer'}, 'groupId': {'type': 'integer'}}, 'required': ['id', 'groupId']}} bbox = {'$id': 'https://darwin.v7labs.com/schemas/supperannotate/bounding_box', 'description': 'Schema of a Bounding Box', 'title': 'Bounding Box', 'defau...
s = list(map(int, input().split())) for i in range(1, len(s)): if s[i] > s[i - 1]: print(s[i], end=' ')
s = list(map(int, input().split())) for i in range(1, len(s)): if s[i] > s[i - 1]: print(s[i], end=' ')
class Solution: def climbStairs(self, n: int) -> int: if(n==1): return 1 dp = [0] * (n+1) dp[1] = 1 dp[2] = 2 for i in range(3,n+1): dp[i] = dp[i-1] + dp[i-2] return dp[n]
class Solution: def climb_stairs(self, n: int) -> int: if n == 1: return 1 dp = [0] * (n + 1) dp[1] = 1 dp[2] = 2 for i in range(3, n + 1): dp[i] = dp[i - 1] + dp[i - 2] return dp[n]
num1 = int(input("Please input num1: ")) num2 = int(input("Please input num2: ")) num3 = int(input("Please input num3: ")) num4 = int(input("Please input num4: ")) num5 = int(input("Please input num5: ")) num6 = int(input("Please input num6: ")) s = num1 + num2 + num3 + num4 + num5 + num6 print("sum: {}".forma...
num1 = int(input('Please input num1: ')) num2 = int(input('Please input num2: ')) num3 = int(input('Please input num3: ')) num4 = int(input('Please input num4: ')) num5 = int(input('Please input num5: ')) num6 = int(input('Please input num6: ')) s = num1 + num2 + num3 + num4 + num5 + num6 print('sum: {}'.format(s))
q=int(input()) if(1>q or q>10): exit def isAnagram(par1,par2): par1.sort() par2.sort() # print(len(par1)) for i in range(len(par1)): if(par1[i]!=par2[i]): return False return True def init(): strings=[] count=0 q=int(globals()['q']) while(q!=0): st...
q = int(input()) if 1 > q or q > 10: exit def is_anagram(par1, par2): par1.sort() par2.sort() for i in range(len(par1)): if par1[i] != par2[i]: return False return True def init(): strings = [] count = 0 q = int(globals()['q']) while q != 0: strings.appe...
# B_R_R # M_S_A_W """ Coding Problem on Exception Handling: How to raise Error Using try and except """ class DogNameError(Exception): def __init__(self, *args,**kwargs): Exception.__init__(self, *args,**kwargs) try: user_input=input("What is your dog name: ") if any(i.isdigit()for i in user_...
""" Coding Problem on Exception Handling: How to raise Error Using try and except """ class Dognameerror(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) try: user_input = input('What is your dog name: ') if any((i.isdigit() for i in user_input)): ...
_base_ = [ '../_base_/datasets/icip.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_40k.py' ] # model settings norm_cfg = dict(type='BN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained=None, backbone=dict( type='ResNetV1c', depth=50, n...
_base_ = ['../_base_/datasets/icip.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_40k.py'] norm_cfg = dict(type='BN', requires_grad=True) model = dict(type='EncoderDecoder', pretrained=None, backbone=dict(type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 1, 1), str...
# # PySNMP MIB module CISCO-ENTITY-SENSOR-EXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ENTITY-SENSOR-EXT-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:57:12 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python versio...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, value_range_constraint, constraints_union, single_value_constraint) ...
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
"""Get ops from program.""" def conv_op_params(blocks, current_op): """Getting params of conv op Args: blocks: BlockDesc, current block current_op: OpDesc, current op Returns: (list): op name and hyperparamters """ (tmp, res) = ([], []) tmp.append('conv') if not curr...
def binary_search(array, target): start_index = 0 end_index = len(array) - 1 while start_index <= end_index: mid_index = (start_index + end_index) // 2 # integer division in Python 3 mid_element = array[mid_index] if target == mid_element: # we have found the element ...
def binary_search(array, target): start_index = 0 end_index = len(array) - 1 while start_index <= end_index: mid_index = (start_index + end_index) // 2 mid_element = array[mid_index] if target == mid_element: return mid_index elif target < mid_element: ...
#!/usr/bin/python3 # code_generator.py def add_layers(layers): return_string = '''model = tf.keras.Sequential()\n''' for layer in layers: if layer['type'] == 'dense': if layer['activation_function'] is not None: return_string += '''model.add(tf.keras.layers.Dense(units={uni...
def add_layers(layers): return_string = 'model = tf.keras.Sequential()\n' for layer in layers: if layer['type'] == 'dense': if layer['activation_function'] is not None: return_string += "model.add(tf.keras.layers.Dense(units={units}, activation='{activation}', \n ...
#Iris Data sorted into columns #Hugh O'Reilly 04/03/18 with open("data/iris.csv") as f: #Opens Iris data set csv file in data folder for line in f:# loops through each line line = line.replace(',', ' ') #replaces comma with space, code from Mohamed Noor line = line.rstrip() #Removes nextline code o...
with open('data/iris.csv') as f: for line in f: line = line.replace(',', ' ') line = line.rstrip() print(line.split(',')[:]) for column in f: print(f.read())
#Euler Problem 5 Lowest common multiple # Michael Garvey # credits: https://gist.github.com/PEZ/47534 i = 1 for k in (range(1, 21)): #using range to test numbers 1 to 20 if i % k > 0: for j in range(1, 21): if (i*j) % k == 0: i *= j break print (i)
i = 1 for k in range(1, 21): if i % k > 0: for j in range(1, 21): if i * j % k == 0: i *= j break print(i)
def mergeSort(array): print(f"Splitting the array {array}") if len(array)>1: mid = len(array)//2 lefthalf = array[:mid] righthalf = array[mid:] mergeSort(lefthalf) mergeSort(righthalf) i=j=k=0 while i < len(lefthalf) and j < len(righthalf): ...
def merge_sort(array): print(f'Splitting the array {array}') if len(array) > 1: mid = len(array) // 2 lefthalf = array[:mid] righthalf = array[mid:] merge_sort(lefthalf) merge_sort(righthalf) i = j = k = 0 while i < len(lefthalf) and j < len(righthalf): ...
class Solution: def storeProfit(self, profit): print(self.profits, profit) store_idx = -1 min = None print(self.profits) for i, val in enumerate(self.profits): if min is None: min = val store_idx = i if ...
class Solution: def store_profit(self, profit): print(self.profits, profit) store_idx = -1 min = None print(self.profits) for (i, val) in enumerate(self.profits): if min is None: min = val store_idx = i if val == 0: ...
"""craigslist - A Discord bot to facilitate playing Millenial Apartment Hunters""" __version__ = '0.1.0' __author__ = 'Rose Davidson <rose@metaclassical.com>' __all__ = []
"""craigslist - A Discord bot to facilitate playing Millenial Apartment Hunters""" __version__ = '0.1.0' __author__ = 'Rose Davidson <rose@metaclassical.com>' __all__ = []
# def add(num1, num2): # # just put these initial values down to the length # x = len(str(num1)) # y = len(str(num2)) # z = 0 # if x >= y : # for k in range(0,x): # z = z + int(num1/(10**x)) + int(num2/(10**x)) # else: # for k in range(0,y): # z = z + i...
def add(num1, num2): x = num1 - int(num1 / 10) * 10 y = num2 - int(num2 / 10) * 10 if x == 0 and y == 0: z = num1 + num2 elif x == 0: z = num1 + y elif y == 0: z = x + num2 else: z = x + y a = len(str(num1)) - 1 b = len(str(num2)) - 1 c = int(num1 / 10...
""" shortcut to run docker remove commands """ def get_rmi_command(info_list): """ JUST USE: docker rmi $(docker images -f "dangling=true" -q) <none> <none> 591446e60492 4 days ago 796MB <none> <none> f2f37f4e35fa 4 days ago ...
""" shortcut to run docker remove commands """ def get_rmi_command(info_list): """ JUST USE: docker rmi $(docker images -f "dangling=true" -q) <none> <none> 591446e60492 4 days ago 796MB <none> <none> f2f37f4e35fa 4 days ago ...
def _render(template, context, app): """Renders the template and fires the signal""" before_render_template.send(app, template=template, context=context) rv = template.render(context) template_rendered.send(app, template=template, context=context) return rv
def _render(template, context, app): """Renders the template and fires the signal""" before_render_template.send(app, template=template, context=context) rv = template.render(context) template_rendered.send(app, template=template, context=context) return rv
class HTTP404(Exception): def __init__(self): super(HTTP404, self).__init__() self.code = 404 def __str__(self): return "404: Page Not Found" def __repr__(self): return self.__str__()
class Http404(Exception): def __init__(self): super(HTTP404, self).__init__() self.code = 404 def __str__(self): return '404: Page Not Found' def __repr__(self): return self.__str__()
#Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between). # #For example: #Given binary tree [3,9,20,null,null,15,7], # 3 # / \ # 9 20 # / \ # 15 7 #return its zigzag level order traversal as: ...
class Solution(object): def zigzag_level_order(self, root): """ :type root: TreeNode :rtype: List[List[int]] """ ans = [] child = [root] c = 0 while child: (temp, temp2) = ([], []) for i in child: if i: temp.a...
version='' commithash='64db13864cb1b377c8a9ab7c08e4688d3d1f94ef' gittag_short='' gittag_long='64db138-dirty' git_lastmod='Mon, 15 May 2017 14:34:53 +0200' github_url='https://github.com/plasmodic/ecto' breathe_default_project = 'ecto' breathe_projects = dict(ecto='/home/arnaud.duhamel/qidata/python-ecto/build/temp.lin...
version = '' commithash = '64db13864cb1b377c8a9ab7c08e4688d3d1f94ef' gittag_short = '' gittag_long = '64db138-dirty' git_lastmod = 'Mon, 15 May 2017 14:34:53 +0200' github_url = 'https://github.com/plasmodic/ecto' breathe_default_project = 'ecto' breathe_projects = dict(ecto='/home/arnaud.duhamel/qidata/python-ecto/bui...
# This problem was recently asked by Apple: # You are given a binary tree representation of an arithmetic expression. # In this tree, each leaf is an integer value,, and a non-leaf node is one of the four operations: '+', '-', '*', or '/'. # Write a function that takes this tree and evaluates the expression. class No...
class Node: def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right plus = '+' minus = '-' times = '*' divide = '/' def evaluate(root): if root is None: return 0 if root.left is None and root.right is None: return int(root....
image = io.imread('../img/skimage-logo.png') # --- assign each color channel to a different variable --- r = image[:, :, 0] g = image[:, :, 1] b = image[:, :, 2]
image = io.imread('../img/skimage-logo.png') r = image[:, :, 0] g = image[:, :, 1] b = image[:, :, 2]
# # PySNMP MIB module MGMT-SECURITY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MGMT-SECURITY-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:11:54 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, constraints_union, constraints_intersection, value_size_constraint) ...
# Copyright 2019 Graphcore Ltd. class NullContextManager(object): def __enter__(self): pass def __exit__(self, *args): pass
class Nullcontextmanager(object): def __enter__(self): pass def __exit__(self, *args): pass
#Global parameters module N = 1024 K = 16 Q = 12289 POLY_BYTES = 1792 NEWHOPE_SEEDBYTES = 32 NEWHOPE_RECBYTES = 256 NEWHOPE_SENDABYTES = POLY_BYTES + NEWHOPE_SEEDBYTES NEWHOPE_SENDBBYTES = POLY_BYTES + NEWHOPE_RECBYTES
n = 1024 k = 16 q = 12289 poly_bytes = 1792 newhope_seedbytes = 32 newhope_recbytes = 256 newhope_sendabytes = POLY_BYTES + NEWHOPE_SEEDBYTES newhope_sendbbytes = POLY_BYTES + NEWHOPE_RECBYTES
# Hacked from winnt.h DELETE = (65536) READ_CONTROL = (131072) WRITE_DAC = (262144) WRITE_OWNER = (524288) SYNCHRONIZE = (1048576) STANDARD_RIGHTS_REQUIRED = (983040) STANDARD_RIGHTS_READ = (READ_CONTROL) STANDARD_RIGHTS_WRITE = (READ_CONTROL) STANDARD_RIGHTS_EXECUTE = (READ_CONTROL) STANDARD_RIGHTS_ALL = (2031616) SP...
delete = 65536 read_control = 131072 write_dac = 262144 write_owner = 524288 synchronize = 1048576 standard_rights_required = 983040 standard_rights_read = READ_CONTROL standard_rights_write = READ_CONTROL standard_rights_execute = READ_CONTROL standard_rights_all = 2031616 specific_rights_all = 65535 access_system_sec...
#Challenge 1 num = 1 while num < 11: print(num) num += 1 #Challenge 2 chosenNum = input('Enter a number: ') modifier = 1 chosenNum = int(chosenNum) for count in range(1, chosenNum, 1): chosenNum += count print (chosenNum) #Challenge 3 for count in range(1500, 2701, 1): if (count % 7 == 0 and ...
num = 1 while num < 11: print(num) num += 1 chosen_num = input('Enter a number: ') modifier = 1 chosen_num = int(chosenNum) for count in range(1, chosenNum, 1): chosen_num += count print(chosenNum) for count in range(1500, 2701, 1): if count % 7 == 0 and count % 5 == 0: print(count) for count in...
#! /home/nsanthony/anaconda3/bin/python num_of_primes = 10000 prime_num_count = 0 primes = [0]*num_of_primes i = 1 #starting prime while prime_num_count < num_of_primes: i += 1 divisible = 1 k = 0 while k < prime_num_count: if(i % primes[k] == 0): #modulus divisible = 0 ...
num_of_primes = 10000 prime_num_count = 0 primes = [0] * num_of_primes i = 1 while prime_num_count < num_of_primes: i += 1 divisible = 1 k = 0 while k < prime_num_count: if i % primes[k] == 0: divisible = 0 break else: k += 1 if divisible != 0: ...
""" Prime Numbers I """ # Check if a number input by a user is prime or not. If it is NOT a prime number, print out that it is not a prime number. If it IS a prime number, print out that it is a prime number and give an example of two of its factors. Hint: Prime numbers must be greater than 1. # Example of output for...
""" Prime Numbers I """
"Dylan Murphy" "2018-07-13" 'Dylan Murphy 2018-07-03' """This Program cross checks addresses from the Petroleum spill database with addresses listed in the PLUTO csv file. these addresses have been edited and formatted in order to properly match. It uses a binary search algorithms to search for matching address...
"""Dylan Murphy""" '2018-07-13' 'Dylan Murphy 2018-07-03' 'This Program cross checks addresses from the Petroleum spill database with addresses listed in \nthe PLUTO csv file. these addresses have been edited and formatted in order to properly match.\nIt uses a binary search algorithms to search for matching addresses ...
string = input().upper() if string.count('AUGUST')>=1: print('NOU') else: string = ''.join(reversed(string)).replace('A','S') print(string)
string = input().upper() if string.count('AUGUST') >= 1: print('NOU') else: string = ''.join(reversed(string)).replace('A', 'S') print(string)
""" Inline tokenizer for mistletoe. """ def tokenize(string, token_types): *token_types, fallback_token = token_types tokens = find_tokens(string, token_types, fallback_token) token_buffer = [] if tokens: prev = tokens[0] for curr in tokens[1:]: prev = eval_tokens(prev, cur...
""" Inline tokenizer for mistletoe. """ def tokenize(string, token_types): (*token_types, fallback_token) = token_types tokens = find_tokens(string, token_types, fallback_token) token_buffer = [] if tokens: prev = tokens[0] for curr in tokens[1:]: prev = eval_tokens(prev, cu...
n_odds = -1 for i in range(0, 14, 2): # Check for the value of i in each iteration breakpoint() # Bad condition if i % 1 == 0: n_odds += 0 print(n_odds)
n_odds = -1 for i in range(0, 14, 2): breakpoint() if i % 1 == 0: n_odds += 0 print(n_odds)
class PublicClass: pass class _PrivateClass: pass def public_function(): pass def _private_function(): pass
class Publicclass: pass class _Privateclass: pass def public_function(): pass def _private_function(): pass
test_image = plt.imread(os.path.join('test_images', 'test4.jpg')) undistorted_img = cv2.undistort(test_image, mtx, dist) thresh_binary = func(image) img_size = (thresh_binary.shape[1], thresh_binary.shape[0]) width, height = img_size offset = 200 src = np.float32([ [ 588, 446 ], [ 691, 446 ], [ 112...
test_image = plt.imread(os.path.join('test_images', 'test4.jpg')) undistorted_img = cv2.undistort(test_image, mtx, dist) thresh_binary = func(image) img_size = (thresh_binary.shape[1], thresh_binary.shape[0]) (width, height) = img_size offset = 200 src = np.float32([[588, 446], [691, 446], [1126, 673], [153, 673]]) dst...
age = 3 admission_fee = (0,25,40) if age < 4: print(f"Your admission fee is ${admission_fee[0]}, welcome to the park!") elif age < 18: print(f"Your admission fee is ${admission_fee[1]}, welcome to the park!") else: print(f"You're a senior so your fee is ${admission_fee[2]}, Welcome!!")
age = 3 admission_fee = (0, 25, 40) if age < 4: print(f'Your admission fee is ${admission_fee[0]}, welcome to the park!') elif age < 18: print(f'Your admission fee is ${admission_fee[1]}, welcome to the park!') else: print(f"You're a senior so your fee is ${admission_fee[2]}, Welcome!!")
# -*- coding: utf-8 -*- """ Spyder Editor @author: syenpark Python Version: 3.6 """ decimal = int(input('Enter an integer number: ')) sign = '' digits = [] binary = '' if decimal < 0: decimal *= -1 sign = '-' while decimal: digits.insert(0, str(decimal % 2)) decimal //= 2 print(sign + bina...
""" Spyder Editor @author: syenpark Python Version: 3.6 """ decimal = int(input('Enter an integer number: ')) sign = '' digits = [] binary = '' if decimal < 0: decimal *= -1 sign = '-' while decimal: digits.insert(0, str(decimal % 2)) decimal //= 2 print(sign + binary.join(digits))
# Copyright (c) 2019 Pavel Vavruska # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, d...
class Map: def __init__(self): self.__map_base = [[10, 10, 10, 10, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 14, 14, 14, 14, 14, 14], [10, -1, 0, -1, -1, 10, 12, -1, -1, -1, -1, -1, -1, 12, 14, -1, -1, -1, -1, 14], [10, -1, -1, -1, -1, 10, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 14], [10, -1, -1,...
dict={11:"th", 12:"th", 13:"th", 1:"st", 2:"nd", 3:"rd"} def what_century(year): year=str(year) century=int(year[:2])+1 if year[-2:]!="00" else int(year[:2]) if century in dict: return f"{century}{dict[century]}" elif century%10 in dict: return f"{century}{dict[century%10]}" return f...
dict = {11: 'th', 12: 'th', 13: 'th', 1: 'st', 2: 'nd', 3: 'rd'} def what_century(year): year = str(year) century = int(year[:2]) + 1 if year[-2:] != '00' else int(year[:2]) if century in dict: return f'{century}{dict[century]}' elif century % 10 in dict: return f'{century}{dict[century...
""" @author: Maneesh D @date: May 15, 2017 @interpreter: Python 3.6.1 Fahrenheit to Celcius Converter """ fahren = float(input("Enter the temperature in Fahrenheit: ")) celcius = ((fahren - 32) * 5) / 9 print("%.2f in Degree Celcius is %.2f" % (fahren, celcius))
""" @author: Maneesh D @date: May 15, 2017 @interpreter: Python 3.6.1 Fahrenheit to Celcius Converter """ fahren = float(input('Enter the temperature in Fahrenheit: ')) celcius = (fahren - 32) * 5 / 9 print('%.2f in Degree Celcius is %.2f' % (fahren, celcius))
class EdgeType(Enum): """Enumeration of different causal edges. Categories ---------- bidirected : str Signifies edge is part of a "<->" edge. arrow : str Signifies ">", or "<" edge. That is a normal directed edge. circle : str Signifies "o" endpoint. That is an...
class Edgetype(Enum): """Enumeration of different causal edges. Categories ---------- bidirected : str Signifies edge is part of a "<->" edge. arrow : str Signifies ">", or "<" edge. That is a normal directed edge. circle : str Signifies "o" endpoint. That is an ...
class common(object): """description of class""" def generateData(dat): updateDic = { "Cartisian.position.x":dat['Cartisian[position][x]'], "Cartisian.position.y":dat['Cartisian[position][y]'], "Cartisian.position.z":dat['Cartisian[position][z]'], "Cartisia...
class Common(object): """description of class""" def generate_data(dat): update_dic = {'Cartisian.position.x': dat['Cartisian[position][x]'], 'Cartisian.position.y': dat['Cartisian[position][y]'], 'Cartisian.position.z': dat['Cartisian[position][z]'], 'Cartisian.orientation.x': dat['Cartisian[orientati...