content stringlengths 7 1.05M |
|---|
'''
Given a sorted array of unknown length and a number to search for, return the index of the number in the array. Accessing an element out of bounds throws exception. If the number occurs multiple times, return the index of any occurrence. If it isn’t present, return -1.
int a[] = {1,2,3,4,5,6,7,8};
Find Value: 6
R... |
"""6.1.3 Circular Definition of Product ID
For each new defined Product ID (type /$defs/product_id_t) in items of relationships (/product_tree/relationships)
it must be tested that the product_id does not end up in a cirle.
The relevant path for this test is:
/product_tree/relationships[]/full_product_name/product... |
# # WAP to accept a number and display all the factors which are prime ( prime factors)
user_Inp = int(input("Enter number: "))
for i in range(1, user_Inp+1):
c = 0
if(user_Inp % i == 0):
for j in range(1, i+1):
if(i % j == 0):
c += 1
if(c <= 2):
print(i, ... |
N, K = list(map(int, input().split(' ')))
cnt = 0
while True:
if N == 1:
break;
if N % K == 0:
N /= K
else:
N -= 1
cnt += 1
print(cnt) |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 1 13:29:53 2018
@author: jel2
"""
def xval(x,y,g,mdl,params):
M=pd.DataFrame(g).join(y,how='outer').join(x,how='outer')
# Y=np.array(M[list(y)])
#### if Y is two columns with one binary column then treat it as survival data
# if(len(Y.shape)>1):... |
class Solution:
def nextLargerNodes(self, head: ListNode) -> List[int]:
st = []
res = []
while head:
while st and st[-1][1] < head.val:
idx, v = st.pop()
res[idx] = head.val
st.append((len(res), head.val))
res.append(0)
... |
def find_matches(match_info, results):
for target_match_info, obj in results:
if target_match_info.equals(match_info):
yield target_match_info, obj
|
#!/usr/bin/env python3
# coding: utf-8
# PSMN: $Id: 01.py 1.2 $
# SPDX-License-Identifier: CECILL-B OR BSD-2-Clause
""" https://github.com/OpenClassrooms-Student-Center/demarrez_votre_projet_avec_python/
fouiller dans les branches
"""
# P2C2
quotes = [
"Ecoutez-moi, Monsieur Shakespeare, nous avons beau être o... |
def test():
print('testing basic math ops')
assert 1+1 == 2
assert 10-1 == 9
assert 10 / 2 == 5
assert int(100.9) == 100
print('testing bitwise ops')
print(100 ^ 0xd008)
assert 100 ^ 0xd008 == 53356
print( 100 & 199 )
assert (100 & 199) == 68
## TODO fixme
print('TODO fix `100 & 199 == 68`')
assert 10... |
phrase = 'Coding For All'
phrase = phrase.split()
abrv = phrase[0][0] + phrase[1][0] + phrase[2][0]
print(abrv)
|
def increment(a):
return a+1
def decrement(a):
return a-1
|
# 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
# todo 上生产前需要修改
source_root = r'D:\Jupyter\tt_spider'
local_host = 'localhost'
local_port = 3306
local_user = 'root'
local_passwd = 'password'
db_host = 'hostname'
db_port = 3306
db_user = 'username'
db_passwd = 'password'
|
#!/usr/bin/python3.7
# -*- coding: utf-8 -*-
"""Molecule to atoms."""
def get_sub_molecule(molecule: list, atom: str) -> list:
molecule_copy = molecule[molecule.index(atom) + 1:]
sub_molecule = []
count_parent = 1
for el in molecule_copy:
if el in "([{":
count_parent += 1
... |
# Python 实现冒泡排序
def bubbleSort(alist):
for passnum in range(len(alist)-1, 0, -1):
for i in range(passnum):
if alist[i] > alist[i+1]:
alist[i], alist[i+1] = alist[i+1], alist[i]
return alist
alist = [54,26,93,17,77,31,44,55,20]
print(bubbleSort(alist))
# 改进的冒泡排序, 加入一个校验, 如果某... |
# 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 pathSum(self, root, sum):
"""
:type root: TreeNode
:type sum: int
:rtype: int
... |
class Referee:
def __init__(self, json_referee_info: dict) -> None:
self.id = json_referee_info.get("id")
self.bonuses = json_referee_info.get("bonuses")
self.bonuses_total = json_referee_info.get("bonuses_total")
self.email = json_referee_info.get("email")
class Referrals:
de... |
def find_the_max_sum_of_subarray(arr, K):
# Input: [2, 1, 5, 1, 3, 2], k=3
# Output: 9
start_index = 0
sum_index = 0
target_sum = 0
for index, value in enumerate(arr):
sum_index += value
if index >= K-1:
if sum_index > target_sum:
target_sum = s... |
def addDynamic():
"""
http://help.autodesk.com/cloudhelp/2019/ENU/Maya-Tech-Docs/CommandsPython/addDynamic.html
-----------------------------------------
addDynamic is undoable, NOT queryable, and NOT editable.
Makes the "object" specified as second argument the source of an existing
field or emitter specified... |
# -*- coding: utf-8 -*-
VOICE_DATA = [
{
"Id": "Joanna",
"LanguageCode": "en-US",
"LanguageName": "US English",
"Gender": "Female",
"Name": "Joanna",
},
{
"Id": "Mizuki",
"LanguageCode": "ja-JP",
"LanguageName": "Japanese",
"Gender": "... |
for i in range(10000000):
str_i = str(i)
s1 = 'ABCDEFH' + str_i
s2 = '123456789' + str_i
result = ''
x = 0
if len(s1) < len(s2):
while x < len(s1):
result += s1[x] + s2[x]
x += 1
result += s2[x:]
else:
while x < len(s2):
result += s... |
class parent:
counter=10
hit=15
def __init__(self):
print("Parent class initialized.")
def SetCounter(self, num):
self.counter= num
class child(parent): # child is the child class of Parent
def __init__(self):
print("Child class being initialized.")
def SetHit(self, num2):
self.hit=num2
c= child()
print... |
class Node:
def __init__(self, data=None , next_ref=None):
self.data = data
self.next = next_ref
class Stack:
def __init__(self, data=None):
self.__top= None
self.__size = 0
if data:
node = Node(data)
self.__top = node
self.__size = 1
def push(self, data):
node = Node(data,self.__top)
self... |
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def reverseBetween(self, head: ListNode) -> ListNode:
value = 0
currentNode = head
while currentNode!=None :
node = currentNode
while node.next!=None:
... |
__title__ = 'ki'
__version__ = '1.1.0'
__author__ = 'Joshua Scott & Caleb Pina'
__description__ = 'Python bindings and extensions for libki'
|
# filename : Graph.py
# ------------------------------------------------------------------------------------
class Graph:
def __init__(self, number_of_vertex, number_of_edges, is_directed = False, is_weighted = False):
self.number_of_vertices = number_of_vertex
self.number_of_edges = number_... |
"""
Authors
-------
Dr. Randal J. Barnes
Department of Civil, Environmental, and Geo- Engineering
University of Minnesota
Richard Soule
Source Water Protection
Minnesota Department of Health
Version
-------
06 May 2020
"""
PROJECTNAME = 'Carlos example'
TARGET = 0
NPATHS = 500
DURATION... |
"""
Stack data structure is optimized for quick appends (push) and removal of the last
node (pop)
"""
class Node:
"""Node is a simple data structure holding information"""
def __init__(self, value, node):
self.__value = value
self.__next = node
@property
def value(self):
"""Re... |
"""
Module cannot be called tool_shed, because this conflicts with lib/tool_shed
also at top level of path.
"""
|
# -*- coding: utf-8 -*-
"""
Unit test package for utils.
"""
|
#!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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
Unle... |
class Solution(object):
def isMatch(self, s, p):
"""
:type s: str
:type p: str
:rtype: bool
"""
n_s = len(s)
n_star = 0
seg = []
i = len(p) - 1
while i > -1:
if p[i] == '*':
n_star += 1
seg.i... |
class SimulationNotFinished(Exception):
def __init__(self, keyword):
super().__init__(
"Run simulation first before using `{}` method.".format(keyword)
)
class DailyReturnsNotRegistered(Exception):
def __init__(self):
super().__init__("Daily returns data have not yet regist... |
''' Faça um programa que calcule a soma entre todos os números impares que são múltiplos de três e que se encontram no
intervalo de 1 até 500.'''
print('\033[1;33m-=\033[m' * 20)
soma = 0
contador = 0
for c in range(1, 501, 2):
if c % 3 == 0:
contador += 1
soma += c
print('\033[35mExiste\033[m {}{}{... |
def test_sm_tatneft_include_eic_yestoday(app):
app.testhelpersm.refresh_page()
app.session.open_SM_page(app.smPurchases)
app.session.ensure_login_sm(app.username, app.password)
app.session.ensure_login_sm(app.username, app.password)
app.session.open_SM_page(app.smPurchases)
app.testHelperSMSe... |
# Refaça o desafio 035 dos triângulos, acrescentando o recurso de mostrar que tipo de triângulo será formado:
# Equilátero: todos os lados iguais.
# Isósceles: dois lados iguais.
# Escaleno: todos os lados diferentes.
reta1 = float(input('Digite o valor da reta 1: '))
reta2 = float(input('Digite o valor da reta 2: '... |
"""
SOLUTIONS ROBUST ARE ON GITHUB RAFFSON (OPLEIDER)
"""
mood = input("What is your mood? :")
mood = mood.lower()
if mood == "happy":
print("It is great to see you happy!")
elif mood == "nervous":
print("Take a deep breath 3 times.")
elif mood == "sad":
print("Cheer up, mate!")
elif mood == "excited":
... |
print('=-'*20)
numero = int(input('Digite o número que deseja ver a tabuada: '))
print('=-'*20)
for c in range(1, 11):
print('{} X {} = {}'.format(c, numero, numero * c))
|
class FilterGroupController:
def __init__(self, filterGroups):
self.filterGroups = filterGroups
def sendCoT(self, CoT):
pass
def addUser(self, clientInformation):
pass
def removeUser(self, clientInformation):
pass |
class Solution:
def maxSumTwoNoOverlap(self, A: List[int], L: int, M: int) -> int:
prefix, n, res, left = [0 for _ in range(len(A) + 1)], len(A) + 1, 0, 0
for i in range(1, n):
prefix[i] = prefix[i - 1] + A[i - 1]
for i in range(L + M, n):
left = max(left, prefix[i - ... |
numbers = """
123.456,789|012,345+678 901
"""
print(numbers.split())
print(numbers.split(","))
separators = ".,|+ "
op = "".join(char if char not in separators else " " for char in numbers).split()
print(op)
|
valores = input().split()
valores = list(map(int,valores))
A, B = valores
if (B%A == 0) or (A%B == 0):
print('Sao Multiplos')
else:
print('Nao sao Multiplos') |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
extract statistics from github repos
"""
__version__ = "1.0"
name = "github_stats"
|
def search(str, lst, size):
for i in range(0, size):
if lst[i] == str:
return i
return -1
print(search("a", ["a", "b", "c"], 3))
print(search("b", ["a", "b", "c"], 3))
print(search("c", ["a", "b", "c"], 3))
print(search("d", ["a", "b", "c"], 3))
|
class Renderer:
def __init__(self):
self.render_queue = Queue()
"""
the renderer stores all of the shapes
and renders them on the screen inside the view
the render_queue
[node] -> [node] -> [node]
"""
|
#!/usr/bin/env python3
def divisor(n):
num = 0
i = 1
while i * i <= n:
if n % i == 0:
num += 2
i += 1
if i * i == n:
num -= 1
return num
def main():
i = 1
sum = 0
while True:
sum = divisor(i*(i+1)/2)
if sum >= 500:
pr... |
# -*- coding: utf-8 -*-
#TODO this could probably just be a list.
digits = {
"0" : True,
"1" : True,
"2" : True,
"3" : True,
"4" : True,
"5" : True,
"6" : True,
"7" : True,
"8" : True,
"9" : True
}
#TODO this could probably just be a list.
lowercase... |
# Individuals Script Runs
Y = True
N = False
topics_run = Y
groups_run = Y
events_and_members_run = Y
events_run = Y
members_run = Y
rsvps_run = Y
# Topics searches by keyword query
# topics = ['innovation']
topics = ['startups','entrepreneurship','innovation']
topics_per_page=20
# topics_offset=0 n/a
# How many t... |
class A:
def __init__(self, a):
self.a = a
a = A(0)
b = a
print(b.a)
b = A(5)
print(a.a)
print(b.a)
|
class Solution:
def numRescueBoats(self, people: List[int], limit: int) -> int:
people.sort()
i, j, boats = 0, len(people) - 1, 0
while i <= j:
boats += 1
if people[i] + people[j] <= limit:
i += 1
j -= 1
return boats |
class Solution:
def findTheDifference(self, s: str, t: str) -> str:
count = Counter(s)
for i, c in enumerate(t):
count[c] -= 1
if count[c] == -1:
return c
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 1 00:49:46 2019
"""
# simple binary detection script
config = {
## model
'num_classes': 1,
'classes': ['background', 'car',],
'img_size': 416,
## train
'weight_decay': 0.0001,
'image... |
class Solution(object):
def checkSubarraySum(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: bool
"""
P = set()
for n in nums:
P = {(m+n) % k if k else m+n for m in P}
if 0 in P:
return True
P.add(n)
return False
|
#!/usr/bin/env python
class Empire(dict):
''' Methods for updating/viewing Empirees '''
def __init__(self, Empire_dict):
super(Empire, self).__init__()
self.update(Empire_dict)
|
class ParserError(Exception):
pass
class ReceiptNotFound(ParserError):
pass
|
text = input().split(", ")
valid_names = ""
for word in text:
if 3 <= len(word) <= 16:
if word.isalnum() or "-" in word or "_" in word:
valid_names = word
print(valid_names)
|
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
if len(s) == 0:
return 0
temp = dict()
i = 0
max_dis = 0
for k in range(len(s)):
if s[k] in temp:
i = max(temp[s[k]] + 1, i)
temp[s[k]] = k
max_d... |
"""
Write Number in Expanded Form
You will be given a number and you will need to return it as a string in Expanded Form.
For example:
expanded_form(12) # Should return '10 + 2'
expanded_form(42) # Should return '40 + 2'
expanded_form(70304) # Should return '70000 + 300 + 4'
NOTE: All numbers will be whole numbers g... |
#!/usr/bin/env python3
sum = 0
prod = 1
for i in range(1,11):
sum += i
prod *= i
print('sum: %d' % sum)
print('prod: %d' % prod)
|
# my name is abhishek. all are comments
# print("hie") # ijko
"""
file = module in python
"""
'''
data type int,float,string,boolean,none- says particular datatype as it doe not have value actually false
data structure - list, dictionary.
'''
# everything in python is call by reference, what is done after delete a f... |
# In Python, True and False are Boolean objects of class 'bool' and they are immutable.
# Python assumes any non-zero and non-null values as True, otherwise it is False value.
# Python does not provide switch or case statements as in other languages.
# if statement
x = int(input('please enter an integer: '))
# x = ... |
#No job instantiation, just an interface that could be implemented with a priority queue or map.
class Executor():
def __init__(self, IP, port):
self.server_info = (IP, port)
#server stores info of jobs in centralized location, so should manage encoding
def submit(self, job_name, siz... |
#!/usr/bin/env python3
"""Super class for all malwares.
"""
class Malware:
"""Defines the lifetime of the malware's domains.
The lifetime is expressed in seconds.
0 means that the malware doesn't implement a DGA.
Returns:
The lifetime of the malware's domains.
"""
@classmethod
def domainsLifetime(... |
# coding: utf-8
# This file is a part of VK4XMPP transport
# © simpleApps, 2014 (30.08.14 08:08AM GMT) — 2015.
"""
This plugin allows users to publish their status in VK
"""
VK_ACCESS += 1024
GLOBAL_USER_SETTINGS["status_to_vk"] = {"label": "Publish my status in VK", "value": 0}
def statustovk_prs01(source, prs, re... |
"""
Given a string text, you want to use the characters of text to form as
many instances of the word "balloon" as possible.
You can use each character in text at most once. Return the maximum
number of instances that can be formed.
Example:
Input: text = "nlaebolko"
Output: 1
Examp... |
def block_width(block):
try:
return block.index('\n')
except ValueError:
return len(block)
def stack_str_blocks(blocks):
"""Takes a list of multiline strings, and stacks them horizontally.
For example, given 'aaa\naaa' and 'bbbb\nbbbb', it returns
'aaa bbbb\naaa bbbb'. As in:
... |
# -*- coding: utf-8 -*-
"""Top-level package for pistis."""
__author__ = """Michael Benjamin Hall"""
__email__ = 'mbhall88@gmail.com'
__version__ = '0.1.0'
|
def binary_search(target, num_list):
if not target:
raise Exception
if not num_list:
raise Exception
left, right = 0, len(num_list)-1
mid = left + (right - left)//2
while left <= right:
mid = left + (right - left)//2
if num_list[mid] == target:
return T... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@File : __init__.py
@Time : 2022/2/1 6:51
@Author : Tim Chen
@Version : 0.0.1
@Contact : cscomicanimation@gmail.com
@License : MIT
@Desc : None
"""
# here put the import lib
|
def rotateMatrixby90(ipMat, size):
opMat = [[0 for i in range(size)] for j in range(size)]
for i in range(size):
for j in range(size):
opMat[j][i] = ipMat[i][j]
return opMat
def reverseMatrix(ipMat, size):
opMat = [[0 for i in range(size)] for j in range(size)]
for i in range(size):
for j i... |
""" Based on C code from: http://nlp.cs.nyu.edu/evalb/
"""
def bracketing(ts):
buf = range((len(ts)+1)/2 + 1)
buf = list(reversed(zip(buf[:-1], buf[1:])))
stack = []
ret = []
for t in ts:
if t == 0:
stack.append(buf.pop())
elif t == 1:
R, L = stack.pop(), st... |
#!/usr/bin/env python
#Modify once acccording to your setup
WORKSPACE = "/Users/Gautam/AndroidStudioProjects/AndroidGPSTracking"
#Modify the below lines for each project
PROJECT_NAME = "AndroidGPSTracking"
#Modify if using DB
DB_NAME = "mainTuple"
TABLE_NAME = "footRecords"
MAIN_ACTIVITY = "TrackActivity"
#DO NOT MO... |
class Solution(object):
def removeKdigits(self, num, k):
if len(num) <= k:
return "0"
ret = []
for i in range(len(num)):
while k > 0 and ret and ret[-1] > num[i]:
ret.pop()
k-=1
ret.append(num[i])
while k >... |
class TooShort(Exception):
pass
class Stale(Exception):
pass
class Incomplete(Exception):
pass
class Boring(Exception):
pass
|
class BasePipeline(object):
"""Main end-point to run the pipeline processes"""
def __init__(self, config):
self.config = config
def initialize_data(self):
""" Initialize dataset: loading, preprocess metadata"""
raise NotImplementedError
def extract_feature(self):
raise... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
class ExampleData(object):
def __init__(
self,
question: str = None,
is_multi_select: bool = False,
option1: str = None,
option2: str = None,
option3: str = None,
):
... |
#
# PySNMP MIB module CISCO-CEF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-CEF-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:53:12 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... |
"""Utilities for speech recognition."""
class TranscriptMap(object):
"""An abstract class representing a map from transcripts to labels.
All other datasets should subclass it. All subclasses should override
``trans2label``.
"""
def trans2label(self, transcript):
"""Convert a transcript t... |
arr = [[1, 2, 3, 12],
[4, 5, 6, 45],
[7, 8, 9, 78]]
x = 3
print("start")
w = len(arr)
h = len(arr[0])
i = 0
j = 0
while i < w and j < h and arr[i][j] < x:
ib = i
ie = w - 1
i2 = -1
while ib < ie:
i2n = (ie - ib) // 2
if i2 == i2n:
break
i2 = i2n
print("i2 ", i2, ib, ie)
if arr[i2... |
"""
Copyright 2016 Pawel Bartusiak
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 writing, softwar... |
"""Skinny, measuring nudity and skin percentage in images.
This module measures the skin coefficient of images in order to determine
if the people in it are nude or not.
Example:
The module is a twistd plugin so it can be run by::
$ twistd -n skinny
Flags:
--port -p (int): Port number for the plugin... |
'''
Min Depth of Binary Tree
Asked in: Facebook, Amazon
https://www.interviewbit.com/problems/min-depth-of-binary-tree/
Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
NOTE : The path has to end on a lea... |
def selection_sort(nums):
# This value of i corresponds to how many values were sorted
for i in range(len(nums)):
# We assume that the first item of the unsorted segment is the smallest
lowest_value_index = i
# This loop iterates over the unsorted items
for j in range(i + 1, len(... |
# Q: A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a^2 + b^2 = c^2
# For example, 32 + 42 = 9 + 16 = 25 = 52.
#
# There exists exactly one Pythagorean triplet for which a + b + c = 1000, Find the product abc.
def main():
print (find_abc(1000))
# We do this in a function to avoid ... |
annual_salary = float(input('Enter your annual salary: '))
portion_saved = float(input('Enter the percent of your salary to save, as a '
'decimal: '))
total_cost = float(input('Enter cost of your dream home: '))
portion_down_payment = 0.25
current_savings = 0
r = 0.04
months = 0
portion_mon... |
def greet(name):
get_greet = f"Hi, {name}"
return get_greet
greeting = greet("Ahmed")
print(greeting)
|
def submission_choice(assignment, user_id, subs):
"""
If a student has multiple submissions, interactively prompt
the user to choose one
"""
# If they have multiple submissions, make them choose
if len(subs) > 1:
print("{0} submissions found for {1}, choose one:\n"
.forma... |
def removeElement(nums, val):
newArray = [n for n in nums if n != val]
print(newArray)
print(len(newArray))
|
class Node:
# Constructor to create a new node
def __init__(self, data):
self.data = data # Pointer to data
self.next = None # Initialize next as null
def deleteNode(head, position):
if head is None:
return head
elif position == 0:
return head.next
prev_node ... |
# -*- coding: utf-8 -*-
L = [
['Apple', 'Google', 'Microsoft'],
['Java', 'Python', 'Ruby', 'PHP'],
['Adam', 'Bart', 'Lisa']
]
print(L[0][0])
print(L[1][1])
print(L[2][2])
sum = 0
for x in range(101):
sum = sum + x
print(sum)
sum1 = 0
n = 99
while n>0:
sum1 = sum1 + n
n = n -2
print(sum1... |
class Soldado:
def __init__(self, nombre, raza):
self.nombre = nombre
self.raza = raza
"""Incluyo el arma como variable propia del objeto y valor inicial vacío"""
self.arma = ""
if raza == "Elfo":
self.vida = 80
self.velocidad = 10
self.cos... |
ori_file = '/home/unaguo/hanson/data/landmark/WFLW191104/train_data/300W_LP.txt'
save_file = '/home/unaguo/hanson/data/landmark/WFLW191104/train_data/300W_LP1.txt'
lable = '0'
ori_lines = []
with open(ori_file, 'r')as f:
ori_lines = f.readlines()
with open(save_file, 'w')as f:
for line in ori_lines:
l... |
messages = {
0: [
"You don’t need a mask in terms of the air pollution today. But since we are facing a global pandemic of Covid-19 right now please wear a mask.",
"It is actually a perfect day to go on a hike today but since the cases of Covid-19 is increasing rapidly I would recommend you to stay... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ======================================================
#
# File name: test_console_outputs
# Author: threeheadedknight@protonmail.com
# Date created: 30.06.2018 17:36
# Python Version: 3.7
#
# ======================================================
# https://www.c... |
"""Defines the `graalvm_native_image_cc_library` macro, which is a helper macro
for declaring a `graalvm_native_image_library` rule and wraping its outputs
in appropriate rules from `@rules_cc`.
"""
load(
"@dwtj_rules_java//experimental/graalvm:rules/graalvm_native_image_library/defs.bzl",
"graalvm_native_imag... |
"""
Scripts to parse and convert LAMMPS log files.
"""
class LogFileReader:
def __init__(self, filename):
"""
Attributes
----------
runs :
List of the run objects
Todo
----
rigid bodies
not implemented ridig body integrator
m... |
class QueryParams:
def _append_query_list(query_list, key, values):
if isinstance(values, list):
for value in values:
QueryParams._append_query_list(query_list, key, value)
elif isinstance(values, bool):
if values == True:
QueryParams._... |
def partition(arr, low, high):
i = low -1
pivot = arr[high]
for j in range(low, high):
if arr[j] < pivot:
i+=1
arr[i], arr[j] =arr[j], arr[i]
arr[i+1], arr[high] = arr[high], arr[i+1]
return i+1
def quicksort(arr, low,high):
if low < high:
pi = partition(... |
# -*- coding: utf-8 -*-
{
'name': "wechat_mall",
'application': True,
'summary': u"""
微信小程序商城管理后台""",
'description': u"""
微信小程序商城管理后台
""",
'author': "Gzp",
'website': "http://wechat.elfgzp.cn",
# Categories can be used to filter modules in modules listing
# Check ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2019-07-07 12:07:46
# @Author : Lewis Tian (taseikyo@gmail.com)
# @Link : github.com/taseikyo
# @Version : Python3.7
# https://projecteuler.net/problem=1
def main():
return sum([i for i in range(1, 1000) if (i % 3 == 0) or (i % 5 == 0)])
if __name_... |
"""
Tipos de dados
str = string = 'Assim' ou "Assim"
int = inteiro = 1234 ou -12 ou 10 ou 333
float = real/ponto flutuante = -89.10 ou 12.99 ou 0.0
bool = booleano/lógico = True ou False => 10 == 10 => True
type = retorna o tipo do dado
"""
print("Leandro")
print(type("Leandro"))
print(123456)
print(type(123456))
print... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.