content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class MonoidLawTester:
def __init__(self, monoid, value):
self.monoid = monoid
self.value = value
def left_identity_test(self):
monoid = self.monoid(self.value)
assert monoid.concat(monoid.neutral()) == monoid
def right_identity_test(self):
monoid = self.monoid(sel... | class Monoidlawtester:
def __init__(self, monoid, value):
self.monoid = monoid
self.value = value
def left_identity_test(self):
monoid = self.monoid(self.value)
assert monoid.concat(monoid.neutral()) == monoid
def right_identity_test(self):
monoid = self.monoid(sel... |
class Circulo:
pi = 3.14 # variable de clase (sin self), puede ser utilizadas por las instancias
def __init__(self,radio):
self.radio = radio # radio es una variable de instancia
circle1 = Circulo(10)
circle2 = Circulo(20)
print(circle1.radio)
circle2.radio = 100
print(circle2.radio)
# uso de la va... | class Circulo:
pi = 3.14
def __init__(self, radio):
self.radio = radio
circle1 = circulo(10)
circle2 = circulo(20)
print(circle1.radio)
circle2.radio = 100
print(circle2.radio)
print(Circulo.pi) |
# -*- coding:utf-8 -*-
class Type:
id = ''
word_id = ''
name = ''
meanings = []
def desc(self):
name = self.name if self.name is not None else ''
return '(\'' + self.word_id + '\', \'' + name + '\')'
| class Type:
id = ''
word_id = ''
name = ''
meanings = []
def desc(self):
name = self.name if self.name is not None else ''
return "('" + self.word_id + "', '" + name + "')" |
##Clock in pt2thon##
t1 = input("Init schedule : ") # first schedule
HH1 = int(t1[0] + t1[1])
MM1 = int(t1[3] + t1[4])
SS1 = int(t1[6] + t1[7])
t2 = input("Final schedule : ") # second schedule
HH2 = int(t2[0] + t2[1])
MM2 = int(t2[3] + t2[4])
SS2 = int(t2[6] + t2[7])
tt1 = (HH1 * 3600) + (MM1 * 60) + SS1 # total... | t1 = input('Init schedule : ')
hh1 = int(t1[0] + t1[1])
mm1 = int(t1[3] + t1[4])
ss1 = int(t1[6] + t1[7])
t2 = input('Final schedule : ')
hh2 = int(t2[0] + t2[1])
mm2 = int(t2[3] + t2[4])
ss2 = int(t2[6] + t2[7])
tt1 = HH1 * 3600 + MM1 * 60 + SS1
tt2 = HH2 * 3600 + MM2 * 60 + SS2
tt3 = tt2 - tt1
if tt3 < 0:
a = 864... |
# PySNMP SMI module. Autogenerated from smidump -f python IANA-MAU-MIB
# by libsmi2pysnmp-0.1.3 at Thu May 22 11:57:41 2014,
# Python version sys.version_info(major=2, minor=7, micro=2, releaselevel='final', serial=0)
# Imports
( Integer, ObjectIdentifier, OctetString, ) = mibBuilder.importSymbols("ASN1", "Integer", ... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, single_value_constraint, value_range_constraint, value_size_constraint) ... |
# name: Exes and Ohs
# url: https://www.codewars.com/kata/55908aad6620c066bc00002a
# Check to see if a string has the same amount of 'x's and 'o's. The method
# must return a boolean and be case insensitive. The string can contain any char.
def xo(s):
lowerStr = s.lower()
return lowerStr.count('o') == lowerStr.... | def xo(s):
lower_str = s.lower()
return lowerStr.count('o') == lowerStr.count('x')
if __name__ == '__main__':
print(xo('ooxx'))
print(xo('xooxx'))
print(xo('ooxXm'))
print(xo('zpzpzpp'))
print(xo('zzoo')) |
BASE_URL = "https://paper-api.alpaca.markets"
KEY = "your key here"
SECRET_KEY = "your secret key here"
HEADERS = {"APCA-API-KEY-ID": KEY, "APCA-API-SECRET-KEY": SECRET_KEY}
# headers are used to authenticate our request | base_url = 'https://paper-api.alpaca.markets'
key = 'your key here'
secret_key = 'your secret key here'
headers = {'APCA-API-KEY-ID': KEY, 'APCA-API-SECRET-KEY': SECRET_KEY} |
# coding: utf-8
# Copyright 2014 jeoliva author. All rights reserved.
# Use of this source code is governed by a MIT License
# license that can be found in the LICENSE file.
class RangedUri(object):
def __init__(self):
self.start = 0
self.length = -1
self.baseUri = ""
self.referenc... | class Rangeduri(object):
def __init__(self):
self.start = 0
self.length = -1
self.baseUri = ''
self.referenceUri = '' |
class Solution:
def wordPatternV1(self, pattern: str, str: str) -> bool:
p2s, s2p, words = {}, {}, str.split()
if len(pattern) != len(words):
return False
for p, s in zip(pattern, words):
if p in p2s and p2s[p] != s:
return False
else:
... | class Solution:
def word_pattern_v1(self, pattern: str, str: str) -> bool:
(p2s, s2p, words) = ({}, {}, str.split())
if len(pattern) != len(words):
return False
for (p, s) in zip(pattern, words):
if p in p2s and p2s[p] != s:
return False
e... |
#-------------------------------------------------------------------------------
# Name: powerlaw.py
# Purpose: This is a set of power law coefficients(a,b) for the calculation of
# empirical rain attenuation model A = a*R^b.
#-------------------------------------------------------------------------------
... | def get_coef_ab(freq, mod_type='MP'):
"""
Returns power law coefficients according to model type (mod_type)
at a given frequency[Hz].
Input:
freq - frequency, [Hz].
Optional:
mod_type - model type for power law. This can be 'ITU_R2005',
'MP','GAMMA'. By default, mo... |
def isPalindrome(x):
#x = x.casefold()
rev_str = reversed(x)
if list(x) == list(rev_str):
print("It is palindrome")
return True
else:
print("It is not palindrome")
return False
isPalindrome("SSAASS") | def is_palindrome(x):
rev_str = reversed(x)
if list(x) == list(rev_str):
print('It is palindrome')
return True
else:
print('It is not palindrome')
return False
is_palindrome('SSAASS') |
'''Application Data (bpy.app)
This module contains application values that remain unchanged during runtime.
'''
debug = None
'''Boolean, for debug info (started with --debug / --debug_* matching this attribute name)
'''
debug_events = None
'''Boolean, for debug info (started with --debug / -... | """Application Data (bpy.app)
This module contains application values that remain unchanged during runtime.
"""
debug = None
'Boolean, for debug info (started with --debug / --debug_* matching this attribute name)\n \n'
debug_events = None
'Boolean, for debug info (started with --debug / --debug_* matching thi... |
##############################################
# parameters than can be defined by the user #
##############################################
# parameters modifying the behaviour of the network
global weight_multiplicator # multiplicator of a returned observation, allow to scale observations in ... | global weight_multiplicator
weight_multiplicator = 0.25
global victory_reward
victory_reward = 0
global defeat_punishment
defeat_punishment = 1
global network_param
network_param = [4]
network_type = 'mlp'
max_score = 200
nb_seq = 1000
nb_simulation = 10
save_frequency = 100
gamma = 0.6
hyperopt = 0
pro_level_exists = ... |
# -*- coding: utf-8 -*-
name = 'nuke_ML_server'
version = '0.1.3'
build_requires = [
'cmake-3.10+'
]
variants = [
['platform-linux', 'arch-x86_64', 'nuke-12.2']
]
def commands():
env.NUKE_PATH.append('{root}/lib')
env.LDD_LIBRARY_PATH.append(env.NUKE_LOCATION)
| name = 'nuke_ML_server'
version = '0.1.3'
build_requires = ['cmake-3.10+']
variants = [['platform-linux', 'arch-x86_64', 'nuke-12.2']]
def commands():
env.NUKE_PATH.append('{root}/lib')
env.LDD_LIBRARY_PATH.append(env.NUKE_LOCATION) |
input()
x = list(map(int, input().split()))
N = len(x)
for i in range(0, N - 1):
for j in range(0, N - i - 1):
if x[j] > x[j + 1]:
x[j], x[j + 1] = x[j + 1], x[j]
print(' '.join(map(str, x)))
| input()
x = list(map(int, input().split()))
n = len(x)
for i in range(0, N - 1):
for j in range(0, N - i - 1):
if x[j] > x[j + 1]:
(x[j], x[j + 1]) = (x[j + 1], x[j])
print(' '.join(map(str, x))) |
# author: Bilal El Uneis
# since: April 2018
# bilaleluneis@gmail.com
class Methods:
number_of_instances = 0 # this is a class level property
# initializer with default values (constructor)
def __init__(self, method_name="anonymous", method_return_type="void"):
self.method_name = method_name
... | class Methods:
number_of_instances = 0
def __init__(self, method_name='anonymous', method_return_type='void'):
self.method_name = method_name
self.method_return_type = method_return_type
type(self).number_of_instances += 1
def __del__(self):
type(self).number_of_instances -... |
n = int(input())
a = list(map(int, input().split()))
total = sum(a)
if total % n != 0:
print(-1)
exit()
num = total // n
ans = 0
for i in range(n - 1):
left = sum(a[:i + 1])
right = sum(a[i + 1:])
if left < num * (i + 1) or right < num * (n - i - 1):
ans += 1
print(ans)
| n = int(input())
a = list(map(int, input().split()))
total = sum(a)
if total % n != 0:
print(-1)
exit()
num = total // n
ans = 0
for i in range(n - 1):
left = sum(a[:i + 1])
right = sum(a[i + 1:])
if left < num * (i + 1) or right < num * (n - i - 1):
ans += 1
print(ans) |
#encoding:utf-8
subreddit = 'KamenRider'
t_channel = '@r_KamenRider'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| subreddit = 'KamenRider'
t_channel = '@r_KamenRider'
def send_post(submission, r2t):
return r2t.send_simple(submission) |
t = int(input())
tests = []
def fact(n):
if n == 1:
return n
else:
return n * fact(n - 1)
while t > 0:
n = int(input())
tests.append(fact(n))
t -= 1
for x in tests:
print(x % 10) | t = int(input())
tests = []
def fact(n):
if n == 1:
return n
else:
return n * fact(n - 1)
while t > 0:
n = int(input())
tests.append(fact(n))
t -= 1
for x in tests:
print(x % 10) |
for _ in range(int(input())):
a,b,q=map(int,input().split())
arr=[]
for i in range(q):
arr+=[list(map(int,input().split()))]
res=0
if a!=b:
for j in range(arr[i][0],arr[i][1]+1):
if (j%a)%b!=(j%b)%a:
res+=1
... | for _ in range(int(input())):
(a, b, q) = map(int, input().split())
arr = []
for i in range(q):
arr += [list(map(int, input().split()))]
res = 0
if a != b:
for j in range(arr[i][0], arr[i][1] + 1):
if j % a % b != j % b % a:
res += 1
... |
# The isBadVersion API is already defined for you.
# @param version, an integer
# @return a bool
def isBadVersion(version):
pass
class Solution:
def firstBadVersion(self, n):
left, right = 0, n
while left <= right:
mid = (left + right) // 2
if not isBadVersion(mid):
... | def is_bad_version(version):
pass
class Solution:
def first_bad_version(self, n):
(left, right) = (0, n)
while left <= right:
mid = (left + right) // 2
if not is_bad_version(mid):
left = mid + 1
else:
right = mid - 1
r... |
def takeInstInput(S):
degrees = []
inputS = S.split(" ")
inputS = [int(x) for x in inputS]
for i in range(len(inputS)):
degrees.append((inputS[i], i))
return degrees
def takeFileInput(FileName):
fileI = open(FileName, 'r')
inputS = fileI.readline()
degrees = takeInstInput(inputS... | def take_inst_input(S):
degrees = []
input_s = S.split(' ')
input_s = [int(x) for x in inputS]
for i in range(len(inputS)):
degrees.append((inputS[i], i))
return degrees
def take_file_input(FileName):
file_i = open(FileName, 'r')
input_s = fileI.readline()
degrees = take_inst_in... |
class Solution:
def intToRoman(self, num: int) -> str:
'''
T: O(1) and S: O(1)
'''
int2rom = {1000:'M',
900:'CM',
500:'D',
400:'CD',
100:'C',
90:'XC',
50:'L',
... | class Solution:
def int_to_roman(self, num: int) -> str:
"""
T: O(1) and S: O(1)
"""
int2rom = {1000: 'M', 900: 'CM', 500: 'D', 400: 'CD', 100: 'C', 90: 'XC', 50: 'L', 40: 'XL', 10: 'X', 9: 'IX', 5: 'V', 4: 'IV', 1: 'I'}
result = ''
for divisor in int2rom:
... |
#
# config.py: configuration for semantic segmentation
# (c) Neil Nie, 2017
# All Rights Reserved.
#
batch_size = 8
img_height = 512
img_width = 1024
display_height = 512
display_width = 1024
nb_classes = 34
learning_rate = 1e-4
nb_epoch = 10
| batch_size = 8
img_height = 512
img_width = 1024
display_height = 512
display_width = 1024
nb_classes = 34
learning_rate = 0.0001
nb_epoch = 10 |
#
# @lc app=leetcode id=485 lang=python3
#
# [485] Max Consecutive Ones
#
# @lc code=start
class Solution:
def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
res = 0
count = 0
for i in nums:
if i == 0:
count = 0
else:
count += 1... | class Solution:
def find_max_consecutive_ones(self, nums: List[int]) -> int:
res = 0
count = 0
for i in nums:
if i == 0:
count = 0
else:
count += 1
res = max(res, count)
return res |
'''
module for calculating
greatest common divisor (GCD)
and lowest common multiple
(LCM)
'''
def gcd(x: int, y: int):
'''
Calculating GCD of x and y
using Euclid's algorithm
'''
if (x > y):
while (y != 0):
x, y = y, x % y
return x
else:
while (x != 0)... | """
module for calculating
greatest common divisor (GCD)
and lowest common multiple
(LCM)
"""
def gcd(x: int, y: int):
"""
Calculating GCD of x and y
using Euclid's algorithm
"""
if x > y:
while y != 0:
(x, y) = (y, x % y)
return x
else:
while x != 0:
... |
#!/bin/python3
#I think this needs to run in c
def addTuple(t1, t2):
return [t1i + t2i for t1i, t2i in zip(t1, t2)]
def compareTuple(t1, t2):
return all([t1i <= t2i for t1i, t2i in zip(t1, t2)])
def theHackathon(n, m, a, b, f, s, t):
# Participant code here
people = {}
groups = {}
max_de... | def add_tuple(t1, t2):
return [t1i + t2i for (t1i, t2i) in zip(t1, t2)]
def compare_tuple(t1, t2):
return all([t1i <= t2i for (t1i, t2i) in zip(t1, t2)])
def the_hackathon(n, m, a, b, f, s, t):
people = {}
groups = {}
max_dep = (f, s, t)
for i in range(n):
inputdata = input().split()
... |
# https://www.geeksforgeeks.org/merge-sort/
# merge(arr,l,m,r) is a key process assuming that arr[l..m] and arr[m+1..r] are sorted and merges the sub-arrays into one
# Recursive implementation
# Space complexity is O(n)+O(logn) counting stack frames -> still O(n) in case of arrays
def mergeSort(arr):
# base cas... | def merge_sort(arr):
if len(arr) > 1:
mid = len(arr) // 2
l = arr[:mid]
r = arr[mid:]
merge_sort(L)
merge_sort(R)
i = j = k = 0
while i < len(L) and j < len(R):
if L[i] < R[j]:
arr[k] = L[i]
i += 1
else:
... |
# list of lists
matrix = [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]
# get element from list of lists
x = matrix[0][0]
# slice a list of lists
x = matrix[0][0:2]
# update element in list
matrix[0][0] = -1
# remove element in list
matrix[0].remove(-1)
# get number of lists
x = len(matrix)
| matrix = [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]
x = matrix[0][0]
x = matrix[0][0:2]
matrix[0][0] = -1
matrix[0].remove(-1)
x = len(matrix) |
# A little about strings
# Often programmers face a problem that can be solved by
# analogy. You are already familiar with the string data type,
# Now you need to study the relevant section of the
# documentation about strings to solve this problem. In the
# documentation you will find the necessary similar examples.
... | print("It isn`t in the section 'C:\\some\\name_of_file'") |
def stringfixer(sentence):
sentence = sentence.split()
symbollst = [".","!","?"]
flag = False
count = 0
final = ""
for elm in sentence:
if count ==0:
elm = elm.capitalize()
count += 1
if flag:
elm = elm.capitalize()
flag = False
... | def stringfixer(sentence):
sentence = sentence.split()
symbollst = ['.', '!', '?']
flag = False
count = 0
final = ''
for elm in sentence:
if count == 0:
elm = elm.capitalize()
count += 1
if flag:
elm = elm.capitalize()
flag = False
... |
def positive_or_negative(value):
if value > 0:
return "Positive!"
elif value < 0:
return "Negative!"
else:
return "It's zero!"
number = int(input("Wprowadz liczbe: "))
print(positive_or_negative(number)) | def positive_or_negative(value):
if value > 0:
return 'Positive!'
elif value < 0:
return 'Negative!'
else:
return "It's zero!"
number = int(input('Wprowadz liczbe: '))
print(positive_or_negative(number)) |
command = input().split("|")
energy = 100
coins = 100
clear_event = True
for current_command in command:
current_command = current_command.split("-")
event = current_command[0]
number = int(current_command[1])
if event == "rest":
needed_energy = 100 - energy
gained_energy = min(numbe... | command = input().split('|')
energy = 100
coins = 100
clear_event = True
for current_command in command:
current_command = current_command.split('-')
event = current_command[0]
number = int(current_command[1])
if event == 'rest':
needed_energy = 100 - energy
gained_energy = min(number, n... |
def diff_tests(input_files):
tests = []
updates = []
for input_file in input_files:
genrule_name = "gen_{}.actual".format(input_file)
actual_file = "{}.actual".format(input_file)
native.genrule(
name = genrule_name,
srcs = [input_file],
outs = [a... | def diff_tests(input_files):
tests = []
updates = []
for input_file in input_files:
genrule_name = 'gen_{}.actual'.format(input_file)
actual_file = '{}.actual'.format(input_file)
native.genrule(name=genrule_name, srcs=[input_file], outs=[actual_file], tools=['//main:as-tree'], cmd='$... |
#-----------------------------------------------------------------------------
# Name: Looping Structures - While (loopingWhile.py)
# Purpose: To provide information about how while loops work as a looping
# structure in Python
#
# Author: Mr. Seidel
# Created: 17-Aug-2018
# Updated: 22-Aug... | count = 1
while count < 10:
print(str(x + count))
count = count + 1
count = 275
while count > 250:
count = count - 1
if count % 2 == 0:
print(str(z) + ': This number is even')
count = 1
while count == 1:
print('Count is equal to the number 1')
count = 1
while count < 10:
print(str(2 * co... |
print("Akshitha Sai");
print("AM.EN.U4CSE18122");
print("CSE");
print("marvel rocks");
| print('Akshitha Sai')
print('AM.EN.U4CSE18122')
print('CSE')
print('marvel rocks') |
# Copyright 2013 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.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
# GN version: //ios/net:ios_net_unittests
'target_name': 'ios_net_unittests',... | {'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'ios_net_unittests', 'type': '<(gtest_target_type)', 'dependencies': ['../../base/base.gyp:base', '../../base/base.gyp:run_all_unittests', '../../net/net.gyp:net_test_support', '../../testing/gtest.gyp:gtest', '../../url/url.gyp:url_lib', 'ios_net.gyp:ios_... |
n = int(input("Enter N: "))
l = []
for i in range(0 , n):
inp = int(input("Enter numbers: "))
l.append(inp)
l.sort()
a = 0
b = 0
for i in range(0 , n):
if i % 2 != 0:
a = a * 10 + l[i]
else:
b = b * 10 + l[i]
c = a + b
print(c)
| n = int(input('Enter N: '))
l = []
for i in range(0, n):
inp = int(input('Enter numbers: '))
l.append(inp)
l.sort()
a = 0
b = 0
for i in range(0, n):
if i % 2 != 0:
a = a * 10 + l[i]
else:
b = b * 10 + l[i]
c = a + b
print(c) |
help = '''tdo -- A todo list tool for the terminal.
Available commands:
tdo Lists all undone tasks, sorted by category.
tdo all Lists all tasks.
tdo add "task" [list] Add a task to a certain list or the default list.
tdo edit id Edit a task description.
tdo done id ... | help = 'tdo -- A todo list tool for the terminal.\n\nAvailable commands:\ntdo Lists all undone tasks, sorted by category.\ntdo all Lists all tasks.\ntdo add "task" [list] Add a task to a certain list or the default list.\ntdo edit id Edit a task description.\ntdo done i... |
game_list = {
"games": [
"4story",
"8bitmmo",
"9dragons",
"9lives-arena",
"a-tale-in-the-desert",
"a3",
"a3-still-alive",
"aberoth",
"ace-online",
"achaea",
"ad2460",
"adventure-land",
"adventure-quest-3d",
"adventurequest-worlds",
... | game_list = {'games': ['4story', '8bitmmo', '9dragons', '9lives-arena', 'a-tale-in-the-desert', 'a3', 'a3-still-alive', 'aberoth', 'ace-online', 'achaea', 'ad2460', 'adventure-land', 'adventure-quest-3d', 'adventurequest-worlds', 'aetolia-the-midnight-age', 'age-of-conan-unchained', 'age-of-the-four-clans', 'age-of-wus... |
# For demonstration this will serve as the database of partners
# For real implementation this will come from a database.
# Both partnerId and key should be shared between services.
partners = {
'abcd123' : { # this is partner ssoId (abcd123)
'name': 'Partner 1 inc.',
'shared_key' : '5f4dcc3b... | partners = {'abcd123': {'name': 'Partner 1 inc.', 'shared_key': '5f4dcc3b5aa765d61d8327deb882cf99', 'is_active': True}, 'abcd1234': {'name': 'Partner 2 inc.', 'shared_key': '482c811da5d5b4bc6d497ffa98491e38', 'is_active': False}} |
#!/usr/bin/env python3
steps = 10
with open('input.txt', 'r') as f:
lines = f.read().splitlines()
initial_string = lines[0]
mapping = {}
for line in lines:
if '->' in line:
x,y=line.split(" -> ")
replacement_text = x[0]+y
mapping[x] = replacement_text
for _ in range(1, steps+1):
processed_string = ''
fo... | steps = 10
with open('input.txt', 'r') as f:
lines = f.read().splitlines()
initial_string = lines[0]
mapping = {}
for line in lines:
if '->' in line:
(x, y) = line.split(' -> ')
replacement_text = x[0] + y
mapping[x] = replacement_text
for _ in range(1, steps + 1):
processed_stri... |
#Occurance of a word in text file
Text = open("abc.txt","r")
d = dict() #Dictionary to store words(keys) and its iterations(values)
# iterate through each line in txt file
for line in Text:
line = line.strip() #remove leading space and \n chrtr
line = line.lower() #convert to lower case
words = line.spl... | text = open('abc.txt', 'r')
d = dict()
for line in Text:
line = line.strip()
line = line.lower()
words = line.split(' ')
for word in words:
if word in d:
d[word] += 1
else:
d[word] = 1
for key in list(d.keys()):
print(key, ':', d[key]) |
# Easy horntail gem
sm.spawnMob(8810102, 95, 260, False)
sm.spawnMob(8810103, 95, 260, False)
sm.spawnMob(8810104, 95, 260, False)
sm.spawnMob(8810105, 95, 260, False)
sm.spawnMob(8810106, 95, 260, False)
sm.spawnMob(8810107, 95, 260, False)
sm.spawnMob(8810108, 95, 260, False)
sm.spawnMob(8810109, 95, 260, False)
sm.s... | sm.spawnMob(8810102, 95, 260, False)
sm.spawnMob(8810103, 95, 260, False)
sm.spawnMob(8810104, 95, 260, False)
sm.spawnMob(8810105, 95, 260, False)
sm.spawnMob(8810106, 95, 260, False)
sm.spawnMob(8810107, 95, 260, False)
sm.spawnMob(8810108, 95, 260, False)
sm.spawnMob(8810109, 95, 260, False)
sm.spawnMob(8810118, 95,... |
# file generated by setuptools_scm
# don't change, don't track in version control
version = "0.1.dev1+ga7b326d.d20210618"
version_tuple = (0, 1, "dev1+ga7b326d", "d20210618")
| version = '0.1.dev1+ga7b326d.d20210618'
version_tuple = (0, 1, 'dev1+ga7b326d', 'd20210618') |
pattern_zero=[0.0, 0.024983563445, 0.048652202498, 0.051282051282, 0.07100591716, 0.076265614727, 0.092044707429, 0.09993425378, 0.102564102564, 0.111768573307, 0.122287968442, 0.127547666009, 0.130177514793, 0.143326758711, 0.147271531887, 0.151216305062, 0.153846153846, 0.163050624589, 0.173570019724, 0.177514792899,... | pattern_zero = [0.0, 0.024983563445, 0.048652202498, 0.051282051282, 0.07100591716, 0.076265614727, 0.092044707429, 0.09993425378, 0.102564102564, 0.111768573307, 0.122287968442, 0.127547666009, 0.130177514793, 0.143326758711, 0.147271531887, 0.151216305062, 0.153846153846, 0.163050624589, 0.173570019724, 0.17751479289... |
class Solution:
def findRepeatNumber(self, nums: List[int]) -> int:
s = set()
for _ in nums:
if _ not in s:
s.add(_)
else:
return _
| class Solution:
def find_repeat_number(self, nums: List[int]) -> int:
s = set()
for _ in nums:
if _ not in s:
s.add(_)
else:
return _ |
def dfs(vertex):
global reachable_vertex
global visited_vertex
if visited_vertex[vertex] is True:
return
visited_vertex[vertex] = True
reachable_vertex.append(vertex)
for i in range(0, vertex_num):
if adjacent_matrix[vertex][i] is True:
dfs(i)
vertex_num = int(inp... | def dfs(vertex):
global reachable_vertex
global visited_vertex
if visited_vertex[vertex] is True:
return
visited_vertex[vertex] = True
reachable_vertex.append(vertex)
for i in range(0, vertex_num):
if adjacent_matrix[vertex][i] is True:
dfs(i)
vertex_num = int(input()... |
N, K=map(int, input().split())
arr=[]
result=0
for i in range(N):
arr.append(int(input()))
for i in range(N-1, -1, -1):
if K==0:
break
else:
result+=K//arr[i]
K=K%arr[i]
print(result)
| (n, k) = map(int, input().split())
arr = []
result = 0
for i in range(N):
arr.append(int(input()))
for i in range(N - 1, -1, -1):
if K == 0:
break
else:
result += K // arr[i]
k = K % arr[i]
print(result) |
myl1 = [12,10,38,22]
myl1.sort(reverse = True)
print(myl1)
myl1.sort(reverse = False)
print(myl1)
| myl1 = [12, 10, 38, 22]
myl1.sort(reverse=True)
print(myl1)
myl1.sort(reverse=False)
print(myl1) |
def minSwap(arr, n, k) :
# Find count of elements
# which are less than
# equals to k
count = 0
for i in range(0, n) :
if (arr[i] <= k) :
count = count + 1
# Find unwanted elements
# in current window of
# size 'count'
bad = ... | def min_swap(arr, n, k):
count = 0
for i in range(0, n):
if arr[i] <= k:
count = count + 1
bad = 0
for i in range(0, count):
if arr[i] > k:
bad = bad + 1
ans = bad
j = count
for i in range(0, n):
if j == n:
break
if arr[i] >... |
class Product:
def __init__(self, name="", price=0.0, discountPercent=0):
self.name = name
self.price = price
self.discountPercent = discountPercent
def getDiscountAmount(self):
return self.price * self.discountPercent / 100
def getDiscountPrice(self):
return self.p... | class Product:
def __init__(self, name='', price=0.0, discountPercent=0):
self.name = name
self.price = price
self.discountPercent = discountPercent
def get_discount_amount(self):
return self.price * self.discountPercent / 100
def get_discount_price(self):
return s... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def isPalindrome(self, head: ListNode) -> bool:
slow, fast = head, head
tot = 0
while fast and fast.next:
fast = ... | class Solution:
def is_palindrome(self, head: ListNode) -> bool:
(slow, fast) = (head, head)
tot = 0
while fast and fast.next:
fast = fast.next.next
slow = slow.next
if not fast:
mid = slow
else:
mid = slow.next
mid = s... |
n = int(input())
count = 0
for i in range(n):
one_word = list(input())
count_arr = [0 for _ in range(26)]
pre = ""
for c in one_word:
idx = ord(c) - 97
cur = c
if (count_arr[idx] == 0) or (pre == cur):
count_arr[idx] += 1
pre = c
if sum(count_arr) == len(o... | n = int(input())
count = 0
for i in range(n):
one_word = list(input())
count_arr = [0 for _ in range(26)]
pre = ''
for c in one_word:
idx = ord(c) - 97
cur = c
if count_arr[idx] == 0 or pre == cur:
count_arr[idx] += 1
pre = c
if sum(count_arr) == len(one_w... |
p=21888242871839275222246405745257275088696311157297823662689037894645226208583
print("over 253 bit")
for i in range (10):
print(i, (p * i) >> 253)
def maxarg(x):
return x // p
print("maxarg")
for i in range(16):
print(i, maxarg(i << 253))
x=0x2c130429c1d4802eb8703197d038ebd5109f96aee333bd027963094f5bb33ad
y =... | p = 21888242871839275222246405745257275088696311157297823662689037894645226208583
print('over 253 bit')
for i in range(10):
print(i, p * i >> 253)
def maxarg(x):
return x // p
print('maxarg')
for i in range(16):
print(i, maxarg(i << 253))
x = 1245960260290650057564252865548478619374135861792959100192203205... |
# This problem was recently asked by AirBNB:
# You are given a singly linked list and an integer k. Return the linked list, removing the k-th last element from the list.
# Try to do it in a single pass and using constant space.
class Node:
def __init__(self, val, next=None):
self.val = val
self.n... | class Node:
def __init__(self, val, next=None):
self.val = val
self.next = next
def __str__(self):
current_node = self
result = []
while current_node:
result.append(current_node.val)
current_node = current_node.next
return str(result)
de... |
a=int(input())
if(a%2==0):
if(a>=2 and a<5):
print ("Not Weird")
elif(a<=20):
print("Weird")
else:
print("Not Weird")
else:
print("Weird")
| a = int(input())
if a % 2 == 0:
if a >= 2 and a < 5:
print('Not Weird')
elif a <= 20:
print('Weird')
else:
print('Not Weird')
else:
print('Weird') |
# test builtin object()
# creation
object()
# printing
print(repr(object())[:7])
| object()
print(repr(object())[:7]) |
class Solution:
def findSpecialInteger(self, arr: List[int]) -> int:
n = len(arr) // 4
c = 0
prev = -1
for e in arr:
if e == prev:
c += 1
else:
c = 1
prev = e
if c > n:
return e
| class Solution:
def find_special_integer(self, arr: List[int]) -> int:
n = len(arr) // 4
c = 0
prev = -1
for e in arr:
if e == prev:
c += 1
else:
c = 1
prev = e
if c > n:
return e |
'''
Data list contains all users info. Each user's info must be a list.
First Element: 0 (int)
Second Element: name (str)
Third Element: username (str)
Fourth Element: toph link (str)
Fifth Element: dimik link (str)
Sixth Element: uri link (str)
Note: If any user does not have an account leave ... | """
Data list contains all users info. Each user's info must be a list.
First Element: 0 (int)
Second Element: name (str)
Third Element: username (str)
Fourth Element: toph link (str)
Fifth Element: dimik link (str)
Sixth Element: uri link (str)
Note: If any user does not have an account leave ... |
students = []
references = []
benefits = []
MODE_SPECIFIC = '1. SPECIFIC'
MODE_HOSTEL = '2. HOSTEL'
MODE_MCDM = '3. MCDM'
MODE_REMAIN = '4. REMAIN'
| students = []
references = []
benefits = []
mode_specific = '1. SPECIFIC'
mode_hostel = '2. HOSTEL'
mode_mcdm = '3. MCDM'
mode_remain = '4. REMAIN' |
secret_password = "marty"
def apasswordcheker(password_checkers):
if password == "marty":
print("You figured out the secret password")
def password_check(passwd):
SpecialSym =['$', '@', '#', '%']
val = True
if len(passwd) < 6:
print('length should be at least 6')
... | secret_password = 'marty'
def apasswordcheker(password_checkers):
if password == 'marty':
print('You figured out the secret password')
def password_check(passwd):
special_sym = ['$', '@', '#', '%']
val = True
if len(passwd) < 6:
print('length should be at least 6')
val = False
... |
def levenshtein_dis(wordA, wordB):
wordA = wordA.lower() # making the wordA lower case
wordB = wordB.lower() # making the wordB lower case
# get the length of the words and defining the variables
length_A = len(wordA)
length_B = len(wordB)
max_len = 0
diff = 0
distances = []
dist... | def levenshtein_dis(wordA, wordB):
word_a = wordA.lower()
word_b = wordB.lower()
length_a = len(wordA)
length_b = len(wordB)
max_len = 0
diff = 0
distances = []
distance = 0
if length_A > length_B:
diff = length_A - length_B
max_len = length_A
elif length_A < leng... |
#
# PySNMP MIB module SHIVA-ETHER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SHIVA-ETHER-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:54:57 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint) ... |
def set_search_path(sender, **kwargs):
conn = kwargs.get('connection')
if conn is not None:
cursor = conn.cursor()
cursor.execute("SET search_path=saleor")
| def set_search_path(sender, **kwargs):
conn = kwargs.get('connection')
if conn is not None:
cursor = conn.cursor()
cursor.execute('SET search_path=saleor') |
def debug_report_progress(repo_ctx, msg):
if repo_ctx.attr.debug:
print(msg)
repo_ctx.report_progress(msg)
for i in range(25000000):
x = 1
| def debug_report_progress(repo_ctx, msg):
if repo_ctx.attr.debug:
print(msg)
repo_ctx.report_progress(msg)
for i in range(25000000):
x = 1 |
def respond(code=200, payload={}, messages=[]):
return {
'status': 'ok' if int(code/100) == 2 else 'error',
'code': code,
'messages': messages,
'payload': payload,
}, code
| def respond(code=200, payload={}, messages=[]):
return ({'status': 'ok' if int(code / 100) == 2 else 'error', 'code': code, 'messages': messages, 'payload': payload}, code) |
# finding least positive number
# Given an array of integers, find the first missing positive integer in linear time and constant space. In other words,
# find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well.
# code contributed by devanshi katy... | def main_function(arr, size):
for i in range(size):
if abs(arr[i]) - 1 < size and arr[abs(arr[i]) - 1] > 0:
arr[abs(arr[i]) - 1] = -arr[abs(arr[i]) - 1]
for i in range(size):
if arr[i] > 0:
return i + 1
return size + 1
def findpositive(arr, size):
j = 0
for i... |
def login_required(func):
def not_logged_in(self, **kwargs):
self.send_login_required({'signin_required': 'you need to sign in'})
return
def check_user(self, **kwargs):
user = self.connection.user
if not user:
return not_logged_in(self, **kwargs)
return func(... | def login_required(func):
def not_logged_in(self, **kwargs):
self.send_login_required({'signin_required': 'you need to sign in'})
return
def check_user(self, **kwargs):
user = self.connection.user
if not user:
return not_logged_in(self, **kwargs)
return func... |
# C.O.R.S.
cors_origins = [
"http://localhost",
"http://localhost:8080",
"http://localhost:3000",
# Production Client on Vercel
"https://twitter-clone.programmertutor.com",
"https://www.twitter-clone.programmertutor.com",
"https://twitter.dericfagnan.com",
"https://www.twitter.dericfagna... | cors_origins = ['http://localhost', 'http://localhost:8080', 'http://localhost:3000', 'https://twitter-clone.programmertutor.com', 'https://www.twitter-clone.programmertutor.com', 'https://twitter.dericfagnan.com', 'https://www.twitter.dericfagnan.com', 'ws://localhost', 'wss://localhost', 'ws://localhost:8080', 'wss:/... |
class Job:
def __init__(self, title, link, date, job_id):
'''
This class holds job information and attributes
'''
self.title = title
self.link = link
self.date = date
self.job_id = job_id
self.applied = False
self.old = False
... | class Job:
def __init__(self, title, link, date, job_id):
"""
This class holds job information and attributes
"""
self.title = title
self.link = link
self.date = date
self.job_id = job_id
self.applied = False
self.old = False
self.new ... |
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "f9af1484",
"metadata": {},
"outputs": [],
"source": [
"# ---------------------- STEP 2: Climate APP\n",
"\n",
"from flask import Flask, json, jsonify\n",
"import datetime as dt\n",
"\n",
"import sqlalchemy\n... | {'cells': [{'cell_type': 'code', 'execution_count': null, 'id': 'f9af1484', 'metadata': {}, 'outputs': [], 'source': ['# ---------------------- STEP 2: Climate APP\n', '\n', 'from flask import Flask, json, jsonify\n', 'import datetime as dt\n', '\n', 'import sqlalchemy\n', 'from sqlalchemy.ext.automap import automap_ba... |
# Add your import statements here
# Add any utility functions here
def rel_docs(query_id,qrels):
j=[item['id'] for item in qrels if item['query_num']==str(query_id)]
return j
def rel_score_as_dict_for_query(query_id,qrels):
docs_score_dict={int(item['id']):int(item['position']) for item in qrels if int(it... | def rel_docs(query_id, qrels):
j = [item['id'] for item in qrels if item['query_num'] == str(query_id)]
return j
def rel_score_as_dict_for_query(query_id, qrels):
docs_score_dict = {int(item['id']): int(item['position']) for item in qrels if int(item['query_num']) == int(query_id)}
return docs_score_di... |
class MockData:
def __init__(self):
self.data = [
'ATGCAT',
'ATGGGT',
'ATGAAT',
]
def get_row(self, i):
return self.sequences[i] | class Mockdata:
def __init__(self):
self.data = ['ATGCAT', 'ATGGGT', 'ATGAAT']
def get_row(self, i):
return self.sequences[i] |
#
# PySNMP MIB module ONEACCESS-DOT11-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ONEACCESS-DOT11-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:25:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, constraints_union, value_size_constraint, single_value_constraint) ... |
class Decipher:
def __init__(self, data='', password=''):
self.data = data
self.password = password
self.result = False
def decipher_password(self):
# For authentication(Deciphering your password)..
helper = self.data.split('*/*/')
count, separator, compare, help... | class Decipher:
def __init__(self, data='', password=''):
self.data = data
self.password = password
self.result = False
def decipher_password(self):
helper = self.data.split('*/*/')
(count, separator, compare, helper_list) = (1, '', '', [])
for i in helper[0]:
... |
class Error(Exception):
pass
class ResourceNotFoundError(Error):
pass
class ResourceAlreadyExistsError(Error):
pass
class DatabaseCommitFailedError(Error):
pass
| class Error(Exception):
pass
class Resourcenotfounderror(Error):
pass
class Resourcealreadyexistserror(Error):
pass
class Databasecommitfailederror(Error):
pass |
N = int(input())
t = N % 360
if t == 90 or t == 270:
print('Yes')
else:
print('No')
| n = int(input())
t = N % 360
if t == 90 or t == 270:
print('Yes')
else:
print('No') |
#!/usr/bin/python3
# Demo of a dictionary comprehension
d={i:chr(i) for i in range(ord('a'),ord('z')+1)}
for k,v in d.items():
print(k,':',v)
| d = {i: chr(i) for i in range(ord('a'), ord('z') + 1)}
for (k, v) in d.items():
print(k, ':', v) |
#!/usr/bin/python3
class GuiService():
def readSettingsFile(self,wert):
settingsFile = open("Settings","r")
file = settingsFile.read()
fileList = file.split("\n")
for element in fileList:
if wert in element:
x = element.split(":")
return x... | class Guiservice:
def read_settings_file(self, wert):
settings_file = open('Settings', 'r')
file = settingsFile.read()
file_list = file.split('\n')
for element in fileList:
if wert in element:
x = element.split(':')
return x[1]
def ge... |
n = int(input("Enter a number you want to check:"))
def digisum(n):
return sum([int(s) for s in str(n)])
def getfactors(n):
k=2
result=[]
while k ** 2 <= n:
while n%k==0:
result.append(k)
n = n // k
k = k +1
if n > 1:
result.append(n)
return resu... | n = int(input('Enter a number you want to check:'))
def digisum(n):
return sum([int(s) for s in str(n)])
def getfactors(n):
k = 2
result = []
while k ** 2 <= n:
while n % k == 0:
result.append(k)
n = n // k
k = k + 1
if n > 1:
result.append(n)
re... |
def obok(n, kost):
szesc = [[[k * n**2 + j * n + i + 1 for i in range(n)] for j in range(n)] for k in range(n)]
p = 0
r = 0
m = 0
for a in range(n):
for b in range(n):
for c in range(n):
if szesc[a][b][c] == kost:
p=a
... | def obok(n, kost):
szesc = [[[k * n ** 2 + j * n + i + 1 for i in range(n)] for j in range(n)] for k in range(n)]
p = 0
r = 0
m = 0
for a in range(n):
for b in range(n):
for c in range(n):
if szesc[a][b][c] == kost:
p = a
r ... |
class OrderNotFound(Exception):
def __init__(self, message='Order tidak ditemukan!'):
self.message = message
super().__init__(self.message)
pass
| class Ordernotfound(Exception):
def __init__(self, message='Order tidak ditemukan!'):
self.message = message
super().__init__(self.message)
pass |
class Solution:
def addDigits(self, num: int) -> int:
while num > 9:
num = sum(int(ch) for ch in str(num))
return num
| class Solution:
def add_digits(self, num: int) -> int:
while num > 9:
num = sum((int(ch) for ch in str(num)))
return num |
value = ''
for i in range(1, 10001):
value = value + str(i) + ' '
value = value.replace('0', ' ')
values = value.split(' ')
total = 0;
for num in values:
if num.lstrip().rstrip().strip() == '':
continue
total += int(num)
print ('Total: ' + str(total))
| value = ''
for i in range(1, 10001):
value = value + str(i) + ' '
value = value.replace('0', ' ')
values = value.split(' ')
total = 0
for num in values:
if num.lstrip().rstrip().strip() == '':
continue
total += int(num)
print('Total: ' + str(total)) |
class Stack:
def __init__(self):
self.data = []
def pop(self):
if self.is_empty():
return None
val = self.data[len(self.data)-1]
self.data = self.data[:len(self.data)-1]
return val
def peek(self):
if self.is_empty():
return None
... | class Stack:
def __init__(self):
self.data = []
def pop(self):
if self.is_empty():
return None
val = self.data[len(self.data) - 1]
self.data = self.data[:len(self.data) - 1]
return val
def peek(self):
if self.is_empty():
return None
... |
class Solution:
def shortestWordDistance(self, words, word1, word2):
i1 = i2 = -1
res, same = float("inf"), word1 == word2
for i, w in enumerate(words):
if w == word1:
if same: i2 = i1
i1 = i
if i2 >= 0: res = min(res, i1 - i2)
... | class Solution:
def shortest_word_distance(self, words, word1, word2):
i1 = i2 = -1
(res, same) = (float('inf'), word1 == word2)
for (i, w) in enumerate(words):
if w == word1:
if same:
i2 = i1
i1 = i
if i2 >= 0:... |
if __name__ == '__main__':
n = int(input())
arr = map(int, input().split(' '))
arr = sorted(list(arr))
arr.reverse()
biggest = arr[0]
for i in arr:
if i != biggest:
print(i)
break
| if __name__ == '__main__':
n = int(input())
arr = map(int, input().split(' '))
arr = sorted(list(arr))
arr.reverse()
biggest = arr[0]
for i in arr:
if i != biggest:
print(i)
break |
class Test():
pass
test = Test()
print(test.__new__)
| class Test:
pass
test = test()
print(test.__new__) |
i = input('carteira em reais: ')
d = float(i)/3.27
print('carteira em dollar: ',d) | i = input('carteira em reais: ')
d = float(i) / 3.27
print('carteira em dollar: ', d) |
class News:
'''
news class to define news Objects
'''
def __init__(self, id, name, description, url, category, language, country):
self.id =id
self.name = name
self.description= description
self.url =url
self.category=category
self.language = language
... | class News:
"""
news class to define news Objects
"""
def __init__(self, id, name, description, url, category, language, country):
self.id = id
self.name = name
self.description = description
self.url = url
self.category = category
self.language = languag... |
class Solution:
# 1st solution, TLE
def shortestPath(self, grid: List[List[int]], k: int) -> int:
ans = [float("inf")]
self.bfs(grid, 0, 0, 0, k, ans)
return ans[0] if ans[0] != float("inf") else -1
def bfs(self, grid, i, j, steps, k, ans):
if k < 0:
return
... | class Solution:
def shortest_path(self, grid: List[List[int]], k: int) -> int:
ans = [float('inf')]
self.bfs(grid, 0, 0, 0, k, ans)
return ans[0] if ans[0] != float('inf') else -1
def bfs(self, grid, i, j, steps, k, ans):
if k < 0:
return
m = len(grid)
... |
class Solution:
def customSortString(self, S: str, T: str) -> str:
char_map = {}
for el in S:
char_map[el] = 0
for el in T:
if el in char_map:
char_map[el] = char_map[el] + 1
else:
char_map[el] = 1
output_str = ""
... | class Solution:
def custom_sort_string(self, S: str, T: str) -> str:
char_map = {}
for el in S:
char_map[el] = 0
for el in T:
if el in char_map:
char_map[el] = char_map[el] + 1
else:
char_map[el] = 1
output_str = ''... |
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def taskflow_repository():
maybe(
http_archive,
name = "taskflow",
urls = [
"https://github.com/taskflow/taskflow/archive/refs/tags/v3.2.0.zip",
... | load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe')
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def taskflow_repository():
maybe(http_archive, name='taskflow', urls=['https://github.com/taskflow/taskflow/archive/refs/tags/v3.2.0.zip'], sha256='dec011fcd9d73ae4bd8ae4d2714c2c108a0... |
line = input()
abbr = line[0]
for i in range(len(line)):
if line[i] == "-":
abbr += line[i+1]
print(abbr)
| line = input()
abbr = line[0]
for i in range(len(line)):
if line[i] == '-':
abbr += line[i + 1]
print(abbr) |
class BinaryTree:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def nodeDepths(root, depth=0):
if root is None:
return 0
return (depth + nodeDepths(root.left, depth + 1)
+ nodeDepths(root.right, depth + 1))
| class Binarytree:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def node_depths(root, depth=0):
if root is None:
return 0
return depth + node_depths(root.left, depth + 1) + node_depths(root.right, depth + 1) |
def sqrt(x):
y = 1.0
while abs(y*y - x) > 1e-6 :
print(y)
y=(y+x/y)/2
return y
if __name__=='__main__':
print(sqrt(99))
| def sqrt(x):
y = 1.0
while abs(y * y - x) > 1e-06:
print(y)
y = (y + x / y) / 2
return y
if __name__ == '__main__':
print(sqrt(99)) |
a1 = str(input('Digite o nome completo de uma pessoa : '))
a3 = a1.strip().lower().find('silva')
if a3 < 0:
print('O nome {} nao possui a palavra Silva'.format(a1))
else:
print('O nome {} possui a palavra Silva'.format(a1))
# ou
nom = str(input('digite o nome : ')).strip()
print('seu nome tem silva? {}'.format(... | a1 = str(input('Digite o nome completo de uma pessoa : '))
a3 = a1.strip().lower().find('silva')
if a3 < 0:
print('O nome {} nao possui a palavra Silva'.format(a1))
else:
print('O nome {} possui a palavra Silva'.format(a1))
nom = str(input('digite o nome : ')).strip()
print('seu nome tem silva? {}'.format('silv... |
#===============================================
#RESOLUTION KEYWORDS
#===============================================
oref = 0 #over refine factor - should typically be set to 0
n_ref = 32 #when n_particles > n_ref, octree refines further
zoom_box_len = 100 #kpc; so the box will be +/- zoom_box_len from the center
bbo... | oref = 0
n_ref = 32
zoom_box_len = 100
bbox_lim = 100000.0
n_processes = 16
n_mpi_processes = 1
n_photons_initial = 100000.0
n_photons_imaging = 100000.0
n_photons_raytracing_sources = 100000.0
n_photons_raytracing_dust = 100000.0
force_random_seed = False
seed = -12345
dustdir = '/home/desika.narayanan/hyperion-dust-0... |
#
# PySNMP MIB module CISCO-VLAN-BRIDGING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-VLAN-BRIDGING-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:18:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, constraints_union, value_range_constraint, single_value_constraint) ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.