content stringlengths 7 1.05M |
|---|
# Quantidade de primos no intervalo
# Escreva uma função que recebe dois números a e b e devolve a quantidade de números de primos p tais que a≤p≤b.
# O nome da sua função deve ser primos_entre.
def eh_primo (num):
if num < 2 or num > 2 and num % 2 == 0:
return False
else:
i = 3
while i... |
class Node:
def __init__(self, data):
self.data = data
self.left = self.right = None
def printSpiral(root):
h = height(root)
condi = False
for i in range(1, h + 1):
printGivenLevel(root, i, condi)
condi = not condi
def printGivenLevel(root, level, condi):
if ro... |
MAX_WORKER = 20
SUPPORTED_FEATURES = ['garbage_collection']
SUPPORTED_SCHEDULES = ['hours']
SUPPORTED_RESOURCE_TYPE = ['inventory.CloudService', 'inventory.CloudServiceType', 'inventory.Region']
DEFAULT_REGION = 'ap-northeast-2'
FILTER_FORMAT = []
CLOUD_SERVICE_GROUP_MAP = {
'IAM': 'IAMConnectorManager',
'Dyna... |
# Course title: Udemy Course: Introduction to the Python Language
# Instructor: Prof. Dr. Diego Mariano
# Example adapted by: Charles Fernandes de Souza
# Date: July 10, 2021
# Print Message
print("Hello, World!")
print("Running Google Colab with Python")
|
def merge(lst1,lst2):
lst = []
while lst1 and lst2:
if lst1[0] < lst2[0]:
lst.append(lst1[0])
lst1.remove(lst1[0])
elif lst1[0] > lst2[0]:
lst.append(lst2[0])
lst2.remove(lst2[0])
else:
lst.append(lst1[0])
lst1.remov... |
class Alternativa():
def __init__(self, contenido: str, ayuda: str):
self.contenido = contenido
self.ayuda= ayuda
def mostrar_alternativa(self) -> None:
print(self.contenido)
if self.ayuda:
print(f"({self.ayuda})") |
"""
Specification for objects to be accessed, for the purpose of dataframe
interchange between libraries, via the ``__dataframe__`` method on a libraries'
data frame object.
For guiding requirements, see https://github.com/data-apis/dataframe-api/pull/35
Concepts in this design
-----------------------
1. A `Buffer`... |
PAD = 0
EOS = 1
BOS = 2
UNK = 3
UNK_WORD = '<unk>'
PAD_WORD = '<pad>'
BOS_WORD = '<s>'
EOS_WORD = '</s>'
NEG_INF = -10000 # -float('inf') |
# !/usr/bin/env python3
#############################################################################
# #
# Program purpose: Prints even numbers in list before an exception. #
# The exception being inclusive. ... |
employees = []
with open("employees.txt", mode="r") as myfile:
for line in myfile:
employee = line.strip().split(",")
full_name, salary, birth_year, department, full_time = employee
employees.append((full_name, float(salary), int(birth_year),
department, full_time =... |
#Escribir un programa que almacene las asignaturas de un curso (por ejemplo Matemáticas, Física, Química, Historia y Lengua) en una lista y la muestre por pantalla.
condicion = True
lista = []
while condicion:
asignatura = input("Ingrese la Asignatura \n")
lista.append(asignatura)
respuesta = input("Ingres... |
a=[]
n=int(input("Enter no. of elements: "))
print("Enter array:")
for x in range(n):
element=int(input())
a.append(element)
a.sort()
b=[]
for i in range(0,len(a)-1):
if a[i]==a[i+1]:
b.append(a[i])
b=list(set(b))
a=set(a)
while(len(b)>0):
a.remove(b[0])
b.pop(0)
print("Output:",end=" ")
pri... |
N, K = map(int, input().split())
A = list(map(int, input().split()))
bcs = [0] * 41
for i in range(N):
a = A[i]
for j in range(41):
if a & (1 << j) != 0:
bcs[j] += 1
X = 0
for i in range(40, -1, -1):
if bcs[i] >= N - bcs[i]:
continue
t = 1 << i
if X + t <= K:
X ... |
# MAXSPPROD
# https://www.interviewbit.com/problems/maxspprod/
#
# You are given an array A containing N integers. The special product of each ith integer in
# this array is defined as the product of the following:<ul>
#
# LeftSpecialValue: For an index i, it is defined as the index j such that A[j]>A[i] (i>j).
# If mu... |
def fuzzy_merge(df_1, df_2, key1, key2, threshold=90, limit=2):
"""
:param df_1: the left table to join
:param df_2: the right table to join
:param key1: key column of the left table
:param key2: key column of the right table
:param threshold: how close the matches should be to return a match, b... |
# Assignment 1
def assignment_1():
print("Working on assignment 1\n")
# Assignment 2
def number_is_even(counter):
if counter % 2 == 0:
return True
else:
return False
def assignment_2():
for counter in range (1,21):
if number_is_even(counter):
print("Even numb... |
class Solution:
def getSum(self, a: int, b: int) -> int:
a &= 0xFFFFFFFF
b &= 0xFFFFFFFF
while b:
carry = a & b
a = a ^ b
b = ((carry) << 1) & 0xFFFFFFFF
return a if a < 0x80000000 else ~(a ^ 0xFFFFFFFF)
|
x = input('escriu alguna cosa: ')
print('el tipus primitiu d’aquest valor és', type(x))
print('el que heu escrit només té espais?', x.isspace())
print('el que heu escrit és numèric?', x.isnumeric())
print('el que heu escrit és alfabètic?', x.isalpha())
print('el que heu escrit és alfanumèric?', x.isalnum())
print('és e... |
a=1
b=3
c=a+b
print(c) |
UL = {}
MT = {
'start_message' : ['Welcome to the StolenBottle Bot. I was created to store and reproduce all content that you and '
'other users share with me.\n'
'Send me whatever you want (text, audio, text, etc.) and I will reply with something from mine archive.\n'... |
michelson_coding_test_case = """from unittest import TestCase
from tests import get_data
from pytezos.michelson.micheline import micheline_to_michelson, michelson_to_micheline
class MichelsonCodingTest{case}(TestCase):
def setUp(self):
self.maxDiff = None
"""
test_michelson_parse = """
def tes... |
"""
Script that will navigate the "maze" in testworld
"""
def navigate(env, callback):
for _ in range(100):
callback(env.step([0, 0]))
for _ in range(11):
callback(env.step([0, -30]))
for _ in range(10):
callback(env.step([0, 0]))
for _ in range(123):
callback(env.s... |
#!/usr/bin/python
# list_sorting.py
numbers = [4, 3, 6, 1, 2, 0, 5 ]
print (numbers)
numbers.sort()
print (numbers)
|
# 堆排序
def buildMaxHeap(lists):
"""
构造最大堆
:param lists:
:return:
"""
llen = len(lists)
for i in range(llen >> 1, -1, -1):
heapify(lists, i, llen)
def heapify(lists, i, llen):
"""
堆化
:param lists:
:param i:
:return:
"""
largest = i
left = 2 * i + 1
... |
def read_file(path):
f = open(path, 'a+')
f.seek(0)
files = [line for line in f.readlines()]
f.close()
return files |
#
# PySNMP MIB module ELTEX-MES-BRIDGE-ERPS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-MES-BRIDGE-ERPS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:46:17 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... |
# config.py - Vite's configuration script
title = "icyphox"
author = ""
header = """<a href="/"><- back</a>"""
# actually the sidebar
footer = f"""
<img class="logo" src="/static/white.svg" alt="icyphox's avatar" style="width: 55%"/>
<p>
<span class="sidebar-link">email</span>
<br>
<a href="mail... |
DATASETS = {
"imdb": {
"train": "s3://suching-dev/final-datasets/imdb/train.jsonl",
"dev": "s3://suching-dev/final-datasets/imdb/dev.jsonl",
"test": "s3://suching-dev/final-datasets/imdb/test.jsonl",
"unlabeled": "s3://suching-dev/final-datasets/imdb/unlabeled.jsonl",
"refere... |
class LinkedQueue:
""" FIFO queue implementation using a sigle linked list for storage """
#--------------------------------------------------------------------------------
class _Node:
""" LightWeight, non public class for storing a singly linked node """
__slots__ = '_element', '_next'
def __init__(self,... |
'''
this function can handle oracle script with block comment
handle change drop table table to
begin execute immediate \'drop table UTLMGT_DASHBOARD.temp_gen_dm_auth_2\'; exception when others then null; end
'''
def convertToBODSScript ( path):
f0 = open(path,'r')
f1 = []
for line in f0:
... |
size = int(input())
arr=[]
for i in range(size):
string = list(input())
rev_string = list(reversed(string))
msg = "Funny"
for j in range(len(string)):
#print(j)
if not abs(ord(string[j])-ord(string[j-1])) == abs(ord(rev_string[j])-ord(rev_string[j-1])):
msg="Not Funny"
... |
# 检查两个字符串相等和不等
car_1 = 'audi'
car_2 = 'bwm'
if car_1 == car_2:
print("不执行")
if car_1 != car_2:
print('执行')
# 使用函数lower()的测试
car = 'audi'
if car.lower() == 'audi':
print('执行')
if car.lower() != 'audi':
print('不执行')
# 检查两个数相等、不等、小于、大于等于和小于等于
number_1 = 416
number_2 = 504
if number_1 == number_2:
pr... |
def convert_coordinates(hpos, vpos, width, height, x_res, y_res):
"""
x = (coordinate['xResolution']/254.0) * coordinate['hpos']
y = (coordinate['yResolution']/254.0) * coordinate['vpos']
w = (coordinate['xResolution']/254.0) * coordinate['width']
h = (coordinate['yResolution']/254.0) * coo... |
family = 'wiktionary'
mylang = 'en'
usernames['wiktionary']['en'] = u'AryamanA' # change to your username
console_encoding = 'utf-8'
minthrottle = 0
maxthrottle = 1 |
{
2 : {
"operator" : "selection",
"selectivity" : 0.2
},
4 : {
"operator" : "selection",
"selectivity" : 0.5
},
5 : {
"operator" : "join",
"selectivity" : 0.19,
"multimatch" : False
},
7 : {
"operator" : "selection",
... |
"""
Follow up for N-Queens problem.
Now, instead outputting board configurations, return the total number of
distinct solutions.

"""
class Solution(object):
def totalNQueens(self, n):
"""
:type n: int
:rtype: i... |
"""
Given an Array of non-negative intergers find if we can divide the array into two sub arrays of equal sum
"""
dp = ([[False for i in range(50)]
for i in range(10)])
def EqualSumDp(a, n):
s = sum(a)
if s & 1:
return False
s = s//2
for j in range(n+1):
dp[j][0] = True
f... |
while True:
inp = input('Enter a number: ')
if inp == 'done' :
break
try:
num = float(inp)
except:
print ('Invalid input')
continue
numbers = list(num)
minimum = None
maximum = None
for num in numbers : ... |
"""
EXERCÍCIO 049: Tabuada v2.0
Refaça o EXERCÍCIO 009, mostrando a tabuada de um número que
o usuário escolher, só que agora utilizando um laço for.
"""
continuar = True
while continuar:
n = int(input('Digite um número para ver a sua tabuada: '))
x = 0
for c in range (0, 10):
x += 1
p... |
# -*- coding: utf-8 -*-
# 设置数据集文件目录
BASE_DIR = "/home/zhouql"
# BASE_DIR = "/home/zhou/0-Research"
HOME_DIR = BASE_DIR + "/CodeSumy"
WORKDIR = HOME_DIR + "/data/workdir"
PNG_HOME = HOME_DIR + "/data/pngSaved"
MODEL_HOME = BASE_DIR + "/CodeSumy/src/model/modelSaved"
# 设置数据集的构造 设置数据集划分比例和规模
DOWNLOAD_DATA = False
SPLITE_... |
# Programmed by </Rudransh Joshi> | Class XII - A | Kendriya Vidyalaya Haldwani Cantt :)
out = [] # Initialising an empty list which will store out results
def table(num, start=1): # Table function which will return us a list of numbers as table of the given number
global upto
if start > upto: # Code logic
... |
LOADTRACKS = "/loadtracks?identifier={query}"
DECODETRACK = "/decodetrack"
DECODETRACKS = "/decodetracks"
ROUTEPLANNER = "/routeplanner/status"
UNMARK_FAILED_ADDRESS = "/routeplanner/free/address"
UNMARK_ALL_FAILED_ADDRESS = "/routeplanner/free/all"
|
#print(args)
if args[5] == 'COMP':
outTop = op('null')
m = op('movie')
t = op('tox')
fromPath = args[6] + '/' + args[0]
type = op(fromPath + '/info')[1, 'type']
path = op(fromPath + '/info')[1, 'path']
parent().par.Mediatype = type
op('display_select').par.top = fromPath + '/display'
op(fromPath).op('m... |
"""
Traversing the Node Elements
We can traverse the elements of the node created above by creating a variable and assigning the first element to it.
Then we use a while loop and nextval pointer to print out all the node elements. Note that we have one more additional
data element and the nextval pointers are pr... |
#By enumerating with two variables
for i,char in enumerate('enumerate'):
print(1,char)
for i,c in enumerate(list(range(100))):
print(i,c)
if c == 50:
#F is to make the print be able to format the i to a value.
print(f'Index of 50 is: {i}') |
def check_values(group, value):
for x in group:
if x == value:
return True
return False
print (check_values([34, 56, 77], 22))
print (check_values([34, 56, 77], 34))
|
class EditGuildFailed(Exception):
"""Raises when editing the guild is failed."""
pass
class FetchGuildChannelsFailed(Exception):
"""Raises when fetching the guild channels is failed."""
pass
class CreateGuildChannelFailed(Exception):
"""Raises when creating new guild channel is failed."""
... |
a = (1, 2, 3, 4, 5)
print(a, type(a))
b = (6, 7, [10, 20, 30])
print(b, type(b))
b[2].append(100)
print(b, type(b))
print(len(a))
print(2 in a or 5 in a and 3 in a)
print(a + b, b + a)
print(sum(a))
print(a.index(2))
a.count(4)
print(a.__sizeof__())
# you can't change tuple after init
# but you can make ch... |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
# Copyright 2019-2020 Hewlett Packard Enterprise Development LP
#
# 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.... |
class Solution:
def lowestCommonAncestor(self, root, p, q):
curr = root
while curr:
if p.val > curr.val and q.val > curr.val:
curr = curr.right
elif p.val < curr.val and q.val < curr.val:
curr = curr.left
else:
retu... |
def sqroot(num):
"""Natural square root (decimal points are ignored).
Needed because math.sqrt breaks with numbers bigger than 2 to the power of 1024."""
lenght = len(str(num))#convert number to string
half = str(num)[0:(lenght//2)]#create a substring that is roughly a half of the number
i = (int("1... |
n = int(input('Digite o valor de n: '))
i = 1
número = 0
while i <= n:
número = número + 1
if (número % 2 != 0):
i = i + 1
print(número) |
A5_CHECK_DIR = '/etc/dd-agent/checks.d'
A5_CONF_DIR = '/etc/dd-agent/conf.d'
A5_EXE_PATH = '/opt/datadog-agent/agent/agent.py'
A6_CHECK_DIR = '/etc/datadog-agent/checks.d'
A6_CONF_DIR = '/etc/datadog-agent/conf.d'
A6_EXE_PATH = '/opt/datadog-agent/bin/agent/agent'
def get_agent_exe_path(agent_version_major):
if ... |
# Definition for an interval.
# class Interval(object):
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution(object):
def minMeetingRooms(self, intervals):
"""
:type intervals: List[Interval]
:rtype: int
"""
intervals = sorted(in... |
def pytest_addoption(parser):
parser.addoption("--unity_exe_path",
action="store",
default=None)
|
#
# Copyright (C) 2018 The Android Open Source Project
#
# 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... |
# encoding: utf-8
# module Grasshopper.Kernel.Graphs calls itself Graphs
# from Grasshopper,Version=1.0.0.20,Culture=neutral,PublicKeyToken=dda4f5ec2cd80803
# by generator 1.145
""" NamespaceTracker represent a CLS namespace. """
# no imports
# functions
def GH_GraphProxyObject(n_owner): # real signature unk... |
def betweenness_centrality(G, k=None, normalized=True, weight=None, endpoints=False, seed=None):
# doesn't currently support `weight`, `k`, `endpoints`, `seed`
query = """\
CALL gds.betweenness.stream({
nodeProjection: $node_label,
relationshipProjection: {
relType: {
... |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 11 10:50:38 2020
@author: Administrator
"""
"""
实现字符串的反转,要求不使用任何系统方法,且时间复杂度最小
"""
def ReverseStr(string):
lens = len(string)
mid = int(lens / 2)
for i in range(mid):
temp = string[i]
string = string[0:i] + string[lens - i - 1]... |
# A foolish try.
def splitp(p: str):
res = []
tmp = ""
for i in range(len(p)):
if p[i] != "*" and p[i] != ".":
tmp += p[i]
elif p[i] == ".":
res.append(tmp)
res.append(p[i])
tmp = ""
else:
if len(res) > 0 and res[-1] == "."... |
__author__ = 'awbennett'
class AbstractMethod(object):
def __init__(self):
pass
def fit(self, x_train, z_train, y_train, x_dev, z_dev, y_dev):
raise NotImplementedError()
def predict(self, x_test):
raise NotImplementedError()
|
class KeyParser:
def __init__(self, separator='\t', row=1, column=0):
"""
:param separator: Field separator to split one line in several values
:param row: The position in a line of the row identifier (starting at zero)
:param column: The position in a line of the column identifie... |
# -*- coding: utf-8 -*-
'''
:file: utils.py
:author: -Farmer
:url: https://blog.farmer233.top
:date: 2021/09/04 23:45:40
'''
class ObjectDict(dict):
""":copyright: (c) 2014 by messense.
Makes a dictionary behave like an object, with attribute-style access.
"""
def __getattr__(self, key... |
# -*- coding: utf-8 -*-
class Types:
""" Перечень типов виртуальной машины """
NONE = 0
INT = 1
CHAR = 2
BOOL = 3
STRING = 4
BOXED_ARR = 5
UNBOXED_ARR = 6
DYNAMIC = 9
""" Перечень примитивных типов """
PRIMITIVE_TYPES = [
Types.NONE,
Types.INT,
Types.CHAR,
Types.B... |
def findDivisible(numberList):
print("Given list is ",numberList)
print("Divisible by 5 in a list")
for num in numberList:
if(num%5==0):
print(num)
numberList=[10,55,21,26,55]
findDivisible(numberList) |
# Construir um programa que calcule a tabuada de um valor qualquer de 1 até 10 e armazene os resultados em uma matriz A de uma dimensão. Apresentar os elementos da matriz A.
A = []
tabuada = int(input('Informe uma Tabuada: '))
for i in range(0, 11):
A.append(i * tabuada)
for i in range(0, 11):
print('{}... |
event_aliases = {
'halloween 2020': 1,
'candy': 2,
'swimsuits 2020': 3,
'maids': 5,
'christmas 2020': 6,
'countdown': 7,
'monster hunter pt1': 9,
'mh1': 9,
'monster hunter pt2': 10,
'mh2': 10,
}
|
BZX = Contract.from_abi("BZX", "0xD8Ee69652E4e4838f2531732a46d1f7F584F0b7f", interface.IBZx.abi)
TOKEN_REGISTRY = Contract.from_abi("TOKEN_REGISTRY", "0xf0E474592B455579Fe580D610b846BdBb529C6F7", TokenRegistry.abi)
list = TOKEN_REGISTRY.getTokens(0, 100)
for l in list:
iTokenTemp = Contract.from_abi("iTokenTemp", ... |
class PdfRelayException(Exception):
def __init__(self, *args, **kwargs):
super(PdfRelayException, self).__init__(args, kwargs)
class JobError(PdfRelayException):
"""Issue with the parameters of the conversion job"""
class EngineError(PdfRelayException):
"""Engine process spawning/execution error"""
class Metad... |
expected_output = {
'vrf': {
'default': {
'local_label': {
201: {
'outgoing_label_or_vc': {
'Pop tag': {
'prefix_or_tunnel_id': {
'10.18.18.18/32': {
... |
a = 1
b = 2
num = 3
|
_base_ = [
'r50_sz224_4xb64_head1_lr0_1_step_ep20.py',
]
# optimizer
optimizer = dict(lr=0.01)
|
#!/usr/bin/python
# -*- coding:utf-8 -*-
# Powered By KK Studio
# 导航Nav
class Nav:
url_none = 'javascript:void(0);'
nav = [
{
'url': '/',
'name': u'控制中心',
'icon': 'icon-wrench',
'sub': []
},
{
'url': url_none,
'n... |
KNOWN_SIDS = {
"S-1-0": "Null Authority",
"S-1-0-0": "Nobody",
"S-1-1": "World Authority",
"S-1-1-0": "Everyone",
"S-1-2": "Local Authority",
"S-1-2-0": "Local",
"S-1-3": "Creator Authority",
"S-1-3-0": "Creator Owner",
"S-1-3-1": "Creator Group",
"S-1-3-4": "Owner Rights",
... |
'''
Write a Python program to count the number occurrence of a specific character in a string.
'''
data = input("Enter a long sentence: ")
datas = data[4]
print(data.count(datas)) |
class Reversed_Proxy(object):
def __init__(self, app, script_name=None, scheme='http', server=None):
self.app = app
self.script_name = script_name
self.scheme = scheme
self.server = server
def __call__(self, environ, start_response):
script_name = environ.get('HTTP_X_SC... |
class ResponsePayloadOperations:
def ProductsJSON(self, records):
products = []
i = 0
while i < len(records):
products.append({
'id' : records[i][0],
'name' : records[i][1],
'description': records[i][2],
'count' :... |
class dtype(object):
def __init__(self, name):
self.type_name = name
float = dtype('float')
double = dtype('double')
half = dtype('half')
uint8 = dtype('uint8')
int16 = dtype('int16')
int32 = dtype('int32')
int64 = dtype('int64')
|
#!/usr/bin/python3
def print_list_integer(my_list=[]):
for i in range(len(my_list)):
print("{:d}".format(my_list[i]))
|
# example of a function that does not mutate its input
def add_one_to_series(series):
"""Adds one to a series
"""
# we are not mutating the original data, but returning a copy with new values
return series + 1
# example of a function that does not mutate its data frame input
def add_one_to_data_frame(... |
res=0
for i in range(1,1001):
res += i**i
res=str(res)
#res='nursyahjaya'
print(res[len(res)-10:])
|
def get_token_group(partitioner="murmur3", group="static-random"):
return static_tokens[partitioner][group]
static_tokens = {
"murmur3": {
"static-random": [
"-1046743493966813495,-1127180199537005110,-118022819648698044,-1189703775502125091,-1249903220729897117,-1363229807648136104,-14179... |
COMMAND_HELP = '''
oplab <command> [<args>]
'''
TRAIN_COMMAND_HELP = '''
oplab t|train
--params <params_file_path>
--output <model_save_path>
'''
|
"""
:type people: List[List[int]]
:rtype: List[List[int]]
[ ] [ ] [ ] [ ] [4] [ ] # [4, 4]: 6 slots, insert 4 with 4 empty space before it
[5] [ ] [ ] [ ] [ ] # [5, 0]: 5 slots, insert 5 with 0 empty space before it
[ ] [5] [ ] [ ] # [5, 2 - 1]: 4 slots, insert 5 with 1 empty space before it
... |
SIZE = 5
queue = [None for _ in range(SIZE)]
front, rear = -1, -1
rear += 1
queue[rear] = '화사'
rear += 1
queue[rear] = '솔라'
rear += 1
queue[rear] = '문별'
print('출구<--',queue,'<--입구')
front += 1
data = queue[front]
queue[front] = None
print('추출-->',data)
front += 1
data = queue[front]
queue[front] = None
print('추출-->',... |
# Storage Account
def storage (storage_client,storage_account_name, location):
#storage_account_name = 'invalid-or-used-name'
availability = storage_client.storage_accounts.check_name_availability(storage_account_name)
print('The storage account account {} is available: {}'.format(storage_account_name, ava... |
"""
File: weather_master.py
-----------------------
This program should implement a console program
that asks weather data from user to compute the
average, highest, lowest, cold days among the inputs.
Output format should match what is shown in the sample
run in the Assignment 2 Handout.
"""
def main():
"""
Enabl... |
# Tower of Hanoi
def toh(n,A,B,C):
if n==0:
return
toh(n-1,A,C,B)
print("Moved Disk",n,"From Tower",A,"To Tower ",B)
toh(n-1,C,B,A)
no_of_disk = int(input())
not1 = input()
not2 = input()
not3 = input()
toh(no_of_disk,not1,not2,not3)
|
dd = {
'a': 1,
'b': 2,
'c': 3
}
ll = [1, 2, 3, 4]
print(ll[0])
print(dd)
dd['new'] = 7
print(dd)
dd['new'] += 6
print(dd)
|
class WinRMError(Exception):
def __init__(self, code, msg):
super(Exception, self).__init__(msg)
self.code = code
|
name = 'forum'
aliases = ('forums', 'f')
pad_none = False
async def run(message):
await message.send('Forum commands: **!forums user (username)**')
|
num = int(input('Type a number between 0 and 9999: '))
u = num % 10
t = num // 10 % 10
h = num // 100 % 10
th = num // 1000 % 10
print(f'Unity: {u} \n'
f'Ten: {t} \n'
f'Hundred: {h} \n'
f'Thousand: {th}')
|
'''
Created on Nov 21, 2012
@author: Gary
'''
|
class InstanceDefinitionArchiveFileStatus(
Enum, IComparable, IFormattable, IConvertible
):
"""
The archive file of a linked instance definition can have the following possible states.
Use InstanceObject.ArchiveFileStatus to query a instance definition's archive file status.
enum InstanceDe... |
# 1. Съдомиялна
# Гошо работи в ресторант и отговаря за зареждането на съдомиялната накрая на деня.
# Вашата задача е да напишете програма, която изчислява, дали дадено закупено количество бутилки от препарат за
# съдомиялна е достатъчно, за да измие определено количество съдове. Знае се, че всяка бутилка съдържа 750 м... |
"""
SQ数据集数据文件目录
文件获取举例:inner2['29'][2],
得到的是内圈2下29Hz的第2个文件(actually 3rd),
默认文件夹内排列顺序,每一个转速下共有3个文件[0~2]
train_dir109 1-故障程度 09-转速(Hz)
train 均使用第0个数据文件,test均使用第1个数据文件
"""
# home = r'G:\dataset\SQdata' # U盘
home = r'F:\dataset\SQdata' # 本地F盘
inner1 = {'09': [home + r'\inner1\09\REC3585_ch2.txt', home + r'\inner1\09\REC... |
print(a == b)
print(a == c)
print(b == c)
# a and b evaluate to the same |
#
# PySNMP MIB module MIMOSA-NETWORKS-BASE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MIMOSA-NETWORKS-BASE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:12:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.... |
# Question 3
# Midpoints of a line
x1 = float(input("Enter x of 1st point: "))
y1 = float(input("Enter y of 1st point: "))
x2 = float(input("Enter x of 2nd point: "))
y2 = float(input("Enter y of 2nd point: "))
midpoint_x = abs(x1 + x2) / 2
midpoint_y = abs(y1 + y2) / 2
print("Midpoint of a line: (" + str(midpoin... |
def giwaxs_S_edge_wenkai(t=1):
dets = [pil300KW]
names = [ 'A2', 'A3', 'A4', 'A5', 'A6']
x = [30000, 16000, 0, -15000, -36000]
energies = np.arange(2450, 2470, 5).tolist() + np.arange(2470, 2480, 0.25).tolist() + np.arange(2480, 2490, 1).tolist()+ np.arange(2490, 2501, 5).tolist()
waxs_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.