content stringlengths 7 1.05M |
|---|
#
# @lc app=leetcode id=498 lang=python3
#
# [498] Diagonal Traverse
#
# https://leetcode.com/problems/diagonal-traverse/description/
#
# algorithms
# Medium (47.34%)
# Likes: 662
# Dislikes: 318
# Total Accepted: 76.3K
# Total Submissions: 161K
# Testcase Example: '[[1,2,3],[4,5,6],[7,8,9]]'
#
# Given a matrix ... |
__all__ = [
"messenger",
"writer",
"processor",
"listener",
]
|
# ПРИМЕР НАСЛЕДОВАНИЯ
class PC (object):
def __init__(self):
self.model =''
self.speed = ''
def ShowSpeed (self):
print(self.speed + self.model)
class Laptop (PC):
# Наследуем клас Laptop от класса PC
def __init__(self):
super(Laptop, self).__init__()
# функция... |
class Solution:
def hammingDistance(self, x: int, y: int) -> int:
if x < 0 or y < 0:
raise Exception("Negative Input(s)")
h_dist = 0
while x > 0 or y > 0:
if (x ^ y) & 1 == 1:
h_dist += 1
x >>= 1
y >>= 1
return h_dist
|
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def helper(self, l1, r1, l2, r2):
if l1 > r1: return None
mid = self.postorder[r2]
... |
def DIST_NAIF(x, y):
return DIST_NAIF_REC(x, y, 0, 0, 0, float('inf'))
def DIST_NAIF_REC(x, y, i, j, c, dist):
"""
x: Dna
y: Dna
i: indice dans [0..|x|]
j: indice dans [0..|y|]
dist: coup du meilleur alignement connu avant cet appel
return
dist meilleur coup connu apre cet appel
... |
"""
Safe Squares from Rooks
On a generalized n-by-n chessboard, there are some number of rooks, each rook represented as a
two-tuple (row, column) of the row and the column that it is in. (The rows and columns are
numbered from 0 to n-1.) A chess rook covers all squares that are in the same row or in the same
column a... |
"""
Link: https://www.hackerrank.com/challenges/python-print/problem?isFullScreen=true
Problem: Print Function
"""
#Solution
if __name__ == '__main__':
n = int(input())
for i in range(1,n+1):
print(i, end="")
|
def mergeSort(alist):
if len(alist) > 1:
mid = len(alist)//2
lefthalf = alist[:mid]
righthalf = alist[mid:]
mergeSort(lefthalf)
mergeSort(righthalf)
i = 0; j = 0; k = 0
while i < len(lefthalf) and j < len(righthalf):
if lefthalf[i] < righthalf[j]... |
#AREA DO CIRCULO
r= float(input())
resultado= 3.14* r**2/10000
print("Area={:.4f}".format(resultado) )
|
soma = cont = 0
while True:
num = int(input('Digite um número: '))
if num == 999:
break
soma += num
cont += 1
print('PROGRAMA FINALIZADO!')
print(f'Foram digitados {cont} números e soma entre ele é {soma}') |
#Berivan ARAS
#180401037
def polinom_bulma(m1,m2,m3,m4,m5,m6,file):
file.write("m1 = "+str(m1)+" m2 = "+str(m2)+" m3 = "+str(m3)+" m4 = "+str(m4)+" m5 = "+str(m5)+" m6 = "+str(m6)+"\n")
if m1>m6 and m1>m5 and m1>m4 and m1>m3 and m1>m2:
file2.write(str(m1) + "en uygun 1. polinom. \n")
... |
#!/usr/bin/env python3
def has_dups(data):
for i in data:
if data.count(i) > 1:
return True
else:
return False
print(has_dups([1, 2, 3]))
print(has_dups([1,1,2,3])) |
# Copyright 2019 The Kubernetes Authors.
#
# 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 law or agreed to ... |
# In practice, this is just a number-base changer, where the number not in base 10 is represented as an array.
# Created to transform binary output arrays of a multilabel classifier into a single base 10 int.
def mux(array, array_base=2):
"""Multiplex array containing digits of given base into base-10 int
Arg... |
headers = {'User-Agent': 'Mozilla/5.0 Chrome/86.0.4240.75'}
# Enter the URL of the product page on flipkart
PRODUCT_URL = 'enter_url_here'
# Enter the threshhold price of the product
THRESHHOLD = 6969.0
# Enter your email address
MY_EMAIL = ''
# Enter your password (Check readme.md for steps to get app password)
MY_APP... |
"""
This file transform the SQL produced by MySQL on SQL that can execute on PostgreSQL
"""
__READ_SQL_FILE__ = "original_schema_msql.sql"
__OUTPUT_SQL_FILE__ = "02_create_schema_db_for_postgresql.sql"
code_to_add_in_top_of_file = ["""
-- delete all tables in public schema, with exception of the spatial_ref_sys
-... |
# Электронные часы-1
num = int(input())
print((num // 60) % 24, num % 60)
|
# Key Arbitrary
def build_profile(first, last, **user_info):
profile = {}
profile['first'] = first
profile['last'] = last
for key, value in user_info.items():
profile[key] = value
return profile
user_profile0 = build_profile('albert', 'einstein', location = 'princeton', field = 'physics')
user_profile1 = build_... |
COMMIT="12c255d13729fb571e4964f4f0a97ddba4bbe0d2"
VERSION="1.1-53-g12c255d"
DICTCOMMIT="8f414ce140263ac8c378d4e7bc97c035ade85aa7"
DICTVERSION="0.2.0"
|
num = int(input('Digite o número que deseja saber a tabuada: '))
print('-='*21)
for i in range(1,10):
print('{} x {} = {}'.format(num, i, num*i))
|
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def isSameTree(self, p: 'TreeNode', q: 'TreeNode') -> 'bool':
def helper(p,q):
if not p and not q:
... |
text_based = ["perspective_score", "identity_attack",
"sentiment",
"Please", "Please_start", "HASHEDGE",
"Indirect_(btw)",
"Hedges",
"Factuality", "Deference", "Gratitude", "Apologizing",
"1st_person_pl.", "1... |
#Submitted by thr3sh0ld
#logic: Readable code
class Solution:
def largestDivisibleSubset(self, nums: List[int]) -> List[int]:
if len(nums) == 0 or len(nums) == 1:
return nums
nums.sort(reverse= False)
l = len(nums)
count = [1 for i in range(l)] #dp
prev = [-1 f... |
int('0x7e0', 0)
# 2016
int('7e0', 16)
# 2016
hex(2016)
# '0x7e0' |
#!/usr/bin/env python3.6.4
# encoding: utf-8
# @Time : 2018/6/24 14:40
# @Author : penghaibo
# @contact: xxxx@qq.com
# @Site :
# @File : config.py
# @Software: PyCharm
appkey = "d391709bada01c89be6dba753752bcd5"
host = "http://v.juhe.cn/historyWeather/" |
#
# PySNMP MIB module A100-R1-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A100-R1-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 16:48:46 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, 0... |
#
# PySNMP MIB module HPN-ICF-DOT11-LIC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-DOT11-LIC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:25:45 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... |
lista_alunos=[]
lista_notas=[]
n1=0
n2=1
n3=2
n4=3
for i in range(0,10,1):
lista_alunos.append(str(input('Digite seu nome:')))
for i in range(0,1,1):
lista_notas.append(float(input('Digite a primeira nota:')))
lista_notas.append(float(input('Digite a segunda nota:')))
lista_notas.append(... |
def simple_generator():
for i in range(5):
yield i
def run_simple_generator():
for j in simple_generator():
print(f"For loop: {j}")
sg = simple_generator()
print(f"Next value: {next(sg)}")
print(f"Next value: {next(sg)}")
print(f"Next value: {next(sg)}")
my_gen = simple_... |
my_variable = 'hello'
my_list_variable = ['hello', 'hi', 'nice to meet you']
my_tuple_variable = ('hello', 'hi', 'nice to meet you') # we can not increase the size of a tuple, it's immutable
my_set_variable = {'hello', 'hi', 'nice to meet you'} # Unique and unordered
print(my_list_variable)
print(my_tuple_variable)
pr... |
# -*- coding: utf-8 -*-
DEFAULT_SETTINGS_MODULE = True
APP_B_FOO = "foo"
|
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'use_system_sqlite%': 0,
},
'target_defaults': {
'defines': [
'SQLITE_CORE',
'SQLITE_ENABLE_BROKEN_FTS3',
... |
# Copyright (c) 2018 Fortinet, Inc.
# 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 requir... |
seriffont = {"Width": 6, "Height": 8, "Start": 32, "End": 127, "Data": bytearray([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
0x03, 0x00, 0x03, 0x00, 0x00, 0x00, #0x00,
0x12, 0x3F, 0x12, 0x3F, 0x12, 0x00, #0x00,
0x26, 0x7F, 0x32, 0x00, 0x00, 0x00, #0x00,
0x13, 0x0... |
London_walk = ox.graph_from_place('London, UK', network_type='walk')
London_walk_simple=nx.Graph(London_walk)
street_bus=London_walk_simple.copy()
street_bus.add_nodes_from(BN.nodes(data=True))
street_bus.add_edges_from(BN.edges(data=True))
# create tree
street_nodes=[]
for node,data in London_walk_simple.nodes(data=... |
# 18 > = Adult
# 5-17 = Child
# >0 - 5 = Infant
your_age = int(input("Enter you age : "))
if your_age >= 18 :
print("ADULT")
elif your_age > 5 :
print("CHILD")
else :
print("INFANT")
|
class Solution:
def solve(self, matrix):
dp = [[[None,0,0,0] for x in range(len(matrix[0])+1)] for y in range(len(matrix)+1)]
ans = 0
for y in range(len(matrix)):
for x in range(len(matrix[0])):
coeff0 = 1 if matrix[y][x] == dp[y-1][x][0] == dp[y][x-1][0] == dp[y-1][x-... |
class Solution:
def bitwiseComplement(self, N: int) -> int:
if N == 0:
return 1
tmp = []
while N:
t = N % 2
N //= 2
tmp.append(1-t)
ans = 0
for k in range(len(tmp)-1, -1, -1):
ans += tmp[k] * 2**k
return ans
... |
def closest_row(dataframe, column, value):
"""
Function which takes a dataframe and returns the row that is closest to the specified value of the specified column.
:param dataframe: Dataframe object
:param column: String which matches to a column in the dataframe in which you would like to find the cl... |
"""IO subpackage.
Modules and functions for input / output file and data processing
"""
|
#
# PySNMP MIB module ACMEPACKET-ENVMON-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ACMEPACKET-ENVMON-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:13:15 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... |
#
# PySNMP MIB module M2000-V1 (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/M2000-V1
# Produced by pysmi-0.3.4 at Mon Apr 29 19:59:02 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:1... |
Experiment(description='More kernels but no RQ',
data_dir='../data/tsdl/',
max_depth=8,
random_order=False,
k=1,
debug=False,
local_computation=False,
n_rand=9,
sd=4,
max_jobs=400,
verbose=False,
... |
"""
############################################################################
## High Altitude Balloon Club
############################################################################
"""
|
class Solution:
def deleteDuplicates(self, head):
if head:
p = head.next
while p and p.val == head.val:
p = p.next
head.next = self.deleteDuplicates(p)
return head
|
# getting these names wrong on the mocks will result in always passing tests
# instead of calling methods on the mock, call these (where typos will fail)
def assert_called_once_with(mock, *args, **kwargs):
mock.assert_called_once_with(*args, **kwargs)
def assert_called_with(mock, *args, **kwargs):
mock.ass... |
# EJERCICIO 1: Imprimir en una lista los números del 1 al 20
lista=[]
for i in range(1,21):
lista.append(i)
print(lista)
# EJERCICIO 2: Imprimir en una lista la tabla de multiplicar hasta el 10 del número que se ingresa por consola
"""n = int(input("Por favor ingrese un número: "))
lista=[]
for i in range(1,11... |
#
# PySNMP MIB module CTRON-SSR-HARDWARE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-SSR-HARDWARE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:31:24 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... |
# Area and perimeter of a rectangle in the plane
# A rectangle is given by the coordinates of two of its opposite angles (x1, y1) - (x2, y2).
# Calculate its area and perimeter . The input is read from the console. The numbers x1, y1, x2 and y2 are given one per line.
# The output is displayed on the console and must c... |
categories = [["Δημητριακά","Φρυγανίες", "Ζαχαρί", "Ρύζια","Αλευρια & Ειδη Ζαχαροπλαστικής","Ψωμί", "Ζυμαρικά" ,"Όσπρια", "Παντοπολείο", "Αλλαντικά", "Κρέας κά", "Προιόντα Ζύμης", "Κατεψυγμένα Λαχανικά", "Φρέσκα Φρούτα & Λαχανικά", "Ψάρια & Θαλάσσινά"],
["Γάλα", "Γιαούρτια & Επιδόρπια", "Κρέμες γάλακτος & Βούτυρα", "Π... |
def fuel(x):
tot = 0
while True:
f = x//3 - 2
if f <= 0:
break
x = f
tot += f
return tot
input = """
123265
68442
94896
94670
145483
93807
88703
139755
53652
52754
128052
81533
56602
96476
87674
102510
95735
69174
136331
51266
148009
72417
52577
86813
60803
14923... |
#LA SETENCIA FOR (PARA)
# Puede hacer recorridos mas eficientes en codigo de listas.
#Ejemplo de Comparación con while.
numeros = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
indice = 0
while(indice < len(numeros)):
print(numeros[indice])
indice += 1
#Ahora con FOR
for numero in numeros:
print(numero)
#EJEMPLO
indic... |
#
# PySNMP MIB module CPQSTSYS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CPQSTSYS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:27:26 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,... |
def encoded_from_base10(number, base, digit_map):
'''
This function returns a string encoding in the "base" for the the "number" using the "digit_map"
Conditions that this function must satisfy:
- 2 <= base <= 36 else raise ValueError
- invalid base ValueError must have relevant information
- di... |
"""
Configuration file for Greedy Schedule Algorithm global variables
"""
FILE_TO_READ = "test_input.csv"
OUTPUT_FILE = "output.csv"
# Allowable overlap time in minutes
ALLOWABLE_OVERLAP = 23
# The limit of the total value number in hours
TOTAL_VALUE_LIMIT = 13
# List of column headers of columns w... |
#config.py
#Enable Flask"s debugging features. should be False in production
DEBUG = True |
# Problem Statement: https://www.hackerrank.com/challenges/ginorts/problem
S = ''.join(sorted(input(), key=lambda x: (not x.islower(),
not x.isupper(),
not x in '13579',
x)))
print(S) |
class InitCommands(object):
COPY = 'copy'
CREATE = 'create'
DELETE = 'delete'
@classmethod
def is_copy(cls, command):
return command == cls.COPY
@classmethod
def is_create(cls, command):
return command == cls.CREATE
@classmethod
def is_delete(cls, command):
... |
hm_epoch = 5 # Number of epoch in training
lag_range = 1 # Lag range
lag_epoch_num = 1 # Number of epoch while finding lag
learning_rate = 0.001 # Default learning rate
|
#
# PySNMP MIB module NOKIA-HWM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NOKIA-HWM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:23:29 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... |
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to ... |
# 20
num = 1
for i in range(100):
num *= i + 1
print(sum(int(n) for n in str(num)))
|
#
# PySNMP MIB module ADIC-INTELLIGENT-STORAGE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ADIC-INTELLIGENT-STORAGE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:13:36 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python vers... |
description = 'Q range displaying devices'
group = 'lowlevel'
includes = ['detector', 'det1', 'sans1_det', 'alias_lambda']
devices = dict(
QRange = device('nicos_mlz.sans1.devices.resolution.Resolution',
description = 'Current q range',
detector = 'det1',
beamstop = 'bs1',
wavelen... |
pkgname = "gsettings-desktop-schemas"
pkgver = "42.0"
pkgrel = 0
build_style = "meson"
configure_args = ["-Dintrospection=true"]
hostmakedepends = [
"meson", "pkgconf", "glib-devel", "gobject-introspection"
]
makedepends = ["libglib-devel"]
depends = [
"fonts-cantarell-otf", "fonts-source-code-pro-otf", "adwait... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
class GpioData:
_count = 0
_modNum = 8
_specMap = {}
_freqMap = {}
_mapList = []
_modeMap = {}
_smtMap = {}
_map_table = {}
def __init__(self):
self.__defMode = 0
self.__eintMode = False
self.__modeVec = ['0', '0', ... |
class Solution:
def smallestRepunitDivByK(self, k: int) -> int:
if k % 2 == 0 or k % 5 == 0:
return -1
if k == 1:
return 1
count = 1
n = 1
while (n % k > 0):
n = (n % k) * 10 + 1
count += 1
return count
|
"""Exceptions for ocean_utils """
# Copyright 2018 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
class OceanInvalidContractAddress(Exception):
"""Raised when an invalid address is passed to the contract loader."""
class OceanDIDUnknownValueType(Exception):
"""Raised when a requested DI... |
class PiggyBank:
# create __init__ and add_money methods
def __init__(self, dollars, cents):
self.dollars = dollars
self.cents = cents
def add_money(self, deposit_dollars, deposit_cents):
self.dollars += deposit_dollars
self.cents += deposit_cents
if self.cents >= 10... |
class Solution:
def countAndSay(self, n: int) -> str:
s = '1'
for _ in range(1, n):
nextS = ''
countC = 1
for i in range(1, len(s) + 1):
if i == len(s) or s[i] != s[i - 1]:
nextS += str(countC) + s[i - 1]
cou... |
def area(larg, comp):
area = larg * comp
print(f'A área de um terreno {larg:.2f}x{comp:.2f} é de {area} m^2')
print('Controle de Terrenos')
print('-' * 20)
larg = float(input('LARGURA (m): '))
comp = float(input('COMPRIMENTO (m): '))
area(larg, comp)
|
###############################################################################
# Auto-generated by `jupyter-book config`
# If you wish to continue using _config.yml, make edits to that file and
# re-generate this one.
###############################################################################
author = 'The Jupyter... |
def convert_to_int(integer_string_with_commas):
comma_separated_parts = integer_string_with_commas.split(",")
for i in range(len(comma_separated_parts)):
if len(comma_separated_parts[i]) > 3:
return None
if i != 0 and len(comma_separated_parts[i]) != 3:
return None
in... |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""USB constant definitions.
"""
class DescriptorType(object):
"""Descriptor Types.
See Universal Serial Bus Specification Revision 2.0 Table 9-5.
"... |
class Component:
def update(self):
return self
def print_to(self, x, y, media):
return media
|
#encoding=utf-8
########################################################################
def checkIndex(key):
"""
所给的键是能接受的索引吗?
为了能被接受,键应该是一个非负的整数。如果它不是一个整数,会引发TypeError; 如果它是负数,则会引发IndexError(因为序列是无限长的)
"""
if not isinstance(key, (int)): raise TypeError
if key < 0: raise IndexError
class Arit... |
n = int(input('Numero de notas: '))
notas = 0
i=0
while i<n:
notas += float(input("nota: "))
i+=1
print('a media das notas é {:.1f}'.format(notas/n)) |
""" Python program for implementation of Quicksort Sort
This function takes last element as pivot, places
the pivot element at its correct position in sorted
array, and places all smaller (smaller than pivot)
to left of pivot and all greater elements to right
of pivot"""
def partition(arr, low, high):
... |
# CAPWATCH downloader config variables
## Copyright 2017 Marshall E. Giguere
##
## 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
... |
class FakeCustomerRepository:
def __init__(self):
self.customers = []
def get_by_id(self, customer_id):
return next(
(customer for customer in self.customers if customer.id == customer_id),
None,
)
def get_by_email(self, email):
return next(
... |
#
# Copyright 2019 The FATE 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 appli... |
#
# PySNMP MIB module CISCO-ENTITY-SENSOR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ENTITY-SENSOR-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:39:57 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... |
INSTALLED_APPS += (
'social_auth',
)
AUTHENTICATION_BACKENDS = (
'social_auth.backends.twitter.TwitterBackend',
'social_auth.backends.facebook.FacebookBackend',
'django.contrib.auth.backends.ModelBackend',
)
TEMPLATE_CONTEXT_PROCESSORS += (
'social_auth.context_processors.social_auth_backends',
... |
num_waves = 4
num_eqn = 5
# Conserved quantities
density = 0
x_momentum = 1
y_momentum = 2
energy = 3
tracer = 4
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Napisz funkcję big_no zwracającej tzw. "Big 'NO!'"
(zob. http://tvtropes.org/pmwiki/pmwiki.php/Main/BigNo)
dla zadanej liczby tj. napis typu "NOOOOOOOOOOOOO!", gdzie liczba 'O' ma być
równa podanemu argumentem, przy czym jeśli argument jest mniejszy niż 5,
ma być zwrac... |
class Solution:
def circularArrayLoop(self, nums: List[int]) -> bool:
N = len(nums)
for i, num in enumerate(nums):
if num == 0: continue
cur = i
flag = num / abs(num)
seen = set()
while nums[cur] * flag > 0:
nx = (cur + nums... |
N, M = map(int, input().split())
for i in range(1, N, 2):
print(''.join(['.|.'] * i).center(M, '-'))
print("WELCOME".center(M, '-'))
for i in range(N-2, -1, -2):
print(''.join(['.|.'] * i).center(M, '-'))
|
class SVGFilterInputs:
SourceGraphic = 'SourceGraphic'
SourceAlpha = 'SourceAlpha'
BackgroundImage = 'BackgroundImage'
BackgroundAlpha = 'BackgroundAlpha'
FillPaint = 'FillPaint'
StrokePaint = 'StrokePaint'
class SVGFilter:
def __init__(self, svg):
self.svg = svg
def render... |
#coding:utf-8
bind = 'unix:/var/run/gunicorn.sock'
workers = 4
# you should change this
user = 'root'
# maybe you like error
loglevel = 'warning'
errorlog = '-'
secure_scheme_headers = {
'X-SCHEME': 'https',
}
x_forwarded_for_header = 'X-FORWARDED-FOR'
### gunicorn -c settings.py -b 0.0.0.0:9000 wsgi:app
|
def get_count_A_C_G_and_T_in_string(dna_string):
'''
Create a function named get_count_A_C_G_and_T_in_string with a parameter named dna_string.
:param dna_string: a DNA string
:return: the count of As, Cs, Gs, and Ts in the dna_string
'''
A_count=0
C_count=0
G_count=0
T_count=0
... |
for i in range(10):
a = i
print(a)
|
# LeetCode 897. Increasing Order Search Tree `E`
# 1sk | 89% | 19'
# A~0v10
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def increasingBST(self, root: T... |
# -*- coding: utf-8 -*-
class Saludo(object):
"""docstring for Saludo"""
def __init__(self):
super(Saludo, self).__init__()
print('\n Estoy saludando ..')
Saludo()
|
# Python program to print positive Numbers in a List
# list of numbers
list1 = [10, -21, 4, -45, -66, -93]
# using list comprehension
positive_nos = [num for num in list1 if num <= 0]
print("positive numbers in the list: ", positive_nos)
# Remove multiple elements from list
l = [3, 5, 7, 4, 8, 4, 3]
l.sort()
pri... |
# nested try's
try:
print("try 1")
try:
print("try 2")
foo()
except:
print("except 2")
bar()
except:
print("except 1")
try:
print("try 1")
try:
print("try 2")
foo()
except TypeError:
print("except 2")
bar()
except NameError:
print... |
__all__ = [
'fullname',
'starts_with'
]
# https://stackoverflow.com/questions/2020014/get-fully-qualified-class-name-of-an-object-in-python
def fullname(o):
if o is None:
return None
module = o.__class__.__module__
if module is None or module == str.__class__.__module__:
return o... |
config_prefix = '='
config_description = 'Use =help to get started!'
config_owner_id = 311661241406062592
config_bot_log_channel = 741486105173688351
config_command_log_channel = 741486105173688351
config_error_log_channel = 741486105173688351
config_guild_log_channel = 741486105173688351
|
#Number analysis program
NUMBER_SERIES = 20
def main():
#here is the mathematical algorithm/code
numbers = get_numbers()
total = calculate_total(numbers)
average = total / len(numbers)
highest_number = max(numbers)
lowest_number = min(numbers)
print()
print_details(numbers,total,averag... |
def eastern_boundaries(lon,lat):
m = Basemap(projection='cyl')
boundaries = []
last_l_is_land = m.is_land(lon[0],lat)
for l in lon[1:]:
current_l_is_land = m.is_land(l,lat)
if last_l_is_land and not current_l_is_land:
boundaries.append(l)
last_l_is_land = current_l_is... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.