content stringlengths 7 1.05M |
|---|
MOCK_DATA = [
{
"symbol": "sy1",
"companyName": "cn1",
"exchange": "ex1",
"industry": "in1",
"website": "ws1",
"description": "dc1",
"CEO": "ceo1",
"issueType": "is1",
"sector": "sc1",
},
{
"symbol": "sy2",
"companyName"... |
# Only used for PyTorch open source BUCK build
# @lint-ignore-every BUCKRESTRICTEDSYNTAX
def is_arvr_mode():
if read_config("pt", "is_oss", "0") == "0":
fail("This file is for open source pytorch build. Do not use it in fbsource!")
return False
|
# a = "crazy_python"
# print(id(a))
# print(id("crazy" + "_" + "python"))
"""
output:
41899952
41899952
"""
a = 'crazy'
b = 'crazy'
c = 'crazy!!'
d = 'crazy!!'
e, f = "crazy!", "crazy!"
print (a is b)
print(c is d)
print(e is f)
"""
output:
True
True
True
"""
array_1 = [1,2,3,4]
print(id(array_1))
g1 = (x for x in... |
class ValueParsingOptions(object,IDisposable):
"""
Options for parsing strings into numbers with units.
ValueParsingOptions()
"""
def Dispose(self):
""" Dispose(self: ValueParsingOptions) """
pass
def GetFormatOptions(self):
"""
GetFormatOptions(self: ValueParsingOptions) -> FormatOptions... |
"""Below Python Programme demonstrate lstrip
functions in a string"""
#Example:
random_string = ' this is good '
# Leading whitepsace are removed
print(random_string.lstrip())
# Argument doesn't contain space
# No characters are removed.
print(random_string.lstrip('sti'))
print(random_string.lstrip('s ti'))
|
# Diffusion 2D
nx = 20 # number of elements
ny = nx
# number of nodes
mx = nx + 1
my = ny + 1
# initial values
iv = {}
for j in range(int(0.2*my), int(0.3*my)):
for i in range(int(0.5*mx), int(0.8*mx)):
index = j*mx + i
iv[index] = 1.0
print("iv: ",iv)
config = {
"solverStructureDiagramFile": "so... |
__title__ = 'lightwood'
__package_name__ = 'mindsdb'
__version__ = '0.14.1'
__description__ = "Lightwood's goal is to make it very simple for developers to use the power of artificial neural networks in their projects."
__email__ = "jorge@mindsdb.com"
__author__ = 'MindsDB Inc'
__github__ = 'https://github.com/mindsdb/... |
# Problem: input: an unsorted array A[lo..hi]; | output: the (left) median of the given array
# Source: SCU COEN279 DAA HW3 Q3
# Author: Shreyas Padhye
# Algorithm: Decrease-Conquer
class solution():
def left_median(self, A):
if len(A) == 1 or len(A) == 2:
return A[0]
else:
... |
"""
This module provide all the functions or classes which help pre-processing data.
For example, splitting paragraph into sentences
"""
|
"""
Defines CPU Options for use in the CPU target
"""
class FastMathOptions(object):
"""
Options for controlling fast math optimization.
"""
def __init__(self, value):
# https://releases.llvm.org/7.0.0/docs/LangRef.html#fast-math-flags
valid_flags = {
'fast',
'... |
def get_belief(sent):
if '<|belief|>' in sent:
tmp = sent.strip(' ').split('<|belief|>')[-1].split('<|action|>')[0]
else:
return []
tmp = tmp.strip(' .,')
tmp = tmp.replace('<|endofbelief|>', '')
tmp = tmp.replace('<|endoftext|>', '')
belief = tmp.split(',')
new_belief = []... |
'''
Created on 2016-01-13
@author: Wu Wenxiang (wuwenxiang.sh@gmail.com)
'''
DEBUG = False |
description = 'Helmholtz field coil'
group = 'optional'
includes = ['alias_B']
tango_base = 'tango://phys.kws1.frm2:10000/kws1/'
devices = dict(
I_helmholtz = device('nicos.devices.entangle.PowerSupply',
description = 'Current in coils',
tangodevice = tango_base + 'gesupply/ps2',
unit = ... |
# Test checked
class SymbolTable(object):
def __init__(self):
self._symbols = \
{ \
'SP':0, 'LCL':1, 'ARG':2, 'THIS':3, 'THAT':4, \
'R0':0, 'R1':1, 'R2':2, 'R3':3, 'R4':4, 'R5':5, 'R6':6, 'R7':7, \
'R8':8, 'R9':9, 'R10':10, 'R11':11, 'R12':12, 'R13':13, 'R14'... |
''' This the demonstration of range function in python'''
class Range:
"""A class that mimic's the built-in range class"""
def __init__(self, start, stop=None, step=1):
"""Initialize a Range instance
Semantic is similar to built-in range class
"""
if step == 0:
raise ValueError('step cannot be 0')
i... |
# File: question3.py
# Author: David Lechner
# Date: 11/19/2019
'''Ask some questions about goats'''
# REVIEW: We write `NUM_GOATS` in all caps because it is a constant. We set it
# once at the begining of the program and don't change after that.
NUM_GOATS = 10 # This is how many goats I have
# REVIEW: The input()... |
# lec6.4-removeDups.py
# edX MITx 6.00.1x
# Introduction to Computer Science and Programming Using Python
# Lecture 6, video 4
# Demonstrates performing operations on lists
# Demonstrates how changing a list while iterating over it creates
# unintended problems
def removeDups(L1, L2):
for e1 in L1:
if e1 ... |
def compareTriplets(a, b):
result = []
aliceScore =0
bobScore = 0
for Alice, Bob in zip(a, b):
if Alice > Bob:
aliceScore +=1
continue
if Bob > Alice:
bobScore +=1
continue
if Alice == Bob:
continue
result.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def test():
message = int(input('Введите целое число:'))
if message > 0:
positive(message)
else:
negative(message)
def negative(message):
print(f'Число {message} отрицательное')
def positive(message):
print(f"Число {message} положи... |
#file extension
'''n = input("enter file name with extension:")
f_ext = n.split('.')
x = f_ext[-1]
print(x)
#sum
n = input("enter one number:")
temp = n
temp1 = temp+temp
temp2 = temp+temp+temp
val = int(n)+int(temp1)+int(temp2)
print(val)
#Multiline comment
print("a string that you \"don\'t\" have to escape \n This... |
""""IMC
O IMC - Índice de Massa Corporal é um critério da Organização Mundial
de Saúde para dar uma indicação sobre a condição de peso de uma pessoa
adulta. A fórmula é IMC = peso / (altura) 2 . Elabore um algoritmo que
leia o peso e a altura de um adulto e mostre sua condição de acordo com
a tabela abaixo:
- Abai... |
# Python - Object Oriented Programming
# In here we will use special methods, also called as Magic methods.
# Double underscore is called as dunder. We have seen dunder __init__ fuction
# we will see __repr__ and __str__ in here.
# we can also have custom dunder that we can create for performing certain
# tasks as func... |
# File: okta_consts.py
#
# Copyright (c) 2018-2022 Splunk Inc.
#
# 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 applic... |
#
"""
Array addition
Have the function ArrayAddition(arr) take the array of numbers stored in arr and return the string true if any combination of numbers in the array (excluding the largest number) can be added up to equal the largest number in the array, otherwise return the string false. For example: if arr cont... |
"""
1. Make a table value -> [index].
2. Make an empty set of the tuples (i, j, k)
3. For-loop through array. Pick two random elements. Test set for a third that completes the triplet (N^2)
4. Confirm i != j !=k, add to ret set. convert ret set to list and return it.
"""
class Solution:
def threeSum(self, n... |
class Node:
def __init__(self, dataval = None):
self.dataval = dataval
self.next = None
self.prev = None
def __str__(self):
return str(self.dataval)
class MyList:
def __init__(self):
self.first = None
self.last = None
def add(self, dataval):... |
category_layers = {
"title": "Hazards",
"abstract": "",
"layers": [
{
"include": "ows_refactored.hazards.burntarea.ows_provisional_ba_cfg.layers",
"type": "python",
},
]
}
|
class Logger:
# Time: O(1), Space: O(M) all incoming messages
def __init__(self):
# Initialize a data structure to store messages
self.messages = {}
def shouldPrintMessage(self, timestamp: int, message: str) -> bool:
# If the message streaming in does not exist add to dictionary
... |
def add_native_methods(clazz):
def getScrollbarSize__int__(a0):
raise NotImplementedError()
def setValues__int__int__int__int__(a0, a1, a2, a3, a4):
raise NotImplementedError()
def setLineIncrement__int__(a0, a1):
raise NotImplementedError()
def setPageIncrement__int__(a0, a1)... |
"""
Avoid already-imported warning cause of we are importing this package from
run wrapper for loading config.
You can see documentation here:
https://docs.pytest.org/en/latest/reference.html
under section PYTEST_DONT_REWRITE
"""
|
number = int(input("Which number do you want to choose"))
if number % 2 == 0:
print("This is an even number.")
else:
print("This is an odd number.") |
# General info
AUTHOR_NAME = "Jeremy Gordon"
SITENAME = "Flow"
EMAIL_PREFIX = "[ Flow ] "
TAGLINE = "A personal dashboard to focus on what matters"
SECURE_BASE = "https://flowdash.co"
# Emails
APP_OWNER = "onejgordon@gmail.com"
ADMIN_EMAIL = APP_OWNER
DAILY_REPORT_RECIPS = [APP_OWNER]
SENDER_EMAIL = APP_OWNER
NOTIF_E... |
class StandartIO:
def read(self, file_name):
f = open(file_name, "r")
result = f.read()
f.close()
return result
def write(self, file_name, data):
f = open(file_name, "w")
f.write(data)
f.close()
def append(self, file_name, data, line):
cont... |
a=input('输入你的分数: ')
a=int(a)
if a>=90:
print('优秀')
if a>=80:
print('良好')
if a>=60:
print('普通') |
N, M = map(int, input().split())
grid = [input() for _ in range(N)]
max_length = min(N, M)
def is_square(n):
for i in range(N-n+1):
for j in range(M-n+1):
if is_same(n, i, j):
return True
return False
def is_same(k, x, y):
if grid[x][y] == grid[x][y+k-1] == grid[x+k-1][... |
"""Pylons requires that packages have a lib.base and lib.helpers
So we've added on here so we can run tests in the context of the tg
package itself, pylons will likely remove this restriction before
1.0 and this package can then be removed.
""" |
def KGI(serial):
if len(str(serial)) == 10 :
enterprise = "362"
tests = "3713713713713"
synthetic = enterprise+str(serial)
step1 =[]
for i in range(len(synthetic)):
step1.append(str(int(synthetic[i])*int(tests[i])))
step2 = 0
for i in rang... |
class JadeError(Exception):
# RPC error codes
INVALID_REQUEST = -32600
UNKNOWN_METHOD = -32601
BAD_PARAMETERS = -32602
INTERNAL_ERROR = -32603
# Implementation specific error codes: -32000 to -32099
USER_CANCELLED = -32000
PROTOCOL_ERROR = -32001
HW_LOCKED = -32002
NETWORK_MISMA... |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def zigzagLevelOrder(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
"""
... |
"""
Dictionaries are lists of key value pairs.
The key can be any object that doesn't change and the value can be any object.
The key and values have a colon ':' between them.
{ Key:Value, Key:Value, Key:Value}
"""
#
# Creating empty dictionaries
#
data = {}
data = dict()
#
# Dictionary with three pairs usin... |
#Day 1:
#Python Program to check if a Number Is Positive Or Negative
#Step 1. Start
#Step 2. Insert the number.
#Step 3. If the number is greater than zero, then print, “The number is Positive”
#Step 4. Else print, “You entered Negative”
#Step 5. Stop
#Code
num = int(input("Enter a Number: "))
if num > 0:
print("... |
def sum(arr):
if len(arr) == 1:
return arr[0]
return arr[0] + sum(arr[1:])
print(sum([2, 2, 4, 6])) # 14
|
WEEK0 = 'week0'
WEEK1 = 'week1'
MONTH0 = 'month0'
MONTH1 = 'month1'
DATE_RANGES = [WEEK0, WEEK1, MONTH0, MONTH1]
FORMS_SUBMITTED = 'forms_submitted'
CASES_TOTAL = 'cases_total'
CASES_ACTIVE = 'cases_active'
CASES_OPENED = 'cases_opened'
CASES_CLOSED = 'cases_closed'
LEGACY_TOTAL_CASES = 'totalCases'
LEGACY_CASES_UP... |
# for no processing
# the generators for non essential parameters need to provide the
# default value when called with None
def nothing(strin):
if strin is None:
return 'default'
return strin
def prot_core(strin):
return strin.split(',')
# {'keyword in input file':(essential?,method to call(pr... |
# Minimum distance to skip in meters for skeleton creation.
skip_rate = 100
# seconds to skip while creating the estimate trail from raw trail
jump_seconds = 100
# Distance vehicle can travel away from route, used in case of identifying trails that leave a skeleton and then join again.
d1 = 1000 # meters
# Distance to ... |
QUESTIONS = [
{
"text": "Nechi yoshsiz?",
"choices": ["18 yoki undan kichik", "19 - 64", "65 yoki undan katta"],
},
{
"text": "Yaqinda siz ushbu alomatlardan birini boshdan kechirganmisiz?",
"choices": [
"Isitma yoki titroq",
"Nafas olishda yengil yoki o'r... |
'''
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as:
a binary tree in which the left and right subtrees of every node differ in height by no more than 1.
'''
|
class CinemaDatabaseMixin:
"""
mixin to make spider use database's cinema table
"""
use_cinema_database = True
class ShowingDatabaseMixin:
"""
mixin to make spider use database's showing table
"""
use_showing_database = True
class MovieDatabaseMixin:
"""
mixin to make spider ... |
def f1():
print('call f1')
def f2():
return 'some value'
|
"""API key storage for direct order retrieval."""
# Key example:
#
# KEYS = {
# 'bittrex': {
# 'key': 'mykey',
# 'secret': 'mysecret'
# }
# }
KEYS = {
}
|
"""Rules for importing Nixpkgs packages."""
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "workspace_and_buildfile")
load("@bazel_skylib//lib:sets.bzl", "sets")
load("@bazel_skylib//lib:versions.bzl", "versions")
load("@bazel_tools//tools/cpp:cc_configure.bzl", "cc_autoconf_impl")
load(
"@bazel_tools//tool... |
{
"name" : "ZK Biometric Device Integration Kware (ZKTECO) Demo (UDP)",
"version" : "1.0",
"author" : "JUVENTUD PRODUCTIVA VENEZOLANA",
"category" : "HR",
"website" : "https://www.youtube.com/channel/UCTj66IUz5M-QV15Mtbx_7yg",
"description": "Module for the connection between odoo and zkteco dev... |
class HierarchicalVirtualizationHeaderDesiredSizes(object):
""" HierarchicalVirtualizationHeaderDesiredSizes(logicalSize: Size,pixelSize: Size) """
def Equals(self,*__args):
"""
Equals(self: HierarchicalVirtualizationHeaderDesiredSizes,comparisonHeaderSizes: HierarchicalVirtualizationHeaderDesiredSizes) -> bo... |
# Задача 1. Вариант 10.
# Напишите программу, которая будет сообщать род деятельности и псевдоним под
# которым скрывается Ричард Дженкинс. После вывода информации программа должна
# дожидаться пока пользователь нажмет Enter для выхода.
# Колеганов Никита Сергеевич
# 29.05.2016
print("Ричард Дженкинс извествен по имен... |
f = open("1/input.txt", "rt")
# read line by line
lines = f.readlines()
line = lines[0]
floor = 0
firstBasement = None
for i in range(0, len(line)):
if line[i] == "(":
floor += 1
else:
floor -= 1
if (floor < 0) & (firstBasement == None):
firstBasement = i+1
print("answer 1 - " +... |
a = [int(x) for x in input().split()]
if a[0] >= a[1]:
a[1] += 24
print(f"O JOGO DUROU {a[1] - a[0]} HORA(S)") |
# -*- coding: utf-8 -*-
R = float(input())
PI = 3.14159
VOLUME = (4 / 3) * PI * (R ** 3)
print("VOLUME = %.3f" % (VOLUME)) |
f = open("textfile.txt");
for line in f:
print (line)
f.close()
|
# search_data: The data to be used in a search POST.
search_data = {
'metodo': 'buscar',
'acao': '',
'resumoFormacao': '',
'resumoAtividade': '',
'resumoAtuacao': '',
'resumoProducao': '',
'resumoPesquisador': '',
'resumoIdioma': '',
'resumoPresencaDGP': '',
'resumoModalidade': '... |
class Solution(object):
def destCity(self, paths):
origin, destination = [], []
for p in paths:
origin.append(p[0])
destination.append(p[1])
for d in destination:
if d not in origin :
return d |
class AsyncRunner:
async def __call__(self, facade_method, *args, **kwargs):
await self.connection.rpc(facade_method(*args, **kwargs))
class ThreadedRunner:
pass
# Methods are descriptors??
# get is called with params
# set gets called with the result?
# This could let us fake the protocol we want
#... |
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def make_list(values: list[int]) -> list[ListNode]:
v = []
for i, val in enumerate(values):
v.append(ListNode(val))
if i > 0:
v[i - 1].next = v[i]
return v
def same_values(head: ListNode,... |
"""
Default disk quota assigned to each new user
Units: Bytes (Base 2 - 1 kiB = 1024 bytes)
Default: 100 MiB
Note: Make migrations when updating value
"""
DEFAULT_QUOTA = 104857600
"""
How long the 'Change Password' URL should be
valid, in days.
Current: 1 day (24 Hours)
"""
PASSWORD_RESET_TIMEOUT_DAYS = 1
"""
Extern... |
def test_d_1():
assert True
def test_d_2():
assert True
def test_d_3():
assert True
|
#!/usr/bin/env python3
class Node():
def __init__(self, parent=None, position=None):
self.parent = parent # parent node
self.position = position
#self.position = (position[1], position[0]) # y, x
self.distance_from_start = 0
self.distance_to_end = 0
self.cost = ... |
class ContactList(list):
def search(self, name):
"""Return all contacts that contain the search value
in their name."""
matching_contacts = []
for contact in self:
if name in contact.name:
matching_contacts.append(contact)
return matching_contacts
... |
registry = set()
def register(active=True):
def decorate(func):
print('Running registry (active=%s)->decorate(%s)' % (active, func))
if active:
registry.add(func)
else:
registry.discard(func)
return func
return decorate
@register(active=False)
def f1()... |
'''
Description:
Given a collection of numbers that might contain duplicates, return all possible unique permutations.
Example:
Input: [1,1,2]
Output:
[
[1,1,2],
[1,2,1],
[2,1,1]
]
'''
class Solution:
# @param num, a list of integer
# @return a list of lists of integers
def permuteUnique(s... |
# -*- coding: utf-8 -*-
"""
1669. Merge In Between Linked Lists
You are given two linked lists: list1 and list2 of sizes n and m respectively.
Remove list1's nodes from the ath node to the bth node, and put list2 in their place.
The blue edges and nodes in the following figure indicate the result:
Build the result... |
## 백준 9498
## 시험성적
## 조건문, 구현
def examScore(n):
pass
if n <101 and n > 89:
print('A')
elif n > 79:
print('B')
elif n > 69:
print('C')
elif n > 59:
print('D')
else:
print('F')
if __name__ == "__main__":
N = int(input())
examScore(N)
''' 참고 숏코드
p... |
def x1(y):
if y < 10:
z = x1(y+1)
z += 1
return z + 3
return y
def x2(y):
if y < 10:
z = x2(y+1)
return z + 3
return y
x1(5)
x2(5) |
# This file is used with the GYP meta build system.
# http://code.google.com/p/gyp
# To build try this:
# svn co http://gyp.googlecode.com/svn/trunk gyp
# ./gyp/gyp -f make --depth=`pwd` libexpat.gyp
# make
# ./out/Debug/test
{
'target_defaults': {
'default_configuration': 'Debug',
'configurations': ... |
# 简单的while循环
# 从1开始, 打印小于等于5的整数
current_number = 1
while current_number <= 5:
print(current_number)
current_number += 1
# 让用户选择何时退出
prompt = "\nTell me something, and I will repeat it back to you:"
prompt += "\nEnter 'quit' to end the program. "
message = ""
while message != 'quit':
message = input(pro... |
x = [1,2,3]
y = [1,2,3]
print(x == y)
print(x is y)
|
class KostenPlaatsError(Exception):
pass
class ServerError(Exception):
pass
class FaultCodeNotFoundError(Exception):
"""Exception when faultcode not found"""
pass
class TwinfieldFaultCode(Exception):
"""Exception when Twinfield has raised a faultcode"""
pass
class SelectOfficeError(Exc... |
# Equal
# https://www.interviewbit.com/problems/equal/
#
# Given an array A of integers, find the index of values that satisfy A + B = C + D, where A,B,C & D are integers values in the array
#
# Note:
#
# 1) Return the indices `A1 B1 C1 D1`, so that
# A[A1] + A[B1] = A[C1] + A[D1]
# A1 < B1, C1 < D1
# A1 < C1, B1... |
{
"targets": [
{
"target_name": "gomodule_addon",
"sources": ["nodegomodule.cc"],
"include_dirs": [
"<(module_root_dir)/../../"
],
"libraries": ["<(module_root_dir)/../../../gomodule/build/gomodule.so"]
}
]
}
|
{
"targets": [
{
# OpenSSL has a lot of config options, with some default options
# enabling known insecure algorithms. What's a good combinations
# of openssl config options?
# ./config no-asm no-shared no-ssl2 no-ssl3 no-hw no-zlib no-threads
#... |
def make_matrix(rows=0, columns=0, list_of_list=[[]]):
'''
(int, int, list of list) -> list of list (i.e. matrix)
Return a list of list (i.e. matrix) from "list_of_list" if given
or if not given a "list_of_list" parameter,
then prompt user to type in values for each row
and return a matrix with ... |
# date: 2019.09.24
# https://stackoverflow.com/questions/58085910/python-convert-u0048-style-unicode-to-normal-string/58086131#58086131
print('#U0048#U0045#U004C#U004C#U004F'.replace('#U', '\\u').encode().decode('raw_unicode_escape'))
|
a, b = map(int, input().split())
product = a * b
if product % 2 == 0:
print("Even")
else:
print("Odd")
|
# encoding = utf-8
f= open('listing11-4.txt','w')
f.write('Hello, ')
# print(f.read()) io.UnsupportedOperation: not readable 如果文件没有关闭,那么不可对其进行读操作。
f.close()
f = open('listing11-4.txt','r+')
print(f.read(3))
# 'r+'和'w+'之间有个重要差别:后者截断文件,而前者不会这样做。
f2= open('listing11-5.txt','r')
print(f2.read()) |
# f = open('读文件01', mode='r', encoding='utf-8')
# for line in f:
# print(line.strip())
# f.seek(0) # 移动到开头
#
# for line in f:
# print(line.strip())
# f.close()
# f = open('读文件01', mode='r', encoding='utf-8')
# f.seek(3) # 3byte => 1中文
# s = f.read(1) # 读取一个字符
# print(s)
# print(f.tell()) # 光标在哪儿???
# f.clo... |
SSS_VERSION = '1.0'
SSS_FORMAT = 'json'
SERVICE_TYPE = 'sss'
ENDPOINT_TYPE = 'publicURL'
AUTH_TYPE = "identity"
ACTION_PREFIX = ""
|
fd=open('NIST.result','r')
output = fd.readlines()
BLEUStrIndex = output.index('BLEU score = ')
blu_new = float(output[BLEUStrIndex+13:BLEUStrIndex+19])
|
class Solution:
def strWithout3a3b(self, A, B):
"""
:type A: int
:type B: int
:rtype: str
"""
if A < B:
s_list = []
while A>0 and B>0:
A -= 1
B -= 1
s_list.append('ba')
index = 0
... |
# 此处可 import 模块
"""
@param string line 为单行测试数据
@return string 处理后的结果
"""
def solution(line):
# 缩进请使用 4 个空格,遵循 PEP8 规范
# please write your code here
# return 'your_answer'
a, b = line.strip().split('-')
return str(int(a)-int(b))
# a_list = [int(x) for x in a]
# b_list = [int(x) for x in... |
# Given an array of integers ( sorted) and integer Val.Implement a function that takes A
# and Val as input parameters and returns the lower bound of Val. ex- A =[-1,-1,2,3,5] Val=4
# Ans=3. As 3 is smaller than 4
def lowerBound(arr, key):
s = 0
e = len(arr)
while s<=e:
mid = (s+e)//2
if ... |
expected_output = {
'model': 'C9300-24P',
'os': 'iosxe',
'platform': 'cat9k',
'version': '17.06.01',
}
|
massA = float(input("Enter first mass - unit kg\n"))
massB = float(input("Enter second mass - unit kg\n"))
radius = float(input("Enter radius - unit metres\n"))
Gravity = 6.673*(10**(-11))
force = Gravity * massA * massB / (radius**2)
print("The force of gravity acting on the bodies is",round(force,5),"N")
|
#Section 1: Terminology
# 1) What is a recursive function?
# A recursive function is a function that call itself
#
# 2) What happens if there is no base case defined in a recursive function?
# Without the base the recursive function wouldn't be complete and it will get an error message.
#
#
# 3) What is the first thi... |
class Constants: # pylint: disable=too-few-public-methods
"""
TO CHANNEL FROM BOT: Login URL prefix
"""
TO_CHANNEL_FROM_BOT_LOGIN_URL_PREFIX = 'https://login.microsoftonline.com/'
"""
TO CHANNEL FROM BOT: Login URL token endpoint path
"""
TO_CHANNEL_FROM_BOT_TOKEN_ENDPOINT_PATH = '/oaut... |
a=int(input(">>"))
s1=0
while a>0:
s=a%10
a=int(a/10)
s1=s1+s
#print(s)
print(s1)
|
STKMarketData_t = {
"trading_day": "string",
"update_time": "string",
"update_millisec": "int",
"update_sequence": "int",
"instrument_id": "string",
"exchange_id": "string",
"exchange_inst_id": "string",
"instrument_status": "int",
"last_price": "double",
"volume": "int",
"la... |
#!/usr/bin/evn python3
# coding=utf-8
#######################
# 此配置文件用于生产环境 #
#######################
"""
# server 配置
"""
server = {
# 67108864 64M
# 134217728 128M
# 268435456 256M
# 536870912 512M
# 1073741824 1G
"max_buffer_size": 268435456,
"port": 8899,
}
"""
# App 配置
"""
app ... |
# Crie um programa onde o usuário possa digitar sete valores numéricos e cadastre-os em uma lista única que mantenha separados os valores pares e ímpares. No final, mostre os valores pares e ímpares em ordem crescente.
valores = [[],[]]
numero = 0
for x in range(0,7):
numero = int(input('Digite um número: '))
i... |
class Circle:
def __init__(self, x, y, radius):
self.radius = radius
self.x = x
self.y = y
self.perimeter = self.calcPerimeter() #init des différentes variables de la classe
def calcPerimeter(self):
self.perimeter = self.x + self.y #methode de la fonction
p = Circle(1,... |
class Other:
def __init__(self, _name):
self._name = _name
@property
def name(self):
return self._name
@staticmethod
def decode(data):
f_name = data["name"]
if not isinstance(f_name, unicode):
raise Exception("not a string")
return Other(f_name)
def encode(self):
data = di... |
'''
dengan python bisa melakukan manipulasi sebuah file
sumber referensi: https://www.petanikode.com/python-file/
ditulis pada: 14-02-2021
'''
#membaca file yang akan di tulis
#w = write, ini digunakan untuk mengubah isi dari sebuah file
file = open('file.txt', 'w')
#membuat sebuah user inputan
text = input('masukka... |
# EX 1: Bank Exercise
#
# Create a Bank, an Account, and a Customer class.
# All classes should be in a single file.
# The bank class should be able to hold many account.
# You should be able to add new accounts.
# he Account class should have relevant details.
# The Customer class Should also have relevant details.
#
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.