content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class_names = [
'agricultural',
'airplane',
'baseballdiamond',
'beach',
'buildings',
'chaparral',
'denseresidential',
'forest',
'freeway',
'golfcourse',
'harbor',
'intersection',
'mediumresidential',
'mobilehomepark',
'overpass',
'parkinglot',
'river',
'runway',
'sparseresidential',
'storagetanks',
... | class_names = ['agricultural', 'airplane', 'baseballdiamond', 'beach', 'buildings', 'chaparral', 'denseresidential', 'forest', 'freeway', 'golfcourse', 'harbor', 'intersection', 'mediumresidential', 'mobilehomepark', 'overpass', 'parkinglot', 'river', 'runway', 'sparseresidential', 'storagetanks', 'tenniscourt'] |
#! /usr/bin/env python3
# func.py -- This script calls the hello function 10 times.
# Author -- Prince Oppong Boamah<regioths@gmail.com>
# Date -- 27th August, 2015
def hello():
print("Hello world!")
print("I am going to call the hello function 10 times")
for i in range(10):
print("hello")
| def hello():
print('Hello world!')
print('I am going to call the hello function 10 times')
for i in range(10):
print('hello') |
#########################################YOLOV3##################################################################
yolov3_params={
'good_model_path' :'/home/ai/model/freezer/ep3587-loss46.704-val_loss52.474.h5',
'anchors_path' :'./goods/freezer/keras_yolo3/model_data/yolo_anchors.txt',
'classes_path' : './go... | yolov3_params = {'good_model_path': '/home/ai/model/freezer/ep3587-loss46.704-val_loss52.474.h5', 'anchors_path': './goods/freezer/keras_yolo3/model_data/yolo_anchors.txt', 'classes_path': './goods/freezer/keras_yolo3/model_data/voc_classes.txt', 'label_path': './goods/freezer/keras_yolo3/model_data/goods_label_map.pbt... |
class RestApiException(Exception):
def __init__(self, message, status_code):
super(RestApiException, self).__init__(message)
self.status_code = status_code
self.message = message
def __unicode__(self, ):
return "%s" % self.message
def __repr__(self, ):
return "%s"... | class Restapiexception(Exception):
def __init__(self, message, status_code):
super(RestApiException, self).__init__(message)
self.status_code = status_code
self.message = message
def __unicode__(self):
return '%s' % self.message
def __repr__(self):
return '%s' % se... |
QUERIES = {
'add_service':
'insert into services(name, type, repeat_period, metadata, status) values("{name}", {type}, {repeat_period}, "{metadata}", 1)',
'services_last_row_id': 'select max(id) from services',
'get_active_services': 'select services.id, services.name, services.type, service_types.T... | queries = {'add_service': 'insert into services(name, type, repeat_period, metadata, status) values("{name}", {type}, {repeat_period}, "{metadata}", 1)', 'services_last_row_id': 'select max(id) from services', 'get_active_services': 'select services.id, services.name, services.type, service_types.Type, services.repeat_... |
adj_descriptions = {
'STR': {
'short': [
'Atk Mod',
'Dmg Adj',
'Test',
'Feat',
],
'long': [
'Melee Attack',
'Damage Adjustment',
'Test of STR',
'Feat of STR',
],
},
'DEX': {
... | adj_descriptions = {'STR': {'short': ['Atk Mod', 'Dmg Adj', 'Test', 'Feat'], 'long': ['Melee Attack', 'Damage Adjustment', 'Test of STR', 'Feat of STR']}, 'DEX': {'short': ['Atk Mod', 'Def Adj', 'Test', 'Feat'], 'long': ['Missile Attack', 'Defense Adjustment', 'Test of DEX', 'Feat of DEX']}, 'CON': {'short': ['HP Adj',... |
def permutationWCaseChangeUtil(input_string, output_string):
if len(input_string) == 0:
print(output_string, end=', ')
return
modified_output_string1 = output_string + input_string[0].upper()
modified_output_string2 = output_string + input_string[0]
modified_input_string = input... | def permutation_w_case_change_util(input_string, output_string):
if len(input_string) == 0:
print(output_string, end=', ')
return
modified_output_string1 = output_string + input_string[0].upper()
modified_output_string2 = output_string + input_string[0]
modified_input_string = input_stri... |
# function = a block of code which is executed only when it is called
name = input("What's your name? ")
age = str(input("What is your age? "))
def trevi(name, age):
print(f'Hello {name}!')
if age == "0":
print(f'Keep Pounding {name}!')
elif age == "1":
print(f'Proud of you {name}. Keep go... | name = input("What's your name? ")
age = str(input('What is your age? '))
def trevi(name, age):
print(f'Hello {name}!')
if age == '0':
print(f'Keep Pounding {name}!')
elif age == '1':
print(f'Proud of you {name}. Keep going!')
else:
print(f"Awesome {name}!That's the way!")
trevi... |
def non_capitalized():
"""
compute the MACD (Moving Average Convergence/Divergence) using ...
"""
def capitalized():
"""
Compute the MACD (Moving Average Convergence/Divergence) using ...
"""
| def non_capitalized():
"""
compute the MACD (Moving Average Convergence/Divergence) using ...
"""
def capitalized():
"""
Compute the MACD (Moving Average Convergence/Divergence) using ...
""" |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def reorderList(self, head):
if head:
arr = []
while head:
arr += head,
head = head.next
... | class Solution(object):
def reorder_list(self, head):
if head:
arr = []
while head:
arr += (head,)
head = head.next
(l, r, prev) = (0, len(arr) - 1, list_node(0))
while l < r:
(prev.next, arr[l].next, prev, l, r... |
for _ in range(int(input())):
j=m=0
for joao in range(3):
x=list(map(int,input().split()))
j+=(x[0]*x[1])
for maria in range(3):
x=list(map(int,input().split()))
m+=(x[0]*x[1])
print("MARIA") if m>j else print("JOAO")
| for _ in range(int(input())):
j = m = 0
for joao in range(3):
x = list(map(int, input().split()))
j += x[0] * x[1]
for maria in range(3):
x = list(map(int, input().split()))
m += x[0] * x[1]
print('MARIA') if m > j else print('JOAO') |
# Copyright 2017 The Bazel Authors. 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | """Bazel rules for creating watchOS applications and bundles."""
load('@build_bazel_rules_apple//apple/bundling:binary_support.bzl', 'binary_support')
load('@build_bazel_rules_apple//apple/bundling:product_support.bzl', 'apple_product_type')
load('@build_bazel_rules_apple//apple/bundling:watchos_rules.bzl', _watchos_ap... |
def add(x,y):
return x + y
def subtract(x,y):
return x - y
def multiply(x,y):
return x * y
def divide(x,y):
return x / y
def exponents(x,y):
return x ** y
while True:
print('Basic Calculator\nSelect your Operator')
print('1. Add')
print('2. Subtract')
print('3. Multiply')
print('... | def add(x, y):
return x + y
def subtract(x, y):
return x - y
def multiply(x, y):
return x * y
def divide(x, y):
return x / y
def exponents(x, y):
return x ** y
while True:
print('Basic Calculator\nSelect your Operator')
print('1. Add')
print('2. Subtract')
print('3. Multiply')
... |
class Car():
chasisLength = 250
wheels = 4
power = False
#self makes reference to the instance in class
#self hace referencia a una instancia al objeto de la misma clase
#self equivale a this en otros lenguajes
def turnOn(self):
self.power = True
def changeLenght(self, n):
self.cha... | class Car:
chasis_length = 250
wheels = 4
power = False
def turn_on(self):
self.power = True
def change_lenght(self, n):
self.changeLenght = n
car1 = car()
print(car1.power)
print(car1.chasisLength)
car1.turnOn()
car1.changeLenght(1200)
print(car1.power)
print(car1.chasisLength) |
def calcula_salario_liquido(salario_bruto):
liquido = salario_bruto - (salario_bruto * 0.15)
return liquido
for c in range(3):
salario = float(input("Informe seu salario bruto: "))
liquido = calcula_salario_liquido(salario)
print(liquido)
| def calcula_salario_liquido(salario_bruto):
liquido = salario_bruto - salario_bruto * 0.15
return liquido
for c in range(3):
salario = float(input('Informe seu salario bruto: '))
liquido = calcula_salario_liquido(salario)
print(liquido) |
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is the Modelscape lesson script for January 31, 2022.
"""
# You can also add comments like this.
# The shortcut to run a line
# Mac - fn + F9
# PC - FN + F9 or Ctrl + F5
print("Hello World")
# Introduction to Python built-in data types
text = "Data Carpentry" # strin... | """
Spyder Editor
This is the Modelscape lesson script for January 31, 2022.
"""
print('Hello World')
text = 'Data Carpentry'
number = 42
pi_value = 3.1415
pi_value
type(number)
print(number)
2 + 2
6 * 7
2 ** 16
13 % 5
13 / 5
3 > 4
numbers = [1, 2, 3]
numbers[0]
practice = ['blue', 'green', 'red']
again = ['blue', 'gr... |
x = 5
print(x)
def f():
x = 2
print(x)
def g():
global x
x = 1
f()
g()
print(x)
| x = 5
print(x)
def f():
x = 2
print(x)
def g():
global x
x = 1
f()
g()
print(x) |
# [] => this is an array. an array is a special type of container that can hold multipe items
# arrays are indexed (their contents get assigned a number)
# the index always starts at 0
choices = ["rock", "paper", "scissors"]
player_lives = 5
ai_lives = 5
total_lives = 5
# True and False are boolean data type
playe... | choices = ['rock', 'paper', 'scissors']
player_lives = 5
ai_lives = 5
total_lives = 5
player = False |
def hint_username(username: str) -> bool:
if len(username) < 3:
return False
elif len(username) > 15:
return False
else:
return True
def is_even(number: int):
if number % 2 == 0:
return True
return False
| def hint_username(username: str) -> bool:
if len(username) < 3:
return False
elif len(username) > 15:
return False
else:
return True
def is_even(number: int):
if number % 2 == 0:
return True
return False |
# 338-counting-bits.py
class Solution(object):
def countBits(self, num):
ret = [0]*(num+1)
for i in range(0, num+1):
ret[i] = ret[i & (i-1)] + 1
return ret
| class Solution(object):
def count_bits(self, num):
ret = [0] * (num + 1)
for i in range(0, num + 1):
ret[i] = ret[i & i - 1] + 1
return ret |
#
# PySNMP MIB module BroadworksMaintenance (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BroadworksMaintenance
# Produced by pysmi-0.3.4 at Mon Apr 29 17:25:36 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ... |
render = ez.Node()
aspect2D = ez.Node()
camera = ez.Camera(parent=render)
camera.y = -10
#Create a mouse picker for the camera:
mouse_picker = ez.collision.MousePicker(camera, mask=ez.mask[1])
#Create a mouse picker for aspect2D:
mouse_picker2D = ez.collision.MousePickre2D(mask=ez.mask[1])
#Load a 2D plane and par... | render = ez.Node()
aspect2_d = ez.Node()
camera = ez.Camera(parent=render)
camera.y = -10
mouse_picker = ez.collision.MousePicker(camera, mask=ez.mask[1])
mouse_picker2_d = ez.collision.MousePickre2D(mask=ez.mask[1])
mesh = ez.load.mesh('plane.bam')
plane = ez.Model(mesh, parent=aspect2D)
plane.scale = 0.2
plane.x = -0... |
s2= "I am learning Python everyday"
s1="Python"
def check(s2, s1):
if (s2.count(s1) > 0):
print("YES")
else:
print("NO")
check(s2, s1)
#b
print(len(s1))
#c
print(s2.replace("Python","C++"))
#d
print(s2.upper())
#e
s2 = s2[:-1]
print(s2)
| s2 = 'I am learning Python everyday'
s1 = 'Python'
def check(s2, s1):
if s2.count(s1) > 0:
print('YES')
else:
print('NO')
check(s2, s1)
print(len(s1))
print(s2.replace('Python', 'C++'))
print(s2.upper())
s2 = s2[:-1]
print(s2) |
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: MIT
__all__ = [
'commands_ip_route',
'commands_iptables_forwarding',
'is_ipv6',
]
CMD_IP = '/sbin/ip'
CMD_IPTABLESv4 = '/sbin/iptables'
CMD_IPTABLESv6 = '/sbin/ip6tables'
def is_ipv6(ip_addr):
return (':' in ip_addr)
def commands_ip_route(device_na... | __all__ = ['commands_ip_route', 'commands_iptables_forwarding', 'is_ipv6']
cmd_ip = '/sbin/ip'
cmd_iptable_sv4 = '/sbin/iptables'
cmd_iptable_sv6 = '/sbin/ip6tables'
def is_ipv6(ip_addr):
return ':' in ip_addr
def commands_ip_route(device_name, ip, *, start=None, stop=None):
assert bool(start) ^ bool(stop)
... |
LMS_LEVELS = {
"programme_preliminaries": 1,
"programming_paradigms": 1,
"html_essentials": 1,
"css_essentials": 1,
"user_centric_frontend_development": 1,
"comparative_programming_languages_essentials": 2,
"javascript_essentials": 2,
"interactive_frontend_development": 2,
"python_es... | lms_levels = {'programme_preliminaries': 1, 'programming_paradigms': 1, 'html_essentials': 1, 'css_essentials': 1, 'user_centric_frontend_development': 1, 'comparative_programming_languages_essentials': 2, 'javascript_essentials': 2, 'interactive_frontend_development': 2, 'python_essentials': 3, 'practical_python': 3, ... |
def main():
n, k, l, c, d, p, nl, np = list(map(int, input().split()))
total_drink = k*l
total_limes = c*d
total_salt = p
print(int(min(int(total_drink/nl), total_limes, int(total_salt/np))/n))
if __name__=='__main__':
main()
| def main():
(n, k, l, c, d, p, nl, np) = list(map(int, input().split()))
total_drink = k * l
total_limes = c * d
total_salt = p
print(int(min(int(total_drink / nl), total_limes, int(total_salt / np)) / n))
if __name__ == '__main__':
main() |
input = """
ok(X) :- p(f(X)), q(f(X)).
q(X) :- p(X).
p(f(a)).
p(f(b,a)).
p(g(c)).
"""
output = """
ok(X) :- p(f(X)), q(f(X)).
q(X) :- p(X).
p(f(a)).
p(f(b,a)).
p(g(c)).
"""
| input = '\nok(X) :- p(f(X)), q(f(X)).\nq(X) :- p(X).\n\np(f(a)).\np(f(b,a)).\np(g(c)).\n'
output = '\nok(X) :- p(f(X)), q(f(X)).\nq(X) :- p(X).\n\np(f(a)).\np(f(b,a)).\np(g(c)).\n' |
"""
kustomize actions
"""
def kustomize_build_action(ctx, srcs, deps, dir, out):
"""Run a build of the kustomize
Args:
ctx: arguments description, can be
multiline with additional indentation.
srcs: source files
out: output directory
deps: dependencies
dir: dire... | """
kustomize actions
"""
def kustomize_build_action(ctx, srcs, deps, dir, out):
"""Run a build of the kustomize
Args:
ctx: arguments description, can be
multiline with additional indentation.
srcs: source files
out: output directory
deps: dependencies
dir: dire... |
# contains the processing code for the ticketer.
class Processor(object):
def __init__(self):
pass
def say(self, message):
return message + "\n"
| class Processor(object):
def __init__(self):
pass
def say(self, message):
return message + '\n' |
"""
Event action's base class.
"""
class BaseEventAction(object):
"""
Event action's base class.
"""
key = ""
name = ""
def func(self, event, character):
"""
Event action's function.
"""
pass
| """
Event action's base class.
"""
class Baseeventaction(object):
"""
Event action's base class.
"""
key = ''
name = ''
def func(self, event, character):
"""
Event action's function.
"""
pass |
EMAIL_SERVER = None
PORT = None
SENDER_EMAIL = None
PASSWORD = None
RECIEVER_EMAIL = None | email_server = None
port = None
sender_email = None
password = None
reciever_email = None |
# Python - 3.6.0
Test.describe('Basic tests')
Test.assert_equals(volume(7, 3), 153)
Test.assert_equals(volume(56, 30), 98520)
Test.assert_equals(volume(0, 10), 0)
Test.assert_equals(volume(10, 0), 0)
Test.assert_equals(volume(0, 0), 0)
| Test.describe('Basic tests')
Test.assert_equals(volume(7, 3), 153)
Test.assert_equals(volume(56, 30), 98520)
Test.assert_equals(volume(0, 10), 0)
Test.assert_equals(volume(10, 0), 0)
Test.assert_equals(volume(0, 0), 0) |
# OpenWeatherMap API Key
weather_api_key = "Put Key Here"
# Google API Key
g_key = "Put key here"
| weather_api_key = 'Put Key Here'
g_key = 'Put key here' |
class Node:
"""
Class representation of a Node for use in a
Doubly Linked List
"""
def __init__(self, data):
self.data = data
self.prev = None
self.next = None
class DoublyLinkedList:
"""
Representation of a Singly Linked List
Methods:
- to_list() - O(N)
... | class Node:
"""
Class representation of a Node for use in a
Doubly Linked List
"""
def __init__(self, data):
self.data = data
self.prev = None
self.next = None
class Doublylinkedlist:
"""
Representation of a Singly Linked List
Methods:
- to_list() - O(N)
... |
def max_number(input_num):
"""Create largest possible number out of the input.
Parameters
----------
input_num : int
Positive integer.
Returns
-------
max_num : int
Maximum number that can be made out of digits present in input_num.
"""
num_to_str = str(input_num)
... | def max_number(input_num):
"""Create largest possible number out of the input.
Parameters
----------
input_num : int
Positive integer.
Returns
-------
max_num : int
Maximum number that can be made out of digits present in input_num.
"""
num_to_str = str(input_num)
... |
"""
This script implements Min-Heaps.
"""
class MinHeap:
def __init__(self):
self.items = []
def leftIndex(self, parent): return 2*parent
def rightIndex(self, parent): return 2*parent+1
def parentIndex(self, child): return (child-1)//2
def hasLeft(self, parent): return len(self.items) > s... | """
This script implements Min-Heaps.
"""
class Minheap:
def __init__(self):
self.items = []
def left_index(self, parent):
return 2 * parent
def right_index(self, parent):
return 2 * parent + 1
def parent_index(self, child):
return (child - 1) // 2
def has_left(... |
class Node(object):
def __init__(self, value, data=None, left=None, right=None):
""" Instantiates the first Node
"""
self.value = value
self.data = data
self.left = left
self.right = right
def __str__(self):
""" Returns a string
"""
return... | class Node(object):
def __init__(self, value, data=None, left=None, right=None):
""" Instantiates the first Node
"""
self.value = value
self.data = data
self.left = left
self.right = right
def __str__(self):
""" Returns a string
"""
retur... |
""" Zola site builder """
load(":content_group.bzl", "ZolaContentGroupInfo")
load("@bazel_skylib//lib:paths.bzl", "paths")
def _site_path(ctx, path = ""):
return paths.join(ctx.label.name + "_site_content", path)
def _generated_html_path(ctx, path = ""):
return "/".join([ctx.label.name, path])
def zola_site... | """ Zola site builder """
load(':content_group.bzl', 'ZolaContentGroupInfo')
load('@bazel_skylib//lib:paths.bzl', 'paths')
def _site_path(ctx, path=''):
return paths.join(ctx.label.name + '_site_content', path)
def _generated_html_path(ctx, path=''):
return '/'.join([ctx.label.name, path])
def zola_site_init... |
BASE_URL = 'http://api.fantasy.nfl.com/v1/players/stats?statType={}&season={}&format=json{}'
STAT_URL = 'http://api.fantasy.nfl.com/v1/game/stats?format=json'
USEFUL_DATA = ('name', 'position', 'stats', 'teamAbbr')
ALL_WEEKS = [x for x in range(1,18)]
ONE_HOUR = 3600
VALID_POSITIONS = (
'QB',
'RB',
'WR... | base_url = 'http://api.fantasy.nfl.com/v1/players/stats?statType={}&season={}&format=json{}'
stat_url = 'http://api.fantasy.nfl.com/v1/game/stats?format=json'
useful_data = ('name', 'position', 'stats', 'teamAbbr')
all_weeks = [x for x in range(1, 18)]
one_hour = 3600
valid_positions = ('QB', 'RB', 'WR', 'TE', 'DEF')
o... |
class InterfaceMeta(type):
def __new__(cls, name, bases, attrs):
if "salad" not in attrs:
attrs["salad"] = "salad"
return super().__new__(cls, name, bases, attrs)
class Interface(metaclass=InterfaceMeta):
def __init__(self, potato):
self.potato = potato
def test_meta():... | class Interfacemeta(type):
def __new__(cls, name, bases, attrs):
if 'salad' not in attrs:
attrs['salad'] = 'salad'
return super().__new__(cls, name, bases, attrs)
class Interface(metaclass=InterfaceMeta):
def __init__(self, potato):
self.potato = potato
def test_meta():
... |
# The variable number is just reference to the object 1001
number = 1001
print(id(number))
print(id(1001))
a1 = 2
print('a1: ', id(a1))
a2 = a1 + 1
print('a2: ', id(a2))
print('three: ', id(3))
b1 = 2
print('b1: ', id(b1))
print('Two: ', id(2))
# All bellow assignments to the 'something' variable is a valid code
so... | number = 1001
print(id(number))
print(id(1001))
a1 = 2
print('a1: ', id(a1))
a2 = a1 + 1
print('a2: ', id(a2))
print('three: ', id(3))
b1 = 2
print('b1: ', id(b1))
print('Two: ', id(2))
something = 12
something = 'Python'
something = ['a', 2, True]
def hello():
print('Hello World')
something = hello
something()
pr... |
# description: global
# date: 2020/6/7 19:15
# author: objcat
# version: 1.0
tool = None | tool = None |
def validate_post(post):
try:
anno_l1 = post['Layer1'].split(' ')
anno_l2 = post['Layer2'].split(' ')
text = post['text']
except KeyError:
return False, 4
if len(anno_l1) != len(anno_l2):
return False, 0
elif '[removed]' in text:
return False, 3
elif... | def validate_post(post):
try:
anno_l1 = post['Layer1'].split(' ')
anno_l2 = post['Layer2'].split(' ')
text = post['text']
except KeyError:
return (False, 4)
if len(anno_l1) != len(anno_l2):
return (False, 0)
elif '[removed]' in text:
return (False, 3)
... |
def get_kwarg(self, name, **kwargs):
return kwargs[name] if name in kwargs else ''
def get_arg(self, name, *args):
return args[0] if len(args) > 0 else '' | def get_kwarg(self, name, **kwargs):
return kwargs[name] if name in kwargs else ''
def get_arg(self, name, *args):
return args[0] if len(args) > 0 else '' |
class Solution:
def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:
dic = [0]*101
for n in nums:
dic[n] += 1
return [sum(dic[0:n]) for n in nums]
| class Solution:
def smaller_numbers_than_current(self, nums: List[int]) -> List[int]:
dic = [0] * 101
for n in nums:
dic[n] += 1
return [sum(dic[0:n]) for n in nums] |
class Employee:
name = "Tom Cruise"
def function(self):
print("This is a message inside the class.")
employeeTom = Employee()
employeeJerry = Employee()
employeeJerry.name = "Jerry"
print(employeeTom.name)
print(employeeJerry.name)
print(employeeJerry.function())
| class Employee:
name = 'Tom Cruise'
def function(self):
print('This is a message inside the class.')
employee_tom = employee()
employee_jerry = employee()
employeeJerry.name = 'Jerry'
print(employeeTom.name)
print(employeeJerry.name)
print(employeeJerry.function()) |
#declare X Data points
testDataX = [1, 2, 3, 4, 5, 6, 7]
lengthX = len(testDataX)
n = lengthX
############## ############## ##############
#declare Y Data points
testDataY = [1.5, 3.8, 6.7, 9.0, 11.2, 13.6, 16.0]
lengthY = len(testDataY)
############## ############## ##############
#find the Variance, or square... | test_data_x = [1, 2, 3, 4, 5, 6, 7]
length_x = len(testDataX)
n = lengthX
test_data_y = [1.5, 3.8, 6.7, 9.0, 11.2, 13.6, 16.0]
length_y = len(testDataY)
mean_y = 0.0
for i in range(lengthY):
mean_y += testDataY[i]
mean_y /= lengthY
s_ey = 0.0
for i in range(lengthY):
s_ey += (testDataY[i] - meanY) ** 2.0
print(... |
# time related parameters
no_intervals = 144
no_periods = 48
no_intervals_periods = int(no_intervals / no_periods)
# household related parameters
# new_households = True
new_households = False
no_households = 100
no_tasks_min = 5
max_demand_multiplier = no_tasks_min
care_f_max = 10
care_f_weight = 1
# pricing related... | no_intervals = 144
no_periods = 48
no_intervals_periods = int(no_intervals / no_periods)
new_households = False
no_households = 100
no_tasks_min = 5
max_demand_multiplier = no_tasks_min
care_f_max = 10
care_f_weight = 1
pricing_table_weight = 1
cost_function_type = 'piece-wise'
zero_digit = 2
var_selection = 'smallest'... |
"""
python + redux == pydux
Redux: http://redux.js.org
A somewhat literal translation of Redux.
Closures in Python are over references, as opposed to
names in JavaScript, so they are read-only. Single-
element arrays are used to create read/write closures.
"""
class ActionTypes(object):
INIT = '@@redux/INIT'... | """
python + redux == pydux
Redux: http://redux.js.org
A somewhat literal translation of Redux.
Closures in Python are over references, as opposed to
names in JavaScript, so they are read-only. Single-
element arrays are used to create read/write closures.
"""
class Actiontypes(object):
init = '@@redux/INIT'
... |
"""
PASSENGERS
"""
numPassengers = 18936
passenger_arriving = (
(6, 4, 3, 7, 5, 0, 4, 5, 1, 2, 1, 1, 0, 6, 4, 2, 3, 3, 2, 0, 1, 9, 1, 0, 0, 0), # 0
(9, 6, 4, 7, 4, 6, 0, 1, 1, 1, 1, 0, 0, 4, 7, 1, 1, 7, 2, 1, 3, 2, 2, 1, 0, 0), # 1
(7, 5, 6, 8, 4, 2, 2, 3, 3, 0, 1, 0, 0, 9, 5, 4, 1, 1, 4, 4, 0, 1, 2, 0, 0, 0), ... | """
PASSENGERS
"""
num_passengers = 18936
passenger_arriving = ((6, 4, 3, 7, 5, 0, 4, 5, 1, 2, 1, 1, 0, 6, 4, 2, 3, 3, 2, 0, 1, 9, 1, 0, 0, 0), (9, 6, 4, 7, 4, 6, 0, 1, 1, 1, 1, 0, 0, 4, 7, 1, 1, 7, 2, 1, 3, 2, 2, 1, 0, 0), (7, 5, 6, 8, 4, 2, 2, 3, 3, 0, 1, 0, 0, 9, 5, 4, 1, 1, 4, 4, 0, 1, 2, 0, 0, 0), (7, 1, 8, 5, 4, ... |
# -*- coding: utf8 -*-
"Files-related convertors"
| """Files-related convertors""" |
"""
Given a positive integer num, write a function which returns True if num is a perfect square else False.
Note: Do not use any built-in library function such as sqrt.
Example 1:
Input: 16
Returns: True
Example 2:
Input: 14
Returns: False
"""
__author__ = 'Daniel'
class Solution(object):
def isPerfectSquare... | """
Given a positive integer num, write a function which returns True if num is a perfect square else False.
Note: Do not use any built-in library function such as sqrt.
Example 1:
Input: 16
Returns: True
Example 2:
Input: 14
Returns: False
"""
__author__ = 'Daniel'
class Solution(object):
def is_perfect_squa... |
################################################
class BasePlantNonUDP(BasePlant):
def init(self):
pass
def stop(self):
pass
def enable(self):
pass
def last_data_ts_arrival(self):
# there's no delay when receiving feedback using the NonUDP classes,
... | class Baseplantnonudp(BasePlant):
def init(self):
pass
def stop(self):
pass
def enable(self):
pass
def last_data_ts_arrival(self):
return time.time()
def disable(self):
pass
def enable_watchdog(self, timeout_ms):
pass
class Armassistplantnon... |
#!/usr/bin/env python3
if __name__ == '__main__':
message = """
The `awscreds` command has been deprecated.
The command worked with the old shared (HSE) AWS account, but
now all labs have been migrated to their own accounts.
If you need help with AWS access, please email helpdesk@fredhutch.org.
"""
pri... | if __name__ == '__main__':
message = '\nThe `awscreds` command has been deprecated. \nThe command worked with the old shared (HSE) AWS account, but\nnow all labs have been migrated to their own accounts. \nIf you need help with AWS access, please email helpdesk@fredhutch.org.\n '
print(message) |
"""
Take a list and write a program that prints out all
the elements of the list that are less than 5.
"""
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
for items in a:
if (items < 5):
print(items)
continue
| """
Take a list and write a program that prints out all
the elements of the list that are less than 5.
"""
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
for items in a:
if items < 5:
print(items)
continue |
catlog = [
"New",
"Macros",
"Manager",
"-",
"Install",
"Contribute",
"update_plg",
"-",
"temporal_plg",
"StackReg",
"Games",
"screencap_plg",
]
| catlog = ['New', 'Macros', 'Manager', '-', 'Install', 'Contribute', 'update_plg', '-', 'temporal_plg', 'StackReg', 'Games', 'screencap_plg'] |
class A:
def speak(self):
return "hello"
def speak_patch(self):
return "world"
A.speak = speak_patch
some_class = A()
print('some_class.speak():', some_class.speak())
some_class2 = A()
print('some_class2.speak():', some_class2.speak())
| class A:
def speak(self):
return 'hello'
def speak_patch(self):
return 'world'
A.speak = speak_patch
some_class = a()
print('some_class.speak():', some_class.speak())
some_class2 = a()
print('some_class2.speak():', some_class2.speak()) |
def requires_userinfo(func):
"""
If userinfo is required and not available then skip the test
"""
def userinfo_available(test):
return func(test) if test.tester.info else 3
return userinfo_available
def return_version_on_fail(func):
"""
If the result from alert is false we return a... | def requires_userinfo(func):
"""
If userinfo is required and not available then skip the test
"""
def userinfo_available(test):
return func(test) if test.tester.info else 3
return userinfo_available
def return_version_on_fail(func):
"""
If the result from alert is false we return a... |
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
_end = '_end_'
def make_trie(words):
root = dict()
for word in words:
current_dict = root
for letter in word:
current_dict = current_dict.setdefault(letter, {})
current_dict[_end] = _e... | _end = '_end_'
def make_trie(words):
root = dict()
for word in words:
current_dict = root
for letter in word:
current_dict = current_dict.setdefault(letter, {})
current_dict[_end] = _end
return root
def get_endings(di, prefix=''):
res = []
for c in di:
i... |
def copy_not_empty_attrs(src, dst):
if src is not None and dst is not None:
for attribute in src.__dict__:
value = getattr(src, attribute)
if value:
setattr(dst, attribute, value)
class NoneDict(dict):
def __init__(self, args, **kwargs):
self.update(args... | def copy_not_empty_attrs(src, dst):
if src is not None and dst is not None:
for attribute in src.__dict__:
value = getattr(src, attribute)
if value:
setattr(dst, attribute, value)
class Nonedict(dict):
def __init__(self, args, **kwargs):
self.update(args... |
def make_arr(data):
t = {}
for ov in data:
if t.get(ov['resource']) is None:
t[ov['resource']] = {}
t[ov['resource']][ov['other_input']] = ov['value']
return t
| def make_arr(data):
t = {}
for ov in data:
if t.get(ov['resource']) is None:
t[ov['resource']] = {}
t[ov['resource']][ov['other_input']] = ov['value']
return t |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ============================================================================
# fap4malware - File analyzation program to detect malware
# Malware definition list
# Copyright (C) 2018 by Ralf Kilian
# Distributed under the MIT License (https://opensource.org/licenses/MIT... | deflist = {'6eb9f90ae2cfe10f0364729298351eb2afba298a6c8b36b47483785b78a87c4e': "Test file included with 'fap4malware'", '275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f': 'EICAR test signature', '2546dcffc5ad854d4ddc64fbf056871cd5a00f2471cb7a5bfd4ac23b6e9eedad': 'EICAR test signature (zipped)', 'e11050... |
def createMatrix(rowCount, colCount):
mat = []
for i in range(rowCount):
rowList = []
for j in range(colCount):
rowList.append(0)
mat.append(rowList)
return mat
with open('input.txt') as file:
input = (file.readline()).split(" ")
n = int(input[0])
... | def create_matrix(rowCount, colCount):
mat = []
for i in range(rowCount):
row_list = []
for j in range(colCount):
rowList.append(0)
mat.append(rowList)
return mat
with open('input.txt') as file:
input = file.readline().split(' ')
n = int(input[0])
k = int(inpu... |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class DeployCertParameters(object):
"""Implementation of the 'DeployCertParameters' model.
Specifies the parameters used to generate and deploy a certificate.
Attributes:
cert_file_name (string): Specifies the filename of the certificate.
... | class Deploycertparameters(object):
"""Implementation of the 'DeployCertParameters' model.
Specifies the parameters used to generate and deploy a certificate.
Attributes:
cert_file_name (string): Specifies the filename of the certificate.
password (list of string): Specifies the passsword ... |
# Source: https://github.com/sventhijssen/pgmtocnf
# Authors: Sven Thijssen and Gillis Hermans
class Literal():
def __init__(self, name, positive=True):
super(Literal, self).__init__()
self.atom = name
self.positive = positive
def __str__(self):
if self.positive:
re... | class Literal:
def __init__(self, name, positive=True):
super(Literal, self).__init__()
self.atom = name
self.positive = positive
def __str__(self):
if self.positive:
return str(self.atom)
elif self.atom == 'False':
return str(self.atom)
... |
# -*- coding:utf-8 -*-
class Message(dict):
"""
The base message class
"""
pass
| class Message(dict):
"""
The base message class
"""
pass |
class PointsSet:
def __init__(self, delaunay_diagram, initial_point, minimal_point_density, minimal_regression):
self._delaunay = delaunay_diagram
self._points = {initial_point}
self._triangles = set()
self._points_to_add = set(p for p in delaunay_diagram.neighbours[initial_point]
... | class Pointsset:
def __init__(self, delaunay_diagram, initial_point, minimal_point_density, minimal_regression):
self._delaunay = delaunay_diagram
self._points = {initial_point}
self._triangles = set()
self._points_to_add = set((p for p in delaunay_diagram.neighbours[initial_point] ... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def flatten(self, root):
"""
:type root: TreeNode
:rtype: void Do not return anything, modify root in-place inste... | class Solution:
def flatten(self, root):
"""
:type root: TreeNode
:rtype: void Do not return anything, modify root in-place instead.
"""
self.suc = None
self.helper(root)
def helper(self, node):
if not node:
return None
self.helper(no... |
# x = 101
#
# # print no of digits in a number
# print(len(str(x)))
#
#
# def end_zeros(num: int) -> int:
# # your code here
# # return str(num).count('0')
# return len(str(num)) - len(str(num).rstrip('0'))
#
#
# if __name__ == '__main__':
# print("Example:")
# print(end_zeros(0))
#
# # These "a... | def correct_sentence(text: str) -> str:
text = text[0].upper() + text[1:]
if text[len(text) - 1] != '.':
return text[0:] + '.'
return text[0:]
if __name__ == '__main__':
print('Example:')
print(correct_sentence('greetings, friends'))
assert correct_sentence('greetings, friends') == 'Gree... |
myStr = "Hello World"
#print(dir(myStr))
print(myStr.upper())
print(myStr.swapcase())
print(myStr.replace("Hello", "Goodbye"))
print(myStr.count("l"))
print(myStr.startswith("he"))
print(myStr.split(" "))
print(len(myStr))
print(myStr.find("e"))
print(myStr.index("e"))
print(myStr.isnumeric())
print(myStr.isalpha())... | my_str = 'Hello World'
print(myStr.upper())
print(myStr.swapcase())
print(myStr.replace('Hello', 'Goodbye'))
print(myStr.count('l'))
print(myStr.startswith('he'))
print(myStr.split(' '))
print(len(myStr))
print(myStr.find('e'))
print(myStr.index('e'))
print(myStr.isnumeric())
print(myStr.isalpha())
print(myStr[4])
prin... |
expected_output = {
"boot_loader_version": "Not applicable",
"build": "4567",
"chassis_serial_number": "None",
"commit_pending": "false",
"configuration_template": "CLItemplate_srp_vedge",
"controller_compatibility": "20.3",
"cpu_allocation": {"control": 1, "data": 3, "total": 4},
"cpu_r... | expected_output = {'boot_loader_version': 'Not applicable', 'build': '4567', 'chassis_serial_number': 'None', 'commit_pending': 'false', 'configuration_template': 'CLItemplate_srp_vedge', 'controller_compatibility': '20.3', 'cpu_allocation': {'control': 1, 'data': 3, 'total': 4}, 'cpu_reported_reboot': 'Not Applicable'... |
#
# PySNMP MIB module NET-SNMP-EXAMPLES-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NET-SNMP-EXAMPLES-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:18:07 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, constraints_union, value_size_constraint, constraints_intersection) ... |
class Led:
def __init__(self, devpath, brightness):
self.devpath = devpath
self.brightness = brightness
def __del__(self):
self.set_brightness(0)
def set_brightness(self, brightness):
f = open(self.devpath, "w")
f.write("%d\n" % brightness)
f.close();
self.brightness = brightness
| class Led:
def __init__(self, devpath, brightness):
self.devpath = devpath
self.brightness = brightness
def __del__(self):
self.set_brightness(0)
def set_brightness(self, brightness):
f = open(self.devpath, 'w')
f.write('%d\n' % brightness)
f.close()
... |
#!/usr/bin/env python3
def transform(s1, s2):
first_list = map(int, s1.split())
second_list = map(int, s2.split())
zipped = list(zip(first_list, second_list))
final_list = [a * b for a, b in zipped]
return final_list
def main():
s1 = "1 51 12 4"
s2 = "4 6 99 2"
print(transfor... | def transform(s1, s2):
first_list = map(int, s1.split())
second_list = map(int, s2.split())
zipped = list(zip(first_list, second_list))
final_list = [a * b for (a, b) in zipped]
return final_list
def main():
s1 = '1 51 12 4'
s2 = '4 6 99 2'
print(transform(s1, s2))
if __name__ == '__mai... |
def gradingStudents(calificaciones):
for i in range(len(calificaciones)):
if calificaciones[i] > 40:
redondeo = int(calificaciones[i] / 5 + 1)
if redondeo * 5 - calificaciones[i] < 3:
calificaciones[i] = redondeo * 5
print(calificaciones)
continuar = False
while ... | def grading_students(calificaciones):
for i in range(len(calificaciones)):
if calificaciones[i] > 40:
redondeo = int(calificaciones[i] / 5 + 1)
if redondeo * 5 - calificaciones[i] < 3:
calificaciones[i] = redondeo * 5
print(calificaciones)
continuar = False
while ... |
'''
Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the average gray scale (rounding down) of all the 8 surrounding cells and itself. If a cell has less than 8 surrounding cells, then use as many as you can.
Example 1:
Input... | """
Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the average gray scale (rounding down) of all the 8 surrounding cells and itself. If a cell has less than 8 surrounding cells, then use as many as you can.
Example 1:
Input... |
'''
Author: your name
Date: 2021-01-27 08:45:44
LastEditTime: 2021-02-08 12:02:54
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath: /mmdetection/configs/_base_/default_runtime.py
'''
checkpoint_config = dict(interval=1)
# yapf:disable
log_config = dict(
interval=50,
hooks=[
... | """
Author: your name
Date: 2021-01-27 08:45:44
LastEditTime: 2021-02-08 12:02:54
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath: /mmdetection/configs/_base_/default_runtime.py
"""
checkpoint_config = dict(interval=1)
log_config = dict(interval=50, hooks=[dict(type='TextLoggerHook')])
d... |
__doc__ = """
This module all the config parameters for bcs serevr
"""
# Storage config
DB_FILE = 'bank.db'
# Server config
TCP_IP = '127.0.0.1'
TCP_PORT = 5010
MAX_CONNECTIONS = 2
MESSAGE_LENGTH = 1024
# Superuser account
ADMIN_NAME = 'admin'
ADMIN_EMAIL = 'admin@bcs.com'
ADMIN_PASSWORD = 'admin'
# Log config... | __doc__ = '\n This module all the config parameters for bcs serevr\n'
db_file = 'bank.db'
tcp_ip = '127.0.0.1'
tcp_port = 5010
max_connections = 2
message_length = 1024
admin_name = 'admin'
admin_email = 'admin@bcs.com'
admin_password = 'admin'
log_filename = 'logs/bcs_server.log'
max_size_in_kb = 20
number_of_files... |
print("hello Dodger fans")
print("I know you haven't won a world series in a while")
print("but the rest of the NL West fans don't care")
print("Go Brewers!")
print("Even though you beat the Rockies")
| print('hello Dodger fans')
print("I know you haven't won a world series in a while")
print("but the rest of the NL West fans don't care")
print('Go Brewers!')
print('Even though you beat the Rockies') |
## Example #1
print("\n\n")
print("*" * 80)
print("Example #1")
print("*" * 80)
up = True
down = True
if up:
print("Going Up!")
elif down:
print("Going Down!")
elif up and down:
print("Going No Where!!!")
else:
print("Error!")
## Example #2
# print("\n\n")
# print("*" * 80)
# print("Example #2... | print('\n\n')
print('*' * 80)
print('Example #1')
print('*' * 80)
up = True
down = True
if up:
print('Going Up!')
elif down:
print('Going Down!')
elif up and down:
print('Going No Where!!!')
else:
print('Error!') |
#!/usr/bin/env python
"""Struct to define a planning problem which will be solved by a planner"""
class PlanningProblem:
def __init__(self, params):
self.initialized = False
self.params = params
def initialize(self, env=None, lattice=None, cost=None, heuristic=None, start_n=None, goal_n=None, visualize=... | """Struct to define a planning problem which will be solved by a planner"""
class Planningproblem:
def __init__(self, params):
self.initialized = False
self.params = params
def initialize(self, env=None, lattice=None, cost=None, heuristic=None, start_n=None, goal_n=None, visualize=False):
... |
class Solution:
def fib(self, N: int) -> int:
if N==0:
return 0
if N==1:
return 1
dp=[0]*N
dp[0]=1
dp[1]=1
for i in range(2,N):
dp[i]=dp[i-1]+dp[i-2]
return dp[N-1]
| class Solution:
def fib(self, N: int) -> int:
if N == 0:
return 0
if N == 1:
return 1
dp = [0] * N
dp[0] = 1
dp[1] = 1
for i in range(2, N):
dp[i] = dp[i - 1] + dp[i - 2]
return dp[N - 1] |
w=int(input())
if w>2:
if w%2==0:
print("YES")
else:
print("NO")
else:
print("NO")
| w = int(input())
if w > 2:
if w % 2 == 0:
print('YES')
else:
print('NO')
else:
print('NO') |
#
# PySNMP MIB module ODSLANBlazer7000-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ODSLANBlazer7000-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:32:20 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_size_constraint, value_range_constraint, single_value_constraint) ... |
def wiggle_sort(nums: list) -> list:
"""
Python implementation of wiggle.
Example:
>>> wiggle_sort([0, 5, 3, 2, 2])
[0, 5, 2, 3, 2]
>>> wiggle_sort([])
[]
>>> wiggle_sort([-2, -5, -45])
[-45, -2, -5]
>>> wiggle_sort([-2.1, -5.68, -45.11])
[-45.11, -2.1, -5.68]
... | def wiggle_sort(nums: list) -> list:
"""
Python implementation of wiggle.
Example:
>>> wiggle_sort([0, 5, 3, 2, 2])
[0, 5, 2, 3, 2]
>>> wiggle_sort([])
[]
>>> wiggle_sort([-2, -5, -45])
[-45, -2, -5]
>>> wiggle_sort([-2.1, -5.68, -45.11])
[-45.11, -2.1, -5.68]
"""
for... |
"""
RiscEmu (c) 2021 Anton Lydike
SPDX-License-Identifier: MIT
"""
# Colors
"""
FMT_RED = '\033[31m'
FMT_ORANGE = '\033[33m'
FMT_GRAY = '\033[37m'
FMT_CYAN = '\033[36m'
FMT_GREEN = '\033[32m'
FMT_MAGENTA = '\033[35m'
FMT_BLUE = '\033[34m'
FMT_YELLOW = '\033[93m'
FMT_BOLD = '\033[1m'
FMT_NONE = '\033[0m'
FMT_UNDERLI... | """
RiscEmu (c) 2021 Anton Lydike
SPDX-License-Identifier: MIT
"""
"\nFMT_RED = '\x1b[31m'\nFMT_ORANGE = '\x1b[33m'\nFMT_GRAY = '\x1b[37m'\nFMT_CYAN = '\x1b[36m'\nFMT_GREEN = '\x1b[32m'\nFMT_MAGENTA = '\x1b[35m'\nFMT_BLUE = '\x1b[34m'\nFMT_YELLOW = '\x1b[93m'\n\nFMT_BOLD = '\x1b[1m'\nFMT_NONE = '\x1b[0m'\nFMT_UNDERLIN... |
"""
CHALLENGE - Extensions
"""
# ** Challenge** Add each element of the tuple1 to list1 *individually* and print the result.
list1 = [6, 12, 9, 4, 10, 1]
tuples = [(15,3), (6,2), (1, 8)]
| """
CHALLENGE - Extensions
"""
list1 = [6, 12, 9, 4, 10, 1]
tuples = [(15, 3), (6, 2), (1, 8)] |
def welcome():
starsintro = "*" * 38
welcomemessage = ("""
** Welcome to the Snakes Cafe! **
** Please see our menu below. **
** **
** To quit at any time, type "quit" **
""")
print(" " + starsintro + welcomemessage + starsintro)
welcome()
def menu():
Ap... | def welcome():
starsintro = '*' * 38
welcomemessage = '\n ** Welcome to the Snakes Cafe! **\n ** Please see our menu below. **\n ** **\n ** To quit at any time, type "quit" **\n '
print(' ' + starsintro + welcomemessage + starsintro)
welcome()
def menu():
... |
""" QuoLab Add on for Splunk
"""
# Assumption: All sys.path fixes have already been applied by the importer
__version__ = "0.12.2"
| """ QuoLab Add on for Splunk
"""
__version__ = '0.12.2' |
#W.A.P TO CHECK WHETHER THE NO. IS ARMSTRONG NO.
x=int(input('Enter a no.'))
sum=0
t=x
while(t!=0):
sum=sum+(int(t%10))**3
t=t/10
if(sum==x):
print('It is an armstrong no.')
else:
print('It is not an armstrong no.') | x = int(input('Enter a no.'))
sum = 0
t = x
while t != 0:
sum = sum + int(t % 10) ** 3
t = t / 10
if sum == x:
print('It is an armstrong no.')
else:
print('It is not an armstrong no.') |
# coding: utf8
FILENAME_TYPE = {'full': '_T1w_space-MNI152NLin2009cSym_res-1x1x1_T1w',
'cropped': '_T1w_space-MNI152NLin2009cSym_desc-Crop_res-1x1x1_T1w',
'skull_stripped': '_space-Ixi549Space_desc-skullstripped_T1w'}
| filename_type = {'full': '_T1w_space-MNI152NLin2009cSym_res-1x1x1_T1w', 'cropped': '_T1w_space-MNI152NLin2009cSym_desc-Crop_res-1x1x1_T1w', 'skull_stripped': '_space-Ixi549Space_desc-skullstripped_T1w'} |
"""
From Kapil Sharma's lecture 9 Jun 2020
Given the index of a node, and the head of linked list, delete the node at that index.
Singly-linked list
Return True if successful; False if not.
"""
class Node:
def __init__(self, value):
self.value = value
self.next = None
def delete_node(index, he... | """
From Kapil Sharma's lecture 9 Jun 2020
Given the index of a node, and the head of linked list, delete the node at that index.
Singly-linked list
Return True if successful; False if not.
"""
class Node:
def __init__(self, value):
self.value = value
self.next = None
def delete_node(index, hea... |
T = [3614090360, 3905402710, 606105819, 3250441966,
4118548399, 1200080426, 2821735955, 4249261313,
1770035416, 2336552879, 4294925233, 2304563134,
1804603682, 4254626195, 2792965006, 1236535329,
4129170786, 3225465664, 643717713, 3921069994,
3593408605, 38016083, 3634488961, 38894294... | t = [3614090360, 3905402710, 606105819, 3250441966, 4118548399, 1200080426, 2821735955, 4249261313, 1770035416, 2336552879, 4294925233, 2304563134, 1804603682, 4254626195, 2792965006, 1236535329, 4129170786, 3225465664, 643717713, 3921069994, 3593408605, 38016083, 3634488961, 3889429448, 568446438, 3275163606, 41076033... |
def driver():
list = []
age1 = input("Enter the first number:")
age2 = input("Enter the second number:")
def swap(num1, num2):
if age1 > age2:
list.append(age2)
list.append(age1)
if age1 < age2:
list.append(age1)
list.append(age2)
swap(age1,age2)
print("the swapped result (fr... | def driver():
list = []
age1 = input('Enter the first number:')
age2 = input('Enter the second number:')
def swap(num1, num2):
if age1 > age2:
list.append(age2)
list.append(age1)
if age1 < age2:
list.append(age1)
list.append(age2)
swap... |
db_config = {
# 'host': 'localhost',
# 'port': 1337,
# 'unix_socket': '/var/lib/mysql/mysql.sock',
'user': 'root',
# 'passwd': 'password,
'db': 'logs_db'
}
| db_config = {'user': 'root', 'db': 'logs_db'} |
def Ro_decimal_constr(x_par):
"""
The function to compute the non linear contraint of the Ro parameter.
:param list x_par: list of parameters, beta, r and pop.
:return: the Ro value.
:rtype: float
"""
if len(x_par) == 3:
return x_par[0] * x_par[2] / x_par[1]
else:
return x_par... | def ro_decimal_constr(x_par):
"""
The function to compute the non linear contraint of the Ro parameter.
:param list x_par: list of parameters, beta, r and pop.
:return: the Ro value.
:rtype: float
"""
if len(x_par) == 3:
return x_par[0] * x_par[2] / x_par[1]
else:
r... |
make_numbers = {'American Motors': 1,
'Jeep/Kaiser-Jeep/Willys Jeep': 2,
'AM General': 3,
'Chrysler': 6,
'Dodge': 7,
'Imperial': 8,
'Plymouth': 9,
'Eagle': 10,
'Ford': 12,
... | make_numbers = {'American Motors': 1, 'Jeep/Kaiser-Jeep/Willys Jeep': 2, 'AM General': 3, 'Chrysler': 6, 'Dodge': 7, 'Imperial': 8, 'Plymouth': 9, 'Eagle': 10, 'Ford': 12, 'Lincoln': 13, 'Mercury': 14, 'Buick/Opel': 18, 'Cadillac': 19, 'Chevrolet': 20, 'Oldsmobile': 21, 'Pontiac': 22, 'GMC': 23, 'Saturn': 24, 'Grumman'... |
def twoNumberSum(array, targetSum):
# Write your code here.
dic = {}
for i in range(len(array)):
if targetSum - array[i] in dic:
return [array[i], targetSum - array[i]]
else:
dic[array[i]] = i
return [] | def two_number_sum(array, targetSum):
dic = {}
for i in range(len(array)):
if targetSum - array[i] in dic:
return [array[i], targetSum - array[i]]
else:
dic[array[i]] = i
return [] |
# Calcular todos em:
# KM HM DAM M DM CM MM
var = float(input("Digite um valor: "))
print("O valor em decimetro fica {}".format(var * 10)) #DM
print("O valor em centimetros fica {}".format(var * 100)) #CM
print("O valor e milimetros fica {}".format(var * 1000)) #MM
print("O valor em metros fica {}".format(var * 10... | var = float(input('Digite um valor: '))
print('O valor em decimetro fica {}'.format(var * 10))
print('O valor em centimetros fica {}'.format(var * 100))
print('O valor e milimetros fica {}'.format(var * 1000))
print('O valor em metros fica {}'.format(var * 10000))
print('O valor em decametro fica {}'.format(var / 10))
... |
class SOG():
"""The class for SOG training
"""
def __init__(self, *args):
"""Set the training hyper-parameters including the network, the criterion, the optimizer,
training epoches, sampling distribution and sampling number etc.
Initialize the components here
"""
pas... | class Sog:
"""The class for SOG training
"""
def __init__(self, *args):
"""Set the training hyper-parameters including the network, the criterion, the optimizer,
training epoches, sampling distribution and sampling number etc.
Initialize the components here
"""
pass
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.