blob_id stringlengths 40 40 | repo_name stringlengths 5 127 | path stringlengths 2 523 | length_bytes int64 22 545k | score float64 3.5 5.34 | int_score int64 4 5 | text stringlengths 22 545k |
|---|---|---|---|---|---|---|
3ed4e89c1ef7aa209d853d0f0ff7cf95a0672c96 | SeriousGuy888/pygame-checkers | /checkers_classes/ghost_piece.py | 3,009 | 3.546875 | 4 | import __main__ as main
class GhostPiece(main.pygame.sprite.Sprite):
def __init__(self, square, ghosted_piece, is_jumping_piece, piece_being_jumped):
main.pygame.sprite.Sprite.__init__(self)
self.x = square.x
self.y = square.y
self.ghosted_piece = ghosted_piece
self.is_jump... |
ed32eff5d2a297f299deacf1e22d68193494fcce | Starluxe/MIT-6.00.1x-Introduction-to-Computer-Science-and-Programming-Using-Python | /Problem Set 1/Problem 3 - Longest Alphabetcal Substring.py | 1,187 | 4.28125 | 4 | # Assume s is a string of lower case characters.
# Write a program that prints the longest substring of s in which the letters
# occur in alphabetical order. For example, if s = 'azcbobobegghakl',
# then your program should print
# Longest substring in alphabetical order is: beggh
# In the case of ties, print the ... |
b2da8890a183783c996070701b900c866f235d61 | Starluxe/MIT-6.00.1x-Introduction-to-Computer-Science-and-Programming-Using-Python | /Final Exam/Problem 3.py | 631 | 4.1875 | 4 | # Implement a function that meets the specifications below.
# def sum_digits(s):
# """ assumes s a string
# Returns an int that is the sum of all of the digits in s.
# If there are no digits in s it raises a ValueError exception. """
# # Your code here
# For example, sum_digits("a;35d4") retu... |
c92d4356e1b2ceb8dd558a5f7ef76b582b2dd3bf | patni11/python-course | /video8/tasks/triangle.py | 255 | 4 | 4 | """
1
12
123
1234
12345
"""
def triangle(steps=5):
for i in range(1, steps+1):
print()
for j in range(0, i):
print(j+1, end=" ")
steps = int(input("Please enter the number of steps for triangle"))
triangle(steps=steps)
|
cb0236045342423a4aca5db5393339b8b88fd800 | patni11/python-course | /video 5 (if conditions)/if.py | 1,035 | 3.890625 | 4 | """
boolean
if statements - explain indentation, explain colon, explain what's inside if and what's not, not equal
nested if
if else
'and' and 'or' and 'not'
fizz buzz
Create a game login system
Username - check for age, user have not entered something wrong
Then concatenate everything and give an output
"""
# ... |
14cfddc26e6ad30247c31d38ecd8693c5d151888 | willianyoliveira/Mundo-Python-1---curso-em-v-deo | /Desafio012.py | 218 | 3.796875 | 4 | l = float(input('Qual a largura da parede?'))
h = float(input('Qual a altura da parede?'))
a = (l*h)
tinta = a/2
print('Você vai precisar de {:.2f} litros de tinta para pintar uma parede de {:2f}m²'.format(tinta,a))
|
0ef859a4a480f1d61da7b9a065f37b9d3e4fe9d6 | willianyoliveira/Mundo-Python-1---curso-em-v-deo | /Desafio23.py | 410 | 3.90625 | 4 | # faça um programa que leia um número de 1 ate 9999 e mostre quantas unidades, centenas, e dezenas possui
num = int(input('Digite um número de 1 a 9999 e iremos decompor: '))
u = num//1 %10
d = num//10 %10
c = num//100 %10
m = num//1000 %10
print('Analisando o número {}'.format(num))
print('Unidade: {}'.format(u))
prin... |
0d9cee17b396341ca249c90414f66e2d9602757f | willianyoliveira/Mundo-Python-1---curso-em-v-deo | /DEsafio017.py | 430 | 4.125 | 4 | '''Catetos e hipotenusa'''
import math
'''x = float(input('Qual o comprimento do cateto oposto: '))
y = float(input('Qual o comprimento do cateto adjascente: '))
h = (x*x + y*y)**0.5
print('O valor da hipotenusa é {.2f}.'.format(h))'''
x = float(input('Qual o comprimento do cateto oposto: '))
y = float(input('Qual o ... |
cd3f5722f7b8f54234994b194626272de4864251 | cam-garrison/python-string-searching-jake | /example_string_code.py | 1,152 | 3.6875 | 4 | import string
# This will create a list of lists of words
replaced = [sentence.replace(",", "") for sentence in big_list]
tokens = [sub.split() for sub in replaced]
# loop through list of lists
for i in range(len(tokens)):
for x in range(len(tokens[i])):
if tokens[i][x] == '':
continue
... |
12f5cba0647cc8b43b070bbb9b6a88d6efdb0be2 | vidddd/python-test | /condiciones.py | 137 | 3.734375 | 4 | x = 10
y = 80
if x > y:
print ("x es mayor que y ")
elif y > x:
print("y es mayor que x")
else:
print(" x e y son iguales")
|
fd99176bb1826a690b8fa32ea3ebcc2e2ccd24b5 | choldgraf/ecoggui | /examples/model_displacement.py | 1,663 | 3.546875 | 4 | # Authors: Jean-Remi King <jeanremi.king@gmail.com>
# Nghia Ho <http://nghiaho.com>
"""Generates 10 random 3D coordinates, rotate and translate them, and show how
the displacement can be fitted and predicted with `ModelDisplacement`.
"""
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matpl... |
9a49da9508fa090106d193491317db35a835573e | cpfischer/MazeSearchAlgorithms | /maze/Bot.py | 918 | 3.8125 | 4 | """
DO NOT CHANGE ANYTHING IN THIS FILE.
"""
"""
For this problem, note that the Bot receives
- maze
- starting row and column
- ending row and column
These forms the problem:
- the maze gives us "actions" and "successors"
- starting row and column gives us the initial state
- ending row and column gives us the goal s... |
87b5a07dc549fd0d2dd377a95f228ddf42343ccc | aaron-iglesias/Leetcode | /Python/climbing_stairs.py | 360 | 3.84375 | 4 | # You are climbing a stair case. It takes n steps to reach to the top.
# Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
# Note: Given n will be a positive integer.
class Solution(object):
def climbStairs(self, n):
sqrt5 = pow(5, 0.5)
return int(po... |
567569886dabd2a9b92ce8e6585c3c8f40482afe | aaron-iglesias/Leetcode | /Python/palindrome_linked_list.py | 392 | 3.921875 | 4 | # Given a singly linked list, determine if it is a palindrome.
class Solution(object):
def isPalindrome(self, head):
st = []
tmp = head
while tmp is not None:
st.append(tmp.val)
tmp = tmp.next
while head is not None:
if head.val != st.pop():
... |
e4ea8350a69027952211545b182140132f49e51b | Gabvaztor/TFBoost | /src/examples/PythonSintaxisExamples/Humano.py | 547 | 3.546875 | 4 | class Humano:
ojos = 2
piernas = 2
inteligencia = None
masaMuscular = 50
longitudDeBiceps = 20
fuerzaBrazo = masaMuscular*longitudDeBiceps
nombre = None
def __init__(self, nombre,gjasfhjgal,masaMuscular):
self.nombre = nombre
self.ojos = gjasfhjgal
self.masaMusc... |
000aba41fbc0af41dabb2f54715fbd1da15aa893 | Gabvaztor/TFBoost | /src/examples/Tests/Inference/Multithreading.py | 471 | 3.546875 | 4 | # single_threaded.py
import time
from threading import Thread
COUNT = 50000000
def countdown(n):
while n>0:
n -= 1
start = time.time()
countdown(COUNT)
end = time.time()
print('Time taken in seconds : ', end - start)
t1 = Thread(target=countdown, args=(COUNT//2,))
t2 = Thread(target=countdown, args=(CO... |
0bd76aeb906087cf6f194620a0039876c698ad89 | Gabvaztor/TFBoost | /src/examples/Tests/test_.py | 792 | 3.78125 | 4 | def in_list(iter, n):
start_index = 0
end_index = len(iter) - 1
middle_index = len(iter) // 2
quarter_index = middle_index // 2
third_quarter_index = int(middle_index * 1.5)
section_1 = [start_index, quarter_index]
section_2 = [quarter_index, middle_index]
section_3 = [middle_index, thi... |
13bb7a6ddcf310780bc3720087adac33398c1804 | Gabvaztor/TFBoost | /src/examples/PythonSintaxisExamples/Class.py | 731 | 3.875 | 4 | class Clase:
property_1 = 2
property_2 = ""
property_3 = None
def __init__(self,nombre = "Sin nombre", piernas = "Sin piernas", tipo = "Sin tipo"):
self.nombre = nombre
self.piernas = piernas
self.tipo = tipo
def nombrar(self,property = "Snooby"):
self.property_2 =... |
dc0b125c8db3e06ce9e6f64d5b4e0bbca6ee5f6c | lukelafountaine/euler | /common.py | 727 | 3.921875 | 4 | import itertools
import random
def incremental_sieve():
composites = {}
yield 2
for x in itertools.count(3, 2):
if x not in composites:
yield x
composites[x * x] = [x]
else:
for prime in composites[x]:
next = x + prime
... |
94846af53f588d81cf57e822044d204cb5fef2d1 | lukelafountaine/euler | /23.py | 1,887 | 4.25 | 4 | #! /usr/bin/env python
# A perfect number is a number for which the sum of its proper divisors is exactly equal to the number.
# For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28,
# which means that 28 is a perfect number.
#
# A number n is called deficient if the sum of its proper div... |
f3d520e3294cb123db91beab99d28c34c939b1d0 | lukelafountaine/euler | /1.py | 426 | 4.34375 | 4 | #! /usr/bin/env python
# If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9.
# The sum of these multiples is 23.
#
# Find the sum of all the multiples of 3 or 5 below 1000.
def sum_of_multiples(n, bound):
multiples = (bound - 1) / n
return n * ((multiples * (multip... |
ed723c17a0319dabd53648944ade82c1f4910711 | JaredEngelken/ShoppingSolutions-ElSA | /LED_Toggler.py | 812 | 3.65625 | 4 | from Tkinter import *
import tkFont
from gpiozero import LED
import RPi.GPIO
RPi.GPIO.setmode(RPi.GPIO.BCM)
led = LED(14)
win = Tk()
win.title("LED Toggler")
myFont = tkFont.Font(family = 'Helvetica', size = 12, weight = 'bold')
def ledToggle():
if led.is_lit:
led.off()
ledButton["text"] = "Turn... |
691e3195375eeb45b2a7cfbc093f529b5fbe16b9 | marcopla/python-object | /Revisao/modelo_rev.py | 947 | 3.71875 | 4 |
class Programa:
def __init__(self, nome, ano, duracao):
self.__nome = nome
self.ano = ano
self.__likes = 0
self.__duracao = duracao
@property
def nome(self):
return self.__nome
@property
def likes(self):
return self.__likes
@prope... |
c89a9101264d26b3e3aefab99eda6458ef0ee3b8 | Singhal861/Python-small-projects | /Faulty Calc_by_argparse.py | 1,884 | 3.78125 | 4 | import argparse
import sys
# print("enter your eq")
# N1 = int(input())
# op = input()
# N2 = int(input())
# def calc(args):
# if op=="add":
# if N1==56 and N2==9 or N1==9 and N2==56:
# print("=77")
# else:
# print("=",N1 + N2)
# elif op=="min":
# print("=",N1 -... |
f37c48eda323f850e914d8e725420b0b969f2c85 | kwonmin123/Mypython | /05Random.py | 341 | 3.75 | 4 | from random import *
print(random())#0~1미만의 수
print(random()*10)#0~10미만의 모든 수
print(int(random()*10)) #0~10미만의 정수값
print(int(random()*10)+1) #1~10이하의 정수값
print(int(random()*45)+1) #1~45이하의 정수값
print(randrange(1,46))#1~46미만의 정수값
print(randint(1,45))#1~45이하의 정수값 |
4ce1291f77e0131658ccf1fbcf14c88c2c328076 | SavvyShah/ipl2020 | /scripts/splitCSVById.py | 1,645 | 3.828125 | 4 | import os
import csv
def split(source_filepath, dest_folder, split_file_prefix):
"""
Split a source csv into multiple csvs of equal numbers of records,
except the last file.
Includes the initial header row in each split file.
Split files follow a zero-index sequential naming convention like so:
... |
868f25f8f9e5e45c3b362a6ac6600f4411501ad9 | rajs96/QDA-LDA-Classifier | /LDA_classifier.py | 2,496 | 3.9375 | 4 | # function to compute LDA classifier
# coded in Python
import numpy as np
# allows us to multiply more than one vector at once
from numpy.linalg import multi_dot
# allows us to compute inverse of matrix
from numpy.linalg import inv
def LDA_classifier(X,estimates,variance_estimate):
"""
A function to return LDA clas... |
e847163243fab51dede630b814f58e804aca5569 | cristiancmello/python-learning | /10-brief-tour-stdlib/10.5-str-pattern-match/script-1.py | 314 | 4.28125 | 4 | # String Pattern Matching
# Um módulo chamado 're' fornece ferramentas para processamento avançado de strings
# através de expressões regulares.
import re
print(re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest')) # ['foot', 'fell', 'fastest']
print('tea for too'.replace('too', 'two')) # tea for two |
3d2e3be0c33eea3c0dc994566209ac424e7dfb2c | cristiancmello/python-learning | /5-data-structures/5.6-looping-techniques/script-1.py | 572 | 3.828125 | 4 | # Looping Techniques
point = {'x': 100, 'y': 200}
for k, v in point.items():
print(k, v, sep='=')
# OUTPUT
# x=100
# y=200
# Responder com índice e valor ao mesmo tempo
for i, v in enumerate(['orange', 'apple', 'strawberry']):
print(i,v,sep='=>')
# OUTPUT
# 0=>orange
# 1=>apple
# 2=>strawberry
# Par... |
73cf62270898593c9931bb8d1cc1c477f326bea8 | cristiancmello/python-learning | /3-informal-intro-python/3.2-strings/script-1.py | 2,068 | 4.25 | 4 | # Strings
# Pode usar tanto '' quanto "" para expressar strings. Os caracteres de escape
# são POSIX (\n, \t, ...)
print('spam eggs')
print('\"Hello, Double Quotes\"')
print('Fist Line\n\tSecond Line.')
# String com caractere de formatação ignorado
print('Primeira linha\nova linha') # Observa-se que 'nova linha' fi... |
68f92dc3f7a4ac13d8408161b209dcd489e29f0a | cristiancmello/python-learning | /9-classes/9.4-random-remarks/script-1.py | 258 | 3.5625 | 4 | # Random Remarks
# Podemos definir uma função for do contexto sintático de uma classe
def f1(self, x, y):
return min(x, x+y)
class C:
f = f1
def g(self):
return 'Hello, World!'
h = g
c = C()
print(c.f(4, 1))
print(c.h()) |
9f1ceda961e34223e3f49243c7bb0718bcb00d18 | cristiancmello/python-learning | /5-data-structures/5.1-more-on-lists/script-1.py | 2,717 | 4.71875 | 5 | # Data Structures
# Funções de listas
# Append
# Colocar um elemento ao final de uma lista.
lista = [1, 2]
lista.append(3)
print(lista) # [1, 2, 3]
# Extend
# Colocar uma lista ao final de outra.
lista = [1, 2]
lista.extend([3, 4])
print(lista) # [1, 2, 3, 4]
# Insert
# Inserir um elemento em determinada posiç... |
e3f3b2e210c39bcbfab71de8ab5e725d2f763586 | cristiancmello/python-learning | /9-classes/9.9-iterators/script-1.py | 392 | 4.53125 | 5 | # Iterators
# Muitos objetos podem ser percorridos por loops 'for'.
for element in [1, 2, 3]:
print(element)
for element in (1, 2, 3):
print(element)
for key in {'one': 1, 'two': 2}:
print(key)
# Por trás da cortina, o Python chama o método 'iter()' do objeto.
obj = {'name': 'John Doe', 'email': 'j... |
65649bcfaf6a199c9aae09b9d5f7287f5e2c31cb | Foxh0und/LearnPythonTheHardWay | /Exercises/38/ex38.py | 625 | 3.84375 | 4 | lTenThings = "Apples Oranges Crows Telephone Light Sugar"
print( "Wait, there are not ten things in that list. Let's fix that." )
lSplit = lTenThings.split( ' ' )
lMoreStuff = ["Day", "Night", "Song", "Frisbee", "Corn", "Banana", "Girl", "Boy"]
while len( lSplit ) != 10:
lNextOne = lMoreStuff.pop()
print( "... |
256d040d3ff8cac47bf5125167a93910cdea3068 | Foxh0und/LearnPythonTheHardWay | /Exercises/5/ex5.py | 524 | 3.90625 | 4 | my_name = 'Adam Miritis'
my_age = 23
my_height = 179 #cm
my_weight = 72 #kg
my_eyes = 'Blue'
my_teeth = 'White'
my_hair = 'Brown'
print( f"Lets talk about {my_name}." )
print( f"He's {my_height} cm tall." )
print( f"He's {my_weight} kg heavy." )
print( "Actually, that's not too heavy." )
print( f"He's got {my_eyes} e... |
9586024909d617f4683c98835264008a79e504aa | Foxh0und/LearnPythonTheHardWay | /Exercises/4/ex4.py | 1,142 | 3.78125 | 4 | cars = 100
space_in_a_car = 4.0
drivers = 30
passengers = 90
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_capacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven
print( "There are", cars, "cars available." )
print( "There are only", drivers, "drivers available." ... |
23f65c465dc2c9923956f1e9738d6b5dd3cae50c | SparklingFire/codewars_catas-master | /06-to-weird-case.py | 204 | 3.984375 | 4 | # https://www.codewars.com/kata/weird-string-case/python
def to_weird_case(string):
return ' '.join(''.join(x[i].upper() if i % 2 is False else x[i] for i in range(len(x))) for x in string.split())
|
7ae89453da68f1709a3ca62d7789766b32187b70 | danmurphy1217/advent-of-code | /2020/day-two/main.py | 7,435 | 3.5625 | 4 | from typing import List, Any, Tuple, Dict
from datatypes.PasswordMeta import PasswordMeta
def create_modular_passwords_from(a_list_of_passwords: List[Any]) -> List[List[Any]]:
"""
:param a_list_of_passwords -> ``List[Any]``: a list of 'clean' passwords
:returns result -> ``List[List[Any]]``: a list of pass... |
a5ca6821cd98719d5adcb039cc97e461861f3180 | quyenxhuynh/ai-connect4 | /ai_algorithms.py | 16,676 | 3.578125 | 4 | class GameState:
def __init__(self, game, DANGERFACTOR = 0):
self.board = [row[:] for row in game.board] # make a deep copy of the game board
self.turn = 1
self.ROWS = game.ROWS
self.COLS = game.COLS
self.PLAYERS = 2
self.winner = None
self.TO_WIN = game.TO_... |
8d13851dc19f0a205c2674846f1f121fbe2dfba5 | prasad-madhale/gym-gamblers | /gym_gamblers/envs/gamblers_env.py | 3,636 | 3.53125 | 4 |
import gym
import random
from gym import spaces
def coin_flip(prob_of_head = 0.4):
'''
Args:
prob_of_head - probability of getting a Head on coin flip
Returns:
0 for Heads or 1 for Tails
'''
return 0 if random.random() < prob_of_head else 1
'''
Represents a Gambler's problem Gym ... |
12a276e0a807127f31cc1c0bd8a4b294dffd192a | Ozcry/Aleatorio | /Entendendo Algoritmos - Aditya Y Bhargava/Cap 1 - Introdução a algoritmos/cap_1.py | 443 | 3.953125 | 4 | def pesquisa_binaria(lista, item):
baixo = 1
alto = len(lista) - 1
while baixo <= alto:
meio = (baixo + alto) // 2
chute = lista[meio]
if chute == item:
return meio
elif chute > item:
alto = meio - 1
else:
baixo = meio + 1
retur... |
2bcd8d07218ac6b032e707585d738d0bb338cd33 | cna274/Python_Codes | /Codes/split_join.py | 171 | 3.8125 | 4 | string, substring = (raw_input(), raw_input())
print string, substring
print sum([1 for i in range(len(string)-len(substring)+1) if string[i:i+len(substring)]==substring]) |
575a20318b88020f439350271779359ee0a69278 | Cai-Pei-Xuan/Boundary_Extraction | /boundary_extraction.py | 2,272 | 3.578125 | 4 | from PIL import Image, ImageDraw
# 取得座標(x, y)附近的像素值
def getpixel(image, x, y):
pixel_list = []
# 取得3*3的像素值
for i in range(-1, 2):
for j in range(-1, 2):
pixel = image.getpixel((x + j ,y + i))
pixel_list.append(pixel)
return(pixel_list)
# 將黑白圖片做Erosion
def Erosion(... |
558e8817a329fb66c1eefc20161b20722f34fe7e | kandulsh/HadoopProject | /Twitter_Question-5/reducer.py | 970 | 3.609375 | 4 | #!/usr/bin/env python
import sys
import string
import operator
from collections import defaultdict
d = defaultdict(list)
num_of_tweets={}
for line in sys.stdin:
(key,val) = line.strip().split('\t')
d[key].append(int(val))
#for finding what twitter user tweeted the most
for key in d.keys():
num_of_tweets[key]=l... |
b64920369fd3bb59aab089aab355f473345e64d3 | peachgo-/learn-python-Stanford-lab | /labs/lab0/modify_file/file_modifier.py | 316 | 3.75 | 4 | #!/usr/bin/env python3 -tt
# f = open("test.txt", "r+")
# using "with" to ensure the file will be entered and exited
# no need to call f.close()
with open('test.txt', "r+") as f:
for line in f.readlines():
line = line.strip()
print(line)
f.write("New member\n") # BAD, file has been closed.
|
cc1fcaeca3cd3a86a0af130022d6204a1f3e7acb | rajeshberwal/revisiting-dsa | /python/searching/linear-searching.py | 559 | 3.984375 | 4 | """
Author: Rajesh Berwal
Date: 20-04-2020
Website: https://rajeshberwal.com/
"""
def linear_search(arr, elem):
"""
@params:
arr -> array : array,
elem: element to be searched: any
"""
for i in range(len(arr)):
if arr[i] == elem:
return i
# if it doesn... |
24d312a0af05292f4a8d4769600ed8c4fc34fd46 | lsiepman/AdventOfCode2016 | /Day24.py | 3,347 | 3.640625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 16 20:30:12 2020.
@author: laura
"""
# IMPORTS
import numpy as np
from collections import deque
from itertools import permutations
# DATA
data = []
with(open("Data - Day24.txt")) as f:
for line in f:
data.append(line.strip())
# GOAL 1
"""You extract the d... |
96c879cc0dd0d96909eaeeea09b4c23ba4a995fe | lsiepman/AdventOfCode2016 | /Day14.py | 2,942 | 3.875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 28 16:46:19 2020.
@author: laura
"""
# IMPORTS
import re
from hashlib import md5
# DATA
data = "zpqevtbw"
# data = "abc"
# GOAL 1
"""To generate keys, you first get a stream of random data by taking the MD5
of a pre-arranged salt (your puzzle input) and an increasing in... |
4a2efa1abefc86adecbb508a360234a1b966d202 | yangninghua/code_library | /book-code/图解LeetCode初级算法-源码/6/reverseList.py | 992 | 3.765625 | 4 | #!/usr/bin/env python3
#-*- coding:utf-8 -*-
# File: /Users/king/Python初级算法/code/6/reverseList.py
# Project: /Users/king/Python初级算法/code/6
# Created Date: 2019/03/03
# Author: hstking hst_king@hotmail.com
from createNode import *
def reverseList(head: ListNode) -> ListNode:
# valList = []
# pointer = hea... |
f623dfb338c797686faeb8b8d74c80799e882fa9 | yangninghua/code_library | /book-code/图解LeetCode初级算法-源码/2/maxHeap.py | 4,033 | 3.90625 | 4 | class MaxHeap:
""" 最大堆 """
def __init__(self):
self.max_heap_list = []
def create_max_heap(self, new_list: list):
""" 创建新的最大堆 """
self.max_heap_list = new_list
# 从第一个非子节点开始调整最大堆
for i in range((len(self.max_heap_list) - 1) // 2, -1, -1):
self.adjust_sub... |
ebf98a3d1b43481a3abf6fe89aeed1a86dac5d42 | yangninghua/code_library | /book-code/图解LeetCode初级算法-源码/5/isAnagram.py | 856 | 3.75 | 4 | #!/usr/bin/env python3
#-*- coding:utf-8 -*-
# File: /Users/king/Python初级算法/code/5/isAnagram.py
# Project: /Users/king/Python初级算法/code/5
# Created Date: 2019/02/10
# Author: hstking hst_king@hotmail.com
def isAnagram(s, t):
# 排序比较
# if len(s) != len(t):
# return False
# sList = list(s)
#... |
665991f02a59046034b828fea02a43122abb71af | yangninghua/code_library | /book-code/图解LeetCode初级算法-源码/5/firstUniqChar.py | 918 | 3.796875 | 4 | #!/usr/bin/env python3
#-*- coding:utf-8 -*-
# File: /Users/king/Python初级算法/code/5/firstUniqChar.py
# Project: /Users/king/Python初级算法/code/5
# Created Date: 2019/02/10
# Author: hstking hst_king@hotmail.com
def firstUniqChar(s):
if len(s) == 1:
return 0
for i in range(len(s)):
if s[i] no... |
6024a1cb6d8cca8a50bbf8c52123f590aa1c253d | yangninghua/code_library | /book-code/图解LeetCode初级算法-源码/2/mergeSort.py | 967 | 3.875 | 4 | #!/usr/bin/env python3
#-*- coding:utf-8 -*-
# File: /Users/king/Python初级算法/code/2/mergeSort.py
# Project: /Users/king/Python初级算法/code/2
# Created Date: 2018/10/26
# Author: hstking hst_king@hotmail.com
from randomList import randomList
import timeit
iList = randomList(20)
def mergeSort(iList):
if len(iList... |
fce34641d7a5020aa8fedd907e112dff85d97137 | yangninghua/code_library | /book-code/图解LeetCode初级算法-源码/2/countingSort.py | 944 | 3.6875 | 4 | #!/usr/bin/env python3
#-*- coding:utf-8 -*-
# File: /Users/king/Python初级算法/code/2/countingSort.py
# Project: /Users/king/Python初级算法/code/2
# Created Date: 2018/10/26
# Author: hstking hst_king@hotmail.com
from randomList import randomList
import timeit
iList = randomList(20)
def countingSort(iList):
if len... |
e0d9b4ea2c9cd5128237e4c28a9eec2d275bcf42 | yangninghua/code_library | /book-code/图解LeetCode初级算法-源码/5/reverseInteger.py | 1,316 | 4.15625 | 4 | #!/usr/bin/env python3
#-*- coding:utf-8 -*-
# File: /Users/king/Python初级算法/code/5/reverse.py
# Project: /Users/king/Python初级算法/code/5
# Created Date: 2019/02/10
# Author: hstking hst_king@hotmail.com
def reverse(x):
# tList = list(str(x))
# if tList[0] == '-':
# rNum = int(''.join(tList[1:][::-1... |
f8fc3f837b02794ecc275273108520df107ee32f | yangninghua/code_library | /book-code/图解LeetCode初级算法-源码/10/fizzBuzz.py | 620 | 4.03125 | 4 | #!/usr/bin/env python3
#-*- coding:utf-8 -*-
# File: /Users/king/Python初级算法/code/10/fizzBuzz.py
# Project: /Users/king/Python初级算法/code/10
# Created Date: 2019/03/11
# Author: hstking hst_king@hotmail.com
def fizzBuzz(n):
rList = []
for i in range(1, n+1):
if i%3 == 0 and i%5 == 0:
rL... |
cf7d1a4c6c58c9f500e5443d5713dde67c84deff | CyberDuck79/Python_Maching_Learning | /cost.py | 1,565 | 3.953125 | 4 | from random import randrange
# 2D vector multiplication function
# x : input vector
# y : output vector
def f(x, w):
#y = (x[0] * w[0], x[1] * w[1])
# or power function ?
# y = (x[0] ** w[0], x[1] ** w[1])
y = w[0] + (w[1] * x)
return y
# cost computing function
# x : input vector
# y : desired... |
898b4c27c3c9c1578ea056f97de644894548c48b | dandelion2413/Illumio_coding_challenge | /Illumio.py | 3,643 | 3.6875 | 4 | from collections import defaultdict
import csv
import socket
import struct
class Firewall(object):
"""
Firewall that takes in rules and access packets that follow the rules.
"""
def __init__(self, fw_path):
"""
Constructor for the Firewall class. Create data member rules that
s... |
4315e3e8c1185f64dc1dd7ad6fcf63e723fc6e0c | marii-20/GeekBrains-Homework | /lesson-1-1.py | 896 | 4.21875 | 4 | #Поработайте с переменными, создайте несколько,
# выведите на экран, запросите у пользователя несколько
# чисел и строк и сохраните в переменные, выведите на экран
greeting = ('Привет! Меня зовут Мария. \n')
age = 28
info = (f'Мне {age} лет и я учусь на python-разработчика. \n')
question = ('Теперь ваша очередь расска... |
e5aa088990397c6635f2697b16f4e72771d25f74 | AggieF/geo-puzzles | /geo_euler_4.py | 912 | 3.765625 | 4 | # https://www.geocaching.com/geocache/GC5CH5V_project-euler-4
def ispalindrome(m):
"Determines if a number is a palindrome"
if str(m) == str(m)[::-1] : # checks if reverse string equals the string
return True
else:
return False
def f(i,n):
"Finds the first i digits of the largest palin... |
d5a7d2d619a6b0a39c82809b8345d4ca3518ff70 | sravanthi91/driveready | /multiplication table.py | 110 | 3.578125 | 4 | """program for splitting input"""
n=int(input())
while(n!=0):
r=n%10
n=n//10
print(r,n)
|
a43e84d790a757277cebd8cafad2dcd0e82c4fd4 | guojian0615/python-spider | /base-study/module-threading/lock-demo.py | 509 | 3.59375 | 4 | """
多线程下共享数据问题
"""
import threading
VALUE = 0
# 定义一个全局锁
gLock = threading.Lock()
class Compute(threading.Thread):
def run(self):
global VALUE
for x in range(1000000):
# 上锁
gLock.acquire()
VALUE += 1
# 释放锁
gLock.release()
print(f'... |
05596c6573fd6ea52247450db24179dc5dd15a36 | guojian0615/python-spider | /spider-demo/spider-weather/main.py | 2,532 | 3.546875 | 4 | """
使用Beautiful-soup 和requests来爬取【中国天气网】的信息
获取今天全国天气温度最低的前十名城市
使用pyecharts 可视化显示图表信息
"""
import requests
from bs4 import BeautifulSoup
from pyecharts import Bar
HEADERS = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3141.7 Safari/537.36'
}
# 保存所有的城市信息
ALL... |
4d8dc21c7bd8d2991ad5bd7249aa26e522c49f60 | creemj/macro | /dev/productionmarket_copy.py | 6,230 | 3.515625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 12 20:34:50 2016
@author: jcreem
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
##Variables
#r=real interest rate. Rate at which consumers and the government can borrowers and lend.
#Output is produce using production fun... |
ceaeaef56804d1648cb859a6ed40ffd92da16e51 | jfulghum/practice_thy_algos | /recursion/permuteBacktracking_recursion_iterative.py | 1,887 | 3.890625 | 4 |
# Given an array of N integers, generate all permutations of the given array.
# Function Signature:
# get_permutations(l: List[int]) -> List[List[int]]
# Target runtime and space complexity:
# O(N!) time, O(N) space; N = length of input
# 1 2 3
# 2 1 3
# 2 3 1
# 3 2 1
# 3 1 2
# 1 3 2
# 1 2 3
# steps
# 1- swap every ... |
5f541b37b76441a076ead0fb393d02c7a9c12759 | jfulghum/practice_thy_algos | /sorting/pancakeSort.py | 991 | 3.984375 | 4 | def pancake_sort(arr):
current_size = len(arr)
while current_size > 1:
biggest = biggestIndex(arr[:current_size])
flip(arr, biggest)
flip(arr, current_size - 1)
current_size -= 1
return arr
[1,2,3,4,56,7] # 4
[56,1,2,3,4,7] #flip first 6
[7,4,3,2,1,56] # find biggest of five 5.
[1,2,3,4,7,56] #fl... |
c64f86821a9cf6e4e1658c9c067e597885599efd | jfulghum/practice_thy_algos | /binary_trees/bfs_find_levels.py | 2,458 | 4 | 4 | '''
Given a binary tree (NOT a BST), find a target element using Breadth First Search.
'''
class TreeNode:
def __init__(self, value=None, left=None, right=None):
self.value = value
self.left = left
self.right = right
def printNode(node):
print(node.value)
if node.left:
pri... |
242a36cf0d05922c6e7eb42a9fec3804c2e6fca7 | jfulghum/practice_thy_algos | /queues/find_shortest_path.py | 1,335 | 4.09375 | 4 | from collections import queue
visited = set()
flights = {"Seattle": "Boston", "Austin",
"Austin": "New York"}
start = "Seattle"
end = "New York"
output = 2
def find_shortest_path(flights, start, end):
visited = set()
queue = deque()
output: Dict[str, int] = {}
distance = 0
queue.append((star... |
a98246b38d367b3d38563f7d7fdc47ecc69c357e | jfulghum/practice_thy_algos | /binary_trees/height_balanced_tree.py | 365 | 3.546875 | 4 | def solution(array):
return sortedArrayToBSTHelper(array, 0, len(array) - 1)
def sortedArrayToBSTHelper(nums, start, end):
if end < start:
return None
mid = (start + end) // 2
root = Tree(nums[mid])
root.left = sortedArrayToBSTHelper(nums, start, mid - 1)
root.right = sortedArrayToB... |
87351efb827796bdde84fa15df577ad52b615ff5 | jfulghum/practice_thy_algos | /LinkedList/LLStack.py | 1,496 | 4.1875 | 4 | # Prompt
# Implement a basic stack class using an linked list as the underlying storage. Stacks have two critical methods, push() and pop() to add and remove an item from the stack, respectively. You'll also need a constructor for your class, and for convenience, add a size() method that returns the current size of the... |
f165df8ffa1c5ac0c57d74adeafc9254357b3f81 | jfulghum/practice_thy_algos | /dutch_national_flag.py | 988 | 3.96875 | 4 | def sortColors(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
low = 0
high = len(nums) - 1
mid = 0 # mid must be the same as low
while mid <= high:
if nums[mid] == 0:
nums[low], nums[mid] = nums[mid], nums... |
53a882ee915fec996bf4eb203d3cdecf0927ee0e | jfulghum/practice_thy_algos | /binary_trees/find_all_binary_tree_paths.py | 675 | 3.78125 | 4 | #https://leetcode.com/problems/binary-tree-paths/solution/
# Binary trees are already defined with this interface:
# class Tree(object):
# def __init__(self, x):
# self.value = x
# self.left = None
# self.right = None
def solution(t):
if t is None:
return []
paths = []
stack = [(t... |
9ddd7f942dbc582183e5e5cc9d03d29d634edea1 | jfulghum/practice_thy_algos | /LinkedList/insert_LL.py | 956 | 3.921875 | 4 | #insert in order
def solution(list, target):
if list is None:
return ListNode(target)
curr = list
if curr.value > target:
head = ListNode(target)
head.next = curr
return head
while curr.next:
prev = curr
curr = curr.next
if curr and cu... |
8a05003067ce4a70a62d4dda3342630029c06b99 | jfulghum/practice_thy_algos | /stacks.py | 464 | 3.5625 | 4 | def nextGreaterElement(nums1, nums2):
ans = []
for x in nums1:
j = nums2.index(x)
found = False
while j < len(nums2) - 1:
if x < nums2[j+1]:
ans.append(nums2[j+1])
found = True
break
j += 1
if fou... |
13844475673a251ab27cff1da9eb96c1bafc0b92 | jfulghum/practice_thy_algos | /backtracking/longestPalindromicSubstring.py | 419 | 3.578125 | 4 | def longestPalindromicSubstring(string):
if not string or len(string) == 1:
return string
max_palindrome = ''
for i in range(len(string)):
for j in range(i + 1, len(string)):
s = string[i:j+1]
rev_s = s[::-1]
if s == rev_s:
... |
6c390807a8bb8d7f0cc4b347243bdc50172786b7 | jfulghum/practice_thy_algos | /binary_trees/averageOfLevelsQueues.py | 1,835 | 3.734375 | 4 |
class TreeNode:
def __init__(self, value = 0, left = None, right = None):
self.value = value
self.left = left
self.right = right
def arrayifyTree(root):
if root is None:
return []
queue = []
array = []
queue.append(root)
while (len(queue) != 0):
node = q... |
8c6169bd812a5f34693b12ce2c886969542f1ab8 | jfulghum/practice_thy_algos | /LinkedList/count_linked_list_recursive.py | 363 | 3.71875 | 4 | class ListNode:
def __init__(self, value = 0, next = None):
self.value = value
self.next = next
def count(node: ListNode) -> int:
if node is None:
return 0
else:
return count(node.next) + 1
# Test Cases
LL1 = ListNode(1, ListNode(4, ListNode(5)))
print(count(None)) # 0
print(co... |
4a8cbd05cdf2eba487e303c23e5d0419005c6386 | jfulghum/practice_thy_algos | /recursion/hanoi.py | 1,129 | 3.859375 | 4 | # https://www.dailycodingproblem.com/solution/128?token=30b19c5a8841788c9d5cc0dc9019e2a17dd0aa072619ab12dcb416109967e338b8a385bc
def tower_of_hanoi(n, a="1", b="2", c="3"):
if n >= 1:
tower_of_hanoi(n - 1, a, c, b)
print("Move {} to {}".format(a, c))
tower_of_hanoi(n - 1, b, a, c)
... |
b92b7229bc06e87c659598592a802fb726262859 | jfulghum/practice_thy_algos | /graph/NTreetoLL.py | 1,704 | 3.8125 | 4 | """
Given a N-ary tree
return a collection of linked lists, where eacr list contains the elements of one level in the tree
1
/ | \
2 3 4
| |
5 6
=> [
1 -> None,
2 -> 3 -> 4 -> None,
5 -> 6 -> None
]
"""
class Node:
value: int
children: List['Node']
'''
sudo co... |
01164085bfbba943ab33418bb84197d2101ee48a | jfulghum/practice_thy_algos | /powerset.py | 277 | 3.921875 | 4 | array = [1,2,3]
# [[], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3]]
def powerSet(array):
subset = [[]]
for el in array:
for i in range(len(subset)):
currentSubset = subset[i]
subset.append(currentSubset + [el])
return subset
print(powerSet(array))
|
d15b9588a830aed0caf2471f70ba3d0b8e9d1d9b | jfulghum/practice_thy_algos | /get_cheapest_cost.py | 613 | 3.84375 | 4 | def get_cheapest_cost(rootNode):
if len(rootNode.children) == 0: return rootNode.cost
total = float('inf')
for childNode in rootNode.children:
temp = get_cheapest_cost(childNode)
if temp < total: #Because of this, it's always finding cheapest cost for all the children
total = temp
return rootNod... |
f12616c1d93bfbd7c34130607a18eed8f0fa7472 | jfulghum/practice_thy_algos | /binary_trees/largestValues.py | 812 | 3.921875 | 4 |
# https://leetcode.com/problems/find-largest-value-in-each-tree-row/
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def largestValues(self, root):
self.res = {}
self.dfs(root, 0)
... |
d9735a5f873d484a162d7a967532ee7896bb4cd6 | jfulghum/practice_thy_algos | /arrays/kreps_time_complexity.py | 2,184 | 3.671875 | 4 | '''
The original solution, using a dictionary to keep track of the number of repetitions. Early return when you find an element that hits k.
The original solution, but do not return early. Build up the full dictionary of counts. Iterate through the array again and return the first one whose count is greater than or e... |
850b3e4b5bf7d0f73a8099ace9cbb38d325d4d12 | jfulghum/practice_thy_algos | /LinkedList/removeKthNodeFromEnd.py | 503 | 3.828125 | 4 | class LinkedList:
def __init__(self, value):
self.value = value
self.next = None
def removeKthNodeFromEnd(head, k):
first = head
second = head
counter = 1
while counter <= k:
second = second.next
counter +=1
if second is None:
#remove head
head.value = head.next.value
head.next ... |
a5ee8f69690dd09757f78f7af5be3a82162f43b8 | jfulghum/practice_thy_algos | /smallest_difference.py | 431 | 3.78125 | 4 | def smallestDifference(x,y):
x.sort()
y.sort()
i1 = 0
i2 = 0
current = float("inf")
smallest = float("inf")
while i1 < len(x) and i2 < len(y):
num1 = x[i1]
num2 = y[i2]
if num1 == num2:
return [num1, num2]
elif num1 < num2:
i1 += 1
current = num2 - num1
else:
i2 +=1
current = num1 - ... |
be1d46e5b24abc08a5ea94810dc69cc3297bbc29 | jfulghum/practice_thy_algos | /LinkedList/queue_with_linked _list.py | 1,352 | 4.5625 | 5 | # Your class will need a head and tail pointer, as well as a field to track the current size.
# Enqueue adds a new value at one side.
# Dequeue removes and returns the value at the opposite side.
# A doubly linked list is one of the simplest ways to implement a queue. You'll need both a head and tail pointer to keep t... |
48806b1097ede6c7023743fa3a1cd5c04e4adef3 | jfulghum/practice_thy_algos | /binary_trees/order_level_traversal.py | 416 | 3.734375 | 4 | # level order traversal
def solution(root):
levels = []
if not root:
return levels
def helper(node, level):
if len(levels) == level:
levels.append([])
levels[level].append(node.value)
if node.left:
helper(node.left, level + 1)
if node.... |
97868e30337799e44bb0b6e4c454e66ee31672e8 | jfulghum/practice_thy_algos | /recursion/removeInvalidParenthesesproblem.py | 1,614 | 3.546875 | 4 | # https://replit.com/@jfulghum/StarryOrchidShoutcast#main.py
# https://leetcode.com/problems/remove-invalid-parentheses/
# Given a string s that contains parentheses and letters,
# remove the minimum number of invalid parentheses
# to make the input string valid.
# Return all the possible results. You may return th... |
d2715c2b0101d26065e0892d0889752e8c7ea58b | AdriGross/AprendiendoPython | /biblioteca.py | 3,119 | 3.875 | 4 | # ***** SISTEMA DE BIBLIOTECA *****
# *---- CLASE AUTOR ----*
class Autor:
def __init__(self, nombre, apellidos):
self.Nombre = nombre
self.Apellidos = apellidos
def MostrarAutor(self):
print("Autor: ", self.Nombre, "", self.Apellidos)
# *---- CLASE LIBRO ----*
class Lib... |
220865c33abc017e826af7dcdc3e2e9a19dcbe07 | p-szymo/nyc_trees | /functions.py | 11,040 | 3.640625 | 4 | # standard libraries
import pandas as pd
import numpy as np
# iterate over dataframes
import itertools
# visualization library
import matplotlib.pyplot as plt
# distance calculations
from sklearn.neighbors import BallTree
# Random Forest model
from sklearn.ensemble import RandomForestClassifier
# dummy yes/no col... |
5220c956d0b166441bd0ef1c2d3de2720f382a15 | rikukawamura/atcoder | /AtcoderProblems/ABC/ABC189/D.py | 1,759 | 3.796875 | 4 | from math import factorial
import pdb
# ----------------------------------------------------------------------------------------------------------
def int_sp():
return map(int, input().split())
def li_int_sp():
return list(map(int, input().split()))
def comb(n, k):
return factorial(n) // (factorial(k... |
8f09f163ae762c65f3c03f67b8944327c484f042 | rikukawamura/atcoder | /AtcoderProblems/ABC/ABC203/C.py | 2,188 | 3.796875 | 4 | from math import factorial
import pdb
# ----------------------------------------------------------------------------------------------------------
def int_sp():
return map(int, input().split())
def li_int_sp():
return list(map(int, input().split()))
def comb(n, k):
return factorial(n) // (factorial(k... |
2d0219422aaa47919d072558472bda761fd1f044 | rikukawamura/atcoder | /AtcoderProblems/ABC/ABC158/B.py | 220 | 3.59375 | 4 | import pdb
# 配列が大きくなりすぎると,REとなるから注意
n, a, b = map(int, input().split())
c = n // (a+b)
bleus = a * c
amari = n % (a+b)
if amari > a:
amari = a
bleus += amari
print(bleus) |
bf53b43aa3a3d5c62976fa147a08b7d2979e39f6 | rikukawamura/atcoder | /AtcoderProblems/ABC/ABC195/C.py | 182 | 3.734375 | 4 | import pdb
N = int(input())
x = (len(str(N))-1) // 3
count = 0
while x != 0:
#pdb.set_trace()
count += (N - 10**(3*x) + 1) * x
N = 10**(3*x) - 1
x -= 1
print(count) |
610ee0630f8200eb3b04e2c49a54aed981bf909a | sudarshan1754/Algos_IC_1_Python | /coursera/programming-challenge-1/count_inversions.py | 3,629 | 3.796875 | 4 | #Simple brute force method, runs in O(n^2), to get a feel for the problem.
def brute_force():
inversions = 0
for i in xrange(len(numbers)):
print str(i)+" --- "+str(numbers[i])
for j in xrange(i):
if(numbers[i] < numbers[j]):
inversions+=1
print "There are "+str(... |
ee97a248de32fd10b2b906f091508038b7aded25 | ashish15270/HackerRank_Prob_Solve_in_PYTHON | /Apple & Oranges/Apple n Oranges.py | 339 | 3.640625 | 4 | def countApplesAndOranges(s, t, a, b, apples, oranges):
count=0
count2=0
for i in range(len(apples)):
if apples[i]+a >=s and apples[i]+a<=t:
count+=1
print(count)
for i in range(len(oranges)):
if oranges[i]+b >=s and oranges[i]+b<=t:
count2+=1
... |
d9a431ae99d5a3900b00eb4523dacda3813c2e25 | ashish15270/HackerRank_Prob_Solve_in_PYTHON | /Min-Max Sum/Min_max.py | 230 | 3.640625 | 4 | def miniMaxSum(arr):
maxi=0
mini=0
ma=sorted(arr,key=None,reverse=False)
mi=sorted(arr,key=None,reverse=True)
for i in range(len(arr)-1):
maxi += ma[i]
mini += mi[i]
print(maxi,mini) |
6feb35542cb47e6802619830297c54a076783a69 | educatedadi/Classic-Snake-Game | /food.py | 465 | 3.609375 | 4 | from turtle import Turtle
import random
class Food(Turtle):
def __init__(self):
super().__init__()
self.penup()
self.shape('circle')
self.color('green')
self.speed(0)
self.shapesize(stretch_wid=0.5, stretch_len=0.5)
self.new_food()
def new... |
b6468a452afca558387f38bb5104285fb5d9d85a | TcMysunshine/AdvanceAlgorithms | /PythonAA/Second/sortAlgorithm.py | 2,984 | 3.75 | 4 | import math,random
def insertSort(arr):
if len(arr) == 1:
return arr
length = len(arr)
for i in range(1, length):
j = i
while j > 0:
if arr[j] < arr[j-1]:
arr[j], arr[j-1] = arr[j-1], arr[j]
j -= 1
return arr
def bubbleSort(arr):
if le... |
919d63e7d93869151bc1ca9d7012f740b33dad5a | Arup276/365Days_Challenge | /#Day__23/DDA_Algorithm.py | 576 | 3.8125 | 4 | import matplotlib.pyplot as plt
#%matplotlib inline
x1 = float(input("Enter X1: "))
x2 = float(input("Enter X2: "))
y1 = float(input("Enter Y1: "))
y2 = float(input("Enter Y2: "))
dx = abs(x2-x1)
dy = abs(y2-y1)
if dx >= dy:
length = dx
else:
length = dy
dx = (x2-x1)/length
dy = (y2-y1)/len... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.