content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class NoSessionError(Exception):
"""Raised when a model from :mod:`.models` wants to ``create``/``update``
but it doesn't have an :class:`atomx.Atomx` session yet.
"""
pass
class InvalidCredentials(Exception):
"""Raised when trying to login with the wrong e-mail or password."""
pass
class APIE... | class Nosessionerror(Exception):
"""Raised when a model from :mod:`.models` wants to ``create``/``update``
but it doesn't have an :class:`atomx.Atomx` session yet.
"""
pass
class Invalidcredentials(Exception):
"""Raised when trying to login with the wrong e-mail or password."""
pass
class Apie... |
class Solution:
def dfs(self,row_cnt:int, col_cnt:int, i:int, j:int, solve_dict:dict):
if (i, j) in solve_dict:
return solve_dict[(i,j)]
right_cnt = 0
down_cnt = 0
#right
if i + 1 < row_cnt:
if (i + 1, j) in solve_dict:
right_cnt = sol... | class Solution:
def dfs(self, row_cnt: int, col_cnt: int, i: int, j: int, solve_dict: dict):
if (i, j) in solve_dict:
return solve_dict[i, j]
right_cnt = 0
down_cnt = 0
if i + 1 < row_cnt:
if (i + 1, j) in solve_dict:
right_cnt = solve_dict[i ... |
'''
Kept for python2.7 compatibility.
'''
__all__ = []
| """
Kept for python2.7 compatibility.
"""
__all__ = [] |
"""
stringjumble.py
Author: johari
Credit: megsnyder, https://www.geeksforgeeks.org/reverse-string-python-5-different-ways/https://www.geeksforgeeks.org/reverse-string-python-5-different-ways/
https://stackoverflow.com/questions/529424/traverse-a-list-in-reverse-order-in-python
https://stackoverflow.com/questions/44817... | """
stringjumble.py
Author: johari
Credit: megsnyder, https://www.geeksforgeeks.org/reverse-string-python-5-different-ways/https://www.geeksforgeeks.org/reverse-string-python-5-different-ways/
https://stackoverflow.com/questions/529424/traverse-a-list-in-reverse-order-in-python
https://stackoverflow.com/questions/44817... |
STATE_NOT_STARTED = "NOT_STARTED"
STATE_COIN_FLIPPED = "COIN_FLIPPED"
STATE_DRAFT_COMPLETE = "COMPLETE"
STATE_BANNING = "BANNING"
STATE_PICKING = "PICKING"
USER_READABLE_STATE_MAP = {
STATE_NOT_STARTED: "Not started",
STATE_BANNING: "{} Ban",
STATE_PICKING: "{} Pick",
STATE_DRAFT_COMPLETE: "Draft compl... | state_not_started = 'NOT_STARTED'
state_coin_flipped = 'COIN_FLIPPED'
state_draft_complete = 'COMPLETE'
state_banning = 'BANNING'
state_picking = 'PICKING'
user_readable_state_map = {STATE_NOT_STARTED: 'Not started', STATE_BANNING: '{} Ban', STATE_PICKING: '{} Pick', STATE_DRAFT_COMPLETE: 'Draft complete'}
next_state =... |
class SearchProvider:
def search(self) -> list:
""" Searches a remote data source """
return []
| class Searchprovider:
def search(self) -> list:
""" Searches a remote data source """
return [] |
#!/usr/bin/env python3
try: # try the following code
print(a) # won't work since we have not defined a
except: # if there is ANY error
print('a is not defined!') # print this
try:
... | try:
print(a)
except:
print('a is not defined!')
try:
print(a)
except NameError:
print('a is still not defined!')
except:
print('Something else went wrong.')
print(a) |
n, k = map(int, input().split())
coin = sorted([int(input()) for _ in range(n)])
lst = [[0]*(k+1)]*n+[[1]*(k+1)]
lst[0] = [1 if j%coin[0]==0 else 0 for j in range(0,k+1)]
for i in range(0, len(coin)):
lst[i] = [sum([lst[i-1][j - (k * coin[i])] for k in range((j//coin[i])+1)]) for j in range(k+1)]
print(lst[n-1][k]) | (n, k) = map(int, input().split())
coin = sorted([int(input()) for _ in range(n)])
lst = [[0] * (k + 1)] * n + [[1] * (k + 1)]
lst[0] = [1 if j % coin[0] == 0 else 0 for j in range(0, k + 1)]
for i in range(0, len(coin)):
lst[i] = [sum([lst[i - 1][j - k * coin[i]] for k in range(j // coin[i] + 1)]) for j in range(k... |
"""Top-level package for oda-ops."""
__author__ = """Volodymyr Savchenko"""
__email__ = 'Volodymyr.Savchenko@unige.ch'
__version__ = '0.1.0'
| """Top-level package for oda-ops."""
__author__ = 'Volodymyr Savchenko'
__email__ = 'Volodymyr.Savchenko@unige.ch'
__version__ = '0.1.0' |
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
class_name = cls.__name__
if class_name not in cls._instances:
cls._instances[class_name] = super(Singleton, cls).__call__(*args, **kwargs)
return cls._instances[class_name]
| class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
class_name = cls.__name__
if class_name not in cls._instances:
cls._instances[class_name] = super(Singleton, cls).__call__(*args, **kwargs)
return cls._instances[class_name] |
{
"targets": [
{
"target_name": "samplerproxy",
"sources": [ "src/node_sampler_proxy.cpp" ],
"include_dirs": [
# Path to hopper root
],
"libraries": [
# Path to hopper framework library
# Path to hopper histogram library
],
"cflags" : [ "-std=c++11... | {'targets': [{'target_name': 'samplerproxy', 'sources': ['src/node_sampler_proxy.cpp'], 'include_dirs': [], 'libraries': [], 'cflags': ['-std=c++11', '-stdlib=libc++'], 'conditions': [['OS!="win"', {'cflags+': ['-std=c++11'], 'cflags_c+': ['-std=c++11'], 'cflags_cc+': ['-std=c++11']}], ['OS=="mac"', {'xcode_settings': ... |
class Solution:
def judgeCircle(self, moves: str) -> bool:
M = {
'U': (0, -1),
'D': (0, 1),
'R': (1, 0),
'L': (-1, 0)
}
x, y = 0, 0
for move in moves:
dx, dy = M[move]
x += dx
y += dy
retur... | class Solution:
def judge_circle(self, moves: str) -> bool:
m = {'U': (0, -1), 'D': (0, 1), 'R': (1, 0), 'L': (-1, 0)}
(x, y) = (0, 0)
for move in moves:
(dx, dy) = M[move]
x += dx
y += dy
return x == 0 and y == 0 |
class Animal(object):
def run(self):
print('Animal is running...')
class Dog(Animal):
def run(self):
print('Dog is running...')
class Cat(Animal):
pass
dog = Dog()
dog.run()
cat = Cat()
cat.run() | class Animal(object):
def run(self):
print('Animal is running...')
class Dog(Animal):
def run(self):
print('Dog is running...')
class Cat(Animal):
pass
dog = dog()
dog.run()
cat = cat()
cat.run() |
__author__ = "Piotr Gawlowicz, Anatolij Zubow"
__copyright__ = "Copyright (c) 2015, Technische Universitat Berlin"
__version__ = "0.1.0"
__email__ = "{gawlowicz, zubow}@tkn.tu-berlin.de"
class NetDevice(object):
'''
Base Class for all Network Devices, i.e. wired/wireless
This basic functionality should be... | __author__ = 'Piotr Gawlowicz, Anatolij Zubow'
__copyright__ = 'Copyright (c) 2015, Technische Universitat Berlin'
__version__ = '0.1.0'
__email__ = '{gawlowicz, zubow}@tkn.tu-berlin.de'
class Netdevice(object):
"""
Base Class for all Network Devices, i.e. wired/wireless
This basic functionality should be ... |
x=9
y=3
#Im only gonna comment here but i'll separate all the operater by new lines
#Same progression as the slides
print(x+y)
print(x-y)
print(x*y)
print(x/y)
print(x%y)
print(x**y)
x=9.919555555
print(x//y)
x=9
x+=3
print(x)
x=9
x-=3
print(x)
x*=3
print(x)
x/=3
print(x)
x ** 3
pri... | x = 9
y = 3
print(x + y)
print(x - y)
print(x * y)
print(x / y)
print(x % y)
print(x ** y)
x = 9.919555555
print(x // y)
x = 9
x += 3
print(x)
x = 9
x -= 3
print(x)
x *= 3
print(x)
x /= 3
print(x)
x ** 3
print(x)
x = 9
x = 3
print(x == y)
print(x != y)
print(x > y)
print(x < y)
print(x >= y)
print(x <= y) |
# Configuration
# Flask
DEBUG = True
UPLOAD_FOLDER = "/tmp/uploads"
MAX_CONTENT_LENGTH = 16 * 1024 * 1024 # 16MB
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
# Flask-SQLAlchemy
SQLALCHEMY_DATABASE_URI = "sqlite:////tmp/db.sqlite"
| debug = True
upload_folder = '/tmp/uploads'
max_content_length = 16 * 1024 * 1024
allowed_extensions = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
sqlalchemy_database_uri = 'sqlite:////tmp/db.sqlite' |
# Created by MechAviv
# Quest ID :: 34925
# Not coded yet
sm.setSpeakerID(3001508)
sm.setSpeakerType(3)
sm.flipDialogue()
sm.setBoxChat()
sm.boxChatPlayerAsSpeaker()
sm.setBoxOverrideSpeaker()
sm.flipBoxChat()
sm.flipBoxChatPlayerAsSpeaker()
sm.setColor(1)
sm.sendNext("#face0#We've got to find it. Looks like we've got... | sm.setSpeakerID(3001508)
sm.setSpeakerType(3)
sm.flipDialogue()
sm.setBoxChat()
sm.boxChatPlayerAsSpeaker()
sm.setBoxOverrideSpeaker()
sm.flipBoxChat()
sm.flipBoxChatPlayerAsSpeaker()
sm.setColor(1)
sm.sendNext("#face0#We've got to find it. Looks like we've got no choice but to form a recovery team.")
sm.setSpeakerID(3... |
class user:
"""
Class that generates new instances of user identify for creating an account in the app
"""
listUser = []
def __init__(self, firstName, lastName, userName, passWord):
self.fname = firstName
self.lname = lastName
self.uname = userName
self.pword = pas... | class User:
"""
Class that generates new instances of user identify for creating an account in the app
"""
list_user = []
def __init__(self, firstName, lastName, userName, passWord):
self.fname = firstName
self.lname = lastName
self.uname = userName
self.pword = pass... |
# https: // leetcode.com/problems/middle-of-the-linked-list/description/
#
# algorithms
# Easy (69.1%)
# Total Accepted: 6.1k
# Total Submissions: 8.8k
# beats 9.07% of python submissions
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# sel... | class Solution(object):
def middle_node(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if not head.next:
return head
tail = head.next
while tail:
head = head.next
if not tail.next or not tail.next.next:
... |
n = int(input())
a = [int(input()) for _ in range(n)]
pushed = [False] * n
cnt = 0
index = 0
while not (pushed[index]):
cnt += 1
pushed[index] = True
if index == 1:
cnt -= 1
print(cnt)
exit()
index = a[index] - 1
print(-1)
| n = int(input())
a = [int(input()) for _ in range(n)]
pushed = [False] * n
cnt = 0
index = 0
while not pushed[index]:
cnt += 1
pushed[index] = True
if index == 1:
cnt -= 1
print(cnt)
exit()
index = a[index] - 1
print(-1) |
single_port_ram = """module SinglePortRam #
(
parameter DATA_WIDTH = 8,
parameter ADDR_WIDTH = 4,
parameter RAM_DEPTH = 1 << ADDR_WIDTH
)
(
input clk,
input rst,
input [ADDR_WIDTH-1:0] ram_addr,
input [DATA_WIDTH-1:0] ram_d,
input ram_we,
output [DATA_WIDTH-1:0] ram_q
);
reg [DATA_WIDTH-1:0] mem [0... | single_port_ram = 'module SinglePortRam #\n(\n parameter DATA_WIDTH = 8,\n parameter ADDR_WIDTH = 4,\n parameter RAM_DEPTH = 1 << ADDR_WIDTH\n)\n(\n input clk,\n input rst,\n input [ADDR_WIDTH-1:0] ram_addr,\n input [DATA_WIDTH-1:0] ram_d,\n input ram_we,\n output [DATA_WIDTH-1:0] ram_q\n);\n\n reg [DATA_WIDT... |
# Source: https://leetcode.com/problems/add-digits/description/
# Author: Paulo Lemus
# Date : 2017-11-16
# Info : #258, Easy, 92 ms, 92.50%
# Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.
#
# For example:
#
# Given num = 38, the process is like: 3 + 8 = 11, 1 +... | class Solution:
def add_digits(self, num):
"""
:type num: int
:rtype: int
"""
while num > 9:
num = sum(map(int, str(num)))
return num
class Solution2:
def add_digits(self, num):
"""
:type num: int
:rtype: int
"""
... |
# -*- coding: utf-8 -*-
"""Top-level package for Twith Chat File Reader."""
__author__ = """Yann-Sebastien Tremblay-Johnston"""
__email__ = 'yanns.tremblay@gmail.com'
__version__ = '0.1.0'
| """Top-level package for Twith Chat File Reader."""
__author__ = 'Yann-Sebastien Tremblay-Johnston'
__email__ = 'yanns.tremblay@gmail.com'
__version__ = '0.1.0' |
def neural_control (output):
lat_stick = (output[0] - output[1]) * 21.5
pull = (output[2] - output[3]) * 25
control = [1.0, pull, lat_stick, 0.0]
return control | def neural_control(output):
lat_stick = (output[0] - output[1]) * 21.5
pull = (output[2] - output[3]) * 25
control = [1.0, pull, lat_stick, 0.0]
return control |
a = input("Geef een waarde (geen 0) ")
try:
a = int(a)
b = 100 / a
print(b)
except:
print("Ik zei nog zo: geen 0")
finally:
print("Bedankt voor het meedoen")
| a = input('Geef een waarde (geen 0) ')
try:
a = int(a)
b = 100 / a
print(b)
except:
print('Ik zei nog zo: geen 0')
finally:
print('Bedankt voor het meedoen') |
title = """
__ \ ___| |
| | | | __ \ _` | _ \ _ \ __ \ | __| _` | \ \ \ / | _ \ __|
| | | | | | ( | __/ ( | | | | | ( | \ \ \ / | __/ |
____/ \_... | title = '\n __ \\ ___| | \n | | | | __ \\ _` | _ \\ _ \\ __ \\ | __| _` | \\ \\ \\ / | _ \\ __| \n | | | | | | ( | __/ ( | | | | | ( | \\ \\ \\ / | __/ | ... |
#
# @lc app=leetcode id=43 lang=python
#
# [43] Multiply Strings
#
# https://leetcode.com/problems/multiply-strings/description/
#
# algorithms
# Medium (29.99%)
# Total Accepted: 185.2K
# Total Submissions: 617.4K
# Testcase Example: '"2"\n"3"'
#
# Given two non-negative integers num1 and num2 represented as strin... | '''
class Solution(object):
def multiply(self, num1, num2):
"""
:type num1: str
:type num2: str
:rtype: str
"""
num1 = num1[::-1] # Calculate the result from the rear.
num2 = num2[::-1]
if num1 == '0' or num2 == '0':
return '0'
if l... |
#https://www.acmicpc.net/problem/2475
n = map(int, input().split())
sum = 0
for i in n:
sum += (i**2)
print(sum%10) | n = map(int, input().split())
sum = 0
for i in n:
sum += i ** 2
print(sum % 10) |
__author__ = 'mcxiaoke'
class Bird(object):
feather=True
class Chicken(Bird):
fly=False
def __init__(self,age):
self.age=age
ck=Chicken(2)
print(Bird.__dict__)
print(Chicken.__dict__)
print(ck.__dict__)
| __author__ = 'mcxiaoke'
class Bird(object):
feather = True
class Chicken(Bird):
fly = False
def __init__(self, age):
self.age = age
ck = chicken(2)
print(Bird.__dict__)
print(Chicken.__dict__)
print(ck.__dict__) |
t=int(input())
l=list(map(int,input().split()))
l=sorted(l)
ans=0
c=0
for i in l:
if i>=c:
ans+=1
c+=i
print(ans) | t = int(input())
l = list(map(int, input().split()))
l = sorted(l)
ans = 0
c = 0
for i in l:
if i >= c:
ans += 1
c += i
print(ans) |
names = ["shiva", "sai", "azim", "mathews", "philips", "samule"]
items = [name.capitalize() for name in names]
print(items)
items = [len(name) for name in names]
print(items)
def get_list_comprehensions(lambda_expression, value):
return [lambda_expression(x) for x in range(value)]
data = get_list_comprehensions... | names = ['shiva', 'sai', 'azim', 'mathews', 'philips', 'samule']
items = [name.capitalize() for name in names]
print(items)
items = [len(name) for name in names]
print(items)
def get_list_comprehensions(lambda_expression, value):
return [lambda_expression(x) for x in range(value)]
data = get_list_comprehensions(la... |
TILESIZE = 29
PLAYER_LAYER = 4
ENEMY_LAYER = 3
BLOCK_LAYER = 2
GROUND_LAYER = 1
PLAYER_SPEED = 3
player_speed = 0
WHITE = (255, 255, 255)
BLUE = (0, 0, 255)
RED = (255, 0, 0)
BLACK = (0, 0, 0)
tilemap = [
'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
'B............................... | tilesize = 29
player_layer = 4
enemy_layer = 3
block_layer = 2
ground_layer = 1
player_speed = 3
player_speed = 0
white = (255, 255, 255)
blue = (0, 0, 255)
red = (255, 0, 0)
black = (0, 0, 0)
tilemap = ['BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB', 'B........................................... |
"""
Cryptocurrency network definitions
"""
class Network:
"""
Represents a cryptocurrency network (e.g. Bitcoin Mainnet)
"""
def __init__(self, description, version_priv, version_pub, pub_key_hash,
wif):
self.description = description
self.version_priv = version_priv
... | """
Cryptocurrency network definitions
"""
class Network:
"""
Represents a cryptocurrency network (e.g. Bitcoin Mainnet)
"""
def __init__(self, description, version_priv, version_pub, pub_key_hash, wif):
self.description = description
self.version_priv = version_priv
self.versi... |
class VentilationTrapInstanceError(Exception):
"""Raised when a Ventilation Trap parameter is not int or float"""
pass
class TrapezeBuildGeometryError(Exception):
"""raised when the parameter have not good type"""
pass
| class Ventilationtrapinstanceerror(Exception):
"""Raised when a Ventilation Trap parameter is not int or float"""
pass
class Trapezebuildgeometryerror(Exception):
"""raised when the parameter have not good type"""
pass |
def moveDisk(poles, disk, pole):
# move disk to pole
if(disk == 0):
# base case of recursive algorithm
return 0, poles
# find the pole the disk is currently on
diskIsOn = 0
if disk in poles[1]:
diskIsOn = 1
if disk in poles[2]:
diskIsOn = 2
# make list of al... | def move_disk(poles, disk, pole):
if disk == 0:
return (0, poles)
disk_is_on = 0
if disk in poles[1]:
disk_is_on = 1
if disk in poles[2]:
disk_is_on = 2
disks_to_move = []
for d in poles[diskIsOn] + poles[pole]:
if d < disk:
disksToMove.insert(0, d)
... |
TOKEN_URL = 'https://discordapp.com/api/oauth2/token'
GROUP_DM_URL = 'https://discordapp.com/api/users/@me/channels'
RPC_TOKEN_URL_FRAGMENT = '/rpc'
RPC_HOSTNAME = 'ws://127.0.0.1:'
RPC_QUERYSTRING = '?v=1&encoding=json&client_id='
CLIENT_ID = ''
CLIENT_SECRET = ''
REDIRECT_URI = ''
RPC_ORIGIN = ''
BOT_TOKEN = ''
| token_url = 'https://discordapp.com/api/oauth2/token'
group_dm_url = 'https://discordapp.com/api/users/@me/channels'
rpc_token_url_fragment = '/rpc'
rpc_hostname = 'ws://127.0.0.1:'
rpc_querystring = '?v=1&encoding=json&client_id='
client_id = ''
client_secret = ''
redirect_uri = ''
rpc_origin = ''
bot_token = '' |
## Automatically adapted for numpy Apr 14, 2006 by convertcode.py
ARCSECTORAD = float('4.8481368110953599358991410235794797595635330237270e-6')
RADTOARCSEC = float('206264.80624709635515647335733077861319665970087963')
SECTORAD = float('7.2722052166430399038487115353692196393452995355905e-5')
RADTOSEC = float('1... | arcsectorad = float('4.8481368110953599358991410235794797595635330237270e-6')
radtoarcsec = float('206264.80624709635515647335733077861319665970087963')
sectorad = float('7.2722052166430399038487115353692196393452995355905e-5')
radtosec = float('13750.987083139757010431557155385240879777313391975')
radtodeg = float('57... |
CONTENT_TYPE_CHOICES = (
('Company', 'Company'),
('Job', 'Job'),
('Topic', 'Topic'),
) | content_type_choices = (('Company', 'Company'), ('Job', 'Job'), ('Topic', 'Topic')) |
class AnimalNode:
def __init__(self, question, yes_child, no_child):
self.question = question
self.yes_child = yes_child
self.no_child = no_child
def name(self):
"""
Return the animal's name with an appropriate "a" or "an" in front.
This only works for l... | class Animalnode:
def __init__(self, question, yes_child, no_child):
self.question = question
self.yes_child = yes_child
self.no_child = no_child
def name(self):
"""
Return the animal's name with an appropriate "a" or "an" in front.
This only works for leaf node... |
class Solution(object):
def angleClock(self, hour, minutes):
"""
:type hour: int
:type minutes: int
:rtype: float
"""
m = minutes * (360/60)
if hour == 12:
h = minutes * (360.0/12/60)
else:
h = hour * (360/12) + minutes * (360.0... | class Solution(object):
def angle_clock(self, hour, minutes):
"""
:type hour: int
:type minutes: int
:rtype: float
"""
m = minutes * (360 / 60)
if hour == 12:
h = minutes * (360.0 / 12 / 60)
else:
h = hour * (360 / 12) + minute... |
"""
Figure parameters class
"""
class FigureParameters:
"""
Class contains figure and text sizes
"""
def __init__(self):
self.scale = 1.25*1080/8
self.figure_size_x = int(1920/self.scale)
self.figure_size_y = int(1080/self.scale)
self.text_size = int(2.9*1080/self.sca... | """
Figure parameters class
"""
class Figureparameters:
"""
Class contains figure and text sizes
"""
def __init__(self):
self.scale = 1.25 * 1080 / 8
self.figure_size_x = int(1920 / self.scale)
self.figure_size_y = int(1080 / self.scale)
self.text_size = int(2.9 * 1080 ... |
class Solution:
def summaryRanges(self, nums):
summary = []
i = 0
for j in range(len(nums)):
if j + 1 < len(nums) and nums[j + 1] == nums[j] + 1:
continue
if i == j:
summary.append(str(nums[i]))
else:
summar... | class Solution:
def summary_ranges(self, nums):
summary = []
i = 0
for j in range(len(nums)):
if j + 1 < len(nums) and nums[j + 1] == nums[j] + 1:
continue
if i == j:
summary.append(str(nums[i]))
else:
summa... |
# import copy
class Solution:
def numIslands(self, grid: List[List[str]]) -> int:
if not grid:
return 0
# copyGrid = copy.deepcopy(grid)
copyGrid = grid
m = len(grid)
n = len(grid[0])
res = 0
for i in range(m):
for j in range(n):
... | class Solution:
def num_islands(self, grid: List[List[str]]) -> int:
if not grid:
return 0
copy_grid = grid
m = len(grid)
n = len(grid[0])
res = 0
for i in range(m):
for j in range(n):
if copyGrid[i][j] == '1':
... |
BAD_CREDENTIALS = "Unauthorized: The credentials were provided incorrectly or did not match any existing,\
active credentials."
PAYMENT_REQUIRED = "Payment Required: There is no active subscription\
for the account associated with the credentials submitted with the request."
FORBIDDEN = "Because the international s... | bad_credentials = 'Unauthorized: The credentials were provided incorrectly or did not match any existing, active credentials.'
payment_required = 'Payment Required: There is no active subscription for the account associated with the credentials submitted with the request.'
forbidden = 'Because the international service... |
#!/usr/bin/env python3
# coding: utf-8
def foreachcsv(filename, callback):
with open(filename, 'rb') as f:
while True:
line = f.readline().strip()
if not line:
break
callback(line)
def fdata2list(filename):
with open(filename, 'r') as f:
da... | def foreachcsv(filename, callback):
with open(filename, 'rb') as f:
while True:
line = f.readline().strip()
if not line:
break
callback(line)
def fdata2list(filename):
with open(filename, 'r') as f:
data = [line.strip() for line in f.readlines... |
class Person:
def __init__(self, name):
self.name = name
def display1(self):
print('End of the Statement')
class Student(Person):
def __init__(self, name, usn, branch):
super().__init__(name)
self.name = name
self.usn = usn
self.branch = branch
def dis... | class Person:
def __init__(self, name):
self.name = name
def display1(self):
print('End of the Statement')
class Student(Person):
def __init__(self, name, usn, branch):
super().__init__(name)
self.name = name
self.usn = usn
self.branch = branch
def di... |
#
# @lc app=leetcode id=61 lang=python3
#
# [61] Rotate List
#
# @lc code=start
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def rotateRight(self, head: ListNode, k: int) -> ListNode:
curr = head
... | class Solution:
def rotate_right(self, head: ListNode, k: int) -> ListNode:
curr = head
length = 0
while curr:
length += 1
curr = curr.next
if length == 0:
return None
k = k % length
if k == 0:
return head
left ... |
# https://programmers.co.kr/learn/courses/30/lessons/42584
def solution(prices):
answer = []
length = len(prices)
for i in range(length):
now_value = prices[i]
for j in range(i+1, length):
if prices[j] < now_value or j == length -1:
answer.append(j-i)
... | def solution(prices):
answer = []
length = len(prices)
for i in range(length):
now_value = prices[i]
for j in range(i + 1, length):
if prices[j] < now_value or j == length - 1:
answer.append(j - i)
break
answer.append(0)
return answer |
###############################################################################
# Done: READ the code below. TRACE (by hand) the execution of the code,
# predicting what will get printed. Then run the code
# and compare your prediction to what actually was printed.
# Then mark this _TODO_ as DONE and commit-and-push ... | def main():
hello('Snow White')
goodbye('Bashful')
hello('Grumpy')
hello('Sleepy')
hello_and_goodbye('Magic Mirror', 'Cruel Queen')
def hello(friend):
print('Hello,', friend, '- how are things?')
def goodbye(friend):
print('Goodbye,', friend, '- see you later!')
print(' Ciao!')
p... |
i = 0
while True:
open(f'{i}', 'w')
i += 1
| i = 0
while True:
open(f'{i}', 'w')
i += 1 |
"""
Terminal client for telegram
"""
__version__ = "0.17.0"
| """
Terminal client for telegram
"""
__version__ = '0.17.0' |
# Example: Fetch a single transcription on a recording
my_transcription = api.get_transcription('recordingId', 'transcriptionId')
print(my_transcription)
## {
## 'chargeableDuration': 11,
## 'id' : '{transcriptionId}',
## 'state' : 'completed',
## 'text' : 'Hey t... | my_transcription = api.get_transcription('recordingId', 'transcriptionId')
print(my_transcription) |
class Solution:
def singleNumber(self, nums: List[int]) -> int:
nums.sort()
i=0
while i <len(nums):
if ((i<len(nums)-2) and nums[i]==nums[i+1] ):
i+=2
else:
return nums[i]
break | class Solution:
def single_number(self, nums: List[int]) -> int:
nums.sort()
i = 0
while i < len(nums):
if i < len(nums) - 2 and nums[i] == nums[i + 1]:
i += 2
else:
return nums[i]
break |
# -*- encoding: utf-8 -*-
{
'name': 'El Salvador - Reportes y funcionalidad extra',
'version': '1.0',
'category': 'Localization',
'description': """ Reportes requeridos y otra funcionalidad extra para llevar un contabilidad en El Salvador. """,
'author': 'Aquih, S.A.',
'website': 'http:... | {'name': 'El Salvador - Reportes y funcionalidad extra', 'version': '1.0', 'category': 'Localization', 'description': ' Reportes requeridos y otra funcionalidad extra para llevar un contabilidad en El Salvador. ', 'author': 'Aquih, S.A.', 'website': 'http://aquih.com/', 'depends': ['l10n_sv'], 'data': ['views/account_v... |
"""Common environment variables unique to the discussion plugin."""
def plugin_settings(settings):
"""Settings for the discussions plugin. """
# .. toggle_name: ALLOW_HIDING_DISCUSSION_TAB
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: If True, it add... | """Common environment variables unique to the discussion plugin."""
def plugin_settings(settings):
"""Settings for the discussions plugin. """
settings.FEATURES['ALLOW_HIDING_DISCUSSION_TAB'] = False
settings.DISCUSSION_SETTINGS = {'MAX_COMMENT_DEPTH': 2, 'COURSE_PUBLISH_TASK_DELAY': 30} |
class Solution:
def minPathSum(self, grid: List[List[int]]) -> int:
m = len(grid[0])
n = len(grid)
if m == 0 or n == 0:
return 0
for i in range(m):
if i != 0:
grid[0][i] += grid[0][i-1]
for j in range(... | class Solution:
def min_path_sum(self, grid: List[List[int]]) -> int:
m = len(grid[0])
n = len(grid)
if m == 0 or n == 0:
return 0
for i in range(m):
if i != 0:
grid[0][i] += grid[0][i - 1]
for j in range(n):
if j != 0:
... |
print("Keep Talking And Nobody Explodes - Kronorox Solvers")
print("On the Subject of Passwords")
print("Version 1.01")
print(" ")
print("Remember to rack through the first six(using the arrows), then move to the second set of letters, and so on")
#Loading the file, opening it, then adding it to the list, then clo... | print('Keep Talking And Nobody Explodes - Kronorox Solvers')
print('On the Subject of Passwords')
print('Version 1.01')
print(' ')
print('Remember to rack through the first six(using the arrows), then move to the second set of letters, and so on')
def loadwords():
words = open('passwordslist.txt', 'r')
wordlis... |
class BeaxyIOError(IOError):
def __init__(self, msg, response, result, *args, **kwargs):
self.response = response
self.result = result
super(BeaxyIOError, self).__init__(msg, *args, **kwargs)
| class Beaxyioerror(IOError):
def __init__(self, msg, response, result, *args, **kwargs):
self.response = response
self.result = result
super(BeaxyIOError, self).__init__(msg, *args, **kwargs) |
class Solution(object):
def lengthOfLongestSubstring(self, s):
if not s:
return 0
start, end = 0, 0
seen = set()
ans = 0
while end < len(s):
if s[end] not in seen:
seen.add(s[end])
... | class Solution(object):
def length_of_longest_substring(self, s):
if not s:
return 0
(start, end) = (0, 0)
seen = set()
ans = 0
while end < len(s):
if s[end] not in seen:
seen.add(s[end])
ans = max(ans, end - start + 1)... |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = "/home/mayur/ros jade files/catkin_ws/src/Udacity-SDC-Radar-Driver-Micro-Challenge/ros/src/sensing/drivers/can/packages/kvaser/msg/CANESR.msg"
services_str = ""
pkg_name = "kvaser"
dependencies_str = "std_msgs;visualization_msgs"
langs = "gencpp;geneus... | messages_str = '/home/mayur/ros jade files/catkin_ws/src/Udacity-SDC-Radar-Driver-Micro-Challenge/ros/src/sensing/drivers/can/packages/kvaser/msg/CANESR.msg'
services_str = ''
pkg_name = 'kvaser'
dependencies_str = 'std_msgs;visualization_msgs'
langs = 'gencpp;geneus;genlisp;gennodejs;genpy'
dep_include_paths_str = 'kv... |
file = open("input", "r")
good_passwords = 0
for line in file.readlines():
poss, char, word = line.strip().split()
pos_one, pos_two = poss.split("-")
char = char[0]
if (word[int(pos_one) - 1] == char) != (word[int(pos_two) - 1] == char):
good_passwords += 1
print(good_passwords)
| file = open('input', 'r')
good_passwords = 0
for line in file.readlines():
(poss, char, word) = line.strip().split()
(pos_one, pos_two) = poss.split('-')
char = char[0]
if (word[int(pos_one) - 1] == char) != (word[int(pos_two) - 1] == char):
good_passwords += 1
print(good_passwords) |
# Hotel Receptionist (1061100) | Sleepywood Hotel
array = [# Name, MesoCost, Map ID
["Regular", 499, 105000011],
["VIP", 999, 105000012]
]
sm.sendNext("Welcome. We're the Sleepywood Hotel. "
"Our hotel works hard to serve you the best at all times. "
"If you are tired ... | array = [['Regular', 499, 105000011], ['VIP', 999, 105000012]]
sm.sendNext("Welcome. We're the Sleepywood Hotel. Our hotel works hard to serve you the best at all times. If you are tired and worn out from hunting, how about a relaxing stay at our hotel?")
selection = sm.sendNext('We offer two kinds of rooms for our ser... |
### Merge Sort
def merge_sort(A):
"""
Given a list A, sort it using merge sort.
First divide the list into two halves, then resursively sort each half.
Return the sorted list.
If the list has length less than 2, return the list since it's already sorted.
"""
n = len(A)
if n < 2:
... | def merge_sort(A):
"""
Given a list A, sort it using merge sort.
First divide the list into two halves, then resursively sort each half.
Return the sorted list.
If the list has length less than 2, return the list since it's already sorted.
"""
n = len(A)
if n < 2:
return A
... |
def init_parse(init):
dicinit = {}
init = open('%s'%init,'r')
lines = init.readlines()
lines = [x.strip( ) for x in lines]
for line in lines:
if line.startswith('#'):
pass
else:
try:
dicinit[line.split(' ')[0]] = line.split(' ')[2]
... | def init_parse(init):
dicinit = {}
init = open('%s' % init, 'r')
lines = init.readlines()
lines = [x.strip() for x in lines]
for line in lines:
if line.startswith('#'):
pass
else:
try:
dicinit[line.split(' ')[0]] = line.split(' ')[2]
... |
"""
This is where we should implement any and all job function for the
redis queue. The rq library requires special namespacing in order to work,
so these functions must reside in a separate file.
"""
| """
This is where we should implement any and all job function for the
redis queue. The rq library requires special namespacing in order to work,
so these functions must reside in a separate file.
""" |
"""
A decorator that makes a class a singleton
"""
# pylint: disable=too-few-public-methods
class Singleton:
"""
A singleton class
"""
instances = {}
def __new__(cls, clz=None):
"""
Returns a new instance ONLY if one does not already exist
"""
if clz is None:
... | """
A decorator that makes a class a singleton
"""
class Singleton:
"""
A singleton class
"""
instances = {}
def __new__(cls, clz=None):
"""
Returns a new instance ONLY if one does not already exist
"""
if clz is None:
if cls.__name__ not in Singleton.in... |
try:
print("Enter the 20 input Number to get summary")
num=[]
for i in range(0, 20):
temp = int(input())
num.append(temp)
print(f"List with Number's : {num}\nlength :{len(num)}")
count_p=0
count_n=0
count_odd=0
count_even=0
count_zero=0
for i in num:
if i>... | try:
print('Enter the 20 input Number to get summary')
num = []
for i in range(0, 20):
temp = int(input())
num.append(temp)
print(f"List with Number's : {num}\nlength :{len(num)}")
count_p = 0
count_n = 0
count_odd = 0
count_even = 0
count_zero = 0
for i in num:
... |
class Solution:
def solve(self, strs):
return sorted(strs, reverse = True)
| class Solution:
def solve(self, strs):
return sorted(strs, reverse=True) |
"""
You can uncomment on the setting parameters below
==================================
"""
"""
This parameter is used to determine the specific user to executes the kolla ansible command
"""
# USER_EXEC_KOLLA_COMMAND = "root"
"""
This parameter is used to determine the location of the hosts file
"""
# CONFIG_DIR_HO... | """
You can uncomment on the setting parameters below
==================================
"""
'\nThis parameter is used to determine the specific user to executes the kolla ansible command\n'
'\nThis parameter is used to determine the location of the hosts file\n'
'\nThis parameter is used to determine the storage locat... |
before_array_dict = [
{"theRealCat": "unavailable",
"code": "callback-http-failure-status",
"nestedDeeply": {
"stillNesting": {
"yetStillNesting": {
"wowSuchNest": True
}
}
},
"details": [{"nextId": "ued-abc123",
"nam... | before_array_dict = [{'theRealCat': 'unavailable', 'code': 'callback-http-failure-status', 'nestedDeeply': {'stillNesting': {'yetStillNesting': {'wowSuchNest': True}}}, 'details': [{'nextId': 'ued-abc123', 'name': 'callnextId', 'superValue': 'c-abc123'}, {'nextId': 'ued-abc123', 'name': 'callbackStatusCode', 'superValu... |
class Solution:
def findTheWinner(self, n: int, k: int) -> int:
# edge cases
if n == 1: return 1
if k == 1: return n
# general cases
circle = [i for i in range(1,n+1)]
start = 0
while len(circle) > 1:
start = (start + k -1) % len(circle)
... | class Solution:
def find_the_winner(self, n: int, k: int) -> int:
if n == 1:
return 1
if k == 1:
return n
circle = [i for i in range(1, n + 1)]
start = 0
while len(circle) > 1:
start = (start + k - 1) % len(circle)
del circle[s... |
def list_of_multiples (num, length):
return [i*num for i in range(1,length+1)]
#Problem statement: Create a function that takes two numbers as arguments (num, length) and returns a list of multiples of num up to length.
#Problem Link: https://edabit.com/challenge/BuwHwPvt92yw574zB
| def list_of_multiples(num, length):
return [i * num for i in range(1, length + 1)] |
__author__ = 'wangjian'
| __author__ = 'wangjian' |
#CB 03/03/2019
#GMIT Data Analytics Programming & Scripting Module 2019
#Problem Sets
#Problem Set 1
#Setting up a user-defined variable 'i', and asking the user to enter a positive integer as 'i'
i = int(input("Please enter a positive integer: "))
#Setting up the 'total' variable, which will track the output value i... | i = int(input('Please enter a positive integer: '))
total = 0
while i > 0:
total = total + i
i = i - 1
print(total) |
class NumArray:
def __init__(self, nums: 'List[int]'):
self.sums = [0]
for num in nums:
self.sums.append(self.sums[-1] + num)
def sumRange(self, i: int, j: int) -> int:
return self.sums[j + 1] - self.sums[i]
if __name__ == '__main__':
num_array = NumArray([-... | class Numarray:
def __init__(self, nums: 'List[int]'):
self.sums = [0]
for num in nums:
self.sums.append(self.sums[-1] + num)
def sum_range(self, i: int, j: int) -> int:
return self.sums[j + 1] - self.sums[i]
if __name__ == '__main__':
num_array = num_array([-2, 0, 3, -... |
# Requires mock server set up on localhost:3000
# Try out Mockoon for this: https://github.com/mockoon/mockoon
# They even provide sample responses for each API: https://github.com/mockoon/mock-samples
SPOTIFY_WEB_API = "http://localhost:3000/v1"
SPOTIFY_AUTH_API = "http://localhost:3000/v1/auth"
GROUPS_TABLE = "Smoot... | spotify_web_api = 'http://localhost:3000/v1'
spotify_auth_api = 'http://localhost:3000/v1/auth'
groups_table = 'SmoothieGroupsDev' |
def cartpole_analytical_derivatives(model, data, x, u=None):
if u is None:
u = model.unone
# Getting the state and control variables
y, th, ydot, thdot = x[0].item(), x[1].item(), x[2].item(), x[3].item()
f = u[0].item()
# Shortname for system parameters
m1, m2, l, g = model.m1, model.... | def cartpole_analytical_derivatives(model, data, x, u=None):
if u is None:
u = model.unone
(y, th, ydot, thdot) = (x[0].item(), x[1].item(), x[2].item(), x[3].item())
f = u[0].item()
(m1, m2, l, g) = (model.m1, model.m2, model.l, model.g)
(s, c) = (np.sin(th), np.cos(th))
m = m1 + m2
... |
plays = ['Hamlet', 'Macbeth', 'King Lear']
plays.insert(1, 'Julius Caesar')
print(plays)
plays.insert(0, 'Romeo & Juliet')
print(plays)
plays.insert(10, "A Midsummer Night's Dreams")
print(plays) | plays = ['Hamlet', 'Macbeth', 'King Lear']
plays.insert(1, 'Julius Caesar')
print(plays)
plays.insert(0, 'Romeo & Juliet')
print(plays)
plays.insert(10, "A Midsummer Night's Dreams")
print(plays) |
"""
Problem 1
COORDINATE MATH: Fill in the Line class methods to accept coordinates as a pair of tuples and return the slope and distance of the line.
EXAMPLE OUTPUT
coordinate1 = (3,2)
coordinate2 = (8,10)
li = Line(coordinate1,coordinate2)
"""
class Line:
def __init__(self,coor1,coor2):
self.coo... | """
Problem 1
COORDINATE MATH: Fill in the Line class methods to accept coordinates as a pair of tuples and return the slope and distance of the line.
EXAMPLE OUTPUT
coordinate1 = (3,2)
coordinate2 = (8,10)
li = Line(coordinate1,coordinate2)
"""
class Line:
def __init__(self, coor1, coor2):
self.coor1... |
se_colors = {
'TV Application Layer': '#D9D9D9',
'Second Screen Framework': '#B67272',
'Audio Mining': '#F23A3A',
'Content Optimisation': '#00B0F0',
'HbbTV Application Toolkit': '#FF91C4',
'Open City Database': '#61DDFF',
'POIProxy': '#C8F763',
'App Generator': ... | se_colors = {'TV Application Layer': '#D9D9D9', 'Second Screen Framework': '#B67272', 'Audio Mining': '#F23A3A', 'Content Optimisation': '#00B0F0', 'HbbTV Application Toolkit': '#FF91C4', 'Open City Database': '#61DDFF', 'POIProxy': '#C8F763', 'App Generator': '#1EC499', 'Fusion Engine': '#ECA2F5', 'OpenDataSoft': '#36... |
class HashTable:
def __init__(self):
self.table = [[] for x in range(13)]
def hash(self, key):
chrcodes = sum([ord(x) for x in key])
return chrcodes % 13
def insert(self, key, data):
# try to get existing key
print(self.hash(key))
for item in self.table[sel... | class Hashtable:
def __init__(self):
self.table = [[] for x in range(13)]
def hash(self, key):
chrcodes = sum([ord(x) for x in key])
return chrcodes % 13
def insert(self, key, data):
print(self.hash(key))
for item in self.table[self.hash(key)]:
if item[... |
# Get the plain text matrix (1 * 3 from a 3 letter word)
def get_plain_text_matrix(plain_text):
return [(ord(plain_text[i]) - 65) for i in range(3)]
# Get the key matrix (3 * 3 mtx from a 9 letter word)
def get_key_matrix(key):
mtx = [[0] * 3 for _ in range(3)]
counter = 0
for i in range(3):
f... | def get_plain_text_matrix(plain_text):
return [ord(plain_text[i]) - 65 for i in range(3)]
def get_key_matrix(key):
mtx = [[0] * 3 for _ in range(3)]
counter = 0
for i in range(3):
for j in range(3):
mtx[i][j] = ord(key[counter]) - 65
counter += 1
return mtx
def get_... |
class ShaderNodeBsdfTransparent:
pass
| class Shadernodebsdftransparent:
pass |
'''
Copyright [2017] [taurus.ai]
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 agreed to in writing, software
... | """
Copyright [2017] [taurus.ai]
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 agreed to in writing, software
... |
# auto parse
def auto_json_to_graph_experiment(json_dict):
process_original_json(json_dict)
# tags
normal_merge(json_dict, "Tag", "Chemical", "pk", "tags")
normal_merge(json_dict, "Tag", "Mixture", "pk", "tags")
normal_merge(json_dict, "Tag", "Experiment", "pk", "tags")
# get prop... | def auto_json_to_graph_experiment(json_dict):
process_original_json(json_dict)
normal_merge(json_dict, 'Tag', 'Chemical', 'pk', 'tags')
normal_merge(json_dict, 'Tag', 'Mixture', 'pk', 'tags')
normal_merge(json_dict, 'Tag', 'Experiment', 'pk', 'tags')
merge_prop_dict(json_dict, 'PropertyName', 'Prope... |
class Employee():
def __init__(self, name, salary):
self.name = name
self.salary = salary
self.is_db_connected = False
def __enter__(self):
print("entered")
self.is_db_connected = True
# must return self because in the with employee as e: e becomes the value re... | class Employee:
def __init__(self, name, salary):
self.name = name
self.salary = salary
self.is_db_connected = False
def __enter__(self):
print('entered')
self.is_db_connected = True
return self
def __exit__(self, type, value, traceback):
print('exi... |
##x = input()
##if str(x)[::-1] == str(x):
## print("yes")
##else:
## print("no")
x = input()
x.replace(" ", "")
l = 0
r = len(x) - 1
output = 'yes'
while l < r:
if x[l] != x[r]:
output = 'no'
break
else:
l += 1
r -= 1
print(output)
| x = input()
x.replace(' ', '')
l = 0
r = len(x) - 1
output = 'yes'
while l < r:
if x[l] != x[r]:
output = 'no'
break
else:
l += 1
r -= 1
print(output) |
string1 = input("")
string2 = input("")
lenStrings = len(string1)
arr = [[0]*(lenStrings+1) for n in range(lenStrings+1)]
for i in range(1,lenStrings+1):
for j in range(1,lenStrings+1):
match = arr[i-1][j-1]
if string1[i-1] == string2[j-1]:
match += 1
arr[i][j] = max(arr[i][j-... | string1 = input('')
string2 = input('')
len_strings = len(string1)
arr = [[0] * (lenStrings + 1) for n in range(lenStrings + 1)]
for i in range(1, lenStrings + 1):
for j in range(1, lenStrings + 1):
match = arr[i - 1][j - 1]
if string1[i - 1] == string2[j - 1]:
match += 1
arr[i][... |
class Solution:
def findMaxAverage(self, nums, k: int) -> float:
# Avoid computations by working with a window of 1. We find the
# average of k-1 elements and add/remove values from the ends.
limit = k-1
start, max_avg = sum(nums[:limit]) / k, -(10 << 30)
for i in range(limit... | class Solution:
def find_max_average(self, nums, k: int) -> float:
limit = k - 1
(start, max_avg) = (sum(nums[:limit]) / k, -(10 << 30))
for i in range(limit, len(nums)):
final_value = nums[i] / k
candidate = start + final_value
if candidate > max_avg:
... |
EE_BASE = "https://elections.democracyclub.org.uk/"
"""
Every Election settings
Set CHECK to True to check Every Election to see if there is
an election happening before serving a poling station result
Set CHECK to False to return the value of HAS_ELECTION instead
This is mostly useful in development when we want
t... | ee_base = 'https://elections.democracyclub.org.uk/'
'\nEvery Election settings\n\nSet CHECK to True to check Every Election to see if there is\nan election happening before serving a poling station result\n\nSet CHECK to False to return the value of HAS_ELECTION instead\n\nThis is mostly useful in development when we w... |
# Section 5.15 snippets
# Finding the Minimum and Maximum Values Using a Key Function
'Red' < 'orange'
ord('R')
ord('o')
colors = ['Red', 'orange', 'Yellow', 'green', 'Blue']
min(colors, key=lambda s: s.lower())
max(colors, key=lambda s: s.lower())
# Iterating Backwards Through a Sequence
numbers = [10, 3, 7, 1,... | 'Red' < 'orange'
ord('R')
ord('o')
colors = ['Red', 'orange', 'Yellow', 'green', 'Blue']
min(colors, key=lambda s: s.lower())
max(colors, key=lambda s: s.lower())
numbers = [10, 3, 7, 1, 9, 4, 2, 8, 5, 6]
reversed_numbers = [item ** 2 for item in reversed(numbers)]
reversed_numbers
names = ['Bob', 'Sue', 'Amanda']
grad... |
#!/usr/bin/python
def Fibonaci_iter(n):
if (n == 0):
return 0
elif (n == 1):
return 1
elif (n > 1):
fn = 0
fn1 = 1
fn2 = 1
while n > 2:
fn = fn1 + fn2
fn1 = fn2
fn2 = fn
n = n - 1
return fn
print(Fibo... | def fibonaci_iter(n):
if n == 0:
return 0
elif n == 1:
return 1
elif n > 1:
fn = 0
fn1 = 1
fn2 = 1
while n > 2:
fn = fn1 + fn2
fn1 = fn2
fn2 = fn
n = n - 1
return fn
print(fibonaci_iter(5)) |
# Copyright 2021 The Perkeepy Authors
#
# 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 agreed to in... | class Camlisig:
@staticmethod
def from_armored_gpg_signature(armored_gpg_signature: str) -> str:
armored_gpg_signature = armored_gpg_signature.strip()
start_index: int = armored_gpg_signature.index('\n\n')
end_index: int = armored_gpg_signature.index('\n-----')
signature: str = ... |
#
# PySNMP MIB module TIMETRA-TC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIMETRA-TC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:01:12 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, constraints_union, value_range_constraint, value_size_constraint) ... |
{
"cells": [
{
"cell_type": "code",
"execution_count": 108,
"id": "25569a41",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import csv \n",
"from statistics import mean"
]
},
{
"cell_type": "code",
"execution_count": 109,
"id": "2cbb873b",
"metadata": {},... | {'cells': [{'cell_type': 'code', 'execution_count': 108, 'id': '25569a41', 'metadata': {}, 'outputs': [], 'source': ['import os\n', 'import csv \n', 'from statistics import mean']}, {'cell_type': 'code', 'execution_count': 109, 'id': '2cbb873b', 'metadata': {}, 'outputs': [{'data': {'text/plain': ["'Resources/budget_da... |
#
# PySNMP MIB module CISCO-QLLC01-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-QLLC01-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:53:38 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, constraints_intersection, single_value_constraint, value_size_constraint) ... |
# Thrown by WikiData classes
class AppBaseException(Exception):
def __init__(self, message="", tag=None):
Exception.__init__(self, message)
self.tag = tag
def getTag(self):
return self.tag
class WikiDataException(AppBaseException): pass
class WikiWordNotFoundException(WikiD... | class Appbaseexception(Exception):
def __init__(self, message='', tag=None):
Exception.__init__(self, message)
self.tag = tag
def get_tag(self):
return self.tag
class Wikidataexception(AppBaseException):
pass
class Wikiwordnotfoundexception(WikiDataException):
pass
class Wik... |
def capitalize(string):
new = ''
for i in range(0,len(string)):
if i == 0:
new += string[i].upper()
elif string[i - 1] == ' ':
new += string[i].upper()
else :
new += string[i]
return new | def capitalize(string):
new = ''
for i in range(0, len(string)):
if i == 0:
new += string[i].upper()
elif string[i - 1] == ' ':
new += string[i].upper()
else:
new += string[i]
return new |
numbers = (input("").split())
a=int(numbers[0])
b=int(numbers[1])
if a == b:
print(0)
else:
print(1) | numbers = input('').split()
a = int(numbers[0])
b = int(numbers[1])
if a == b:
print(0)
else:
print(1) |
@bot.command()
async def meme(ctx):
msg = await ctx.send("<a:loading:900379618924716052> Processing")
r = requests.get('https://meme-api.herokuapp.com/gimme')
x = r.text
y = json.loads(x)
title = y["title"]
url = y["url"]
author = y["author"]
embed = discord.Embed(title=f"{title}", color... | @bot.command()
async def meme(ctx):
msg = await ctx.send('<a:loading:900379618924716052> Processing')
r = requests.get('https://meme-api.herokuapp.com/gimme')
x = r.text
y = json.loads(x)
title = y['title']
url = y['url']
author = y['author']
embed = discord.Embed(title=f'{title}', color... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.