content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# -*- coding: utf-8 -*-
#~ from __future__ import (unicode_literals, print_function, division, absolute_import)
class BaseDataSource:
def __init__(self):
pass
@property
def nb_channel(self):
raise(NotImplementedError)
def get_channel_name(self, chan=0):
raise(NotImplementedE... | class Basedatasource:
def __init__(self):
pass
@property
def nb_channel(self):
raise NotImplementedError
def get_channel_name(self, chan=0):
raise NotImplementedError
@property
def t_start(self):
raise NotImplementedError
@property
def t_stop(self):
... |
#17/02/21
#What does this code do?
# This code is designed to make a count down, based off a input value.
n = int(input('Time to launch: '))
print('Counting down ...')
while n > 0:
print(n, '...')
n = n - 1
print('Lift Off!')
#What is happening here?
# The first line of our code takes an integer inpu... | n = int(input('Time to launch: '))
print('Counting down ...')
while n > 0:
print(n, '...')
n = n - 1
print('Lift Off!') |
'''
Description:
Given two strings s and t which consist of only lowercase letters.
String t is generated by random shuffling string s and then add one more letter at a random position.
Find the letter that was added in t.
Example:
Input:
s = "abcd"
t = "abcde"
Output:
e
Explanation:
'e' is the letter that was ... | """
Description:
Given two strings s and t which consist of only lowercase letters.
String t is generated by random shuffling string s and then add one more letter at a random position.
Find the letter that was added in t.
Example:
Input:
s = "abcd"
t = "abcde"
Output:
e
Explanation:
'e' is the letter that was ... |
class uniModel:
def __init__(self):
self.name = ''
self.type = ''
self.city = ''
self.rank = 0
self.uniar_score = 0
self.points = 0
self.article_count = 0
self.project_count = 0
self.book_count = 0
self.studied_abroad = 0
self.s... | class Unimodel:
def __init__(self):
self.name = ''
self.type = ''
self.city = ''
self.rank = 0
self.uniar_score = 0
self.points = 0
self.article_count = 0
self.project_count = 0
self.book_count = 0
self.studied_abroad = 0
self.... |
class Event:
def __init__(self, bot, data):
self.bot = bot
self.data = data
def post_message(self, text):
channel = self.data['channel']
return self.bot.post_message(text, channel)
def add_reaction(self, emoji):
channel = self.data['channel']
timestamp = sel... | class Event:
def __init__(self, bot, data):
self.bot = bot
self.data = data
def post_message(self, text):
channel = self.data['channel']
return self.bot.post_message(text, channel)
def add_reaction(self, emoji):
channel = self.data['channel']
timestamp = se... |
'''
Given a list of intervals, merge all the overlapping intervals to produce a
list that has only mutually exclusive intervals.
Example 1:
Intervals: [[1,4], [2,5], [7,9]]
Output: [[1,5], [7,9]]
Explanation: Since the first two intervals [1,4] and [2,5] overlap, we merged
them into one [1,5].
Example 2:
Intervals:... | """
Given a list of intervals, merge all the overlapping intervals to produce a
list that has only mutually exclusive intervals.
Example 1:
Intervals: [[1,4], [2,5], [7,9]]
Output: [[1,5], [7,9]]
Explanation: Since the first two intervals [1,4] and [2,5] overlap, we merged
them into one [1,5].
Example 2:
Intervals:... |
CPU_TEMPERATURE = 'cpu_temperature'
WEATHER_TEMPERATURE = 'weather_temperature'
WEATHER_HUMIDITY = 'weather_humidity'
RAM_USAGE = 'ram_usage'
TASK_QUEUE_DELAY = 'task_queue_delay'
USER_IS_CONNECTED_TO_ROUTER = 'user_is_connected_to_router'
AUTO_SECURITY_IS_ENABLED = 'auto_security_is_enabled'
USE_CAMERA = 'use_camera'... | cpu_temperature = 'cpu_temperature'
weather_temperature = 'weather_temperature'
weather_humidity = 'weather_humidity'
ram_usage = 'ram_usage'
task_queue_delay = 'task_queue_delay'
user_is_connected_to_router = 'user_is_connected_to_router'
auto_security_is_enabled = 'auto_security_is_enabled'
use_camera = 'use_camera'
... |
# game options/settings
TITLE = 'BLOCK RUN'
# initial game window and game speed attributes
WIDTH = 800
HEIGHT = 400
FPS = 60
FONT_NAME = 'comicsans'
# initialize colors
WHITE = (255,255,255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
L_GRAY = (125, 125, 125)
CLOUD_GREY = (240, 240, 24... | title = 'BLOCK RUN'
width = 800
height = 400
fps = 60
font_name = 'comicsans'
white = (255, 255, 255)
black = (0, 0, 0)
red = (255, 0, 0)
green = (0, 255, 0)
blue = (0, 0, 255)
l_gray = (125, 125, 125)
cloud_grey = (240, 240, 240)
gravity = 0.8
antigravity = -0.3
player_jump = -13
obs_y_pos = HEIGHT - 100
obs_width = 2... |
name0_0_0_0_1_3_0 = None
name0_0_0_0_1_3_1 = None
name0_0_0_0_1_3_2 = None
name0_0_0_0_1_3_3 = None
name0_0_0_0_1_3_4 = None | name0_0_0_0_1_3_0 = None
name0_0_0_0_1_3_1 = None
name0_0_0_0_1_3_2 = None
name0_0_0_0_1_3_3 = None
name0_0_0_0_1_3_4 = None |
# -*- coding: utf-8 -*-
explorer = None
def register_api_explorer(expl):
global explorer
explorer = expl
# mark methods to be exposed by replacing them by
# an instance of APIExposedMethod class.
# (we cannot rename these attributes here, their 'name'
# belongs to the class. That's why we need
# the other dec... | explorer = None
def register_api_explorer(expl):
global explorer
explorer = expl
class Apiexposedmethod(object):
def __init__(self, func):
self.func = func
def api_expose_method(func):
return api_exposed_method(func)
class Apidecoratedinit(object):
def __init__(self, attrs, init_func):... |
MODELS = ["VGG-Face", "Facenet", "OpenFace", "DeepFace", "DeepID", "ArcFace", "Dlib"]
METRICS = ["cosine", "euclidean"]
CONFIG = {
# Guards
"face_detection": {"enabled": True},
"info_validation": {"enabled": True, "use_gpu": False, "lang_list": ["en"]},
# Core
"facial_similarity_detection": {
... | models = ['VGG-Face', 'Facenet', 'OpenFace', 'DeepFace', 'DeepID', 'ArcFace', 'Dlib']
metrics = ['cosine', 'euclidean']
config = {'face_detection': {'enabled': True}, 'info_validation': {'enabled': True, 'use_gpu': False, 'lang_list': ['en']}, 'facial_similarity_detection': {'enabled': True, 'tolerance': 0.5, 'model': ... |
'''
Program Description: Count the number of vowels in a string
'''
def count_vowels(string):
amount = 0
for i in range(len(string)):
if string[i] in 'AEIOUaeiou':
amount += 1
return amount
string = input("Enter string\t\t:\t")
print("\nNumber of Vowels\t:\t" , ... | """
Program Description: Count the number of vowels in a string
"""
def count_vowels(string):
amount = 0
for i in range(len(string)):
if string[i] in 'AEIOUaeiou':
amount += 1
return amount
string = input('Enter string\t\t:\t')
print('\nNumber of Vowels\t:\t', count_vowels(string)) |
# See https://devblogs.microsoft.com/cosmosdb/spark-3-connector-databricks/
# Each of the following "COMMAND ----------" is a Notebook cell.
# Chris Joakim, Microsoft, June 2021
# Databricks notebook source
# Read the Databricks built-in dataset as a PySpark DataFrame
df = spark.read.format('csv').options(header='tru... | df = spark.read.format('csv').options(header='true').load('dbfs:/databricks-datasets/COVID/coronavirusdataset/SeoulFloating.csv')
display(df.printSchema())
print((df.count(), len(df.columns)))
display(df.limit(20))
cosmos_endpoint = 'https://cjoakimcosmossql.documents.azure.com:443/'
cosmos_master_key = '...your key...... |
# coding: utf-8
def make_averager():
count = 0
total = 0
def averager(new_value):
nonlocal count, total
count += 1
total += new_value
return total/count
return averager
| def make_averager():
count = 0
total = 0
def averager(new_value):
nonlocal count, total
count += 1
total += new_value
return total / count
return averager |
{
'targets': [
{
'target_name': 'taocrypt',
'type': 'static_library',
'standalone_static_library': 1,
'includes': [ '../../../config/config.gypi' ],
'sources': [
'src/aes.cpp',
'src/aestables.cpp',
'src/algebra.cpp',
'src/arc4.cpp',
'src/asn.cp... | {'targets': [{'target_name': 'taocrypt', 'type': 'static_library', 'standalone_static_library': 1, 'includes': ['../../../config/config.gypi'], 'sources': ['src/aes.cpp', 'src/aestables.cpp', 'src/algebra.cpp', 'src/arc4.cpp', 'src/asn.cpp', 'src/bftables.cpp', 'src/blowfish.cpp', 'src/coding.cpp', 'src/des.cpp', 'src/... |
class Blog(object):
def __init__(self):
pass
def posts_length(self):
return len(self.posts())
def posts(self):
return []
| class Blog(object):
def __init__(self):
pass
def posts_length(self):
return len(self.posts())
def posts(self):
return [] |
#
# PySNMP MIB module BW-BroadworksResourceAccess (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BW-BroadworksResourceAccess
# Produced by pysmi-0.3.4 at Wed May 1 11:42:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python versio... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint, constraints_union) ... |
# 200. Number of Islands
'''
Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.
Example 1:
Input: grid = [
... | """
Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.
Example 1:
Input: grid = [
["1","1","1","1","0"],
... |
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
self.last_node = None
def append(self, data):
if self.last_node is None:
self.head = Node(data)
self.last_node = ... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
self.last_node = None
def append(self, data):
if self.last_node is None:
self.head = node(data)
self.last_node = ... |
NM_HOST = '127.0.0.1'
NM_PORT = '8080'
NM_URL = 'http://{0}:{1}/'.format(NM_HOST, NM_PORT)
Kafka_HOST = '10.0.0.216'
Kafka_PORT = '8082'
Kafka_URL = 'http://{0}:{1}/'.format(Kafka_HOST, Kafka_PORT)
| nm_host = '127.0.0.1'
nm_port = '8080'
nm_url = 'http://{0}:{1}/'.format(NM_HOST, NM_PORT)
kafka_host = '10.0.0.216'
kafka_port = '8082'
kafka_url = 'http://{0}:{1}/'.format(Kafka_HOST, Kafka_PORT) |
# --------------
def read_file(path):
file=open(path,'r')
sentence=file.readlines()[0]
file.close()
return sentence
sample_message=read_file(file_path)
print(sample_message)
message_1=read_file(file_path_1)
message_2=read_file(file_path_2)
#Function to fus... | def read_file(path):
file = open(path, 'r')
sentence = file.readlines()[0]
file.close()
return sentence
sample_message = read_file(file_path)
print(sample_message)
message_1 = read_file(file_path_1)
message_2 = read_file(file_path_2)
def fuse_msg(message_a, message_b):
quotient = int(message_b) // ... |
modules_dict = {}
__ver__ = '0.1'
__all__ = ['add_module']
def add_module (name, ver):
print (f': {name}.py \n:: {ver}')
modules_dict [name] = ver
add_module (__name__, __ver__)
| modules_dict = {}
__ver__ = '0.1'
__all__ = ['add_module']
def add_module(name, ver):
print(f': {name}.py \n:: {ver}')
modules_dict[name] = ver
add_module(__name__, __ver__) |
class Stack:
def __init__(self,contents = []):
self._contents = contents
self._min = None
self._max = 10
def get_contents(self):
return self._contents
def push(self, p):
self._contents.append(p)
if self._min == None:
self._min = p
else:
if self._min > p:
self._min = p
def pop(self):
... | class Stack:
def __init__(self, contents=[]):
self._contents = contents
self._min = None
self._max = 10
def get_contents(self):
return self._contents
def push(self, p):
self._contents.append(p)
if self._min == None:
self._min = p
elif se... |
# Write your solution here
def search_by_name(filename: str, word: str):
recipe_list = []
formated_recipe = []
found_recipes = []
with open(filename) as new_file:
for line in new_file:
line = line.replace("\n", "")
recipe_list.append(line)
while True:
... | def search_by_name(filename: str, word: str):
recipe_list = []
formated_recipe = []
found_recipes = []
with open(filename) as new_file:
for line in new_file:
line = line.replace('\n', '')
recipe_list.append(line)
while True:
if '' in recipe_list:
... |
class Base:
def __init__(self, data):
self._data = data
def __getattr__(self, key):
if key not in self._data:
raise AttributeError(key)
return self._data[key]
@property
def raw_data(self):
return self._data
| class Base:
def __init__(self, data):
self._data = data
def __getattr__(self, key):
if key not in self._data:
raise attribute_error(key)
return self._data[key]
@property
def raw_data(self):
return self._data |
def prime(n):
if n<4:
return (n==2 or n==3)
if n%2==0 or n%3==0:
return False
for i in range(5,int(n**0.5)+1,6):
if n%i==0 or n%(i+2)==0:
return False
return True
n = int(input())
if prime(n):
print(1)
print(n)
elif prime(n-2):
print(2)
print(2,n-2)
e... | def prime(n):
if n < 4:
return n == 2 or n == 3
if n % 2 == 0 or n % 3 == 0:
return False
for i in range(5, int(n ** 0.5) + 1, 6):
if n % i == 0 or n % (i + 2) == 0:
return False
return True
n = int(input())
if prime(n):
print(1)
print(n)
elif prime(n - 2):
... |
data = (
'Ming ', # 0x00
'Sheng ', # 0x01
'Shi ', # 0x02
'Yun ', # 0x03
'Mian ', # 0x04
'Pan ', # 0x05
'Fang ', # 0x06
'Miao ', # 0x07
'Dan ', # 0x08
'Mei ', # 0x09
'Mao ', # 0x0a
'Kan ', # 0x0b
'Xian ', # 0x0c
'Ou ', # 0x0d
'Shi ', # 0x0e
'Yang ', # 0x0f
'Zheng ', # 0... | data = ('Ming ', 'Sheng ', 'Shi ', 'Yun ', 'Mian ', 'Pan ', 'Fang ', 'Miao ', 'Dan ', 'Mei ', 'Mao ', 'Kan ', 'Xian ', 'Ou ', 'Shi ', 'Yang ', 'Zheng ', 'Yao ', 'Shen ', 'Huo ', 'Da ', 'Zhen ', 'Kuang ', 'Ju ', 'Shen ', 'Chi ', 'Sheng ', 'Mei ', 'Mo ', 'Zhu ', 'Zhen ', 'Zhen ', 'Mian ', 'Di ', 'Yuan ', 'Die ', 'Yi ', '... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def getDecimalValue(self, head: ListNode) -> int:
def build_dec( node ):
if not node:
retu... | class Solution:
def get_decimal_value(self, head: ListNode) -> int:
def build_dec(node):
if not node:
return ''
return str(node.val) + build_dec(node.next)
dec = build_dec(head)
return int(dec, 2)
class Solutionii:
def get_decimal_value(self, h... |
# Special responses adapted from https://github.com/nginx/nginx/blob/release-1.15.8/src/http/ngx_http_special_response.c#L132
special_responses_format1 = {
301: "301 Moved Permanently",
302: "302 Found",
303: "303 See Other",
307: "307 Temporary Redirect",
308: "308 Permanent Redirect",
400: "4... | special_responses_format1 = {301: '301 Moved Permanently', 302: '302 Found', 303: '303 See Other', 307: '307 Temporary Redirect', 308: '308 Permanent Redirect', 400: '400 Bad Request', 401: '401 Authorization Required', 402: '402 Payment Required', 403: '403 Forbidden', 404: '404 Not Found', 405: '405 Not Allowed', 406... |
# 94. Binary Tree Inorder Traversal
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def inorderTraversal(self, root: TreeNode) -> List[int]:
result = []
... | class Treenode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def inorder_traversal(self, root: TreeNode) -> List[int]:
result = []
def _inorder_recurr(node, result):
if node:
... |
class LRUCache:
def __init__(self, capacity: int):
self.dataDict = {}
self.dataList = []
self.capacity = capacity
def get(self, key: int) -> int:
if key in self.dataList:
index = self.dataList.index(key)
if index != len(self.dataList) - 1:
... | class Lrucache:
def __init__(self, capacity: int):
self.dataDict = {}
self.dataList = []
self.capacity = capacity
def get(self, key: int) -> int:
if key in self.dataList:
index = self.dataList.index(key)
if index != len(self.dataList) - 1:
... |
a=[]
while True:
b=input('Enter Number(Use String To Break):')
if b.isalpha():
break
else:
a.append(int(b))
while len(a)>0:
b=a[0]
c=0
while b in a:
a.remove(b)
c+=1
print ("Number:",b,"\nFreq:",c)
| a = []
while True:
b = input('Enter Number(Use String To Break):')
if b.isalpha():
break
else:
a.append(int(b))
while len(a) > 0:
b = a[0]
c = 0
while b in a:
a.remove(b)
c += 1
print('Number:', b, '\nFreq:', c) |
cad = dict()
lista = list()
soma = media = 0
while True:
cad.clear()
cad['nome'] = str(input('Nome: ')).title()
while True:
cad['sexo'] = str(input('Sexo [M/F]: ')).upper()[0]
if cad['sexo'] in 'MF':
break
print('ERRO digite apenas M ou F.')
cad['idade'] = int(input('... | cad = dict()
lista = list()
soma = media = 0
while True:
cad.clear()
cad['nome'] = str(input('Nome: ')).title()
while True:
cad['sexo'] = str(input('Sexo [M/F]: ')).upper()[0]
if cad['sexo'] in 'MF':
break
print('ERRO digite apenas M ou F.')
cad['idade'] = int(input('... |
n = int(input())
for i in range(n):
x = int(input())
print( (x+1) // 2 )
| n = int(input())
for i in range(n):
x = int(input())
print((x + 1) // 2) |
__author__ = 'chinarulezzz'
__email__ = 'alexandr.savca89@gmail.com'
__license__ = 'MIT'
__version__ = '1.2.2'
| __author__ = 'chinarulezzz'
__email__ = 'alexandr.savca89@gmail.com'
__license__ = 'MIT'
__version__ = '1.2.2' |
# Given an array of integers, find two numbers such that they add up to a
# specific target number.
#
# The function twoSum should return indices of the two numbers such that they add
# up to the target, where index1 must be less than index2. Please note that your
# returned answers (both index1 and index2) are not zer... | class Solution:
def two_sum(self, num, target):
self.num_ = num
self.target_ = target
diff_dict = self.generateDeltaDict()
for (i, val) in enumerate(self.num_):
if val in diffDict and diffDict[val] is not i:
i = self.toOneBasedIndex(i)
j =... |
# 3.1 What is a control structure?
# ANSWER:
# A control structure is a logical design that controls the order in which a set
# of statements execute.
# 3.2 What is a decision structure?
# ANSWER:
# A decision structure allows a program to have more than one path of execution.
# 3.3 What is a single alternative decis... | y = 10
if y == 20:
x = 0
sales = 250
if sales >= 10000:
commission_rate = 0.2 |
a = int(input())
b = int(input())
print(f"The value of a is {a}")
print(f"The value of b is {b}")
a, b = b, a
print("After Swapping...")
print(f"The value of a is {a}")
print(f"The value of b is {b}") | a = int(input())
b = int(input())
print(f'The value of a is {a}')
print(f'The value of b is {b}')
(a, b) = (b, a)
print('After Swapping...')
print(f'The value of a is {a}')
print(f'The value of b is {b}') |
# empresa = 'Google'
# print(empresa[0])
# print(empresa[:3])
# print(empresa[3:])
# print(empresa[1:3])
print("\"I'm groot\", said Groot")
| print('"I\'m groot", said Groot') |
###
# Copyright (c) 2019-present, IBM Research
# Licensed under The MIT License [see LICENSE for details]
###
EXISTS_CONNECTOR = "exists"
FORALL_CONNECTOR = "forall"
NOT_CONNECTOR = "not"
CONJUNCTION_CONNECTOR = 'conjunction'
DISJUNCTION_CONNECTOR = 'disjunction'
NEGATION_CONNECTOR = 'not'
SUBCONCEPTOF_CONNECTOR = 'su... | exists_connector = 'exists'
forall_connector = 'forall'
not_connector = 'not'
conjunction_connector = 'conjunction'
disjunction_connector = 'disjunction'
negation_connector = 'not'
subconceptof_connector = 'subConceptOf'
eqconcept_connector = 'eqConceptTo'
instanceof_connector = 'http://www.w3.org/1999/02/22-rdf-syntax... |
my_dict = {}
data = input().split(' -> ')
while data[0] != 'End':
company = data[0]
user_id = data[1]
if company not in my_dict:
my_dict[company] = []
if user_id not in my_dict[company]:
my_dict[company].append(user_id)
else:
if user_id not in my_dict[company]:
... | my_dict = {}
data = input().split(' -> ')
while data[0] != 'End':
company = data[0]
user_id = data[1]
if company not in my_dict:
my_dict[company] = []
if user_id not in my_dict[company]:
my_dict[company].append(user_id)
elif user_id not in my_dict[company]:
my_dict[co... |
# Compute the linear regressions
slope_1975, intercept_1975 = np.polyfit(bl_1975, bd_1975, 1)
slope_2012, intercept_2012 = np.polyfit(bl_2012, bd_2012, 1)
# Perform pairs bootstrap for the linear regressions
bs_slope_reps_1975, bs_intercept_reps_1975 = \
draw_bs_pairs_linreg(bl_1975, bd_1975, 1000)
bs_slope_re... | (slope_1975, intercept_1975) = np.polyfit(bl_1975, bd_1975, 1)
(slope_2012, intercept_2012) = np.polyfit(bl_2012, bd_2012, 1)
(bs_slope_reps_1975, bs_intercept_reps_1975) = draw_bs_pairs_linreg(bl_1975, bd_1975, 1000)
(bs_slope_reps_2012, bs_intercept_reps_2012) = draw_bs_pairs_linreg(bl_2012, bd_2012, 1000)
slope_conf... |
#!/usr/bin/env python3
# Welcome message and get user name
print("Hello and welcome to the Grade Point Average Calculator App")
name = input("What is your name: ").title().strip()
grade_num = int(input("How many grades do you like to enter: "))
# Get grades from user
grades = []
for i in range(grade_num):
grades... | print('Hello and welcome to the Grade Point Average Calculator App')
name = input('What is your name: ').title().strip()
grade_num = int(input('How many grades do you like to enter: '))
grades = []
for i in range(grade_num):
grades.append(int(input('Enter grade: ')))
grades.sort(reverse=True)
print('\nGrades Highes... |
vowels = ["a", "A", "e", "E", "i", "I", "o", "O", "u", "U"]
def remove_vowels(input):
for x in input:
for v in vowels:
if x == v:
input = input.replace(v,"")
print(input)
remove_vowels("banana") | vowels = ['a', 'A', 'e', 'E', 'i', 'I', 'o', 'O', 'u', 'U']
def remove_vowels(input):
for x in input:
for v in vowels:
if x == v:
input = input.replace(v, '')
print(input)
remove_vowels('banana') |
# Densely Packed BCD Calculator
def main():
# Input packed BCD as a string separated by a space
packedBcd = input("Enter the packed BCD, separating each grouping with a space: ")
digitBcd = packedBcd.split(' ')
# Get the msb of each
msb = [digbcd[0] for digbcd in digitBcd]
msb = "".join(msb)
... | def main():
packed_bcd = input('Enter the packed BCD, separating each grouping with a space: ')
digit_bcd = packedBcd.split(' ')
msb = [digbcd[0] for digbcd in digitBcd]
msb = ''.join(msb)
lookup_table = {'000': 'bcdfgh0jkm', '001': 'bcdfgh100m', '010': 'bcdjkh101m', '011': 'bcd10h111m', '100': 'jkd... |
# https://www.acmicpc.net/problem/1167
class Node:
def __init__(self, nxt, cost):
self.nxt = nxt
self.cost = cost
def dfs(cur, find):
for node in tree[cur]:
if find != 0:
return find
if visited[node.nxt]:
continue
visited[node.nxt] = True
... | class Node:
def __init__(self, nxt, cost):
self.nxt = nxt
self.cost = cost
def dfs(cur, find):
for node in tree[cur]:
if find != 0:
return find
if visited[node.nxt]:
continue
visited[node.nxt] = True
find = dfs(node.nxt, find)
if find... |
__author__ = "Prikly Grayp"
__license__ = "MIT"
__version__ = "1.0.0"
__email__ = "priklygrayp@gmail.com"
__status__ = "Development"
# Download innosetup
www.jrsoftware.org/isinfo.php
# Open innosetup
#Create a new script file using the script wizard.
| __author__ = 'Prikly Grayp'
__license__ = 'MIT'
__version__ = '1.0.0'
__email__ = 'priklygrayp@gmail.com'
__status__ = 'Development'
www.jrsoftware.org / isinfo.php |
references = [
"chemistry/H",
"chemistry/He",
"chemistry/Li",
"chemistry/Be",
]
titled_references = {
"Element 1": "chemistry/H",
"Element 2": "chemistry/He",
"Element 3": "chemistry/Li",
"Element 4": "chemistry/Be",
}
| references = ['chemistry/H', 'chemistry/He', 'chemistry/Li', 'chemistry/Be']
titled_references = {'Element 1': 'chemistry/H', 'Element 2': 'chemistry/He', 'Element 3': 'chemistry/Li', 'Element 4': 'chemistry/Be'} |
# # This is a comment
# this code gets the list of all the presidents from a txt file, and then puts them in an array
# it then displays some information, and requests that the user add there name to list of presidents
file = open("presidents.txt", "r")
presidents = []
for line in file:
line = line.strip()
pr... | file = open('presidents.txt', 'r')
presidents = []
for line in file:
line = line.strip()
presidents.append(line)
file.close()
print('There were ' + str(len(presidents)) + ' of the USA. \n and they are: ')
print(presidents)
print('Add yourself to the list of presidents of the united states')
name = input('What i... |
class Employee:
employee_count = 0
def __init__(self, name, salary, age):
self.name = name
self.salary = salary
self.age = age
Employee.employee_count += 1
def display_count(self):
print("We have {} number of employees".format(Employee.employee_count))
def disp... | class Employee:
employee_count = 0
def __init__(self, name, salary, age):
self.name = name
self.salary = salary
self.age = age
Employee.employee_count += 1
def display_count(self):
print('We have {} number of employees'.format(Employee.employee_count))
def disp... |
# Programacion orientada a objetos (POO o OOP)
# Definir una clase (molde para crear mas objetos de ese tipo)
# (Coche) con caracteristicas similares
class Coche:
# Atributos o propiedades (variables)
# caracteristicas del coche
color = "Rojo"
marca = "Ferrari"
modelo = "Aventador"
velocidad =... | class Coche:
color = 'Rojo'
marca = 'Ferrari'
modelo = 'Aventador'
velocidad = 300
caballaje = 500
plazas = 2
variable_publica = 'Hola, soy un atributo publico'
__variable_privada = 'Hola, soy un atributo privado'
def get_variable_privada(self):
return self.__variable_privad... |
def sort(l):
for j in range(0,len(l)-1):
minimum = j
for i in range(j, len(l)):
if(l[i]<l[minimum]):
minimum = i
l[j], l[minimum] = l[minimum], l[j]
# l.remove(minimum)
# l = l[:j] + [minimum] + l[j:]
return l
print(sor... | def sort(l):
for j in range(0, len(l) - 1):
minimum = j
for i in range(j, len(l)):
if l[i] < l[minimum]:
minimum = i
(l[j], l[minimum]) = (l[minimum], l[j])
return l
print(sort([1, 4, 3, 6, 5])) |
n = int(input())
dp = [1] * n
a, b, c = 0, 0, 0
for i in range(1, n):
n2, n3, n5 = dp[a] * 2, dp[b] * 3, dp[c] * 5
dp[i] = min(n2, n3, n5)
if dp[i] == n2:
a += 1
if dp[i] == n3:
b += 1
if dp[i] == n5:
c += 1
print(dp[-1])
| n = int(input())
dp = [1] * n
(a, b, c) = (0, 0, 0)
for i in range(1, n):
(n2, n3, n5) = (dp[a] * 2, dp[b] * 3, dp[c] * 5)
dp[i] = min(n2, n3, n5)
if dp[i] == n2:
a += 1
if dp[i] == n3:
b += 1
if dp[i] == n5:
c += 1
print(dp[-1]) |
dados = [{"Nome": "Fabio", "Idade": 26, "Wats": 995456},
{"Nome": "Pedro", "Idade": 34, "Wats": 596859},
{"Nome": "Luiz", "Idade": 65, "Wats": 657444},
{"Nome": "Marcos", "Idade": 45, "Wats": 666675},
{"Nome": "Eneas", "Idade": 35, "Wats": 345677}]
opc = 7
def cab(n=10):
print(... | dados = [{'Nome': 'Fabio', 'Idade': 26, 'Wats': 995456}, {'Nome': 'Pedro', 'Idade': 34, 'Wats': 596859}, {'Nome': 'Luiz', 'Idade': 65, 'Wats': 657444}, {'Nome': 'Marcos', 'Idade': 45, 'Wats': 666675}, {'Nome': 'Eneas', 'Idade': 35, 'Wats': 345677}]
opc = 7
def cab(n=10):
print()
print('#' * n)
def opcoes(opc)... |
# Python - 3.6.0
test.describe('Example Tests')
tests = [
('1', 1),
('123', 123),
('this is number: 7', 7),
('$100 000 000', 100000000),
('hell5o wor6ld', 56),
('one1 two2 three3 four4 five5', 12345)
]
for inp, exp in tests:
test.assert_equals(get_number_from_string(inp), exp)
| test.describe('Example Tests')
tests = [('1', 1), ('123', 123), ('this is number: 7', 7), ('$100 000 000', 100000000), ('hell5o wor6ld', 56), ('one1 two2 three3 four4 five5', 12345)]
for (inp, exp) in tests:
test.assert_equals(get_number_from_string(inp), exp) |
# -*- python -*-
# Copyright 2018-2022 Josh Pieper, jjp@pobox.com.
#
# 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 a... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def _impl(repository_ctx):
fwver = '1.20220120'
repository_ctx.download_and_extract(url=['https://github.com/raspberrypi/firmware/archive/{}.tar.gz'.format(FWVER)], sha256='67c49b6f2fbf4ee612536b3fc24e44ab3fa9584c78224865699f1cbc1b8eea3c', st... |
include("common.py")
# TODO: is this the right trace?
def streckerDegradationGen():
def attach_2_H_C(r, root, offset, withCarbonylConstraint=False):
r.context.extend([
"# 2, H or C on %d" % root,
])
for s1, s2 in [("H", "H"), ("H", "C"), ("C", "C")]:
rCopy = r.clone()
rCopy.name += ", " + s1 + s2
r... | include('common.py')
def strecker_degradation_gen():
def attach_2_h_c(r, root, offset, withCarbonylConstraint=False):
r.context.extend(['# 2, H or C on %d' % root])
for (s1, s2) in [('H', 'H'), ('H', 'C'), ('C', 'C')]:
r_copy = r.clone()
rCopy.name += ', ' + s1 + s2
... |
def describe_city(name,country):
print(name + ' is in ' + country)
describe_city('wo','ni')
describe_city('ni','ta')
describe_city('ta','wo') | def describe_city(name, country):
print(name + ' is in ' + country)
describe_city('wo', 'ni')
describe_city('ni', 'ta')
describe_city('ta', 'wo') |
def test_urls_empty_client(empty_client):
response = empty_client.get("/api/urls.json")
assert response.status_code == 200
assert response.json == {}
def test_index_with_data(test_data_client, test_data):
response = test_data_client.get("/api/urls.json")
assert response.status_code == 200
as... | def test_urls_empty_client(empty_client):
response = empty_client.get('/api/urls.json')
assert response.status_code == 200
assert response.json == {}
def test_index_with_data(test_data_client, test_data):
response = test_data_client.get('/api/urls.json')
assert response.status_code == 200
asser... |
even = set()
odd = set()
for i in range(1, int(input()) + 1):
name_sum = sum([ord(x) for x in input()]) // i
if name_sum % 2 == 0:
even.add(name_sum)
else:
odd.add(name_sum)
if sum(even) == sum(odd):
arg = list(map(str, even.union(odd)))
print(", ".join(arg))
elif sum(even) < sum(... | even = set()
odd = set()
for i in range(1, int(input()) + 1):
name_sum = sum([ord(x) for x in input()]) // i
if name_sum % 2 == 0:
even.add(name_sum)
else:
odd.add(name_sum)
if sum(even) == sum(odd):
arg = list(map(str, even.union(odd)))
print(', '.join(arg))
elif sum(even) < sum(odd... |
# -*- coding: utf-8 -*-
TEXT_FORMATS = (
("html", "html"),
("markdown", "markdown"),
("plaintext", "plaintext")
)
| text_formats = (('html', 'html'), ('markdown', 'markdown'), ('plaintext', 'plaintext')) |
def write_line(fname: str, line: str, target_line: int) -> None:
def _clear_file() -> None:
file.truncate(0)
file.seek(0)
with open(fname, 'r+') as file:
lines = file.readlines()
lines[target_line] = line
_clear_file()
file.writelines(lines)
def main():
wit... | def write_line(fname: str, line: str, target_line: int) -> None:
def _clear_file() -> None:
file.truncate(0)
file.seek(0)
with open(fname, 'r+') as file:
lines = file.readlines()
lines[target_line] = line
_clear_file()
file.writelines(lines)
def main():
with... |
class Solution:
def oddCells(self, n: int, m: int, indices: List[List[int]]) -> int:
rows = [0] * n
cols = [0] * m
for r, c in indices:
rows[r] += 1
cols[c] += 1
return sum((rows[r] + cols[c]) % 2 for r in range(n) for c in range(m))
| class Solution:
def odd_cells(self, n: int, m: int, indices: List[List[int]]) -> int:
rows = [0] * n
cols = [0] * m
for (r, c) in indices:
rows[r] += 1
cols[c] += 1
return sum(((rows[r] + cols[c]) % 2 for r in range(n) for c in range(m))) |
SOCKET_OPTIONS = [
"ip_multicast_if",
"ip_multicast_if2",
"ip_multicast_loop",
"ip_tos",
"so_broadcast",
"so_conditional_accept",
"so_keepalive",
"so_dontroute",
"so_linger",
"so_dontlinger",
"so_oobinline",
"so_rcvbuf",
"so_group_priority",
"so_reuseaddr",
"s... | socket_options = ['ip_multicast_if', 'ip_multicast_if2', 'ip_multicast_loop', 'ip_tos', 'so_broadcast', 'so_conditional_accept', 'so_keepalive', 'so_dontroute', 'so_linger', 'so_dontlinger', 'so_oobinline', 'so_rcvbuf', 'so_group_priority', 'so_reuseaddr', 'so_debug', 'so_rcvtimeo', 'so_sndbuf', 'so_sndtimeo', 'so_upda... |
date, name, price = ['December 23, 2015', 'Jack', 1.234]
def drop_first_last(grades):
first, *middle, last = grades
avg = sum(middle) / len(middle)
print(avg)
drop_first_last([1, 2, 3, 4])
| (date, name, price) = ['December 23, 2015', 'Jack', 1.234]
def drop_first_last(grades):
(first, *middle, last) = grades
avg = sum(middle) / len(middle)
print(avg)
drop_first_last([1, 2, 3, 4]) |
# this is just a sample config file.You need to edit this file.You need to get these details from your Twitter app settings.
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
| consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = '' |
# Solution
# O(nlog(n)) time / O(1) space
def heapSort(array):
buildMaxHeap(array)
for endIdx in reversed(range(1, len(array))):
swap(0, endIdx, array)
siftDown(0, endIdx - 1, array)
return array
def buildMaxHeap(array):
firstParentIdx = (len(array) - 1) // 2
for currentIdx in reversed(range(firstP... | def heap_sort(array):
build_max_heap(array)
for end_idx in reversed(range(1, len(array))):
swap(0, endIdx, array)
sift_down(0, endIdx - 1, array)
return array
def build_max_heap(array):
first_parent_idx = (len(array) - 1) // 2
for current_idx in reversed(range(firstParentIdx + 1)):
... |
# elements.py
CARBON_WEIGHT = 12.011
SILICON_SYMBOL = 'Si'
elements = {
"H": {
"name": "Hydrogen",
"weight": 1.008,
"number": 1,
"boiling point": 20.271,
},
"He": {
"name": "Helium",
"weight": 4.003,
"number": 2,
"boiling point": 4.222,
... | carbon_weight = 12.011
silicon_symbol = 'Si'
elements = {'H': {'name': 'Hydrogen', 'weight': 1.008, 'number': 1, 'boiling point': 20.271}, 'He': {'name': 'Helium', 'weight': 4.003, 'number': 2, 'boiling point': 4.222}, 'Li': {'name': 'Lithium', 'weight': 6.94, 'number': 3, 'boiling point': 1603.0}, 'Be': {'name': 'Bery... |
BASE = "http://toptal.com"
BLOG = "/blog"
RESUME = "/resume"
SEARCH_BASE = "https://www.googleapis.com/customsearch/v1?key=AIzaSyCMGfdDaSfjqv5zYoS0mTJnOT3e9MURWkU&cx=003141353161291263905%3Avli4gva3h44&q="
#redis&start=1&num=10"
topics = {
"backend" : "https://www.toptal.com/blog/back-end",
"frontend" : "https... | base = 'http://toptal.com'
blog = '/blog'
resume = '/resume'
search_base = 'https://www.googleapis.com/customsearch/v1?key=AIzaSyCMGfdDaSfjqv5zYoS0mTJnOT3e9MURWkU&cx=003141353161291263905%3Avli4gva3h44&q='
topics = {'backend': 'https://www.toptal.com/blog/back-end', 'frontend': 'https://www.toptal.com/blog/web-front-en... |
#author SANKALP SAXENA
if __name__ == '__main__':
a = []
marks = 0.0
N = int(input())
for _ in range(N):
name = input()
score = float(input())
a.append([name, score])
secondlast = marks
for _ in range(N):
if(a[_][1] > marks):
secondlas... | if __name__ == '__main__':
a = []
marks = 0.0
n = int(input())
for _ in range(N):
name = input()
score = float(input())
a.append([name, score])
secondlast = marks
for _ in range(N):
if a[_][1] > marks:
secondlast = marks
marks = a[_][1]
... |
mod = lambda n,m: n%m
def baseExpansion(n,c,b):
i = len(n)
base10 = sum([pow(c,i-k-1)*n[k] for k in range(i)])
j = int(ceil(log(base10 + 1,b)))
baseExpanded = [mod(base10//pow(b,j-p),b) for p in range(1,j+1)]
return baseExpanded
| mod = lambda n, m: n % m
def base_expansion(n, c, b):
i = len(n)
base10 = sum([pow(c, i - k - 1) * n[k] for k in range(i)])
j = int(ceil(log(base10 + 1, b)))
base_expanded = [mod(base10 // pow(b, j - p), b) for p in range(1, j + 1)]
return baseExpanded |
# CONSTANTS
BORDER_WIDTH = 700
BORDER_HEIGHT = 700
STARTING_POSITION = [(0,0),(-20,0),(-40,0)]
STEP_SIZE = 20
UP = 90
DOWN = 270
RIGHT = 0
LEFT = 180 | border_width = 700
border_height = 700
starting_position = [(0, 0), (-20, 0), (-40, 0)]
step_size = 20
up = 90
down = 270
right = 0
left = 180 |
class RequestStatus(object):
CREATED: int = 0
SUBMITTED: int = 1
IN_PROGRESS: int = 2
DELIVERED: int = 3
PAID: int = 4
| class Requeststatus(object):
created: int = 0
submitted: int = 1
in_progress: int = 2
delivered: int = 3
paid: int = 4 |
def get_config(game):
info = {}
if game == 'hopper-medium-expert-v0':
eta_coef = 50.0
lambda_coef = 1.0
elif game == 'walker2d-medium-expert-v0':
eta_coef = 20.0
lambda_coef = 1.0
elif game == 'hammer-human-v0':
eta_coef = 1.0
lambda_coef = 1.0
... | def get_config(game):
info = {}
if game == 'hopper-medium-expert-v0':
eta_coef = 50.0
lambda_coef = 1.0
elif game == 'walker2d-medium-expert-v0':
eta_coef = 20.0
lambda_coef = 1.0
elif game == 'hammer-human-v0':
eta_coef = 1.0
lambda_coef = 1.0
elif ga... |
fname = input('Enter the file name: ')
try:
fhand = open(fname)
except:
print('File cannot be opened: ', fname)
exit()
count = 0
for line in fhand:
if line.startswith('Subject:'):
count = count + 1
print('There were', count, 'subject lines in', fname) | fname = input('Enter the file name: ')
try:
fhand = open(fname)
except:
print('File cannot be opened: ', fname)
exit()
count = 0
for line in fhand:
if line.startswith('Subject:'):
count = count + 1
print('There were', count, 'subject lines in', fname) |
class MedianFinder:
def __init__(self):
self.maxHeap = []
self.minHeap = []
def addNum(self, num: int) -> None:
if not self.maxHeap or num <= -self.maxHeap[0]:
heapq.heappush(self.maxHeap, -num)
else:
heapq.heappush(self.minHeap, num)
# balance two heaps s.t.
# |maxHeap| >= |mi... | class Medianfinder:
def __init__(self):
self.maxHeap = []
self.minHeap = []
def add_num(self, num: int) -> None:
if not self.maxHeap or num <= -self.maxHeap[0]:
heapq.heappush(self.maxHeap, -num)
else:
heapq.heappush(self.minHeap, num)
if len(sel... |
def linear_evolve(operator, state):
res = [0.0] * len(operator)
for i in range(len(operator)):
for j in range(len(state)):
res[i] += (operator[i][j] * state[j])
return res
| def linear_evolve(operator, state):
res = [0.0] * len(operator)
for i in range(len(operator)):
for j in range(len(state)):
res[i] += operator[i][j] * state[j]
return res |
n = int(input('N='))
lst = []
for i in range(0,n):
s = list(str(i))
if s[-1] == '3':
lst.append(int(''.join(s)))
print(lst)
| n = int(input('N='))
lst = []
for i in range(0, n):
s = list(str(i))
if s[-1] == '3':
lst.append(int(''.join(s)))
print(lst) |
class BaseQueue(object):
def __init__(self):
self.__queue = []
self.__length = 0
def empty(self):
if self.__length == 0:
return True
return False
def size(self):
return self.__length
def first(self):
if not self.empty():
return ... | class Basequeue(object):
def __init__(self):
self.__queue = []
self.__length = 0
def empty(self):
if self.__length == 0:
return True
return False
def size(self):
return self.__length
def first(self):
if not self.empty():
return ... |
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
def dependencies():
#---------------------------------------------------------------------------
# Bazel buil... | load('@bazel_tools//tools/build_defs/repo:git.bzl', 'git_repository')
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe')
def dependencies():
maybe(http_archive, name='com_github_bazelbuild_buildtools', sha256='a5fca3f810588b441a647cf6... |
def selection_sort(a_list):
for i in range(len(a_list)-1):
min_index = i
for j in range(i + 1, len(a_list)):
if a_list[min_index] > a_list[j]:
min_index = j
a_list[i], a_list[min_index] = a_list[min_index], a_list[i]
| def selection_sort(a_list):
for i in range(len(a_list) - 1):
min_index = i
for j in range(i + 1, len(a_list)):
if a_list[min_index] > a_list[j]:
min_index = j
(a_list[i], a_list[min_index]) = (a_list[min_index], a_list[i]) |
class ClockWidget():
def __init__(self):
self.name = "Clock"
self.template = "widget_clock.html"
class PingWidget():
def __init__(self, addrs: list):
self.name = "Ping"
self.template = "widget_ping.html"
self.addrs = addrs
self.targets = self.addrs | class Clockwidget:
def __init__(self):
self.name = 'Clock'
self.template = 'widget_clock.html'
class Pingwidget:
def __init__(self, addrs: list):
self.name = 'Ping'
self.template = 'widget_ping.html'
self.addrs = addrs
self.targets = self.addrs |
def entrada():
numeros = list(map(int, input().split(' ')))
n1 = numeros[0]
n2 = numeros[1]
return n1, n2
def dividindo(n):
for i in range(n):
dividendo, divisor = entrada()
if divisor == 0:
print('divisao impossivel')
else:
divisao = dividendo / div... | def entrada():
numeros = list(map(int, input().split(' ')))
n1 = numeros[0]
n2 = numeros[1]
return (n1, n2)
def dividindo(n):
for i in range(n):
(dividendo, divisor) = entrada()
if divisor == 0:
print('divisao impossivel')
else:
divisao = dividendo / ... |
# "w" - Write. Opens a file for writing, creates the file if it does not exist
# if there is data written, will override and deletes old data
f = open("text.txt", "w")
f.write("Hello world")
f.close() | f = open('text.txt', 'w')
f.write('Hello world')
f.close() |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'depot_tools/bot_update',
'chromium',
'depot_tools/gclient',
'recipe_engine/context',
'recipe_engine/path',
'recipe_engine/properties',
... | deps = ['depot_tools/bot_update', 'chromium', 'depot_tools/gclient', 'recipe_engine/context', 'recipe_engine/path', 'recipe_engine/properties', 'recipe_engine/python', 'recipe_engine/raw_io', 'recipe_engine/step', 'recipe_engine/url', 'v8']
def run_steps(api):
api.gclient.set_config('v8')
api.bot_update.ensure... |
#!/usr/bin/python
def increament():
x= yield
yield x+10
data = increament()
next(data)
#data.send(None)
print(data.send(10))
| def increament():
x = (yield)
yield (x + 10)
data = increament()
next(data)
print(data.send(10)) |
paris = (48.8566, 2.3522)
vincennes = (48.8283, 2.4330)
boulogne = (48.8624, 2.2492)
st_denis = (48.9362, 2.3574)
orleans = (47.9030, 1.9093)
targets_paris = [vincennes, boulogne, st_denis, orleans]
locations_paris = {'source': paris, 'targets': targets_paris}
# This edge case has the following properties
# -- consi... | paris = (48.8566, 2.3522)
vincennes = (48.8283, 2.433)
boulogne = (48.8624, 2.2492)
st_denis = (48.9362, 2.3574)
orleans = (47.903, 1.9093)
targets_paris = [vincennes, boulogne, st_denis, orleans]
locations_paris = {'source': paris, 'targets': targets_paris}
edge_1_0 = (0, 0)
edge_1_1 = (0, 10)
edge_1_2 = (4, 9.88)
edg... |
@ask.intent('AlarmBuddy_SendSound', mapping={'friend_uname' : 'friend_uname', 'sound_id' : 'sound_id'})
def SendSoundIntent(friend_uname, sound_id):
if(friend_uname is None):
speak_output = "Sorry, you must specify a username to send a sound to."
return question(speak_output).reprompt(speak_outp... | @ask.intent('AlarmBuddy_SendSound', mapping={'friend_uname': 'friend_uname', 'sound_id': 'sound_id'})
def send_sound_intent(friend_uname, sound_id):
if friend_uname is None:
speak_output = 'Sorry, you must specify a username to send a sound to.'
return question(speak_output).reprompt(speak_output).s... |
# Section 2 - Programming Exercises Q2
number1 = int(input("Enter first number: "))
number2 = input("Enter second number: ")
number2 = int(number2)
sum = number1 + number2
print(number1, "+", number2, "=", sum)
# bogus lines!
number1 = int(number1)
sum = sum + number1
print("The answer is sum")
| number1 = int(input('Enter first number: '))
number2 = input('Enter second number: ')
number2 = int(number2)
sum = number1 + number2
print(number1, '+', number2, '=', sum)
number1 = int(number1)
sum = sum + number1
print('The answer is sum') |
# Superstar
medal = 1142499
inheritance = 60010217
spell = 60011005
if sm.canHold(medal):
sm.chatScript("You obtained the <Superstar> medal.")
sm.giveSkill(inheritance)
sm.giveSkill(spell)
sm.startQuest(parentID)
sm.completeQuest(parentID)
| medal = 1142499
inheritance = 60010217
spell = 60011005
if sm.canHold(medal):
sm.chatScript('You obtained the <Superstar> medal.')
sm.giveSkill(inheritance)
sm.giveSkill(spell)
sm.startQuest(parentID)
sm.completeQuest(parentID) |
#
# Qutebrowser Config
#
# ==================== General Settings ==================================
c.confirm_quit = ['downloads']
c.content.fullscreen.window = True
c.spellcheck.languages = ["de-DE", "en-GB", "en-US"]
c.tabs.show = 'never'
c.tabs.tabs_are_windows = True
c.url.d... | c.confirm_quit = ['downloads']
c.content.fullscreen.window = True
c.spellcheck.languages = ['de-DE', 'en-GB', 'en-US']
c.tabs.show = 'never'
c.tabs.tabs_are_windows = True
c.url.default_page = 'about:blank'
c.url.start_pages = ['about:blank']
c.zoom.default = 150
c.content.autoplay = False
c.content.mute = True
c.fonts... |
l = list(map(int, input().split()))
cur = 0
for i in range(3):
cur = l[cur]
print(cur) | l = list(map(int, input().split()))
cur = 0
for i in range(3):
cur = l[cur]
print(cur) |
# define a normaliser
def normalizer(dataArray):
if dataArray.max() - dataArray.min() == 0:
return dataArray
return (dataArray - dataArray.min()) / (dataArray.max() - dataArray.min())
# define a standardizer
def standardizer(dataArray):
if dataArray.max() - dataArray.min() == 0:
return data... | def normalizer(dataArray):
if dataArray.max() - dataArray.min() == 0:
return dataArray
return (dataArray - dataArray.min()) / (dataArray.max() - dataArray.min())
def standardizer(dataArray):
if dataArray.max() - dataArray.min() == 0:
return dataArray
return (dataArray - dataArray.mean()... |
class Edge:
__slots__ = ['src', 'dst', 'relation']
def __init__(self, src, dst, relation):
self.src = src
self.dst = dst
self.relation = relation
def state(self):
return [self.src, self.dst, self.relation]
@classmethod
def from_state(cls, state):
return Edg... | class Edge:
__slots__ = ['src', 'dst', 'relation']
def __init__(self, src, dst, relation):
self.src = src
self.dst = dst
self.relation = relation
def state(self):
return [self.src, self.dst, self.relation]
@classmethod
def from_state(cls, state):
return edg... |
# Link to flowcharts:
# https://drive.google.com/file/d/12xTQSyUeeSIWUDkwn3nWW-KHMmj31Rxy/view?usp=sharing
# Count the even and odd digits of the entered natural number.
# For example, if the number 34560 is entered, then he has 3 even numbers (4, 6 and 0) and 2 odd numbers (3 and 5).
print ( " Count the odd and even... | print(' Count the odd and even numbers in a natural number ')
num = int(input(' Enter a positive integer: '))
even = 0
odd = 0
while num > 0:
if num % 2 == 0:
even += 1
else:
odd += 1
num //= 10
print(' Even {} , odd {} '.format(even, odd)) |
greeting = "Hello "
your_name = "Nikhilesh"
print(greeting + your_name)
| greeting = 'Hello '
your_name = 'Nikhilesh'
print(greeting + your_name) |
n = int(input("n: "))
k = int(input("k: "))
while (n < 1 or n > 1000) or (k < 1 or k > 1000):
print("Numbers not in range: between 1 and 1000")
n = int(input("n: "))
k = int(input("k: "))
goat_weights = []
for i in range(n):
a = int(input("a" + str(i + 1) + ": "))
while (a < 1 or a > 100000):
... | n = int(input('n: '))
k = int(input('k: '))
while (n < 1 or n > 1000) or (k < 1 or k > 1000):
print('Numbers not in range: between 1 and 1000')
n = int(input('n: '))
k = int(input('k: '))
goat_weights = []
for i in range(n):
a = int(input('a' + str(i + 1) + ': '))
while a < 1 or a > 100000:
... |
def test_get_products(client_products):
get_response = client_products.get("/products")
assert get_response.json == client_products.expected
def test_get_single_product(client_products):
id = client_products.expected[1]["id"]
get_response = client_products.get("/products/" + str(id))
assert get_response.json["... | def test_get_products(client_products):
get_response = client_products.get('/products')
assert get_response.json == client_products.expected
def test_get_single_product(client_products):
id = client_products.expected[1]['id']
get_response = client_products.get('/products/' + str(id))
assert get_res... |
class ConfigManError(Exception):
pass
class InvalidConfigNameError(ConfigManError):
pass
class IncompatibleTypeError(ConfigManError):
pass
| class Configmanerror(Exception):
pass
class Invalidconfignameerror(ConfigManError):
pass
class Incompatibletypeerror(ConfigManError):
pass |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014-2015 Online SAS and Contributors. All Rights Reserved.
# Edouard Bonlieu <ebonlieu@scaleway.com>
# Julien Castets <jcastets@scaleway.com>
# Manfred Touron <mtouron@scaleway.com>
# ... | series_map = {'Ubuntu Utopic (14.10)': 'utopic', 'Ubuntu Trusty (14.04 LTS)': 'trusty'}
def get_images(client):
images = {}
for i in client.get_images():
if not i.public:
continue
for serie in SERIES_MAP:
if '%s' % serie == i.name:
images[SERIES_MAP[serie... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.