content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# this works, but has the argument order dependency problem class Rectangle: def __init__(self, width, height): self.height = height self.width = width def area(self): return self.height * self.width def perimeter(self): return (2 * self.height) + (2 * self.width) x = Rectangle(4, 4) print(x.wi...
class Rectangle: def __init__(self, width, height): self.height = height self.width = width def area(self): return self.height * self.width def perimeter(self): return 2 * self.height + 2 * self.width x = rectangle(4, 4) print(x.width) print(x.area()) print(x.perimeter())
# -*- coding: utf-8 -*- # -------------------------------------- # tree_from_shot.py # # MDSplus Python project # for CTH data access # # tree_from_shot --- returns the CTH MDSplus tree associated with the # given shot number # # Parameters: # shotnum - integer - the shotnumber to open # Returns: #...
def tree_from_shot(shotnum): shot_string = str(shotnum) tree = 't' + shotString[0:6] return tree
k,n=map(int,input().split());a=[int(i+1) for i in range(k)] for _ in range(n): s,e,m=map(int,input().split()) b0=a[:s-1];b1=a[s-1:e];b2=a[e:];a=[] l=b1[:m-s];r=b1[m-s:];b1=r+l a=b0+b1+b2 r="" for i in a: r+=str(i)+' ' print(r)
(k, n) = map(int, input().split()) a = [int(i + 1) for i in range(k)] for _ in range(n): (s, e, m) = map(int, input().split()) b0 = a[:s - 1] b1 = a[s - 1:e] b2 = a[e:] a = [] l = b1[:m - s] r = b1[m - s:] b1 = r + l a = b0 + b1 + b2 r = '' for i in a: r += str(i) + ' ' print(r)
__author__ = 'Masataka' class IFileParser: def __init__(self): pass def getparam(self): pass def getJob(self): pass
__author__ = 'Masataka' class Ifileparser: def __init__(self): pass def getparam(self): pass def get_job(self): pass
# -*- encoding: utf-8 def func(x, y): return x + y def test_example(): assert func(1, 2) == 3
def func(x, y): return x + y def test_example(): assert func(1, 2) == 3
#!/usr/bin/python # -*- coding: utf-8 -*- ### # MIT License # # Copyright (c) 2021 Yi-Sheng, Kang (Eason Kang) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, ...
service = data.get('service') [service_domain, service_name] = service.split('.') service_data_decrease = data.get('service_data_decrease') service_data_increase = data.get('service_data_increase') speed_percentage = data.get('percentage') speed_count = data.get('speed_count') fan_speed_entity_id = data.get('speed_enti...
# -*- coding=utf-8 -*- class MessageInfo: def __init__(self, msgFlag, msgBody): self.msgFlag = msgFlag self.msgReServe = 0 msgBody = msgBody.encode(encoding='utf-8') # msgBody = bytes(msgBody, encoding='utf-8') self.msgBodySize = msgBody.__len__() self.msgBo...
class Messageinfo: def __init__(self, msgFlag, msgBody): self.msgFlag = msgFlag self.msgReServe = 0 msg_body = msgBody.encode(encoding='utf-8') self.msgBodySize = msgBody.__len__() self.msgBody = msgBody def get_msg(arg): pass def create_msg(msgFlag=1001, msgBo...
guest_list = ["Shantopriyo Bhowmick", "Jordan B Peterson", "Mayuri B Upadhaya", "Deblina Bhowmick", "Sandeep Goswami", "Soumen Goswami"] print(f"Hi my dear brother{guest_list[0].title()}, Hope your killing it wherever you are. Come join me for a dinner. Meet people i like the most") print(f"Hi professor {guest_list[1...
guest_list = ['Shantopriyo Bhowmick', 'Jordan B Peterson', 'Mayuri B Upadhaya', 'Deblina Bhowmick', 'Sandeep Goswami', 'Soumen Goswami'] print(f'Hi my dear brother{guest_list[0].title()}, Hope your killing it wherever you are. Come join me for a dinner. Meet people i like the most') print(f"Hi professor {guest_list[1]....
class Participation: def __init__(self, id, tournament_id, player_id): self.id = id self.tournament_id = tournament_id self.player_id = player_id @staticmethod def build(attributes): return Participation( id=attributes['id'], tournament_id=attributes[...
class Participation: def __init__(self, id, tournament_id, player_id): self.id = id self.tournament_id = tournament_id self.player_id = player_id @staticmethod def build(attributes): return participation(id=attributes['id'], tournament_id=attributes['tournament_id'], player...
## ## Some global settings constants ## # The amount of inactivity (in milliseconds) that must elapse # before the badge will consider going into standby. If set to # zero then the badge will never attempt to sleep. sleeptimeout = 900000 # The default banner message to print in the scroll.py animation. banner = "DEFC...
sleeptimeout = 900000 banner = 'DEFCON Furs' debug = False bootanim = 'scroll' mazesolver = True blecooldown = 60 boopselect = 0 color = 16777215
# Set collector mode `raw` or `unpack` mode = 'raw' # LIsten IP address. ip_address = '127.0.0.1' # Listen port (UDP). port = 2055 # Template size in bytes. Template size configured on exporter. template_size_in_bytes = 50 # Capture duration in seconds caption_duration = 300
mode = 'raw' ip_address = '127.0.0.1' port = 2055 template_size_in_bytes = 50 caption_duration = 300
example_readings = [3,4,3,1,2] readings = [2,1,1,4,4,1,3,4,2,4,2,1,1,4,3,5,1,1,5,1,1,5,4,5,4,1,5,1,3,1,4,2,3,2,1,2,5,5,2,3,1,2,3,3,1,4,3,1,1,1,1,5,2,1,1,1,5,3,3,2,1,4,1,1,1,3,1,1,5,5,1,4,4,4,4,5,1,5,1,1,5,5,2,2,5,4,1,5,4,1,4,1,1,1,1,5,3,2,4,1,1,1,4,4,1,2,1,1,5,2,1,1,1,4,4,4,4,3,3,1,1,5,1,5,2,1,4,1,2,4,4,4,4,2,2,2,4,4,4...
example_readings = [3, 4, 3, 1, 2] readings = [2, 1, 1, 4, 4, 1, 3, 4, 2, 4, 2, 1, 1, 4, 3, 5, 1, 1, 5, 1, 1, 5, 4, 5, 4, 1, 5, 1, 3, 1, 4, 2, 3, 2, 1, 2, 5, 5, 2, 3, 1, 2, 3, 3, 1, 4, 3, 1, 1, 1, 1, 5, 2, 1, 1, 1, 5, 3, 3, 2, 1, 4, 1, 1, 1, 3, 1, 1, 5, 5, 1, 4, 4, 4, 4, 5, 1, 5, 1, 1, 5, 5, 2, 2, 5, 4, 1, 5, 4, 1, 4, ...
class Events: TRAINING_START = "TRAINING_START" EPOCH_START = "EPOCH_START" BATCH_START = "BATCH_START" FORWARD = "FORWARD" BACKWARD = "BACKWARD" BATCH_END = "BATCH_END" VALIDATE = "VALIDATE" EPOCH_END = "EPOCH_END" TRAINING_END = "TRAINING_END" ERROR = "ERROR"
class Events: training_start = 'TRAINING_START' epoch_start = 'EPOCH_START' batch_start = 'BATCH_START' forward = 'FORWARD' backward = 'BACKWARD' batch_end = 'BATCH_END' validate = 'VALIDATE' epoch_end = 'EPOCH_END' training_end = 'TRAINING_END' error = 'ERROR'
# 1.07 # Slicing and dicing #Selecting single values from a list is just one part of the story. It's also possible to slice your list, which means selecting multiple elements from your list. Use the following syntax: #my_list[start:end] #The start index will be included, while the end index is not. #The code sample b...
areas = ['hallway', 11.25, 'kitchen', 18.0, 'living room', 20.0, 'bedroom', 10.75, 'bathroom', 9.5] downstairs = areas[0:6] upstairs = areas[6:10] print(downstairs) print(upstairs)
class Node: def __init__(self, val, parent, level=0): self.val = val self.parent = None self.level = level class Tree: def __init__(self, root): self.root = Node(root, None) self.root.level = 0 def find_hits(self, dist, clubs): c = self.root q = [...
class Node: def __init__(self, val, parent, level=0): self.val = val self.parent = None self.level = level class Tree: def __init__(self, root): self.root = node(root, None) self.root.level = 0 def find_hits(self, dist, clubs): c = self.root q = [c...
a = int(input()) s = [x for x in input().split()] output = [] for i in range(a-1): if i == 0: if s[0] == '1': output.append('x^%d' % (a-i)) elif s[0] == '-1': output.append('-x^%d' % (a-i)) else: output.append(s[0]+'x^%d' % (a-i)) else: if int(...
a = int(input()) s = [x for x in input().split()] output = [] for i in range(a - 1): if i == 0: if s[0] == '1': output.append('x^%d' % (a - i)) elif s[0] == '-1': output.append('-x^%d' % (a - i)) else: output.append(s[0] + 'x^%d' % (a - i)) elif int(s[...
def collatzChain(n): lengthChain=0 while n!=1: if n%2==0: n=int(n/2) else: n=int((3*n)+1) print(n) def collatzChainLength(n): lengthChain=0 while n!=1: if n%2==0: n=int(n/2) else: n=int((3*n)+1) ...
def collatz_chain(n): length_chain = 0 while n != 1: if n % 2 == 0: n = int(n / 2) else: n = int(3 * n + 1) print(n) def collatz_chain_length(n): length_chain = 0 while n != 1: if n % 2 == 0: n = int(n / 2) else: n ...
vowels = "aeiouAEIOU" consonants = "bcdfghjklmnpqrstvwxyz"; consonants+=consonants.upper() #The f means final, I thought acually writing final would take to long fvowels = "" fcon="" fother="" userInput = input("Please input sentance to split: ") print ("Splitting sentance: " + userInput) #Iterates through inputed char...
vowels = 'aeiouAEIOU' consonants = 'bcdfghjklmnpqrstvwxyz' consonants += consonants.upper() fvowels = '' fcon = '' fother = '' user_input = input('Please input sentance to split: ') print('Splitting sentance: ' + userInput) for char in userInput: if char in vowels: fvowels += char elif char in consonant...
#!/usr/bin/env python3 # Replace by your own program print("hello world")
print('hello world')
def is_mechanic(user): return user.groups.filter(name='mechanic') # return user.is_superuser def is_mechanic_above(user): return user.groups.filter(name='mechanic') or user.is_superuser # return user.is_superuser
def is_mechanic(user): return user.groups.filter(name='mechanic') def is_mechanic_above(user): return user.groups.filter(name='mechanic') or user.is_superuser
less = "Nimis"; more = "Non satis"; requiredGold = 104; def sumCoinValues(coins): totalValue = 0; for coin in coins: totalValue += coin.value return totalValue def collectAllCoins(): item = hero.findNearest(hero.findItems()) while item: hero.moveXY(item.pos.x, item.pos.y) ...
less = 'Nimis' more = 'Non satis' required_gold = 104 def sum_coin_values(coins): total_value = 0 for coin in coins: total_value += coin.value return totalValue def collect_all_coins(): item = hero.findNearest(hero.findItems()) while item: hero.moveXY(item.pos.x, item.pos.y) ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 02/12/2017 8:57 PM # @Project : BioQueue # @Author : Li Yao # @File : svn.py def get_sub_protocol(db_obj, protocol_parent, step_order_start=1): steps = list() steps.append(db_obj(software='svn', parameter='checkout {{InputF...
def get_sub_protocol(db_obj, protocol_parent, step_order_start=1): steps = list() steps.append(db_obj(software='svn', parameter='checkout {{InputFile}}', parent=protocol_parent, user_id=0, hash='c025d53644388a50fb3704b4a81d5a93', step_order=step_order_start)) return (step_order_start + len(steps), steps)
n = int(input("> ")) suma = 0 while n > 0: suma += n % 10 n //= 10 print(suma)
n = int(input('> ')) suma = 0 while n > 0: suma += n % 10 n //= 10 print(suma)
# Author: Ashish Jangra from Teenage Coder var_int = 3 var_float = -3.14 var_boolean = False var_string = "True" print(type(var_int)) print(type(var_boolean)) print(type(var_string)) print(type(var_float))
var_int = 3 var_float = -3.14 var_boolean = False var_string = 'True' print(type(var_int)) print(type(var_boolean)) print(type(var_string)) print(type(var_float))
a, b, c, x, y = map(int, input().split()) ans = 5000*(10**5)*2 for i in range(max(x, y)+1): tmp_ans = i*2*c if x > i: tmp_ans += (x-i)*a if y > i: tmp_ans += (y-i)*b ans = min(ans, tmp_ans) print(ans)
(a, b, c, x, y) = map(int, input().split()) ans = 5000 * 10 ** 5 * 2 for i in range(max(x, y) + 1): tmp_ans = i * 2 * c if x > i: tmp_ans += (x - i) * a if y > i: tmp_ans += (y - i) * b ans = min(ans, tmp_ans) print(ans)
# Python - 2.7.6 def AddExtra(listOfNumbers): return listOfNumbers + ['']
def add_extra(listOfNumbers): return listOfNumbers + ['']
@dataclass class Position: x: int = 0 y: int = 0 def __matmul__(self, other: tuple[int, int]) -> None: self.x = other[0] self.y = other[1]
@dataclass class Position: x: int = 0 y: int = 0 def __matmul__(self, other: tuple[int, int]) -> None: self.x = other[0] self.y = other[1]
# testlist_comp # : (test | star_expr) (comp_for | (COMMA (test | star_expr))* COMMA?) # ; # test [x] # star_expr comp_for [z for z in a] # test COMMA star_expr COMMA [x, *a,] # star_expr COMMA test COMMA star_expr [*u, a, *i]
[x] [z for z in a] [x, *a] [*u, a, *i]
def foo(x): return 1/x def zoo(x): res = foo(x) return res print(zoo(0))
def foo(x): return 1 / x def zoo(x): res = foo(x) return res print(zoo(0))
# Email Configuration EMAIL_PORT = 587 EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = 'bob@bobmail.com' EMAIL_HOST_PASSWORD = 'bob' EMAIL_USE_TLS = True
email_port = 587 email_host = 'smtp.gmail.com' email_host_user = 'bob@bobmail.com' email_host_password = 'bob' email_use_tls = True
self.description = "dir->symlink change during package upgrade (conflict)" p1 = pmpkg("pkg1", "1.0-1") p1.files = ["test/", "test/file1", "test/dir/file1", "test/dir/file2"] self.addpkg2db("local", p1) p2 = pmpkg("pkg2") p2.files = ["test/dir/file3"] self.addpkg2db("local", p2) p3...
self.description = 'dir->symlink change during package upgrade (conflict)' p1 = pmpkg('pkg1', '1.0-1') p1.files = ['test/', 'test/file1', 'test/dir/file1', 'test/dir/file2'] self.addpkg2db('local', p1) p2 = pmpkg('pkg2') p2.files = ['test/dir/file3'] self.addpkg2db('local', p2) p3 = pmpkg('pkg1', '2.0-1') p3.files = ['...
# __about__.py # # Copyright (C) 2006-2020 wolfSSL Inc. # # This file is part of wolfSSL. # # wolfSSL is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any ...
metadata = dict(__name__='wolfcrypt', __version__='0.1.9', __license__='GPLv2 or Commercial License', __author__='wolfSSL Inc.', __author_email__='info@wolfssl.com', __url__='https://wolfssl.github.io/wolfcrypt-py', __description__=u"A Python library that encapsulates wolfSSL's wolfCrypt API.", __keywords__='security, ...
class Notifier: def __init__(self, transporter): self.transporter = transporter def log(self, s): self.transporter.send('logs', s) def error(self, message, stack): self.transporter.send('process:exception', { 'message': message, 'stack': stack })
class Notifier: def __init__(self, transporter): self.transporter = transporter def log(self, s): self.transporter.send('logs', s) def error(self, message, stack): self.transporter.send('process:exception', {'message': message, 'stack': stack})
class Registry: def __init__(self): self._registered_methods = {} def namespaces(self): return list(self._registered_methods) def methods(self, *namespace_path): return self._registered_methods[namespace_path] def clear(self): self._registered_methods = {} def reg...
class Registry: def __init__(self): self._registered_methods = {} def namespaces(self): return list(self._registered_methods) def methods(self, *namespace_path): return self._registered_methods[namespace_path] def clear(self): self._registered_methods = {} def re...
class AppRoutes: def __init__(self) -> None: self.prefix = "/api" self.users_sign_ups = "/api/users/sign-ups" self.auth_token = "/api/auth/token" self.auth_token_long = "/api/auth/token/long" self.auth_refresh = "/api/auth/refresh" self.users = "/api/users" s...
class Approutes: def __init__(self) -> None: self.prefix = '/api' self.users_sign_ups = '/api/users/sign-ups' self.auth_token = '/api/auth/token' self.auth_token_long = '/api/auth/token/long' self.auth_refresh = '/api/auth/refresh' self.users = '/api/users' s...
release_major = 2 release_minor = 3 release_patch = 0 release_so_abi_rev = 2 # These are set by the distribution script release_vc_rev = None release_datestamp = 0 release_type = 'unreleased'
release_major = 2 release_minor = 3 release_patch = 0 release_so_abi_rev = 2 release_vc_rev = None release_datestamp = 0 release_type = 'unreleased'
# -*- coding: utf-8 -*- def two_sum(nums, target): if ((nums is None) or not isinstance(nums, list) or len(nums) == 0): return False nums.sort() low, high = 0, len(nums) - 1 while low < high: total = nums[low] + nums[high] if total < target: ...
def two_sum(nums, target): if nums is None or not isinstance(nums, list) or len(nums) == 0: return False nums.sort() (low, high) = (0, len(nums) - 1) while low < high: total = nums[low] + nums[high] if total < target: while low + 1 < high and nums[low] == nums[low + 1...
''' Python program which adds up columns and rows of given table as shown in the specified figure Input number of rows/columns (0 to exit) 4 Input cell value: 25 69 51 26 68 35 29 54 54 57 45 63 61 68 47 59 Result: 25 69 51 26 171 68 35 29 54 186 54 57 45 63 219 61 68 47 59 235 208 229 172 202 811 Input number of rows/...
""" Python program which adds up columns and rows of given table as shown in the specified figure Input number of rows/columns (0 to exit) 4 Input cell value: 25 69 51 26 68 35 29 54 54 57 45 63 61 68 47 59 Result: 25 69 51 26 171 68 35 29 54 186 54 57 45 63 219 61 68 47 59 235 208 229 172 202 811 Input number of rows/...
# Set up the winner variable to hold None winner = None print('winner:', winner) print('winner is None:', winner is None) print('winner is not None:', winner is not None) print(type(winner)) # Now set winner to be True print('Set winner to True') winner = True print('winner:', winner) print('winner is None:', winner i...
winner = None print('winner:', winner) print('winner is None:', winner is None) print('winner is not None:', winner is not None) print(type(winner)) print('Set winner to True') winner = True print('winner:', winner) print('winner is None:', winner is None) print('winner is not None:', winner is not None) print(type(win...
# This should cover all the syntactical constructs that we hope to support # Intended sources should be the variable `SOURCE` and intended sinks should be # arguments to the function `SINK` (see python/ql/test/experimental/dataflow/testConfig.qll). # # Functions whose name ends with "_with_local_flow" will also be test...
source = 'source' def sink(x): print(x) def test_tuple_with_local_flow(): x = (3, SOURCE) y = x[1] sink(y) def test_names(): x = SOURCE sink(x) def test_string_literal(): x = 'source' sink(x) def test_bytes_literal(): x = b'source' sink(x) def test_integer_literal(): x ...
n = int(input()) prime=0 for i in range(n-1,0,-1): if i==2: prime = i elif(i>2): st=True for j in range(2,int(n**0.5)+1): if(i%j==0): st=False break if(st): prime = i break s_prime=0 for i in range(n+1,n+(n...
n = int(input()) prime = 0 for i in range(n - 1, 0, -1): if i == 2: prime = i elif i > 2: st = True for j in range(2, int(n ** 0.5) + 1): if i % j == 0: st = False break if st: prime = i break s_prime = 0 for i i...
fname = input("Enter file name: ") try: fhand = open(fname) except: print('Something wrong with the file') for line in fhand: print((line.upper()).rstrip())
fname = input('Enter file name: ') try: fhand = open(fname) except: print('Something wrong with the file') for line in fhand: print(line.upper().rstrip())
# -*- coding: utf-8 -*- def ULongToHexHash(long: int): buffer = [None] * 8 buffer[0] = (long >> 56).to_bytes(28,byteorder='little').hex()[:2] buffer[1] = (long >> 48).to_bytes(28,byteorder='little').hex()[:2] buffer[2] = (long >> 40).to_bytes(28,byteorder='little').hex()[:2] buffer[3] = (long >> 32)...
def u_long_to_hex_hash(long: int): buffer = [None] * 8 buffer[0] = (long >> 56).to_bytes(28, byteorder='little').hex()[:2] buffer[1] = (long >> 48).to_bytes(28, byteorder='little').hex()[:2] buffer[2] = (long >> 40).to_bytes(28, byteorder='little').hex()[:2] buffer[3] = (long >> 32).to_bytes(28, byt...
expected_output = { "peer_type": { "vbond": { "downtime": { "2021-12-15T04:19:41+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DCONFAIL", "peer_organization": "", ...
expected_output = {'peer_type': {'vbond': {'downtime': {'2021-12-15T04:19:41+0000': {'domain_id': '0', 'local_color': 'gold', 'local_error': 'DCONFAIL', 'peer_organization': '', 'peer_private_ip': '184.118.1.19', 'peer_private_port': '12346', 'peer_protocol': 'dtls', 'peer_public_ip': '184.118.1.19', 'peer_public_port'...
map = {'corridor':['room1','','','room2'],'room1':['','','corridor',''],'room2':['','corridor','','']} commands = {'room1':room1,'room2':room2,'corridor':corridor} def Moving(location): rooms = map[location] directions = ['North','East','South','West'] availableDirections = [directions[i] for i,j in enume...
map = {'corridor': ['room1', '', '', 'room2'], 'room1': ['', '', 'corridor', ''], 'room2': ['', 'corridor', '', '']} commands = {'room1': room1, 'room2': room2, 'corridor': corridor} def moving(location): rooms = map[location] directions = ['North', 'East', 'South', 'West'] available_directions = [directio...
def fence_pattern(rails, message_size): pass def encode(rails, message): pass def decode(rails, encoded_message): pass
def fence_pattern(rails, message_size): pass def encode(rails, message): pass def decode(rails, encoded_message): pass
# python3 def last_digit_of_fibonacci_number_naive(n): assert 0 <= n <= 10 ** 7 if n <= 1: return n return (last_digit_of_fibonacci_number_naive(n - 1) + last_digit_of_fibonacci_number_naive(n - 2)) % 10 def last_digit_of_fibonacci_number(n): assert 0 <= n <= 10 ** 7 if (n < 2): ...
def last_digit_of_fibonacci_number_naive(n): assert 0 <= n <= 10 ** 7 if n <= 1: return n return (last_digit_of_fibonacci_number_naive(n - 1) + last_digit_of_fibonacci_number_naive(n - 2)) % 10 def last_digit_of_fibonacci_number(n): assert 0 <= n <= 10 ** 7 if n < 2: return n el...
# From pep-0318 examples: # https://www.python.org/dev/peps/pep-0318/#examples def accepts(*types): def check_accepts(f): assert len(types) == f.func_code.co_argcount def new_f(*args, **kwds): for (a, t) in zip(args, types): assert isinstance(a, t), "arg %r does not ma...
def accepts(*types): def check_accepts(f): assert len(types) == f.func_code.co_argcount def new_f(*args, **kwds): for (a, t) in zip(args, types): assert isinstance(a, t), 'arg %r does not match %s' % (a, t) return f(*args, **kwds) new_f.func_name = f...
historical_yrs = [i + 14 for i in range(6)] future_yrs = [5*i + 20 for i in range(7)] cities = { 'NR': { 'Delhi': (28.620198, 77.207953), 'Jaipur': (26.913310, 75.800162), 'Lucknow': (26.850000, 80.949997), 'Kanpur': (26.460681, 80.313318), 'Ghaz...
historical_yrs = [i + 14 for i in range(6)] future_yrs = [5 * i + 20 for i in range(7)] cities = {'NR': {'Delhi': (28.620198, 77.207953), 'Jaipur': (26.91331, 75.800162), 'Lucknow': (26.85, 80.949997), 'Kanpur': (26.460681, 80.313318), 'Ghaziabad': (28.673733, 77.437598), 'Ludhiana': (30.903434, 75.854784), 'Agra': (27...
port="COM3" # if ('virtual' in globals() and virtual): virtualArduino = Runtime.start("virtualArduino", "VirtualArduino") virtualArduino.connect(port) ard = Runtime.createAndStart("Arduino","Arduino") ard.connect(port) # i2cmux = Runtime.createAndStart("i2cMux","I2cMux") # From version 1.0.2316 use attach inste...
port = 'COM3' if 'virtual' in globals() and virtual: virtual_arduino = Runtime.start('virtualArduino', 'VirtualArduino') virtualArduino.connect(port) ard = Runtime.createAndStart('Arduino', 'Arduino') ard.connect(port) i2cmux = Runtime.createAndStart('i2cMux', 'I2cMux') i2cmux.attach(ard, '1', '0x70') mpu6050_0...
# # PySNMP MIB module NBS-CMMCENUM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NBS-CMMCENUM-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:17:11 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ...
#! /usr/bin/env python3 '''A library of functions for our cool app''' def add(a, b): return a + b def add1(a): return a - 1 def sub1(a): pass
"""A library of functions for our cool app""" def add(a, b): return a + b def add1(a): return a - 1 def sub1(a): pass
# # PySNMP MIB module LANART-AGENT (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/LANART-AGENT # Produced by pysmi-0.3.4 at Mon Apr 29 19:54:37 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, constraints_union, value_size_constraint, single_value_constraint) ...
class PoolUserConfiguration: def __init__(self, pool_name: str, username: str, password: str): self.pool_name = pool_name self.username = username self.password = password def __eq__(self, other): if not isinstance(other, PoolU...
class Pooluserconfiguration: def __init__(self, pool_name: str, username: str, password: str): self.pool_name = pool_name self.username = username self.password = password def __eq__(self, other): if not isinstance(other, PoolUserConfiguration): return False ...
if not ( ( 'a' in vars() or 'a' in globals() ) and type(a) == type(0) ): print("no suitable a") else: print("good to go")
if not (('a' in vars() or 'a' in globals()) and type(a) == type(0)): print('no suitable a') else: print('good to go')
''' A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has binary representation 1000010001 and contai...
""" A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has binary representation 1000010001 and contai...
l = [0,1,2,3,4,5,6,7,8,9,] def f(x): return x**2 print(list(map(f,l))) def fake_map(function,list): list_new = [] for n in list: i = function(n) list_new.append(i) return list_new print(fake_map(f,l))
l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] def f(x): return x ** 2 print(list(map(f, l))) def fake_map(function, list): list_new = [] for n in list: i = function(n) list_new.append(i) return list_new print(fake_map(f, l))
working = True match working: case True: print("OK") case False: print()
working = True match working: case True: print('OK') case False: print()
def test_scout_tumor_normal(invoke_cli, tumor_normal_config): # GIVEN a tumor-normal config file # WHEN running analysis result = invoke_cli([ 'plugins', 'scout', '--sample-config', tumor_normal_config, '--customer-id', 'cust000' ]) # THEN it should run without any error print(r...
def test_scout_tumor_normal(invoke_cli, tumor_normal_config): result = invoke_cli(['plugins', 'scout', '--sample-config', tumor_normal_config, '--customer-id', 'cust000']) print(result) assert result.exit_code == 0 def test_scout_tumor_only(invoke_cli, tumor_only_config): result = invoke_cli(['plugins'...
''' # Copyright (C) 2020 by ZestIOT. All rights reserved. The # information in this document is the property of ZestIOT. Except # as specifically authorized in writing by ZestIOT, the receiver # of this document shall keep the information contained herein # confidential and shall protect the same in whole or ...
""" # Copyright (C) 2020 by ZestIOT. All rights reserved. The # information in this document is the property of ZestIOT. Except # as specifically authorized in writing by ZestIOT, the receiver # of this document shall keep the information contained herein # confidential and shall protect the same in whole or ...
# funcs01.py def test_para_02(l1: list ): l1.append(42) def test_para(a: int, b: int, c: int = 10 ): print("*"*34, "test_para", "*"*35) print("Parameter a: ", a) print("Parameter b: ", b) print("Parameter c: ", c) print("*"*80, "\n") x: int = 10 y = 12 z = 13 test_para(x, y, z) print("x: ...
def test_para_02(l1: list): l1.append(42) def test_para(a: int, b: int, c: int=10): print('*' * 34, 'test_para', '*' * 35) print('Parameter a: ', a) print('Parameter b: ', b) print('Parameter c: ', c) print('*' * 80, '\n') x: int = 10 y = 12 z = 13 test_para(x, y, z) print('x: ', x) test_para(2...
## ## This file is maintained by Ansible - CHANGES WILL BE OVERWRITTEN ## USERS = ( 'nate@bx.psu.edu', 'clements@galaxyproject.org', 'outreach@galaxyproject.org' ) NORM_USERS = [ u.lower() for u in USERS ] def dynamic_normal_reserved( user_email ): if user_email is not None and user_email.lower() in ...
users = ('nate@bx.psu.edu', 'clements@galaxyproject.org', 'outreach@galaxyproject.org') norm_users = [u.lower() for u in USERS] def dynamic_normal_reserved(user_email): if user_email is not None and user_email.lower() in NORM_USERS: return 'reserved' return 'slurm_normal' def dynamic_normal_reserved_1...
# Game GAME_NAME = 'Pong-v0' # Preprocessing STACK_SIZE = 4 FRAME_H = 84 FRAME_W = 84 # Model STATE_SHAPE = [FRAME_H, FRAME_W, STACK_SIZE] # Training NUM_EPISODES = 2500 # Discount factor GAMMA = 0.99 # RMSProp LEARNING_RATE = 2.5e-4 # Save the model every 50 episodes SAVE_EVERY = 50 SAVE_PATH = './checkpoints'
game_name = 'Pong-v0' stack_size = 4 frame_h = 84 frame_w = 84 state_shape = [FRAME_H, FRAME_W, STACK_SIZE] num_episodes = 2500 gamma = 0.99 learning_rate = 0.00025 save_every = 50 save_path = './checkpoints'
SECRET_KEY = 'dev' SQLALCHEMY_DATABASE_URI = 'postgresql:///sopy' SQLALCHEMY_TRACK_MODIFICATIONS = False ALEMBIC_CONTEXT = { 'compare_type': True, 'compare_server_default': True, 'user_module_prefix': 'user', } # Set the following in <app.instance_path>/config.py # On dev that's <project>/instance/config...
secret_key = 'dev' sqlalchemy_database_uri = 'postgresql:///sopy' sqlalchemy_track_modifications = False alembic_context = {'compare_type': True, 'compare_server_default': True, 'user_module_prefix': 'user'}
class Tagger(object): tags = [] def __call__(self, tokens): raise NotImplementedError def check_tag(self, tag): return tag in self.tags class PassTagger(Tagger): def __call__(self, tokens): for token in tokens: yield token class TaggersComposition(Tagger): ...
class Tagger(object): tags = [] def __call__(self, tokens): raise NotImplementedError def check_tag(self, tag): return tag in self.tags class Passtagger(Tagger): def __call__(self, tokens): for token in tokens: yield token class Taggerscomposition(Tagger): d...
sys.stdout = open("3-letter.txt", "w") data = "abcdefghijklmnopqrstuvwxyz" data += data.upper() for a in data: for b in data: for c in data: print(a+b+c) sys.stdout.close()
sys.stdout = open('3-letter.txt', 'w') data = 'abcdefghijklmnopqrstuvwxyz' data += data.upper() for a in data: for b in data: for c in data: print(a + b + c) sys.stdout.close()
# date: 17/07/2020 # Description: # Given a set of words, # find all words that are concatenations of other words in the set. class Solution(object): def findAllConcatenatedWords(self, words): seen = [] wrds = [] for i,a in enumerate(words): for j,b in enumerate(...
class Solution(object): def find_all_concatenated_words(self, words): seen = [] wrds = [] for (i, a) in enumerate(words): for (j, b) in enumerate(words): if i != j: if a + b in words and a + b not in seen: wrds.append(a...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # Scratch buffer slice with manual indexing class BufferSlice: def __init__(self, buf, name): self.name = name self.buf = buf self.offset = -1 # Offset into the global scratch buffer self.chunks = [] # Ret...
class Bufferslice: def __init__(self, buf, name): self.name = name self.buf = buf self.offset = -1 self.chunks = [] def get_global_index(self, index): assert self.offset > -1, 'set_offset needs to be called first' return self.offset + index def get_buffer(s...
# Generated by h2py from stdin TCS_MULTILINE = 0x0200 CBRS_ALIGN_LEFT = 0x1000 CBRS_ALIGN_TOP = 0x2000 CBRS_ALIGN_RIGHT = 0x4000 CBRS_ALIGN_BOTTOM = 0x8000 CBRS_ALIGN_ANY = 0xF000 CBRS_BORDER_LEFT = 0x0100 CBRS_BORDER_TOP = 0x0200 CBRS_BORDER_RIGHT = 0x0400 CBRS_BORDER_BOTTOM = 0x0800 CBRS_BORDER_ANY = 0x0F0...
tcs_multiline = 512 cbrs_align_left = 4096 cbrs_align_top = 8192 cbrs_align_right = 16384 cbrs_align_bottom = 32768 cbrs_align_any = 61440 cbrs_border_left = 256 cbrs_border_top = 512 cbrs_border_right = 1024 cbrs_border_bottom = 2048 cbrs_border_any = 3840 cbrs_tooltips = 16 cbrs_flyby = 32 cbrs_float_multi = 64 cbrs_...
x = 1 if x == 1: # indented four spaces print("Hello World")
x = 1 if x == 1: print('Hello World')
#!/usr/bin/python3 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # With a given integral number n, write a program to generate a # dictionary that contains (i, i*i) such that is an integral number # between 1 and n (both included). and then the program should print the # dictionary. # # Supp...
n = 10 dict = {i: i * i for i in range(1, n + 1)} print(dict)
n = [3, 5, 7] def total(numbers): result = 0 for i in range(len(numbers)): result += numbers[i] return result print(total(n))
n = [3, 5, 7] def total(numbers): result = 0 for i in range(len(numbers)): result += numbers[i] return result print(total(n))
with open("input.txt") as fp: instructions = [(line.strip('\n')[0], int(line.strip('\n')[1:])) for line in fp] moves = {'E': 1, 'W': -1, 'N': 1, 'S': -1, 'R': 1, 'L': -1} sides = 'ESWN' current_direction = 'E' current_coords = (0, 0) current_waypoint_offset = (10, 1) current_waypoint_coords = (...
with open('input.txt') as fp: instructions = [(line.strip('\n')[0], int(line.strip('\n')[1:])) for line in fp] moves = {'E': 1, 'W': -1, 'N': 1, 'S': -1, 'R': 1, 'L': -1} sides = 'ESWN' current_direction = 'E' current_coords = (0, 0) current_waypoint_offset = (10, 1) current_waypoint_coords = (current_coords[0] + c...
#!/usr/bin/python command = (oiio_app("maketx") + " --filter lanczos3 " + parent + "/oiio-images/grid-overscan.exr" + " -o grid-overscan.exr ;\n") command = command + testtex_command ("grid-overscan.exr", "--wrap black") outputs = [ "out.exr" ]
command = oiio_app('maketx') + ' --filter lanczos3 ' + parent + '/oiio-images/grid-overscan.exr' + ' -o grid-overscan.exr ;\n' command = command + testtex_command('grid-overscan.exr', '--wrap black') outputs = ['out.exr']
n = int(input()) horas = n // 3600 n %= 3600 minutos = n // 60 n %= 60 segundos = n print(f'{horas}:{minutos}:{segundos}')
n = int(input()) horas = n // 3600 n %= 3600 minutos = n // 60 n %= 60 segundos = n print(f'{horas}:{minutos}:{segundos}')
# optimizer optimizer = dict(type='AdamW', lr=0.0001, weight_decay=0.0005) optimizer_config = dict(grad_clip=dict(max_norm=1, norm_type=2)) # learning policy lr_config = dict( policy='step', warmup='linear', warmup_iters=1000, warmup_ratio=0.001, step=[60000, 72000], by_epoch=False) # runtime se...
optimizer = dict(type='AdamW', lr=0.0001, weight_decay=0.0005) optimizer_config = dict(grad_clip=dict(max_norm=1, norm_type=2)) lr_config = dict(policy='step', warmup='linear', warmup_iters=1000, warmup_ratio=0.001, step=[60000, 72000], by_epoch=False) runner = dict(type='IterBasedRunner', max_iters=80000) checkpoint_c...
#!/usr/bin/env python3 #global num_path #num_path = 0 class Path: num_path = 0 def __init__(self, start, end): self.passed_by = False self.start = start self.end = end def __str__(self): return "{}-{} [{}]".format(self.start, self.end, "T" if self.passed_by else "F") def __eq__(self, n): retur...
class Path: num_path = 0 def __init__(self, start, end): self.passed_by = False self.start = start self.end = end def __str__(self): return '{}-{} [{}]'.format(self.start, self.end, 'T' if self.passed_by else 'F') def __eq__(self, n): return self.start == n.sta...
execfile("Modified_data/data_record.dr") trick.sim_services.exec_set_terminate_time(300.0)
execfile('Modified_data/data_record.dr') trick.sim_services.exec_set_terminate_time(300.0)
class BaseConfig: DEBUG = True TESTING = False SECRET_KEY = 'melhor isso aqui depois =D' class Producao(BaseConfig): SECRET_KEY = 'aqui deve ser melhorado ainda mais - de um arquivo de fora.' DEBUG = False class Desenvolvimento(BaseConfig): TESTING = True
class Baseconfig: debug = True testing = False secret_key = 'melhor isso aqui depois =D' class Producao(BaseConfig): secret_key = 'aqui deve ser melhorado ainda mais - de um arquivo de fora.' debug = False class Desenvolvimento(BaseConfig): testing = True
def regular_intervals(points, interval): cum_distance = 0.0 first = True for p in points: if first: yield p first = False else: cum_distance += p['distance'] last_p = p if cum_distance >= interval: yield p cum_dista...
def regular_intervals(points, interval): cum_distance = 0.0 first = True for p in points: if first: yield p first = False else: cum_distance += p['distance'] last_p = p if cum_distance >= interval: yield p cum_distan...
# Base of the number - count of digits used un that number system # Smallest entity of data in computing is a bit - either 0 or 1 # bit = BInary digiT # Bit to the extreme left is the MSB (Most Significant Bit) # Bit to the extreme right is the LSB (Least Significant Bit) class ConvertToBinary: def __init__(self, ...
class Converttobinary: def __init__(self, i): self.i = i def dec2bin(self): if isinstance(self.i, int): return self.int2bin() elif isinstance(self.i, float): return self.float2bin() else: raise value_error('Given value is neither integer nor ...
with open('2017/day_02/list.txt', encoding="utf-8") as f: lines = f.readlines() v = 0 for i in lines: t = i.split('\t') t[len(t)-1] = t[len(t)-1].split('\n')[0] t.sort(key=int) v += int(t[len(t)-1]) - int(t[0]) print(v)
with open('2017/day_02/list.txt', encoding='utf-8') as f: lines = f.readlines() v = 0 for i in lines: t = i.split('\t') t[len(t) - 1] = t[len(t) - 1].split('\n')[0] t.sort(key=int) v += int(t[len(t) - 1]) - int(t[0]) print(v)
class Nodo(): def __init__(self, val, izq=None, der=None): self.valor = val self.izq = izq self.der = der
class Nodo: def __init__(self, val, izq=None, der=None): self.valor = val self.izq = izq self.der = der
x = int(input('Digite um valor:')) print('{} x {} = {}'.format(x, 1, (x *1))) print('{} x {} = {}'.format(x, 2, (x*2))) print('{} x {} = {} '.format(x, 3,(x*3))) print('{} x {} = {}'.format(x, 4, (x*4))) print('{} x {} = {}'.format(x, 5, (x*5))) print('{} x {} = {}'.format(x, 6, (x*6))) print('{} x {} = {} '.format(x,...
x = int(input('Digite um valor:')) print('{} x {} = {}'.format(x, 1, x * 1)) print('{} x {} = {}'.format(x, 2, x * 2)) print('{} x {} = {} '.format(x, 3, x * 3)) print('{} x {} = {}'.format(x, 4, x * 4)) print('{} x {} = {}'.format(x, 5, x * 5)) print('{} x {} = {}'.format(x, 6, x * 6)) print('{} x {} = {} '.format(x, ...
li = [1, 1] #_ [int,int,] it = iter(li) #_ listiterator tu = (1, 1) #_ (int,int,) it = iter(tu) #_ tupleiterator ra = range(2) #_ [int,int,] it = iter(ra) #_ listiterator
li = [1, 1] it = iter(li) tu = (1, 1) it = iter(tu) ra = range(2) it = iter(ra)
# -*- encoding: utf-8 -*- # @Time : 11/24/18 3:00 PM # @File : settings.py TEXTS_SIZE = 400 TEXT_NOISE_SIZE = 410 EMBEDDING_SIZE = 300 PREFIX = "/gated_fusion_network" IMAGES_SIZE = 4 IMAGE_NOISE_SIZE = 50 LEAVES_SIZE = 300 LEAF_NOISE_SIZE = 350 EMBEDDING_MATRIX_FN = PREFIX + "/word2vec_embedding_matrix.pkl...
texts_size = 400 text_noise_size = 410 embedding_size = 300 prefix = '/gated_fusion_network' images_size = 4 image_noise_size = 50 leaves_size = 300 leaf_noise_size = 350 embedding_matrix_fn = PREFIX + '/word2vec_embedding_matrix.pkl' gfn_init_parameters = {'texts_size': TEXTS_SIZE, 'embedding_size': EMBEDDING_SIZE, 'v...
def grade(autogen, key): n = autogen.instance if "flag_{}_do_the_hard_work_to_make_it_simple".format(n) == key.lower().strip(): return True, "Correct!" else: return False, "Try Again."
def grade(autogen, key): n = autogen.instance if 'flag_{}_do_the_hard_work_to_make_it_simple'.format(n) == key.lower().strip(): return (True, 'Correct!') else: return (False, 'Try Again.')
score_regular = {'A': 11, 'K': 4, 'Q': 3, 'J': 2, 'T': 10, '9': 0, '8': 0, '7': 0} score_trump = {'A': 11, 'K': 4, 'Q': 3, 'J': 20, 'T': 10, '9': 14, '8': 0, '7': 0} inp = input().split() hands = int(inp[0]) trump_suite = inp[1] score = 0 for i in range(4*hands): hand = input() score += score_trump[hand[0]] i...
score_regular = {'A': 11, 'K': 4, 'Q': 3, 'J': 2, 'T': 10, '9': 0, '8': 0, '7': 0} score_trump = {'A': 11, 'K': 4, 'Q': 3, 'J': 20, 'T': 10, '9': 14, '8': 0, '7': 0} inp = input().split() hands = int(inp[0]) trump_suite = inp[1] score = 0 for i in range(4 * hands): hand = input() score += score_trump[hand[0]] i...
# A single node of a singly linked list class Node: # constructor def __init__(self, data, next=None): self.data = data self.next = next # Creating a single node first = Node(3) print(first.data)
class Node: def __init__(self, data, next=None): self.data = data self.next = next first = node(3) print(first.data)
def get_index(flower_n): if flower_n == "Roses": return 0 elif flower_n == "Dahlias": return 1 elif flower_n == "Tulips": return 2 elif flower_n == "Narcissus": return 3 elif flower_n == "Gladiolus": return 4 flower = input() count_of_flowers = int(input()) ...
def get_index(flower_n): if flower_n == 'Roses': return 0 elif flower_n == 'Dahlias': return 1 elif flower_n == 'Tulips': return 2 elif flower_n == 'Narcissus': return 3 elif flower_n == 'Gladiolus': return 4 flower = input() count_of_flowers = int(input()) bu...
# Copyright 2014 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
load('@io_bazel_rules_go//go/private:common.bzl', 'split_srcs', 'to_set', 'sets') load('@io_bazel_rules_go//go/private:mode.bzl', 'get_mode', 'mode_string') load('@io_bazel_rules_go//go/private:providers.bzl', 'GoLibrary', 'GoSourceList', 'GoArchive', 'GoArchiveData', 'sources') load('@io_bazel_rules_go//go/platform:li...
class Condor: def __init__(self): self.desc = 'load2: jsub_ext3.backend.condor.Condor' class ClassWithSpecificName: def __init__(self): self.desc = 'load1: jsub_ext3.backend.condor.ClassWithSpecificName' class ClassWithAnotherName: def __init__(self): self.desc = 'load2: jsub_ext3....
class Condor: def __init__(self): self.desc = 'load2: jsub_ext3.backend.condor.Condor' class Classwithspecificname: def __init__(self): self.desc = 'load1: jsub_ext3.backend.condor.ClassWithSpecificName' class Classwithanothername: def __init__(self): self.desc = 'load2: jsub_ex...
n=str(input()) d={"0":"zero","1":"one","2":"two","3":"three","4":"four","5":"five", "6":"six","7":"seven","8":"eight","9":"nine"} for i in n: print(d[i],end=" ")
n = str(input()) d = {'0': 'zero', '1': 'one', '2': 'two', '3': 'three', '4': 'four', '5': 'five', '6': 'six', '7': 'seven', '8': 'eight', '9': 'nine'} for i in n: print(d[i], end=' ')
# Much faster and more elegant than brute force solution def remove(array, even): if even: mod = 2 else: mod = 1 return [array[i] for i in range(len(array)) if i % 3 == mod] num_elves = 3014387 elves = [i + 1 for i in range(num_elves)] while len(elves) > 1: midpoint = int(len(elves) ...
def remove(array, even): if even: mod = 2 else: mod = 1 return [array[i] for i in range(len(array)) if i % 3 == mod] num_elves = 3014387 elves = [i + 1 for i in range(num_elves)] while len(elves) > 1: midpoint = int(len(elves) / 2) preserved_array = elves[:midpoint] to_prune_arra...
#Config MYSQL_HOST = '45.78.57.84' MYSQL_PORT = 3306 MYSQL_USER = 'ss' MYSQL_PASS = 'ss' MYSQL_DB = 'shadowsocks' MANAGE_PASS = 'ss233333333' #if you want manage in other server you should set this value to global ip MANAGE_BIND_IP = '127.0.0.1' #make sure this port is idle MANAGE_PORT = 23333
mysql_host = '45.78.57.84' mysql_port = 3306 mysql_user = 'ss' mysql_pass = 'ss' mysql_db = 'shadowsocks' manage_pass = 'ss233333333' manage_bind_ip = '127.0.0.1' manage_port = 23333
class Solution: # @param s, a string # @return a string def reverseWords(self, s): b = s.rstrip().lstrip().split(' ') b = filter(lambda x: len(x) > 0, b) b.reverse() return ' '.join(b)
class Solution: def reverse_words(self, s): b = s.rstrip().lstrip().split(' ') b = filter(lambda x: len(x) > 0, b) b.reverse() return ' '.join(b)
# Copyright (c) 2020-2022, Adam Karpierz # Licensed under the BSD license # https://opensource.org/licenses/BSD-3-Clause __import__("pkg_about").about() __copyright__ = f"Copyright (c) 2020-2022 {__author__}" # noqa
__import__('pkg_about').about() __copyright__ = f'Copyright (c) 2020-2022 {__author__}'
n=100 f=1 for i in range(1,101): f*=i print(f) s=0 c=str(f) for i in c: s+=int(i) print("sum is ",s)
n = 100 f = 1 for i in range(1, 101): f *= i print(f) s = 0 c = str(f) for i in c: s += int(i) print('sum is ', s)
# a terrible brute force way to get a list of values (with key) in disired order def ez_sort(ListToSort,ListInOrder,index=0): Ordered = [] for x in ListInOrder: i = 0 for y in ListToSort: if y[index] == x: Ordered.append(y) i = i + 1 return Ordered ...
def ez_sort(ListToSort, ListInOrder, index=0): ordered = [] for x in ListInOrder: i = 0 for y in ListToSort: if y[index] == x: Ordered.append(y) i = i + 1 return Ordered testcase = ([1, 2, 3, 4, 5], [[2, 11], [3, 23], [1, 32], [4, 45]]) tc1 = [2, 3, 1,...
''' Control: robot.move_forward() robot.rotate_right() robot.rotate_left() robot.display_color(string) robot.finish_round() Sensors: robot.ultrasonic_front() -> int robot.ultrasonic_right() -> int robot.ultrasonic_left() -> int robot.get_color() -> string ''' def main(): robot.m...
""" Control: robot.move_forward() robot.rotate_right() robot.rotate_left() robot.display_color(string) robot.finish_round() Sensors: robot.ultrasonic_front() -> int robot.ultrasonic_right() -> int robot.ultrasonic_left() -> int robot.get_color() -> string """ def main(): robot.m...