content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2020 Niko Sandschneider
"""
easyp2p is an application for downloading and aggregating account statements
from several people-to-people (P2P) lending platforms.
"""
__version__ = '0.0.1'
| """
easyp2p is an application for downloading and aggregating account statements
from several people-to-people (P2P) lending platforms.
"""
__version__ = '0.0.1' |
# -*- coding: utf-8 -*-
__description__ = u'RPZ-IR-Sensor Utility'
__long_description__ = u'''RPZ-IR-Sensor Utility
'''
__author__ = u'osoken'
__email__ = u'osoken.devel@outlook.jp'
__version__ = '0.0.0'
__package_name__ = u'pyrpzirsensor'
| __description__ = u'RPZ-IR-Sensor Utility'
__long_description__ = u'RPZ-IR-Sensor Utility\n'
__author__ = u'osoken'
__email__ = u'osoken.devel@outlook.jp'
__version__ = '0.0.0'
__package_name__ = u'pyrpzirsensor' |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def averageOfLevels(self, root):
"""
:type root: TreeNode
:rtype: List[float]
"""
... | class Solution(object):
def average_of_levels(self, root):
"""
:type root: TreeNode
:rtype: List[float]
"""
res = []
self.getLevel(root, 0, res)
return [sum(line) / float(len(line)) for line in res]
def get_level(self, root, level, res):
if not r... |
#Replace APIKEY with your Metoffice Datapoint API key, and LOCATION with
# the location you want weather for.
# Get your location from:
# http://datapoint.metoffice.gov.uk/public/data/val/wxfcs/all/json/sitelist?key=<your key here>
APIKEY = "<your key here>"
LOCATION = "<your location here>"
| apikey = '<your key here>'
location = '<your location here>' |
#
# PySNMP MIB module HUAWEI-AAA-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-AAA-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:30:41 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, value_size_constraint, constraints_intersection, single_value_constraint) ... |
class Version():
main = 0x68000001
test = 0x98000001
mijin = 0x60000001
class TransactionType():
transfer_transaction = 0x0101
importance_transfer_transaction = 0x0801
multisig_aggregate_modification_transfer_transaction = 0x1001
multisig_signature_transaction = 0x1002
multisig_transaction = 0x1004
provision_... | class Version:
main = 1744830465
test = 2550136833
mijin = 1610612737
class Transactiontype:
transfer_transaction = 257
importance_transfer_transaction = 2049
multisig_aggregate_modification_transfer_transaction = 4097
multisig_signature_transaction = 4098
multisig_transaction = 4100
... |
# Copyright (c) 2018, MD2K Center of Excellence
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditio... | """
Takes as input raw datastreams from motionsenseHRV and decodes them
to get the Accelerometer, Gyroscope, PPG, Sequence number timeseries.
Last of all it does timestamp correction on all the timeseries and saves them.
Algorithm::
Input:
Raw datastream of motionsenseHRV and motionsenseHRV+
Ea... |
FreeSans9pt7bBitmaps = [
0xFF, 0xFF, 0xF8, 0xC0, 0xDE, 0xF7, 0x20, 0x09, 0x86, 0x41, 0x91, 0xFF,
0x13, 0x04, 0xC3, 0x20, 0xC8, 0xFF, 0x89, 0x82, 0x61, 0x90, 0x10, 0x1F,
0x14, 0xDA, 0x3D, 0x1E, 0x83, 0x40, 0x78, 0x17, 0x08, 0xF4, 0x7A, 0x35,
0x33, 0xF0, 0x40, 0x20, 0x38, 0x10, 0xEC, 0x20, 0xC6, 0x20, 0xC... | free_sans9pt7b_bitmaps = [255, 255, 248, 192, 222, 247, 32, 9, 134, 65, 145, 255, 19, 4, 195, 32, 200, 255, 137, 130, 97, 144, 16, 31, 20, 218, 61, 30, 131, 64, 120, 23, 8, 244, 122, 53, 51, 240, 64, 32, 56, 16, 236, 32, 198, 32, 198, 64, 198, 64, 108, 128, 57, 0, 1, 60, 2, 119, 2, 99, 4, 99, 4, 119, 8, 60, 14, 6, 96, ... |
# pop]Remove element by index [].pop
planets = ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter']
print(planets) # ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter']
third = planets.pop(2)
print(third) # Earth
print(planets) # ['Mercury', 'Venus', 'Mars', 'Jupiter']
last = planets.pop()
print(last) # Jupiter
print(planet... | planets = ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter']
print(planets)
third = planets.pop(2)
print(third)
print(planets)
last = planets.pop()
print(last)
print(planets)
jupyter_landers = [] |
def getmonthdays(y, m):
if (m == 2):
if (isleapyear(y)):
return 29
else:
return 28
else:
return {
1: 31, 3: 31, 4: 40,
5: 31, 6: 30, 7: 31,
8: 31, 9: 30, 10: 31,
11: 30, 12: 31
}[m]
def isleapyear(y):
r... | def getmonthdays(y, m):
if m == 2:
if isleapyear(y):
return 29
else:
return 28
else:
return {1: 31, 3: 31, 4: 40, 5: 31, 6: 30, 7: 31, 8: 31, 9: 30, 10: 31, 11: 30, 12: 31}[m]
def isleapyear(y):
return y % 4 == 0 and y % 100 != 0 or y % 400 == 0
def getdays(... |
class GirlFriend:
girlfriend = False
def __init__(self,exist):
self.girlfriend = exist
self.girlfriend = False
GirlFriend.girlfriend = False
print(" No. She doesn't exist! :( ")
def exists(self):
return False | class Girlfriend:
girlfriend = False
def __init__(self, exist):
self.girlfriend = exist
self.girlfriend = False
GirlFriend.girlfriend = False
print(" No. She doesn't exist! :( ")
def exists(self):
return False |
# SheetManager Exceptions
class GoogleConnectionException(Exception):
pass
class InitSheetManagerException(Exception):
pass
class AuthSheetManagerException(Exception):
pass
class CreateSheetException(Exception):
pass
class OpenSheetException(Exception):
pass
class WriteTableException(Excep... | class Googleconnectionexception(Exception):
pass
class Initsheetmanagerexception(Exception):
pass
class Authsheetmanagerexception(Exception):
pass
class Createsheetexception(Exception):
pass
class Opensheetexception(Exception):
pass
class Writetableexception(Exception):
pass
class Protectc... |
onnx = []
verbose = 0
header = ["include/operators"]
no_header = 0
force_header = 0
resolve = ["src/operators/resolve"]
no_resolve = 0
force_resolve = 0
sets = ["src/operators/"]
no_sets = 0
stubs = ["src/operators/implementation"]
force_sets = 0
no_stubs = 0
force_stubs = 0
info = ["src/operators/info"]
no_info = 0
f... | onnx = []
verbose = 0
header = ['include/operators']
no_header = 0
force_header = 0
resolve = ['src/operators/resolve']
no_resolve = 0
force_resolve = 0
sets = ['src/operators/']
no_sets = 0
stubs = ['src/operators/implementation']
force_sets = 0
no_stubs = 0
force_stubs = 0
info = ['src/operators/info']
no_info = 0
fo... |
#!/usr/bin/env-python3
print('Welcome to a hello word for python.')
name = input("Please enter you name: ")
print("Hi " + name + " welcome to python")
print("python is very powerful")
| print('Welcome to a hello word for python.')
name = input('Please enter you name: ')
print('Hi ' + name + ' welcome to python')
print('python is very powerful') |
# Build a program that create an automatic pizza order
# Consider that there are three types of pizza: Small ($15), Medium ($20) and large ($25)
# If you want to add pepperoni, you will need to add $2 for a small pizza
# For the Medium or large one, you will need to add $3
# If you want extra cheese, the added price wi... | total_bill = 0
print('Welcome to Python Pizza Deliveries!')
pizza_size = input('What size of pizza do you want? S, M L \n')
pepperoni_option = input('Do you want pepperoni? Y, N \n')
extra_cheese = input('Do you want extra cheese? Y, N \n')
small_p = 15
medium_p = 20
large_p = 25
if pizzaSize == 'S':
total_bill = t... |
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified).
__all__ = ['hello_world']
# Cell
def hello_world(world):
"""
This function says hello to the `world`
"""
print("hello ", world) | __all__ = ['hello_world']
def hello_world(world):
"""
This function says hello to the `world`
"""
print('hello ', world) |
Names = ["Jack", "Cian", "Leah", "Elliot", "Cai", "Eben"]
print("Hello how are you " + Names[0])
print("Hello how are you " + Names[1])
print("Hello how are you " + Names[2])
print("Hello how are you " + Names[3])
print("Hello how are you " + Names[4])
print("Hello how are you " + Names[5])
| names = ['Jack', 'Cian', 'Leah', 'Elliot', 'Cai', 'Eben']
print('Hello how are you ' + Names[0])
print('Hello how are you ' + Names[1])
print('Hello how are you ' + Names[2])
print('Hello how are you ' + Names[3])
print('Hello how are you ' + Names[4])
print('Hello how are you ' + Names[5]) |
'''
stemdiff.const
--------------
Constants for package stemdiff.
'''
# Key constants
# (these costants are not expected to change for given microscope
# (they can be adjusted if the program is used for a different microscope
DET_SIZE = 256
'''DET_SIZE = size of pixelated detector (in pixels :-)'''
RESC... | """
stemdiff.const
--------------
Constants for package stemdiff.
"""
det_size = 256
'DET_SIZE = size of pixelated detector (in pixels :-)'
rescale = 4
'RESCALE = scaling coefficient: final image size = DET_SIZE * RESCALE'
class Centering:
"""
Set parameters for determination of center of 4D-STEM datafiles.
... |
# using for loops with the range function
# https://www.udemy.com/course/100-days-of-code/learn/lecture/18085735#content
'''
# start value a is first number
# end value b is last value but is not included in range
for number in range (a, b):
print(number)
'''
# print all values between 1 through 10
for num... | """
# start value a is first number
# end value b is last value but is not included in range
for number in range (a, b):
print(number)
"""
for number in range(1, 11):
print(number)
'\n# add a step c for a number pattern in the range\nfor number in range (a, b, c):\n print(number)\n\n'
for number in ra... |
def birthday_ranges(birthdays, ranges):
list_of_number_of_birthdays = []
for start, end in ranges:
number = 0
for current_birthday in birthdays:
if current_birthday in range(start, end):
number += 1
list_of_number_of_birthdays.append(number)
return list_o... | def birthday_ranges(birthdays, ranges):
list_of_number_of_birthdays = []
for (start, end) in ranges:
number = 0
for current_birthday in birthdays:
if current_birthday in range(start, end):
number += 1
list_of_number_of_birthdays.append(number)
return list_... |
class Solution:
def majorityElement(self, nums: List[int]) -> int:
#using hashmap or dictionary as is called in python
count = {}
for i in nums:
if i in count:
count[i] += 1
else:
count[i] = 1
if count[i] > len(nums)... | class Solution:
def majority_element(self, nums: List[int]) -> int:
count = {}
for i in nums:
if i in count:
count[i] += 1
else:
count[i] = 1
if count[i] > len(nums) // 2:
return i |
"""Variable types provided by Dakota.
The module name in this package must match the keyword used by Dakota
for the variable; e.g., the Dakota keyword ``continuous_design`` is
used to name **continuous_design.py**.
"""
| """Variable types provided by Dakota.
The module name in this package must match the keyword used by Dakota
for the variable; e.g., the Dakota keyword ``continuous_design`` is
used to name **continuous_design.py**.
""" |
#uses python3
def evalt(a, b, op):
if op == '+':
return a + b
elif op == '-':
return a - b
elif op == '*':
return a * b
else:
assert False
def MinMax(i, j, op, m, M):
mmin = 10000
mmax = -10000
for k in range(i, j):
a = evalt(M[i][k], M[k+1][j], op[k])... | def evalt(a, b, op):
if op == '+':
return a + b
elif op == '-':
return a - b
elif op == '*':
return a * b
else:
assert False
def min_max(i, j, op, m, M):
mmin = 10000
mmax = -10000
for k in range(i, j):
a = evalt(M[i][k], M[k + 1][j], op[k])
b... |
## To fill these in:
## 1. Create a twitter account, or log in to your own
## 2. apps.twitter.com
## 3. Click "Create New App"
## 4. You'll see Create An Application. Fill in a name (must be unique) and a brief description (anything OK), and ANY complete website, e.g. http://programsinformationpeople.org in the website... | consumer_key = 'yXNjbxmVp0v33vHuvgaK6vxdb'
consumer_secret = 'SS2TSkoSRfkTk4nHk3kDgF5zI6zuP4eYJ6JyDJ6FgB5iuw3Zbe'
access_token = '438854829-7Ao9rz9PVvKMykErUzVr20Nz7unefv4DUUiEuESG'
access_token_secret = 'F4n0eOJ9lYndAoFBYwgsxdxQ9TNKKOb8VIDgqrfJ5u7PD' |
# -*- coding: utf-8 -*-
#
# This is the Robotics Language compiler
#
# Language.py: Definition of the language for this package
#
# Created on: June 22, 2017
# Author: Gabriel A. D. Lopes
# Licence: Apache 2.0
# Copyright: 2014-2017 Robot Care Systems BV, The Hague, The Netherlands. All rights reser... | default_output = ''
language = {'option': {'output': {'Python': '{{children[0]}}'}}, 'Reals': {'output': {'Python': ''}}, 'Integers': {'output': {'Python': ''}}, 'Naturals': {'output': {'Python': ''}}, 'Strings': {'output': {'Python': ''}}, 'Booleans': {'output': {'Python': ''}}, 'string': {'output': {'Python': '"{{tex... |
#!/usr/bin/env python3
# https://abc053.contest.atcoder.jp/tasks/abc053_b
s = input()
print(s.rindex('Z') - s.index('A') + 1)
| s = input()
print(s.rindex('Z') - s.index('A') + 1) |
#!/usr/bin/env python3
def charCount(ch, st):
count = 0
for character in st:
if character == ch:
count += 1
return count
st = input("Enter a string ")
ch = input("Find character to be searched ")
print(charCount(ch, st))
| def char_count(ch, st):
count = 0
for character in st:
if character == ch:
count += 1
return count
st = input('Enter a string ')
ch = input('Find character to be searched ')
print(char_count(ch, st)) |
"""
Given an n-ary tree, return the preorder traversal of its nodes' values.
Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples).
Follow up:
Recursive solution is trivial, could you do it iteratively?
Example 1:
I... | """
Given an n-ary tree, return the preorder traversal of its nodes' values.
Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples).
Follow up:
Recursive solution is trivial, could you do it iteratively?
Example 1:
I... |
# configuration file for resource "postgresql_1"
#
# this file exists as a reference for configuring postgresql resources
# and to support self-test run of module protocol_postgresql_pg8000.py
#
# copy this file to your own cage, possibly renaming into
# config_resource_YOUR_RESOURCE_NAME.py, then modify the copy
conf... | config = dict(protocol='postgresql_pg8000', decimal_precision=(10, 2), server_address=('db.domain.com', 5432), connect_timeout=3.0, database='database', username='user', password='pass', server_encoding=None)
self_test_config = dict(server_address=('test.postgres', 5432), database='test_db', username='user', password='... |
data = test_dataset.take(15)
points, labels = list(data)[0]
points = points[:8, ...]
labels = labels[:8, ...]
# run test data through model
preds = model.predict(points)
preds = tf.math.argmax(preds, -1)
points = points.numpy()
# plot points with predicted class and label
fig = plt.figure(figsize=(15, 10))
for ... | data = test_dataset.take(15)
(points, labels) = list(data)[0]
points = points[:8, ...]
labels = labels[:8, ...]
preds = model.predict(points)
preds = tf.math.argmax(preds, -1)
points = points.numpy()
fig = plt.figure(figsize=(15, 10))
for i in range(8):
ax = fig.add_subplot(2, 4, i + 1, projection='3d')
ax.scat... |
t=1
while t<=10:
print(f'Tabuada do Tabuada do {t}')
n=1
while n<=10:
print(f'{t} x {n} ={t*n}')
n=n+1
t= t+1
print()
| t = 1
while t <= 10:
print(f'Tabuada do Tabuada do {t}')
n = 1
while n <= 10:
print(f'{t} x {n} ={t * n}')
n = n + 1
t = t + 1
print() |
class Statistics:
def __init__(
self,
):
self.metrics = {
'success': 0,
'failure': 0,
'retry': 0,
'process': 0,
'heartbeat': 0,
}
self.workers = {}
def process_report(
self,
message,
):
... | class Statistics:
def __init__(self):
self.metrics = {'success': 0, 'failure': 0, 'retry': 0, 'process': 0, 'heartbeat': 0}
self.workers = {}
def process_report(self, message):
self.process_report_metrics(message=message)
self.process_report_worker_statistics(message=message)
... |
def in_the_matrix():
matrix = [[1, 2, 3],[4, 5, 6],[7, 8, 9]]
rows = len(matrix) # count # of rows
for i in range(rows):
col = len(matrix[i]) # count # of columns
for x in range(col):
print(matrix[i][x], end='')
print()
return | def in_the_matrix():
matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
rows = len(matrix)
for i in range(rows):
col = len(matrix[i])
for x in range(col):
print(matrix[i][x], end='')
print()
return |
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 12 20:22:51 2020
@author: Abhishek Parashar
"""
arr=[10,20,30,40]
# Python3 program for optimal allocation of pages
# Utility function to check if
# current minimum value is feasible or not.
def isPossible(arr, n, m, curr_min):
studentsRequired = 1
cur... | """
Created on Mon Oct 12 20:22:51 2020
@author: Abhishek Parashar
"""
arr = [10, 20, 30, 40]
def is_possible(arr, n, m, curr_min):
students_required = 1
curr_sum = 0
for i in range(n):
if arr[i] > curr_min:
return False
if curr_sum + arr[i] > curr_min:
students_req... |
# https://github.com/jeffmer/micropython-upybbot/blob/master/font.py
'''
* This file is part of the Micro Python project, http:#micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this soft... | """
* This file is part of the Micro Python project, http:#micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* ... |
class Solution(object):
def numPairsDivisibleBy60(self, time):
"""
:type time: List[int]
:rtype: int
"""
return self.hashmap(time)
def naive(self, time):
count = 0
for i in range(len(time)):
for j in range(i + 1, len(time)):
if... | class Solution(object):
def num_pairs_divisible_by60(self, time):
"""
:type time: List[int]
:rtype: int
"""
return self.hashmap(time)
def naive(self, time):
count = 0
for i in range(len(time)):
for j in range(i + 1, len(time)):
... |
N = int(input())
if N == 1 or N == 103:
print(0)
else:
print(N)
| n = int(input())
if N == 1 or N == 103:
print(0)
else:
print(N) |
# Create a python list containing first 5 positive even numbers. Display the list elements in the desending order.
list1 = [2, 4, 6, 8, 10]
list1.sort(reverse=True)
print(list1)
# hehe be efficient and not just do `print(list1[4])` , `print(list1[3])` etc etc | list1 = [2, 4, 6, 8, 10]
list1.sort(reverse=True)
print(list1) |
#
# Copyright (C) 2020 Arm Mbed. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""Use this module to assemble build configuration."""
| """Use this module to assemble build configuration.""" |
class ExpertaError(Exception):
def __init__(self, message):
super().__init__(message)
class FactNotFoundError(ExpertaError):
"""
"""
def __init__(self):
self.message = f"Fact wasn't found"
super().__init__(self.message)
| class Expertaerror(Exception):
def __init__(self, message):
super().__init__(message)
class Factnotfounderror(ExpertaError):
"""
"""
def __init__(self):
self.message = f"Fact wasn't found"
super().__init__(self.message) |
# Title : Simple Decorator
# Author : Kiran Raj R.
# Date : 12/11/2020
def my_decorator(function):
def inner_function(name):
print("This is a simple decorator function output")
function(name)
print("Finished....")
return inner_function
def greet_me(name):
print(f"Hello, Mr.{name... | def my_decorator(function):
def inner_function(name):
print('This is a simple decorator function output')
function(name)
print('Finished....')
return inner_function
def greet_me(name):
print(f'Hello, Mr.{name}')
decor = my_decorator(greet_me)
decor('kiran')
def me_or_you(function1... |
class MenuItem:
def __init__(self, option: str, name: str):
self.option = option
self.name = name
def __call__(self, action: callable, *args, **kwargs):
self.action = action
def inner_function(*args, **kwargs):
return self.action(*args, **kwargs)
return s... | class Menuitem:
def __init__(self, option: str, name: str):
self.option = option
self.name = name
def __call__(self, action: callable, *args, **kwargs):
self.action = action
def inner_function(*args, **kwargs):
return self.action(*args, **kwargs)
return sel... |
"""Module that holds classes related to sets.
This module contains the `Set` class. `Set` represents a set.
Examples:
Creating a `Set`, adding elements, and checking membership:
s = Set()
s.union(Set(1))
s.union(Set(2,3))
if 1 in s:
print("1")
Removing elements fr... | """Module that holds classes related to sets.
This module contains the `Set` class. `Set` represents a set.
Examples:
Creating a `Set`, adding elements, and checking membership:
s = Set()
s.union(Set(1))
s.union(Set(2,3))
if 1 in s:
print("1")
Removing elements fr... |
# Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | class Baseendpointresolvererror(Exception):
"""Base error for endpoint resolving errors.
Should never be raised directly, but clients can catch
this exception if they want to generically handle any errors
during the endpoint resolution process.
"""
class Noregionerror(BaseEndpointResolverError):
... |
__author__ = "Eli Serra"
__copyright__ = "Copyright 2020, Eli Serra"
__deprecated__ = False
__license__ = "MIT"
__status__ = "Production"
# Version of realpython-reader package
__version__ = "2.5.0"
| __author__ = 'Eli Serra'
__copyright__ = 'Copyright 2020, Eli Serra'
__deprecated__ = False
__license__ = 'MIT'
__status__ = 'Production'
__version__ = '2.5.0' |
class WhoisItError(Exception):
'''
Parent Exception for all whoisit raised exceptions.
'''
class BootstrapError(WhoisItError):
'''
Raised when there are any issues with bootstrapping.
'''
class QueryError(WhoisItError):
'''
Raised when there are any issues with queries.
... | class Whoisiterror(Exception):
"""
Parent Exception for all whoisit raised exceptions.
"""
class Bootstraperror(WhoisItError):
"""
Raised when there are any issues with bootstrapping.
"""
class Queryerror(WhoisItError):
"""
Raised when there are any issues with queries.
... |
"""OTElib exceptions."""
class BaseOtelibException(Exception):
"""A base OTElib exception."""
class ApiError(BaseOtelibException):
"""An API Error Exception"""
def __init__(self, detail: str, status: int, *args) -> None:
super().__init__(detail, *args)
self.detail = detail
self.... | """OTElib exceptions."""
class Baseotelibexception(Exception):
"""A base OTElib exception."""
class Apierror(BaseOtelibException):
"""An API Error Exception"""
def __init__(self, detail: str, status: int, *args) -> None:
super().__init__(detail, *args)
self.detail = detail
self.st... |
with open("halting.txt") as file:
lines = file.readlines()
lines = [line.rstrip() for line in lines]
insn = [(lines[i][:3], int(lines[i][4:])) for i in range(len(lines))]
jmps = [i for i in range(len(insn)) if insn[i][0] == "jmp"]
curr = 0
acc = 0
switch = 0
while switch < len(jmps):
acc = 0
visited... | with open('halting.txt') as file:
lines = file.readlines()
lines = [line.rstrip() for line in lines]
insn = [(lines[i][:3], int(lines[i][4:])) for i in range(len(lines))]
jmps = [i for i in range(len(insn)) if insn[i][0] == 'jmp']
curr = 0
acc = 0
switch = 0
while switch < len(jmps):
acc = 0
visited = {... |
'''
Given two strings str1 and str2, find the length of the smallest string which has both, str1 and str2 as its sub-sequences.
Input:
The first line of input contains an integer T denoting the number of test cases.Each test case contains two space separated strings.
Output:
Output the length of the required string.
... | """
Given two strings str1 and str2, find the length of the smallest string which has both, str1 and str2 as its sub-sequences.
Input:
The first line of input contains an integer T denoting the number of test cases.Each test case contains two space separated strings.
Output:
Output the length of the required string.
... |
#cari median
def cariMedian(arr):
totalNum=len(arr)
if totalNum%2 == 0:
index1=int(len(arr)/2)
index2=int(index1-1)
return (arr[index1]+arr[index2])/2
else:
index=int((len(arr)-1)/2)
return arr[index]
#test case
print(cariMedian([1, 2, 3, 4, 5])) # 3
print(cariMedian... | def cari_median(arr):
total_num = len(arr)
if totalNum % 2 == 0:
index1 = int(len(arr) / 2)
index2 = int(index1 - 1)
return (arr[index1] + arr[index2]) / 2
else:
index = int((len(arr) - 1) / 2)
return arr[index]
print(cari_median([1, 2, 3, 4, 5]))
print(cari_median([1... |
# -*- coding: utf-8 -*-
def main():
s = input()
n = len(s)
if s == s[::-1]:
t = s[:(n - 1) // 2]
u = s[(n + 3) // 2 - 1:]
if t == t[::-1] and u == u[::-1]:
print('Yes')
else:
print('No')
else:
print('No')
if __name_... | def main():
s = input()
n = len(s)
if s == s[::-1]:
t = s[:(n - 1) // 2]
u = s[(n + 3) // 2 - 1:]
if t == t[::-1] and u == u[::-1]:
print('Yes')
else:
print('No')
else:
print('No')
if __name__ == '__main__':
main() |
ADDRESS = {
'street': 'Elm Street',
'street_2': 'No 185',
'city': 'New York City',
'state': 'NY',
'zipcode': '10006'
}
ADDRESS_2 = {
'street': 'South Park',
'street_2': 'No 1',
'city': 'San Francisco',
'state': 'CA',
'zipcode': '94110'
}
ADMIN_USER = {
'username': 'bobs',
... | address = {'street': 'Elm Street', 'street_2': 'No 185', 'city': 'New York City', 'state': 'NY', 'zipcode': '10006'}
address_2 = {'street': 'South Park', 'street_2': 'No 1', 'city': 'San Francisco', 'state': 'CA', 'zipcode': '94110'}
admin_user = {'username': 'bobs', 'email': 'bob@gmail.com', 'password': 'pass'}
person... |
# Package exception model:
# Here we subclass base Python exception overriding its constructor to
# accomodate error message string as its first parameter and an open
# set of keyword arguments that become exception object attributes.
# While exception object is bubbling up the call stack, intermediate
# exception hand... | class Pysmierror(Exception):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args)
self.msg = args and args[0] or ''
for k in kwargs:
setattr(self, k, kwargs[k])
def __repr__(self):
return '%s(%s)' % (self.__class__.__name__, ', '.join(['%s=%r' % (k, ... |
# Python program to demonstrate working of extended
# Euclidean Algorithm
# function for extended Euclidean Algorithm
def gcdExtended(a, b):
# Base Case
if a == 0 :
return b, 0, 1
gcd, x1, y1 = gcdExtended(b%a, a)
# Update x and y using results of recursive
# call
x = y1 - (b//a) * x1
y = x1
return... | def gcd_extended(a, b):
if a == 0:
return (b, 0, 1)
(gcd, x1, y1) = gcd_extended(b % a, a)
x = y1 - b // a * x1
y = x1
return (gcd, x, y)
(a, b) = (123439843020, 101)
(g, x, y) = gcd_extended(a, b)
print('gcd(', a, ',', b, ') = ', g)
print('x: ', x)
print('y: ', y) |
class Solution:
@lru_cache(maxsize=None)
def minCostAfter(self, index, lastColor, target):
if target<0 or len(self.houses)-index+1<target:
return -1
if index==self.m-1:
if self.houses[index]!=0:
if (target==0 and lastColor==self.houses[index]) o... | class Solution:
@lru_cache(maxsize=None)
def min_cost_after(self, index, lastColor, target):
if target < 0 or len(self.houses) - index + 1 < target:
return -1
if index == self.m - 1:
if self.houses[index] != 0:
if target == 0 and lastColor == self.houses[... |
#author SANKALP SAXENA
if __name__ == '__main__':
n = int(input())
arr = map(int, input().split())
arr = list(arr)
arr.sort()
#print(arr)
l = -1
i = 0
e = 0
f = 0
flag = False
while(True) :
e = arr.pop(-1)
if(len(arr) == 1):
flag = True
... | if __name__ == '__main__':
n = int(input())
arr = map(int, input().split())
arr = list(arr)
arr.sort()
l = -1
i = 0
e = 0
f = 0
flag = False
while True:
e = arr.pop(-1)
if len(arr) == 1:
flag = True
break
f = arr.pop(-2)
if ... |
"""Given n names and phones numbers, assemble a phone book that maps friends' names to their respective phone numbers. You will then be given an unknown number of names to query your phone book for. For each namequeried, print the associated entry from your phone book on a new line in the form name = phoneNumber.
If an... | """Given n names and phones numbers, assemble a phone book that maps friends' names to their respective phone numbers. You will then be given an unknown number of names to query your phone book for. For each namequeried, print the associated entry from your phone book on a new line in the form name = phoneNumber.
If an... |
class CaesarCipher:
def encrypt(self, plain, n):
rst = [None] * len(plain)
for i in range(len(plain)):
rst[i] = chr((ord(plain[i]) - ord('A') + n) % 26 + ord('A'))
return ''.join(rst)
def decrypt(self, encrypted, n):
rst = [None] * len(encrypted)
f... | class Caesarcipher:
def encrypt(self, plain, n):
rst = [None] * len(plain)
for i in range(len(plain)):
rst[i] = chr((ord(plain[i]) - ord('A') + n) % 26 + ord('A'))
return ''.join(rst)
def decrypt(self, encrypted, n):
rst = [None] * len(encrypted)
for i in ra... |
class LotteryPlayer:
def __init__(self, name):
self.name = name
self.number = (1, 34, 56, 90)
def __str__(self):
return f"Person {self.name} year old"
def __repr__(self):
return f"<LotteryPlayer({self.name})>"
def total(self):
return sum(self.number)
player... | class Lotteryplayer:
def __init__(self, name):
self.name = name
self.number = (1, 34, 56, 90)
def __str__(self):
return f'Person {self.name} year old'
def __repr__(self):
return f'<LotteryPlayer({self.name})>'
def total(self):
return sum(self.number)
player_on... |
def vert_mirror(strng):
arr = strng.split("\n")
res = []
for word in arr:
w = word[::-1]
res.append(w)
return '\n'.join(res)
def hor_mirror(strng):
# arr = splint("\n")
arr = strng.split("\n")
# revirse every element in arr
res = arr[::-1]
# return join arr ("\n")
... | def vert_mirror(strng):
arr = strng.split('\n')
res = []
for word in arr:
w = word[::-1]
res.append(w)
return '\n'.join(res)
def hor_mirror(strng):
arr = strng.split('\n')
res = arr[::-1]
return '\n'.join(res)
def oper(fct, s):
return fct(s)
def vert_mirror2(s):
re... |
"""
Idempotency errors
"""
class IdempotencyItemAlreadyExistsError(Exception):
"""
Item attempting to be inserted into persistence store already exists and is not expired
"""
class IdempotencyItemNotFoundError(Exception):
"""
Item does not exist in persistence store
"""
class IdempotencyAl... | """
Idempotency errors
"""
class Idempotencyitemalreadyexistserror(Exception):
"""
Item attempting to be inserted into persistence store already exists and is not expired
"""
class Idempotencyitemnotfounderror(Exception):
"""
Item does not exist in persistence store
"""
class Idempotencyalrea... |
display = [['.' for i in range(50)] for j in range(6)]
instructions = []
while True:
try:
instructions.append(input())
except:
break
for instruction in instructions:
if instruction[:4] == 'rect':
i, j = instruction.find(' '), instruction.find('x')
width = int(instruction[i ... | display = [['.' for i in range(50)] for j in range(6)]
instructions = []
while True:
try:
instructions.append(input())
except:
break
for instruction in instructions:
if instruction[:4] == 'rect':
(i, j) = (instruction.find(' '), instruction.find('x'))
width = int(instruction[... |
one = int(input("Enter the number no 1: "))
two = int(input("Enter the number no 2: "))
three = int(input("Enter the number no 3: "))
four = int(input("Enter the number no 4: "))
one += two
three += four
dell = one / three
print("Answer %.2f" % dell)
| one = int(input('Enter the number no 1: '))
two = int(input('Enter the number no 2: '))
three = int(input('Enter the number no 3: '))
four = int(input('Enter the number no 4: '))
one += two
three += four
dell = one / three
print('Answer %.2f' % dell) |
# https://www.hackerrank.com/challenges/counting-valleys/problem
def countingValleys(steps, path):
# Write your code here
valley = 0
mountain = 0
state = 0
up = 0
down = 0
before_present_state = 0
for step in range(steps):
if path[step] == 'D':
down += 1
elif ... | def counting_valleys(steps, path):
valley = 0
mountain = 0
state = 0
up = 0
down = 0
before_present_state = 0
for step in range(steps):
if path[step] == 'D':
down += 1
elif path[step] == 'U':
up += 1
before_present_state = state
state =... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Purpose:
connections methods
'''
__author__ = 'Matt Joyce'
__email__ = 'matt@joyce.nyc'
__copyright__ = 'Copyright 2016, Symphony Communication Services LLC'
class Connections(object):
def __init__(self, *args, **kwargs):
super(Connections, ... | """
Purpose:
connections methods
"""
__author__ = 'Matt Joyce'
__email__ = 'matt@joyce.nyc'
__copyright__ = 'Copyright 2016, Symphony Communication Services LLC'
class Connections(object):
def __init__(self, *args, **kwargs):
super(Connections, self).__init__(*args, **kwargs)
def sessioni... |
def findOutlier(integers):
ofound = 0
efound = 0
ocnt = 0
ecnt = 0
for el in integers:
if (el % 2 == 1):
ofound = el
ocnt += 1
else:
efound = el
ecnt += 1
return(efound if ocnt > ecnt else ofound)
print("The outlier is %s" % findO... | def find_outlier(integers):
ofound = 0
efound = 0
ocnt = 0
ecnt = 0
for el in integers:
if el % 2 == 1:
ofound = el
ocnt += 1
else:
efound = el
ecnt += 1
return efound if ocnt > ecnt else ofound
print('The outlier is %s' % find_outl... |
testList = [1, -4, 8, -9]
def applyToEach(L, f):
for i in range(len(L)):
L[i] = f(L[i])
def turnToPositive(n):
if(n<0):
n*=-1
return n
applyToEach(testList, turnToPositive)
def sumOne(n):
n+=1
return n
applyToEach(testList, sumOne)
def square(n):
n**=2
return n
applyTo... | test_list = [1, -4, 8, -9]
def apply_to_each(L, f):
for i in range(len(L)):
L[i] = f(L[i])
def turn_to_positive(n):
if n < 0:
n *= -1
return n
apply_to_each(testList, turnToPositive)
def sum_one(n):
n += 1
return n
apply_to_each(testList, sumOne)
def square(n):
n **= 2
re... |
n=500
primeno=[2,3]
i=5
flag=0
diff=2
while i<=500:
print(i)
flag_p=1
for j in primeno:
if i%j== 0:
flag_p = 0
break
if flag_p==1:
primeno.append(i)
i += diff
if flag == 0:
diff=4
flag=1
continue
if flag == 1:
diff=2
... | n = 500
primeno = [2, 3]
i = 5
flag = 0
diff = 2
while i <= 500:
print(i)
flag_p = 1
for j in primeno:
if i % j == 0:
flag_p = 0
break
if flag_p == 1:
primeno.append(i)
i += diff
if flag == 0:
diff = 4
flag = 1
continue
if flag ... |
# -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
class AnalyseJarArg(object):
"""Implementation of the 'AnalyseJarArg' model.
API to analyse a JAR file. This JAR may contain multiple mappers/reducers.
Jar will be analysed and list of all mappers/reducers found in the jar
will be returned.
... | class Analysejararg(object):
"""Implementation of the 'AnalyseJarArg' model.
API to analyse a JAR file. This JAR may contain multiple mappers/reducers.
Jar will be analysed and list of all mappers/reducers found in the jar
will be returned.
Attributes:
jar_name (string): Name of the JAR to... |
# file classtools.py(new)
"Assorted class utilities and tools"
class AttrDisplay:
"""
Provides an inheritable display overload method that show instances with
their class name and a name=value pair for each attribute stored on the
instance itself(but not attributes inherited from its classes). Can be
... | """Assorted class utilities and tools"""
class Attrdisplay:
"""
Provides an inheritable display overload method that show instances with
their class name and a name=value pair for each attribute stored on the
instance itself(but not attributes inherited from its classes). Can be
mixed into any clas... |
#! /usr/bin/env python3
def neighbors(board, x, y) -> int :
minx, maxx = x - 1, x + 1
miny, maxy = y - 1, y + 1
if miny < 0 : miny = 0
if maxy >= len(board[0]) : maxy = len(board[0]) - 1
if minx < 0 : minx = 0
if maxx >= len(board) : maxx = len(board) - 1
count = 0
for i in range(min... | def neighbors(board, x, y) -> int:
(minx, maxx) = (x - 1, x + 1)
(miny, maxy) = (y - 1, y + 1)
if miny < 0:
miny = 0
if maxy >= len(board[0]):
maxy = len(board[0]) - 1
if minx < 0:
minx = 0
if maxx >= len(board):
maxx = len(board) - 1
count = 0
for i in ra... |
"""
"""
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
def setup_immer(name):
git_repository(
name = name,
remote = "https://github.com/arximboldi/immer",
commit = "2eea2202b5b71b58d18cc4672a5d995397a9797b",
shallow_since = "1633428364 +0200"
)
| """
"""
load('@bazel_tools//tools/build_defs/repo:git.bzl', 'git_repository')
def setup_immer(name):
git_repository(name=name, remote='https://github.com/arximboldi/immer', commit='2eea2202b5b71b58d18cc4672a5d995397a9797b', shallow_since='1633428364 +0200') |
class Container:
def __init__(self, processor, processes):
self._processor = processor
self._processes = processes
def run(self):
for process in self._processes:
process.run(self._processor)
| class Container:
def __init__(self, processor, processes):
self._processor = processor
self._processes = processes
def run(self):
for process in self._processes:
process.run(self._processor) |
def test_registering_new_filter_with_no_args(rpc_client, rpc_call_emitter):
filter_id = rpc_client(
method='eth_newFilter',
params=[{}]
)
changes = rpc_client(
method='eth_getFilterChanges',
params=[filter_id],
)
assert not changes
def test_registering_new_filter_w... | def test_registering_new_filter_with_no_args(rpc_client, rpc_call_emitter):
filter_id = rpc_client(method='eth_newFilter', params=[{}])
changes = rpc_client(method='eth_getFilterChanges', params=[filter_id])
assert not changes
def test_registering_new_filter_with_no_args(rpc_client, rpc_call_emitter):
... |
data = []
# zbieranie danych z pliku do listy
with open('../dane/sygnaly.txt') as f:
for x in f:
data.append(x[:-1])
# funkcja sprawdzajaca czy string spelnia warunek z zadania
def is_valid(s):
# parowanie kazdej litery z kazda litera zeby sprawdzic
# czy ich kody ASCII sa wystarczajaco blisko si... | data = []
with open('../dane/sygnaly.txt') as f:
for x in f:
data.append(x[:-1])
def is_valid(s):
for a in s:
for b in s:
if distance(a, b) > 10:
return False
return True
def distance(a, b):
return abs(ord(a) - ord(b))
result = []
for s in data:
if is_va... |
__author__ = 'Eric SHI'
__author_email__ = 'longwosion@gmail.com'
__url__ = 'https://github.com/Longwosion/parrot'
__license__ = 'BSD'
version = __version__ = '0.1.0'
| __author__ = 'Eric SHI'
__author_email__ = 'longwosion@gmail.com'
__url__ = 'https://github.com/Longwosion/parrot'
__license__ = 'BSD'
version = __version__ = '0.1.0' |
def steam(received):
# substitute spaces for url space character
response = "https://store.steampowered.com/search/?term=" + received.replace(' ', "%20")
return response
| def steam(received):
response = 'https://store.steampowered.com/search/?term=' + received.replace(' ', '%20')
return response |
# -*- coding: utf-8 -*-
"""Django password hasher using a fast PBKDF2 implementation (fastpbkdf2)."""
VERSION = (0, 0, 1)
__version__ = '.'.join([str(x) for x in VERSION])
| """Django password hasher using a fast PBKDF2 implementation (fastpbkdf2)."""
version = (0, 0, 1)
__version__ = '.'.join([str(x) for x in VERSION]) |
#encoding:utf-8
subreddit = 'desigentlemanboners'
t_channel = '@r_dgb'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| subreddit = 'desigentlemanboners'
t_channel = '@r_dgb'
def send_post(submission, r2t):
return r2t.send_simple(submission) |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'includes': [
'app_remoting_webapp_build.gypi',
],
'targets': [
{
'target_name': 'ar_sample_app',
'app_id': 'ljacajndfccfgnfohlg... | {'includes': ['app_remoting_webapp_build.gypi'], 'targets': [{'target_name': 'ar_sample_app', 'app_id': 'ljacajndfccfgnfohlgkdphmbnpkjflk', 'app_name': 'App Remoting Client', 'app_description': 'App Remoting client'}]} |
n , dm = map(int,input().split())
li = list(map(int, input().split()))
x = -1
for i in range(n):
if int(li[i]) <= dm:
x = i
print("It hadn't snowed this early in %d years!"%x)
break
else:
print("It had never snowed this early!") | (n, dm) = map(int, input().split())
li = list(map(int, input().split()))
x = -1
for i in range(n):
if int(li[i]) <= dm:
x = i
print("It hadn't snowed this early in %d years!" % x)
break
else:
print('It had never snowed this early!') |
class BasePSError:
def __init__(self, start_position, end_position, error_type, error_message, context):
self.start_position = start_position
self.end_position = end_position
self.error_type = error_type
self.error_message = error_message
self.context = context
def gener... | class Basepserror:
def __init__(self, start_position, end_position, error_type, error_message, context):
self.start_position = start_position
self.end_position = end_position
self.error_type = error_type
self.error_message = error_message
self.context = context
def gene... |
msg_template = """Hello {name},
Thank you for joining {website}. We are very
happy to have you with us.
""" # .format(name="Justin", website='cfe.sh') without using the function
def format_msg(my_name="Dev tez", my_website="t&tinc.org"):
my_msg = msg_template.format(name=my_name, website=my_website)
return my_... | msg_template = 'Hello {name},\nThank you for joining {website}. We are very\nhappy to have you with us.\n'
def format_msg(my_name='Dev tez', my_website='t&tinc.org'):
my_msg = msg_template.format(name=my_name, website=my_website)
return my_msg |
class Solution:
def sequenceReconstruction(self, org: List[int], seqs: List[List[int]]) -> bool:
children = collections.defaultdict(set)
parents = collections.defaultdict(set)
nodes = set()
for s in seqs:
for i in range(len(s)):
nodes.add(s[i])
... | class Solution:
def sequence_reconstruction(self, org: List[int], seqs: List[List[int]]) -> bool:
children = collections.defaultdict(set)
parents = collections.defaultdict(set)
nodes = set()
for s in seqs:
for i in range(len(s)):
nodes.add(s[i])
... |
def parse_vars(vars):
res = set()
for var in vars.split(" "):
var = var.split("<")[0]
res.add(chr(int(var[2:], 16)))
return res
| def parse_vars(vars):
res = set()
for var in vars.split(' '):
var = var.split('<')[0]
res.add(chr(int(var[2:], 16)))
return res |
n,m=map(int,input().split())
l=[]
for i in range(n):
new=list(map(int,input().split()))
l.append(new)
ans=[]
for i in range(n):
ans.append([0]*m)
for i in range(n):
for j in range(m):
if (i+j)%2==1:
ans[i][j]=720720 #lcm of first 16 numbers
else:
ans[i][j]=720720+... | (n, m) = map(int, input().split())
l = []
for i in range(n):
new = list(map(int, input().split()))
l.append(new)
ans = []
for i in range(n):
ans.append([0] * m)
for i in range(n):
for j in range(m):
if (i + j) % 2 == 1:
ans[i][j] = 720720
else:
ans[i][j] = 720720 ... |
# -*- coding: utf-8 -*-
# @Author: 1uci3n
# @Date: 2021-03-10 16:02:41
# @Last Modified by: 1uci3n
# @Last Modified time: 2021-03-10 16:03:13
class Solution:
def calculate(self, s: str) -> int:
i = 0
kuohao = []
temp_sums = []
temp_sum = 0
temp_str = '0'
while i <... | class Solution:
def calculate(self, s: str) -> int:
i = 0
kuohao = []
temp_sums = []
temp_sum = 0
temp_str = '0'
while i < len(s):
if s[i] == ' ':
s = s[:i] + s[i + 1:]
continue
else:
if s[i] == ... |
print('='*8,'Aumentos Multiplos','='*8)
s = float(input('Qual o valor do salario atual do funcionario? R$'))
if s<=1250.00:
ns = s*1.15
print('O novo salario do funcionario devera ser de R${:.2f}.'.format(ns))
else:
ns = s*1.10
print('O novo salario do funcionario devera ser de R${:.2f}.'.format(ns))
| print('=' * 8, 'Aumentos Multiplos', '=' * 8)
s = float(input('Qual o valor do salario atual do funcionario? R$'))
if s <= 1250.0:
ns = s * 1.15
print('O novo salario do funcionario devera ser de R${:.2f}.'.format(ns))
else:
ns = s * 1.1
print('O novo salario do funcionario devera ser de R${:.2f}.'.form... |
X = int(input())
azuke = 100
ans = 0
while True:
azuke = int(azuke*1.01)
ans += 1
if azuke >= X:
print(ans)
exit(0)
| x = int(input())
azuke = 100
ans = 0
while True:
azuke = int(azuke * 1.01)
ans += 1
if azuke >= X:
print(ans)
exit(0) |
text = "hello world"
for c in text:
if c ==" ":
break
print(c) #will print every single fro mthe beginning of text but will stop a first space
| text = 'hello world'
for c in text:
if c == ' ':
break
print(c) |
# Write a program that ask the user car speed.If exceed 80km/h, show one message saying that the user has been fined.In this case, show the fine price, charging $5 per km over the limit of 80km/h
speed=int(input("What is your car speed(in km/h): "))
if speed>80:
fine=(speed-80)*5
print(f"You has been fined in $... | speed = int(input('What is your car speed(in km/h): '))
if speed > 80:
fine = (speed - 80) * 5
print(f'You has been fined in ${fine}')
else:
print("You're ok!!!") |
TEAM_DATA = {
"nba": {
"1": [
"atl",
"hawks",
"atlanta hawks",
"<:hawks:935782369212895232>"
],
"2": [
"bos",
"celtics",
"boston celtics",
"<:celtics:935742825377718302>"
],
"3": [
... | team_data = {'nba': {'1': ['atl', 'hawks', 'atlanta hawks', '<:hawks:935782369212895232>'], '2': ['bos', 'celtics', 'boston celtics', '<:celtics:935742825377718302>'], '3': ['no', 'pelicans', 'new orleans pelicans', '<:pelicans:935742824639524906>'], '4': ['chi', 'bulls', 'chicago bulls', '<:bulls:935781032408530965>']... |
class MSContentDrawView(object):
@property
def frame(self):
"""
Returns a CGRect of the current view
"""
pass
def zoomIn(self):
"""
Zooms in by 2x.
"""
# Not implemented
pass
def zoomOut(self):
"""
Zooms out by the... | class Mscontentdrawview(object):
@property
def frame(self):
"""
Returns a CGRect of the current view
"""
pass
def zoom_in(self):
"""
Zooms in by 2x.
"""
pass
def zoom_out(self):
"""
Zooms out by the 2x.
"""
... |
frutas = open('frutas.txt', 'r')
numeros = open('numeros.txt', 'r')
def informacion_lista(lista:list)->list:
auxiliar=[]
for i in lista:
print(len(lista))
return auxiliar
"""
if __name__ == "__main__":
lista_fruta_nueva=eliminar_un_caracter_de_toda_la_lista(lista_frutas,"\n")
print(lista_fruta_nueva)
li... | frutas = open('frutas.txt', 'r')
numeros = open('numeros.txt', 'r')
def informacion_lista(lista: list) -> list:
auxiliar = []
for i in lista:
print(len(lista))
return auxiliar
'\nif __name__ == "__main__":\n lista_fruta_nueva=eliminar_un_caracter_de_toda_la_lista(lista_frutas,"\n")\n print(lista_... |
class Solution(object):
# @return an integer
def minDistance(self, word1, word2):
"""
:type word1: str
:type word2: str
:rtype: int
"""
m=len(word1)+1; n=len(word2)+1
dp = [[0 for i in range(n)] for j in range(m)]
for i in range(n):
dp... | class Solution(object):
def min_distance(self, word1, word2):
"""
:type word1: str
:type word2: str
:rtype: int
"""
m = len(word1) + 1
n = len(word2) + 1
dp = [[0 for i in range(n)] for j in range(m)]
for i in range(n):
dp[0][i] = ... |
def zmode(list) -> float:
"""Finds mode of given list
:param list: list of values
:return: int, float, None if no mode, or list if multiple modes"""
# mode = 0
# mode_count = 0
for i in list:
mode_count = 0
mode = 0
# index = 0
for i in list:
if list.c... | def zmode(list) -> float:
"""Finds mode of given list
:param list: list of values
:return: int, float, None if no mode, or list if multiple modes"""
for i in list:
mode_count = 0
mode = 0
for i in list:
if list.count(i) > mode_count:
mode_count = list.... |
class Solution:
def findSmallestSetOfVertices(self, n: int, edges):
in_degrees = {}
res = []
for u, v in edges:
in_degrees[v] = in_degrees.get(v, 0)+1
for i in range(n):
if in_degrees.get(i, 0) < 1:
res.append(i)
return res
"""
Succes... | class Solution:
def find_smallest_set_of_vertices(self, n: int, edges):
in_degrees = {}
res = []
for (u, v) in edges:
in_degrees[v] = in_degrees.get(v, 0) + 1
for i in range(n):
if in_degrees.get(i, 0) < 1:
res.append(i)
return res
'\n... |
"""
U6 Dictionaries
@author: Gerhard Kling
"""
#=========================================================================================================
#Dictionaries
#=========================================================================================================
#Comma-separated list of key:value... | """
U6 Dictionaries
@author: Gerhard Kling
"""
my_dict = {'Name': 'Tom'}
print(my_dict['Name'])
my_dict.update({'Age': 43})
print(my_dict)
list_keys = list(my_dict)
print(list_keys)
list_keys = sorted(my_dict)
print(list_keys)
new_dict = dict([('Name', 'Amy'), ('Position', 'Data nerd')])
print(new_dict)
new_dict = dic... |
# Array
# Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
#
# Example 1:
#
# Input:
# [
# [ 1, 2, 3 ],
# [ 4, 5, 6 ],
# [ 7, 8, 9 ]
# ]
# Output: [1,2,3,6,9,8,7,4,5]
# Example 2:
#
# Input:
# [
# [1, 2, 3, 4],
# [5, 6, 7, 8],
# [9,10,11,12]
# ]
# Output... | class Solution:
def spiral_order(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: List[int]
"""
def extract_layer(remain):
output = []
(mat_len, mat_wid) = (len(remain), len(remain[0]))
output += remain[0]
if matLen > ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# TIOJ 1006.py
# @Author : ()
# @Link :
# @Date : 2019/10/5
a = input()
b = input()
a = int(a)
b = int(b)
print(a//b) | a = input()
b = input()
a = int(a)
b = int(b)
print(a // b) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.