content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
d = int(input())
if d == 25:
ans = 'Christmas'
elif d == 24:
ans = 'Christmas Eve'
elif d == 23:
ans = 'Christmas Eve Eve'
elif d == 22:
ans = 'Christmas Eve Eve Eve'
print(ans)
| d = int(input())
if d == 25:
ans = 'Christmas'
elif d == 24:
ans = 'Christmas Eve'
elif d == 23:
ans = 'Christmas Eve Eve'
elif d == 22:
ans = 'Christmas Eve Eve Eve'
print(ans) |
pkgname = "gperf"
pkgver = "3.1"
pkgrel = 0
build_style = "gnu_configure"
make_cmd = "gmake"
hostmakedepends = ["gmake"]
pkgdesc = "Perfect hash function generator"
maintainer = "q66 <q66@chimera-linux.org>"
license = "GPL-3.0-or-later"
url = "https://www.gnu.org/software/gperf"
source = f"$(GNU_SITE)/{pkgname}/{pkgnam... | pkgname = 'gperf'
pkgver = '3.1'
pkgrel = 0
build_style = 'gnu_configure'
make_cmd = 'gmake'
hostmakedepends = ['gmake']
pkgdesc = 'Perfect hash function generator'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'GPL-3.0-or-later'
url = 'https://www.gnu.org/software/gperf'
source = f'$(GNU_SITE)/{pkgname}/{pkgnam... |
'''
Author: Jon Ormond
Created: October 10th, 2021
Description: Simplified dragon text game, example of room movement.
Created for week 6 of the IT-140 class at SNHU.
Version: 1.0
'''
# A dictionary for the simplified dragon text game
# The dictionary links a room to other rooms.
rooms = {
'Great ... | """
Author: Jon Ormond
Created: October 10th, 2021
Description: Simplified dragon text game, example of room movement.
Created for week 6 of the IT-140 class at SNHU.
Version: 1.0
"""
rooms = {'Great Hall': {'South': 'Bedroom'}, 'Bedroom': {'North': 'Great Hall', 'East': 'Cellar'}, 'Cellar': {'West': 'Bedr... |
def merge2(lista1, lista2):
i1 = i2 = 0
lista3 = []
while i1 < len(lista1) and i2 < len(lista2):
if lista1[i1] < lista2[i2]:
if len(lista3) == 0 or lista3[-1] != lista1[i1]:
lista3.append(lista1[i1])
i1 += 1
else:
if len(lista3) == 0 or l... | def merge2(lista1, lista2):
i1 = i2 = 0
lista3 = []
while i1 < len(lista1) and i2 < len(lista2):
if lista1[i1] < lista2[i2]:
if len(lista3) == 0 or lista3[-1] != lista1[i1]:
lista3.append(lista1[i1])
i1 += 1
else:
if len(lista3) == 0 or lis... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
# https://skyyen999.gitbooks.io/-leetcode-with-javascript/content/questions/24md.html
class Solution:
def swapPairs(self, head: ListNode) -> ListNode:
prev_p... | class Solution:
def swap_pairs(self, head: ListNode) -> ListNode:
prev_p = dummy = list_node(0)
dummy.next = cur_p = head
while cur_p and cur_p.next:
keep_p = cur_p.next.next
cur_p.next.next = cur_p
prev_p.next = cur_p.next
cur_p.next = keep_p... |
'''
Given a list of numbers and a number k, return whether any two numbers from the list add up to k.
For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17.
Bonus: Can you do this in one pass?
'''
def check_2_numbers(anum, alist):
for x in alist:
#print(f'Start {x}')
for y ... | """
Given a list of numbers and a number k, return whether any two numbers from the list add up to k.
For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17.
Bonus: Can you do this in one pass?
"""
def check_2_numbers(anum, alist):
for x in alist:
for y in alist[alist.index(x) + 1:]:... |
#! /usr/bin/python
HOME_PATH = './'
CACHE_PATH = '/var/cache/obmc/'
FLASH_DOWNLOAD_PATH = "/tmp"
GPIO_BASE = 320
SYSTEM_NAME = "Palmetto"
## System states
## state can change to next state in 2 ways:
## - a process emits a GotoSystemState signal with state name to goto
## - objects specified in EXIT_STATE_DEPE... | home_path = './'
cache_path = '/var/cache/obmc/'
flash_download_path = '/tmp'
gpio_base = 320
system_name = 'Palmetto'
system_states = ['BASE_APPS', 'BMC_STARTING', 'BMC_READY', 'HOST_POWERING_ON', 'HOST_POWERED_ON', 'HOST_BOOTING', 'HOST_BOOTED', 'HOST_POWERED_OFF']
exit_state_depend = {'BASE_APPS': {'/org/openbmc/sen... |
public_key = b"\x30\x82\x01\x22\x30\x0d\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x00\x30\x82\x01\x0a\x02\x82\x01\x01" + \
b"\x00\xc0\x86\x99\x9a\x76\x74\x9a\xf5\x04\xb8\x48\xf0\x7e\x67\xc3\x90\x51\x17\xe6\xcd\xb3\x97\x6b\x41\xbc\x4e\x4e\x0c\x30\xff\x57" + \
b"\xf1\x4... | public_key = b'0\x82\x01"0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x000\x82\x01\n\x02\x82\x01\x01' + b'\x00\xc0\x86\x99\x9avt\x9a\xf5\x04\xb8H\xf0~g\xc3\x90Q\x17\xe6\xcd\xb3\x97kA\xbcNN\x0c0\xffW' + b'\xf1G\x99\xd5\xc3*g&l(\x1e\x18\x03\x0f\xaf\xd2p\xd2\xb2\xab\xaeDz\x1c\xcd\xceo\xcb\xfbV\x96\x1b' + ... |
class Solution:
def canVisitAllRooms(self, rooms: List[List[int]]) -> bool:
# we use this below list for checking whether all list have been visited or not
visited=[False]*len(rooms)
# per condition room 0 is always unlocked
visited[0]=True
#we use stack for acquiring key to ... | class Solution:
def can_visit_all_rooms(self, rooms: List[List[int]]) -> bool:
visited = [False] * len(rooms)
visited[0] = True
stack = [0]
while stack:
node = stack.pop()
for key in rooms[node]:
if not visited[key]:
visite... |
def findDecision(obj): #obj[0]: Coupon, obj[1]: Education, obj[2]: Occupation, obj[3]: Restaurant20to50, obj[4]: Distance
# {"feature": "Coupon", "instances": 85, "metric_value": 0.9637, "depth": 1}
if obj[0]>1:
# {"feature": "Occupation", "instances": 56, "metric_value": 0.8384, "depth": 2}
if obj[2]<=7:
# {"... | def find_decision(obj):
if obj[0] > 1:
if obj[2] <= 7:
if obj[3] > -1.0:
if obj[1] <= 2:
if obj[4] <= 2:
return 'True'
elif obj[4] > 2:
return 'True'
else:
... |
arr1= [50,60]
array = [1,2,3,4,5,6,7,8]
arr = []
arr.append(arr1[1])
print(arr) | arr1 = [50, 60]
array = [1, 2, 3, 4, 5, 6, 7, 8]
arr = []
arr.append(arr1[1])
print(arr) |
print(15 != 15)
print(10 > 11)
print(10 > 9) | print(15 != 15)
print(10 > 11)
print(10 > 9) |
def sortedSquaredArray(array):
# Write your code here.
negatives = [] # This simulates a stack
squares = []
i = 0
while i < len(array):
if array[i] < 0: # If negative
negatives.append(abs(array[i]))
else:
if len(negatives) > 0: # If negatives stack has elements and current element is positive
top... | def sorted_squared_array(array):
negatives = []
squares = []
i = 0
while i < len(array):
if array[i] < 0:
negatives.append(abs(array[i]))
elif len(negatives) > 0:
top = negatives[-1]
if i + 1 == len(array):
if top >= array[i]:
... |
class Car:
models = []
count = 0
def __init__(self, make, model):
self.make = make
self.model = model
Car.count += 1
@classmethod
def add_models(cls, make):
cls.models.append(make)
@staticmethod
def convert_km_to_mile(value):
return value / 1.609344... | class Car:
models = []
count = 0
def __init__(self, make, model):
self.make = make
self.model = model
Car.count += 1
@classmethod
def add_models(cls, make):
cls.models.append(make)
@staticmethod
def convert_km_to_mile(value):
return value / 1.609344... |
alphabets=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
#function to apply the algorithm
def encode_decode(start_text, shift_amount, cipher_direction):
... | alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
def encode_decode(start_text, shift_amount, ci... |
#
# @lc app=leetcode id=24 lang=python3
#
# [24] Swap Nodes in Pairs
#
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def swapPairs(self, head: ListNode) -> ListNode:
temp = ListNode(0)
temp.nex... | class Solution:
def swap_pairs(self, head: ListNode) -> ListNode:
temp = list_node(0)
temp.next = head
prev = temp
curr = temp.next
if curr:
nxt = curr.next
while curr and curr.next and nxt:
curr.next = nxt.next
nxt.next = curr
... |
class AsyncBaseCache:
def __init__(self, location, params, loop=None):
self._params = params
self._location = location
self._loop = loop
self._key_prefix = self._params.get('PREFIX', '')
async def init(self, *args, **kwargs):
return self
async def get(self, key: st... | class Asyncbasecache:
def __init__(self, location, params, loop=None):
self._params = params
self._location = location
self._loop = loop
self._key_prefix = self._params.get('PREFIX', '')
async def init(self, *args, **kwargs):
return self
async def get(self, key: st... |
def Read(filename):
file = open("lists.txt",'r')
line = file.readlines()
l=[]
for i in range(len(line)):
p = line[i].replace("\n","")
q = p.split(',')
l.append(q)
for j in range(len(l)): # changing price & quantity into int data type
for k in range(len(l[j])... | def read(filename):
file = open('lists.txt', 'r')
line = file.readlines()
l = []
for i in range(len(line)):
p = line[i].replace('\n', '')
q = p.split(',')
l.append(q)
for j in range(len(l)):
for k in range(len(l[j])):
if k != 0:
l[j][k] = i... |
# SUMPOS
for i in range(int(input())):
x,y,z=map(int,input().split())
if((x+y==z)or(x+z==y)or(y+z==x)):
print("YES")
else:
print("NO") | for i in range(int(input())):
(x, y, z) = map(int, input().split())
if x + y == z or x + z == y or y + z == x:
print('YES')
else:
print('NO') |
class BinaryTree:
def __init__(self, key=None):
self.key = key
self.left = None
self.right = None
def set_root(self, key):
self.key = key
def insert_left(self, new_node):
self.left = new_node
def insert_right(self, new_node):
self.right = new_node
... | class Binarytree:
def __init__(self, key=None):
self.key = key
self.left = None
self.right = None
def set_root(self, key):
self.key = key
def insert_left(self, new_node):
self.left = new_node
def insert_right(self, new_node):
self.right = new_node
... |
# For the code which builds PDFs we need to give it a directory where
# it can find the custom font.
FONT_DIRECTORY = '/usr/share/fonts/TTF'
# Which accounts are sending approval requests to managers via e-mail.
SENDING_APPROVAL_MANAGERS = {
"BF": True
}
# Which accounts are sending approval requests via e-mail.
S... | font_directory = '/usr/share/fonts/TTF'
sending_approval_managers = {'BF': True}
sending_approval = SENDING_APPROVAL_MANAGERS
sending_approval_tl = {'BF': True}
extra_activities = {'BF': ['CZAP']}
can_view_jobcodes = ['thunder@cats.com']
zeroing_hours = {'CZ': True}
override_calculation = {'BF': some_other_calculation}... |
def can_sum_basic(target, numbers):
if target == 0:
return True
if target < 0:
return False
for i in numbers:
reminder = target - i
if can_sum_basic(reminder, numbers):
return True
return False
def can_sum_memo(target, numbers, memo=dict()):
if targ... | def can_sum_basic(target, numbers):
if target == 0:
return True
if target < 0:
return False
for i in numbers:
reminder = target - i
if can_sum_basic(reminder, numbers):
return True
return False
def can_sum_memo(target, numbers, memo=dict()):
if target == ... |
def ask_until_y_or_n(question):
var = ''
while not var in ['Y', 'y', 'N', 'n', 0, 1]:
var = input(question + ' (Y/N) ')
return var in ['y', 'Y', 1]
def delete_duplicate(list):
seen = set()
seen_add = seen.add
return [x for x in list if not (x in seen or seen_add(x))]
def delete_non_nu... | def ask_until_y_or_n(question):
var = ''
while not var in ['Y', 'y', 'N', 'n', 0, 1]:
var = input(question + ' (Y/N) ')
return var in ['y', 'Y', 1]
def delete_duplicate(list):
seen = set()
seen_add = seen.add
return [x for x in list if not (x in seen or seen_add(x))]
def delete_non_num... |
def solve():
n = int(input())
a = list(map(int,input().split()))
s = int(input())
limit = 1 << n
subset = 0
flag = True
for mask in range(limit):
subset = 0
for i in range(n):
f = 1 << i
if f&mask:
subset += a[i]
if subset =... | def solve():
n = int(input())
a = list(map(int, input().split()))
s = int(input())
limit = 1 << n
subset = 0
flag = True
for mask in range(limit):
subset = 0
for i in range(n):
f = 1 << i
if f & mask:
subset += a[i]
if subset ==... |
a = 5 # 5 is an object
b = {'x': 5, 'y': 3} # dicts are objects
c = "hello" # strings are objects too
d = c # two variables sharing an object
e = c.lower() # should generate a new object
f = 8 * b['y'] - 19 # what happens here?
for obj in (a, b, b['x'], b['y']... | a = 5
b = {'x': 5, 'y': 3}
c = 'hello'
d = c
e = c.lower()
f = 8 * b['y'] - 19
for obj in (a, b, b['x'], b['y'], c, d, e, f):
print(id(obj)) |
class Solution:
def rob(self, nums: List[int]) -> int:
if not nums:
return 0
preMax = 0
curMax = nums[0]
idx = 1
while idx < len(nums):
preMax, curMax = curMax, max(preMax + nums[idx], curMax)
idx += 1
return max(preMax, curMax)
... | class Solution:
def rob(self, nums: List[int]) -> int:
if not nums:
return 0
pre_max = 0
cur_max = nums[0]
idx = 1
while idx < len(nums):
(pre_max, cur_max) = (curMax, max(preMax + nums[idx], curMax))
idx += 1
return max(preMax, cu... |
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
# iterate over list take the target for comparison
# store the index in an output array
# store the diff in another variable
# iterate over the other elements and check if the diff is there in the given list... | class Solution:
def two_sum(self, nums: List[int], target: int) -> List[int]:
output: List[int] = []
for i in range(0, len(nums)):
diff = target - nums[i]
for j in range(i + 1, len(nums)):
if nums[j] == diff:
output.append(i)
... |
# This data was taken from:
# https://github.com/fivethirtyeight/data/blob/master/hate-crimes/hate_crimes.csv
#
# Data info:
# Index | Attribute Name | Details
# ---------------------------------------------------------------------------------------------------
# 0 | state ... | data = [['Alab', 42278, 0.06, 0.64, 0.821, 0.02, 0.12, 0.472, 0.35, 0.63, 0.125838926, 1.806410489], ['Alaska', 67629, 0.064, 0.63, 0.914, 0.04, 0.06, 0.422, 0.42, 0.53, 0.143740118, 1.656700109], ['Arizona', 49254, 0.063, 0.9, 0.842, 0.1, 0.09, 0.455, 0.49, 0.5, 0.225319954, 3.413927994], ['Arkansas', 44922, 0.052, 0.... |
# Created by MechAviv
# [Lilin] | [1202000]
# Snow Island : Ice Cave
if "clear" not in sm.getQuestEx(21019, "helper"):
sm.setSpeakerID(1202000)
sm.flipSpeaker()
sm.sendNext("You've finally awoken...!")
sm.setSpeakerID(1202000)
sm.setPlayerAsSpeaker()
sm.sendSay("And you are...?")
sm.se... | if 'clear' not in sm.getQuestEx(21019, 'helper'):
sm.setSpeakerID(1202000)
sm.flipSpeaker()
sm.sendNext("You've finally awoken...!")
sm.setSpeakerID(1202000)
sm.setPlayerAsSpeaker()
sm.sendSay('And you are...?')
sm.setSpeakerID(1202000)
sm.flipSpeaker()
sm.sendSay("The hero who fough... |
class WWSHCError(BaseException): pass
class WWSHCNotExistingError(WWSHCError): pass
class NoSuchGroup(WWSHCNotExistingError): pass
class NoSuchClass(WWSHCNotExistingError): pass
class NoSuchUser(WWSHCNotExistingError): pass
class AlreadyInContacts(WWSHCError): pass
| class Wwshcerror(BaseException):
pass
class Wwshcnotexistingerror(WWSHCError):
pass
class Nosuchgroup(WWSHCNotExistingError):
pass
class Nosuchclass(WWSHCNotExistingError):
pass
class Nosuchuser(WWSHCNotExistingError):
pass
class Alreadyincontacts(WWSHCError):
pass |
class CModel_robot_input():
def __init__(self):
self.gACT = 0
self.gGTO = 0
self.gSTA = 0
self.gOBJ = 0
self.gFLT = 0
self.gPR = 0
self.gPO = 0
self.gCU = 0
| class Cmodel_Robot_Input:
def __init__(self):
self.gACT = 0
self.gGTO = 0
self.gSTA = 0
self.gOBJ = 0
self.gFLT = 0
self.gPR = 0
self.gPO = 0
self.gCU = 0 |
#!/usr/bin/python
DIR = "data_tmp/"
FILES = []
FILES.append("02_attk1_avg20_test")
FILES.append("02_attk1_avg40_test")
FILES.append("02_attk1_avg50_test")
FILES.append("02_attk1_avg60_test")
FILES.append("02_attk1_avg80_test")
FILES.append("03_attk1_opt20_test")
FILES.append("03_attk1_opt40_test")
FILES.append("03_a... | dir = 'data_tmp/'
files = []
FILES.append('02_attk1_avg20_test')
FILES.append('02_attk1_avg40_test')
FILES.append('02_attk1_avg50_test')
FILES.append('02_attk1_avg60_test')
FILES.append('02_attk1_avg80_test')
FILES.append('03_attk1_opt20_test')
FILES.append('03_attk1_opt40_test')
FILES.append('03_attk1_opt50_test')
FIL... |
def coord():
i = mc.ls(sl=1, fl=1)
cp = []
for j in i:
val = tuple(mc.xform(j, q=1, t=1, ws=True))
cp.append(val)
print('___________________________\n')
cp = [tuple([round(x/2, 3) for x in j]) for j in cp]
cp = str(cp)
cp = cp.replace('.0)', ')')
cp = cp.replace('.0,', ',... | def coord():
i = mc.ls(sl=1, fl=1)
cp = []
for j in i:
val = tuple(mc.xform(j, q=1, t=1, ws=True))
cp.append(val)
print('___________________________\n')
cp = [tuple([round(x / 2, 3) for x in j]) for j in cp]
cp = str(cp)
cp = cp.replace('.0)', ')')
cp = cp.replace('.0,', ... |
def tribonacci(n):
if n < 4:
return 1
return tribonacci(n-1) + tribonacci(n-2) + tribonacci(n-3)
def tallest_player(nba_player_data):
list = []
max_pies, max_pulgadas = [0,0]
for key, value in nba_player_data.items():
pies, pulgadas = value[3].split('-')
if(int(pies) > ma... | def tribonacci(n):
if n < 4:
return 1
return tribonacci(n - 1) + tribonacci(n - 2) + tribonacci(n - 3)
def tallest_player(nba_player_data):
list = []
(max_pies, max_pulgadas) = [0, 0]
for (key, value) in nba_player_data.items():
(pies, pulgadas) = value[3].split('-')
if int(... |
a=list(map(int,input().split()))
n=len(a)
lo=0
h=1
prod=0
for i in range(0,n):
m=1
for j in range(i,n):
m=m*a[j]
prod=max(prod,m)
#print(prod)
print(prod)
| a = list(map(int, input().split()))
n = len(a)
lo = 0
h = 1
prod = 0
for i in range(0, n):
m = 1
for j in range(i, n):
m = m * a[j]
prod = max(prod, m)
print(prod) |
AUTHOR = 'Nathan Shafer'
SITENAME = 'Lotechnica'
SITESUBTITLE = "Technical writings by Nathan Shafer"
SITEURL = 'https://blog.lotech.org'
PATH = 'content'
STATIC_PATHS = ['images', 'static']
STATIC_EXCLUDES = ['.sass-cache']
AUTHOR_SAVE_AS = ''
USE_FOLDER_AS_CATEGORY = True
# Locale settings
TIMEZONE = 'America/Phoe... | author = 'Nathan Shafer'
sitename = 'Lotechnica'
sitesubtitle = 'Technical writings by Nathan Shafer'
siteurl = 'https://blog.lotech.org'
path = 'content'
static_paths = ['images', 'static']
static_excludes = ['.sass-cache']
author_save_as = ''
use_folder_as_category = True
timezone = 'America/Phoenix'
default_lang = '... |
# 19. Write a program in Python to enter length in centimeter and convert it into meter and kilometer.
len_cm=int(input("Enter length in centimeter: "))
len_m=len_cm/100
len_km=len_cm/100000
print("Length in meter= ",len_m,"\nLength in kilometer= ",len_km)
| len_cm = int(input('Enter length in centimeter: '))
len_m = len_cm / 100
len_km = len_cm / 100000
print('Length in meter= ', len_m, '\nLength in kilometer= ', len_km) |
#Binary Search Tree
#BST OPERATIONS
#INSERT --> FIND --> DELETE-->GET SIZE -->TRAVERSALS
#BST INSERT
#START AT ROOT
#ALWAYS INSERT NODE AS LEAF
#BST FIND
#START AT ROOT
#RETURN DATA IF FOUND :
# ELSE RETURN FALSE
#DELETE
#3 POSSIBLE CASES
#LEAF NODE
#1 CHILD
#2 CHILDR... | class Tree:
def __init__(self, data, left=None, right=None):
self.data = data
self.left = left
self.right = right
def insert(self, data):
if self.data == data:
return False
elif self.data > data:
if self.left is not None:
return s... |
class ParkingPermitBaseException(Exception):
pass
class PermitLimitExceeded(ParkingPermitBaseException):
pass
class PriceError(ParkingPermitBaseException):
pass
class InvalidUserZone(ParkingPermitBaseException):
pass
class InvalidContractType(ParkingPermitBaseException):
pass
class NonDraf... | class Parkingpermitbaseexception(Exception):
pass
class Permitlimitexceeded(ParkingPermitBaseException):
pass
class Priceerror(ParkingPermitBaseException):
pass
class Invaliduserzone(ParkingPermitBaseException):
pass
class Invalidcontracttype(ParkingPermitBaseException):
pass
class Nondraftperm... |
# Finding duplicate articles
# this will print out articles that have
# the same titles. for each match, it will print 2x -> 1,5 & 5,1
def dedupe(n):
a = d[n]
for key,value in d.items():
if a == value and key != n:
print(f'{key} <-> {n}')
articles = u.articles.all()
d = {}
for a in articl... | def dedupe(n):
a = d[n]
for (key, value) in d.items():
if a == value and key != n:
print(f'{key} <-> {n}')
articles = u.articles.all()
d = {}
for a in articles:
d[a.id] = a.title
for (k, v) in d.items():
dedupe(k)
a = Article.query.filter_by(id=173).first()
a.title
a.highlights.count... |
fib = [0,1]
i = 1
print(fib[0])
while fib[i]<=842040:
print(fib[i])
i +=1
fib.append(fib[i-1] + fib[i-2]) | fib = [0, 1]
i = 1
print(fib[0])
while fib[i] <= 842040:
print(fib[i])
i += 1
fib.append(fib[i - 1] + fib[i - 2]) |
############################
# General Settings
############################
# crop_size: crop size for the input image, center crop
crop_size = 178
# image_size: input/output image resolution, test output is 2x
image_size = 64
# Establish convention for real and fake probability labels during training
real_prob = 1... | crop_size = 178
image_size = 64
real_prob = 1
fake_prob = 0
train_batch_size = 128
test_batch_size = 64
num_workers = 4
n_epochs = 80
random_seed = 1111
selected_attr = None
g_input_dim = len(selected_attr) if selected_attr else 40
g_num_blocks = 6
g_conv_channels = [512, 256, 128, 64]
g_out_channels = 3
g_wd = 0
g_lr ... |
'''
Created on Feb 12, 2019
@author: jcorley
'''
class Recipe:
'''
Stores basic information for a recipe.
'''
def __init__(self, name, categories, timeToCook, timeToPrep, ingredients, instructions, servings):
'''
Create a new recipe with the provided information.
... | """
Created on Feb 12, 2019
@author: jcorley
"""
class Recipe:
"""
Stores basic information for a recipe.
"""
def __init__(self, name, categories, timeToCook, timeToPrep, ingredients, instructions, servings):
"""
Create a new recipe with the provided information.
... |
x = float(input())
if x >= 0 and x <= 25:
print("Intervalo [0,25]")
elif x > 25 and x <= 50:
print("Intervalo (25,50]")
elif x > 50 and x <= 75:
print("Intervalo (50,75]")
elif x > 75 and x <= 100:
print("Intervalo (75,100]")
else:
print("Fora de intervalo")
| x = float(input())
if x >= 0 and x <= 25:
print('Intervalo [0,25]')
elif x > 25 and x <= 50:
print('Intervalo (25,50]')
elif x > 50 and x <= 75:
print('Intervalo (50,75]')
elif x > 75 and x <= 100:
print('Intervalo (75,100]')
else:
print('Fora de intervalo') |
# Hidden Street : Destroyed Temple of Time Entrance (927020000) | Used in Luminous' Intro
PHANTOM = 2159353
sm.lockInGameUI(True)
sm.curNodeEventEnd(True)
sm.removeEscapeButton()
sm.flipDialoguePlayerAsSpeaker()
sm.sendNext("The heavens have set the perfect stage for our final confrontation.")
sm.sendDelay(500)
sm.f... | phantom = 2159353
sm.lockInGameUI(True)
sm.curNodeEventEnd(True)
sm.removeEscapeButton()
sm.flipDialoguePlayerAsSpeaker()
sm.sendNext('The heavens have set the perfect stage for our final confrontation.')
sm.sendDelay(500)
sm.forcedInput(1) |
# LeetCode 824. Goat Latin `E`
# acc | 99% | 14'
# A~0h19
class Solution:
def toGoatLatin(self, S: str) -> str:
vowels = ("a", "e", "i", "o", "u", "A", "E", "I", "O", "U")
S = [w+"ma"+"a"*(i+1) if w[0] in vowels else w[1:] +
w[0]+"ma"+"a"*(i+1) for i, w in enumerate(S.split())]
... | class Solution:
def to_goat_latin(self, S: str) -> str:
vowels = ('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U')
s = [w + 'ma' + 'a' * (i + 1) if w[0] in vowels else w[1:] + w[0] + 'ma' + 'a' * (i + 1) for (i, w) in enumerate(S.split())]
return ' '.join(S) |
#!c:\Python36\python.exe
print ("Content-Type: text/html") # Header
print ()
print ("<html><head><title>Server test</title></head>")
print ("<b>Hello</b>")
print ("</html>") | print('Content-Type: text/html')
print()
print('<html><head><title>Server test</title></head>')
print('<b>Hello</b>')
print('</html>') |
class DummyTransport(object):
def __init__(self, *args, **kargs):
self.called_count = 0
def perform_request(self, method, url, params=None, body=None):
self.called_count += 1
self.url = url
self.params = params
self.body = body
class DummyTracer(object):
def __init... | class Dummytransport(object):
def __init__(self, *args, **kargs):
self.called_count = 0
def perform_request(self, method, url, params=None, body=None):
self.called_count += 1
self.url = url
self.params = params
self.body = body
class Dummytracer(object):
def __ini... |
# Enter your code here. Read input from STDIN. Print output to STDOUT
n = int(input())
stack = []
for i in range(n):
x = [int(i) for i in input().split(' ')]
if x[0]==1:
if stack:
m = max(stack[-1],x[1])
stack.append(m)
else:
stack.append(x[1])
elif x... | n = int(input())
stack = []
for i in range(n):
x = [int(i) for i in input().split(' ')]
if x[0] == 1:
if stack:
m = max(stack[-1], x[1])
stack.append(m)
else:
stack.append(x[1])
elif x[0] == 2:
stack.pop()
elif x[0] == 3:
print(stack[-1... |
# Harmonica notes and holes.
dic_notes = {
'E3': 164.81,
'F3': 174.61,
'F#3': 185.00,
'G3': 196.00,
'G#3': 207.65,
'A3': 220.00,
'A#3': 233.08,
'B3': 246.94,
'C4': 261.63,
'C#4': 277.18,
'D4': 293.66,
'D#4': 311.13,
'E4': 329.63,
'F4': 349.23,
'F#4': 369.99,
'G4': 392.00,
'G#4': 415.30,
'A4': 440.00,
'A#4': 466.16,... | dic_notes = {'E3': 164.81, 'F3': 174.61, 'F#3': 185.0, 'G3': 196.0, 'G#3': 207.65, 'A3': 220.0, 'A#3': 233.08, 'B3': 246.94, 'C4': 261.63, 'C#4': 277.18, 'D4': 293.66, 'D#4': 311.13, 'E4': 329.63, 'F4': 349.23, 'F#4': 369.99, 'G4': 392.0, 'G#4': 415.3, 'A4': 440.0, 'A#4': 466.16, 'B4': 493.88, 'C5': 523.25, 'C#5': 554.... |
'''stub for savings.py exercise.'''
def savingGrowth(deposit, interestPercentage, goal):
'''Print the account balance for each year until it reaches
or passes the goal.
>>> savingGrowth(100, 8.0, 125)
Year 0: $100.00
Year 1: $108.00
Year 2: $116.64
Year 3: $125.97
'''
# code here!
... | """stub for savings.py exercise."""
def saving_growth(deposit, interestPercentage, goal):
"""Print the account balance for each year until it reaches
or passes the goal.
>>> savingGrowth(100, 8.0, 125)
Year 0: $100.00
Year 1: $108.00
Year 2: $116.64
Year 3: $125.97
"""
saving_growth(100... |
def transformacion(c):
t = (c * (9/5))+32
print(t)
transformacion(100)
| def transformacion(c):
t = c * (9 / 5) + 32
print(t)
transformacion(100) |
#
# PySNMP MIB module CT-FASTPATH-DHCPSERVER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CT-FASTPATH-DHCPSERVER-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:13:05 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection) ... |
'''
Backward and forward
====================
The sign outside reads: Name no one man.
"Escape. We must escape." Staring at the locked door of his cage, Beta Rabbit, spy and brilliant mathematician, has a revelation. "Of course! Name no one man - it's a palindrome! Palindromes are the key to opening this lock!"
To ... | """
Backward and forward
====================
The sign outside reads: Name no one man.
"Escape. We must escape." Staring at the locked door of his cage, Beta Rabbit, spy and brilliant mathematician, has a revelation. "Of course! Name no one man - it's a palindrome! Palindromes are the key to opening this lock!"
To ... |
class CalcEvent():
__handlers = None
def __init__(self):
self.__handlers = []
def add_handler(self, handler):
self.__handlers.append(handler)
def button_clicked(self, text: str):
for handler in self.__handlers:
handler(text) | class Calcevent:
__handlers = None
def __init__(self):
self.__handlers = []
def add_handler(self, handler):
self.__handlers.append(handler)
def button_clicked(self, text: str):
for handler in self.__handlers:
handler(text) |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
for n in range (2,25):
for i in range(2, n):
if n % i == 0:
break
else:
print(n) | for n in range(2, 25):
for i in range(2, n):
if n % i == 0:
break
else:
print(n) |
def ordena(lista):
tamanho_lista = len(lista)
for i in range(tamanho_lista - 1):
menor_visto = i
for j in range(i + 1, tamanho_lista):
if lista[j] < lista[menor_visto]:
menor_visto = j
lista[i], lista[menor_visto] = lista[menor_visto], lista[i]
return lis... | def ordena(lista):
tamanho_lista = len(lista)
for i in range(tamanho_lista - 1):
menor_visto = i
for j in range(i + 1, tamanho_lista):
if lista[j] < lista[menor_visto]:
menor_visto = j
(lista[i], lista[menor_visto]) = (lista[menor_visto], lista[i])
return ... |
f = open('raven.txt', 'r')
# create an empty dictionary
count = {}
for line in f:
for word in line.split():
# remove punctuation
word = word.replace('_', '').replace('"', '').replace(',', '').replace('.', '')
word = word.replace('-', '').replace('?', '').replace('!', '').replace("'", "")
... | f = open('raven.txt', 'r')
count = {}
for line in f:
for word in line.split():
word = word.replace('_', '').replace('"', '').replace(',', '').replace('.', '')
word = word.replace('-', '').replace('?', '').replace('!', '').replace("'", '')
word = word.replace('(', '').replace(')', '').replace... |
def whitenoise_add_middleware(MIDDLEWARE):
insert_after = "django.middleware.security.SecurityMiddleware"
index = 0
MIDDLEWARE = list(MIDDLEWARE)
if insert_after in MIDDLEWARE:
index = MIDDLEWARE.index(insert_after) + 1
MIDDLEWARE.insert(index, "whitenoise.middleware.WhiteNoiseMiddleware")
... | def whitenoise_add_middleware(MIDDLEWARE):
insert_after = 'django.middleware.security.SecurityMiddleware'
index = 0
middleware = list(MIDDLEWARE)
if insert_after in MIDDLEWARE:
index = MIDDLEWARE.index(insert_after) + 1
MIDDLEWARE.insert(index, 'whitenoise.middleware.WhiteNoiseMiddleware')
... |
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
load("@build_stack_rules_proto//:deps.bzl",
"bazel_skylib",
"build_bazel_rules_swift"
)
load("//swift:zlib.bzl", "ZLIB_BUILD_FILE_CONTENT")
load("//swift:grpc_swift.bzl", "GRPC_SWIFT_BUILD_FILE_CONTENT")
load("//swift:swift_protobuf.bzl",... | load('@bazel_tools//tools/build_defs/repo:git.bzl', 'new_git_repository')
load('@build_stack_rules_proto//:deps.bzl', 'bazel_skylib', 'build_bazel_rules_swift')
load('//swift:zlib.bzl', 'ZLIB_BUILD_FILE_CONTENT')
load('//swift:grpc_swift.bzl', 'GRPC_SWIFT_BUILD_FILE_CONTENT')
load('//swift:swift_protobuf.bzl', 'SWIFT_P... |
# This is an input class. Do not edit.
class LinkedList:
def __init__(self, value):
self.value = value
self.next = None
def removeDuplicatesFromLinkedList(linkedList):
# Write your code here.
# Have two pointers
# 1. Current Node
# 2. Next Node
# Check if the current node is equal to th... | class Linkedlist:
def __init__(self, value):
self.value = value
self.next = None
def remove_duplicates_from_linked_list(linkedList):
curr_node = linkedList
next_node = linkedList.next
while next_node:
if curr_node.value == next_node.value:
remove_node = next_node
... |
def sumDigits(num, base=10):
return sum([int(x, base) for x in list(str(num))])
print(sumDigits(1))
print(sumDigits(12345))
print(sumDigits(123045))
print(sumDigits('fe', 16))
print(sumDigits("f0e", 16))
| def sum_digits(num, base=10):
return sum([int(x, base) for x in list(str(num))])
print(sum_digits(1))
print(sum_digits(12345))
print(sum_digits(123045))
print(sum_digits('fe', 16))
print(sum_digits('f0e', 16)) |
def maxSubArraySum(arr,N):
maxm_sum=arr[0]
curr_sum=0
for ele in arr:
curr_sum+=ele
if curr_sum>0:
if curr_sum>maxm_sum:
maxm_sum=curr_sum
else:
if curr_sum>maxm_sum:
maxm_sum=curr_sum
curr... | def max_sub_array_sum(arr, N):
maxm_sum = arr[0]
curr_sum = 0
for ele in arr:
curr_sum += ele
if curr_sum > 0:
if curr_sum > maxm_sum:
maxm_sum = curr_sum
else:
if curr_sum > maxm_sum:
maxm_sum = curr_sum
curr_sum = ... |
__all__ = ['OrderLog', 'OrderLogTruncated']
class OrderLog:
def __init__(self):
self._key = None
self._data = None
def get_key(self):
return self._key
def set_key(self, key):
if not isinstance(key, int):
raise ValueError('Date must be in int format')
s... | __all__ = ['OrderLog', 'OrderLogTruncated']
class Orderlog:
def __init__(self):
self._key = None
self._data = None
def get_key(self):
return self._key
def set_key(self, key):
if not isinstance(key, int):
raise value_error('Date must be in int format')
... |
#coding: utf-8
''' mbinary
#######################################################################
# File : hammingDistance.py
# Author: mbinary
# Mail: zhuheqin1@gmail.com
# Blog: https://mbinary.xyz
# Github: https://github.com/mbinary
# Created Time: 2018-12-17 17:36
# Description:
hamming distance is the numbe... | """ mbinary
#######################################################################
# File : hammingDistance.py
# Author: mbinary
# Mail: zhuheqin1@gmail.com
# Blog: https://mbinary.xyz
# Github: https://github.com/mbinary
# Created Time: 2018-12-17 17:36
# Description:
hamming distance is the number of different ... |
# Constants
repo_path = '/Users/aaron/git/gittle'
repo_url = 'git@friendco.de:friendcode/gittle.git'
# RSA private key
key_file = open('/Users/aaron/git/friendcode-conf/rsa/friendcode_rsa') | repo_path = '/Users/aaron/git/gittle'
repo_url = 'git@friendco.de:friendcode/gittle.git'
key_file = open('/Users/aaron/git/friendcode-conf/rsa/friendcode_rsa') |
# 1.Reverse the order of the items in an array.
# Example:
# a = [1, 2, 3, 4, 5]
# Result:
# a = [5, 4, 3, 2, 1]
def reverseFunction(aList):
return aList.reverse()
a=[1,2,3,4,5]
reverseFunction(a)
print(a)
# 2. Get the number of occurrences of var b in array a.
# Example:
# a = [1, 1, ... | def reverse_function(aList):
return aList.reverse()
a = [1, 2, 3, 4, 5]
reverse_function(a)
print(a)
def occurences_nr(aList, elem):
return aList.count(elem)
b = [1, 1, 2, 2, 2, 2, 3, 3, 3]
c = 3
d = occurences_nr(b, c)
print(d)
def words_counter(aString):
return len(aString.split())
string = 'ana are mer... |
class Converter():
def __init__(self):
self.alpha = [chr(k) for k in range(65,91)] #Set an array of chars going to the letter A to the Z
def calculate(self, seq, b):
if not 2 <= b <= 36: #Bases range is [2,36]
return None
else:
out = []
sequence = seq
base = b
itr = 0 #Keep track of the number o... | class Converter:
def __init__(self):
self.alpha = [chr(k) for k in range(65, 91)]
def calculate(self, seq, b):
if not 2 <= b <= 36:
return None
else:
out = []
sequence = seq
base = b
itr = 0
while sequence != 0 and... |
#create mongoDB client
#TODO: what port is db on?????
client = MongoClient('localhost', 27017)
#get the database from mongoDB client
database = client.database
#get the tables from the database
users = database.users
#function that handles client-server connections
#creates a thread for a connected client
def cl... | client = mongo_client('localhost', 27017)
database = client.database
users = database.users
def client_connected(connection):
connection.send('Connected to server successfully\n')
while 1:
data = connection.recv(1024)
reply = 'received something'
if not data:
break
c... |
sum_of_the_squares = 0
square_of_the_sum = 0
for i in range(0,100):
sum_of_the_squares = sum_of_the_squares + (i+1)**2
square_of_the_sum = square_of_the_sum + (i+1)
print((square_of_the_sum**2) - sum_of_the_squares)
| sum_of_the_squares = 0
square_of_the_sum = 0
for i in range(0, 100):
sum_of_the_squares = sum_of_the_squares + (i + 1) ** 2
square_of_the_sum = square_of_the_sum + (i + 1)
print(square_of_the_sum ** 2 - sum_of_the_squares) |
WEB_URL = "https://replicate.ai"
DOCS_URL = WEB_URL + "/docs"
PYTHON_REFERENCE_DOCS_URL = DOCS_URL + "/reference/python"
YAML_REFERENCE_DOCS_URL = DOCS_URL + "/reference/yaml"
REPOSITORY_VERSION = 1
HEARTBEAT_MISS_TOLERANCE = 3
EXPERIMENT_STATUS_RUNNING = "running"
EXPERIMENT_STATUS_STOPPED = "stopped"
| web_url = 'https://replicate.ai'
docs_url = WEB_URL + '/docs'
python_reference_docs_url = DOCS_URL + '/reference/python'
yaml_reference_docs_url = DOCS_URL + '/reference/yaml'
repository_version = 1
heartbeat_miss_tolerance = 3
experiment_status_running = 'running'
experiment_status_stopped = 'stopped' |
demo_schema = [
{
'name': 'SUMLEV',
'type': 'STRING'
},
{
'name': 'STATE',
'type': 'STRING'
},
{
'name': 'COUNTY',
'type': 'STRING'
... | demo_schema = [{'name': 'SUMLEV', 'type': 'STRING'}, {'name': 'STATE', 'type': 'STRING'}, {'name': 'COUNTY', 'type': 'STRING'}, {'name': 'TRACT', 'type': 'STRING'}, {'name': 'BLKGRP', 'type': 'STRING'}, {'name': 'BLOCK', 'type': 'STRING'}, {'name': 'POP100', 'type': 'INTEGER'}, {'name': 'HU100', 'type': 'INTEGER'}, {'n... |
# https://leetcode.com/problems/check-if-word-equals-summation-of-two-words
alphabet = {
'a': '0',
'b': '1',
'c': '2',
'd': '3',
'e': '4',
'f': '5',
'g': '6',
'h': '7',
'i': '8',
'j': '9',
}
def get_numerical_value(word):
list_of_chars = []
for char in word:
... | alphabet = {'a': '0', 'b': '1', 'c': '2', 'd': '3', 'e': '4', 'f': '5', 'g': '6', 'h': '7', 'i': '8', 'j': '9'}
def get_numerical_value(word):
list_of_chars = []
for char in word:
list_of_chars.append(alphabet[char])
return int(''.join(list_of_chars))
def is_sum_equal(first_word, second_word, targ... |
APP_NAME = "dotpyle"
DOTPYLE_CONFIG_FILE_NAME = "dotpyle.yml"
DOTPYLE_LOCAL_CONFIG_FILE_NAME = "dotpyle.local.yml"
DOTFILES_FOLDER = "dotfiles"
SCRIPTS_FOLDER = "scripts"
DOTPYLE_CONFIG_FILE_NAME_TEMP = "dotpyle.temp.yml"
README_NAME = "README.md"
README_TEMPLATE_PATH = "dotpyle/templates/readme.md"
CONFIG_TEMPLATE_PAT... | app_name = 'dotpyle'
dotpyle_config_file_name = 'dotpyle.yml'
dotpyle_local_config_file_name = 'dotpyle.local.yml'
dotfiles_folder = 'dotfiles'
scripts_folder = 'scripts'
dotpyle_config_file_name_temp = 'dotpyle.temp.yml'
readme_name = 'README.md'
readme_template_path = 'dotpyle/templates/readme.md'
config_template_pat... |
#!/usr/bin/python3
def print_list_integer(my_list=[]):
"prints all integers of a list"
for i in range(len(my_list)):
print("{:d}".format(my_list[i]))
| def print_list_integer(my_list=[]):
"""prints all integers of a list"""
for i in range(len(my_list)):
print('{:d}'.format(my_list[i])) |
HOST = 'http://kevin:8000'
VERSION = 'v2'
API_URL = "{host}/{version}".format(host=HOST, version=VERSION)
API_TOKEN = None # set by wiredrive.auth.set_token()
SSL_VERIFY = True
# Any requests for more resources than the limit will be clamped down to it.
MAX_PAGINATION_LIMIT = 500
RFC3339_FORMAT = "%Y-%m-%dT%H:%M:%SZ... | host = 'http://kevin:8000'
version = 'v2'
api_url = '{host}/{version}'.format(host=HOST, version=VERSION)
api_token = None
ssl_verify = True
max_pagination_limit = 500
rfc3339_format = '%Y-%m-%dT%H:%M:%SZ'
datetime_format = RFC3339_FORMAT |
class Solution:
def mirrorReflection(self, p: int, q: int) -> int:
m, n = q, p
while m % 2 == 0 and n % 2 == 0:
m, n = m / 2, n / 2
if n % 2 == 0 and m % 2 == 1: # receive at left side if n is even
return 2
# receive at right side: 0, or 1
if n % 2 ==... | class Solution:
def mirror_reflection(self, p: int, q: int) -> int:
(m, n) = (q, p)
while m % 2 == 0 and n % 2 == 0:
(m, n) = (m / 2, n / 2)
if n % 2 == 0 and m % 2 == 1:
return 2
if n % 2 == 1 and m % 2 == 0:
return 0
if n % 2 == 1 and m ... |
NAMES = {
'lane': 'Test1',
'lb': None,
'pu': 'Test1',
'sample': 'Test1',
'rg': 'Test1',
'pl': 'illumina'
}
DATA = {
'files': [
'/bcbio-nextgen/tests/test_automated_output/trimmed/1_1_Test1.trimmed.fq.gz',
'/bcbio-nextgen/tests/test_automated_output/trimmed/1_2_Test1.trimmed.... | names = {'lane': 'Test1', 'lb': None, 'pu': 'Test1', 'sample': 'Test1', 'rg': 'Test1', 'pl': 'illumina'}
data = {'files': ['/bcbio-nextgen/tests/test_automated_output/trimmed/1_1_Test1.trimmed.fq.gz', '/bcbio-nextgen/tests/test_automated_output/trimmed/1_2_Test1.trimmed.fq.gz'], 'dirs': {'config': '/bcbio-nextgen/tests... |
#zamjena vrijednosti dvije promjeljive
a = 5; b = 8
print(a, b)
a, b = b, a
print(a, b)
| a = 5
b = 8
print(a, b)
(a, b) = (b, a)
print(a, b) |
#W.A.P TO PRINT PATTERNS USING NESTED FOR
t=65
for i in range(0,4,1):
for j in range(0,i+1,1):
ch=chr(t)
print(ch,end='')
t = t + 1
print()
t=0
n=0
for i in range(0,5,1):
t=n
for j in range(0,i+1,1):
print(t,end='')
t=t+1
print()
t =0
for i in range(0, 5, 1)... | t = 65
for i in range(0, 4, 1):
for j in range(0, i + 1, 1):
ch = chr(t)
print(ch, end='')
t = t + 1
print()
t = 0
n = 0
for i in range(0, 5, 1):
t = n
for j in range(0, i + 1, 1):
print(t, end='')
t = t + 1
print()
t = 0
for i in range(0, 5, 1):
t = 1
for... |
magicians = ['alice', 'david', 'carolina']
for magician in magicians:
print(magician.title() + ", that was a great trick!")
print(f"i can't wait to see your next trick, {magician.title()}", end="\n\n")
print("Thank you, everyone. That was a great magic show!")
'''
o nome da lista deve vir no plural
assim facili... | magicians = ['alice', 'david', 'carolina']
for magician in magicians:
print(magician.title() + ', that was a great trick!')
print(f"i can't wait to see your next trick, {magician.title()}", end='\n\n')
print('Thank you, everyone. That was a great magic show!')
'\no nome da lista deve vir no plural\nassim facili... |
obj_path_map = {
"long_sofa": "04256520/68fce005fd18b5af598a453fd9fbd988",
"l_sofa": "04256520/575876c91251e1923d6e282938a47f9e",
"conic_bin": "02747177/cf158e768a6c9c8a17cab8b41d766398",
"square_prism_bin": "02747177/9fe4d78e7d4085c2f1b010366bb60ce8",
"faucet": "03325088/1f223cac61e3679ef235ab3c41a... | obj_path_map = {'long_sofa': '04256520/68fce005fd18b5af598a453fd9fbd988', 'l_sofa': '04256520/575876c91251e1923d6e282938a47f9e', 'conic_bin': '02747177/cf158e768a6c9c8a17cab8b41d766398', 'square_prism_bin': '02747177/9fe4d78e7d4085c2f1b010366bb60ce8', 'faucet': '03325088/1f223cac61e3679ef235ab3c41aeb5b6', 'bunsen_burne... |
#
# PySNMP MIB module CXPCM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXPCM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:17:42 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:23... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, value_size_constraint, constraints_intersection, single_value_constraint) ... |
N = int(input())
H = list(map(int, input().split()))
answer = moved = 0
before_h = H[0]
for h in H[1:]:
if h > before_h:
moved = 0
else:
moved += 1
answer = max(answer, moved)
before_h = h
print(answer) | n = int(input())
h = list(map(int, input().split()))
answer = moved = 0
before_h = H[0]
for h in H[1:]:
if h > before_h:
moved = 0
else:
moved += 1
answer = max(answer, moved)
before_h = h
print(answer) |
def generate_matrix(size):
matrix = []
for i in range(size):
matrix.append([None] * size)
return matrix
def create_list_of_lines(matrix):
lines = []
#adding horizontal lines
for hor_line in matrix:
lines.append(hor_line)
#adding vertical lines
for i in range(len(matrix)... | def generate_matrix(size):
matrix = []
for i in range(size):
matrix.append([None] * size)
return matrix
def create_list_of_lines(matrix):
lines = []
for hor_line in matrix:
lines.append(hor_line)
for i in range(len(matrix)):
ver_line = []
for j in range(len(matri... |
consumer_key = "mXzLJ779Al4UPyg3OJr1NzXdg"
consumer_secret = "yxQYDNvUs0JNEtEasA9CN4bEweImDIrISQit6eNWEmuCGP008G"
access_token = "1431634234783981568-WllRiFW0dQW7PjM2eBqYMIsfpqoJc8"
access_token_secret = "HahcSPryVc553SYEV6tOKPJkK2TcS2RX75jK3oOVNjRY1"
trigger = ""
timezone = 2 #change this into your timezone. for examp... | consumer_key = 'mXzLJ779Al4UPyg3OJr1NzXdg'
consumer_secret = 'yxQYDNvUs0JNEtEasA9CN4bEweImDIrISQit6eNWEmuCGP008G'
access_token = '1431634234783981568-WllRiFW0dQW7PjM2eBqYMIsfpqoJc8'
access_token_secret = 'HahcSPryVc553SYEV6tOKPJkK2TcS2RX75jK3oOVNjRY1'
trigger = ''
timezone = 2 |
def getKeys(os):
try:
dotenv = '.env.ini'
with open(dotenv, 'r') as file:
content = file.readlines()
content = [line.strip().split('=') for line in content if '=' in line]
env_vars = dict(content)
if file:
file.close()
return env_vars
exc... | def get_keys(os):
try:
dotenv = '.env.ini'
with open(dotenv, 'r') as file:
content = file.readlines()
content = [line.strip().split('=') for line in content if '=' in line]
env_vars = dict(content)
if file:
file.close()
return env_vars
exce... |
{
"targets": [
{
"target_name": "tester",
"sources": [ "tester.cc", "tester.js" ]
}
]
} | {'targets': [{'target_name': 'tester', 'sources': ['tester.cc', 'tester.js']}]} |
CONTROL_TOKEN = [int('1101010100', 2), # 00
int('0010101011', 2), # 01
int('0101010100', 2), # 10
int('1010101011', 2)] # 11
| control_token = [int('1101010100', 2), int('0010101011', 2), int('0101010100', 2), int('1010101011', 2)] |
class CStaticConsts:
# Product dictionary indexes
title = 'title'
currencyType = 'currencyId'
itemPrice = 'itemPrice'
productUrl = 'productUrl'
currencyUSD = 'USD'
siteName = 'siteName'
# Supported sites
Ebay = 'Ebay'
Walmart = 'Walmart'
Amazon = 'Amazon'
| class Cstaticconsts:
title = 'title'
currency_type = 'currencyId'
item_price = 'itemPrice'
product_url = 'productUrl'
currency_usd = 'USD'
site_name = 'siteName'
ebay = 'Ebay'
walmart = 'Walmart'
amazon = 'Amazon' |
# Strings taken from https://github.com/b1naryth1ef.
__all__ = (
'BOT_BROKEN_MSG',
'COUNCIL_QUEUE_MSG_NOT_FOUND',
'BAD_SUGGESTION_MSG',
'SUGGESTION_RECEIVED',
'SUGGESTION_APPROVED',
'SUGGESTION_DENIED',
'SUGGESTION_TOO_LARGE',
'UPLOADED_EMOJI_NOT_FOUND',
'SUBMITTER_NOT_FOUND'
)
COU... | __all__ = ('BOT_BROKEN_MSG', 'COUNCIL_QUEUE_MSG_NOT_FOUND', 'BAD_SUGGESTION_MSG', 'SUGGESTION_RECEIVED', 'SUGGESTION_APPROVED', 'SUGGESTION_DENIED', 'SUGGESTION_TOO_LARGE', 'UPLOADED_EMOJI_NOT_FOUND', 'SUBMITTER_NOT_FOUND')
council_queue_msg_not_found = "⚠ Couldn't delete the associated council queue message (ID: `{sug... |
class Solution:
def kthGrammar(self, N: int, K: int) -> int:
K -= 1
count = 0
while K:
count += 1
K &= K - 1
return count & 1
| class Solution:
def kth_grammar(self, N: int, K: int) -> int:
k -= 1
count = 0
while K:
count += 1
k &= K - 1
return count & 1 |
class scheduleElem():
def __init__(self, _tr, _op, _res):
self.tr = _tr
self.op = _op
self.res = _res
def __repr__(self):
return "{}{}({})".format(self.op, self.tr, self.res)
def getElem(strelem):
strtr = ''
op = ''
for i in strelem[0:strelem.find('(')]:
... | class Scheduleelem:
def __init__(self, _tr, _op, _res):
self.tr = _tr
self.op = _op
self.res = _res
def __repr__(self):
return '{}{}({})'.format(self.op, self.tr, self.res)
def get_elem(strelem):
strtr = ''
op = ''
for i in strelem[0:strelem.find('(')]:
if ... |
def foo(*, a, b):
print(a)
print(b)
def bar():
fo<caret>o(a = 1, b = 2)
| def foo(*, a, b):
print(a)
print(b)
def bar():
fo < caret > o(a=1, b=2) |
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def print_list(self):
cur_node = self.head
while cur_node:
print(cur_node.data)
cur_node = cur_node.next
def ... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def print_list(self):
cur_node = self.head
while cur_node:
print(cur_node.data)
cur_node = cur_node.next
def... |
def max_sum_subarray(nums):
if not nums: return nums
max_sum = nums[0]
cur_sum = 0
for i in range(len(nums)):
cur_sum = max( cur_sum + nums[i], nums[i] )
max_sum = max( cur_sum, max_sum )
return max_sum
| def max_sum_subarray(nums):
if not nums:
return nums
max_sum = nums[0]
cur_sum = 0
for i in range(len(nums)):
cur_sum = max(cur_sum + nums[i], nums[i])
max_sum = max(cur_sum, max_sum)
return max_sum |
class NoHostError(Exception):
pass
class NoHeartbeatError(Exception):
pass
class NoSudoError(Exception):
pass
class ServiceShutdown(Exception):
pass
| class Nohosterror(Exception):
pass
class Noheartbeaterror(Exception):
pass
class Nosudoerror(Exception):
pass
class Serviceshutdown(Exception):
pass |
#
# PySNMP MIB module FOUNDRY-SN-TRAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FOUNDRY-SN-TRAP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:15:47 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, single_value_constraint, constraints_union, value_size_constraint) ... |
n = int(input())
b = list(map(int, input().rstrip().split()))
count = 0
total = 0
l = len(b)-1
for i in b:
try:
if i%2 != 0:
b[count] += 1
b[count + 1] += 1
total += 1
except:
break
count += 1
if count == l:
break
if b[-1]%2 == 0:
pr... | n = int(input())
b = list(map(int, input().rstrip().split()))
count = 0
total = 0
l = len(b) - 1
for i in b:
try:
if i % 2 != 0:
b[count] += 1
b[count + 1] += 1
total += 1
except:
break
count += 1
if count == l:
break
if b[-1] % 2 == 0:
pri... |
#
# PySNMP MIB module PAIRGAIN-DSLAM-ALARM-SEVERITY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PAIRGAIN-DSLAM-ALARM-SEVERITY-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:27:27 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using P... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, constraints_union, single_value_constraint, constraints_intersection) ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.