content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#!/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'...
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...
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')
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...
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
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
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
# 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...
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) ...
# 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...
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
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]}...
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: ...
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...
#!/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...
# 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'}
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...
# 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)...
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
# Q5. Write a program to implement OOPs concepts in python i.e. inheritance etc. class Person: def __init__(self, name, age, address): # constructor self.name = name self.age = age self.address = address def set_data(self, name, age, address): self.name = name self.age = age self.address...
class Person: def __init__(self, name, age, address): self.name = name self.age = age self.address = address def set_data(self, name, age, address): self.name = name self.age = age self.address = address def get_data(self): print('Name : ', self.nam...
class PolarPoint(): def __init__(self, angle, radius): self.angle = angle self.radius = radius
class Polarpoint: def __init__(self, angle, radius): self.angle = angle self.radius = radius
def mu(i, lo=0, hi=None): hi = hi or len(i.has) return sum([i.x(i.has[j]) for j in range(lo, hi)]) / (hi - lo) class Some(o): "Collect some examples, not all." hi = 256 # max number of items to collect def __init__(i, pos=0, txt=" ", inits=[]): i.pos, i.txt, i.n, i._all, i.sorted = pos, txt, 0, [], Fa...
def mu(i, lo=0, hi=None): hi = hi or len(i.has) return sum([i.x(i.has[j]) for j in range(lo, hi)]) / (hi - lo) class Some(o): """Collect some examples, not all.""" hi = 256 def __init__(i, pos=0, txt=' ', inits=[]): (i.pos, i.txt, i.n, i._all, i.sorted) = (pos, txt, 0, [], False) i...
''' Truth tables for logical expressions. Define predicates and/2, or/2, nand/2, nor/2, xor/2, impl/2 and equ/2 (for logical equivalence) which succeed or fail according to the result of their respective operations; e.g. and(A,B) will succeed, if and only if both A and B succeed. Note that A and B can be Prolog goa...
""" Truth tables for logical expressions. Define predicates and/2, or/2, nand/2, nor/2, xor/2, impl/2 and equ/2 (for logical equivalence) which succeed or fail according to the result of their respective operations; e.g. and(A,B) will succeed, if and only if both A and B succeed. Note that A and B can be Prolog goa...
''' *000*000* 0*00*00*0 00*0*0*00 000***000 Utkarsh ''' l=int(input()) b=int(input()) print("With for\n") for i in range(1,b+1): for j in range(1,l+1): if j==(l+1)//2 or j==i or j==(l+1)-i: print('*',end='') else: print('0',end='') print() i=1 j=1 print("\nWith while\n")...
""" *000*000* 0*00*00*0 00*0*0*00 000***000 Utkarsh """ l = int(input()) b = int(input()) print('With for\n') for i in range(1, b + 1): for j in range(1, l + 1): if j == (l + 1) // 2 or j == i or j == l + 1 - i: print('*', end='') else: print('0', end='') print() i = 1 j...
# automatically generated by the FlatBuffers compiler, do not modify # namespace: flat class SeriesLengthOption(object): Unlimited = 0 Three_Games = 1 Five_Games = 2 Seven_Games = 3
class Serieslengthoption(object): unlimited = 0 three__games = 1 five__games = 2 seven__games = 3
# coding: utf-8 __author__ = 'tack' class Position(object): ''' position ''' def __init__(self, code, num, price, commission, date): ''' Args: code: stock code price: cost price commission: commission num: num date: date ...
__author__ = 'tack' class Position(object): """ position """ def __init__(self, code, num, price, commission, date): """ Args: code: stock code price: cost price commission: commission num: num date: date """ s...
with open("p022_names.txt","r") as names: names = names.read().replace("\"","").split(",") names.sort() Sum = 0 length = len(names) for position in range(length): alphavalue=0 for j in names[position]: alphavalue += (ord(j)-64) Sum += (alphavalue * (position+1)) print(Sum)
with open('p022_names.txt', 'r') as names: names = names.read().replace('"', '').split(',') names.sort() sum = 0 length = len(names) for position in range(length): alphavalue = 0 for j in names[position]: alphavalue += ord(j) - 64 sum += alphavalue * (position + 1) print(Sum)
config = { 'population_size' : 100, 'mutation_probability' : .1, 'crossover_rate' : .9, # maximum simulation runs before finishing 'max_runs' : 100, # maximum timesteps per simulation 'max_timesteps' : 150, # smoothness value of the line in [0, 1] 'line_smoothness' : .4, # Bound ...
config = {'population_size': 100, 'mutation_probability': 0.1, 'crossover_rate': 0.9, 'max_runs': 100, 'max_timesteps': 150, 'line_smoothness': 0.4, 'max_gain_value': 3, 'new_map': True, 'runs_per_screenshot': 10, 'data_directory': '/home/monk/genetic_pid_data', 'map_filename': 'map.csv'}
expected_output = { 'mstp': { 'blocked-ports': { 'mst_instances': { '0': { 'mst_id': '0', 'interfaces': { 'GigabitEthernet0/0/4/4': { 'name': 'GigabitEthe...
expected_output = {'mstp': {'blocked-ports': {'mst_instances': {'0': {'mst_id': '0', 'interfaces': {'GigabitEthernet0/0/4/4': {'name': 'GigabitEthernet0/0/4/4', 'cost': 200000, 'role': 'ALT', 'port_priority': 128, 'port_num': 196, 'port_state': 'BLK', 'designated_bridge_priority': 4097, 'designated_bridge_address': '00...
class Solution: def containsNearbyAlmostDuplicate(self, nums: List[int], k: int, t: int) -> bool: tup = [(ind, i) for ind, i in enumerate(nums)] tup.sort(key=lambda x: x[1]) for i in range(len(tup)): for j in range(i+1, len(tup)): if abs(tup[i][1]-tup[j][1])>t: ...
class Solution: def contains_nearby_almost_duplicate(self, nums: List[int], k: int, t: int) -> bool: tup = [(ind, i) for (ind, i) in enumerate(nums)] tup.sort(key=lambda x: x[1]) for i in range(len(tup)): for j in range(i + 1, len(tup)): if abs(tup[i][1] - tup[j]...
del_items(0x80139F2C) SetType(0x80139F2C, "void PresOnlyTestRoutine__Fv()") del_items(0x80139F54) SetType(0x80139F54, "void FeInitBuffer__Fv()") del_items(0x80139F7C) SetType(0x80139F7C, "void FeAddEntry__Fii8TXT_JUSTUsP7FeTableP5CFont(int X, int Y, enum TXT_JUST Just, unsigned short Str, struct FeTable *MenuPtr, struc...
del_items(2148769580) set_type(2148769580, 'void PresOnlyTestRoutine__Fv()') del_items(2148769620) set_type(2148769620, 'void FeInitBuffer__Fv()') del_items(2148769660) set_type(2148769660, 'void FeAddEntry__Fii8TXT_JUSTUsP7FeTableP5CFont(int X, int Y, enum TXT_JUST Just, unsigned short Str, struct FeTable *MenuPtr, st...
# -*- coding: utf-8 -*- # Create and print a dictionary: thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964 } print(thisdict) # Duplicate values will overwrite existing values: thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964, "year": 2020 } print(thisdict) # String, int, boolean, and list dat...
thisdict = {'brand': 'Ford', 'model': 'Mustang', 'year': 1964} print(thisdict) thisdict = {'brand': 'Ford', 'model': 'Mustang', 'year': 1964, 'year': 2020} print(thisdict) thisdict = {'brand': 'Ford', 'electric': False, 'year': 1964, 'colors': ['red', 'white', 'blue']} child1 = {'name': 'Emil', 'year': 2004} child2 = {...
''' e. and use all methods ''' ''' also try different exception like java file,array,string,numberformat ''' ''' user define exception ''' try: raise Exception('spam,','eggs') except Exception as inst: print("Type of instance : ",type(inst)) # the exception instance print("Arguments of instance : ",inst.ar...
""" e. and use all methods """ ' also try different exception like java file,array,string,numberformat ' ' user define exception ' try: raise exception('spam,', 'eggs') except Exception as inst: print('Type of instance : ', type(inst)) print('Arguments of instance : ', inst.args) print('Instance print :...
def is_palindrome_number(number): return number == int(str(number)[::-1]) def infinite_sequence(): num = 0 while True: yield num num += 1 for number in infinite_sequence(): if is_palindrome_number(number): print(number) def countdown_from(number): print(f"Starting to co...
def is_palindrome_number(number): return number == int(str(number)[::-1]) def infinite_sequence(): num = 0 while True: yield num num += 1 for number in infinite_sequence(): if is_palindrome_number(number): print(number) def countdown_from(number): print(f'Starting to count ...
TEST_ROOT_TABLES = { "tenders": ["/tender"], "awards": ["/awards"], "contracts": ["/contracts"], "planning": ["/planning"], "parties": ["/parties"], } TEST_COMBINED_TABLES = { "documents": [ "/planning/documents", "/tender/documents", "/awards/documents", "/contra...
test_root_tables = {'tenders': ['/tender'], 'awards': ['/awards'], 'contracts': ['/contracts'], 'planning': ['/planning'], 'parties': ['/parties']} test_combined_tables = {'documents': ['/planning/documents', '/tender/documents', '/awards/documents', '/contracts/documents', '/contracts/implementation/documents'], 'mile...
def pattern_nineteen(steps): ''' Pattern nineteen 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24 27 30 4 8 12 16 20 24 28 32 36 40 5 10 15 20 25 30 35 40 45 50 6 12 18 24...
def pattern_nineteen(steps): """ Pattern nineteen 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24 27 30 4 8 12 16 20 24 28 32 36 40 5 10 15 20 25 30 35 40 45 50 6 12 18 24 30 36...
n1 = float(input('qual a primeira nota? ')) n2 = float(input('qual a segunda nota? ')) soma = n1 + n2 media = (n1 + n2) / 2 print('a soma das notas foi {:.2f}, e a sua media foi de {:.2f}'.format(soma, media))
n1 = float(input('qual a primeira nota? ')) n2 = float(input('qual a segunda nota? ')) soma = n1 + n2 media = (n1 + n2) / 2 print('a soma das notas foi {:.2f}, e a sua media foi de {:.2f}'.format(soma, media))
''' 02 - Creating dummy variables As Andy discussed in the video, scikit-learn does not accept non-numerical features. You saw in the previous exercise that the 'Region' feature contains very useful information that can predict life expectancy. For example: Sub-Saharan Africa has a lower life expectancy compar...
""" 02 - Creating dummy variables As Andy discussed in the video, scikit-learn does not accept non-numerical features. You saw in the previous exercise that the 'Region' feature contains very useful information that can predict life expectancy. For example: Sub-Saharan Africa has a lower life expectancy compar...
# Given three colinear points p, q, r, the function checks if # point q lies on line segment 'pr' def onSegment(p, q, r): if ( (q.position[0] <= max(p.position[0], r.position[0])) and (q.position[0] >= min(p.position[0], r.position[0])) and (q.position[1] <= max(p.position[1], r.position[1])) and ...
def on_segment(p, q, r): if q.position[0] <= max(p.position[0], r.position[0]) and q.position[0] >= min(p.position[0], r.position[0]) and (q.position[1] <= max(p.position[1], r.position[1])) and (q.position[1] >= min(p.position[1], r.position[1])): return True return False def orientation(p, q, r): ...
class SystemCallFault(Exception): def __init__(self): pass def __str__(self): return 'System not give expect response.' class NecessaryLibraryNotFound(Exception): def __init__(self,value = '?'): self.value = value def __str__(self): return 'Necessary library \'%s\' n...
class Systemcallfault(Exception): def __init__(self): pass def __str__(self): return 'System not give expect response.' class Necessarylibrarynotfound(Exception): def __init__(self, value='?'): self.value = value def __str__(self): return "Necessary library '%s' not ...
string = "Character" print(string[2]) # string[2] = 'A' not change it # string.replace('a','A') we can replace it but it cannot change the our string variables. new_string = string.replace('a','A') print(new_string)
string = 'Character' print(string[2]) new_string = string.replace('a', 'A') print(new_string)
## CvAltRoot ## ## Tells BUG where to locate its files when it cannot find them normally. ## This is common when using the /AltRoot Civ4 feature or sometimes on ## non-English operating systems and Windows Vista. ## ## HOW TO USE ## ## 1. Change the text in the quotes below to match the full path to the ## ...
root_dir = 'C:/Documents and Settings/[UserName]/My Documents/My Games/Beyond the Sword'
####################################################################### # Copyright (C) 2017 Shangtong Zhang(zhangshangtong.cpp@gmail.com) # # Permission given to modify the code as long as you keep this # # declaration at the top # ################################...
class Config: q_target = 0 expected_sarsa_target = 1 def __init__(self): self.task_fn = None self.optimizer_fn = None self.actor_optimizer_fn = None self.critic_optimizer_fn = None self.network_fn = None self.actor_network_fn = None self.critic_networ...
# question 1 A = 3 B = 3 C = (-5) X = 8.8 Y = 3.5 Z = (-5.2) print(A % C) print(A * B / C) print((A * C) % C) print(X / Y) print(X / (X + Y)) print(int(X) % int(Y)) # question 2 A = float(input("the number you want to round off:")) print(round(A)) # question 3 A = float(input("length in CM:")) B = float(input("length...
a = 3 b = 3 c = -5 x = 8.8 y = 3.5 z = -5.2 print(A % C) print(A * B / C) print(A * C % C) print(X / Y) print(X / (X + Y)) print(int(X) % int(Y)) a = float(input('the number you want to round off:')) print(round(A)) a = float(input('length in CM:')) b = float(input('length in CM:')) c = A / (12 * 5 / 2) d = B * 5 / 2 p...
# coding=utf-8 setThrowException(True) class Nautilus: REMOTE = 0 LOCAL = 1 _tab = None _dirs = {} def __init__(self): self._dirs = {self.LOCAL: [], self.REMOTE: []} self._startNautilus() self._initWebdav() sleep(1) self._initLocal() def _startNautilus(self): ...
set_throw_exception(True) class Nautilus: remote = 0 local = 1 _tab = None _dirs = {} def __init__(self): self._dirs = {self.LOCAL: [], self.REMOTE: []} self._startNautilus() self._initWebdav() sleep(1) self._initLocal() def _start_nautilus(self): ...
print((2**64).to_bytes(9, "little",signed=False)) #signed shall be False by default print((2**64).to_bytes(9, "little")) # test min/max signed value for i in [10]: v = 2**(i*8 - 1) - 1 print(v) vbytes = v.to_bytes(i, "little") print(vbytes) print(int.from_bytes(vbytes,"little")) v = - (2**(i*8...
print((2 ** 64).to_bytes(9, 'little', signed=False)) print((2 ** 64).to_bytes(9, 'little')) for i in [10]: v = 2 ** (i * 8 - 1) - 1 print(v) vbytes = v.to_bytes(i, 'little') print(vbytes) print(int.from_bytes(vbytes, 'little')) v = -2 ** (i * 8 - 1) print(v) vbytes = v.to_bytes(i, 'littl...
x = int(input('Podaj pierwsza liczbe calkowita: ')) y = int(input('Podaj druga liczbe calkowita: ')) print() print(x%y) print(y%x) print() print(x//y) print(y//x)
x = int(input('Podaj pierwsza liczbe calkowita: ')) y = int(input('Podaj druga liczbe calkowita: ')) print() print(x % y) print(y % x) print() print(x // y) print(y // x)
SEAL_CHECKER = 9300535 SEAL_OF_TIME_1 = 2159363 SEAL_OF_TIME_2 = 2159364 SEAL_OF_TIME_3 = 2159365 SEAL_OF_TIME_4 = 2159366 sm.giveSkill(20041222) sm.setFuncKeyByScript(True, 20041222, 42) sm.spawnMob(SEAL_CHECKER, 550, -298, False) sm.spawnMob(SEAL_CHECKER, 107, -508, False) sm.spawnMob(SEAL_CHECKER, -195, -508, Fals...
seal_checker = 9300535 seal_of_time_1 = 2159363 seal_of_time_2 = 2159364 seal_of_time_3 = 2159365 seal_of_time_4 = 2159366 sm.giveSkill(20041222) sm.setFuncKeyByScript(True, 20041222, 42) sm.spawnMob(SEAL_CHECKER, 550, -298, False) sm.spawnMob(SEAL_CHECKER, 107, -508, False) sm.spawnMob(SEAL_CHECKER, -195, -508, False)...
description = 'minimal NICOS startup setup' group = 'lowlevel' sysconfig = dict( cache = 'tofhw.toftof.frm2:14869', )
description = 'minimal NICOS startup setup' group = 'lowlevel' sysconfig = dict(cache='tofhw.toftof.frm2:14869')
class BaseStrategy(object): def get_next_move(self, board): raise NotImplementedError class MoveFirst(BaseStrategy): pass
class Basestrategy(object): def get_next_move(self, board): raise NotImplementedError class Movefirst(BaseStrategy): pass
VERSION = "1.0.0-beta.15" LANGUAGE = "python" PROJECT = "versionhelper" _p = "versionhelper.libvh." API = {_p + "version_helper" : {"arguments" : ("filename str", ), "keywords" : {"directory" : "directory str", "version" : "str", ...
version = '1.0.0-beta.15' language = 'python' project = 'versionhelper' _p = 'versionhelper.libvh.' api = {_p + 'version_helper': {'arguments': ('filename str',), 'keywords': {'directory': 'directory str', 'version': 'str', 'prerelease': 'str', 'build_metadata': 'str', 'db': 'filename str', 'checker': 'filename str', '...
#Build a Bus/Air/Rail Booking System where the user can choose a source and destination from the list given and enter the information passenger wise, depending on the distance cost shall be computed. #Bus,Rail and Air systems will have different fares for different classes.You should be able to think of the system as ...
mode = input('Hello! Welcome to the automated ticket system. Please enter a method how you would like to travel (Bus, Air or Rail): ').lower() transport = {'bus': 500, 'air': 4000, 'rail': 1500} cost = 0 place = {'mumbai': 1000, 'hydrabad': 900, 'chennai': 1200, 'bangalore': 950} if mode == 'bus' or mode == 'air' or mo...
''' Author: Shuailin Chen Created Date: 2021-08-17 Last Modified: 2021-08-17 content: ''' _base_= [ '../_base_/models/bit_pos_s4_dd8.py', '../_base_/datasets/s2looking.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py' ] data = dict( samples_per_gpu=8, workers_per_g...
""" Author: Shuailin Chen Created Date: 2021-08-17 Last Modified: 2021-08-17 content: """ _base_ = ['../_base_/models/bit_pos_s4_dd8.py', '../_base_/datasets/s2looking.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py'] data = dict(samples_per_gpu=8, workers_per_gpu=8) evaluation = dict(metric...
#need prompt for pet type #build pet dictionary #give toys, feed pet, let game loop, while printing menu pet = {"name":"", "type": "", "age": 0, "hunger": 0, "playfulness" : 0, "toys": []} pettoys = {"cat": ["String", "Cardboard Box", "Scratching Post"], "dog": ["Frisbee","Tennis Ball", "Stick"], "fish": ["Underse...
pet = {'name': '', 'type': '', 'age': 0, 'hunger': 0, 'playfulness': 0, 'toys': []} pettoys = {'cat': ['String', 'Cardboard Box', 'Scratching Post'], 'dog': ['Frisbee', 'Tennis Ball', 'Stick'], 'fish': ['Undersea Castle', 'Buried Treasure', 'Coral']} def quitsim(): print("That's the end of the game! Thank you for ...
RAWDATA_DIR = '/staging/as/skchoudh/rna-seq-datasets/single/gallus_gallus/SRP007412' OUT_DIR = '/staging/as/skchoudh/rna-seq-output/gallus_gallus/SRP007412' CDNA_FA_GZ = '/home/cmb-panasas2/skchoudh/genomes/gallus_gallus/cdna/Gallus_gallus.Gallus_gallus-5.0.cdna.all.fa.gz' CDNA_IDX = '/home/cmb-panasas2/skchoudh/g...
rawdata_dir = '/staging/as/skchoudh/rna-seq-datasets/single/gallus_gallus/SRP007412' out_dir = '/staging/as/skchoudh/rna-seq-output/gallus_gallus/SRP007412' cdna_fa_gz = '/home/cmb-panasas2/skchoudh/genomes/gallus_gallus/cdna/Gallus_gallus.Gallus_gallus-5.0.cdna.all.fa.gz' cdna_idx = '/home/cmb-panasas2/skchoudh/genome...
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- TIME_WIND...
time_window = u'Microsoft.TimeWindow' percentage = u'Microsoft.Percentage' targeting = u'Microsoft.Targeting'
n, min_val, max_val = int(input('n=')), int(input('minimum=')), int(input('maximum=')) c = i = 0 while True: i, sq = i+1, i**n if sq in range(min_val, max_val+1): c += 1 if sq > max_val: break print(f'{c} values raised to the power {n} lie in the range {min_val}, {max_val}')
(n, min_val, max_val) = (int(input('n=')), int(input('minimum=')), int(input('maximum='))) c = i = 0 while True: (i, sq) = (i + 1, i ** n) if sq in range(min_val, max_val + 1): c += 1 if sq > max_val: break print(f'{c} values raised to the power {n} lie in the range {min_val}, {max_val}')
_base_ = [ '../_base_/models/fpn_r50.py', '../_base_/datasets/FoodSeg103.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py' ] model = dict(pretrained='./pretrained_model/R50_ReLeM.pth', backbone=dict(type='ResNet'), decode_head=dict(num_classes=104)) optimizer...
_base_ = ['../_base_/models/fpn_r50.py', '../_base_/datasets/FoodSeg103.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py'] model = dict(pretrained='./pretrained_model/R50_ReLeM.pth', backbone=dict(type='ResNet'), decode_head=dict(num_classes=104)) optimizer_config = dict() runner = dict(type='I...
def me(**kwargs): for key, value in kwargs.items(): print("{0}=={1}". format(key, value)) me(name="Rahim", ID=18) me(name="Ariful", age=109) me(age=10)
def me(**kwargs): for (key, value) in kwargs.items(): print('{0}=={1}'.format(key, value)) me(name='Rahim', ID=18) me(name='Ariful', age=109) me(age=10)
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Adekunle Oliver Adebajo\n", "### 20120612016\n", "### adekunle.adebajo@pau.edu.ng\n", "### the following codes consist of class exercises involving problem solving" ] }, { "cell_type": "code", "execution_co...
{'cells': [{'cell_type': 'markdown', 'metadata': {}, 'source': ['### Adekunle Oliver Adebajo\n', '### 20120612016\n', '### adekunle.adebajo@pau.edu.ng\n', '### the following codes consist of class exercises involving problem solving']}, {'cell_type': 'code', 'execution_count': 17, 'metadata': {}, 'outputs': [{'name': '...
#divide 2 numbers x = int(input("Enter first number :")) y = int(input("Enter second number :")) answer = int(x/y) remainder = x % y print("{} divided by {} is {} with a remainder of {}".format(x,y,answer,remainder))
x = int(input('Enter first number :')) y = int(input('Enter second number :')) answer = int(x / y) remainder = x % y print('{} divided by {} is {} with a remainder of {}'.format(x, y, answer, remainder))
def return_true(): return True if __name__ == "__main__": print("shipit")
def return_true(): return True if __name__ == '__main__': print('shipit')