content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
"""
:testcase_name record_metrics
:author Sriteja Kummita
:script_type class
:description Metrics contains the getters and setter for precision and recall. RecordMetrics uses these methods
to set and get the respective metrics.
"""
class Metrics:
def __init__(self):
self.precision = 0.0
self.recal... | """
:testcase_name record_metrics
:author Sriteja Kummita
:script_type class
:description Metrics contains the getters and setter for precision and recall. RecordMetrics uses these methods
to set and get the respective metrics.
"""
class Metrics:
def __init__(self):
self.precision = 0.0
self.recal... |
#
# PySNMP MIB module WWP-LEOS-PORT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-LEOS-PORT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:38:09 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, constraints_union, single_value_constraint, value_size_constraint) ... |
budget = int(input())
season = input()
fisherman = int(input())
rent_price = 0
if season == "Spring":
rent_price = 3000
elif season == "Summer" or season == "Autumn":
rent_price = 4200
elif season == "Winter":
rent_price = 2600
if fisherman <= 6:
rent_price = rent_price - (rent_price * 0.1)
elif 7 <= ... | budget = int(input())
season = input()
fisherman = int(input())
rent_price = 0
if season == 'Spring':
rent_price = 3000
elif season == 'Summer' or season == 'Autumn':
rent_price = 4200
elif season == 'Winter':
rent_price = 2600
if fisherman <= 6:
rent_price = rent_price - rent_price * 0.1
elif 7 <= fish... |
def pascal_triangle(n):
if n == 0:
return [1]
else:
row = [1]
line_behind = pascal_triangle(n - 1)
for r in range(len(line_behind) - 1):
row.append(line_behind[r] + line_behind[r + 1])
row += [1]
return row
print(pascal_triangle(4))
| def pascal_triangle(n):
if n == 0:
return [1]
else:
row = [1]
line_behind = pascal_triangle(n - 1)
for r in range(len(line_behind) - 1):
row.append(line_behind[r] + line_behind[r + 1])
row += [1]
return row
print(pascal_triangle(4)) |
class YesError(Exception):
pass
class YesUserCanceledError(YesError):
pass
class YesUnknownIssuerError(YesError):
pass
class YesAccountSelectionRequested(YesError):
redirect_uri: str
class YesOAuthError(YesError):
oauth_error: str
oauth_error_description: str
| class Yeserror(Exception):
pass
class Yesusercancelederror(YesError):
pass
class Yesunknownissuererror(YesError):
pass
class Yesaccountselectionrequested(YesError):
redirect_uri: str
class Yesoautherror(YesError):
oauth_error: str
oauth_error_description: str |
class Packtry(object):
@staticmethod
def print():
print('print')
| class Packtry(object):
@staticmethod
def print():
print('print') |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class UnsupportedFileFormatError(Exception):
"""
This exception is intended to communicate that the file extension is not one of
the supported file types and cannot be parsed with AICSImage.
"""
def __init__(self, data, **kwargs):
super().__in... | class Unsupportedfileformaterror(Exception):
"""
This exception is intended to communicate that the file extension is not one of
the supported file types and cannot be parsed with AICSImage.
"""
def __init__(self, data, **kwargs):
super().__init__(**kwargs)
self.data = data
def... |
class Constants:
APPLICATION_TITLE = "Welcome to Kafka Local Setup Tool"
APPLICATION_WINDOW_TITLE = "Kafka Application Tool"
START_BUTTON = "Start"
STOP_BUTTON = "Stop"
CHOOSE_FOLDER = "Choose Folder"
SELECT_FOLDER = "Select the folder"
ZOOKEEPER_START_SERVER_PATH = "bin/zookeeper-server-sta... | class Constants:
application_title = 'Welcome to Kafka Local Setup Tool'
application_window_title = 'Kafka Application Tool'
start_button = 'Start'
stop_button = 'Stop'
choose_folder = 'Choose Folder'
select_folder = 'Select the folder'
zookeeper_start_server_path = 'bin/zookeeper-server-sta... |
class User():
def __init__(self, Name, LastName, ID, Mail, Phone):
self.Name = Name
self.LastName = LastName
self.ID = ID
self.Mail = Mail
self.Phone = Phone
def Describe_U(self):
s = "\nName: " + self.Name + " "+self.LastName + "\nID: "+self.ID
... | class User:
def __init__(self, Name, LastName, ID, Mail, Phone):
self.Name = Name
self.LastName = LastName
self.ID = ID
self.Mail = Mail
self.Phone = Phone
def describe_u(self):
s = '\nName: ' + self.Name + ' ' + self.LastName + '\nID: ' + self.ID
s += '... |
with open("data_100.vrt", "rb") as f_in:
with open("data_broken_header.vrt", "wb") as f_out:
f_out.write(f_in.read(2))
with open("data_missing_fields.vrt", "wb") as f_out:
f_out.write(f_in.read(4))
with open("data_broken_fields.vrt", "wb") as f_out:
f_out.write(f_in.read(6))
with... | with open('data_100.vrt', 'rb') as f_in:
with open('data_broken_header.vrt', 'wb') as f_out:
f_out.write(f_in.read(2))
with open('data_missing_fields.vrt', 'wb') as f_out:
f_out.write(f_in.read(4))
with open('data_broken_fields.vrt', 'wb') as f_out:
f_out.write(f_in.read(6))
with... |
"""
Euclidean common divisor algorithm.
"""
def greatest_common_divisor(num_a: int, num_b: int) -> int:
"""
A method to compute the greatest common divisor.
Args:
num_a (int): The first number.
num_b (int): Second number
Returns:
The greatest common divisor.
"""
... | """
Euclidean common divisor algorithm.
"""
def greatest_common_divisor(num_a: int, num_b: int) -> int:
"""
A method to compute the greatest common divisor.
Args:
num_a (int): The first number.
num_b (int): Second number
Returns:
The greatest common divisor.
"""
... |
n = int(input())
arr = [int(x) for x in input().split()]
if all(item < 0 for item in arr):
print(0)
else:
mx = 0
su = 0
for item in arr:
su += item
if su < 0:
su = 0
if su > mx:
mx = su
print(mx)
| n = int(input())
arr = [int(x) for x in input().split()]
if all((item < 0 for item in arr)):
print(0)
else:
mx = 0
su = 0
for item in arr:
su += item
if su < 0:
su = 0
if su > mx:
mx = su
print(mx) |
def flatten_list(mylist,index=0,newlist=[]):
if(index==len(mylist)):
return newlist
if(type(mylist[index])== list):
newlist.extend(flatten_list(mylist[index],0,[]))
else:
newlist.append(mylist[index])
return flatten_list(mylist,index+1,newlist)
mylist=[1,2,[3,4],[5,[6,7,... | def flatten_list(mylist, index=0, newlist=[]):
if index == len(mylist):
return newlist
if type(mylist[index]) == list:
newlist.extend(flatten_list(mylist[index], 0, []))
else:
newlist.append(mylist[index])
return flatten_list(mylist, index + 1, newlist)
mylist = [1, 2, [3, 4], [5... |
class Service(object):
'''Basic service interface.
If you want your own service, you should respect this interface
so that your service can be used by the looper.
'''
def __init__(self, cfg, comp, outdir):
'''
cfg: framework.config.Service object containing whatever parameters
... | class Service(object):
"""Basic service interface.
If you want your own service, you should respect this interface
so that your service can be used by the looper.
"""
def __init__(self, cfg, comp, outdir):
"""
cfg: framework.config.Service object containing whatever parameters
... |
# Copyright 2015 Curtis Sand
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | class Commandmixin(object):
"""Command Mixin: Used to add commands to an interpreter.
Subclasses of the CommandMixin should use mangled class attributes to avoid
collisions when the interpreter object is put together.
Example::
class Example(CommandMixin):
'''Example command help ... |
def shorten_string(string : str, max_length : int):
shortened_name = string
if len(string) > max_length:
shortened_name = string[0:max_length] + '...'
return shortened_name | def shorten_string(string: str, max_length: int):
shortened_name = string
if len(string) > max_length:
shortened_name = string[0:max_length] + '...'
return shortened_name |
#!/usr/bin/env python3
#
# Prints to stdout very fast.
#
# Optimal time:
# time ./stress.py >/dev/null
# Actual time:
# time ./stress.py
for i in range(1000000):
print('\033[31;1m', i, '\033[0m')
| for i in range(1000000):
print('\x1b[31;1m', i, '\x1b[0m') |
GstreamerPackage ('gstreamer', 'gst-plugins-bad', '0.10.23', configure_flags = [
' --disable-gtk-doc',
' --with-plugins=quicktime',
' --disable-apexsink',
' --disable-bz2',
' --disable-metadata',
' --disable-oss4',
' --disable-theoradec'
])
| gstreamer_package('gstreamer', 'gst-plugins-bad', '0.10.23', configure_flags=[' --disable-gtk-doc', ' --with-plugins=quicktime', ' --disable-apexsink', ' --disable-bz2', ' --disable-metadata', ' --disable-oss4', ' --disable-theoradec']) |
n = int(input())
list_names = []
for i in range(n):
name = input()
list_names.append(name)
print(list_names) | n = int(input())
list_names = []
for i in range(n):
name = input()
list_names.append(name)
print(list_names) |
class CubeOrder:
"""""
There does not seem to be one single standard for cube representation among various solvers.
Different programs will receive an input string expecting a different order.
This class allows us to convert from one order to another order allowing stitching among solvers.
... | class Cubeorder:
"""""
There does not seem to be one single standard for cube representation among various solvers.
Different programs will receive an input string expecting a different order.
This class allows us to convert from one order to another order allowing stitching among solvers.
The ... |
class Dataset(object):
"""
Class representation of a dataset on Citrination.
"""
def __init__(self, id, name=None, description=None,
created_at=None):
"""
Constructor.
:param id: The ID of the dataset (required for instantiation)
:type id: int
:param... | class Dataset(object):
"""
Class representation of a dataset on Citrination.
"""
def __init__(self, id, name=None, description=None, created_at=None):
"""
Constructor.
:param id: The ID of the dataset (required for instantiation)
:type id: int
:param name: The n... |
"""Exception types."""
class IntegratorError(RuntimeError):
"""Error raised when integrator step fails."""
class NonReversibleStepError(IntegratorError):
"""Error raised when integrator step fails reversibility check."""
class ConvergenceError(IntegratorError):
"""Error raised when solver fails to con... | """Exception types."""
class Integratorerror(RuntimeError):
"""Error raised when integrator step fails."""
class Nonreversiblesteperror(IntegratorError):
"""Error raised when integrator step fails reversibility check."""
class Convergenceerror(IntegratorError):
"""Error raised when solver fails to conver... |
class Solution:
# 1st two-pass solution
# O(2n) time | O(1) space
def sortColors(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
zero = 0
for i in range(len(nums)):
if nums[i] == 0:
nums[i], num... | class Solution:
def sort_colors(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
zero = 0
for i in range(len(nums)):
if nums[i] == 0:
(nums[i], nums[zero]) = (nums[zero], nums[i])
zero +... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
EXPECTED_REPR = u""""""
EXPECTED_AGG_QUERY = {
"week": {
"aggs": {
"nested_below_week": {
"aggs": {
"local_metrics.field_class.name": {
"aggs": {
"min_f1_score... | expected_repr = u''
expected_agg_query = {'week': {'aggs': {'nested_below_week': {'aggs': {'local_metrics.field_class.name': {'aggs': {'min_f1_score': {'min': {'field': 'local_metrics.performance.test.f1_score'}}}, 'terms': {'field': 'local_metrics.field_class.name', 'size': 10}}}, 'nested': {'path': 'local_metrics'}}}... |
"""Py4research main library. Note that it consists
of two modules.
"""
__version__ = '1.0.1'
| """Py4research main library. Note that it consists
of two modules.
"""
__version__ = '1.0.1' |
# -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
class DbTypeEnum(object):
"""Implementation of the 'DbType' enum.
Specifies the type of the database in Oracle Protection Source.
'kRACDatabase' indicates the database is a RAC DB.
'kSingleInstance' indicates that the database is single instance.... | class Dbtypeenum(object):
"""Implementation of the 'DbType' enum.
Specifies the type of the database in Oracle Protection Source.
'kRACDatabase' indicates the database is a RAC DB.
'kSingleInstance' indicates that the database is single instance.
Attributes:
KSINGLEINSTANCE: TODO: type des... |
# -*- coding: utf-8 -*-
textFile = """
.
.
.
One has to consider that the database is closed.
Spyder
"""
print("Osman Orhun OZSAN")
print("2017-01-19 14:00:00")
print(textFile)
| text_file = '\n.\n.\n.\n\n One has to consider that the database is closed.\n \n Spyder\n'
print('Osman Orhun OZSAN')
print('2017-01-19 14:00:00')
print(textFile) |
def mergeSort(myArray):
# print to show splitting
print("Splitting ",myArray)
# if array is greater than 1 then:
if len(myArray) > 1:
# mid, leftside, and right side of array stored as variables
mid = len(myArray)//2
lefthalf = myArray[:mid]
righthalf = myArray[m... | def merge_sort(myArray):
print('Splitting ', myArray)
if len(myArray) > 1:
mid = len(myArray) // 2
lefthalf = myArray[:mid]
righthalf = myArray[mid:]
merge_sort(lefthalf)
merge_sort(righthalf)
i = 0
j = 0
k = 0
while i < len(lefthalf) and j... |
class TSheetsError(Exception):
"""Exception Class to handle the failure of the request."""
def __init__(self, base_exception=None):
self.base_exception = base_exception
def __str__(self):
if self.base_exception:
return str(self.base_exception)
return "An unknown error... | class Tsheetserror(Exception):
"""Exception Class to handle the failure of the request."""
def __init__(self, base_exception=None):
self.base_exception = base_exception
def __str__(self):
if self.base_exception:
return str(self.base_exception)
return 'An unknown error o... |
"""Compatibility support for Python 2 and 3."""
try:
string_types = (basestring,)
except NameError:
string_types = (str,)
| """Compatibility support for Python 2 and 3."""
try:
string_types = (basestring,)
except NameError:
string_types = (str,) |
ATOM, BOND, DIGIT, LPAR, RPAR, LSPAR, RSPAR, PLUS, MINUS, DOT, WILDCARD, PERCENT, AT, COLON, EOF = (
'ATOM', 'BOND', 'DIGIT', '(', ')', '[', ']', '+', '-', '.', '*', '%', '@', ':', 'EOF'
)
SYMBOLS_TR = {
'=': BOND,
'#': BOND,
'$': BOND,
'/': BOND,
'\\': BOND,
'(': LPAR,
')': RPAR,
'... | (atom, bond, digit, lpar, rpar, lspar, rspar, plus, minus, dot, wildcard, percent, at, colon, eof) = ('ATOM', 'BOND', 'DIGIT', '(', ')', '[', ']', '+', '-', '.', '*', '%', '@', ':', 'EOF')
symbols_tr = {'=': BOND, '#': BOND, '$': BOND, '/': BOND, '\\': BOND, '(': LPAR, ')': RPAR, '[': LSPAR, ']': RSPAR, '+': PLUS, '-':... |
#!/usr/bin/env python3
class Flower():
color = 'unknown'
rose = Flower()
rose.color = "red"
violet = Flower()
violet.color = "blue"
this_pun_is_for_you = "The honey is sweet and so are you"
print("Roses are {},".format(rose.color))
print("violets are {},".format(violet.color))
print(this_pun_is_for_you)
| class Flower:
color = 'unknown'
rose = flower()
rose.color = 'red'
violet = flower()
violet.color = 'blue'
this_pun_is_for_you = 'The honey is sweet and so are you'
print('Roses are {},'.format(rose.color))
print('violets are {},'.format(violet.color))
print(this_pun_is_for_you) |
def query(start, end):
if start < end:
print('M {} {}'.format(start, end), flush=True)
else:
print('M {} {}'.format(end, start), flush=True)
def swap(pos1, pos2):
if pos1 < pos2:
print('S {} {}'.format(pos1, pos2), flush=True)
else:
print('S {} {}'.format(pos2, pos1), fl... | def query(start, end):
if start < end:
print('M {} {}'.format(start, end), flush=True)
else:
print('M {} {}'.format(end, start), flush=True)
def swap(pos1, pos2):
if pos1 < pos2:
print('S {} {}'.format(pos1, pos2), flush=True)
else:
print('S {} {}'.format(pos2, pos1), fl... |
# -*- mode: python -*-
DOCUMENTATION = '''
---
module: group_by
short_description: Create Ansible groups based on facts
description:
- Use facts to create ad-hoc groups that can be used later in a playbook.
version_added: "0.9"
options:
key:
description:
- The variables whose values will be used as groups
... | documentation = '\n---\nmodule: group_by\nshort_description: Create Ansible groups based on facts\ndescription:\n - Use facts to create ad-hoc groups that can be used later in a playbook.\nversion_added: "0.9"\noptions:\n key:\n description:\n - The variables whose values will be used as groups\n required: t... |
"""
10.2.1
Can you implement the dynamic-set operation INSERT on a singly linked list in O(1) time? How about DELETE?
"""
class Node:
def __init__(self, data=0, next=None):
self.data = data
self.next = next
class LinkedList:
def __init__(self):
self.head = None
"""Insertion at t... | """
10.2.1
Can you implement the dynamic-set operation INSERT on a singly linked list in O(1) time? How about DELETE?
"""
class Node:
def __init__(self, data=0, next=None):
self.data = data
self.next = next
class Linkedlist:
def __init__(self):
self.head = None
'Insertion at the ... |
#!/usr/bin/env python3
"""Advent of Code 2021 Day 12 - Passage Pathing"""
with open('inputs/day_12.txt', 'r') as aoc_input:
lines = [line.strip().split('-') for line in aoc_input.readlines()]
connections = {}
for line in lines:
from_cave, to_cave = line
if from_cave not in connections.keys():
co... | """Advent of Code 2021 Day 12 - Passage Pathing"""
with open('inputs/day_12.txt', 'r') as aoc_input:
lines = [line.strip().split('-') for line in aoc_input.readlines()]
connections = {}
for line in lines:
(from_cave, to_cave) = line
if from_cave not in connections.keys():
connections[from_cave] = se... |
#class that represents a resource
class Resource:
def __init__(self,name,id):
self.name = name
self.ID = id
self.aliases = [name]
#list of all the events this resource is involved in
#reflects when the resource worked on which object
#list of Event objects
s... | class Resource:
def __init__(self, name, id):
self.name = name
self.ID = id
self.aliases = [name]
self.events = []
def get_name(self):
return self.name
def set_name(self, name):
self.name = name
def get_id(self):
return self.ID
def add_ali... |
"""
http://adventofcode.com/2017/day/9
"""
def cleanStream(stream):
streamToClean = stream[:]
isCleaned = False
while not isCleaned:
idx = [i for i,item in enumerate(streamToClean) if item=="!"]
if len(idx)<1:
isCleaned = True
break
streamToClean = streamToClean[:idx[0]]+streamToClean[idx[0]+2:]
return... | """
http://adventofcode.com/2017/day/9
"""
def clean_stream(stream):
stream_to_clean = stream[:]
is_cleaned = False
while not isCleaned:
idx = [i for (i, item) in enumerate(streamToClean) if item == '!']
if len(idx) < 1:
is_cleaned = True
break
stream_to_clea... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 14 20:08:32 2019
@author: Parikshith.H
"""
class Date:
def __init__(self,day,month,year):
self.__day=day
self.__month=month
self.__year=year
def get_day(self):
return self.__day
def get_month(self):
return self.__month... | """
Created on Fri Jun 14 20:08:32 2019
@author: Parikshith.H
"""
class Date:
def __init__(self, day, month, year):
self.__day = day
self.__month = month
self.__year = year
def get_day(self):
return self.__day
def get_month(self):
return self.__month
def get... |
class Book():
def __init__(self, name) -> None:
self._name = name
def get_name(self):
return self._name
class BookShelf():
def __init__(self) -> None:
self._books: list[Book] = []
def append(self, book: Book):
self._books.append(book)
def get_book_at(self, index)... | class Book:
def __init__(self, name) -> None:
self._name = name
def get_name(self):
return self._name
class Bookshelf:
def __init__(self) -> None:
self._books: list[Book] = []
def append(self, book: Book):
self._books.append(book)
def get_book_at(self, index):
... |
"""from random import random
class TestDocTrackingMlflow:
def test_doc(self):
#### DOC START
from dbnd import task
from mlflow import start_run, end_run
from mlflow import log_metric, log_param
@task
def calculate_alpha():
start_run()
# param... | """from random import random
class TestDocTrackingMlflow:
def test_doc(self):
#### DOC START
from dbnd import task
from mlflow import start_run, end_run
from mlflow import log_metric, log_param
@task
def calculate_alpha():
start_run()
# param... |
# -*- coding: utf-8 -*-
def main():
s = input()
k = int(input())
count = 0
for si in s:
if si == '1':
count += 1
else:
break
if s[0] != '1':
print(s[0])
else:
if k <= count:
print(1)
else:
print(s[count])... | def main():
s = input()
k = int(input())
count = 0
for si in s:
if si == '1':
count += 1
else:
break
if s[0] != '1':
print(s[0])
elif k <= count:
print(1)
else:
print(s[count])
if __name__ == '__main__':
main() |
values = input("please fill value: ")
previous = []
result = []
def isAEIOU(value):
# value = str(value)
if value.upper() == 'A':
return True
elif value.upper() == 'E':
return True
elif value.upper() == 'I':
return True
elif value.upper() == 'O':
return True
e... | values = input('please fill value: ')
previous = []
result = []
def is_aeiou(value):
if value.upper() == 'A':
return True
elif value.upper() == 'E':
return True
elif value.upper() == 'I':
return True
elif value.upper() == 'O':
return True
elif value.upper() == 'U':
... |
__author__ = 'Shane'
class ClassToPass:
def __init__(self, int1=int(), int2=int()):
self.int1 = int1
self.int2 = int2
def gimmeTheSum(self, a, b) -> int:
return a + b | __author__ = 'Shane'
class Classtopass:
def __init__(self, int1=int(), int2=int()):
self.int1 = int1
self.int2 = int2
def gimme_the_sum(self, a, b) -> int:
return a + b |
"""Utility functions for the cargo rules"""
load("//rust/platform:triple_mappings.bzl", "system_to_binary_ext")
def _resolve_repository_template(
template,
abi = None,
arch = None,
system = None,
tool = None,
triple = None,
vendor = None,
version = None)... | """Utility functions for the cargo rules"""
load('//rust/platform:triple_mappings.bzl', 'system_to_binary_ext')
def _resolve_repository_template(template, abi=None, arch=None, system=None, tool=None, triple=None, vendor=None, version=None):
"""Render values into a repository template string
Args:
temp... |
N = input()
N = '0' + N
result = 0
carry = 0
for i in range(len(N) - 1, 0, -1):
c = int(N[i]) + carry
n = int(N[i - 1])
if c < 5 or (c == 5 and n < 5):
result += c
carry = 0
else:
result += 10 - c
carry = 1
result += carry
print(result)
| n = input()
n = '0' + N
result = 0
carry = 0
for i in range(len(N) - 1, 0, -1):
c = int(N[i]) + carry
n = int(N[i - 1])
if c < 5 or (c == 5 and n < 5):
result += c
carry = 0
else:
result += 10 - c
carry = 1
result += carry
print(result) |
class Demo:
def __init__(self, name):
self.name = name
print("Started!")
def hello(self):
print("Hey " + self.name + "!")
def goodbye(self):
print("Good-bye " + self.name + "!")
m = Demo("Alexa")
m.hello()
m.goodbye()
| class Demo:
def __init__(self, name):
self.name = name
print('Started!')
def hello(self):
print('Hey ' + self.name + '!')
def goodbye(self):
print('Good-bye ' + self.name + '!')
m = demo('Alexa')
m.hello()
m.goodbye() |
assert set([1,2]) == set([1,2])
assert not set([1,2,3]) == set([1,2])
assert set([1,2,3]) >= set([1,2])
assert set([1,2]) >= set([1,2])
assert not set([1,3]) >= set([1,2])
assert set([1,2,3]).issuperset(set([1,2]))
assert set([1,2]).issuperset(set([1,2]))
assert not set([1,3]).issuperset(set([1,2]))
assert set([1,2,... | assert set([1, 2]) == set([1, 2])
assert not set([1, 2, 3]) == set([1, 2])
assert set([1, 2, 3]) >= set([1, 2])
assert set([1, 2]) >= set([1, 2])
assert not set([1, 3]) >= set([1, 2])
assert set([1, 2, 3]).issuperset(set([1, 2]))
assert set([1, 2]).issuperset(set([1, 2]))
assert not set([1, 3]).issuperset(set([1, 2]))
... |
def makeGood(s: str) -> str:
stack = []
for i in range(len(s)):
if stack and ((s[i].isupper() and stack[-1] == s[i].lower()) or
(s[i].islower() and stack[-1] == s[i].upper())):
stack.pop()
else:
stack.append(s[i])
return ''.join(stack) | def make_good(s: str) -> str:
stack = []
for i in range(len(s)):
if stack and (s[i].isupper() and stack[-1] == s[i].lower() or (s[i].islower() and stack[-1] == s[i].upper())):
stack.pop()
else:
stack.append(s[i])
return ''.join(stack) |
"""
# Definition for a Node.
class Node(object):
def __init__(self, val, children):
self.val = val
self.children = children
"""
class Solution(object):
def levelOrder(self, root):
"""
:type root: Node
:rtype: List[List[int]]
"""
if not root:
re... | """
# Definition for a Node.
class Node(object):
def __init__(self, val, children):
self.val = val
self.children = children
"""
class Solution(object):
def level_order(self, root):
"""
:type root: Node
:rtype: List[List[int]]
"""
if not root:
... |
#Given a binary tree, return all root-to-leaf paths.
# dfs+stack, bfs+queue, dfs recursively
class Solution:
def binaryTreePaths1(self, root):
if not root:
return []
res, stack = [], [(root, "")]
while stack:
node, ls = stack.pop()
if not node.left and no... | class Solution:
def binary_tree_paths1(self, root):
if not root:
return []
(res, stack) = ([], [(root, '')])
while stack:
(node, ls) = stack.pop()
if not node.left and (not node.right):
res.append(ls + str(node.val))
if node.ri... |
class Solution:
def diagonalSum(self, mat: List[List[int]]) -> int:
sum = 0
n = len(mat)
for i in range(n):
sum += mat[i][i]
if i != n - 1 - i:
sum += mat[i][n - 1 - i]
return sum
| class Solution:
def diagonal_sum(self, mat: List[List[int]]) -> int:
sum = 0
n = len(mat)
for i in range(n):
sum += mat[i][i]
if i != n - 1 - i:
sum += mat[i][n - 1 - i]
return sum |
def courses_list(user=None):
user = auth.user if not user else db(db.users.id==user).select().first()
if user.type_==1:
courses = db(db.registered_courses.professor==user.id).select(db.registered_courses.course_id)
courses = map(lambda x: x.course_id, courses)
else:
courses = db(db.student_registrations.... | def courses_list(user=None):
user = auth.user if not user else db(db.users.id == user).select().first()
if user.type_ == 1:
courses = db(db.registered_courses.professor == user.id).select(db.registered_courses.course_id)
courses = map(lambda x: x.course_id, courses)
else:
courses = d... |
def check_inners(rule):
if target in rules[rule]:
return 1
for bag in rules[rule]:
if check_inners(bag):
return 1
return 0
def part1():
count = 0
for rule in rules:
#print(rule)
if rule == target:
next
else:
count += check_... | def check_inners(rule):
if target in rules[rule]:
return 1
for bag in rules[rule]:
if check_inners(bag):
return 1
return 0
def part1():
count = 0
for rule in rules:
if rule == target:
next
else:
count += check_inners(rule)
prin... |
#practice using data structures and several algorithms
#compiled all classes into one
class Node:
def __init__(self, data):
self.data = data
self.next = None
class BinaryNode:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
self.val = data
class... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Binarynode:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
self.val = data
class Graphnode:
def __init__(self, data, adj=[], visited=0):
s... |
# list(map(int, input().split()))
# int(input())
def main(X, Y):
cand = Y // 4
for i in range(cand, -1, -1):
if i * 4 + (X - i) * 2 == Y:
print('Yes')
exit()
else:
print('No')
if __name__ == '__main__':
X, Y = list(map(int, input().split()))
main(X, Y)
| def main(X, Y):
cand = Y // 4
for i in range(cand, -1, -1):
if i * 4 + (X - i) * 2 == Y:
print('Yes')
exit()
else:
print('No')
if __name__ == '__main__':
(x, y) = list(map(int, input().split()))
main(X, Y) |
class Solution:
def peakIndexInMountainArray(self, arr: List[int]) -> int:
count = 0
for i in range(len(arr)-1):
if arr[i] < arr[i+1]:
count += 1
return count
| class Solution:
def peak_index_in_mountain_array(self, arr: List[int]) -> int:
count = 0
for i in range(len(arr) - 1):
if arr[i] < arr[i + 1]:
count += 1
return count |
def mutate_kernel_size(kernel):
return None
def mutate_stride(stride):
return None
def mutate_padding(padding):
return None
def mutate_filter(filter):
return None | def mutate_kernel_size(kernel):
return None
def mutate_stride(stride):
return None
def mutate_padding(padding):
return None
def mutate_filter(filter):
return None |
# Check a number for prime....
a = int(input("Enter Number: "))
c = 0
for i in range(1, a+1):
if a % i == 0:
c += 1
if c == 2:
print("Prime")
else:
print("Not Prime")
| a = int(input('Enter Number: '))
c = 0
for i in range(1, a + 1):
if a % i == 0:
c += 1
if c == 2:
print('Prime')
else:
print('Not Prime') |
def readint(msg):
ok = False
value = 0
while True:
n1 = str(input(msg))
if n1.isnumeric():
value = int(n1)
ok = True
else:
print('\033[0;31mError! Please enter a valid number. \033[m')
if ok:
break
return value
n = readint... | def readint(msg):
ok = False
value = 0
while True:
n1 = str(input(msg))
if n1.isnumeric():
value = int(n1)
ok = True
else:
print('\x1b[0;31mError! Please enter a valid number. \x1b[m')
if ok:
break
return value
n = readint('... |
# https://leetcode.com/problems/keys-and-rooms/
class Solution:
def canVisitAllRooms(self, rooms: List[List[int]]) -> bool:
return self.dfs(rooms, 0, set())
def dfs(self, rooms: List[List[int]], node: int, visited: set[int]) -> bool:
if node in visited:
return False
vis... | class Solution:
def can_visit_all_rooms(self, rooms: List[List[int]]) -> bool:
return self.dfs(rooms, 0, set())
def dfs(self, rooms: List[List[int]], node: int, visited: set[int]) -> bool:
if node in visited:
return False
visited.add(node)
if len(visited) == len(roo... |
c = float(input())
n = int(input())
t=0
for each in range(n):
h,w = list(map(float, input().split()))
t+= h*w*c
print("{:.8f}".format(t))
| c = float(input())
n = int(input())
t = 0
for each in range(n):
(h, w) = list(map(float, input().split()))
t += h * w * c
print('{:.8f}'.format(t)) |
class Dsu:
def __init__(self, n, ranked):
self.parents = [i for i in range(n)]
self.ranked = ranked
self.ranks = [0 for i in range(n)]
self.messages = [0 for i in range(n)]
self.read = [0 for i in range(n)]
def find(self, v):
if v == self.parents[v]:
... | class Dsu:
def __init__(self, n, ranked):
self.parents = [i for i in range(n)]
self.ranked = ranked
self.ranks = [0 for i in range(n)]
self.messages = [0 for i in range(n)]
self.read = [0 for i in range(n)]
def find(self, v):
if v == self.parents[v]:
... |
"""
Exceptions
~~~~~~~~~~
Custom exceptions raised by the phenotype service.
"""
class PhenotypeError(Exception):
pass
| """
Exceptions
~~~~~~~~~~
Custom exceptions raised by the phenotype service.
"""
class Phenotypeerror(Exception):
pass |
'''
A simple exercie sript to find out total pay by multiplying hours worked with
rate per hour.
'''
hr1 = input('Enter Hours: ')
rate1 = input('Enter Rate: ')
# made failure proof so if user inputs values other than number it won't crash
# and through an error. so the program will just quit with following warning
# ... | """
A simple exercie sript to find out total pay by multiplying hours worked with
rate per hour.
"""
hr1 = input('Enter Hours: ')
rate1 = input('Enter Rate: ')
try:
hrs = float(hr1)
rate = float(rate1)
except:
print('Failure: Enter Integers Only')
quit()
pay = float(hrs * rate)
print('Pay:', pay) |
spark = SparkSession \
.builder \
.appName("exercise_eighteen") \
.getOrCreate()
(df.select("id", "first_name", "last_name", "gender", "country", "birthdate", "salary")
.filter(df["country"] == "United States")
.orderBy(df["gender"].asc(), df["salary"].asc())
.show())
df.select("id", "first_name", "las... | spark = SparkSession.builder.appName('exercise_eighteen').getOrCreate()
df.select('id', 'first_name', 'last_name', 'gender', 'country', 'birthdate', 'salary').filter(df['country'] == 'United States').orderBy(df['gender'].asc(), df['salary'].asc()).show()
df.select('id', 'first_name', 'last_name', 'gender', 'country', '... |
"""utils.py"""
def param_dict(param_list):
"""param_dict"""
dct = {}
for param in param_list:
dct[param.key] = param
return dct
| """utils.py"""
def param_dict(param_list):
"""param_dict"""
dct = {}
for param in param_list:
dct[param.key] = param
return dct |
#personaldetails
print("NAME: Jaskeerat Singh \nE-MAIL: jsing322@uwo.ca \nSLACK USERNAME: @jass \nBIOSTACK: Genomics \nTwitter Handle: @jsin")
def hamming_distance(a,b):
count=0
for i in range(len(a)):
if a[i] != b[i]:
count +=1
return count
print(hamming_distance('@jass','@jsin'))
| print('NAME: Jaskeerat Singh \nE-MAIL: jsing322@uwo.ca \nSLACK USERNAME: @jass \nBIOSTACK: Genomics \nTwitter Handle: @jsin')
def hamming_distance(a, b):
count = 0
for i in range(len(a)):
if a[i] != b[i]:
count += 1
return count
print(hamming_distance('@jass', '@jsin')) |
# autogenerated by /home/astivala/phd/ptgraph/buildversion.sh
# Fri Aug 10 09:43:43 EST 2012
def get_version():
"""
Return version string containing global version number and 'build' date
"""
return "Revision 4288:4291, Fri Aug 10 09:43:43 EST 2012"
| def get_version():
"""
Return version string containing global version number and 'build' date
"""
return 'Revision 4288:4291, Fri Aug 10 09:43:43 EST 2012' |
"""Role testing files using testinfra."""
def test_lvm_package_shall_be_installed(host):
assert host.package("lvm2").is_installed
def test_non_persistent_volume_group_is_created(host):
command = """sudo vgdisplay | grep -c 'non-persistent'"""
cmd = host.run(command)
assert '1' in cmd.stdout
def te... | """Role testing files using testinfra."""
def test_lvm_package_shall_be_installed(host):
assert host.package('lvm2').is_installed
def test_non_persistent_volume_group_is_created(host):
command = "sudo vgdisplay | grep -c 'non-persistent'"
cmd = host.run(command)
assert '1' in cmd.stdout
def test_thin... |
"""
Get Height of Binary Tree
"""
class Node:
def __init__(self, data, left=None, right=None):
self.data = data
self.left = left
self.right = right
def get_height(root):
"""
>>> assert(get_height(None) == -1)
>>> root = Node(1)
>>> assert(get_height(root) == 0)
>>> ro... | """
Get Height of Binary Tree
"""
class Node:
def __init__(self, data, left=None, right=None):
self.data = data
self.left = left
self.right = right
def get_height(root):
"""
>>> assert(get_height(None) == -1)
>>> root = Node(1)
>>> assert(get_height(root) == 0)
>>> roo... |
# Time: O(logn)
# Space: O(1)
class Solution(object):
def toHex(self, num):
"""
:type num: int
:rtype: str
"""
if not num:
return "0"
result = []
while num and len(result) != 8:
h = num & 15
if h < 10:
res... | class Solution(object):
def to_hex(self, num):
"""
:type num: int
:rtype: str
"""
if not num:
return '0'
result = []
while num and len(result) != 8:
h = num & 15
if h < 10:
result.append(str(chr(ord('0') + h... |
class Interface(object):
def __init__(self, name, idx, addrwidth, datawidth, lite=False):
self.name = name
self.idx = idx
self.datawidth = datawidth
self.addrwidth = addrwidth
self.lite = lite
def __repr__(self):
ret = []
ret.append('(')
ret.appen... | class Interface(object):
def __init__(self, name, idx, addrwidth, datawidth, lite=False):
self.name = name
self.idx = idx
self.datawidth = datawidth
self.addrwidth = addrwidth
self.lite = lite
def __repr__(self):
ret = []
ret.append('(')
ret.appe... |
class HierarchicalDataTemplate(DataTemplate,INameScope,ISealable,IHaveResources,IQueryAmbient):
"""
Represents a System.Windows.DataTemplate that supports System.Windows.Controls.HeaderedItemsControl,such as System.Windows.Controls.TreeViewItem or System.Windows.Controls.MenuItem.
HierarchicalDataTemplate()
... | class Hierarchicaldatatemplate(DataTemplate, INameScope, ISealable, IHaveResources, IQueryAmbient):
"""
Represents a System.Windows.DataTemplate that supports System.Windows.Controls.HeaderedItemsControl,such as System.Windows.Controls.TreeViewItem or System.Windows.Controls.MenuItem.
HierarchicalDataTemplate... |
{
'includes': [
'deps/common.gypi',
],
'variables': {
'gtest%': 0,
'gtest_static_libs%': [],
'glfw%': 0,
'glfw_static_libs%': [],
'mason_platform': 'osx',
},
'targets': [
{ 'target_name': 'geojsonvt',
'product_name': 'geojsonvt',
'type': 'static_library',
'standal... | {'includes': ['deps/common.gypi'], 'variables': {'gtest%': 0, 'gtest_static_libs%': [], 'glfw%': 0, 'glfw_static_libs%': [], 'mason_platform': 'osx'}, 'targets': [{'target_name': 'geojsonvt', 'product_name': 'geojsonvt', 'type': 'static_library', 'standalone_static_library': 1, 'include_dirs': ['include'], 'sources': [... |
print(True)
print(False)
print("True")
print("False")
print(5 == 1)
print(5 != 1)
print("Ham" == "Ham")
print("ham " == "ham")
print(5 == 5.0)
print(5 < 1)
print(5 >= 5)
print(5 < 8 <= 7) | print(True)
print(False)
print('True')
print('False')
print(5 == 1)
print(5 != 1)
print('Ham' == 'Ham')
print('ham ' == 'ham')
print(5 == 5.0)
print(5 < 1)
print(5 >= 5)
print(5 < 8 <= 7) |
class Animal:
def __init__(self, leg_count=4): # Constructor, initializes the new obj
# Print("constructor called!")
self.leg_count = leg_count
self.likes_food = True
def get_leg_count(self): # getter
return self.leg_count
def set_leg_count(self, leg_count): # setter
... | class Animal:
def __init__(self, leg_count=4):
self.leg_count = leg_count
self.likes_food = True
def get_leg_count(self):
return self.leg_count
def set_leg_count(self, leg_count):
self.leg_count = leg_count
cat = animal()
dog = animal()
centipede = animal(100)
rabbits = [a... |
def check(x):
""" Checking for password format
Format::: (min)-(max) (letter): password
"""
count = 0
dashIndex = x.find('-')
colonIndex = x.find(':')
minCount = int(x[:dashIndex]) - 1
maxCount = int(x[(dashIndex + 1):(colonIndex - 2)]) - 1
letter = x[colonIndex - 1]
password = x... | def check(x):
""" Checking for password format
Format::: (min)-(max) (letter): password
"""
count = 0
dash_index = x.find('-')
colon_index = x.find(':')
min_count = int(x[:dashIndex]) - 1
max_count = int(x[dashIndex + 1:colonIndex - 2]) - 1
letter = x[colonIndex - 1]
password = x... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exporting modules of Clastering Algorithms Benchmarking Framework
algorithms/ - evaluating algorithms
utils/ - evaluation utilities
benchapps - evaluating algorithms executors
benchevals - evaluation utilities (and measures) executors
benchmark - the benchmark... | """Exporting modules of Clastering Algorithms Benchmarking Framework
algorithms/ - evaluating algorithms
utils/ - evaluation utilities
benchapps - evaluating algorithms executors
benchevals - evaluation utilities (and measures) executors
benchmark - the benchmarking framework
benchutils - [internal] access... |
a = float(input())
b = float(input())
peso_nota_a = 3.5
peso_nota_b = 7.5
media = (a * peso_nota_a + b * peso_nota_b) / (peso_nota_a + peso_nota_b)
print(f"MEDIA = {media:.5f}")
| a = float(input())
b = float(input())
peso_nota_a = 3.5
peso_nota_b = 7.5
media = (a * peso_nota_a + b * peso_nota_b) / (peso_nota_a + peso_nota_b)
print(f'MEDIA = {media:.5f}') |
class Node(object):
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def __str__(self):
return str(self.data)
class AVL_Tree(object):
def height(self,root):
if not root:
return -1
else:
hl = self.hei... | class Node(object):
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def __str__(self):
return str(self.data)
class Avl_Tree(object):
def height(self, root):
if not root:
return -1
else:
hl = self.height... |
# enter the Chocolate Rooom
ownername = "Daw Hla"
playerlives = 2
chocolate = 2
print("Welcome to the Chocolate Room. I am the owner of this sweet shop, my name is " + ownername)
print("You must answer this question.")
# add an input statement to ask the question on the next line and store the response in a variable c... | ownername = 'Daw Hla'
playerlives = 2
chocolate = 2
print('Welcome to the Chocolate Room. I am the owner of this sweet shop, my name is ' + ownername)
print('You must answer this question.')
print('Which of the following could be used as a good password')
print("1. Your pet's name. 2. Password123 3. A random collection... |
'''
https://leetcode.com/contest/weekly-contest-150/problems/as-far-from-land-as-possible/
'''
diffs = [(1, 0), (0, 1), (-1, 0), (0, -1)]
class Cell:
def __init__(self, x, y, dist=0):
self.dist = dist
self.x, self.y = x, y
class Solver:
def __init__(self, grid):
self.g = grid
s... | """
https://leetcode.com/contest/weekly-contest-150/problems/as-far-from-land-as-possible/
"""
diffs = [(1, 0), (0, 1), (-1, 0), (0, -1)]
class Cell:
def __init__(self, x, y, dist=0):
self.dist = dist
(self.x, self.y) = (x, y)
class Solver:
def __init__(self, grid):
self.g = grid
... |
f=str(input('Digite uma frase: ')).strip().upper()
print('Tem {} A na frase.'.format(f.count('A')))
print('O primeiro A esta em {} letra.'.format(f.find('A')+1))
print('O ultimo A esta em {} letra.'.format(f.rfind('A')+1))
| f = str(input('Digite uma frase: ')).strip().upper()
print('Tem {} A na frase.'.format(f.count('A')))
print('O primeiro A esta em {} letra.'.format(f.find('A') + 1))
print('O ultimo A esta em {} letra.'.format(f.rfind('A') + 1)) |
def start_room():
return "room1"
| def start_room():
return 'room1' |
node = S(input, "application/json")
childNode = node.prop("orderDetails")
property = childNode.prop("article")
value = property.stringValue()
| node = s(input, 'application/json')
child_node = node.prop('orderDetails')
property = childNode.prop('article')
value = property.stringValue() |
bit_list = [19, 17, 16, 18, 26, 24, 22, 21, 23, 25]
value = 5808
for bit in bit_list:
new_value = value + 2 ** bit
print(value, new_value-1)
value = new_value
| bit_list = [19, 17, 16, 18, 26, 24, 22, 21, 23, 25]
value = 5808
for bit in bit_list:
new_value = value + 2 ** bit
print(value, new_value - 1)
value = new_value |
class Solution:
# @return a string
def minWindow(self, S, T):
s = S
t = T
d = {}
td = {}
for c in t:
td[c] = td.get(c, 0) + 1
left = 0
right = 0
lefts = []
rights = []
for i, c in enumerate(s):
if c in td:
... | class Solution:
def min_window(self, S, T):
s = S
t = T
d = {}
td = {}
for c in t:
td[c] = td.get(c, 0) + 1
left = 0
right = 0
lefts = []
rights = []
for (i, c) in enumerate(s):
if c in td:
d[c] ... |
class Solution:
def canJump(self, nums: List[int]) -> bool:
if not nums or len(nums) == 0:
return False
target = len(nums) - 1
for i in range(len(nums) - 1, -1, -1):
if (nums[i] + i >= target):
target = i
return targe... | class Solution:
def can_jump(self, nums: List[int]) -> bool:
if not nums or len(nums) == 0:
return False
target = len(nums) - 1
for i in range(len(nums) - 1, -1, -1):
if nums[i] + i >= target:
target = i
return target == 0 |
print ("How old are you?"),
age = input()
print ("How tall are you?"),
height = input()
print ("How much do you weigh?"),
weight = input()
print ("So you are %r old, %r tall and %r heavy!"%(age,weight,height) )
| (print('How old are you?'),)
age = input()
(print('How tall are you?'),)
height = input()
(print('How much do you weigh?'),)
weight = input()
print('So you are %r old, %r tall and %r heavy!' % (age, weight, height)) |
a=int(input("enter number:"))
b=int(input("enter number:"))
c=int(input("enter number:"))
d=int(input("enter number:"))
total=a+b+c+d
average=total/4
print("total=",total)
print("average=",average)
| a = int(input('enter number:'))
b = int(input('enter number:'))
c = int(input('enter number:'))
d = int(input('enter number:'))
total = a + b + c + d
average = total / 4
print('total=', total)
print('average=', average) |
# test decorators
def dec(f):
print('dec')
return f
def dec_arg(x):
print(x)
return lambda f:f
# plain decorator
@dec
def f():
pass
# decorator with arg
@dec_arg('dec_arg')
def g():
pass
# decorator of class
@dec
class A:
pass
print("PASS") | def dec(f):
print('dec')
return f
def dec_arg(x):
print(x)
return lambda f: f
@dec
def f():
pass
@dec_arg('dec_arg')
def g():
pass
@dec
class A:
pass
print('PASS') |
def read_E_matrix():
# # physical distance
# E = [[1, 1, 0, 0, 1, 1],
# [1, 1, 1, 1, 1, 0],
# [0, 1, 1, 1, 0, 0],
# [0, 1, 1, 1, 0, 0],
# [1, 1, 0, 0, 1, 0],
# [1, 0, 0, 0, 0, 1]
# ]
# fully connected
# E = [[1, 1, 1, 1, 1, 1],
# [1, 1, 1, 1... | def read_e_matrix():
e = [[1, 0, 1, 0, 1, 1], [0, 1, 0, 0, 0, 1], [1, 0, 1, 0, 0, 1], [0, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 0], [1, 1, 1, 0, 0, 1]]
return E
def graph_random(i):
if i == 6:
e = [[1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 1], [0, 1, ... |
# Databricks notebook source
# MAGIC %run ./_utility-methods $lesson="dlt_lab_82"
# COMMAND ----------
# MAGIC %run ./mount-datasets
# COMMAND ----------
# def print_sql(rows, sql):
# displayHTML(f"""<body><textarea style="width:100%" rows={rows}> \n{sql.strip()}</textarea></body>""")
# COMMAND ----------... | def print_pipeline_config():
display_html(f'<table>\n <tr><td>Pipeline Name:</td><td><b>DLT-Lab-82L-{DA.username}</b></td></tr>\n <tr><td>Source:</td><td><b>{DA.paths.working_dir}/source/tracker</b></td></tr>\n <tr><td>Target:</td><td><b>{DA.db_name}</b></td></tr>\n <tr><td>Storage Location:</td><td><b>... |
# color mixer
print("Red, blue, and yellow are primary colors.")
print()
# ask user to choose two primary colors to mix
color1 = input("Enter the primary color 1 (red,blue, or yellow): ")
color2 = input("Enter the primary color 2 (red,blue, or yellow): ")
if color1 == "red" and color2 == "blue":
print("The seco... | print('Red, blue, and yellow are primary colors.')
print()
color1 = input('Enter the primary color 1 (red,blue, or yellow): ')
color2 = input('Enter the primary color 2 (red,blue, or yellow): ')
if color1 == 'red' and color2 == 'blue':
print('The secondary color is purple.')
elif color1 == 'blue' and color2 == 'red... |
# Non-MacOS users can change it to Chrome/Firefox.
BROWSER = "Chrome" # can be Chrome/Safari/Firefox
MATCH_URL = "http://www.espncricinfo.com/series/8039/commentary/1144506/afghanistan-vs-england-24th-match-icc-cricket-world-cup-2019"
MESSAGE_BOX_CLASS_NAME = "_3u328"
SEND_BUTTON_CLASS_NAME = "_3M-N-"
# Match start ti... | browser = 'Chrome'
match_url = 'http://www.espncricinfo.com/series/8039/commentary/1144506/afghanistan-vs-england-24th-match-icc-cricket-world-cup-2019'
message_box_class_name = '_3u328'
send_button_class_name = '_3M-N-'
match_start_hours = 13
match_start_minutes = 30
match_end_hours = 23
match_end_minutes = 0
script_l... |
# REST API server related constants
USERNAME = "asdfg"
PASSWORD = "asdfg"
HOST = "http://127.0.0.1:8000"
AUTH_URL: str = f"{HOST}/auth/"
LOCATIONS_URL: str = f"{HOST}/api/locations/"
PANIC_URL: str = f"{HOST}/api/panic/"
# Format constants
DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"
PRECISION = 6
# Job scheduling cons... | username = 'asdfg'
password = 'asdfg'
host = 'http://127.0.0.1:8000'
auth_url: str = f'{HOST}/auth/'
locations_url: str = f'{HOST}/api/locations/'
panic_url: str = f'{HOST}/api/panic/'
datetime_format = '%Y-%m-%dT%H:%M:%S.%fZ'
precision = 6
time_panic = 1
time_no_panic = 5
time_check_panic = 3
log_file = 'gps_tracker.l... |
LOCK = False
RELEASE = True
VERSION = "19.99.0"
VERSION_AGAIN = "19.99.0"
STRICT_VERSION = "19.99.0"
UNRELATED_STRING = "apple"
| lock = False
release = True
version = '19.99.0'
version_again = '19.99.0'
strict_version = '19.99.0'
unrelated_string = 'apple' |
def dec_to_bin(dec):
bin_num = ''
while dec > 0:
bin_num = str(dec % 2) + bin_num
dec //= 2
return bin_num
if __name__ == "__main__":
dec_num = int(input())
print(dec_to_bin(dec_num))
| def dec_to_bin(dec):
bin_num = ''
while dec > 0:
bin_num = str(dec % 2) + bin_num
dec //= 2
return bin_num
if __name__ == '__main__':
dec_num = int(input())
print(dec_to_bin(dec_num)) |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# author: ouyangshaokun
# date:
print(44444444444)
print("fsfasfaa")
print(22222222)
print("fsfasfa")
print(123214)
print(22222222)
print(22222222)
print(22222222)
print(22222222)
print(22222222)
print(22222222)
print(42342) | print(44444444444)
print('fsfasfaa')
print(22222222)
print('fsfasfa')
print(123214)
print(22222222)
print(22222222)
print(22222222)
print(22222222)
print(22222222)
print(22222222)
print(42342) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.