content stringlengths 7 1.05M |
|---|
class Czlowiek:
iloscOczu = 2
def __init__(self,imie,wiek):
self.imie = imie
self.wiek = wiek
And = Czlowiek("Andrzej", 22)
Ann = Czlowiek("Anna", 17)
print(And.iloscOczu)
print(Ann.wiek)
#-------------------------------
def dodawanie(x,y):
return x+y
dod = lambda x,y: ... |
class RangeMethod:
RANGE_MAX = 0
RANGE_3SIGMA = 1
RANGE_MAX_TENPERCENT = 2
RANGE_SWEEP = 3
class QuantizeMethod:
# quantize methods
FIX_NONE = 0
FIX_AUTO = 1
FIX_FIXED = 2
|
# This Python file uses the following encoding: utf-8
nutriMapSpanishToEnglish = {
'ac. grasos trans': 'Trans Fatty Acids',
'ac. pantoténico':'Vitamin B5',
'ac.pantoténico':'Vitamin B5',
'acesulfame de potassio':'Acesulfame Potassium',
'acesulfame de potasio':'Acesulfame Potassium',
'acesulfamo... |
def compose(*fns):
"""
Returns a function that evaluates it all
"""
def comp(*args, **kwargs):
v = fns[0](*args, **kwargs)
for fn in fns[1:]:
v = fn(v)
return v
return comp
|
class Logger:
def __init__(self, name: str):
self.name: str = name
def console_log(self, message: str):
print('<{0}> {1}'.format(self.name, message))
|
#
# PySNMP MIB module SEI-SMI (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SEI-SMI
# Produced by pysmi-0.3.4 at Wed May 1 15:01:44 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)... |
def solution(n):
answer = 0
for i in range(1, n+1):
if n % i == 0: answer += i
return answer |
"""
Lecture 17: Approximation Algorithms
Vertex Cover
------------
This program contains two approximation algorithms
for solving the vertex cover problem for an undirected
graphs G(V, E).
A vertex cover is a subset V' of V such that
forall (u, v) in E, either u or v is in V'.
The goal is to find the smallest set V' w... |
class Solution:
def lastStoneWeight(self, stones: List[int]) -> int:
max_heap = []
for n in stones :
heappush(max_heap,-n)
while max_heap :
sto1 = -heappop(max_heap)
if not max_heap :
return sto1
sto2 = -heappop(max_hea... |
class Spam:
def __init__(self):
self.spam = 'spam, spam, spam'
def set_eggs(eggs):
self.eggs = eggs
def __str__(self):
return '%s and %s' % (self.spam, self.eggs) # Maybe uninitialized attribute 'eggs'
#Fixed version
class Spam:
def __init__(self):
self.spam = 'spam... |
# https://edabit.com/challenge/yfooETHj3sHoHTJsv
# Create a function that returns True when num1 is equal to num2; otherwise return False.
def same_thing(int1: int, int2: int) -> bool:
try:
if int1 == int2:
return True
elif int1 != int2:
return False
except ValueErr... |
# a metric cross reference:
# <haproxy metric>: (<collectd type instance>, <collectd type>)
METRIC_XREF = {
# metrics from the "show info" command
'Nbproc': ('num_processes', 'gauge'),
'Process_num': ('process_num', 'gauge'),
'Pid': ('pid', 'gauge'),
'Uptime_sec': ('uptime_seconds', 'gauge'),
... |
class Tree:
def __init__(self, content):
self.content = content
self.children = []
def add_child(self, tree):
if not isinstance(tree, Tree):
tree = self.__class__(tree)
self.children.append(tree)
return self
def add_children(self, *trees):
for tr... |
CLUSTER_NODE_LABEL = 'Cluster'
CLUSTER_RELATION_TYPE = 'CLUSTER'
CLUSTER_REVERSE_RELATION_TYPE = 'CLUSTER_OF'
CLUSTER_NAME_PROP_KEY = 'name'
|
'''
Created on 23. nov. 2015
@author: kga
'''
MYSQL = "mysql"
POSTGRESSQL = "postgressql"
SQLITE = "sqlite"
ORACLE = "oracle"
|
#!/usr/bin/python
CLUSTER_NAME = 'gcp-integration-test-cluster'
LOGNAME_LENGTH = 16
LOGGING_PREFIX = 'GCP_INTEGRATION_TEST_'
DEFAULT_TIMEOUT = 30 # seconds
ROOT_ENDPOINT = '/'
ROOT_EXPECTED_OUTPUT = 'Hello World!'
STANDARD_LOGGING_ENDPOINT = '/logging_standard'
CUSTOM_LOGGING_ENDPOINT = '/logging_custom'
MONITOR... |
class Team:
def __init__(
self,
name: str,
team_id: str,
wins: int,
losses: int,
line_scores: list,
):
self.name = name
self.team_id = team_id
self.wins = wins
self.losses = losses
self.line_scores = line_scores
def __s... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:
21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13
It can be verified that the sum of the numbers on the diagonals is 101.
What ... |
x = [0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 3.6, 4.8, 7.2, 9.6, 14.4, 19.2]
with open("../test.txt") as f:
l = f.readlines()
for i in range(len(l)):
l[i] = l[i].split()
print(f'{x[i]:.1f} & 3 & {l[i][0]} & {l[i][1]} & {l[i][2]} ' + r'\\')
|
def bubble_sort(arr):
length = len(arr)
while True:
swapped = False
for i in range(1, length):
if arr[i - 1] > arr[i]:
arr[i - 1], arr[i] = arr[i], arr[i - 1]
swapped = True
if not swapped:
break
else:
pass
... |
#
# PySNMP MIB module HH3C-OBJP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-OBJP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:28:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... |
# Given an integer array nums, return true if any value appears at least twice in the array, and return false if
# every element is distinct.
#
# Example 1:
# Input: nums = [1, 2, 3, 1]
# Output: true
#
# Example 2:
# Input: nums = [1, 2, 3, 4]
# Output: false
#
# Example 3:
# Input: nums = [1, 1, 1, 3, 3, 4, 3, 2, 4, ... |
"""Reads initial conditions from a file and outputs to a dictionary."""
class fileInput(object):
"""Loads data then outputs an initial parameters dictionary."""
def updateDict(initParams, filename=None):
"""Update and return the initial parameter dictionary from a file."""
labelToParam_MD = i... |
list=[1,2,3,2,1,4,56,8,7]
newlist=[]
for i in range(0,len(list)):
if(list[i] in newlist):
continue
newlist.append(list[i])
print("old list: \t\t",list)
print("unique elements :",newlist)
|
p, d, m, s = map(int, input().split())
count = 0
total = 0
while p >= m and total <= s:
total += p
p -= d
count += 1
if p - d < m:
while total <= s:
total += m
count += 1
print(count-1)
|
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
cf-configuration-exporter
"""
__program__ = "cf-configuration-exporter"
__version__ = "0.0.13"
__author__ = "Claudio Benfatto"
__year__ = "2017"
__email__ = "<claudio.benfatto@springer.com>"
__license__ = "MIT"
|
# -*-coding:Utf-8 -*
class DictionnaireOrdonne:
"""Notre dictionnaire ordonné. L'ordre des données est maintenu
et il peut donc, contrairement aux dictionnaires usuels, être trié
ou voir l'ordre de ses données inversées"""
def __init__(self, base={}, **donnees):
"""Constructeur de notre objet.... |
'''
Created on 1.12.2016
@author: Darren
''''''
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
Update (2015-02-12):
For C programmers: Try to solve it in-place in O(1) space.
click to show clarifica... |
#!/usr/bin/env python -tt
#
# Copyright (c) 2007 Red Hat, Inc.
# Copyright (c) 2011 Intel, Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; version 2 of the License
#
# This program is dis... |
num = int(input('Digite um número: '))
total = 0 #números de divisiveis
for c in range(1, num + 1):
if num % c == 0: #se o número for divisível pelo contador
print('\033[33m', end= '') #amarelo se for divisível
total += 1
else:
print('\033[31m... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def reverseList(self, head: ListNode) -> ListNode:
p1 = None
p2 = head
while p2 is not None:
temp1 = p1
te... |
"""
Implementing some of the LinkedList functions
In this file I try to practice on how to play with Linkedlists and thsi makes me more Familiar with
Linkedlists
"""
class Node:
def __init__(self,data=None,next=None):
self.data = data
self.next =next
class LinkedList:
def __init__ (self):
... |
"""
Jamie Thayer -- Project Week 8
"""
""" Problem 1a and 1b """
def diff_first_last(L, *opArg):
"""
(list) -> boolean
Precondition: len(L) >= 2
Returns True if the first item of the list is different from the last; else returns False.
>>> diff_first_last([3, 4, 2, 8, 3])
False
>>> diff... |
# -*- coding: utf-8 -*-
"""
A toolkit for python dict type
"""
class DictToolkit(object):
@staticmethod
def merge_dict(original: dict, updates: dict):
if original is None and updates is None:
return None
if original is None:
return updates
if updates is None:
... |
DATA_MEAN = 168.3172158554484
DATA_STD = 340.21625683608994
OUTPUT_CHANNELS = 1
DATA_PATH = "/home/matthew/Documents/unet_model/6375_images/"
WEIGHTS = "/home/matthew/Documents/unet_model/dsc_after_bce_old.hdf5"
|
'''
lab4 dict and tuple
'''
#3.1
my_dict = {
'name' : 'Athena',
'id':123
}
print(my_dict)
#3.2
print(my_dict.values())
print(my_dict.keys())
#3.3
my_dict['id']=321 #changing the value
print(my_dict)
#3.4
my_dict.pop('name',None)
print(my_dict)
#3.5
my_tweet = {
"tweet_id":1138,
"coordinates":(-75,... |
#
# PySNMP MIB module MICOMFLTR (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MICOMFLTR
# Produced by pysmi-0.3.4 at Mon Apr 29 20:02:23 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23... |
"""
The API: int read4(char *buf) reads 4 characters at a time from a file.
The return value is the actual number of characters read. For example, it
returns 3 if there is only 3 characters left in the file.
By using the read4 API, implement the function int read(char *buf, int n) that
reads n characters from the fil... |
def delta(x):
if x==0:
y=1;
else:
y=0;
return(y) |
a=97
b= 98
while(a>=97 and a <=1003):
if(a%2==0):
print("{:.0f}".format(c))
a= a+1
c= (a+b)*226.5 |
def isPalindrome(str):
if str == str[::-1]:
return True
else:
return False
string = input('Digite uma string: ')
if isPalindrome(string.lower()):
print('A palavra "{}" é um palíndromo'.format(string))
else:
print('A palavra "{}" não é um palíndromo'.format(string))
|
"""
Project Euler - Problem Solution 039
Problem Title - Integer right triangles
Copyright (c) Justin McGettigan. All rights reserved.
https://github.com/jwmcgettigan/project-euler-solutions
"""
def pythagorean_triplet_solutions(p):
''' Finds the pythagorean triplets
for the given perimeter (p). '''
seen = set()... |
SOS_token = 0
EOS_token = 1
class Lang:
def __init__(self, name):
self.name = name
self.word2index = {}
self.word2count = {}
self.index2word = {0: "SOS", 1: "EOS"}
self.n_words = 2 # Count SOS and EOS
def addSentence(self, sentence):
for word in sentence.split... |
# MYSQL_HOST = "jbw-1.cpmvfibm3vjp.ap-southeast-1.rds.amazonaws.com"
MYSQL_HOST = "localhost"
MYSQL_PORT = 3306
MYSQL_USER = "redatom"
MYSQL_PWD = "redatom"
MYSQL_DB = "redatom"
Config = {
"mysql": {
"connection": 'mysql://%s:%s@%s:%s/%s?charset=utf8' % (MYSQL_USER, MYSQL_PWD, MYSQL_HOST, MYSQL_PORT, MYSQL... |
'''
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, p... |
def gen_tumor_ic_file(file_dir, dp):
# write to file
inpf = open(file_dir + dp.tumor_ic_file, 'w')
inpf.write("type, cx, cy, cz, tum_rx, tum_ry, tum_rz, hyp_rx, hyp_ry, hyp_rz\n")
# type = 1 -- spherical tumor core
# type = 2 -- elliptical tumor core (sharp)
# type = 3 -- spherical tumor core... |
'''traversetree module
Module with functions to traverse our triangle.
'''
__all__ = ['maximum_pathsum']
__author__ = 'Alexandre Pierre'
def pairs(iterator):
'''Given an iterator yields its elements in pairs in which the first
element will assume values from first to second-last and the second element
of the p... |
# -*- coding: UTF-8 -*-
# [1,2,3]
a = [1,2,3]
print(a)
# [1,2,3]
b = a
print(b)
# True
print(id(a) == id(b))
b[0] = 3
# [3,2,3]
print(b)
# [3,2,3]
print(a)
# True
print(id(a) == id(b)) |
# entrada
entrance = input()
#extrair 2 inteiros
v = entrance.split(' ')
A = int(v[0])
B = int(v[1])
# condição
if A > B:
ht = (24 - A) + B
elif A < B:
ht = B - A
elif A == B:
ht = 24
print('O JOGO DUROU {} HORA(S)'.format(ht))
|
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press ... |
"""
Given a sequence of integers, find the longest increasing subsequence (LIS).
You code should return the length of the LIS.
"""
__author__ = 'Danyang'
class Solution:
def longestIncreasingSubsequence(self, nums):
"""
let f(i) be the LIS END WITH A[i]
f(i) = max(f(j)+1) if A[i]>=A[j] \f... |
class SqlQueries:
songplay_table_insert = ("""
INSERT INTO songplays (playid, start_time, userid, level, songid, artist_id, session_id, location, user_agent)
SELECT
md5(events.sessionid || events.start_time) AS playid,
events.start_time AS start_time,
... |
class dsheet():
def __init__(self,data,col_name=''):
self.name=''
self.ds=[]
self.colname=col_name
self.__setds(data,col_name)
def __setds(self,data,col_name):#不建议从外部调用
dic={}
dic_li=[]
if type(data) != list: #data必须为列表,否则创建失败,返回空值
print('data shoud be list')
return None... |
__author__ = 'makarenok'
class Contact:
def __init__(self, first_name, middle_name, last_name, nick, title, company, address, tel_home, email):
self.first_name = first_name
self.middle_name = middle_name
self.last_name = last_name
self.nick = nick
self.title = title
... |
with open("input") as f:
map = f.readlines()
# want to make my life easier with bounds checking
# so i'm going to pad the map
for i in range(len(map)):
map[i] = ' ' + map[i].strip('\n') + ' '
# add the extra row at the end
map.append(' '*len(map[0]))
row = 0
# find entry at the top
for i in map[... |
class Solution:
def minDominoRotations(self, tops: List[int], bottoms: List[int]) -> int:
total = len(tops)
top_fr, bot_fr, val_total = [0]*7, [0]*7, [total]*7
for top, bot in zip(tops, bottoms):
if top == bot:
val_total[top] -= 1
else:
... |
class A:
def __contains__(self, e):
return False
a = A()
print(0 in a)
|
class Person:
name = ''
age = 0
des = ''
# def __init__(self,name,age,des):
# self.name = name
# self.age = age
# self.des = des
def say(self):
print('我的名字是:',self.name)
print('我的年龄是:',self.age)
print('我的描述是:' , self.des)
|
def long_text_to_list():
string = open('longtext.txt').read()
return string.split()
def word_frequency_dict(wordList):
wordDict = {}
for word in wordList:
if word in wordDict:
wordDict[word] = wordDict[word] + 1
else:
wordDict[word] = 1
return wordDict
de... |
# -*- coding: utf-8 -*-
class Registry(object):
__registry = {}
def add(self, command):
self.__registry.update({
command.name: command
})
def get_all(self):
return self.__registry.copy()
def get_command(self, name, default=None):
return self.__registry.ge... |
def map(soup, payload, mappings, tag_prop):
for source_key, payload_key in mappings.items():
tag = soup.find('meta', attrs={tag_prop:source_key})
if tag:
payload[payload_key] = tag.get('content')
|
serv_ver_info = "Connected to MySQL Server version"
conn_success_info = "You're connected to database"
conn_error_info = "Error while connecting to MySQL"
conn_close_info = "MySQL connection is closed"
error_insert_info = "Failed to insert data to table in MySQL"
error_create_info = "Failed to create table in MySQL"
er... |
###Título: Programa palavra secreta.py
###Descrição: Este programa insere uma lista de palavras através de um indice
###Autor: Valmor Mantelli Jr.
###Data: 09/01/2018
###Versão 0.0.17
# Declaração de variáveis
lista_de_palavras = ""
digitadas = []
acertos = []
erros = []
senha = ""
letra = 0
x = 0
tentativa = ... |
def writer(mat_export):
canvas = open("dipinto_magnified.ppm","w")
canvas.write(lines[0] + "\n")
canvas.write(str(width) +" "+ str(height) + "\n")
canvas.write(lines[2] + "\n")
for a in range (0,height):
for b in range (0,width):
for c in range (0,3):
canvas.write(mat_export[a][b][c] + "\n")
... |
def try_get_item(list, index):
"""
Returns an item from a list on the specified index.
If index is out or range, returns `None`.
Keyword arguments:
list -- the list
index -- the index of the item
"""
return list[index] if index < len(list) else None
def union(A, B):
"""
Return... |
valores = []
num1 = int(input('Digite um valor: '))
valores.append(num1)
print('Adicionado ao final da lista...')
for c in range(0, 4):
num = int(input('Digite um valor: '))
if num > max(valores):
valores.append(num)
print(f'Adicionado ao final da lista...')
elif num <= valores[0]:
v... |
{
'targets': [
{'target_name': 'libspedye',
'type': 'static_library',
'dependencies': [
'deps/http-parser/http_parser.gyp:http_parser',
'deps/uv/uv.gyp:uv',
'deps/openssl/openssl.gyp:openssl',
'deps/spdylay.gyp:spdylay',
],
'export_dependent_settings': [
'dep... |
#!/usr/bin/python3
"""
Given an array of characters, compress it in-place.
The length after compression must always be smaller than or equal to the original array.
Every element of the array should be a character (not int) of length 1.
After you are done modifying the input array in-place, return the new length of t... |
ninjas = {
"Kakashi": "Jonin",
"Shikamaru": "Chunin",
"Naruto": "Genin"
}
print(ninjas)
ninjas.update({"Kakashi": "Hokage", "Shikamaru": "Jonin"})
print(ninjas) |
class Solution:
def numberToWords(self, num: int) -> str:
below_100 = ['Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety']
below_20 = ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten',
'Eleven', 'Twelve', 'Thirteen', 'Fourteen... |
class Knapsack:
"""
Knapsack objects provide an intuitive means of binding
the problem data
"""
def __init__(self, cap):
"""
Initialize new knapsack object
with capacity and empty items list
"""
self.capacity = cap
self.items = []
def setCap... |
def run_rc4(text,key):
resultado = []
for char in text:
resultado.append(rc4(char,key))
return bytearray(resultado)
def rc4(value,key):
SJ = KSA(key)
generatedByte = GenFluxo(SJ[0])
return value ^ next(generatedByte)
def KSA(key):
S = []
T = []
for i in range(256):
... |
expected_output = {
'session_db': {
0: {
'session_id': 48380,
'state': 'open',
'src_ip': '10.225.32.228',
'dst_ip': '10.196.32.228',
'src_port': 1024,
'dst_port': 1024,
'protocol': 'PROTO_L4_UDP',
'src_vrf': 3,
'dst_vrf': 3,
'src_vpn_id': 20,
'dst_... |
# family.py
def init(engine):
def son_of(son, father, mother):
engine.add_universal_fact('family', 'son_of', (son, father, mother))
son_of('art', 'art2', 'nana')
son_of('artie', 'art', 'kathleen')
son_of('ed', 'art', 'kathleen')
son_of('david', 'art', 'kathleen')
son_of('justin', 'artie... |
# -*- coding: utf-8 -*-
V = int(input())
for i in range(10):
print("N[%d] = %d" % (i, V))
V *= 2
|
class Something:
def do_something(
self, x: int = 1984, y: int = 2021, z: Optional[int] = None
) -> None:
pass
__book_url__ = "dummy"
__book_version__ = "dummy"
|
# Allow definitions for where we should pick up our assets from.
# By default if no repository is specified in say WORKSPACE then it defaults to maven_central definition.
# This behaviour is found / specified and loaded from
# "@com_googlesource_gerrit_bazlets//tools:maven_jar.bzl", "maven_jar",
# To prevent us having... |
class Error(Exception):
"""Raised when something failed in an unexpected and unrecoverable way"""
pass
class OperationError(Error):
"""Raised when an operation failed in an expected but unrecoverable way"""
pass
class NotifyError(Error):
"""Raised when an notify operation failed in an expected but... |
class Config:
HOST = '192.168.0.23' # use 127.0.0.1 if running both client and server on the Raspberry Pi.
PORT = 2018
RELAY_LABELS = ['Exterior Stairs Light', 'Deck Pot Lights', 'Soffit Receptacle', 'Driveway Light']
|
### model hyperparameters
state_size = [100, 128, 4] # 4 stacked frames
action_size = 7 # 7 possible actions
learning_rate = 0.00025 # alpha (aka learning rate)
### training hyperparameters
total_episodes = 50 # total episodes for training
max_steps = 5000 # max possible steps in an episode
batch_size = 64
# explorat... |
#
# PySNMP MIB module DLINK-3100-DOT1X-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DLINK-3100-DOT1X-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:48:19 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... |
def is_subsequence(str1, str2):
if len(str1) == 0:
return True
if len(str2) == 0:
return False
index = 0
current = str1[index]
for letter in str2:
if letter == current:
index += 1
if len(str1) == index:
return True
current... |
class InvalidMilvagoClassException(Exception):
"""Used when an invalid Milvago instance
has been passed."""
class InvalidMediaType(Exception):
"""Used when an invalid content-type
has been passed.""" |
"""Rules for building Jekyll based websites.
"""
load(
"@kruemelmann_rules_jekyll//jekyll:jekyll.bzl",
_jekyll_build = "jekyll_build_rule",
)
load(
"@kruemelmann_rules_jekyll//jekyll/private:jekyll_repositories.bzl",
_jekyll_repositories = "jekyll_repositories",
)
jekyll_build = _jekyll_build
jekyll_r... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 9 2019
@author: emilia_chojak
@e-mail: emilia.chojak@gmail.com
"""
seq = "ACTGATCGATTACGTATAGTAGAATTCTATCATACATATATATCGATGCGTTCAT"
cut_motif = "GAATTC" #G*AATTC so it will be cut between G and A
cut_index = seq.find(cut_motif)+1
first_fragment = le... |
__author__ = 'Aaron Yang'
__email__ = 'byang971@usc.edu'
__date__ = '8/28/2020 10:55 PM'
class Solution:
def shortestPalindrome(self, s: str) -> str:
i, j = 0, len(s)
if_palindrome = lambda item: item == item[::-1]
while 0 < j:
if if_palindrome(s[i: j]):
break... |
# basic types
'hello' # str
True # bool
None # null
4 # int
2.5 # float
0. # ...
1j # complex
[1,2,3] # list
(1,2,3) # tuple
range(4) # range
{'a','b','c'} # set
frozenset({'a','b'}) # frozenset
{'a': 'foo', 'b': 4} # dict
b'hello' # bytes
bytearray(5) # bytearray
memoryview(b... |
#
# PySNMP MIB module Brcm-adapterInfo-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Brcm-adapterInfo-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:42:51 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... |
#grading system
print("grading system")
s=float(input("Enter marks of the student"))
if(s>90 and s<=100):
print("grade=A")
elif(s>80 and s<=90):
print("grade=B")
elif(s>70 and s<=80):
print("grade=c")
elif(s>60 and s<=70):
print("grade=d")
elif(s>50 and s<=60):
print("g... |
result = ""
summe = 0
while(True):
nums = input().split(" ")
M = int(nums[0])
N = int(nums[1])
if(M <= 0 or N <= 0):
break
if(M > N):
for i in range(N,M+1):
result += str(i)+" "
summe += i
else:
for i in range(M,N+1):
result += str(i)+" "
summe += i
result += "Sum="+str(summe)
print(r... |
n = int(input())
x = 1
for _ in range(n, 0, -1):
print(' '*_ + '*'*x)
x=x+2
_ = _-1
|
n = {"notas":[],"notas ao contrario":[],"soma":0,"notas acima da media":0,"abaixo de 7":0,"media":0}
print('digite quantas notas quiser, -1 encerra o programa')
while True:
num = float(input('digite uma nota: '))
if num == -1:
break
else:
n["soma"]+=num
n["notas"].append(num)
... |
class Cat:
def __init__(self, name) -> None:
self.name = name
def __str__(self) -> str:
return f"Meow {self.name}!"
|
RECORDS =[
{
'name': 'Cluster 1',
'number_of_nodes': 5,
'node_type': 'm5.xlarge',
'region': 'us-west-1'
},
{
'name': 'Cluster 2',
'number_of_nodes': 6,
'node_type': 'm5.large',
'region': 'eu-west-1'
},
{
'name': 'Cluster 3',
... |
'''
Write a Python program print every second character(Even) from a string.
'''
string=input()
final=''
for i in range(1,len(string),2):
final+=string[i]
print(final) |
# Bubble Sort
# Find the largest element A[i], reverse A[0:i+1], making the current largest at the head of the array, then reverse the whole array to make A[i] at the bottom.
# Do the above again and again, finally we'll have the whole array sorted.
# eg:
# [3,1,4,2] (input array)
# [4,1,3,2] -> [2,3,1,4] (current m... |
# 计算3个数中的最大值
def max3(a, b, c):
"""计算并返回a、b和c的最大值是"""
max = a
if b > max: max = b
if c > max: max = c
return max
n1 = int(input('整数n1:'))
n2 = int(input('整数n2:'))
n3 = int(input('整数n3:'))
print('最大值是', max3(n1, n2, n3), '。')
x1 = float(input('实数x1:'))
x2 = float(input('... |
def get_truncated_str(str_: str, _max_len: int = 80) -> str:
truncated_str = str_[:_max_len]
if len(str_) > _max_len:
return truncated_str[:-5] + '[...]'
return truncated_str
|
au_cities = (('Wollongong', 150.902, -34.4245),
('Shellharbour', 150.87, -34.5789),
('Thirroul', 150.924, -34.3147),
('Mittagong', 150.449, -34.4509),
('Batemans Bay', 150.175, -35.7082),
('Canberra', 144.963, -37.8143),
('Melbourne', 145.963... |
"""
First Approach
3Sum 2 Sum ငုံတဲ့ Naive Approach
Time Complexity: O(n*n*n)
"""
class Solution:
def fourSum(self, nums: List[int], target: int) -> List[List[int]]:
if (len(nums)<4):
return []
ans = []
nums = sorted(nums)
for i4 in range(0, len(nums)-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.