content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class FPyCompare: def __readFile(self, fileName): with open(fileName) as f: lines = f.read().splitlines() return lines def __writeFile(self, resultList, fileName): with open(fileName, "w") as outfile: outfile.write("\n".join(resultList)) print(fileName + ...
class Fpycompare: def __read_file(self, fileName): with open(fileName) as f: lines = f.read().splitlines() return lines def __write_file(self, resultList, fileName): with open(fileName, 'w') as outfile: outfile.write('\n'.join(resultList)) print(fileName...
print(() == ()) print(() > ()) print(() < ()) print(() == (1,)) print((1,) == ()) print(() > (1,)) print((1,) > ()) print(() < (1,)) print((1,) < ()) print(() >= (1,)) print((1,) >= ()) print(() <= (1,)) print((1,) <= ()) print((1,) == (1,)) print((1,) != (1,)) print((1,) == (2,)) print((1,) == (1, 0,)) print((1,) > ...
print(() == ()) print(() > ()) print(() < ()) print(() == (1,)) print((1,) == ()) print(() > (1,)) print((1,) > ()) print(() < (1,)) print((1,) < ()) print(() >= (1,)) print((1,) >= ()) print(() <= (1,)) print((1,) <= ()) print((1,) == (1,)) print((1,) != (1,)) print((1,) == (2,)) print((1,) == (1, 0)) print((1,) > (1,...
# Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
{'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'timed_decomposer_lib', 'type': 'static_library', 'sources': ['timed_decomposer_app.cc', 'timed_decomposer_app.h'], 'dependencies': ['<(src)/syzygy/pe/pe.gyp:pe_lib', '<(src)/syzygy/common/common.gyp:syzygy_version']}, {'target_name': 'timed_decomposer', '...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def reverseBetween(self, head: ListNode, left: int, right: int) -> ListNode: dummy_head = sublist_head = ListNode(0,head) for _ in ra...
class Solution: def reverse_between(self, head: ListNode, left: int, right: int) -> ListNode: dummy_head = sublist_head = list_node(0, head) for _ in range(1, left): sublist_head = sublist_head.next sublist_iter = sublist_head.next for _ in range(right - left): ...
# Height in cm --> feet and inches # (just for ya fookin 'muricans) cm = float(input("Enter height in cm: ")) inches = cm/2.54 ft = int(inches//12) inches = int(round(inches % 12)) print("Height is about {}'{}\".".format(ft, inches))
cm = float(input('Enter height in cm: ')) inches = cm / 2.54 ft = int(inches // 12) inches = int(round(inches % 12)) print('Height is about {}\'{}".'.format(ft, inches))
# writing to a file : # To write to a file you need to create file stream = open('output.txt', 'wt') print('\n Can I write to this file : ' + str(stream.writable())) stream.write('H') # write a single string ... stream.writelines(['ello',' ', 'Susan']) # write multiple strings stream.write('\n') # write a new line ...
stream = open('output.txt', 'wt') print('\n Can I write to this file : ' + str(stream.writable())) stream.write('H') stream.writelines(['ello', ' ', 'Susan']) stream.write('\n') names = ['Alen', 'Chris', 'Sausan'] stream.writelines(','.join(names)) stream.writelines('\n'.join(names)) stream.close()
an_int = 2 a_float = 2.1 print(an_int + 3) # prints 5 # Define the release and runtime integer variables below: release_year = 15 runtime = 20 # Define the rating_out_of_10 float variable below: rating_out_of_10 = 3.5
an_int = 2 a_float = 2.1 print(an_int + 3) release_year = 15 runtime = 20 rating_out_of_10 = 3.5
N = int(input()) s = [input() for _ in range(5)] a = [ '.###..#..###.###.#.#.###.###.###.###.###.', '.#.#.##....#...#.#.#.#...#.....#.#.#.#.#.', '.#.#..#..###.###.###.###.###...#.###.###.', '.#.#..#..#.....#...#...#.#.#...#.#.#...#.', '.###.###.###.###...#.###.###...#.###.###.' ] result = [] for i...
n = int(input()) s = [input() for _ in range(5)] a = ['.###..#..###.###.#.#.###.###.###.###.###.', '.#.#.##....#...#.#.#.#...#.....#.#.#.#.#.', '.#.#..#..###.###.###.###.###...#.###.###.', '.#.#..#..#.....#...#...#.#.#...#.#.#...#.', '.###.###.###.###...#.###.###...#.###.###.'] result = [] for i in range(N): t = [s...
# -*- coding: utf-8 -*- """ Created on Tue Sep 22 15:47:38 2020 @author: xyz """ a = 4 b = 5 c = 6 d = True e = False bool1 = (d + d) >= 2 and (not e) bool2 = (not e) and (6*d == 12/2) bool3 = (d or (e)) and (a > b) print(bool1, bool2, bool3)
""" Created on Tue Sep 22 15:47:38 2020 @author: xyz """ a = 4 b = 5 c = 6 d = True e = False bool1 = d + d >= 2 and (not e) bool2 = not e and 6 * d == 12 / 2 bool3 = (d or e) and a > b print(bool1, bool2, bool3)
# Numpy is imported; seed is set # Initialize all_walks (don't change this line) all_walks = [] # Simulate random walk 10 times for i in range(10) : # Code from before random_walk = [0] for x in range(100) : step = random_walk[-1] dice = np.random.randint(1,7) if di...
all_walks = [] for i in range(10): random_walk = [0] for x in range(100): step = random_walk[-1] dice = np.random.randint(1, 7) if dice <= 2: step = max(0, step - 1) elif dice <= 5: step = step + 1 else: step = step + np.random.randint(...
# A file to test if pyvm works from the command line. def it_works(): print("Success!") it_works()
def it_works(): print('Success!') it_works()
n = "Hello" # Your function here! def string_function(s): return s + 'world' print(string_function(n))
n = 'Hello' def string_function(s): return s + 'world' print(string_function(n))
#this software is a copyrighted product made by laba.not for resell. all right reserved.date-7th may 2018. one of the 1st software made by laba. print("Welcome to Personal dictionary by laba.\nThis ugliest software is made by most handsome man alive name laba.") print("\nThis software aims to make your process for ...
print('Welcome to Personal dictionary by laba.\nThis ugliest software is made by most handsome man alive name laba.') print('\nThis software aims to make your process for learning new words easy. \nJust add a new word and a note describing it. Revice twice a day.') words = [] notes = [] def word_entry(word): w_ent...
# Final Exam, Problem 4 - 2 def longestRun(L): ''' Assumes L is a non-empty list Returns the length of the longest monotonically increasing ''' maxRun = 0 tempRun = 0 for i in range(len(L) - 1): if L[i + 1] >= L[i]: tempRun += 1 if tempRun > maxRun: ...
def longest_run(L): """ Assumes L is a non-empty list Returns the length of the longest monotonically increasing """ max_run = 0 temp_run = 0 for i in range(len(L) - 1): if L[i + 1] >= L[i]: temp_run += 1 if tempRun > maxRun: max_run = tempRun ...
# # @lc app=leetcode id=415 lang=python3 # # [415] Add Strings # # https://leetcode.com/problems/add-strings/description/ # # algorithms # Easy (51.34%) # Likes: 2772 # Dislikes: 495 # Total Accepted: 421.8K # Total Submissions: 820.4K # Testcase Example: '"11"\n"123"' # # Given two non-negative integers, num1 a...
class Solution: def add_strings(self, num1: str, num2: str) -> str: ans = int(num1) + int(num2) return str(ans)
def landscaper(f, generations): seen_states = {} states = [] state = f.readline().strip().split(' ')[-1] f.readline() rules = {} idx = 0 prev_sum = None for rule in f.readlines(): keys, _, res = rule.strip().split(' ') if res == '#': rules[keys] = True ...
def landscaper(f, generations): seen_states = {} states = [] state = f.readline().strip().split(' ')[-1] f.readline() rules = {} idx = 0 prev_sum = None for rule in f.readlines(): (keys, _, res) = rule.strip().split(' ') if res == '#': rules[keys] = True f...
# printing out a string print("lol") # printing out a space betwin them (\n) print("Hello\nWorld") # if you want to put a (") inside do this: print("Hello\"World\"") # if you want to put a (\) inside just type: print("Hello\World") # you can also print a variable like this; lol = "Hello World" print(lol) # y...
print('lol') print('Hello\nWorld') print('Hello"World"') print('Hello\\World') lol = 'Hello World' print(lol) lol = 'Hello World' print(lol + ' Hello World') lol = 'Hello World' print(lol.lower()) print(lol.upper()) print(lol.isupper()) print(lol.upper().isupper()) print(len(lol)) lol = 'Hello World' print(lol[0]) prin...
def funcao(x = 1,y = 1): return 2*x+y print(funcao(2,3)) print(funcao(3,2)) print(funcao(1,2))
def funcao(x=1, y=1): return 2 * x + y print(funcao(2, 3)) print(funcao(3, 2)) print(funcao(1, 2))
''' author: Iuri Freire e-mail: iuricostafreire at gmail dot com local date : 2021-01-07 local time : 20:47 '''
""" author: Iuri Freire e-mail: iuricostafreire at gmail dot com local date : 2021-01-07 local time : 20:47 """
# -*- coding: utf-8 -*- """ snaplayer ~~~~~~~~ The very basics :copyright: (c) 2015 by Alejandro Ricoveri :license: MIT, see LICENSE for more details. """ PKG_URL = 'https://github.com/axltxl/snaplayer' __name__ = 'snaplayer' __author__ = 'Alejandro Ricoveri' __version__ = '0.1.1' __licence__ = 'MIT' __copyright__...
""" snaplayer ~~~~~~~~ The very basics :copyright: (c) 2015 by Alejandro Ricoveri :license: MIT, see LICENSE for more details. """ pkg_url = 'https://github.com/axltxl/snaplayer' __name__ = 'snaplayer' __author__ = 'Alejandro Ricoveri' __version__ = '0.1.1' __licence__ = 'MIT' __copyright__ = 'Copyright (c) Alejandr...
name = 'exit' usage = 'EXIT' description = 'Exits Diplomat.' def execute(query): return 'Exiting Diplomat.'
name = 'exit' usage = 'EXIT' description = 'Exits Diplomat.' def execute(query): return 'Exiting Diplomat.'
"""Args: param1 (int): byte as int value in binary Returns: True if input indicates a meta event, False if otherwise. """ def is_meta(n): # hex status byte 0xFF # dec value 255 dec_val = int(n, 2) if dec_val == 255: return True else: return False
"""Args: param1 (int): byte as int value in binary Returns: True if input indicates a meta event, False if otherwise. """ def is_meta(n): dec_val = int(n, 2) if dec_val == 255: return True else: return False
#!/usr/bin/env python """version of the sdk """ __version__ = "1.0.0"
"""version of the sdk """ __version__ = '1.0.0'
success = { "uuid": "8bf7e570-67cd-4670-a37c-0999fd07f9bf", "action": "EventsRouter", "result": { "success": True }, "tid": 1, "type": "rpc", "method": "detail" } fail = { "uuid": "8bf7e570-67cd-4670-a37c-0999fd07f9bf", "action": "EventsRouter", "result": { "msg"...
success = {'uuid': '8bf7e570-67cd-4670-a37c-0999fd07f9bf', 'action': 'EventsRouter', 'result': {'success': True}, 'tid': 1, 'type': 'rpc', 'method': 'detail'} fail = {'uuid': '8bf7e570-67cd-4670-a37c-0999fd07f9bf', 'action': 'EventsRouter', 'result': {'msg': 'ServiceResponseError: Not Found', 'type': 'exception', 'succ...
settings = { # add provider-specific survey settings here # e.g. how to abbreviate questions }
settings = {}
# coding: utf-8 s = "The string ends in escape: " s += chr(27) # add an escape character at the end of $str print(repr(s))
s = 'The string ends in escape: ' s += chr(27) print(repr(s))
SERVICE_NAME = "org.bluez" AGENT_IFACE = SERVICE_NAME + '.Agent1' ADAPTER_IFACE = SERVICE_NAME + ".Adapter1" DEVICE_IFACE = SERVICE_NAME + ".Device1" PLAYER_IFACE = SERVICE_NAME + '.MediaPlayer1' TRANSPORT_IFACE = SERVICE_NAME + '.MediaTransport1' OBJECT_IFACE = "org.freedesktop.DBus.ObjectManager" PROPERTIES_IFACE =...
service_name = 'org.bluez' agent_iface = SERVICE_NAME + '.Agent1' adapter_iface = SERVICE_NAME + '.Adapter1' device_iface = SERVICE_NAME + '.Device1' player_iface = SERVICE_NAME + '.MediaPlayer1' transport_iface = SERVICE_NAME + '.MediaTransport1' object_iface = 'org.freedesktop.DBus.ObjectManager' properties_iface = '...
class Cliente: def __init__(self, nome): self.__nome = nome @property def nome(self): return self.__nome.title() def get_nome(self): print('[INFO] Getting value...') print('[INFO] Name "{}" getted sucessfully'.format(self.__nome)) return self.__nome...
class Cliente: def __init__(self, nome): self.__nome = nome @property def nome(self): return self.__nome.title() def get_nome(self): print('[INFO] Getting value...') print('[INFO] Name "{}" getted sucessfully'.format(self.__nome)) return self.__nome.title() ...
class ChartModel: def score_keywords(self, dep_keywords): #mock (@todo: update after integrating training a model) keyword_scores = [] for kw in dep_keywords: keyword_scores.append({ 'keyword': kw, 'score': 0.7 }) ...
class Chartmodel: def score_keywords(self, dep_keywords): keyword_scores = [] for kw in dep_keywords: keyword_scores.append({'keyword': kw, 'score': 0.7}) return keyword_scores
def word_permutation(s): return word_permutation_helper(list(s)) def word_permutation_helper(input_list): if len(input_list) ==0: return '' ret = [] for i in range(len(input_list)): base = input_list[i] remainder = input_list[:i]+input_list[i+1:] out = word_permu...
def word_permutation(s): return word_permutation_helper(list(s)) def word_permutation_helper(input_list): if len(input_list) == 0: return '' ret = [] for i in range(len(input_list)): base = input_list[i] remainder = input_list[:i] + input_list[i + 1:] out = word_permutat...
def solution(participant, completion): answer = "" temp = 0 dic = {} for p in participant: dic[hash(p)] = p temp += hash(p) for c in completion: temp -= hash(c) return dic[temp]
def solution(participant, completion): answer = '' temp = 0 dic = {} for p in participant: dic[hash(p)] = p temp += hash(p) for c in completion: temp -= hash(c) return dic[temp]
class Solution: def generateMatrix(self, n: int) -> List[List[int]]: mat = [[0] * n for _ in range(n)] left, top, right, bottom = 0, 0, n, n val = 1 while left < right and top < bottom: for i in range(left, right): mat[top][i] = val val += ...
class Solution: def generate_matrix(self, n: int) -> List[List[int]]: mat = [[0] * n for _ in range(n)] (left, top, right, bottom) = (0, 0, n, n) val = 1 while left < right and top < bottom: for i in range(left, right): mat[top][i] = val v...
# DROP TABLES songplay_table_drop = "DROP TABLE songplays" user_table_drop = "DROP TABLE users" song_table_drop = "DROP TABLE songs" artist_table_drop = "DROP TABLE artists" time_table_drop = "DROP TABLE time" # CREATE TABLES songplay_table_create = (""" CREATE TABLE IF NOT EXISTS songplays ( songplay_id SERIAL ...
songplay_table_drop = 'DROP TABLE songplays' user_table_drop = 'DROP TABLE users' song_table_drop = 'DROP TABLE songs' artist_table_drop = 'DROP TABLE artists' time_table_drop = 'DROP TABLE time' songplay_table_create = '\nCREATE TABLE IF NOT EXISTS songplays (\n songplay_id SERIAL PRIMARY KEY, \n start_time time...
class Solution(object): def findCircleNum(self, M): def dfs(node): visited.add(node) for person, is_friend in enumerate(M[node]): if is_friend and person not in visited: dfs(person) circle = 0 visited = set() ...
class Solution(object): def find_circle_num(self, M): def dfs(node): visited.add(node) for (person, is_friend) in enumerate(M[node]): if is_friend and person not in visited: dfs(person) circle = 0 visited = set() for node ...
a = [1,5,4,6,8,11,3,12] even = list(filter(lambda x: (x%2 == 0), a)) print(even) third = list(filter(lambda x: (x%3 == 0), a)) print(third) b = [[0,1,8],[7,2,2],[5,3,10],[1,4,5]] b.sort(key = lambda x: x[2]) print(b) b.sort(key = lambda x: x[0]+x[1]) print(b)
a = [1, 5, 4, 6, 8, 11, 3, 12] even = list(filter(lambda x: x % 2 == 0, a)) print(even) third = list(filter(lambda x: x % 3 == 0, a)) print(third) b = [[0, 1, 8], [7, 2, 2], [5, 3, 10], [1, 4, 5]] b.sort(key=lambda x: x[2]) print(b) b.sort(key=lambda x: x[0] + x[1]) print(b)
# -*- coding: utf-8 -*- """ Created on Wed Feb 5 11:02:42 2020 @author: Arthur """
""" Created on Wed Feb 5 11:02:42 2020 @author: Arthur """
def word(str): j=len(str)-1 for i in range(int(len(str)/2)): if str[i]!=str[j]: return False j=j-1 return True str=input("Enter the string :") ans=word(str) if(ans): print("string is palindrome") else: print("string is not palindrome")
def word(str): j = len(str) - 1 for i in range(int(len(str) / 2)): if str[i] != str[j]: return False j = j - 1 return True str = input('Enter the string :') ans = word(str) if ans: print('string is palindrome') else: print('string is not palindrome')
class RowMenuItem: def __init__(self, widget): # Item can have an optional id self.id = None # Item may specify a parent id (for rendering purposes, like display = 'with-parent,' perhaps) self.parent_id = None # If another item chooses to display with this item, then tha...
class Rowmenuitem: def __init__(self, widget): self.id = None self.parent_id = None self.friend_ids = [] self.item = widget self.visibility = 'visible' self.hidden = False self.disabled = False self.individual_border = False self.shrinkwrap = ...
nome = str(input('Digite seu nome completo: ')).strip() print(nome.upper()) print(nome.lower()) print(len(nome))
nome = str(input('Digite seu nome completo: ')).strip() print(nome.upper()) print(nome.lower()) print(len(nome))
#!/usr/bin/env python # encoding=utf-8 def test(): print('utils_gao, making for ml')
def test(): print('utils_gao, making for ml')
class Config(object): """This is the basic configuration class for BorgWeb.""" #: builtin web server configuration HOST = '127.0.0.1' # use 0.0.0.0 to bind to all interfaces PORT = 9087 # ports < 1024 need root DEBUG = True # if True, enable reloader and debugger LOG_FILE = 'prombot.log' ...
class Config(object): """This is the basic configuration class for BorgWeb.""" host = '127.0.0.1' port = 9087 debug = True log_file = 'prombot.log' telegram_bot_username = 'dwarferie_bot' telegram_bot_token = '1110478838:AAGZVZaDmjUPffFTIxpgLVIKI5r7yg5h_8g' telegram_bot_chat_id = '-48929...
def _gen_k8s_file(ctx): odir = ctx.actions.declare_directory("tmp") ctx.actions.run( inputs = [], outputs = [odir], arguments = [], progress_message = "Converting", env = { "CDK8S_OUTDIR": odir.path, }, executable = ctx.executable.tool, ...
def _gen_k8s_file(ctx): odir = ctx.actions.declare_directory('tmp') ctx.actions.run(inputs=[], outputs=[odir], arguments=[], progress_message='Converting', env={'CDK8S_OUTDIR': odir.path}, executable=ctx.executable.tool, tools=[ctx.executable.tool]) runfiles = ctx.runfiles(files=[odir, ctx.executable._conca...
# # This file contains the Python code from Program 2.9 of # "Data Structures and Algorithms # with Object-Oriented Design Patterns in Python" # by Bruno R. Preiss. # # Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved. # # http://www.brpreiss.com/books/opus7/programs/pgm02_09.txt # def geometricSeries...
def geometric_series_sum(x, n): return (power(x, n + 1) - 1) / (x - 1)
N, K = map(int, input().split()) a_list = list(map(int, input().split())) sum_list = [] for i in range(N): for j in range(i, N): sum_list.append(sum(a_list[i:j+1])) ans = 0 count = 0 tmp = [] for i in range(40, -1, -1): for s in sum_list: check_num = 1 << i logical_and = check_num & s ...
(n, k) = map(int, input().split()) a_list = list(map(int, input().split())) sum_list = [] for i in range(N): for j in range(i, N): sum_list.append(sum(a_list[i:j + 1])) ans = 0 count = 0 tmp = [] for i in range(40, -1, -1): for s in sum_list: check_num = 1 << i logical_and = check_num & ...
# Reads config/config.ini and performs sanity checks class Config(object): config = None def __init__(self, path='config/config.ini'): if not self.config: print("[WARNING] Loading placeholder config") # this has to be replaced by reading the actual .ini config file ...
class Config(object): config = None def __init__(self, path='config/config.ini'): if not self.config: print('[WARNING] Loading placeholder config') with open(path, 'r') as cfg: token = cfg.readline().rstrip() initial_channel = cfg.readline().rstri...
''' Set data type lst = [varname, varname1, varname2] dictionary = { "key": "value", } ''' set = {"Item1", "Item2", "Item3"} print(set) # {'Item1', 'Item2', 'Item3'} # Sets do not care about the order # {'Item2', 'Item3', 'Item1'} # Sets do not care about the order s = {"Item1", "It...
""" Set data type lst = [varname, varname1, varname2] dictionary = { "key": "value", } """ set = {'Item1', 'Item2', 'Item3'} print(set) s = {'Item1', 'Item2', 'Item2', 'Item3'} print(s) s.add('item 4') print(s) s.remove('item 4') print(s)
""" gen123.py generate sequences from a base list, repeating each element one more time than the last. """ def gen123(m): #yield None n = 0 for item in m: n += 1 for i in range(n): yield item
""" gen123.py generate sequences from a base list, repeating each element one more time than the last. """ def gen123(m): n = 0 for item in m: n += 1 for i in range(n): yield item
class SlidingAverage: def __init__(self, window_size): self.index = 0 self.values = [0] * window_size def _previous(self): return self.values[(self.index + len(self.values) - 1) % len(self.values)] def update(self, value): self.values[self.index] = self._previous() + value ...
class Slidingaverage: def __init__(self, window_size): self.index = 0 self.values = [0] * window_size def _previous(self): return self.values[(self.index + len(self.values) - 1) % len(self.values)] def update(self, value): self.values[self.index] = self._previous() + value...
palavras = ('Doidera', 'Calipso', 'Yoda', 'Axt', 'Jovirone', 'Matilda', 'Schwarzenneger', 'Mustefaga', 'Instinct', 'Kobayashi', 'Ludgero', 'Salcicha', 'Scooby', 'Turtle', 'Lily', 'Toast') for palavra in palavras: print(f'Na palavra {palavra.upper()} temos ', end='') for c in range(0, len(palavra)): if p...
palavras = ('Doidera', 'Calipso', 'Yoda', 'Axt', 'Jovirone', 'Matilda', 'Schwarzenneger', 'Mustefaga', 'Instinct', 'Kobayashi', 'Ludgero', 'Salcicha', 'Scooby', 'Turtle', 'Lily', 'Toast') for palavra in palavras: print(f'Na palavra {palavra.upper()} temos ', end='') for c in range(0, len(palavra)): if p...
def specificSummator(): counter = 0 for i in range(0, 10000): if (i % 7) == 0: counter += i elif (i % 9) == 0: counter += i return counter print(specificSummator())
def specific_summator(): counter = 0 for i in range(0, 10000): if i % 7 == 0: counter += i elif i % 9 == 0: counter += i return counter print(specific_summator())
# WAP to accept a file from user and print shortest and longest line from that file. def PrintShortestLongestLines(inputFile): line = inputFile.readline() maxLine = line minLine = line while line != "": line = inputFile.readline() if line == "\n" or line == "": continue ...
def print_shortest_longest_lines(inputFile): line = inputFile.readline() max_line = line min_line = line while line != '': line = inputFile.readline() if line == '\n' or line == '': continue if len(line) < len(minLine): min_line = line elif len(lin...
# Much of the code in this file was ported from ev3dev-lang-python so we # are including the license for ev3dev-lang-python. # ----------------------------------------------------------------------------- # Copyright (c) 2015 Ralph Hempel # # Permission is hereby granted, free of charge, to any person obtaining a copy...
centimeter_mm = 10 decimeter_mm = 100 meter_mm = 1000 inch_mm = 25.4 foot_mm = 304.8 yard_mm = 914.4 stud_mm = 8 class Distancevalue: """ A base class for ``Distance`` classes. Do not use this directly. Use one of: * :class:`DistanceMillimeters` * :class:`DistanceCentimeters` * :class:`DistanceDec...
students = [] class Student: school_name = "Springfied Elementary" def __init__(self, name, student_id=332): self.name = name self.student_id = student_id students.append(self) def __str__(self): return "Student " + self.name def get_name_capitalize(self): r...
students = [] class Student: school_name = 'Springfied Elementary' def __init__(self, name, student_id=332): self.name = name self.student_id = student_id students.append(self) def __str__(self): return 'Student ' + self.name def get_name_capitalize(self): ret...
data_A = [1,2,3,6,7,8,9] data_B = [1,2,7,8] count = 0 for number1 in data_A: for number2 in data_B: if number1 == number2: print('{} is also appeared in {}'.format(number1,number2)) count += 1 else: pass print('There are only {} matching numbers between Data A and Data ...
data_a = [1, 2, 3, 6, 7, 8, 9] data_b = [1, 2, 7, 8] count = 0 for number1 in data_A: for number2 in data_B: if number1 == number2: print('{} is also appeared in {}'.format(number1, number2)) count += 1 else: pass print('There are only {} matching numbers between Data A a...
class Solution(object): def rotate(self, matrix): """ :type m: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ m = matrix side = len(m) max_i = side - 1 for i in range(side // 2): y = i f...
class Solution(object): def rotate(self, matrix): """ :type m: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ m = matrix side = len(m) max_i = side - 1 for i in range(side // 2): y = i ...
# Publised to Explorer in private.py # Also used in measurement.py TEST_GROUPS = { "websites": ["web_connectivity"], "im": ["facebook_messenger", "signal", "telegram", "whatsapp"], "middlebox": ["http_invalid_request_line", "http_header_field_manipulation"], "performance": ["ndt", "dash"], "circumv...
test_groups = {'websites': ['web_connectivity'], 'im': ['facebook_messenger', 'signal', 'telegram', 'whatsapp'], 'middlebox': ['http_invalid_request_line', 'http_header_field_manipulation'], 'performance': ['ndt', 'dash'], 'circumvention': ['bridge_reachability', 'meek_fronted_requests_test', 'vanilla_tor', 'tcp_connec...
# -*- coding: utf-8 -*- class VertexNotReachableException(Exception): """ Exception for vertex distance and path """ pass
class Vertexnotreachableexception(Exception): """ Exception for vertex distance and path """ pass
class Node: def __init__(self, value): self.value = value self.l = None self.r = None class BinaryTree: def __init__(self): self.root = None def draw(self): '''Prints a preorder traversal of the tree''' self._draw(self.root) print() def _draw(se...
class Node: def __init__(self, value): self.value = value self.l = None self.r = None class Binarytree: def __init__(self): self.root = None def draw(self): """Prints a preorder traversal of the tree""" self._draw(self.root) print() def _draw(...
# 1, 2, 3, 4, 5, 6, 7, 8, 9 # 0, 1, 1, -1, -1, 2, 2, -2, -2 # 0, 0, 1, 1, -1, -1, 2, 2, -2, -2 def seq(n): a = (n - 1) // 2 b = (n + 1) // 4 if a % 2 == 0: return -b else: return b n = int(input()) x = seq(n + 1) y = seq(n) print(x, y)
def seq(n): a = (n - 1) // 2 b = (n + 1) // 4 if a % 2 == 0: return -b else: return b n = int(input()) x = seq(n + 1) y = seq(n) print(x, y)
W = [] S = str(input('')) for i in S: if i not in W: W.append(i) if len(W) % 2 == 0: print('CHAT WITH HER!') else: print('IGNORE HIM!')
w = [] s = str(input('')) for i in S: if i not in W: W.append(i) if len(W) % 2 == 0: print('CHAT WITH HER!') else: print('IGNORE HIM!')
worldLists = { "desk": { "sets": ["desk"], "assume": ["des", "de"], }, "laptop": { "sets": ["laptop"], "assume": ["lapto", "lapt", "lap", "la"], }, "wall": { "sets": ["wall"], "assume": ["wal", "wa"] }, "sign": { "sets": [...
world_lists = {'desk': {'sets': ['desk'], 'assume': ['des', 'de']}, 'laptop': {'sets': ['laptop'], 'assume': ['lapto', 'lapt', 'lap', 'la']}, 'wall': {'sets': ['wall'], 'assume': ['wal', 'wa']}, 'sign': {'sets': ['sign'], 'assume': ['sig', 'si']}, 'door': {'sets': ['door'], 'assume': ['doo', 'do']}, 'chair': {'sets': [...
# Prova Mundo 02 # Rascunhos da Prova do Mundo 2 #Nota: 90% n = ' nilseia'.upper().strip()[0] print(n) for c in range(0, 10): print(c)
n = ' nilseia'.upper().strip()[0] print(n) for c in range(0, 10): print(c)
dnas = [ ['hY?9', 56, 25, 8.21, 47, 21, -2.56, {'ott_len': 43, 'ott_percent': 196, 'ott_bw': 124, 'tps_qty_index': 215}], ['st7M', 67, 43, 17.72, 55, 29, 5.52, {'ott_len': 49, 'ott_percent': 299, 'ott_bw': 84, 'tps_qty_index': 468}], ]
dnas = [['hY?9', 56, 25, 8.21, 47, 21, -2.56, {'ott_len': 43, 'ott_percent': 196, 'ott_bw': 124, 'tps_qty_index': 215}], ['st7M', 67, 43, 17.72, 55, 29, 5.52, {'ott_len': 49, 'ott_percent': 299, 'ott_bw': 84, 'tps_qty_index': 468}]]
# This program contains a tuple stores the months of the year and # another tuple from it with just summer months # and prints out the summer months ine at a time. month = ("January", "February", "March", "April", "May", "June", "July", "August", "Septem...
month = ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December') summer = month[4:7] for month in summer: print(month)
default_players = { 'hungergames': [ ("Marvel", True), ("Glimmer", False), ("Cato", True), ("Clove", False), ("Foxface", False), ("Jason", True), ("Rue", False), ("Thresh", True), ("Peeta", True), ("Katniss", False) ], ...
default_players = {'hungergames': [('Marvel', True), ('Glimmer', False), ('Cato', True), ('Clove', False), ('Foxface', False), ('Jason', True), ('Rue', False), ('Thresh', True), ('Peeta', True), ('Katniss', False)], 'melee': [('Dr. Mario', True), ('Mario', True), ('Luigi', True), ('Bowser', True), ('Peach', False), ('Y...
def main(): N, M = map(int,input().split()) for i in range(1,N,2): print(("." + "|.."*int((i-1)/2) + "|" + "..|"*int((i-1)/2) + ".").center(M,'-')) print("WELCOME".center(M,"-")) for i in range(N-2,-1,-2): print(("." + "|.."*int((i-1)/2) + "|" + "..|"*int((i-1)/2) + ".").center(M,'-')...
def main(): (n, m) = map(int, input().split()) for i in range(1, N, 2): print(('.' + '|..' * int((i - 1) / 2) + '|' + '..|' * int((i - 1) / 2) + '.').center(M, '-')) print('WELCOME'.center(M, '-')) for i in range(N - 2, -1, -2): print(('.' + '|..' * int((i - 1) / 2) + '|' + '..|' * int((...
""" Given a string s, return the longest palindromic substring in s. Example 1: Input: s = "babad" Output: "bab" Note: "aba" is also a valid answer. Example 2: Input: s = "cbbd" Output: "bb" Example 3: Input: s = "a" Output: "a" Example 4: Input: s = "ac" Output: "a" Constraints: 1 <= s.length <= 1000 s cons...
""" Given a string s, return the longest palindromic substring in s. Example 1: Input: s = "babad" Output: "bab" Note: "aba" is also a valid answer. Example 2: Input: s = "cbbd" Output: "bb" Example 3: Input: s = "a" Output: "a" Example 4: Input: s = "ac" Output: "a" Constraints: 1 <= s.length <= 1000 s cons...
#!/usr/bin/env python3 tls_cnt = 0 ssl_cnt = 0 with open("input.txt",'r') as f: for line in f: bracket = 0 tls_flag = 0 ABAs = [[],[]] for i in range(len(line)-2): if line[i] == '[': bracket = 1 elif line[i] == ']': bracket = 0 else: if line[i] == line[i+2] and line[i+1] not in "]": ...
tls_cnt = 0 ssl_cnt = 0 with open('input.txt', 'r') as f: for line in f: bracket = 0 tls_flag = 0 ab_as = [[], []] for i in range(len(line) - 2): if line[i] == '[': bracket = 1 elif line[i] == ']': bracket = 0 else: ...
"""This module defines Ubuntu Bionic dependencies.""" load("@rules_deb_packages//:deb_packages.bzl", "deb_packages") def ubuntu_bionic_amd64(): deb_packages( name = "ubuntu_bionic_amd64", arch = "amd64", packages = { "base-files": "pool/main/b/base-files/base-files_10.1ubuntu2....
"""This module defines Ubuntu Bionic dependencies.""" load('@rules_deb_packages//:deb_packages.bzl', 'deb_packages') def ubuntu_bionic_amd64(): deb_packages(name='ubuntu_bionic_amd64', arch='amd64', packages={'base-files': 'pool/main/b/base-files/base-files_10.1ubuntu2.11_amd64.deb', 'bash': 'pool/main/b/bash/bash...
# Configuration file for the Sphinx documentation builder. project = 'wwt_api_client' author = 'Peter K. G. Williams' copyright = '2019 ' + author release = '0.1.0dev0' extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode'...
project = 'wwt_api_client' author = 'Peter K. G. Williams' copyright = '2019 ' + author release = '0.1.0dev0' extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode', 'sphinx_automodapi.automodapi', 'sphinx_automodapi.smart_resolver', 'numpydoc'] m...
class ConfigException(Exception): pass class AuthException(Exception): pass class AuthEngineFailedException(AuthException): pass class UnauthorizedAccountException(AuthException): pass class LockedUserException(UnauthorizedAccountException): pass class InvalidAuthEngineException(AuthExcept...
class Configexception(Exception): pass class Authexception(Exception): pass class Authenginefailedexception(AuthException): pass class Unauthorizedaccountexception(AuthException): pass class Lockeduserexception(UnauthorizedAccountException): pass class Invalidauthengineexception(AuthException):...
def tick(nums): """ Simulate one tick of passage of time nums is a list of timer counts of all fish """ # Iterate over a copy of nums as it will be modified within the loop for i, j in enumerate(nums[:]): if j == 0: nums[i] = 6 nums.append(8) else: ...
def tick(nums): """ Simulate one tick of passage of time nums is a list of timer counts of all fish """ for (i, j) in enumerate(nums[:]): if j == 0: nums[i] = 6 nums.append(8) else: nums[i] -= 1 return nums def part1(): nums = list(map(int...
""" Copyright 2020 Tianshu AI Platform. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law ...
""" Copyright 2020 Tianshu AI Platform. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law ...
class Metadata: name: str def __init__(self, name: str): self.name = name def to_dict(self) -> dict: return { 'name': self.name, } class ConfigMap: metadata: Metadata data: dict apiVersion: str = 'v1' kind: str = 'ConfigMap' def __init__( ...
class Metadata: name: str def __init__(self, name: str): self.name = name def to_dict(self) -> dict: return {'name': self.name} class Configmap: metadata: Metadata data: dict api_version: str = 'v1' kind: str = 'ConfigMap' def __init__(self, metadata: Metadata, data: ...
# Creating a class # Method 1 # class teddy: # quantity = 200 # print(teddy.quantity) # Method 2 class teddy: quantity = 200 quality = 90 obteddy = teddy() print(obteddy.quality) print(obteddy.quantity)
class Teddy: quantity = 200 quality = 90 obteddy = teddy() print(obteddy.quality) print(obteddy.quantity)
# -*- coding: utf-8 -*- """ Created on Tue Oct 9 20:09:13 2018 @author: JinJheng """ a=input() b=input() c=input() d=input() print('|%10s %10s|' %(a,b)) print('|%10s %10s|' %(c,d)) print('|%-10s %-10s|' %(a,b)) print('|%-10s %-10s|' %(c,d))
""" Created on Tue Oct 9 20:09:13 2018 @author: JinJheng """ a = input() b = input() c = input() d = input() print('|%10s %10s|' % (a, b)) print('|%10s %10s|' % (c, d)) print('|%-10s %-10s|' % (a, b)) print('|%-10s %-10s|' % (c, d))
num = 10 num = 20 num = 30 num = 40 num = 50 num = 66 num = 60 num = 70
num = 10 num = 20 num = 30 num = 40 num = 50 num = 66 num = 60 num = 70
def create_HMM(switch_prob=0.1, noise_level=1e-1, startprob=[1.0, 0.0]): """Create an HMM with binary state variable and 1D Gaussian measurements The probability to switch to the other state is `switch_prob`. Two measurement models have mean 1.0 and -1.0 respectively. `noise_level` specifies the standard devia...
def create_hmm(switch_prob=0.1, noise_level=0.1, startprob=[1.0, 0.0]): """Create an HMM with binary state variable and 1D Gaussian measurements The probability to switch to the other state is `switch_prob`. Two measurement models have mean 1.0 and -1.0 respectively. `noise_level` specifies the standard devia...
#!/usr/bin/env python3 def find_distance(matrix, key): """Find the distance of the nearest key for each cell """ if not matrix or not matrix[0]: return matrix rows, cols = len(matrix), len(matrix[0]) delta = [(-1, 0), (1, 0), (0, -1), (0, 1)] def shortest(matrix, row, col, key): ...
def find_distance(matrix, key): """Find the distance of the nearest key for each cell """ if not matrix or not matrix[0]: return matrix (rows, cols) = (len(matrix), len(matrix[0])) delta = [(-1, 0), (1, 0), (0, -1), (0, 1)] def shortest(matrix, row, col, key): q = [(row, col, 0)...
""" Utilities for the :class:`~django_mri.analysis.interfaces.fmriprep.fmriprep.FmriPrep` interface. """ #: Command line template to format for execution. COMMAND = "singularity run -e {security_options} -B {bids_parent}:/work,{destination_parent}:/output,{freesurfer_license}:/fs_license {singularity_image_root}/fmrip...
""" Utilities for the :class:`~django_mri.analysis.interfaces.fmriprep.fmriprep.FmriPrep` interface. """ command = 'singularity run -e {security_options} -B {bids_parent}:/work,{destination_parent}:/output,{freesurfer_license}:/fs_license {singularity_image_root}/fmriprep-{version}.simg /work/{bids_name} /output/{desti...
val = open('val.txt', encoding='UTF-8') out = open('out.txt', encoding='UTF-8') t = val.readline() a = out.readline() sum = 0 right = 0 while t and a: error = [] t = t.strip() a = a.strip() for i in range(len(t)): sum += 1 if t[i] == a[i]: right += 1 else: ...
val = open('val.txt', encoding='UTF-8') out = open('out.txt', encoding='UTF-8') t = val.readline() a = out.readline() sum = 0 right = 0 while t and a: error = [] t = t.strip() a = a.strip() for i in range(len(t)): sum += 1 if t[i] == a[i]: right += 1 else: ...
#!/usr/bin/env python3 @app.route('/api/v1/weight', methods=['GET']) def weight_v1(): conn = None try: params = config() conn = psycopg2.connect(**params) cur = conn.cursor(cursor_factory = psycopg2.extras.DictCursor) cur.execute("""SELECT * FROM weights WHERE child...
@app.route('/api/v1/weight', methods=['GET']) def weight_v1(): conn = None try: params = config() conn = psycopg2.connect(**params) cur = conn.cursor(cursor_factory=psycopg2.extras.DictCursor) cur.execute('SELECT * FROM weights WHERE child_id={};'.format(request.args['child_id'])...
URL_FANTOIR = ( "https://www.collectivites-locales.gouv.fr/competences/la-mise-disposition-gratuite-du-fichier-des-" "voies-et-des-lieux-dits-fantoir" ) URL_DOCUMENTATION = "https://docs.3liz.org/QgisCadastrePlugin/"
url_fantoir = 'https://www.collectivites-locales.gouv.fr/competences/la-mise-disposition-gratuite-du-fichier-des-voies-et-des-lieux-dits-fantoir' url_documentation = 'https://docs.3liz.org/QgisCadastrePlugin/'
class JavascriptDebugRenderer: def __init__(self, debugger): self.debugger = debugger def render(self, meta=None): data = {} if meta is None: meta = [] for name, collector in self.debugger.collectors.items(): data.update({collector.name: collector.collec...
class Javascriptdebugrenderer: def __init__(self, debugger): self.debugger = debugger def render(self, meta=None): data = {} if meta is None: meta = [] for (name, collector) in self.debugger.collectors.items(): data.update({collector.name: collector.coll...
n = int(input('digite um numero: ')) if n%2 == 0: print('PAR') else: print('IMPAR')
n = int(input('digite um numero: ')) if n % 2 == 0: print('PAR') else: print('IMPAR')
ir_licenses = { 'names': { 'P': 'Pro', 'A': 'Class A', 'B': 'Class B', 'C': 'Class C', 'D': 'Class D', 'R': 'Rookie' }, 'bg_colors': { 'P': '#000000', 'A': '#0153DB', 'B': '#00C702', 'C': '#FEEC04', 'D': '#FC8A27', ...
ir_licenses = {'names': {'P': 'Pro', 'A': 'Class A', 'B': 'Class B', 'C': 'Class C', 'D': 'Class D', 'R': 'Rookie'}, 'bg_colors': {'P': '#000000', 'A': '#0153DB', 'B': '#00C702', 'C': '#FEEC04', 'D': '#FC8A27', 'R': '#FC0706'}, 'colors': {'P': '#FFFFFF', 'A': '#FFFFFF', 'B': '#FFFFFF', 'C': '#000000', 'D': '#000000', '...
pkg_dnf = { 'nfs-utils': {}, 'libnfsidmap': {}, } svc_systemd = { 'nfs-server': { 'needs': ['pkg_dnf:nfs-utils'], }, 'rpcbind': { 'needs': ['pkg_dnf:nfs-utils'], }, 'rpc-statd': { 'needs': ['pkg_dnf:nfs-utils'], }, 'nfs-idmapd': { 'needs': ['pkg_dnf:n...
pkg_dnf = {'nfs-utils': {}, 'libnfsidmap': {}} svc_systemd = {'nfs-server': {'needs': ['pkg_dnf:nfs-utils']}, 'rpcbind': {'needs': ['pkg_dnf:nfs-utils']}, 'rpc-statd': {'needs': ['pkg_dnf:nfs-utils']}, 'nfs-idmapd': {'needs': ['pkg_dnf:nfs-utils']}} files = {} actions = {'nfs_export': {'command': 'exportfs -a', 'trigge...
class Solution(object): def multiply(self, A, B): """ :type A: List[List[int]] :type B: List[List[int]] :rtype: List[List[int]] """ m, q, n = len(A), len(B), len(B[0]) # C = [[0] * n] * m C = [[0] * n for _ in range(m)] for i in range(m): ...
class Solution(object): def multiply(self, A, B): """ :type A: List[List[int]] :type B: List[List[int]] :rtype: List[List[int]] """ (m, q, n) = (len(A), len(B), len(B[0])) c = [[0] * n for _ in range(m)] for i in range(m): for k in range(q...
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ # Write your code here n, q = map(int, input().strip().split()) a ...
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ (n, q) = map(int, input().strip().split()) a = list(map(int, input(...
# FIXME need to figure generation of bytecode class Scenario: STAGES = [ {"name": "install", "path": "build/{version}/cast_to_short-{version}.cap",}, { "name": "send", "comment": "READMEM APDU", "payload": "0xA0 0xB0 0x01 0x00 0x00", "optional": False,...
class Scenario: stages = [{'name': 'install', 'path': 'build/{version}/cast_to_short-{version}.cap'}, {'name': 'send', 'comment': 'READMEM APDU', 'payload': '0xA0 0xB0 0x01 0x00\t0x00', 'optional': False}]
class SalesforceRouter(object): """ A router to control all database operations on models in the salesforce application. """ def db_for_read(self, model, **hints): """ Attempts to read salesforce models go to salesforce. """ if model._meta.app_label == 'salesforce': ...
class Salesforcerouter(object): """ A router to control all database operations on models in the salesforce application. """ def db_for_read(self, model, **hints): """ Attempts to read salesforce models go to salesforce. """ if model._meta.app_label == 'salesforce': ...
class Solution: def calPoints(self, ops: List[str]) -> int: arr = [] for op in ops: #print(arr) if op.isdigit() or op[0] == '-': arr.append(int(op)) elif op == 'C' and arr: arr.pop() elif op == 'D' and arr: ...
class Solution: def cal_points(self, ops: List[str]) -> int: arr = [] for op in ops: if op.isdigit() or op[0] == '-': arr.append(int(op)) elif op == 'C' and arr: arr.pop() elif op == 'D' and arr: arr.append(arr[-1] ...
# 153. Find Minimum in Rotated Sorted Array class Solution(object): global find_min_helper def find_min_helper(nums,left,right): # base case: if left >= right, return the first element if left >= right: return nums[0] # get middle element mid = (left+right)/2 ...
class Solution(object): global find_min_helper def find_min_helper(nums, left, right): if left >= right: return nums[0] mid = (left + right) / 2 if mid < right and nums[mid] > nums[mid + 1]: return nums[mid + 1] if mid > left and nums[mid] < nums[mid - 1]...
# Configuration file for ipython. #------------------------------------------------------------------------------ # InteractiveShellApp(Configurable) configuration #------------------------------------------------------------------------------ ## lines of code to run at IPython startup. c.InteractiveShellApp.exec_lin...
c.InteractiveShellApp.exec_lines = ['%load_ext autoreload', '%autoreload 2'] c.InteractiveShellApp.extensions = ['autoreload']
#!/usr/bin/env python3 size_of_grp = 5 inp_list = "1 2 3 6 5 4 4 2 5 3 6 1 6 5 3 2 4 1 2 5 1 4 3 6 8 4 3 1 5 6 2".split() set_l = set(inp_list) cap_room = "" for element in set_l: inp_list.remove(element) if not element in inp_list: cap_room = element break print(int(cap_room))
size_of_grp = 5 inp_list = '1 2 3 6 5 4 4 2 5 3 6 1 6 5 3 2 4 1 2 5 1 4 3 6 8 4 3 1 5 6 2'.split() set_l = set(inp_list) cap_room = '' for element in set_l: inp_list.remove(element) if not element in inp_list: cap_room = element break print(int(cap_room))
class InferErr(Exception): def __init__(self, e): self.code = 1 self.message = "Inference Error" super().__init__(self.message, str(e)) def MiB(val): return val * 1 << 20 def GiB(val): return val * 1 << 30 class HostDeviceMem(object): def __init__(self, host...
class Infererr(Exception): def __init__(self, e): self.code = 1 self.message = 'Inference Error' super().__init__(self.message, str(e)) def mi_b(val): return val * 1 << 20 def gi_b(val): return val * 1 << 30 class Hostdevicemem(object): def __init__(self, host_mem, device_me...
GPU_ID = 0 BATCH_SIZE = 64 VAL_BATCH_SIZE = 100 NUM_OUTPUT_UNITS = 3000 # This is the answer vocabulary size MAX_WORDS_IN_QUESTION = 15 MAX_WORDS_IN_EXP = 36 MAX_ITERATIONS = 50000 PRINT_INTERVAL = 100 # what data to use for training TRAIN_DATA_SPLITS = 'train' # what data to use for the vocabulary QUESTION_VOCAB_SP...
gpu_id = 0 batch_size = 64 val_batch_size = 100 num_output_units = 3000 max_words_in_question = 15 max_words_in_exp = 36 max_iterations = 50000 print_interval = 100 train_data_splits = 'train' question_vocab_space = 'train' answer_vocab_space = 'train' exp_vocab_space = 'train' vqa_pretrained = 'PATH_TO_PRETRAINED_VQA_...
""" The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? """ def largest_prime_factor(): i = 2 lst = [] number = 600851475143 while i != number: if number % i == 0: lst.append(i) number /= i i = 2 ...
""" The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? """ def largest_prime_factor(): i = 2 lst = [] number = 600851475143 while i != number: if number % i == 0: lst.append(i) number /= i i = 2 ...
state_dict = {} aug_dict = {} oneof_dict = {} def clear_dict(state): skey = 'session' if skey not in list(state_dict.keys()) or state != state_dict[skey]: state_dict.clear() state_dict.update({'session': state}) aug_dict.clear()
state_dict = {} aug_dict = {} oneof_dict = {} def clear_dict(state): skey = 'session' if skey not in list(state_dict.keys()) or state != state_dict[skey]: state_dict.clear() state_dict.update({'session': state}) aug_dict.clear()
def reduce_to_one_dividing_by_one_or_pm_one(n): """ Given n this function computes the minimum number of operations 1. Divide by 2 when even 2. Add or subtract 1 when odd to reduce n to 1. The n input is supposed to be a string containing the decimal representation of the actual num...
def reduce_to_one_dividing_by_one_or_pm_one(n): """ Given n this function computes the minimum number of operations 1. Divide by 2 when even 2. Add or subtract 1 when odd to reduce n to 1. The n input is supposed to be a string containing the decimal representation of the actual num...