content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# -*- python -*- load( "//tools/workspace/lcm:lcm.bzl", "lcm_cc_library", "lcm_java_library", "lcm_py_library", ) load( "@drake//tools/skylark:drake_cc.bzl", "drake_installed_headers", "installed_headers_for_drake_deps", ) def drake_lcm_cc_library( name, deps = [], ...
load('//tools/workspace/lcm:lcm.bzl', 'lcm_cc_library', 'lcm_java_library', 'lcm_py_library') load('@drake//tools/skylark:drake_cc.bzl', 'drake_installed_headers', 'installed_headers_for_drake_deps') def drake_lcm_cc_library(name, deps=[], tags=[], strip_include_prefix=None, **kwargs): """A wrapper to insert Drake...
# copybara:strip_for_google3_begin def pyproto_test_wrapper(name): src = name + "_wrapper.py" native.py_test( name = name, srcs = [src], legacy_create_init = False, main = src, data = ["@com_google_protobuf//:testdata"], deps = [ "//python:message_ext...
def pyproto_test_wrapper(name): src = name + '_wrapper.py' native.py_test(name=name, srcs=[src], legacy_create_init=False, main=src, data=['@com_google_protobuf//:testdata'], deps=['//python:message_ext', '@com_google_protobuf//:python_common_test_protos', '@com_google_protobuf//:python_specific_test_protos', '...
class History: def __init__(self): self.HistoryVector = [] def Add(self, action, observation=-1, state=None): self.HistoryVector.append(ENTRY(action, observation, state)) def GetVisitedStates(self): states = [] if self.HistoryVector: for history in sel...
class History: def __init__(self): self.HistoryVector = [] def add(self, action, observation=-1, state=None): self.HistoryVector.append(entry(action, observation, state)) def get_visited_states(self): states = [] if self.HistoryVector: for history in self.Histo...
#!/usr/bin/python # -*- coding: UTF-8 -*- # Given a 32-bit signed integer, reverse digits of an integer. class Solution: max32BitsNum = 1 << 31 def reverse(self, x): """ :type x: int :rtype: int """ if x > Solution.max32BitsNum - 1 or x < -Solution.max32BitsNum: ...
class Solution: max32_bits_num = 1 << 31 def reverse(self, x): """ :type x: int :rtype: int """ if x > Solution.max32BitsNum - 1 or x < -Solution.max32BitsNum: return 0 if x > -10 and x < 10: return x is_neg = False if x < ...
# # Copyright 2018 Asylo authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
"""Provides a function to look up a toolchain installation path.""" def _fail_if_directory_does_not_exist(repository_ctx, path, what): result = repository_ctx.execute(['test', '-d', path]) if result.return_code == 0: return path fail('Install path to ' + what + ' does not exist: ' + path) def _try...
_FONT = { 32: [10, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575], 33: [10, 1048575, 1048575, 1048575, 1048575, 1044735, 1044735, 1044735, 1044735, 1044735, 1044735, 1044735, 1048575, 104...
_font = {32: [10, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575, 1048575], 33: [10, 1048575, 1048575, 1048575, 1048575, 1044735, 1044735, 1044735, 1044735, 1044735, 1044735, 1044735, 1048575, 1048...
""" 335 / 335 test cases passed. Status: Accepted Runtime: 40 ms """ class Solution: def checkPossibility(self, nums: List[int]) -> bool: cnt = 0 for i in range(1, len(nums)): if nums[i - 1] > nums[i]: cnt += 1 if cnt > 1: return False ...
""" 335 / 335 test cases passed. Status: Accepted Runtime: 40 ms """ class Solution: def check_possibility(self, nums: List[int]) -> bool: cnt = 0 for i in range(1, len(nums)): if nums[i - 1] > nums[i]: cnt += 1 if cnt > 1: return Fal...
# Problem: Implement a 3 stack # Algorithm for n-stacks using dynamic arrays (list) # Stack: LIFO (Last In First Out) # pop from top and push to top # data = our dynamic array # Maintain tops array for n-number of stacks and initialize to -1 # Maintain lengths for each stack. # Push(stack, value) # Check i...
class Nstack: def __init__(self, n=3): self.data = [] self.tops = [] self.lengths = [] for i in range(n): self.tops.append(-1) self.lengths.append(0) def push(self, stack, value): if self.tops[stack] == -1: self.data.append(value) ...
#User gives input and loop continues until user keeps entering even numbers Evennumber=0; while(Evennumber%2==0): print("Let me check if the entered number is even or not"); Evennumber=int(input()); if(Evennumber%2==0): print("Number enter is even"); if(Evennumber%2!=0): print("You hav...
evennumber = 0 while Evennumber % 2 == 0: print('Let me check if the entered number is even or not') evennumber = int(input()) if Evennumber % 2 == 0: print('Number enter is even') if Evennumber % 2 != 0: print('You have not entered the Even number') continue
arquivo = open('exemplo.txt', 'r', encoding='utf8') for linha in arquivo: print(linha.strip()) arquivo.close()
arquivo = open('exemplo.txt', 'r', encoding='utf8') for linha in arquivo: print(linha.strip()) arquivo.close()
def bonAppetit(bill, k, b): rest = b - int((sum(bill) - bill[k]) / 2) if rest != 0: print(rest) else: print('Bon Appetit') return
def bon_appetit(bill, k, b): rest = b - int((sum(bill) - bill[k]) / 2) if rest != 0: print(rest) else: print('Bon Appetit') return
"""Setup constants, ymmv.""" PIN_MEMORY = True NON_BLOCKING = True BENCHMARK = True MAX_THREADING = 40 SHARING_STRATEGY = 'file_descriptor' # file_system or file_descriptor DEBUG_TRAINING = False DISTRIBUTED_BACKEND = 'gloo' # nccl would be faster, but require gpu-transfers for indexing and stuff cifar10_mean = [...
"""Setup constants, ymmv.""" pin_memory = True non_blocking = True benchmark = True max_threading = 40 sharing_strategy = 'file_descriptor' debug_training = False distributed_backend = 'gloo' cifar10_mean = [0.4914672374725342, 0.4822617471218109, 0.4467701315879822] cifar10_std = [0.24703224003314972, 0.24348513782024...
"""Provide exceptions to be raised by the `dynamic_models` app. All exceptions inherit from a `DynamicModelError` base class. """ class DynamicModelError(Exception): """Base exception for use in dynamic models.""" class OutdatedModelError(DynamicModelError): """Raised when a model's schema is outdated on s...
"""Provide exceptions to be raised by the `dynamic_models` app. All exceptions inherit from a `DynamicModelError` base class. """ class Dynamicmodelerror(Exception): """Base exception for use in dynamic models.""" class Outdatedmodelerror(DynamicModelError): """Raised when a model's schema is outdated on sav...
prices = {} quantities = {} while True: tokens = input() if tokens == 'buy': break else: tokens = tokens.split(" ") product = tokens[0] price = float(tokens[1]) quantity = int(tokens[2]) prices[product] = price if product not in quantities: quantitie...
prices = {} quantities = {} while True: tokens = input() if tokens == 'buy': break else: tokens = tokens.split(' ') product = tokens[0] price = float(tokens[1]) quantity = int(tokens[2]) prices[product] = price if product not in quantities: quantities[...
def addFriendship(d, u1, u2): if u1 not in d: d[u1] = [u2] else: x = d[u1] x.append(u2) d[u1] = x inFile = open("friendship.txt", "r") d = {} for line in inFile: infos = line.split("\t") user1 = int(infos[0]) user2 = int(infos[1].replace("\n", "")) ...
def add_friendship(d, u1, u2): if u1 not in d: d[u1] = [u2] else: x = d[u1] x.append(u2) d[u1] = x in_file = open('friendship.txt', 'r') d = {} for line in inFile: infos = line.split('\t') user1 = int(infos[0]) user2 = int(infos[1].replace('\n', '')) add_friendshi...
#Make a menu driven program to accept, delete and display the following data stored in a dictionary. #Book_Id.........string #Book_Name.... string #Price......float #Discount...int #The program should continue as long as the user wishes to. At one point of time, I should be able to view minimum 3 records. class P...
class Product: def get_product(self): self.book_id = input('Enter book ID: ') self.name_of_book = input('Enter Name : ') global price_of_books price_of_books = int(input('Enter book Price of books : ')) disc = 0 if price_of_books >= 500: disc = 100 ...
""" Module: 'usocket' on esp8266 v1.11 """ # MCU: (sysname='esp8266', nodename='esp8266', release='2.2.0-dev(9422289)', version='v1.11-8-g48dcbbe60 on 2019-05-29', machine='ESP module with ESP8266') # Stubber: 1.1.0 AF_INET = 2 AF_INET6 = 10 IPPROTO_IP = 0 IP_ADD_MEMBERSHIP = 1024 SOCK_DGRAM = 2 SOCK_RAW = 3 SOCK_STREA...
""" Module: 'usocket' on esp8266 v1.11 """ af_inet = 2 af_inet6 = 10 ipproto_ip = 0 ip_add_membership = 1024 sock_dgram = 2 sock_raw = 3 sock_stream = 1 sol_socket = 1 so_reuseaddr = 4 def callback(): pass def getaddrinfo(): pass def print_pcbs(): pass def reset(): pass class Socket: """""" ...
# N digit numbers with digit sum S # https://www.interviewbit.com/problems/n-digit-numbers-with-digit-sum-s-/ # # Find out the number of N digit numbers, whose digits on being added equals to a given number S. # Note that a valid number starts from digits 1-9 except the number 0 itself. i.e. leading # zeroes are not al...
class Solution: def solve(self, N, S): arr = [[0] * (S + 1) for _ in range(N + 1)] arr[0][0] = 1 for n in range(N): for s in range(S): for digit in range(10): if s + digit <= S: arr[n + 1][s + digit] += arr[n][s] ...
# -*- coding: utf-8 -*- def print_logo(): """ ___ __ __ _ __ / _ \___ ___/ / / / (_)__ / /_ / , _/ -_) _ / / /__/ (_-</ __/ /_/|_|\__/\_,_/ /____/_/___/\__/ by Team Avengers MIT LICENSE """ print(" ___ __ __ _ __ \n / _ \___ ___/ / / / (_)__ / /_\n / , _/ -_) _ / / ...
def print_logo(): """ ___ __ __ _ __ / _ \\___ ___/ / / / (_)__ / /_ / , _/ -_) _ / / /__/ (_-</ __/ /_/|_|\\__/\\_,_/ /____/_/___/\\__/ by Team Avengers MIT LICENSE """ print(' ___ __ __ _ __ \n / _ \\___ ___/ / / / (_)__ / /_\n / , _/ -_) _ / / /__/ (_-</ __/\...
class FizzBuzz(object): def say(self, number): if number % 3 == 0 and number % 5 == 0: return 'FizzBuzz' elif number % 3 == 0: return 'Fizz' elif number % 5 == 0: return 'Buzz' else: return number
class Fizzbuzz(object): def say(self, number): if number % 3 == 0 and number % 5 == 0: return 'FizzBuzz' elif number % 3 == 0: return 'Fizz' elif number % 5 == 0: return 'Buzz' else: return number
# -*- coding: utf-8 -*- __title__ = 'amicleaner' __version__ = '0.2.0' __short_version__ = '.'.join(__version__.split('.')[:2]) __author__ = 'Guy Rodrigue Koffi' __author_email__ = 'koffirodrigue@gmail.com' __license__ = 'MIT'
__title__ = 'amicleaner' __version__ = '0.2.0' __short_version__ = '.'.join(__version__.split('.')[:2]) __author__ = 'Guy Rodrigue Koffi' __author_email__ = 'koffirodrigue@gmail.com' __license__ = 'MIT'
#-*- coding: utf-8 -*- spam = 65 # an integer declaration. print(spam) print(type(spam)) # this is a function call eggs = 2 print(eggs) print(type(eggs)) # Let's see the numeric operations print(spam + eggs) # sum print(spam - eggs) # difference print(spam * eggs...
spam = 65 print(spam) print(type(spam)) eggs = 2 print(eggs) print(type(eggs)) print(spam + eggs) print(spam - eggs) print(spam * eggs) print(spam / eggs) print(spam % eggs) print(spam ** eggs) fooo = -2 print(fooo) print(type(fooo)) print(-fooo) print(abs(fooo)) print(int(fooo)) print(float(fooo)) fooo += 1 print(fooo...
#!/usr/bin/env python # created by Bruce Yuan on 17-11-27 class ConstError(Exception): def __init__(self, message): self._message = str(message) def __str__(self): return self._message __repr__ = __str__
class Consterror(Exception): def __init__(self, message): self._message = str(message) def __str__(self): return self._message __repr__ = __str__
banyakPerulangan = 10 i = 0 while (i < banyakPerulangan): print('Hello World') i += 1
banyak_perulangan = 10 i = 0 while i < banyakPerulangan: print('Hello World') i += 1
class Solution: def sortSentence(self, s: str) -> str: s=s.split() s.sort(key = lambda x: x[-1]) sent="" for i in s: sent += (i[:-1]+" ") s=sent.strip() return s
class Solution: def sort_sentence(self, s: str) -> str: s = s.split() s.sort(key=lambda x: x[-1]) sent = '' for i in s: sent += i[:-1] + ' ' s = sent.strip() return s
a=10 b=20 print(b-a) print("SUBTRACTED b-a")
a = 10 b = 20 print(b - a) print('SUBTRACTED b-a')
# Copyright 2016 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. { 'targets': [ { 'target_name': 'camera', 'dependencies': [ '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:load_time_data',...
{'targets': [{'target_name': 'camera', 'dependencies': ['<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:load_time_data', '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:util'], 'includes': ['../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'change_picture', 'dependencies'...
""" PERIODS """ numPeriods = 180 """ STOPS """ numStations = 13 station_names = ( "Hamburg Hbf", # 0 "Landwehr", # 1 "Hasselbrook", # 2 "Wansbeker Chaussee*", # 3 "Friedrichsberg*", # 4 "Barmbek*", # 5 "Alte Woehr (Stadtpark)", # 6 "Ruebenkamp (City Nord)", # 7 "Ohlsdorf*", # 8 "Kornweg", # 9 ...
""" PERIODS """ num_periods = 180 '\nSTOPS\n' num_stations = 13 station_names = ('Hamburg Hbf', 'Landwehr', 'Hasselbrook', 'Wansbeker Chaussee*', 'Friedrichsberg*', 'Barmbek*', 'Alte Woehr (Stadtpark)', 'Ruebenkamp (City Nord)', 'Ohlsdorf*', 'Kornweg', 'Hoheneichen', 'Wellingsbuettel', 'Poppenbuettel*') num_stops = 26 ...
print("Rock..Paper..Scissors..") print("Type rock or paper or scissors") player1 = input("player 1, Your move: ") player2 = input("player 2, Your move: ") if player1 == player2: print("It's a draw!") elif player1 == "rock": if player2 == "scissors": print("player1 wins!") elif player2 == "paper": print...
print('Rock..Paper..Scissors..') print('Type rock or paper or scissors') player1 = input('player 1, Your move: ') player2 = input('player 2, Your move: ') if player1 == player2: print("It's a draw!") elif player1 == 'rock': if player2 == 'scissors': print('player1 wins!') elif player2 == 'paper': ...
ATTR_CODE = "auth_code" CONF_MQTT_IN = "mqtt_in" CONF_MQTT_OUT = "mqtt_out" DATA_KEY = "media_player.hisense_tv" DEFAULT_CLIENT_ID = "HomeAssistant" DEFAULT_MQTT_PREFIX = "hisense" DEFAULT_NAME = "Hisense TV" DOMAIN = "hisense_tv"
attr_code = 'auth_code' conf_mqtt_in = 'mqtt_in' conf_mqtt_out = 'mqtt_out' data_key = 'media_player.hisense_tv' default_client_id = 'HomeAssistant' default_mqtt_prefix = 'hisense' default_name = 'Hisense TV' domain = 'hisense_tv'
class Solution: def mergeAlternately(self, word1: str, word2: str) -> str: first, second = len(word1), len(word2) result = "" for one, two in zip(word1, word2): result += one + two diff = first - second if not diff: return result elif diff > 0...
class Solution: def merge_alternately(self, word1: str, word2: str) -> str: (first, second) = (len(word1), len(word2)) result = '' for (one, two) in zip(word1, word2): result += one + two diff = first - second if not diff: return result elif d...
matches = 0 for line in open('2/input.txt'): acceptable_range, letter, password = line.split(" ") low, high = acceptable_range.split("-") count = password.count(letter[0]) if count in range(int(low), int(high)+1): matches += 1 print(matches)
matches = 0 for line in open('2/input.txt'): (acceptable_range, letter, password) = line.split(' ') (low, high) = acceptable_range.split('-') count = password.count(letter[0]) if count in range(int(low), int(high) + 1): matches += 1 print(matches)
class Solution: def countNegatives(self, grid: List[List[int]]) -> int: count = 0 for row in grid: for c in row: if c < 0: count += 1 return count
class Solution: def count_negatives(self, grid: List[List[int]]) -> int: count = 0 for row in grid: for c in row: if c < 0: count += 1 return count
class MyHashSet: def __init__(self): self.set = [False] * 1000001 def add(self, key: int) -> None: self.set[key] = True def remove(self, key: int) -> None: self.set[key] = False def contains(self, key: int) -> bool: return self.set[key]
class Myhashset: def __init__(self): self.set = [False] * 1000001 def add(self, key: int) -> None: self.set[key] = True def remove(self, key: int) -> None: self.set[key] = False def contains(self, key: int) -> bool: return self.set[key]
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
def create_healthcareapis(cmd, client, resource_group, name, kind, location, access_policies_object_id, tags=None, etag=None, cosmos_db_offer_throughput=None, authentication_authority=None, authentication_audience=None, authentication_smart_proxy_enabled=None, cors_origins=None, cors_headers=None, cors_methods=None, co...
''' import cachetools from . import lang enabled = True maxsize = 1000 scriptures = {} for each in lang.available: scriptures[each] = cachetools.LRUCache(maxsize=maxsize) '''
""" import cachetools from . import lang enabled = True maxsize = 1000 scriptures = {} for each in lang.available: scriptures[each] = cachetools.LRUCache(maxsize=maxsize) """
class Solution: def mySqrt(self, x: int) -> int: low=0 high=x middle= (low+high)//2 while(high>middle and middle>low): square=middle*middle if (square==x): return int(middle) if (square>x): high=middle el...
class Solution: def my_sqrt(self, x: int) -> int: low = 0 high = x middle = (low + high) // 2 while high > middle and middle > low: square = middle * middle if square == x: return int(middle) if square > x: high = m...
# -*- coding:utf-8 -*- ''' File: templates.py File Created: Tuesday, 12th February 2019 Author: Hongzoeng Ng (kenecho@hku.hk) ----- Last Modified: Tuesday, 12th February 2019 Modified By: Hongzoeng Ng (kenecho@hku.hk>) ----- Copyright @ 2018 KenEcho ''' moving_average_code = """# Moving average strategy start = '%s' e...
""" File: templates.py File Created: Tuesday, 12th February 2019 Author: Hongzoeng Ng (kenecho@hku.hk) ----- Last Modified: Tuesday, 12th February 2019 Modified By: Hongzoeng Ng (kenecho@hku.hk>) ----- Copyright @ 2018 KenEcho """ moving_average_code = '# Moving average strategy\nstart = \'%s\'\nend = \'%s\'\nuniverse ...
print("Podaj a:") a = int(input()) print("Podaj b:") b = int(input()) print("A") if a > b else print("=") if a == b else print("B")
print('Podaj a:') a = int(input()) print('Podaj b:') b = int(input()) print('A') if a > b else print('=') if a == b else print('B')
def get_user_access_token(): """Get the secret access token of the currently-logged-in Microsoft user, for use with the Microsoft REST API. Requires this app to have its own Microsoft client ID and secret. """ pass def get_user_email(): """Get the email address of the currently-logged-in Microsoft use...
def get_user_access_token(): """Get the secret access token of the currently-logged-in Microsoft user, for use with the Microsoft REST API. Requires this app to have its own Microsoft client ID and secret. """ pass def get_user_email(): """Get the email address of the currently-logged-in Microsoft user...
class DB: ''' Convience class for decibel scale. Other non-linear scales such as the richter scale could be handled similarly. Usage: dB = DB() . . (later) . gain = 15 * dB ''' def __rmul__(self, val): ''' Only allow multiplication from the right to avoid confus...
class Db: """ Convience class for decibel scale. Other non-linear scales such as the richter scale could be handled similarly. Usage: dB = DB() . . (later) . gain = 15 * dB """ def __rmul__(self, val): """ Only allow multiplication from the right to avoid confu...
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
dogfood_rm_endpoint = 'https://api-dogfood.resources.windows-int.net/' helm__environment__file__fault__type = 'helm-environment-file-error' invalid__location__fault__type = 'location-validation-error' load__kubeconfig__fault__type = 'kubeconfig-load-error' read__config_map__fault__type = 'configmap-read-error' get__res...
""" GOST R 34.10-20** digital signature implementation This module implements Weierstrass elliptic curves (class elliptic_curve), and GOST R 34.10-20** digital signature: generation, verification, test and various supplemental stuff """
""" GOST R 34.10-20** digital signature implementation This module implements Weierstrass elliptic curves (class elliptic_curve), and GOST R 34.10-20** digital signature: generation, verification, test and various supplemental stuff """
class Solution: def maxProfit(self, k: int, prices: List[int]) -> int: n, res = len(prices), 0 if n < 2: return 0 if k > n // 2: for i in range(1, n): if prices[i] > prices[i - 1]: res += prices[i] - prices[i - 1] return...
class Solution: def max_profit(self, k: int, prices: List[int]) -> int: (n, res) = (len(prices), 0) if n < 2: return 0 if k > n // 2: for i in range(1, n): if prices[i] > prices[i - 1]: res += prices[i] - prices[i - 1] ...
def proper_divisors_sum(n): return sum(a for a in xrange(1, n) if not n % a) def amicable_numbers(a, b): return proper_divisors_sum(a) == b and proper_divisors_sum(b) == a # def amicable_numbers(a, b): # # this works after multiple submissions to get lucky on random inputs # return sum(c for c in xr...
def proper_divisors_sum(n): return sum((a for a in xrange(1, n) if not n % a)) def amicable_numbers(a, b): return proper_divisors_sum(a) == b and proper_divisors_sum(b) == a
# -*- coding: utf-8 -*- """ Created on Sat Sep 4 11:19:30 2021 @author: Easin """ in1 = input().split() list1 = [] for elem in range(len(in1)): list1.append(int(in1[elem])) #print(list1) maxm = max(list1) list2=[] for val in range(len(list1)): if list1[val] != maxm: out = maxm - lis...
""" Created on Sat Sep 4 11:19:30 2021 @author: Easin """ in1 = input().split() list1 = [] for elem in range(len(in1)): list1.append(int(in1[elem])) maxm = max(list1) list2 = [] for val in range(len(list1)): if list1[val] != maxm: out = maxm - list1[val] list2.append(out) print(out)
def save_to_file(data: list, filename: str): """Save to file.""" with open(f"{filename}", "w") as f: for item_ in data: f.write("%s\n" % item_)
def save_to_file(data: list, filename: str): """Save to file.""" with open(f'{filename}', 'w') as f: for item_ in data: f.write('%s\n' % item_)
MESSAGE_TIMESPAN = 2000 SIMULATED_DATA = False I2C_ADDRESS = 0x77 GPIO_PIN_ADDRESS = 24 BLINK_TIMESPAN = 1000
message_timespan = 2000 simulated_data = False i2_c_address = 119 gpio_pin_address = 24 blink_timespan = 1000
"""Meta variables for SkLite""" __title__ = "sklite" __version__ = "0.0.2" __description__ = "Use Scikit Learn models in Flutter" __url__ = "https://github.com/axegon/sklite" __author__ = "Alexander Ejbekov" __author_email__ = "alexander@kialo.ai" __license__ = "MIT" __compat__ = "0.0.1"
"""Meta variables for SkLite""" __title__ = 'sklite' __version__ = '0.0.2' __description__ = 'Use Scikit Learn models in Flutter' __url__ = 'https://github.com/axegon/sklite' __author__ = 'Alexander Ejbekov' __author_email__ = 'alexander@kialo.ai' __license__ = 'MIT' __compat__ = '0.0.1'
pkgname = "evolution-data-server" pkgver = "3.44.0" pkgrel = 0 build_style = "cmake" # TODO: libgdata configure_args = [ "-DENABLE_GOOGLE=OFF", "-DWITH_LIBDB=OFF", "-DSYSCONF_INSTALL_DIR=/etc", "-DENABLE_INTROSPECTION=ON", "-DENABLE_VALA_BINDINGS=ON", ] hostmakedepends = [ "cmake", "ninja", "pkgconf", "...
pkgname = 'evolution-data-server' pkgver = '3.44.0' pkgrel = 0 build_style = 'cmake' configure_args = ['-DENABLE_GOOGLE=OFF', '-DWITH_LIBDB=OFF', '-DSYSCONF_INSTALL_DIR=/etc', '-DENABLE_INTROSPECTION=ON', '-DENABLE_VALA_BINDINGS=ON'] hostmakedepends = ['cmake', 'ninja', 'pkgconf', 'flex', 'glib-devel', 'gperf', 'gobjec...
budget = float(input()) name = "Hello, there!" count = 0 diff_count = 0 fee = 0 while True: name = input() if name == "Stop": print(f"You bought {count} products for {fee:.2f} leva.") break price = float(input()) diff_count += 1 if diff_count%3 == 0: price = price / 2 if ...
budget = float(input()) name = 'Hello, there!' count = 0 diff_count = 0 fee = 0 while True: name = input() if name == 'Stop': print(f'You bought {count} products for {fee:.2f} leva.') break price = float(input()) diff_count += 1 if diff_count % 3 == 0: price = price / 2 i...
'''Taking the input of CIPHERTEXT from the user and removing UNWANTED CHARACTERS and/or WHITESPACES''' Input = input("Enter ciphertext:") Input = Input.upper() NotRecog = '''`~1234567890!@#$%^&*()-_=+[{]}\|'";:.>/?,< ''' for i in Input: if i in NotRecog: Input = Input.replace(i,'') '''Taking the input of K...
"""Taking the input of CIPHERTEXT from the user and removing UNWANTED CHARACTERS and/or WHITESPACES""" input = input('Enter ciphertext:') input = Input.upper() not_recog = '`~1234567890!@#$%^&*()-_=+[{]}\\|\'";:.>/?,< ' for i in Input: if i in NotRecog: input = Input.replace(i, '') 'Taking the input of KEY ...
class Geometric: def Area(self, x, y): return x * y
class Geometric: def area(self, x, y): return x * y
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- # """ Legal content, should offer a lot of fun to write, this is not used so far """ __version__ = '4.0' content = { 'classified_headline':( 'Commercial Rentals', 'Business Opportunities', 'Bed & Breakfast', 'Year Round Rentals', 'Winter Ren...
""" Legal content, should offer a lot of fun to write, this is not used so far """ __version__ = '4.0' content = {'classified_headline': ('Commercial Rentals', 'Business Opportunities', 'Bed & Breakfast', 'Year Round Rentals', 'Winter Rentals', 'Apartments/Rooms', 'Vacation/Summer Rentals', 'Off-Island Rentals', 'Renta...
# Solution to day 10 of AOC 2015, Elves Look, Elves Say # https://adventofcode.com/2015/day/10 new_sequence = '1113222113' for i in range(50): print('i, len(new_sequence)', i, len(new_sequence)) sequence = new_sequence run_digit = None run_length = 0 new_sequence = '' for head in sequence: ...
new_sequence = '1113222113' for i in range(50): print('i, len(new_sequence)', i, len(new_sequence)) sequence = new_sequence run_digit = None run_length = 0 new_sequence = '' for head in sequence: if run_digit is not None and run_digit != head: new_sequence = new_sequence + st...
# Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. # # Symbol Value # I 1 # V 5 # X 10 # L 50 # C 100 # D 500 # M 1000 # For example, two is written as II in Roman numeral, just two one's added to...
class Solution(object): def int_to_roman(self, num): """ :type num: int :rtype: str """ total = '' while num >= 1000: total += 'M' num -= 1000 if 899 < num <= 999: total += 'CM' num -= 900 if 500 <= num ...
class Solution: def mergeInBetween(self, list1: ListNode, a: int, b: int, list2: ListNode) -> ListNode: head = list1 for i in range(a - 1): list1 = list1.next a_1 = list1 for i in range(b - a + 1): list1 = list1.next b_1 = list1.next list1.next...
class Solution: def merge_in_between(self, list1: ListNode, a: int, b: int, list2: ListNode) -> ListNode: head = list1 for i in range(a - 1): list1 = list1.next a_1 = list1 for i in range(b - a + 1): list1 = list1.next b_1 = list1.next list1.n...
# problem3.py # The prime factors of 13195 are 5, 7, 13 and 29. # What is the largest prime factor of the number 600851475143 ? number = 600851475143 divider = 2 while number != 1: if number % divider == 0: number = number / divider print(divider) else: divider += 1
number = 600851475143 divider = 2 while number != 1: if number % divider == 0: number = number / divider print(divider) else: divider += 1
class Solution: # Accumulator List (Accepted), O(n) time and space def waysToMakeFair(self, nums: List[int]) -> int: acc = [] is_even = True n = len(nums) for i in range(n): even, odd = acc[i-1] if i > 0 else (0, 0) if is_even: even += nums...
class Solution: def ways_to_make_fair(self, nums: List[int]) -> int: acc = [] is_even = True n = len(nums) for i in range(n): (even, odd) = acc[i - 1] if i > 0 else (0, 0) if is_even: even += nums[i] else: odd += nu...
#!/usr/bin/python3 def list_division(my_list_1, my_list_2, list_length): idx = 0 results = [] error = None while list_division and idx < list_length: try: results.append(my_list_1[idx] / my_list_2[idx]) except ZeroDivisionError: error = "division by 0" ...
def list_division(my_list_1, my_list_2, list_length): idx = 0 results = [] error = None while list_division and idx < list_length: try: results.append(my_list_1[idx] / my_list_2[idx]) except ZeroDivisionError: error = 'division by 0' results.append(0) ...
class Solution(object): def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ length = len(prices) if length == 0: return 0 max_profit, low = 0, prices[0] for i in range(1, length): if low > prices[i]: ...
class Solution(object): def max_profit(self, prices): """ :type prices: List[int] :rtype: int """ length = len(prices) if length == 0: return 0 (max_profit, low) = (0, prices[0]) for i in range(1, length): if low > prices[i]: ...
# Section 6.2.5 snippets country_capitals1 = {'Belgium': 'Brussels', 'Haiti': 'Port-au-Prince'} country_capitals2 = {'Nepal': 'Kathmandu', 'Uruguay': 'Montevideo'} country_capitals3 = {'Haiti': 'Port-au-Prince', ...
country_capitals1 = {'Belgium': 'Brussels', 'Haiti': 'Port-au-Prince'} country_capitals2 = {'Nepal': 'Kathmandu', 'Uruguay': 'Montevideo'} country_capitals3 = {'Haiti': 'Port-au-Prince', 'Belgium': 'Brussels'} country_capitals1 == country_capitals2 country_capitals1 == country_capitals3 country_capitals1 != country_cap...
class BitmexDataIterator(): def __init__(self,data): self._data = data self._index = 0 def __next__(self): pass class BitmexDataStructure(): """ Data Object for Bitmex data manipulation """ def __init__(self,symbol,use_compression=False): self._symbol = symbol...
class Bitmexdataiterator: def __init__(self, data): self._data = data self._index = 0 def __next__(self): pass class Bitmexdatastructure: """ Data Object for Bitmex data manipulation """ def __init__(self, symbol, use_compression=False): self._symbol = symbol ...
N = int(input()) Y = 0 for _ in range(N): t = input().split() x = float(t[0]) u = t[1] if u == 'JPY': Y += x elif u == 'BTC': Y += x * 380000.0 print(Y)
n = int(input()) y = 0 for _ in range(N): t = input().split() x = float(t[0]) u = t[1] if u == 'JPY': y += x elif u == 'BTC': y += x * 380000.0 print(Y)
def reverse(x: int) -> int: neg = x < 0 if neg: x *= -1 result = 0 while x: result = result * 10 + x % 10 x //= 10 return result if not neg else -1 * result assert reverse(123) == 321 assert reverse(-123) == -321
def reverse(x: int) -> int: neg = x < 0 if neg: x *= -1 result = 0 while x: result = result * 10 + x % 10 x //= 10 return result if not neg else -1 * result assert reverse(123) == 321 assert reverse(-123) == -321
class ParenthesizePropertyNameAttribute(Attribute,_Attribute): """ Indicates whether the name of the associated property is displayed with parentheses in the Properties window. This class cannot be inherited. ParenthesizePropertyNameAttribute() ParenthesizePropertyNameAttribute(needParenthesis: bool) ""...
class Parenthesizepropertynameattribute(Attribute, _Attribute): """ Indicates whether the name of the associated property is displayed with parentheses in the Properties window. This class cannot be inherited. ParenthesizePropertyNameAttribute() ParenthesizePropertyNameAttribute(needParenthesis: bool) """ ...
matriz = [[], [], []] for i in range(0, 3): matriz[0].append(int(input(f'Digite um valor para [{0}, {i}]: '))) for i in range(0, 3): matriz[1].append(int(input(f'Digite um valor para [{1}, {i}]: '))) for i in range(0, 3): matriz[2].append(int(input(f'Digite um valor para [{2}, {i}]: '))) print(f'{matriz[0]}...
matriz = [[], [], []] for i in range(0, 3): matriz[0].append(int(input(f'Digite um valor para [{0}, {i}]: '))) for i in range(0, 3): matriz[1].append(int(input(f'Digite um valor para [{1}, {i}]: '))) for i in range(0, 3): matriz[2].append(int(input(f'Digite um valor para [{2}, {i}]: '))) print(f'{matriz[0]}...
r"""Psuedo-spectral implementations of some useful equations In PsDNS, equations are represented as class objects that implement a :meth:`rhs` method. The :meth:`rhs` method takes one argument, *uhat*, which is the solution vector, normally in spectral space expressed as a :class:`~psdns.bases.SpectralArray`, and it ...
"""Psuedo-spectral implementations of some useful equations In PsDNS, equations are represented as class objects that implement a :meth:`rhs` method. The :meth:`rhs` method takes one argument, *uhat*, which is the solution vector, normally in spectral space expressed as a :class:`~psdns.bases.SpectralArray`, and it r...
class Solution: def __init__(self): self.map = {} def cloneGraph(self, node): if node is None: return None next = UndirectedGraphNode(node.label) self.map[str(node.label)] = next for tmp in node.neighbors: if str(tmp.label) in self.map: ...
class Solution: def __init__(self): self.map = {} def clone_graph(self, node): if node is None: return None next = undirected_graph_node(node.label) self.map[str(node.label)] = next for tmp in node.neighbors: if str(tmp.label) in self.map: ...
""" Package used by tests. """ C = 3
""" Package used by tests. """ c = 3
#!/usr/bin/env python3 """ Copyright (c) 2017-present, Facebook, Inc. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. """ PREFIX = "__osc_" OUTFILE_TABLE = "__osc_tbl_" OUTFILE_EXCLUDE_ID = "__osc_ex_" OUTFILE_INCLUDE_I...
""" Copyright (c) 2017-present, Facebook, Inc. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. """ prefix = '__osc_' outfile_table = '__osc_tbl_' outfile_exclude_id = '__osc_ex_' outfile_include_id = '__osc_in_' new_tabl...
with open('input.txt') as f: octopus = list(map(lambda line: list(map(int, line.strip())), f.readlines())) def print_grid(grid): for line in grid: print(''.join(map(str, line))) def update(grid): flash_count = 0 # increase all flashed = set() to_updates = [] for row in range(len(grid)): for col in range(l...
with open('input.txt') as f: octopus = list(map(lambda line: list(map(int, line.strip())), f.readlines())) def print_grid(grid): for line in grid: print(''.join(map(str, line))) def update(grid): flash_count = 0 flashed = set() to_updates = [] for row in range(len(grid)): for c...
# # PySNMP MIB module CISCO-FIPS-STATS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-FIPS-STATS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:41:23 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint) ...
N = int(input()) a = list(map(int, input().split())) s = float("inf") for i in range(min(a), max(a) + 1): t = 0 for j in a: t += (j - i) ** 2 s = min(s, t) print(s)
n = int(input()) a = list(map(int, input().split())) s = float('inf') for i in range(min(a), max(a) + 1): t = 0 for j in a: t += (j - i) ** 2 s = min(s, t) print(s)
class LoginBase(): freeTimeExpires = -1 def __init__(self, cr): self.cr = cr def sendLoginMsg(self, loginName, password, createFlag): pass def getErrorCode(self): return 0 def needToSetParentPassword(self): return 0
class Loginbase: free_time_expires = -1 def __init__(self, cr): self.cr = cr def send_login_msg(self, loginName, password, createFlag): pass def get_error_code(self): return 0 def need_to_set_parent_password(self): return 0
class RequiredClass: pass def main(): required = RequiredClass() print(required) if __name__ == '__main__': main()
class Requiredclass: pass def main(): required = required_class() print(required) if __name__ == '__main__': main()
def join_topic(part1: str, part2: str): p1 = part1.rstrip('/') p2 = part2.rstrip('/') return p1 + '/' + p2
def join_topic(part1: str, part2: str): p1 = part1.rstrip('/') p2 = part2.rstrip('/') return p1 + '/' + p2
# encoding: utf-8 class DropShadowFilter(object): def __init__(self, distance=4.0, angle=45.0, color=0, alpha=1.0, blurX=4.0, blurY=4.0, strength=1.0, quality=1, inner=False, knockout=False, hideObject=False): self._type = 'DropShadowFilter' self.dist...
class Dropshadowfilter(object): def __init__(self, distance=4.0, angle=45.0, color=0, alpha=1.0, blurX=4.0, blurY=4.0, strength=1.0, quality=1, inner=False, knockout=False, hideObject=False): self._type = 'DropShadowFilter' self.distance = distance self.angle = angle self.color = co...
# -*- coding: utf-8 -*- """ Created on Sat Feb 12 13:38:30 2022 @author: mlols """ def hk_modes(hier_num): """ Generate modes in the HK hierarchy. Parameters ---------- hier_num : int Number in the HK hierarchy (hier_num = n means the nth model). Returns ------- p_modes : li...
""" Created on Sat Feb 12 13:38:30 2022 @author: mlols """ def hk_modes(hier_num): """ Generate modes in the HK hierarchy. Parameters ---------- hier_num : int Number in the HK hierarchy (hier_num = n means the nth model). Returns ------- p_modes : list List of psi mo...
#!/usr/bin/env python3 class Solution: def setZeroes(self, matrix): nrow, ncol = len(matrix), len(matrix[0]) for i in range(nrow): for j in range(ncol): if matrix[i][j] == 0: matrix[i][j] = 'X' for k in range(ncol): ...
class Solution: def set_zeroes(self, matrix): (nrow, ncol) = (len(matrix), len(matrix[0])) for i in range(nrow): for j in range(ncol): if matrix[i][j] == 0: matrix[i][j] = 'X' for k in range(ncol): if matrix...
""" Class description goes here. """ """Exceptions classes used in dataclay.""" __author__ = 'Alex Barcelo <alex.barcelo@bsc.es>' __copyright__ = '2015 Barcelona Supercomputing Center (BSC-CNS)'
""" Class description goes here. """ 'Exceptions classes used in dataclay.' __author__ = 'Alex Barcelo <alex.barcelo@bsc.es>' __copyright__ = '2015 Barcelona Supercomputing Center (BSC-CNS)'
# Parameters BEHAVIORS = 'behaviors' STIMULUS_ELEMENTS = 'stimulus_elements' MECHANISM_NAME = 'mechanism' START_V = 'start_v' START_VSS = 'start_vss' START_W = 'start_w' ALPHA_V = 'alpha_v' ALPHA_VSS = 'alpha_vss' ALPHA_W = 'alpha_w' BETA = 'beta' MU = 'mu' DISCOUNT = 'discount' TRACE = 'trace' BEHAVIOR_COST = 'behavio...
behaviors = 'behaviors' stimulus_elements = 'stimulus_elements' mechanism_name = 'mechanism' start_v = 'start_v' start_vss = 'start_vss' start_w = 'start_w' alpha_v = 'alpha_v' alpha_vss = 'alpha_vss' alpha_w = 'alpha_w' beta = 'beta' mu = 'mu' discount = 'discount' trace = 'trace' behavior_cost = 'behavior_cost' u = '...
nums_str = [] with open("dane/dane.txt") as f: lines = [] for line in f: sline = line.strip() num = int(sline, 8) num_str = str(num) nums_str.append(num_str) count = 0 for num_str in nums_str: if num_str[0] == num_str[-1]: count += 1 print(f"{count=}")
nums_str = [] with open('dane/dane.txt') as f: lines = [] for line in f: sline = line.strip() num = int(sline, 8) num_str = str(num) nums_str.append(num_str) count = 0 for num_str in nums_str: if num_str[0] == num_str[-1]: count += 1 print(f'count={count!r}')
''' Provides utility functions for encoding and decoding linestrings using the Google encoded polyline algorithm. ''' def encode_coords(coords): ''' Encodes a polyline using Google's polyline algorithm See http://code.google.com/apis/maps/documentation/polylinealgorithm.html for more information. ...
""" Provides utility functions for encoding and decoding linestrings using the Google encoded polyline algorithm. """ def encode_coords(coords): """ Encodes a polyline using Google's polyline algorithm See http://code.google.com/apis/maps/documentation/polylinealgorithm.html for more information. ...
router = {"host":"192.168.56.1", "port":"830", "username":"cisco", "password":"cisco123!", "hostkey_verify":"False" }
router = {'host': '192.168.56.1', 'port': '830', 'username': 'cisco', 'password': 'cisco123!', 'hostkey_verify': 'False'}
""" ====================================== Classifier (:mod:`classifier` package) ====================================== This package provides supervised machine learning classifiers. The decision forest module (:mod:`classifier.decision_forest`) -------------------------------------------------------------- .. auto...
""" ====================================== Classifier (:mod:`classifier` package) ====================================== This package provides supervised machine learning classifiers. The decision forest module (:mod:`classifier.decision_forest`) -------------------------------------------------------------- .. auto...
class InstascrapeError(Exception): """Base exception class for all of the exceptions raised by Instascrape.""" class ExtractionError(InstascrapeError): """Raised when Instascrape fails to extract specified data from HTTP response.""" def __init__(self, message: str): super().__init__("Failed to e...
class Instascrapeerror(Exception): """Base exception class for all of the exceptions raised by Instascrape.""" class Extractionerror(InstascrapeError): """Raised when Instascrape fails to extract specified data from HTTP response.""" def __init__(self, message: str): super().__init__("Failed to ex...
class Proxy: def __init__(self, host, port): self.host=host self.port=port self.succeed=0 self.fail=0 def markSucceed(self): self.succeed +=1 def markFail(self): self.fail +=1 def __str__(self): return f'http://{self.host}:{self.port}'
class Proxy: def __init__(self, host, port): self.host = host self.port = port self.succeed = 0 self.fail = 0 def mark_succeed(self): self.succeed += 1 def mark_fail(self): self.fail += 1 def __str__(self): return f'http://{self.host}:{self.por...
lineitem_scheme = ["l_orderkey","l_partkey","l_suppkey","l_linenumber","l_quantity","l_extendedprice", "l_discount","l_tax","l_returnflag","l_linestatus","l_shipdate","l_commitdate","l_receiptdate","l_shipinstruct", "l_shipmode","l_comment", "null"] order_scheme = ["o_orderkey", "o_custkey","o_orderstatus","o_totalpri...
lineitem_scheme = ['l_orderkey', 'l_partkey', 'l_suppkey', 'l_linenumber', 'l_quantity', 'l_extendedprice', 'l_discount', 'l_tax', 'l_returnflag', 'l_linestatus', 'l_shipdate', 'l_commitdate', 'l_receiptdate', 'l_shipinstruct', 'l_shipmode', 'l_comment', 'null'] order_scheme = ['o_orderkey', 'o_custkey', 'o_orderstatus...
#!/usr/bin/env python3 # Daniel Nicolas Gisolfi class UserCommand: """ The users input that will be translated into a shell command """ def __init__(self, cmd:str, args:list): self.command = cmd self.args = args
class Usercommand: """ The users input that will be translated into a shell command """ def __init__(self, cmd: str, args: list): self.command = cmd self.args = args
# https://github.com/adamsaparudin/python-datascience # if (kondisi) # if ("adam" == "adam") # True / False # Task 1 # FIZZBUZZ # print FIZZ jika bisa dibagi 3, # print BUZZ jika bisa dibagi 5, # print FIZZBUZZ jika bisa dibagi 15, # print angka nya sendiri jika tidak bisa dibagi 3 atau 5 # input 6 # FIZZ # input...
def print_fizzbuzz(numb): if numb % 15 == 0: return 'FIZZBUZZ' elif numb % 3 == 0: print('FIZZ') elif numb % 5 == 0: print('BUZZ') else: print(numb) def tambahan(a, b): return a + b def main(): while True: numb = int(input('Input bilangan bulat: ')) ...
def parse_list_ranges(s,sep='-'): r = [] x = s.split(',') for y in x: z = y.split(sep) if len(z)==1: r += [int(z[0])] else: r += range(int(z[0]),int(z[1])+1) return list(r) def parse_list_floats(s): x = s.split(',') return list(map(float, x))
def parse_list_ranges(s, sep='-'): r = [] x = s.split(',') for y in x: z = y.split(sep) if len(z) == 1: r += [int(z[0])] else: r += range(int(z[0]), int(z[1]) + 1) return list(r) def parse_list_floats(s): x = s.split(',') return list(map(float, x)...
class LayoutRuleFixedNumber(LayoutRule, IDisposable): """ This class indicate the layout rule of a Beam System is Fixed-Number. LayoutRuleFixedNumber(numberOfLines: int) """ def Dispose(self): """ Dispose(self: LayoutRuleFixedNumber,A_0: bool) """ pass def ReleaseManage...
class Layoutrulefixednumber(LayoutRule, IDisposable): """ This class indicate the layout rule of a Beam System is Fixed-Number. LayoutRuleFixedNumber(numberOfLines: int) """ def dispose(self): """ Dispose(self: LayoutRuleFixedNumber,A_0: bool) """ pass def release_managed_resources(...
def print_tree(mcts_obj, root_node): fifo = [] for child_node in root_node.children: q = 0 if mcts_obj.visits[child_node] > 0: q = mcts_obj.Q[child_node] / mcts_obj.visits[child_node] print( child_node, mcts_obj.Q[child_node], mcts_obj.visi...
def print_tree(mcts_obj, root_node): fifo = [] for child_node in root_node.children: q = 0 if mcts_obj.visits[child_node] > 0: q = mcts_obj.Q[child_node] / mcts_obj.visits[child_node] print(child_node, mcts_obj.Q[child_node], mcts_obj.visits[child_node], q) fifo.appen...
class DataStructure(object): def __init__(self): self.name2id = {} self.id2item = {} def add_item(self, item_name, item_id, item): self.name2id[item_name] = item_id self.id2item[item_id] = item def search_by_name(self, target_name): target_id = self.name2id[target_n...
class Datastructure(object): def __init__(self): self.name2id = {} self.id2item = {} def add_item(self, item_name, item_id, item): self.name2id[item_name] = item_id self.id2item[item_id] = item def search_by_name(self, target_name): target_id = self.name2id[target_...
class Calendar: def __init__(self, day, month, year): print("Clase Base - Calendar") self.day = day self.month = month self.year = year def __str__(self): return "{}-{}-{}".format(self.day, self.month, se...
class Calendar: def __init__(self, day, month, year): print('Clase Base - Calendar') self.day = day self.month = month self.year = year def __str__(self): return '{}-{}-{}'.format(self.day, self.month, self.year)
#My favorite song described #Genre, Artists and Album Genre = "Bollywood Romance" Composer = "Amit Trivedi" Lyricist = "Amitabh Bhattacharya" Singer_male = "Arijit Singh" Singer_female = "Nikhita Gandhi" Album = "Kedarnath" #YearReleased YearReleased = 2018 #Duration DurationInSeconds = 351 print("My favorit...
genre = 'Bollywood Romance' composer = 'Amit Trivedi' lyricist = 'Amitabh Bhattacharya' singer_male = 'Arijit Singh' singer_female = 'Nikhita Gandhi' album = 'Kedarnath' year_released = 2018 duration_in_seconds = 351 print('My favorite song is from the Album ' + Album + ' and in the genre ' + Genre) print('The artists ...
#!/bin/python #If player is X, I'm the first player. #If player is O, I'm the second player. player = raw_input() #Read the board now. The board is a 3x3 array filled with X, O or _. board = [] for i in xrange(0, 3): board.append(raw_input()) #Proceed with processing and print 2 integers separated by a single ...
player = raw_input() board = [] for i in xrange(0, 3): board.append(raw_input())
DEFAULT_ENV_NAME = "CartPole-v1" DEFAULT_ALGORITHM = "random" DEFAULT_MAX_EPISODES = 1000 DEFAULT_LEARNING_RATE = 0.001 DEFAULT_GAMMA = 0.95 DEFAULT_UPDATE_FREQUENCY = 20
default_env_name = 'CartPole-v1' default_algorithm = 'random' default_max_episodes = 1000 default_learning_rate = 0.001 default_gamma = 0.95 default_update_frequency = 20
def initials(name): parts = name.split(' ') letters = '' for part in parts: letters += part[0] return letters
def initials(name): parts = name.split(' ') letters = '' for part in parts: letters += part[0] return letters