content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# Current version of the bcftbx package
__version__ = '1.11.1'
def get_version():
"""Returns a string with the current version of the bcftbx package (e.g., "0.2.0")
"""
return __version__
| __version__ = '1.11.1'
def get_version():
"""Returns a string with the current version of the bcftbx package (e.g., "0.2.0")
"""
return __version__ |
person='abc'
video_source_number=0
thresholds=[.9,.85,.85,.85,.85,.95,.9]
extra_thresholds=[.85,.85,.85,.85]
#select the image widow and press w,s,a,d keys while running the script and looking in appropriate direction to change threshold
tsrf=True
#if true only image of eye will be processed may increase accuracy
mode=... | person = 'abc'
video_source_number = 0
thresholds = [0.9, 0.85, 0.85, 0.85, 0.85, 0.95, 0.9]
extra_thresholds = [0.85, 0.85, 0.85, 0.85]
tsrf = True
mode = False
print_frame_rate = False
print_additive_average_frame_rate = False
cursor_speed = 3
auto_correct_threshold = False
auto_correct_left_pixel_limit = 0.5
auto_co... |
#
# PySNMP MIB module RBTWS-RF-DETECT-TC (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RBTWS-RF-DETECT-TC
# Produced by pysmi-0.3.4 at Mon Apr 29 20:45:14 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, value_range_constraint, constraints_union, single_value_constraint) ... |
# Collaborators (including web sites where you got help: (enter none if you didn't need help)
# none
# A note on style: Dictionaries can be defined before or after functions.
board = {'1': ' ' , '2': ' ' , '3': ' ' ,'4': ' ' , '5': ' ' , '6': ' ' ,'7': ' ' , '8': ' ' , '9': ' ' }
def gameboard(board):
print(board... | board = {'1': ' ', '2': ' ', '3': ' ', '4': ' ', '5': ' ', '6': ' ', '7': ' ', '8': ' ', '9': ' '}
def gameboard(board):
print(board['1'] + '|' + board['2'] + '|' + board['3'])
print('-+-+-')
print(board['4'] + '|' + board['5'] + '|' + board['6'])
print('-+-+-')
print(board['7'] + '|' + board['8'] ... |
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Financial Analysis\n",
"Total Months:86\n",
"Total Amount:38382578\n",
"-2315.1176470588234\n",
"Feb-2012 1926159... | {'cells': [{'cell_type': 'code', 'execution_count': 4, 'metadata': {}, 'outputs': [{'name': 'stdout', 'output_type': 'stream', 'text': ['Financial Analysis\n', 'Total Months:86\n', 'Total Amount:38382578\n', '-2315.1176470588234\n', 'Feb-2012 1926159\n', 'Sep-2013 -2196167\n']}], 'source': ['#import file\n', 'import os... |
# Puzzle Input
with open('Day13_Input.txt') as puzzle_input:
bus_info = puzzle_input.read().split('\n')
# Get the departure time and the IDs
departure = int(bus_info[0])
bus_id = bus_info[1].split(',')
# Remove the x's
while 'x' in bus_id:
bus_id.remove('x')
# Convert the IDs to integers
bus_id = list(map(in... | with open('Day13_Input.txt') as puzzle_input:
bus_info = puzzle_input.read().split('\n')
departure = int(bus_info[0])
bus_id = bus_info[1].split(',')
while 'x' in bus_id:
bus_id.remove('x')
bus_id = list(map(int, bus_id))
waiting_times = []
for id in bus_id:
waiting_times += [-(departure % ID) + ID]
min_ind... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"PseudoData": "00_pseudodata.ipynb",
"paper_sig": "00_pseudodata.ipynb",
"paper_bkg": "00_pseudodata.ipynb",
"ModelWrapper": "01_model_wrapper.ipynb",
"DataSet": "02_data.i... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'PseudoData': '00_pseudodata.ipynb', 'paper_sig': '00_pseudodata.ipynb', 'paper_bkg': '00_pseudodata.ipynb', 'ModelWrapper': '01_model_wrapper.ipynb', 'DataSet': '02_data.ipynb', 'WeightedDataLoader': '02_data.ipynb', 'DataPair': '02_data.ipynb', 'g... |
def min(x, y):
return x > y and x or y
def gcd(x, y):
res = -1
for i in range(1, min(x, y) + 1):
if x % i == 0 and y % i == 0:
if res < i: res = i
return res
N, M = map(int, input().split())
print(gcd(N, M))
print(gcd(N, M) * (N // gcd(N, M)) * (M // gcd(N, M)))
| def min(x, y):
return x > y and x or y
def gcd(x, y):
res = -1
for i in range(1, min(x, y) + 1):
if x % i == 0 and y % i == 0:
if res < i:
res = i
return res
(n, m) = map(int, input().split())
print(gcd(N, M))
print(gcd(N, M) * (N // gcd(N, M)) * (M // gcd(N, M))) |
# Python - 3.6.0
fruitList = {
1: 'kiwi',
2: 'pear',
3: 'kiwi',
4: 'banana',
5: 'melon',
6: 'banana',
7: 'melon',
8: 'pineapple',
9: 'apple',
10: 'pineapple',
11: 'cucumber',
12: 'pineapple',
13: 'cucumber',
14: 'orange',
15: 'grape',
16: 'orange',
17... | fruit_list = {1: 'kiwi', 2: 'pear', 3: 'kiwi', 4: 'banana', 5: 'melon', 6: 'banana', 7: 'melon', 8: 'pineapple', 9: 'apple', 10: 'pineapple', 11: 'cucumber', 12: 'pineapple', 13: 'cucumber', 14: 'orange', 15: 'grape', 16: 'orange', 17: 'grape', 18: 'apple', 19: 'grape', 20: 'cherry', 21: 'pear', 22: 'cherry', 23: 'pear... |
__all__ = [
'base_controller',
'imaging',
'telephony',
'data_tools',
'security_and_networking',
'geolocation',
'e_commerce',
'www',
] | __all__ = ['base_controller', 'imaging', 'telephony', 'data_tools', 'security_and_networking', 'geolocation', 'e_commerce', 'www'] |
f = open('test16.txt', 'rt')
rows = f.readlines()
for row in rows:
print(row)
f.close()
# while True:
# row = f.readline()
# print(row)
# if not row:
# break
# f.close() | f = open('test16.txt', 'rt')
rows = f.readlines()
for row in rows:
print(row)
f.close() |
flagArray = [0 for i in range(32)]
flag = ""
flagArray[0] = 'd'
flagArray[29] = '9'
flagArray[4] = 'r'
flagArray[2] = '5'
flagArray[23] = 'r'
flagArray[3] = 'c'
flagArray[17] = '4'
flagArray[1] = '3'
flagArray[7] = 'b'
flagArray[10] = '_'
flagArray[5] = '4'
flagArray[9] = '3'
flagArray[11] = 't'
flagArray[15... | flag_array = [0 for i in range(32)]
flag = ''
flagArray[0] = 'd'
flagArray[29] = '9'
flagArray[4] = 'r'
flagArray[2] = '5'
flagArray[23] = 'r'
flagArray[3] = 'c'
flagArray[17] = '4'
flagArray[1] = '3'
flagArray[7] = 'b'
flagArray[10] = '_'
flagArray[5] = '4'
flagArray[9] = '3'
flagArray[11] = 't'
flagArray[15] = 'c'
fl... |
print("Enter a selection from the below menu. Press '0' to exit.")
menu_items = ["Bake a loaf of bread", "Bake a pound cake", "Prepare Roast Chicken", "Make Curry", \
"Put a rack of ribs in the smoker", "Buy dinner out", "Have ice cream", "Sandwiches - again"]
select = None
while True:
for i in range(len(menu... | print("Enter a selection from the below menu. Press '0' to exit.")
menu_items = ['Bake a loaf of bread', 'Bake a pound cake', 'Prepare Roast Chicken', 'Make Curry', 'Put a rack of ribs in the smoker', 'Buy dinner out', 'Have ice cream', 'Sandwiches - again']
select = None
while True:
for i in range(len(menu_items)... |
"""
Write a program to remove the item present at index 4 and
add it to the 2nd position and at the end of the list.
Given:
list1 = [34, 54, 67, 89, 11, 43, 94]
Expected Output:
List After removing element at index 4 [34, 54, 67, 89, 43, 94]
List after Adding element at index 2 [34, 54, 11, 67, 89, 43, 94]
List ... | """
Write a program to remove the item present at index 4 and
add it to the 2nd position and at the end of the list.
Given:
list1 = [34, 54, 67, 89, 11, 43, 94]
Expected Output:
List After removing element at index 4 [34, 54, 67, 89, 43, 94]
List after Adding element at index 2 [34, 54, 11, 67, 89, 43, 94]
List ... |
def primes(n):
out = list()
sieve = [True] * (n+1)
for p in range(2, n+1):
if sieve[p]:
out.append(p)
for i in range(p, n+1, p):
sieve[i] = False
return out
def is_prime(n):
if n <= 1:
return False
if n <= 3:
return True
if n ... | def primes(n):
out = list()
sieve = [True] * (n + 1)
for p in range(2, n + 1):
if sieve[p]:
out.append(p)
for i in range(p, n + 1, p):
sieve[i] = False
return out
def is_prime(n):
if n <= 1:
return False
if n <= 3:
return True
... |
class Solution:
def maxArea(self, height: List[int]) -> int:
area = 0
left_pivot = 0
right_pivot = len(height)-1
while left_pivot != right_pivot:
current_area = abs(right_pivot-left_pivot) * min(height[left_pivot], height[right_pivot])
# ... | class Solution:
def max_area(self, height: List[int]) -> int:
area = 0
left_pivot = 0
right_pivot = len(height) - 1
while left_pivot != right_pivot:
current_area = abs(right_pivot - left_pivot) * min(height[left_pivot], height[right_pivot])
if current_area > ... |
print("------------------")
print("------------------")
print("------------------")
print("------------------")
print("------------------")
num1 = 10
num2 = 20
| print('------------------')
print('------------------')
print('------------------')
print('------------------')
print('------------------')
num1 = 10
num2 = 20 |
#exceptions
def spam(divided_by):
try:
return 42 / divided_by
except:
print('Invalid argument.')
print(spam(2))
print(spam(0))
print(spam(1))
| def spam(divided_by):
try:
return 42 / divided_by
except:
print('Invalid argument.')
print(spam(2))
print(spam(0))
print(spam(1)) |
# Slackbot API Information
slack_bot_token = "xoxb-2650828670406-2670419769553-qxTzP6Sbh9tlqfYIA52wh1bZ"
bot_id = "xoxb-2650828670406-2670419769553-qxTzP6Sbh9tlqfYIA52wh1bZ"
# AIML FIles
directory = "/aiml"
learn_file = "std-startup.xml"
respond = "load aiml b" | slack_bot_token = 'xoxb-2650828670406-2670419769553-qxTzP6Sbh9tlqfYIA52wh1bZ'
bot_id = 'xoxb-2650828670406-2670419769553-qxTzP6Sbh9tlqfYIA52wh1bZ'
directory = '/aiml'
learn_file = 'std-startup.xml'
respond = 'load aiml b' |
#-*- coding: UTF-8 -*-
def log_info(msg):
print ('bn info:'+msg);
return;
def log_error(msg):
print ('bn error:'+msg);
return;
def log_debug(msg):
print ('bn debug:'+msg);
return; | def log_info(msg):
print('bn info:' + msg)
return
def log_error(msg):
print('bn error:' + msg)
return
def log_debug(msg):
print('bn debug:' + msg)
return |
def fighter():
i01.moveHead(160,87)
i01.moveArm("left",31,75,152,10)
i01.moveArm("right",3,94,33,16)
i01.moveHand("left",161,151,133,127,107,83)
i01.moveHand("right",99,130,152,154,145,180)
i01.moveTorso(90,90,90) | def fighter():
i01.moveHead(160, 87)
i01.moveArm('left', 31, 75, 152, 10)
i01.moveArm('right', 3, 94, 33, 16)
i01.moveHand('left', 161, 151, 133, 127, 107, 83)
i01.moveHand('right', 99, 130, 152, 154, 145, 180)
i01.moveTorso(90, 90, 90) |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def __repr__(self):
if self is None:
return "Nil"
else:
return "{} -> {}".format(self.val, repr(self.next))
class Solution:
def oddEvenList(sel... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
def __repr__(self):
if self is None:
return 'Nil'
else:
return '{} -> {}'.format(self.val, repr(self.next))
class Solution:
def odd_even_list(self, head):
"""
:typ... |
# -*- coding: utf-8 -*-
__name__ = "bayrell-common"
__version__ = "0.0.2"
__description__ = "Bayrell Common Library"
__license__ = "Apache License Version 2.0"
__author__ = "Ildar Bikmamatov"
__email__ = "support@bayrell.org"
__copyright__ = "Copyright 2016-2018"
__url__ = "https://github.com/bayrell/common_py3"
| __name__ = 'bayrell-common'
__version__ = '0.0.2'
__description__ = 'Bayrell Common Library'
__license__ = 'Apache License Version 2.0'
__author__ = 'Ildar Bikmamatov'
__email__ = 'support@bayrell.org'
__copyright__ = 'Copyright 2016-2018'
__url__ = 'https://github.com/bayrell/common_py3' |
description = 'Verify the application shows the correct error message when creating a project without name'
pages = ['common',
'index']
def setup(data):
common.access_golem(data.env.url, data.env.admin)
def test(data):
click(index.create_project_button)
click(index.create_button)
index.veri... | description = 'Verify the application shows the correct error message when creating a project without name'
pages = ['common', 'index']
def setup(data):
common.access_golem(data.env.url, data.env.admin)
def test(data):
click(index.create_project_button)
click(index.create_button)
index.verify_error_me... |
expected_output = {
'group':{
1:{
'state':'Ready',
'core_interfaces':{
'Bundle-Ether2':{
'state':'up'
},
'TenGigE0/1/0/6/1':{
'state':'up'
}
},
'access_in... | expected_output = {'group': {1: {'state': 'Ready', 'core_interfaces': {'Bundle-Ether2': {'state': 'up'}, 'TenGigE0/1/0/6/1': {'state': 'up'}}, 'access_interfaces': {'Bundle-Ether1': {'state': 'up'}}}}} |
"""
Configuration for Captain's Log.
"""
# The log file. Use an absolute path to be safe.
log_file = "/path/to/file"
| """
Configuration for Captain's Log.
"""
log_file = '/path/to/file' |
class Band:
def __init__(self, musicians={}):
self._musicians = musicians
def add_musician(self, musician):
if musician is None:
raise ValueError("Missing required musician instance!")
if musician.get_email() in self._musicians.keys():
raise ValueError("Email a... | class Band:
def __init__(self, musicians={}):
self._musicians = musicians
def add_musician(self, musician):
if musician is None:
raise value_error('Missing required musician instance!')
if musician.get_email() in self._musicians.keys():
raise value_error('Email ... |
"""
A pig-latinzer
"""
def pig_latinize(word_list):
"""
Pig-latinizes a list of words.
Args:
word_list: The list of words to pig-latinize.
Returns:
A generator containing the pig-latinized words.
"""
for word in word_list:
if word is None:
... | """
A pig-latinzer
"""
def pig_latinize(word_list):
"""
Pig-latinizes a list of words.
Args:
word_list: The list of words to pig-latinize.
Returns:
A generator containing the pig-latinized words.
"""
for word in word_list:
if word is None:
... |
'''
You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes.
Given a number K, we would want to reformat the strings such that each group contains exactly K characters, except for the first group which could be sho... | """
You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes.
Given a number K, we would want to reformat the strings such that each group contains exactly K characters, except for the first group which could be sho... |
class TestStackiPalletInfo:
def test_no_pallet_name(self, run_ansible_module):
result = run_ansible_module("stacki_pallet_info")
assert result.status == "SUCCESS"
assert result.data["changed"] is False
def test_pallet_name(self, run_ansible_module):
pallet_name = "stacki"
... | class Teststackipalletinfo:
def test_no_pallet_name(self, run_ansible_module):
result = run_ansible_module('stacki_pallet_info')
assert result.status == 'SUCCESS'
assert result.data['changed'] is False
def test_pallet_name(self, run_ansible_module):
pallet_name = 'stacki'
... |
'''(Record and Move on Technique [E]): Given a sorted array A and a target T,
find the target. If the target is not in the array, find the number closest to the target.
For example, if A = [2,3,5,8,9,11] and T = 7, return 8.'''
def record(arr, mid, res, T):
if res == -1 or abs(arr[mid] - T) < abs(arr[res] - T... | """(Record and Move on Technique [E]): Given a sorted array A and a target T,
find the target. If the target is not in the array, find the number closest to the target.
For example, if A = [2,3,5,8,9,11] and T = 7, return 8."""
def record(arr, mid, res, T):
if res == -1 or abs(arr[mid] - T) < abs(arr[res] - T):
... |
f1 = open("../train_pre_1")
f2 = open("../test_pre_1")
out1 = open("../train_pre_1b","w")
out2 = open("../test_pre_1b","w")
t = open("../train_gbdt_out")
v = open("../test_gbdt_out")
add = []
for i in xrange(30,49):
add.append("C" + str(i))
line = f1.readline()
print >> out1, line[:-1] + "," + ",".join(add)
line = f2... | f1 = open('../train_pre_1')
f2 = open('../test_pre_1')
out1 = open('../train_pre_1b', 'w')
out2 = open('../test_pre_1b', 'w')
t = open('../train_gbdt_out')
v = open('../test_gbdt_out')
add = []
for i in xrange(30, 49):
add.append('C' + str(i))
line = f1.readline()
(print >> out1, line[:-1] + ',' + ','.join(add))
li... |
class Solution:
def readBinaryWatch(self, num: int) -> List[str]:
return [str(h)+':'+'0'*(m<10)+str(m) for h in range(12) for m in range(60) if (bin(m)+bin(h)).count('1') ==
num]
| class Solution:
def read_binary_watch(self, num: int) -> List[str]:
return [str(h) + ':' + '0' * (m < 10) + str(m) for h in range(12) for m in range(60) if (bin(m) + bin(h)).count('1') == num] |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( a ) :
return ( 4 * a )
#TOFILL
if __name__ == '__main__':
param = [
(98,),
(9,),
(18,),
... | def f_gold(a):
return 4 * a
if __name__ == '__main__':
param = [(98,), (9,), (18,), (38,), (84,), (8,), (39,), (6,), (60,), (47,)]
n_success = 0
for (i, parameters_set) in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success += 1
print('#Results: %... |
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def deleteDuplicates(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
def helper(start):
... | class Solution(object):
def delete_duplicates(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
def helper(start):
pre = start
while start and start.next:
if start.val != start.next.val:
pre = start
... |
selRoi = 0
top_left= [20,40]
bottom_right = [60,120]
#For cars2.avi
top_left= [40,50]
bottom_right = [60,80]
top_left2= [110,40]
bottom_right2 = [150,120]
first_time = 1
video_path = 'cars2.avi' | sel_roi = 0
top_left = [20, 40]
bottom_right = [60, 120]
top_left = [40, 50]
bottom_right = [60, 80]
top_left2 = [110, 40]
bottom_right2 = [150, 120]
first_time = 1
video_path = 'cars2.avi' |
class Animal:
def __init__(self):
self.age = 1
def eat(self):
print("eat")
class Mammal(Animal):
def walk(self):
print("walk")
m = Mammal()
print(isinstance(m, Mammal))
print(isinstance(m, Animal))
print(isinstance(Mammal, object))
o = object()
print(issubclass(Mammal, Animal))... | class Animal:
def __init__(self):
self.age = 1
def eat(self):
print('eat')
class Mammal(Animal):
def walk(self):
print('walk')
m = mammal()
print(isinstance(m, Mammal))
print(isinstance(m, Animal))
print(isinstance(Mammal, object))
o = object()
print(issubclass(Mammal, Animal))
p... |
inventory_dict = {
"core": [
"PrettyName",
"Present",
"Functional"
],
"fan": [
"PrettyName",
"Present",
"MeetsMinimumShipLevel",
"Functional"
],
"fan_wc": [
"PrettyName",
"Present",
"MeetsMinimumShipLevel"
],
"fr... | inventory_dict = {'core': ['PrettyName', 'Present', 'Functional'], 'fan': ['PrettyName', 'Present', 'MeetsMinimumShipLevel', 'Functional'], 'fan_wc': ['PrettyName', 'Present', 'MeetsMinimumShipLevel'], 'fru': ['PrettyName', 'Present', 'PartNumber', 'SerialNumber', 'Manufacturer', 'BuildDate', 'Model', 'Version', 'Field... |
SEAL_CHECKER = 9300535
SEAL_OF_TIME = 2159367
if not sm.hasQuest(25672):
sm.createQuestWithQRValue(25672, "1")
sm.showFieldEffect("lightning/screenMsg/6", 0) | seal_checker = 9300535
seal_of_time = 2159367
if not sm.hasQuest(25672):
sm.createQuestWithQRValue(25672, '1')
sm.showFieldEffect('lightning/screenMsg/6', 0) |
# -*- coding: utf-8 -*-
class PayStatementReportData(object):
"""Implementation of the 'Pay Statement Report Data' model.
TODO: type model description here.
Attributes:
asset_ids (list of string): The list of pay statement asset IDs.
extract_earnings (bool): Field to indicate... | class Paystatementreportdata(object):
"""Implementation of the 'Pay Statement Report Data' model.
TODO: type model description here.
Attributes:
asset_ids (list of string): The list of pay statement asset IDs.
extract_earnings (bool): Field to indicate whether to extract the
ea... |
class Solution:
def minJumps(self, arr: List[int]) -> int:
if len(arr) == 1:
return 0
d = collections.defaultdict(list)
for index, element in enumerate(arr):
d[element].append(index)
queue = collections.deque([(0, 0)])
s = set()
s.add... | class Solution:
def min_jumps(self, arr: List[int]) -> int:
if len(arr) == 1:
return 0
d = collections.defaultdict(list)
for (index, element) in enumerate(arr):
d[element].append(index)
queue = collections.deque([(0, 0)])
s = set()
s.add(0)
... |
_base_ = './model_r3d18.py'
model = dict(
backbone=dict(type='R2Plus1D'),
)
| _base_ = './model_r3d18.py'
model = dict(backbone=dict(type='R2Plus1D')) |
def func(x):
"""
Parameters:
x(int): first line of the description
second line
third line
Example::
assert func(42) is None
""" | def func(x):
"""
Parameters:
x(int): first line of the description
second line
third line
Example::
assert func(42) is None
""" |
"""
Uni project. Update literature.
Developer: Stanislav Alexandrovich Ermokhin
"""
dic = dict()
for item in ['_ru', '_en']:
with open('literature'+item+'.txt') as a:
lst = a.read().split(';')
dic[item] = lst
new_lst = list()
for key in dic:
dic[key] = sorted(['\t'+item.replace('\n', '') f... | """
Uni project. Update literature.
Developer: Stanislav Alexandrovich Ermokhin
"""
dic = dict()
for item in ['_ru', '_en']:
with open('literature' + item + '.txt') as a:
lst = a.read().split(';')
dic[item] = lst
new_lst = list()
for key in dic:
dic[key] = sorted(['\t' + item.replace('\n', ''... |
'''input
ABCD
No
BACD
Yes
'''
# -*- coding: utf-8 -*-
# CODE FESTIVAL 2017 qual C
# Problem A
if __name__ == '__main__':
s = input()
if 'AC' in s:
print('Yes')
else:
print('No')
| """input
ABCD
No
BACD
Yes
"""
if __name__ == '__main__':
s = input()
if 'AC' in s:
print('Yes')
else:
print('No') |
ss = input()
out = ss[0]
for i in range(1, len(ss)):
if ss[i] != ss[i-1]: out += ss[i]
print(out)
| ss = input()
out = ss[0]
for i in range(1, len(ss)):
if ss[i] != ss[i - 1]:
out += ss[i]
print(out) |
def onStart():
parent().par.Showshortcut = True
def onCreate():
onStart()
| def on_start():
parent().par.Showshortcut = True
def on_create():
on_start() |
#Edited by Joseph Hutchens
def test():
print("Sucessfully Complete")
return 1
test()
| def test():
print('Sucessfully Complete')
return 1
test() |
def pipe_commands(commands):
"""Pipe commands together"""
return ' | '.join(commands)
def build_and_pipe_commands(commands):
"""Command to build then pipe commands together"""
built_commands = [x.build_command() for x in commands]
return pipe_commands(built_commands)
| def pipe_commands(commands):
"""Pipe commands together"""
return ' | '.join(commands)
def build_and_pipe_commands(commands):
"""Command to build then pipe commands together"""
built_commands = [x.build_command() for x in commands]
return pipe_commands(built_commands) |
__all__ = [
'ValidationError',
'MethodMissingError',
]
class ValidationError(Exception):
pass
class MethodMissingError(Exception):
pass
| __all__ = ['ValidationError', 'MethodMissingError']
class Validationerror(Exception):
pass
class Methodmissingerror(Exception):
pass |
def main():
while True:
text = input("Enter a number: ")
if not text:
print("Later...")
break
num = int(text)
num_class = "small" if num < 100 else "huge!"
print(f"The number is {num_class}")
| def main():
while True:
text = input('Enter a number: ')
if not text:
print('Later...')
break
num = int(text)
num_class = 'small' if num < 100 else 'huge!'
print(f'The number is {num_class}') |
"""An Extensible Dependency Resolver
"""
__version__ = "0.0.0a3"
| """An Extensible Dependency Resolver
"""
__version__ = '0.0.0a3' |
quadruple_operations = [
'+', # 0
'-',
'*',
'/',
'%',
'=', # 5
'==',
'>',
'<',
'<=',
'>=', # 10
'<>',
'and',
'or',
'goto',
'gotof', # 15
'gotot',
'ret',
'return',
... | quadruple_operations = ['+', '-', '*', '/', '%', '=', '==', '>', '<', '<=', '>=', '<>', 'and', 'or', 'goto', 'gotof', 'gotot', 'ret', 'return', 'gosub', 'era', 'param', 'print', 'read', 'write', '(', ')']
class Zstack:
"""Traditional stack implementation"""
def __init__(self):
self.arr = []
def t... |
def main():
# problem1()
# problem2()
# problem3()
problem4()
# Create a function that has two variables.
# One called greeting and another called myName.
# Print out greeting and myName two different ways without using the following examples
def problem1():
greeting = "Hello world"
myNam... | def main():
problem4()
def problem1():
greeting = 'Hello world'
my_name = 'Chey'
print('%s my name is %s.' % (greeting, myName))
def problem2():
secret_password = input('Enter secret password ')
while True:
password = input('Enter password ')
if password == secretPassword:
... |
# 037
# Ask the user to enter their name and display each letter in
# their name on a separate line
name = input('Enter ya name: ')
for i in range(len(name)):
print(name[i])
| name = input('Enter ya name: ')
for i in range(len(name)):
print(name[i]) |
# Dictionary Keys, Items and Values
mice = {'harold': 'tiny mouse', 'rose': 'nipple mouse', 'willy wonka': 'dead mouse'}
# Looping over a dictionary
for m in mice.values(): # All values of the dictionary
print(m)
print()
for m in mice.keys(): # All keys of the dictionary
print(m)
print()
... | mice = {'harold': 'tiny mouse', 'rose': 'nipple mouse', 'willy wonka': 'dead mouse'}
for m in mice.values():
print(m)
print()
for m in mice.keys():
print(m)
print()
for m in mice.items():
print(m)
print()
for (key, value) in mice.items():
print(value + ' ' + key + ' represent!')
print()
print('harold' i... |
def selection_sort(items):
"""Implementation of selection sort where a given list of items are sorted in ascending order and returned"""
for current_position in range(len(items)):
# assume the current position as the smallest values position
smallest_item_position = current_position
# ... | def selection_sort(items):
"""Implementation of selection sort where a given list of items are sorted in ascending order and returned"""
for current_position in range(len(items)):
smallest_item_position = current_position
for location in range(current_position, len(items)):
if items[... |
def make_greeting(name, formality):
return (
"Greetings and felicitations, {}!".format(name)
if formality
else "Hello, {}!".format(name)
)
| def make_greeting(name, formality):
return 'Greetings and felicitations, {}!'.format(name) if formality else 'Hello, {}!'.format(name) |
# Python modules
# 3rd party modules
# Our modules
class PulseDesignPreview(object):
"""A lightweight version of a pulse design that's good for populating
lists of designs (as in the design browser dialog).
"""
def __init__(self, attributes=None):
self.id = ""
self.uuid = ""... | class Pulsedesignpreview(object):
"""A lightweight version of a pulse design that's good for populating
lists of designs (as in the design browser dialog).
"""
def __init__(self, attributes=None):
self.id = ''
self.uuid = ''
self.name = ''
self.creator = ''
se... |
class MockMetaMachine(object):
def __init__(self, meta_business_unit_id_set, tag_id_set, platform, type, serial_number="YO"):
self.meta_business_unit_id_set = set(meta_business_unit_id_set)
self._tag_id_set = set(tag_id_set)
self.platform = platform
self.type = type
self.seri... | class Mockmetamachine(object):
def __init__(self, meta_business_unit_id_set, tag_id_set, platform, type, serial_number='YO'):
self.meta_business_unit_id_set = set(meta_business_unit_id_set)
self._tag_id_set = set(tag_id_set)
self.platform = platform
self.type = type
self.ser... |
__all__ = ('CMD_STATUS', 'CMD_STATUS_NAME', 'CMD_BLOCKED', 'CMD_READY',
'CMD_ASSIGNED', 'CMD_RUNNING', 'CMD_FINISHING', 'CMD_DONE',
'CMD_ERROR', 'CMD_CANCELED', 'CMD_TIMEOUT',
'isFinalStatus', 'isRunningStatus')
CMD_STATUS = (CMD_BLOCKED,
CMD_READY,
C... | __all__ = ('CMD_STATUS', 'CMD_STATUS_NAME', 'CMD_BLOCKED', 'CMD_READY', 'CMD_ASSIGNED', 'CMD_RUNNING', 'CMD_FINISHING', 'CMD_DONE', 'CMD_ERROR', 'CMD_CANCELED', 'CMD_TIMEOUT', 'isFinalStatus', 'isRunningStatus')
cmd_status = (cmd_blocked, cmd_ready, cmd_assigned, cmd_running, cmd_finishing, cmd_done, cmd_timeout, cmd_e... |
uri = "postgres://user:password@host/database" # Postgresql url connection string
token = "" # Discord bot token
POLL_ROLE_PING = None # Role ID to ping for polls, leave as None to not ping
THREAD_INACTIVE_HOURS = 12 # How many hours of inactivity are required for a
ADD_USERS_IDS = [] # List of user ids to add to... | uri = 'postgres://user:password@host/database'
token = ''
poll_role_ping = None
thread_inactive_hours = 12
add_users_ids = [] |
# copyright 2008-2009 WebDriver committers
# Copyright 2008-2009 Google Inc.
#
# Licensed under the Apache License Version 2.0 = uthe "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 requ... | class Keys(object):
null = u'\ue000'
cancel = u'\ue001'
help = u'\ue002'
back_space = u'\ue003'
tab = u'\ue004'
clear = u'\ue005'
return = u'\ue006'
enter = u'\ue007'
shift = u'\ue008'
left_shift = u'\ue008'
control = u'\ue009'
left_control = u'\ue009'
alt = u'\ue00a'... |
class Account:
""" A simple account class """
""" The constructor that initializes the objects fields """
def __init__(self, owner, amount=0.00):
self.owner = owner
self.amount = amount
self.transactions = []
def __repr__(self):
return f'Account {self.owner},{self.amoun... | class Account:
""" A simple account class """
' The constructor that initializes the objects fields '
def __init__(self, owner, amount=0.0):
self.owner = owner
self.amount = amount
self.transactions = []
def __repr__(self):
return f'Account {self.owner},{self.amount} '
... |
def my_cleaner(dryrun):
if dryrun:
print('dryrun, dont really execute')
return
print('execute cleaner...')
def task_sample():
return {
"actions" : None,
"clean" : [my_cleaner],
}
| def my_cleaner(dryrun):
if dryrun:
print('dryrun, dont really execute')
return
print('execute cleaner...')
def task_sample():
return {'actions': None, 'clean': [my_cleaner]} |
def NumFunc(myList1=[],myList2=[],*args):
list3 = list(set(myList1).intersection(myList2))
return list3
myList1 = [1,2,3,4,5,6]
myList2 = [3, 5, 7, 9]
NumFunc(myList1,myList2) | def num_func(myList1=[], myList2=[], *args):
list3 = list(set(myList1).intersection(myList2))
return list3
my_list1 = [1, 2, 3, 4, 5, 6]
my_list2 = [3, 5, 7, 9]
num_func(myList1, myList2) |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def mergeKLists(self, lists: List[ListNode]) -> ListNode:
ans = list()
for node in lists:
val = node
while (v... | class Solution:
def merge_k_lists(self, lists: List[ListNode]) -> ListNode:
ans = list()
for node in lists:
val = node
while val != None:
ans.append(val.val)
val = val.next
ans = sorted(ans)
sub = None
point = None
... |
# Copyright (C) 2021 <FacuFalcone - CaidevOficial>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is... | def bag(sizeBag: int, kilos: list, values: list, index: int):
if index == 0 or sizeBag == 0:
return 0
elif kilos[index - 1] > sizeBag:
return bag(sizeBag, kilos, values, index - 1)
return max(values[index - 1] + bag(sizeBag - kilos[index - 1], kilos, values, index - 1), bag(sizeBag, kilos, v... |
"""
lab9
"""
#3.1
class my_stat():
def cal_sigma(self,m,n):
self.result=0
for i in range (n,m+1):
self.result=self.result+i
return self.result
def cal_p(self,m,n):
self.result=1
for i in range (n,m+1):
s... | """
lab9
"""
class My_Stat:
def cal_sigma(self, m, n):
self.result = 0
for i in range(n, m + 1):
self.result = self.result + i
return self.result
def cal_p(self, m, n):
self.result = 1
for i in range(n, m + 1):
self.result = self.result * i
... |
#Replace all ______ with rjust, ljust or center.
THICKNESS = int(input()) #This must be an odd number
c = 'H'
# Top Cone
for i in range(THICKNESS):
print((c*i).rjust(THICKNESS-1)+c+(c*i).ljust(THICKNESS-1))
# Top Pillars
for i in range(THICKNESS+1):
print((c*THICKNESS).center(THICKNESS*2)+(c*THICK... | thickness = int(input())
c = 'H'
for i in range(THICKNESS):
print((c * i).rjust(THICKNESS - 1) + c + (c * i).ljust(THICKNESS - 1))
for i in range(THICKNESS + 1):
print((c * THICKNESS).center(THICKNESS * 2) + (c * THICKNESS).center(THICKNESS * 6))
for i in range((THICKNESS + 1) // 2):
print((c * THICKNESS * ... |
cellsize = 200
cells = {}
recording = False
class Cell:
def __init__(self, x, y, ix, iy):
self.x, self.y = x, y
self.ix, self.iy = ix, iy # positional indices
self.xdiv = 1.0
self.ydiv = 1.0
self.left = None
self.up = None
def left_inter(self):
if s... | cellsize = 200
cells = {}
recording = False
class Cell:
def __init__(self, x, y, ix, iy):
(self.x, self.y) = (x, y)
(self.ix, self.iy) = (ix, iy)
self.xdiv = 1.0
self.ydiv = 1.0
self.left = None
self.up = None
def left_inter(self):
if self.left:
... |
HUOBI_URL_PRO = "https://api.huobi.sg"
HUOBI_URL_VN = "https://api.huobi.sg"
HUOBI_URL_SO = "https://api.huobi.sg"
HUOBI_WEBSOCKET_URI_PRO = "wss://api.huobi.sg"
HUOBI_WEBSOCKET_URI_VN = "wss://api.huobi.sg"
HUOBI_WEBSOCKET_URI_SO = "wss://api.huobi.sg"
class WebSocketDefine:
Uri = HUOBI_WEBSOCKET_URI_PRO
clas... | huobi_url_pro = 'https://api.huobi.sg'
huobi_url_vn = 'https://api.huobi.sg'
huobi_url_so = 'https://api.huobi.sg'
huobi_websocket_uri_pro = 'wss://api.huobi.sg'
huobi_websocket_uri_vn = 'wss://api.huobi.sg'
huobi_websocket_uri_so = 'wss://api.huobi.sg'
class Websocketdefine:
uri = HUOBI_WEBSOCKET_URI_PRO
class R... |
"""
Tests using cards CLI (command line interface).
"""
def test_add(db_empty, cards_cli, cards_cli_list_items):
# GIVEN an empty database
# WHEN a new card is added
cards_cli("add something -o okken")
# THEN The listing returns just the new card
items = cards_cli_list_items("list")
assert le... | """
Tests using cards CLI (command line interface).
"""
def test_add(db_empty, cards_cli, cards_cli_list_items):
cards_cli('add something -o okken')
items = cards_cli_list_items('list')
assert len(items) == 1
assert items[0].summary == 'something'
assert items[0].owner == 'okken'
def test_list_fil... |
def index(array,index):
try:
return array[index]
except:
return array
def append(array,value):
try:
array.append(value)
except:
pass
return array
def remove(array,index):
try:
del array[index]
except:
pass
return array
def dedupe(array):... | def index(array, index):
try:
return array[index]
except:
return array
def append(array, value):
try:
array.append(value)
except:
pass
return array
def remove(array, index):
try:
del array[index]
except:
pass
return array
def dedupe(arra... |
class Entity():
def __init__(self, entityID, type, attributeMap):
self.__entityID = entityID
self.__type = type
self.__attributeMap = attributeMap
@property
def entityID(self):
return self.__entityID
@entityID.setter
def entityID(self, entityID):
self.__enti... | class Entity:
def __init__(self, entityID, type, attributeMap):
self.__entityID = entityID
self.__type = type
self.__attributeMap = attributeMap
@property
def entity_id(self):
return self.__entityID
@entityID.setter
def entity_id(self, entityID):
self.__ent... |
""" Abstract Syntax Tree Nodes """
class AST: ...
class LetraNode(AST):
def __init__(self, token):
self.token = token
def __repr__(self):
return f'{self.token}'
class NumeroNode(AST):
def __init__(self, token):
self.token = token
def __repr__(self):
return f'{self.to... | """ Abstract Syntax Tree Nodes """
class Ast:
...
class Letranode(AST):
def __init__(self, token):
self.token = token
def __repr__(self):
return f'{self.token}'
class Numeronode(AST):
def __init__(self, token):
self.token = token
def __repr__(self):
return f'{s... |
#
# from src/3dgraph.c
#
# a part of main to tdGraph
#
_MAX_VALUE = float("inf")
class parametersTDGraph:
def __init__(self, m, n, t, u, minX, minY, minZ, maxX, maxY, maxZ):
self.m = m
self.n = n
self.t = t
self.u = u
self.minX = minX
self.minY = minY
self.... | _max_value = float('inf')
class Parameterstdgraph:
def __init__(self, m, n, t, u, minX, minY, minZ, maxX, maxY, maxZ):
self.m = m
self.n = n
self.t = t
self.u = u
self.minX = minX
self.minY = minY
self.minZ = minZ
self.maxX = maxX
self.maxY =... |
# -*- coding: utf-8 -*-
"""
fahrToCelsius is the function that converts the input temperature from degrees Fahrenheit
to degrees Celsius.
tempFahrenheit is input value of temperature in degrees Fahrenheit.
convertedTemp is returned value of the function that is value of temperature in degrees Celsius.
tempClass... | """
fahrToCelsius is the function that converts the input temperature from degrees Fahrenheit
to degrees Celsius.
tempFahrenheit is input value of temperature in degrees Fahrenheit.
convertedTemp is returned value of the function that is value of temperature in degrees Celsius.
tempClassifier is the function that clas... |
class CreateSingleEventRequest:
def __init__(self, chart_key, event_key=None, table_booking_config=None, social_distancing_ruleset_key=None):
if chart_key:
self.chartKey = chart_key
if event_key:
self.eventKey = event_key
if table_booking_config is not None:
... | class Createsingleeventrequest:
def __init__(self, chart_key, event_key=None, table_booking_config=None, social_distancing_ruleset_key=None):
if chart_key:
self.chartKey = chart_key
if event_key:
self.eventKey = event_key
if table_booking_config is not None:
... |
#
# PySNMP MIB module PYSNMP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PYSNMP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:43:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ... |
def uniform_cost_search(graph, start, goal):
path = []
explored_nodes = list()
if start == goal:
return path, explored_nodes
path.append(start)
path_cost = 0
frontier = [(path_cost, path)]
while len(frontier) > 0:
path_cost_t... | def uniform_cost_search(graph, start, goal):
path = []
explored_nodes = list()
if start == goal:
return (path, explored_nodes)
path.append(start)
path_cost = 0
frontier = [(path_cost, path)]
while len(frontier) > 0:
(path_cost_till_now, path_till_now) = pop_frontier(frontier)... |
def fibonacci(n):
seznam = []
(a, b) = (0, 1)
for i in range(n):
(a, b) = (b, a+b)
seznam.append(a)
return [a, seznam]
def stevke(stevilo):
n = 1
while n > 0: #nevem kako naj bolje napisem
if fibonacci(n)[0] > 10 ** (stevilo -1):
return fibonacci(n)[1].index(... | def fibonacci(n):
seznam = []
(a, b) = (0, 1)
for i in range(n):
(a, b) = (b, a + b)
seznam.append(a)
return [a, seznam]
def stevke(stevilo):
n = 1
while n > 0:
if fibonacci(n)[0] > 10 ** (stevilo - 1):
return fibonacci(n)[1].index(fibonacci(n)[0]) + 1
... |
spam = 42 # global variable
def printSpam():
print('Spam = ' + str(spam))
def eggs():
spam = 42 # local variable
return spam
print('example xyz')
def Spam():
eggs = 99
bacon()
print(eggs)
def bacon():
ham = 101
eggs = 0
def assignSpam(var):
global spam
spam = var
Spam()
printSpam()
assignSp... | spam = 42
def print_spam():
print('Spam = ' + str(spam))
def eggs():
spam = 42
return spam
print('example xyz')
def spam():
eggs = 99
bacon()
print(eggs)
def bacon():
ham = 101
eggs = 0
def assign_spam(var):
global spam
spam = var
spam()
print_spam()
assign_spam(25)
print_sp... |
"""
URL: https://codeforces.com/problemset/problem/1422/C
Author: Safiul Kabir [safiulanik at gmail.com]
Tags: combinatorics, dp, math, *1700
---------------------In Progress---------------------
"""
mod = 10 ** 9 + 7
def a(s):
# s = input()
ll = len(s)
summ = 0
for i in range(ll):
current_d... | """
URL: https://codeforces.com/problemset/problem/1422/C
Author: Safiul Kabir [safiulanik at gmail.com]
Tags: combinatorics, dp, math, *1700
---------------------In Progress---------------------
"""
mod = 10 ** 9 + 7
def a(s):
ll = len(s)
summ = 0
for i in range(ll):
current_digit = int(s[i])
... |
n = int(input().strip())
ar = list(map(int, input().strip().split(' ')))
print (ar.count(max(ar)))
#https://www.hackerrank.com/challenges/birthday-cake-candles/problem | n = int(input().strip())
ar = list(map(int, input().strip().split(' ')))
print(ar.count(max(ar))) |
class Project:
def __init__(self, id=None, name=None, description=None):
self.id = id
self.name = name
self.description = description
def __repr__(self):
return "%s: %s, %s" % (self.id, self.name, self.description)
def __eq__(self, other):
return self.id == other.id... | class Project:
def __init__(self, id=None, name=None, description=None):
self.id = id
self.name = name
self.description = description
def __repr__(self):
return '%s: %s, %s' % (self.id, self.name, self.description)
def __eq__(self, other):
return self.id == other.i... |
class Service:
def __init__(self, name):
self.name = name
self.methods = {}
def rpc(self, func_name):
def decorator(func):
self._save_method(func_name, func)
return func
if isinstance(func_name, str):
return decorator
func = func_nam... | class Service:
def __init__(self, name):
self.name = name
self.methods = {}
def rpc(self, func_name):
def decorator(func):
self._save_method(func_name, func)
return func
if isinstance(func_name, str):
return decorator
func = func_nam... |
def prime_factors(strs):
result = []
float=2
while float:
if strs%float==0:
strs = strs / float
result.append(float)
else:
float = float+1
if float>strs:
break
return result
| def prime_factors(strs):
result = []
float = 2
while float:
if strs % float == 0:
strs = strs / float
result.append(float)
else:
float = float + 1
if float > strs:
break
return result |
'''
Steven Kyritsis CS100
2021F Section 031 HW 10,
November 12, 2021
'''
#3
def shareoneletter(wordlist):
d={}
for w in wordlist:
d[w]=[]
for i in wordlist:
match=False
for c in w:
if c in i:
match=True
i... | """
Steven Kyritsis CS100
2021F Section 031 HW 10,
November 12, 2021
"""
def shareoneletter(wordlist):
d = {}
for w in wordlist:
d[w] = []
for i in wordlist:
match = False
for c in w:
if c in i:
match = True
if match and i... |
# A server used to store and retrieve arbitrary data.
# This is used by: ./dispatcher.js
def main(request, response):
response.headers.set(b'Access-Control-Allow-Origin', b'*')
response.headers.set(b'Access-Control-Allow-Methods', b'OPTIONS, GET, POST')
response.headers.set(b'Access-Control-Allow-Headers', ... | def main(request, response):
response.headers.set(b'Access-Control-Allow-Origin', b'*')
response.headers.set(b'Access-Control-Allow-Methods', b'OPTIONS, GET, POST')
response.headers.set(b'Access-Control-Allow-Headers', b'Content-Type')
response.headers.set(b'Cache-Control', b'no-cache, no-store, must-re... |
clarify_boosted = {
'abita cove': ["cooked cod"],
'the red city': ["baked potatoes", "carrots", "iron ingot"],
'claybound': ["cooked salmon"]
}
aliases = {
'Quartz': 'Quartz Crystal',
'Potatoes': 'Baked Potatoes',
'Nether Wart': 'Nether Wart Block'
}
| clarify_boosted = {'abita cove': ['cooked cod'], 'the red city': ['baked potatoes', 'carrots', 'iron ingot'], 'claybound': ['cooked salmon']}
aliases = {'Quartz': 'Quartz Crystal', 'Potatoes': 'Baked Potatoes', 'Nether Wart': 'Nether Wart Block'} |
while True:
linha = input("Digite qualquer coisa ou \"fim\" para terminar: ")
if linha == "fim":
break
print(linha)
print("Fim!")
| while True:
linha = input('Digite qualquer coisa ou "fim" para terminar: ')
if linha == 'fim':
break
print(linha)
print('Fim!') |
"""
What you will learn:
- How to add, subtract, multiply divide numbers
- Float division and integer division
- Modulus (finding the remainder)
- Dealing with exponents
- Python will crash on errors (like divide by 0)
Okay now lets do more cool things with variables. Like making python do math for us!
What you need ... | """
What you will learn:
- How to add, subtract, multiply divide numbers
- Float division and integer division
- Modulus (finding the remainder)
- Dealing with exponents
- Python will crash on errors (like divide by 0)
Okay now lets do more cool things with variables. Like making python do math for us!
What you need ... |
phrase = input('Enter a phrase: ')
for c in phrase:
if c in 'aeoiuAEOIU':
print(c) | phrase = input('Enter a phrase: ')
for c in phrase:
if c in 'aeoiuAEOIU':
print(c) |
"""
https://leetcode.com/problems/number-of-islands/
"""
class Solution:
""" Wrapper for LeetCode Solution """
def numIslands(self, grid: [[str]]) -> int:
"""
Determines the number of islands in a matrix, before destroying them
"""
# No islands or land
if not grid or n... | """
https://leetcode.com/problems/number-of-islands/
"""
class Solution:
""" Wrapper for LeetCode Solution """
def num_islands(self, grid: [[str]]) -> int:
"""
Determines the number of islands in a matrix, before destroying them
"""
if not grid or not grid[0]:
retur... |
# author Mahmud Ahsan
# --------------------
# msmath module under mspack package
# --------------------
def sum(x, y):
return x + y
def subtract(x, y):
return x - y
def multiplication(x, y):
return x * y
def division(x, y):
return x / y | def sum(x, y):
return x + y
def subtract(x, y):
return x - y
def multiplication(x, y):
return x * y
def division(x, y):
return x / y |
rows=input()
rows=int(rows)
k=0
matrixList=[]; evenMatrix=[]
while rows!=0:
matrix=input()
matrix=matrix.split(", "); matrix=[int(e) for e in matrix]
e=0; elements=len(matrix)
matrixList.append([])
while e < elements:
matrixList[k].append(matrix[0])
del matrix[0]
... | rows = input()
rows = int(rows)
k = 0
matrix_list = []
even_matrix = []
while rows != 0:
matrix = input()
matrix = matrix.split(', ')
matrix = [int(e) for e in matrix]
e = 0
elements = len(matrix)
matrixList.append([])
while e < elements:
matrixList[k].append(matrix[0])
del m... |
def profitable_gamble(prob, prize, pay):
if prob * prize > pay:
return True
return False
print(profitable_gamble(4,8,12)) | def profitable_gamble(prob, prize, pay):
if prob * prize > pay:
return True
return False
print(profitable_gamble(4, 8, 12)) |
#addition.py
def add(a,b):
return a+b
a=int(input("Enter the a value"))
b= int(input("Enter the b value"))
c=add(a,b)
print(c) | def add(a, b):
return a + b
a = int(input('Enter the a value'))
b = int(input('Enter the b value'))
c = add(a, b)
print(c) |
class DissectError(Exception):
"""
Error when
- initially parsing / constructing a message (Checksum error, message to small, ...) or
- trying to access data / certain attributes (No payload, payload too small, payload does make no sense)
May also occur when encountering edge cases not yet handled by the disse... | class Dissecterror(Exception):
"""
Error when
- initially parsing / constructing a message (Checksum error, message to small, ...) or
- trying to access data / certain attributes (No payload, payload too small, payload does make no sense)
May also occur when encountering edge cases not yet handled by the di... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.