content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
X, Y, A, B = map(int, input().split())
ans = 0
while True:
if X*A < B and X*A < Y:
X *= A
ans += 1
else:
break
ans += (Y-X-1)//B
print(ans)
| (x, y, a, b) = map(int, input().split())
ans = 0
while True:
if X * A < B and X * A < Y:
x *= A
ans += 1
else:
break
ans += (Y - X - 1) // B
print(ans) |
old_file = open('city.txt', 'r')
new_file = open('city_with_format.txt', 'w')
all_cities = old_file.readlines()
# print all_cities
for i in all_cities:
city, country = i.strip().split()
new_file.write('%-25s%-25s\n' % (city, country))
old_file.close()
new_file.close()
| old_file = open('city.txt', 'r')
new_file = open('city_with_format.txt', 'w')
all_cities = old_file.readlines()
for i in all_cities:
(city, country) = i.strip().split()
new_file.write('%-25s%-25s\n' % (city, country))
old_file.close()
new_file.close() |
{
'targets': [
{
'configurations': {
'Debug': { },
'Release': { }
},
'target_name': 'appels',
'type': 'executable',
'dependencies': [
'third_party/skia/skia.gyp:alltargets',
'third_party/skia/gyp/sdl.gyp:sdl',
],
'include_dirs': [
'... | {'targets': [{'configurations': {'Debug': {}, 'Release': {}}, 'target_name': 'appels', 'type': 'executable', 'dependencies': ['third_party/skia/skia.gyp:alltargets', 'third_party/skia/gyp/sdl.gyp:sdl'], 'include_dirs': ['third_party/skia/include/config', 'third_party/skia/include/core', 'third_party/skia/include/gpu', ... |
def pattern(n):
if n <= 1:
return ""
res = ""
for i in range(1, n//2+1):
res += str(i*2)*(i*2)+"\n"
return res[:-1] | def pattern(n):
if n <= 1:
return ''
res = ''
for i in range(1, n // 2 + 1):
res += str(i * 2) * (i * 2) + '\n'
return res[:-1] |
TOTAL_CHARACTERS = 'SELECT COUNT(character_id) FROM charactercreator_character;'
TOTAL_SUBCLASS = '''
SELECT COUNT(*) FROM (SELECT *
FROM charactercreator_character cc_c
INNER JOIN charactercreator_necromancer cc_n
ON cc_c.character_id = cc... | total_characters = 'SELECT COUNT(character_id) FROM charactercreator_character;'
total_subclass = '\n SELECT COUNT(*) FROM (SELECT *\n FROM charactercreator_character cc_c\n INNER JOIN charactercreator_necromancer cc_n\n ON cc_c.character_id = ... |
response.title = settings.title
response.subtitle = settings.subtitle
response.meta.author = '%(author)s <%(author_email)s>' % settings
response.meta.keywords = settings.keywords
response.meta.description = settings.description
response.menu = [
(T('Home'),URL('default','index')==URL(),URL('default','index'),[]),
(T('C... | response.title = settings.title
response.subtitle = settings.subtitle
response.meta.author = '%(author)s <%(author_email)s>' % settings
response.meta.keywords = settings.keywords
response.meta.description = settings.description
response.menu = [(t('Home'), url('default', 'index') == url(), url('default', 'index'), []),... |
class Solution:
def split(self, spaces: int, sets: int) -> Iterable[int]:
if (spaces % sets == 0):
rem = spaces // sets
return (rem for i in range(sets))
else:
rem, bigRem = sets - (spaces % sets), spaces//sets
return (bigRem + 1 if (i >= rem) else big... | class Solution:
def split(self, spaces: int, sets: int) -> Iterable[int]:
if spaces % sets == 0:
rem = spaces // sets
return (rem for i in range(sets))
else:
(rem, big_rem) = (sets - spaces % sets, spaces // sets)
return (bigRem + 1 if i >= rem else b... |
#
# PySNMP MIB module FMS100-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FMS100-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:14:07 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, 09:... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, constraints_intersection, value_range_constraint, value_size_constraint) ... |
{
"targets": [
{
"target_name": "cpp-netlib",
"type": "static_library", # unlike boost-asio which is header-only
"include_dirs": [
"0.11.1-final/cpp-netlib-cpp-netlib-0.11.1-final"
],
"defines": [
"BOOST_NETWORK_ENAB... | {'targets': [{'target_name': 'cpp-netlib', 'type': 'static_library', 'include_dirs': ['0.11.1-final/cpp-netlib-cpp-netlib-0.11.1-final'], 'defines': ['BOOST_NETWORK_ENABLE_HTTPS'], 'sources': ['0.11.1-final/cpp-netlib-cpp-netlib-0.11.1-final/libs/network/src/*.cpp', '0.11.1-final/cpp-netlib-cpp-netlib-0.11.1-final/libs... |
def chdir():
pass
def getcwd():
pass
def listdir():
pass
def mkdir():
pass
def remove():
pass
def rename():
pass
def rmdir():
pass
sep = "/"
def stat():
pass
def statvfs():
pass
def sync():
pass
def uname():
pass
def unlink():
pass
def urandom():... | def chdir():
pass
def getcwd():
pass
def listdir():
pass
def mkdir():
pass
def remove():
pass
def rename():
pass
def rmdir():
pass
sep = '/'
def stat():
pass
def statvfs():
pass
def sync():
pass
def uname():
pass
def unlink():
pass
def urandom():
pass |
# Given a linked list, rotate the list to the right by k places, where k is non-negative.
#
# Example 1:
#
# Input: 1->2->3->4->5->NULL, k = 2
# Output: 4->5->1->2->3->NULL
# Explanation:
# rotate 1 steps to the right: 5->1->2->3->4->NULL
# rotate 2 steps to the right: 4->5->1->2->3->NULL
# Example 2:
#
# Input: 0->1->... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def rotate_right(self, head, k):
if not head:
return head
if not head.next:
return head
length = 0
curr = head
while curr:
length +=... |
# 28 Wind Chill
#Asking for air temperature and wind speed.
T = float(input('Enter the air temperature in celsius= '))
v = float(input('Enter the velocity of windin km/h = '))
x = round(13.12 * 0.6215 * T - 11.37 * v ** 0.16 + 0.3965 * T * v ** 0.16)
print('Wind chill index = ',x)
| t = float(input('Enter the air temperature in celsius= '))
v = float(input('Enter the velocity of windin km/h = '))
x = round(13.12 * 0.6215 * T - 11.37 * v ** 0.16 + 0.3965 * T * v ** 0.16)
print('Wind chill index = ', x) |
##Read the dictionary
fh = open('C:\\english-dict.txt')
dict = []
while True:
line = fh.readline()
dict.append(line.strip())
if not line:
break
fh.close()
#Enter letters to use when compile a list of words
letters = input("Please enter your letters: ")
letters_set=set(letters)
mini = input("Minimu... | fh = open('C:\\english-dict.txt')
dict = []
while True:
line = fh.readline()
dict.append(line.strip())
if not line:
break
fh.close()
letters = input('Please enter your letters: ')
letters_set = set(letters)
mini = input('Minimum length of the word (default is 2): ')
maks = int(input('Maximum length ... |
class Collector:
def __init__(self, name, have_task=True):
self.name = name
self.have_task = have_task
self.data_dict = None
self.last_collect = 0
def run_task(self):
pass
def get_data(self):
pass
| class Collector:
def __init__(self, name, have_task=True):
self.name = name
self.have_task = have_task
self.data_dict = None
self.last_collect = 0
def run_task(self):
pass
def get_data(self):
pass |
def digit_powers():
res = []
for i in range(1, 10):
j = 0
while True:
j += 1
num = i ** j
num_digits = len(str(num))
if num_digits != j:
break
res += [num]
return res | def digit_powers():
res = []
for i in range(1, 10):
j = 0
while True:
j += 1
num = i ** j
num_digits = len(str(num))
if num_digits != j:
break
res += [num]
return res |
print((type(None)))
print(type(True))
print(type(5))
print(type(5.5))
print(type('hi'))
print(type([]))
print(type(()))
print(type({})) | print(type(None))
print(type(True))
print(type(5))
print(type(5.5))
print(type('hi'))
print(type([]))
print(type(()))
print(type({})) |
a=1
b=2
print('a=',a,'b=',b)
x=3
y=3
z=3
print(x,y,z) | a = 1
b = 2
print('a=', a, 'b=', b)
x = 3
y = 3
z = 3
print(x, y, z) |
res = 0
n = 0
print("S= ", end="")
for n2 in range(1, 51):
if n2 == 1:
n += 1
print(f"{n}/{n}", end="")
else:
n += 2
res += (n / n2)
print(f" + {n}/{n2}", end="")
print(f"\nResultado = {res}")
| res = 0
n = 0
print('S= ', end='')
for n2 in range(1, 51):
if n2 == 1:
n += 1
print(f'{n}/{n}', end='')
else:
n += 2
res += n / n2
print(f' + {n}/{n2}', end='')
print(f'\nResultado = {res}') |
def alphabeta(node, is_max=True, alpha=float('-inf'), beta=float('inf')):
if node and not node.children:
return (node.val, [node])
elif is_max:
# Can always fall back on alpha. This is the lower bound score
for child in node.children:
score, path = minimax(child, False, alpha... | def alphabeta(node, is_max=True, alpha=float('-inf'), beta=float('inf')):
if node and (not node.children):
return (node.val, [node])
elif is_max:
for child in node.children:
(score, path) = minimax(child, False, alpha, beta)
if score > beta:
return (score,... |
# -*- coding: utf-8 -*-
class ErrorResponse(Exception):
def __init__(self, error=None, errorcode=None, errormessage=None,
errordetails=None):
self.error = error
self.errorcode = errorcode
self.errormessage = errormessage
self.errordetails = errordetails
def _... | class Errorresponse(Exception):
def __init__(self, error=None, errorcode=None, errormessage=None, errordetails=None):
self.error = error
self.errorcode = errorcode
self.errormessage = errormessage
self.errordetails = errordetails
def __str__(self):
return repr(self)
... |
def primes(n):
for i, prime in enumerate(prime_generator()):
if i == n:
return prime
def prime_generator():
n = 2
primes = set()
while True:
for p in primes:
if n % p == 0:
break
else:
primes.add(n)
yield n
... | def primes(n):
for (i, prime) in enumerate(prime_generator()):
if i == n:
return prime
def prime_generator():
n = 2
primes = set()
while True:
for p in primes:
if n % p == 0:
break
else:
primes.add(n)
yield n
... |
#-*-coding=utf-8-*-
class Node(object):
def __init__(self, elem=-1,lchild=None, rchild=None):
self.elem=elem
self.lchild=lchild
self.rchild=rchild
class Tree(object):
def __init__(self):
self.root=Node()
self.nodequeue=[]
def addnode(self, elem):
node =Node(e... | class Node(object):
def __init__(self, elem=-1, lchild=None, rchild=None):
self.elem = elem
self.lchild = lchild
self.rchild = rchild
class Tree(object):
def __init__(self):
self.root = node()
self.nodequeue = []
def addnode(self, elem):
node = node(elem)
... |
def f(n:Int)->Int:
return (n * (n+1)) // 2
def get_numbers(how_many:Int)->List(Int):
nums = []
for i in range(1, 1 + how_many):
nums.append(f)
return nums
print(get_numbers(4))
def apply_first(funs, n):
return funs[0](n)
print(apply_first(get_numbers(4), 10))
| def f(n: Int) -> Int:
return n * (n + 1) // 2
def get_numbers(how_many: Int) -> list(Int):
nums = []
for i in range(1, 1 + how_many):
nums.append(f)
return nums
print(get_numbers(4))
def apply_first(funs, n):
return funs[0](n)
print(apply_first(get_numbers(4), 10)) |
'''
Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
An input string is valid if:
Open brackets must be closed by the same type of brackets.
Open brackets must be closed in the correct order.
'''
class Solution:
def isValid(self, s: str) -> ... | """
Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
An input string is valid if:
Open brackets must be closed by the same type of brackets.
Open brackets must be closed in the correct order.
"""
class Solution:
def is_valid(self, s: str) -... |
def contador(* num): # O asterisco no contador significa que pode receber diversos valores e vai colocar dentro de uma tupla
for valor in num:
print(f' {valor} ', end='')
print(f'Recebi os valores {num} e sao ao todo {len(num)}')
print('Fim')
contador(2, 1, 7)
contador(4, 0, 4, 6, 9, 8)
def so... | def contador(*num):
for valor in num:
print(f' {valor} ', end='')
print(f'Recebi os valores {num} e sao ao todo {len(num)}')
print('Fim')
contador(2, 1, 7)
contador(4, 0, 4, 6, 9, 8)
def soma(*valores):
s = 0
for n in valores:
s += n
print(f'somando os valores{valores} tems {s}'... |
#
# This file contains the Python code from Program 11.22 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/pgm11_22.txt
#
class Simulation(... | class Simulation(object):
arrival = 0
departure = 1
def __init__(self):
super(Simulation, self).__init__()
self._eventList = leftist_heap()
self._serverBusy = False
self._numberInQueue = 0
self._serviceTime = exponential_rv(100.0)
self._interArrivalTime = exp... |
NETWORKS = {
3: {
"name": "test",
"http_provider": "https://ropsten.infura.io",
"ws_provider": "wss://ropsten.infura.io/ws",
"db": {
"DB_DRIVER": "mysql+pymysql",
"DB_HOST": "localhost",
"DB_USER": "unittest_root",
"DB_PASSWORD": "unitt... | networks = {3: {'name': 'test', 'http_provider': 'https://ropsten.infura.io', 'ws_provider': 'wss://ropsten.infura.io/ws', 'db': {'DB_DRIVER': 'mysql+pymysql', 'DB_HOST': 'localhost', 'DB_USER': 'unittest_root', 'DB_PASSWORD': 'unittest_pwd', 'DB_NAME': 'verification_unittest_db', 'DB_PORT': 3306}}}
network_id = 3
slac... |
# Declares an initial list with 5 values
List1 = [1,2,3,4,5]
# Unpacks this list into 5 separate variables
a,b,c,d,e = List1
# Prints both the list and one of the unpacking variables
print(List1)
print(a)
# Changes the value of a to 6
a = 6
# Prints both the list and a, and we can see that changing a d... | list1 = [1, 2, 3, 4, 5]
(a, b, c, d, e) = List1
print(List1)
print(a)
a = 6
print(a)
print(List1)
List1[1] = 9
print(List1)
print(b) |
def sum_of_multiples(limit, multiples):
multiples_set = set()
for multiple in multiples:
if multiple != 0:
quotient, rest = divmod(limit, multiple)
if rest == 0:
quotient -=1
multiples_set = multiples_set.union(set(multiple * i for i in range(1,quotie... | def sum_of_multiples(limit, multiples):
multiples_set = set()
for multiple in multiples:
if multiple != 0:
(quotient, rest) = divmod(limit, multiple)
if rest == 0:
quotient -= 1
multiples_set = multiples_set.union(set((multiple * i for i in range(1, qu... |
# Size of the window
SCREEN_WIDTH = 1200
SCREEN_HEIGHT = 800
# Default friction used for sprites, unless otherwise specified
DEFAULT_FRICTION = 0.2
# Default mass used for sprites
DEFAULT_MASS = 1
# Gravity
GRAVITY = (0.0, -900.0)
# Player forces
PLAYER_MOVE_FORCE = 700
PLAYER_JUMP_IMPULSE = 600
PLAYER_PUNCH_IMPULS... | screen_width = 1200
screen_height = 800
default_friction = 0.2
default_mass = 1
gravity = (0.0, -900.0)
player_move_force = 700
player_jump_impulse = 600
player_punch_impulse = 600
sprite_size = 64
viewport_margin = 100 |
def opcodeI() -> int:
with open("/home/thelichking/Desktop/adventOfCode/Day2/Opcodes",'r' ) as file:
lines = list(map(int,file.readline().replace("\n","").split(",")))
lines[1],lines[2] = 1,0
idx = 0
while idx < len(lines):
cur_opcode = lines[idx]
if cur_op... | def opcode_i() -> int:
with open('/home/thelichking/Desktop/adventOfCode/Day2/Opcodes', 'r') as file:
lines = list(map(int, file.readline().replace('\n', '').split(',')))
(lines[1], lines[2]) = (1, 0)
idx = 0
while idx < len(lines):
cur_opcode = lines[idx]
if ... |
# Advent Of Code 2016, day 3, part 2
# http://adventofcode.com/2016/day/3
# solution by ByteCommander, 2016-12-03
data = open("inputs/aoc2016_3.txt").read()
# parse input to vertical groups of 3 numbers
rows = [[int(x) for x in line.split()] for line in data.splitlines()]
vertically = [item for inner in zip(*rows) fo... | data = open('inputs/aoc2016_3.txt').read()
rows = [[int(x) for x in line.split()] for line in data.splitlines()]
vertically = [item for inner in zip(*rows) for item in inner]
v3 = [vertically[i:i + 3] for i in range(0, len(vertically), 3)]
counter = 0
for (a, b, c) in v3:
if a + b > c and a + c > b and (b + c > a):... |
__title__ = "pyls-isort"
__version__ = "0.1.1"
__summary__ = "Isort plugin for python-language-server"
__uri__ = "https://github.com/paradoxxxzero/pyls-isort"
__author__ = "Florian Mounier"
__email__ = "paradoxxx.zero@gmail.com"
__license__ = "MIT"
__copyright__ = "Copyright 2017 %s" % __author__
| __title__ = 'pyls-isort'
__version__ = '0.1.1'
__summary__ = 'Isort plugin for python-language-server'
__uri__ = 'https://github.com/paradoxxxzero/pyls-isort'
__author__ = 'Florian Mounier'
__email__ = 'paradoxxx.zero@gmail.com'
__license__ = 'MIT'
__copyright__ = 'Copyright 2017 %s' % __author__ |
class Solutions(object):
def singleNumber(self, nums):
res = 0
for i in range(32):
bit_i_sum = 0
for num in nums:
bit_i_sum += (num >> i) & 1
res += (bit_i_sum % 3) << i
return res
if __name__ == '__main__':
print(Solutions().single... | class Solutions(object):
def single_number(self, nums):
res = 0
for i in range(32):
bit_i_sum = 0
for num in nums:
bit_i_sum += num >> i & 1
res += bit_i_sum % 3 << i
return res
if __name__ == '__main__':
print(solutions().singleNumber... |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'voicex_dev', # Or path to database file if using sqlite3.
'USER': 'postgres', # Not used with sqlite3... | databases = {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'voicex_dev', 'USER': 'postgres', 'PASSWORD': 'postgres', 'HOST': 'localhost', 'PORT': ''}}
logging = {'version': 1, 'disable_existing_loggers': True, 'formatters': {'standard': {'format': '[%(asctime)s] %(levelname)s [%(name)s:%(linen... |
#Why is the error and how to fix it?
#A: A TypeError menas you are using the wrong type to make an operation. Change print(a+b) to return a+b
def foo(a, b):
print(a + b)
x = foo(2, 3) * 10
| def foo(a, b):
print(a + b)
x = foo(2, 3) * 10 |
n=int(input('enter a program : '))
for i in range(n):
for j in range(n-1,i,-1):
print(' ',end=' ')
for k in range(0,i):
print(chr(65+k),end=' ')
print() | n = int(input('enter a program : '))
for i in range(n):
for j in range(n - 1, i, -1):
print(' ', end=' ')
for k in range(0, i):
print(chr(65 + k), end=' ')
print() |
notes = [4,5,3,3,1]
students=["Harry", "Ron","Hemrine", "Ginny", "Draco"]
for i in range(len(students)):
print(f'{students[i]} hat im Fach Zaubertranke die Note {notes[i]} erhalten.') | notes = [4, 5, 3, 3, 1]
students = ['Harry', 'Ron', 'Hemrine', 'Ginny', 'Draco']
for i in range(len(students)):
print(f'{students[i]} hat im Fach Zaubertranke die Note {notes[i]} erhalten.') |
#
# Automatically generated
#
class RTOpcodes(object):
pass
RTOpcodes.JSR = 0x00
RTOpcodes.IMMSHORT = 0x00
RTOpcodes.IMMLONG = 0x10
RTOpcodes.VARSHORT = 0x20
RTOpcodes.VARLONG = 0x30
RTOpcodes.ABS = 0x40
RTOpcodes.LDR = 0x80
RTOpcodes.AND = 0x81
RTOpcodes.ORR = 0x82
RTOpcodes.XOR = 0x83
RTOpcodes.ADD = 0x84
RTOpcod... | class Rtopcodes(object):
pass
RTOpcodes.JSR = 0
RTOpcodes.IMMSHORT = 0
RTOpcodes.IMMLONG = 16
RTOpcodes.VARSHORT = 32
RTOpcodes.VARLONG = 48
RTOpcodes.ABS = 64
RTOpcodes.LDR = 128
RTOpcodes.AND = 129
RTOpcodes.ORR = 130
RTOpcodes.XOR = 131
RTOpcodes.ADD = 132
RTOpcodes.SUB = 133
RTOpcodes.MLT = 134
RTOpcodes.DIV = ... |
# model settings
_base_ = './hv_pointpillars_secfpn_6x8_160e_kitti-3d-3class.py'
voxel_size = [0.16, 0.16, 4]
point_cloud_range = [0, -39.68, -3, 69.12, 39.68, 1]
model = dict(
voxel_encoder=dict(
type='PillarFeatureNet',
in_channels=4,
feat_channels=[64],
with_distance=False,
... | _base_ = './hv_pointpillars_secfpn_6x8_160e_kitti-3d-3class.py'
voxel_size = [0.16, 0.16, 4]
point_cloud_range = [0, -39.68, -3, 69.12, 39.68, 1]
model = dict(voxel_encoder=dict(type='PillarFeatureNet', in_channels=4, feat_channels=[64], with_distance=False, voxel_size=voxel_size, point_cloud_range=[0, -39.68, -3, 69.1... |
numstr=''
sumnum=0
strng=input('Enter a string:')
for a in strng:
if a.isdigit():
numstr+=a
sumnum+=int(a)
if sumnum==0:
print(strng,'has no digits.')
else:
print(strng,'has digits',numstr,'that sum to',sumnum)
| numstr = ''
sumnum = 0
strng = input('Enter a string:')
for a in strng:
if a.isdigit():
numstr += a
sumnum += int(a)
if sumnum == 0:
print(strng, 'has no digits.')
else:
print(strng, 'has digits', numstr, 'that sum to', sumnum) |
#!/usr/bin/env python2
#!coding=utf-8
basic_command = [
('help', 'Show this help'),
('login', 'Login using Baidu account'),
('download', 'Download file from the Baidu pan link'),
('show', 'Show the Baidu pan real link and filename'),
('export', 'export link to aria2 json... | basic_command = [('help', 'Show this help'), ('login', 'Login using Baidu account'), ('download', 'Download file from the Baidu pan link'), ('show', 'Show the Baidu pan real link and filename'), ('export', 'export link to aria2 json-rpc'), ('config', 'save configuration to file')]
extended_usage = ''
def join_commands... |
class Solution:
def findTheDifference(self, s: str, t: str) -> str:
result = 0
for char in s:
result ^= ord(char)
for char in t:
result ^= ord(char)
return chr(result) | class Solution:
def find_the_difference(self, s: str, t: str) -> str:
result = 0
for char in s:
result ^= ord(char)
for char in t:
result ^= ord(char)
return chr(result) |
#Given the year number. You need to check if this year is a leap year. If it is, print LEAP, otherwise print COMMON.
year = int(input("year=?"))
if year % 4 == 0 and year % 100 != 0:
print("It is a leap year!")
elif year % 400 == 0:
print("it is a leap year!")
else:
print("It is not a leap year")
| year = int(input('year=?'))
if year % 4 == 0 and year % 100 != 0:
print('It is a leap year!')
elif year % 400 == 0:
print('it is a leap year!')
else:
print('It is not a leap year') |
def two_fer_va(name=None):
if name is None:
name = 'you'
return f'One for {name}, one for me.'
def two_fer_vb(name=None):
return f'One for {"you" if name is None else name}, one for me.'
def two_fer_vc(name=None):
return f'One for {name or "you"}, one for me.'
def two_fer_vd(name='you'):
... | def two_fer_va(name=None):
if name is None:
name = 'you'
return f'One for {name}, one for me.'
def two_fer_vb(name=None):
return f"One for {('you' if name is None else name)}, one for me."
def two_fer_vc(name=None):
return f"One for {name or 'you'}, one for me."
def two_fer_vd(name='you'):
... |
# Find the Ascii value of user input string.
# define ASCII_value() function with user-input string as argument.
def ASCII_value(charInput):
print("\nASCII value :", end = ' ')
#Getting each character of the user input string
for i in range(len(charInput)):
#Finding the ASCII value of ea... | def ascii_value(charInput):
print('\nASCII value :', end=' ')
for i in range(len(charInput)):
print(str(ord(charInput[i])), end=' ')
if __name__ == '__main__':
user_input = input('\nENTER ANY CHARACTER : ')
ascii_value(userInput) |
n,k=map(int,input().split())
for i in range(1,10):
rem=(n*i)%10
if(rem==0 or rem==k):
print(i)
break
| (n, k) = map(int, input().split())
for i in range(1, 10):
rem = n * i % 10
if rem == 0 or rem == k:
print(i)
break |
student = {
"name": "Mark",
"student_id": 15163,
"feedback": None
}
student["last_name"] = "Kowalski"
try:
last_name = student["last_name"]
numbered_last_name = 3 + last_name
except KeyError:
print
except TypeError as error:
print("I can't add these two together!")
print(error)
print(... | student = {'name': 'Mark', 'student_id': 15163, 'feedback': None}
student['last_name'] = 'Kowalski'
try:
last_name = student['last_name']
numbered_last_name = 3 + last_name
except KeyError:
print
except TypeError as error:
print("I can't add these two together!")
print(error)
print('This code execut... |
# use your username and password
USERNAME = ''
PASSWORD = ''
# URL = 'http://192.168.168.6/sess/Start.aspx'
URL = 'http://pershiess.fasau.ac.ir/sess/Start.aspx'
# # Changing user agent to trick websites (for headless use)
# # with phantomjs (for headless use)
# DCAP = dict("")
# DCAP["phantomjs.page.settings.userAge... | username = ''
password = ''
url = 'http://pershiess.fasau.ac.ir/sess/Start.aspx' |
def generate_permutations(L,i=None,n=None):
if i==None:
i=0
if n==None:
n=len(L)-1
if i==n:
print(L)
else:
for j in range(i,n+1):
L[i],L[j]=L[j],L[i]
generate_permutations(L,i=i+1,n=n)
L[i],L[j]=L[j],L[i]
L=["a","b","c","d","e"]
generate_permutations(L)
| def generate_permutations(L, i=None, n=None):
if i == None:
i = 0
if n == None:
n = len(L) - 1
if i == n:
print(L)
else:
for j in range(i, n + 1):
(L[i], L[j]) = (L[j], L[i])
generate_permutations(L, i=i + 1, n=n)
(L[i], L[j]) = (L[j], ... |
def int_to_bit(n, nbits, lsb0=True):
'''
convert the integer into a bit string of the number of bits specified.
e.g. if n is in bit is "0111",
if nbits is 5 and lsb0 is True, then it's gonna be "00111".
if lsb0 is False, then its' gonna be "11100".
if nbits is less than n in bit, omit the bits.... | def int_to_bit(n, nbits, lsb0=True):
"""
convert the integer into a bit string of the number of bits specified.
e.g. if n is in bit is "0111",
if nbits is 5 and lsb0 is True, then it's gonna be "00111".
if lsb0 is False, then its' gonna be "11100".
if nbits is less than n in bit, omit the bits.... |
#py_binary_operations.py
base_10_number = 12
fmt = "{:<20} {:<30}"
print("Base 2 operations: left shift increases by powers of 2")
for i in range(3):
print(fmt.format("mybin_1000: ", bin(base_10_number << i)))
print()
print("Base 2 operations: right shift reduces by powers of 2")
for i in range(3):
print(... | base_10_number = 12
fmt = '{:<20} {:<30}'
print('Base 2 operations: left shift increases by powers of 2')
for i in range(3):
print(fmt.format('mybin_1000: ', bin(base_10_number << i)))
print()
print('Base 2 operations: right shift reduces by powers of 2')
for i in range(3):
print(fmt.format('mybin_1000: ', bin(... |
{
"targets": [
# the only purpose of this target is to share settings between celt
# and silk targets.
{
"target_name": "opus_common_settings",
"type": "none",
"direct_dependent_settings" : {
"include_dirs": [
"... | {'targets': [{'target_name': 'opus_common_settings', 'type': 'none', 'direct_dependent_settings': {'include_dirs': ['1.1/opus-1.1/include'], 'defines': ['USE_ALLOCA=', 'OPUS_BUILD']}}, {'target_name': 'celt', 'type': 'static_library', 'include_dirs': ['1.1/opus-1.1/celt'], 'sources': ['1.1/opus-1.1/celt/*.c'], 'sources... |
def max_point(strA, left, right):
if right < left:
return -1
mid = (left + right) // 2
if strA[mid] > strA[mid -1] and strA[mid] > strA[mid + 1]:
return strA[mid]
elif strA[mid] > strA[mid -1] and strA[mid] < strA[mid + 1]:
return max_point(strA, mid, right)
elif strA[mid] < strA[mid -1] and strA[mid] >... | def max_point(strA, left, right):
if right < left:
return -1
mid = (left + right) // 2
if strA[mid] > strA[mid - 1] and strA[mid] > strA[mid + 1]:
return strA[mid]
elif strA[mid] > strA[mid - 1] and strA[mid] < strA[mid + 1]:
return max_point(strA, mid, right)
elif strA[mid] ... |
palette = {
"none": "",
"text": "rgb(40, 40, 40)",
"comment": "rgb(130, 130, 130)",
"string": "rgb(30, 100, 0)",
"function": "rgb(50, 50, 200)",
"value": "rgb(200, 0, 0)",
"type": "rgb(0, 110, 120)",
"reserved": "rgb(80, 0, 0)",
"operator": "rgb(100, 100, 0)",
"call": "rgb(0, 50,... | palette = {'none': '', 'text': 'rgb(40, 40, 40)', 'comment': 'rgb(130, 130, 130)', 'string': 'rgb(30, 100, 0)', 'function': 'rgb(50, 50, 200)', 'value': 'rgb(200, 0, 0)', 'type': 'rgb(0, 110, 120)', 'reserved': 'rgb(80, 0, 0)', 'operator': 'rgb(100, 100, 0)', 'call': 'rgb(0, 50, 200)', 'bracket': 'rgb(100, 100, 200)', ... |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
},
}
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.messages',
'django.contrib.sites',
'djangocms_camerasli... | databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}}
installed_apps = ['django.contrib.contenttypes', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.messages', 'django.contrib.sites', 'djangocms_cameraslider', 'cms', 'easy_thumbnails', 'filer', 'menus', 'sekizai', 'treeb... |
class Agent(object):
def train(self, batch):
raise NotImplementedError
def act(self, observation):
raise NotImplementedError
| class Agent(object):
def train(self, batch):
raise NotImplementedError
def act(self, observation):
raise NotImplementedError |
# this is a list of skills which are not one-lines
ACTIVE_SKILLS = [
"book_skill",
"christmas_new_year_skill",
"dff_coronavirus_skill",
"dummy_skill_dialog",
"emotion_skill",
"game_cooperative_skill",
"meta_script_skill",
"dff_movie_skill",
"news_api_skill",
"oscar_skill",
"p... | active_skills = ['book_skill', 'christmas_new_year_skill', 'dff_coronavirus_skill', 'dummy_skill_dialog', 'emotion_skill', 'game_cooperative_skill', 'meta_script_skill', 'dff_movie_skill', 'news_api_skill', 'oscar_skill', 'personal_info_skill', 'reddit_ner_skill', 'short_story_skill', 'superbowl_skill', 'valentines_dat... |
in_min=136818
in_max=685979
def includes_duplicates(num):
str_num = str(num)
for n in range(len(str_num) - 1):
if str_num[n] == str_num[n + 1]:
return True
return False
def monotonic_increase(num):
str_num = str(num)
for n in range(len(str_num) - 1):
if str_num[n + 1] < str_num[n]:
return False
return... | in_min = 136818
in_max = 685979
def includes_duplicates(num):
str_num = str(num)
for n in range(len(str_num) - 1):
if str_num[n] == str_num[n + 1]:
return True
return False
def monotonic_increase(num):
str_num = str(num)
for n in range(len(str_num) - 1):
if str_num[n + ... |
class Solution:
def findMaximumXOR(self, nums: List[int]) -> int:
mx = 0
for i in reversed(range(31)):
prefixes = set(num >> i for num in nums)
mx <<= 1
cand = mx + 1
for prefix in prefixes:
if (cand ^ prefix) in prefixes:
... | class Solution:
def find_maximum_xor(self, nums: List[int]) -> int:
mx = 0
for i in reversed(range(31)):
prefixes = set((num >> i for num in nums))
mx <<= 1
cand = mx + 1
for prefix in prefixes:
if cand ^ prefix in prefixes:
... |
class TreeNode:
def __init__(self, **kwargs):
self.children = dict()
def get(self, key):
return self.children.get(key, None)
def get_children(self, sort=False):
if sort:
return sorted(self.children.values())
return self.children.values()
def add(self, key, ... | class Treenode:
def __init__(self, **kwargs):
self.children = dict()
def get(self, key):
return self.children.get(key, None)
def get_children(self, sort=False):
if sort:
return sorted(self.children.values())
return self.children.values()
def add(self, key,... |
#add your reddit credentials here
username = "" #username
password = "" #password
client_id = "" #client id
client_secret = "" #client password
subreddits = "memes+dankmemes+me_irl" #subreddits you want to get memes from, it is important not to include spaces b/w '+'
min_upvotes = 150 #minimum number of upvotes
debug =... | username = ''
password = ''
client_id = ''
client_secret = ''
subreddits = 'memes+dankmemes+me_irl'
min_upvotes = 150
debug = True |
# 7. Perfect Number
# Write a function that receives an integer number and returns if this number is perfect or NOT.
# A perfect number is a positive integer that is equal to the sum of its proper positive divisors.
# That is the sum of its positive divisors excluding the number itself (also known as its aliquot sum).
... | def check_if_number_perfect(num):
proper_divisors = []
for digit in range(1, num):
if num % digit == 0:
proper_divisors.append(digit)
if sum(proper_divisors) == num:
return True
return False
number = int(input())
result = check_if_number_perfect(number)
if result:
print('... |
# This is sample in Python language for
# MCS - Most Common (Even/Uneven) Sum
# for given list, size and mode(even/uneven)
# created by https://github.com/trolit
# Press Shift+F10 to execute it.
def get_biggest_sum_depending_on_mode(list_numbers, var_size, var_mode):
# Use a breakpoint in the code line below to d... | def get_biggest_sum_depending_on_mode(list_numbers, var_size, var_mode):
list_numbers_length = len(list_numbers)
if var_size > list_numbers_length or var_size < 2 or (var_mode != 'even' and var_mode != 'uneven'):
print('Requirements not met.')
print()
return
list_numbers.sort(reverse... |
# scoping.level.1.py
def my_function():
test = 1 # this is defined in the local scope of the function
print('my_function:', test)
test = 0 # this is defined in the global scope
my_function()
print('global:', test)
| def my_function():
test = 1
print('my_function:', test)
test = 0
my_function()
print('global:', test) |
_base_ = [
'../_base_/models/lcgn_config.py',
'../_base_/datasets/gqa_dataset.py',
'../_base_/schedules/schedule_vqa.py',
'../_base_/default_runtime.py'
] # yapf:disable
| _base_ = ['../_base_/models/lcgn_config.py', '../_base_/datasets/gqa_dataset.py', '../_base_/schedules/schedule_vqa.py', '../_base_/default_runtime.py'] |
#
class BaseConfig(object):
DEBUG = True
class TestConfig(BaseConfig):
DEBUG = False
TESTING = True
| class Baseconfig(object):
debug = True
class Testconfig(BaseConfig):
debug = False
testing = True |
class Makieta:
def __init__(self, dane):
self.dane = dane
| class Makieta:
def __init__(self, dane):
self.dane = dane |
class Walking_HabitsBaseException(Exception):
pass
class InvalidLayoutError(Walking_HabitsBaseException):
pass
| class Walking_Habitsbaseexception(Exception):
pass
class Invalidlayouterror(Walking_HabitsBaseException):
pass |
# encoding: utf-8
MOCK_QUERY_RESULT = "QUERY_RESULT"
def mock_connection(execution_function=lambda x, y: None,
fetch_function=lambda x: None):
cursor = type('cursor', (object, ), {
'execute': execution_function,
'fetchall': fetch_function
})
def cursor_call(*args, **... | mock_query_result = 'QUERY_RESULT'
def mock_connection(execution_function=lambda x, y: None, fetch_function=lambda x: None):
cursor = type('cursor', (object,), {'execute': execution_function, 'fetchall': fetch_function})
def cursor_call(*args, **kwargs):
return cursor()
connection = type('connecti... |
b = bytes(range(20))
il = int.from_bytes(b, "little")
ib = int.from_bytes(b, "big")
print(il)
print(ib)
print(il.to_bytes(20, "little"))
| b = bytes(range(20))
il = int.from_bytes(b, 'little')
ib = int.from_bytes(b, 'big')
print(il)
print(ib)
print(il.to_bytes(20, 'little')) |
#
# PySNMP MIB module CISCO-ENTITY-PROVISIONING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ENTITY-PROVISIONING-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:39:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ve... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection) ... |
le = [1,12,2,3,1,1,2,3,1,3,4,3,1,5,0,3,2,1,9,19,1,19,5,23,1,13,23,27,1,27,6,31,2,31,6,35,2,6,35,39,1,39,5,43,1,13,43,47,1,6,47,51,2,13,51,55,1,10,55,59,1,59,5,63,1,10,63,67,1,67,5,71,1,71,10,75,1,9,75,79,2,13,79,83,1,9,83,87,2,87,13,91,1,10,91,95,1,95,9,99,1,13,99,103,2,103,13,107,1,107,10,111,2,10,111,115,1,115,9,119,... | le = [1, 12, 2, 3, 1, 1, 2, 3, 1, 3, 4, 3, 1, 5, 0, 3, 2, 1, 9, 19, 1, 19, 5, 23, 1, 13, 23, 27, 1, 27, 6, 31, 2, 31, 6, 35, 2, 6, 35, 39, 1, 39, 5, 43, 1, 13, 43, 47, 1, 6, 47, 51, 2, 13, 51, 55, 1, 10, 55, 59, 1, 59, 5, 63, 1, 10, 63, 67, 1, 67, 5, 71, 1, 71, 10, 75, 1, 9, 75, 79, 2, 13, 79, 83, 1, 9, 83, 87, 2, 87, ... |
def tri_recursion(k):
if(k > 0):
result = k + tri_recursion(k - 1)
print(result,k)
else:
result = 0
return result
print("\n\nRecursion Example Results")
tri_recursion(6) | def tri_recursion(k):
if k > 0:
result = k + tri_recursion(k - 1)
print(result, k)
else:
result = 0
return result
print('\n\nRecursion Example Results')
tri_recursion(6) |
extracted_data = {"contractor": "",
"contractee": "",
"duration": None,
"intervalPayment": None,
"interval": None,
"amount": None,
"numberOfPerformanceObligations": 0,
"poi": []
... | extracted_data = {'contractor': '', 'contractee': '', 'duration': None, 'intervalPayment': None, 'interval': None, 'amount': None, 'numberOfPerformanceObligations': 0, 'poi': []} |
# Copyright (c) 2009 - 2015 Tropo, now part of Cisco
# Released under the MIT license. See the file LICENSE
# for the complete license
# --------------------------------------
# Sample Tropo app
# --------------------------------------
answer()
event=ask("where are you heading?",
{'repeat':3,'choices':"1st Floor ... | answer()
event = ask('where are you heading?', {'repeat': 3, 'choices': '1st Floor (first, house wares, 1), 2nd Floor (second, bed and bath, 2), 3rd Floor (third, sporting goods, 3)', 'timeout': 10.03456789, 'onChoice': lambda event: event.onChoice('1st Floor', lambda : say('Your destination is 1st Floor')) and event.o... |
try:
t=int(input())
for i in range(t):
n=int(input())
a=list(map(int,input().split()))
set1=list(set(a))
print(len(set1))
except:
pass | try:
t = int(input())
for i in range(t):
n = int(input())
a = list(map(int, input().split()))
set1 = list(set(a))
print(len(set1))
except:
pass |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Chris Hoffman <choffman@chathamfinancial.com>
#
# This file is part of Ansible
#
# Ansible 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 ... | documentation = '\n---\nmodule: win_service\nversion_added: "1.7"\nshort_description: Manages Windows services\ndescription:\n - Manages Windows services\noptions:\n name:\n description:\n - Name of the service\n required: true\n default: null\n aliases: []\n start_mode:\n description:\n -... |
# File generated by contrib/scrape-ec2-sizes.py script - DO NOT EDIT manually
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to... | region_details = {'af-south-1': {'api_name': 'ec2_af_south', 'country': 'South Africa', 'endpoint': 'ec2.af-south-1.amazonaws.com', 'id': 'af-south-1', 'instance_types': [], 'signature_version': '4'}, 'ap-east-1': {'api_name': 'ec2_ap_east', 'country': 'Hong Kong', 'endpoint': 'ec2.ap-east-1.amazonaws.com', 'id': 'ap-e... |
# SPDX-License-Identifier: GPL-3.0-only
def make_parser_struct(cpp_struct_value, all_enums, all_bitfields, all_used_structs, all_used_groups, hpp, struct_name, read_only, struct_title):
hpp.write(" private:\n".format(struct_name))
hpp.write(" std::vector<ParserStructValue> get_values_internal() overr... | def make_parser_struct(cpp_struct_value, all_enums, all_bitfields, all_used_structs, all_used_groups, hpp, struct_name, read_only, struct_title):
hpp.write(' private:\n'.format(struct_name))
hpp.write(' std::vector<ParserStructValue> get_values_internal() override;\n'.format(struct_name))
hpp.writ... |
# Copyright 2021 Zilliz. 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 agree... | imagenet_default_mean = [0.485, 0.456, 0.406]
imagenet_default_std = [0.229, 0.224, 0.225]
def _cfg(url='', **kwargs):
return {'url': url, 'num_classes': 1000, 'input_size': (3, 224, 224), 'pool_size': None, 'crop_pct': 0.9, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': IMAGENET_DEFAULT_MEAN, 'std'... |
lychrels = 0
for i in range(0, 10001):
s = str(i)
n = i
indicator = 0
for j in range(0, 50):
n = n + int(s[::-1])
s = str(n)
l = len(s)
if l % 2 == 0:
p1 = s[0:int(l/2)]
p2 = s[int(l/2):][::-1]
else:
p1 = s[0:int(l/2)+1]
... | lychrels = 0
for i in range(0, 10001):
s = str(i)
n = i
indicator = 0
for j in range(0, 50):
n = n + int(s[::-1])
s = str(n)
l = len(s)
if l % 2 == 0:
p1 = s[0:int(l / 2)]
p2 = s[int(l / 2):][::-1]
else:
p1 = s[0:int(l / 2) + 1]... |
# lowercased special tokens
UNK = '<unk>'
PAD = '<pad>'
START = '<bos>'
STOP = '<eos>'
# special tokens id (don't edit this order)
UNK_ID = 0
PAD_ID = 1
# this should be set later after building fields
TAGS_PAD_ID = 0
# output_dir
OUTPUT_DIR = 'runs'
# default filenames
CONFIG = 'config.json'
DATASET = 'dataset.tor... | unk = '<unk>'
pad = '<pad>'
start = '<bos>'
stop = '<eos>'
unk_id = 0
pad_id = 1
tags_pad_id = 0
output_dir = 'runs'
config = 'config.json'
dataset = 'dataset.torch'
model = 'model.torch'
optimizer = 'optim.torch'
scheduler = 'scheduler.torch'
trainer = 'trainer.torch'
vocab = 'vocab.torch'
predictions = 'predictions.t... |
# This file contains all the constants in use by the tetration modules
# defining tetration constants
TETRATION_API_INVENTORY_TAG = '/inventory/tags'
TETRATION_API_ROLE = '/roles'
TETRATION_API_USER = '/users'
TETRATION_API_SENSORS = '/sensors'
TETRATION_API_INVENTORY_FILTER = '/filters/inventories'
TETRATION_API_SCOP... | tetration_api_inventory_tag = '/inventory/tags'
tetration_api_role = '/roles'
tetration_api_user = '/users'
tetration_api_sensors = '/sensors'
tetration_api_inventory_filter = '/filters/inventories'
tetration_api_scopes = '/app_scopes'
tetration_api_applications = '/applications'
tetration_api_application_policies = '/... |
def main():
print("I am a webscraper")
if __name__ == "__main__":
return main()
class Website(object):
#create a function that gets URL (def URL)
#create a function that turns HTML elements into an array of strings based on white space or '<> (def elements)
#create a function that uses REGEX to find links tha... | def main():
print('I am a webscraper')
if __name__ == '__main__':
return main()
class Website(object):
pass
class Page(Website):
pass
class Email(Page):
pass
class Name(Page):
pass
class Contact(Page):
pass |
# from https://linked.data.gov.au/dataset/bdr/conservation-status-taxa-wa
# in the sop_recipe_abis_model datagraphs
CONSERVATION_STATUS_TAXA = [
"https://test-idafd.biodiversity.org.au/name/afd/70162908",
"https://test-idafd.biodiversity.org.au/name/afd/70162916",
"https://test-idafd.biodiversity.org.au/nam... | conservation_status_taxa = ['https://test-idafd.biodiversity.org.au/name/afd/70162908', 'https://test-idafd.biodiversity.org.au/name/afd/70162916', 'https://test-idafd.biodiversity.org.au/name/afd/70164586', 'https://test-idafd.biodiversity.org.au/name/afd/70165201', 'https://test-idafd.biodiversity.org.au/name/afd/701... |
#!/usr/bin/env python3
# simplified and faster method to calculate the Fibonacci dequence
a = 0
b = 1
count = 0
max_count = 10
while count < max_count:
count = count + 1
print(a, b, end=' ') # Notice the magic end=' '
a = a + b
b = a + b
print() # gets a new (empty) line
| a = 0
b = 1
count = 0
max_count = 10
while count < max_count:
count = count + 1
print(a, b, end=' ')
a = a + b
b = a + b
print() |
# 1. Invert Values
# Write a program that receives a single string containing numbers separated by a single space.
# Print a list containing the opposite of each number.
string = input()
list = string.split(" ")
list_numbers = numbers = [int(x) for x in list]
myneglist = [-x for x in list_numbers]
print(myneglist) | string = input()
list = string.split(' ')
list_numbers = numbers = [int(x) for x in list]
myneglist = [-x for x in list_numbers]
print(myneglist) |
email_template = \
'''
Dear {salutation} {name},
Thank you for your letter. We are sorry that our {product} {verbed} in your
{room}. Please note that it should never be used in a {room}, especially
near any {animals}.
Send us your receipt and {amount} for shipping and handling. We will send
you another {product} tha... | email_template = '\nDear {salutation} {name},\n\nThank you for your letter. We are sorry that our {product} {verbed} in your\n{room}. Please note that it should never be used in a {room}, especially \nnear any {animals}.\n\nSend us your receipt and {amount} for shipping and handling. We will send\nyou another {product}... |
class Solution:
def minMeetingRooms(self, intervals: List[List[int]]) -> int:
if not intervals:
return 0
intervals.sort(key = lambda x : x[0])
occupiedRooms = []
heappush(occupiedRooms, intervals[0][1])
for interval in intervals[1:]:
if occupiedRooms[0... | class Solution:
def min_meeting_rooms(self, intervals: List[List[int]]) -> int:
if not intervals:
return 0
intervals.sort(key=lambda x: x[0])
occupied_rooms = []
heappush(occupiedRooms, intervals[0][1])
for interval in intervals[1:]:
if occupiedRooms[... |
EVAN = 'Evan'
CHALIE = 'Chalie'
JOHN = 'John'
BARRY = 'Barry'
SERVICE = 'Service'
JAKE = 'Jake'
COREY = 'Corey'
CHRIS = 'Chris'
SUB = 'Sub'
NOTAPP = 'NA'
ANGIESLIST = 'AL'
CONTRACTOR = 'CO'
GOOGLE = 'GO'
OLDCUST = 'OC'
OTHER = 'OT'
RECCO = 'RC'
REALTOR = 'RE'
WEBSITE = 'WS'
YELP = 'YL'
SOURCE_CHOICES = (
(NOTAPP,... | evan = 'Evan'
chalie = 'Chalie'
john = 'John'
barry = 'Barry'
service = 'Service'
jake = 'Jake'
corey = 'Corey'
chris = 'Chris'
sub = 'Sub'
notapp = 'NA'
angieslist = 'AL'
contractor = 'CO'
google = 'GO'
oldcust = 'OC'
other = 'OT'
recco = 'RC'
realtor = 'RE'
website = 'WS'
yelp = 'YL'
source_choices = ((NOTAPP, 'Not A... |
def fancy_divider(divider_length):
divider = ''
for i in range(divider_length):
if i % 2 == 0:
divider += '='
else:
divider += '-'
print(divider)
| def fancy_divider(divider_length):
divider = ''
for i in range(divider_length):
if i % 2 == 0:
divider += '='
else:
divider += '-'
print(divider) |
#
# PyUSB definitions
#
# Copyright (C) 2007 Pablo Bleyer Kocik
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any la... | ok = 0
invalid_handle = 1
device_not_found = 2
device_not_opened = 3
io_error = 4
insufficient_resources = 5
invalid_parameter = 6
invalid_baud_rate = 7
device_not_opened_for_erase = 8
device_not_opened_for_write = 9
failed_to_write_device = 10
eeprom_read_failed = 11
eeprom_write_failed = 12
eeprom_erase_failed = 13
e... |
load("@rules_maven_third_party//:import_external.bzl", import_external = "import_external")
def dependencies():
import_external(
name = "org_scala_lang_scala_compiler",
artifact = "org.scala-lang:scala-compiler:2.12.13",
artifact_sha256 = "ea971e004e2f15d3b7569eee8b559f220e23b9993e688bbe986... | load('@rules_maven_third_party//:import_external.bzl', import_external='import_external')
def dependencies():
import_external(name='org_scala_lang_scala_compiler', artifact='org.scala-lang:scala-compiler:2.12.13', artifact_sha256='ea971e004e2f15d3b7569eee8b559f220e23b9993e688bbe986f97938d1dc9f9', srcjar_sha256='22... |
PLUGIN_METADATA = {
'id': 'dimteleport',
'version': '1.0.0',
'name': 'dimTeleport',
'description': 'A plugin to teleport cross dimension easily',
'author': 'BlissfulAlloy79',
'dependencies': {
'mcdreforged': '>=1.0.0',
}
}
CMDS = [
'overworld',
'nether',
'end',
'ow',... | plugin_metadata = {'id': 'dimteleport', 'version': '1.0.0', 'name': 'dimTeleport', 'description': 'A plugin to teleport cross dimension easily', 'author': 'BlissfulAlloy79', 'dependencies': {'mcdreforged': '>=1.0.0'}}
cmds = ['overworld', 'nether', 'end', 'ow', 'n', 'e']
def on_info(server, info):
args = info.cont... |
# Eyetracker type
# EYETRACKER_TYPE = "IS4_Large_Peripheral" # 4C eyetracker
#EYETRACKER_TYPE = "Tobii T120" # Old eyetracker
EYETRACKER_TYPE = "simulation" # test
# EYETRACKER_TYPE = "Tobii Pro X3-120 EPU" # Tobii X3
SCREEN_SIZE_X = 1920
SCREEN_SIZE_Y = 1080
#Pilot condition
PILOT_CONDITION_TEXT_INTERVENTION = True... | eyetracker_type = 'simulation'
screen_size_x = 1920
screen_size_y = 1080
pilot_condition_text_intervention = True
pilot_condition_no_removal = True
pilot_mmd_subset = [5]
if PILOT_CONDITION_TEXT_INTERVENTION:
user_model_state_path = './database/user_model_state_ref_highlight.db'
else:
user_model_state_path = '.... |
# -*- coding:utf-8 -*-
# Copyright 2015 NEC Corporation. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License... | class Conversiontable(object):
def __init__(self):
self.__connection_type_map = {}
self.__network_conversion_table = {}
self.__node_conversion_table = {}
self.__port_conversion_table = {}
self.__link_conversion_table = {}
self.__flow_conversion_table = {}
def ge... |
def handler(event, context):
return {
"statusCode": 200,
"headers": {
"Refresh": "0; url=mailto:hello@marvinengelmann.email",
}
} | def handler(event, context):
return {'statusCode': 200, 'headers': {'Refresh': '0; url=mailto:hello@marvinengelmann.email'}} |
class BaseModel:
def __init__(self, config):
self.config = config
self.model = None
def save(self, checkpoint_path):
if self.model is None:
raise Exception("You have to build the model first.")
print("Saving model...")
self.model.save_weights(checkpoint_path... | class Basemodel:
def __init__(self, config):
self.config = config
self.model = None
def save(self, checkpoint_path):
if self.model is None:
raise exception('You have to build the model first.')
print('Saving model...')
self.model.save_weights(checkpoint_path... |
command = input().split("#")
water = int(input())
command = ", ".join(command)
fire = command.split(" = ")
fire = ", ".join(fire)
fire_list = fire.split(", ")
cells = []
effort = 0
total_fire = 0
for index, item in enumerate(fire_list):
if item == "High":
fire = int(fire_list[index + 1])
if 81 <=... | command = input().split('#')
water = int(input())
command = ', '.join(command)
fire = command.split(' = ')
fire = ', '.join(fire)
fire_list = fire.split(', ')
cells = []
effort = 0
total_fire = 0
for (index, item) in enumerate(fire_list):
if item == 'High':
fire = int(fire_list[index + 1])
if 81 <= ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.