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 |
|---|---|---|---|---|---|---|
ee914fbf0d7d5d7cbaa0ca8b431e20a279afc27b | dionyziz/kseri | /tests/test_card.py | 1,050 | 3.90625 | 4 | import unittest
from card import Card, Suit, ACE, JACK, QUEEN, KING
class TestCard(unittest.TestCase):
def test_str(self):
ace_of_spades = Card(ACE, Suit.Spades)
self.assertEqual(str(ace_of_spades), 'Ace of Spades')
jack_of_hearts = Card(JACK, Suit.Hearts)
self.assertEqual(str(jac... |
49d620c03a52cf880e33e99cfdb13d7dca77e4f4 | alezi06/python-project-lvl1 | /brain_games/games/calc.py | 425 | 3.859375 | 4 | import operator
import random
MESSAGE = 'What is the result of the expression?'
OPERATIONS = (
('+', operator.add),
('-', operator.sub),
('*', operator.mul),
)
def round():
first = random.randint(1, 100)
second = random.randint(1, 100)
symbol, function = random.choice(OPERATIONS)
questio... |
e87fd714a690df8c8ad8c05b5f9ae953da0391f1 | WLFJ/FaceRec | /FaceRec/test_thread.py | 770 | 3.671875 | 4 | import threading
class MyThread(threading.Thread):
def __init__(self, func, args = ()):
super(MyThread, self).__init__()
self.func = func
self.args = args
def run(self):
self.result = self.func(*self.args)
def get_result(self):
try:
return self.resu... |
21503f16e1dafd5b5779192247ed3e1e68c4d817 | parthvalani/Machine-Learning | /EEG/classification_KNN.py | 738 | 3.578125 | 4 | import load_data
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import accuracy_score
np.random.seed(100)
# return DataSet class
data = load_data.read_data_sets(one_hot=True)
# get train data and labels by batch size
train_x, train_label = data.train.next_batch(... |
162e8500180cee58796a734325faf52e13ff0981 | Pratyush-PS/tathastu_week_of_code | /day5/program3.py | 600 | 3.9375 | 4 | def stolen_values(house_list):
if(len(house_list)==2):
return(max(house_list))
elif (len(house_list)==1):
return house_list[0]
elif len(house_list)==3:
return max(house_list[1], house_list[0]+house_list[2]))
return max(house_list[0]+stolen_values(house_list[2:]), house_list... |
67a12d428a7d40d6a023ddc3f9b0345f4a607c28 | Pratyush-PS/tathastu_week_of_code | /day6/program8.py | 869 | 4.09375 | 4 | def print_spiral(arr,m,n) :
k = 0; l = 0
while (k < m and l < n) :
for i in range(l, n) :
print(arr[k][i], end = " ")
k += 1
for i in range(k, m) :
print(arr[i][n - 1], end = " ")
n -= 1
if ( k < m) :
for i in range(n - 1, (l - 1), -1) :
print(arr[m - 1][i], end = " ")
m -= 1
... |
07f57f122c2f0f6f3f558d78a27ff656bab8ac24 | Pratyush-PS/tathastu_week_of_code | /day6/program11.py | 275 | 4.28125 | 4 | size= int(input("\nEnter your list size:"))
li=[]
for i in range(size):
li.append(int(input("Enter element {}:".format(i+1))))
print("\nGiven list is:",li)
max_product=1
for i in sorted(li)[-3:]:
max_product *=i
print("\nMaximum possible product is:",max_product)
|
2264588746f2bd0c05e6185c5b5121cad832293e | Pratyush-PS/tathastu_week_of_code | /day5/program4.py | 937 | 4.09375 | 4 | def knapsack(knap_weight, item_list):
if knap_weight==0 or len(item_list)==0:
return 0
if(len(item_list)==1):
if(item_list[0][0]>knap_weight):
return 0
return item_list[0][1]
if item_list[0][0]>knap_weight:
return knapsack(knap_weight,item_list[1:])
return max... |
3f60992de4bed3d5e214d80223f222de504ea2e3 | SouthCoded/Cyber-Security | /34c3/dotr.py | 2,026 | 3.734375 | 4 | import random
import itertools
# I implemented some crypto and encrypted my secret: 03_duCbr5e_i_rY_or cou14:L4G f313_Th_etrph00 Wh03UBl_oo?n07!_e
# Can you get it back?
def encrypt(msg, key):
keylen = len(key) #8
k = [x[1] for x in sorted(zip(key[:keylen], range(keylen)))] # second largest value in k... |
c37857b1b305cfe47c456a0549c11239042201da | jan-podolanko/pp1 | /04-Subroutines/zadanie 29.py | 874 | 3.578125 | 4 | #zadanie 29
import statistics
lista = [2, 3, 5, 2, 9, 8, 1, 3, 9, 1, 1, 4, 7, 7, 1, 4]
#gorsza wersja, ale szkoda usunac
def med_i_dom():
lista = [2, 3, 5, 2, 9, 8, 1, 3, 9, 1, 1, 4, 7, 7, 1, 4]
lista.sort()
dlug = len(lista)
if dlug % 2 != 0:
l_mediana = int(dlug/2)
mediana = (lista[l... |
c574c00fabbcc10f51bf6b0e72d3da5bcbdcf662 | jan-podolanko/pp1 | /02-ControlStructures/zadanie 6 i 7.py | 99 | 3.703125 | 4 | for x in range (0,5):
print('Jan')
i = 0
while i <= 4:
i += 1
print('Jan')
|
332927ac29c206383cb4b596bd9cdd949a2eabff | jan-podolanko/pp1 | /03-FileHandling/zadanie 17.py | 117 | 3.671875 | 4 | import re
tekst = 'To be, or not to be, that is the question'
ilosc = re.findall('a|e|i|o|u',tekst)
print(len(ilosc)) |
052968c2066766d53d9ae0a32f56e6c0e11a6c21 | jan-podolanko/pp1 | /06-ClassesAndObjects/zadanie 16.py | 1,413 | 3.578125 | 4 | class ebook():
def __init__(self):
self.filename = r'C:\Users\Monster\Desktop\pp1\06-ClassesAndObjects\book.txt'
self.book_list = []
with open(self.filename, 'r') as book:
for line in book:
self.book_list.append(line)
self.title = self.book_list[0]
... |
45ba8a1ecd6733fba25bb9c2dc6b2589dc14fa50 | jan-podolanko/pp1 | /09-DefensiveProgramming/zadanie 14.py | 510 | 3.90625 | 4 | def pole_prostokata(a,b):
if type(a) != float:
if type(a) != int:
raise TypeError('a isnt an int or a float')
if type(b) != float:
if type(b) != int:
raise TypeError('b isnt an int or a float')
if a <= 0:
raise ValueError('a smaller than 0')
if b <= 0:
... |
044e78a364b632ee3ff0912d702c5129199aaf0c | jan-podolanko/pp1 | /02-ControlStructures/zadanie 45.py | 424 | 3.796875 | 4 | n = (int(input('Podaj ilość liczb pierwszych: ')))
primes = []
count = 0
possiblePrime = 1
while possiblePrime > 0:
possiblePrime += 1
isPrime = True
for num in range(2, possiblePrime):
if possiblePrime % num == 0:
isPrime = False
if isPrime:
primes.append(... |
26cebec658c38c8efe538529ddfa60f51058f9e9 | jan-podolanko/pp1 | /04-Subroutines/zadanie 32.py | 427 | 3.609375 | 4 | X = [[1, 2, 0],
[0, 0, 3],
[5, 1, 1]]
result = [[0,0,0],
[0,0,0],
[0,0,0]]
def transpozycja(X):
# iterate through rows
for i in range(len(X)):
# iterate through columns
for j in range(len(X[0])):
result[j][i] = X[i][j]
for r in result:
print(r)
... |
86af637b8221e30f70b7c53e4cfaee455e4394d5 | jan-podolanko/pp1 | /02-ControlStructures/zadanie 48.py | 768 | 3.671875 | 4 | x = 1
for i in range(1,50):
print(f'{x}', end=' ')
x += 7
if x > 43:
break
print()
x = 2
for i in range(1,50):
print(f'{x}', end=' ')
x += 7
if x > 44:
break
print()
x = 3
for i in range(1,50):
print(f'{x}', end=' ')
x += 7
if x > 45:
break
... |
6961b9de08fd1e2d1f847ec02872e6029b03a375 | jan-podolanko/pp1 | /Study-1/czy.py | 226 | 3.65625 | 4 | def czy(x,y,n):
if n <= x and n >= y:
print('miesci sie w przedziale')
elif n >= x and n <= y:
print('miesci sie w przedziale')
else:
print('nie miesci sie w przedziale')
czy(1,5,5) |
0ddac6be0c524ccb8125b54fc5790b77945cc78b | LKlemens/university | /python/4zestaw.py | 4,122 | 4.0625 | 4 | #! /usr/bin/python2.7
# -*- coding: utf-8 -*-
# 4.2 ######################################################################
print "Rozwiązania zadań 3.5 i 3.6 z poprzedniego zestawu zapisać w postaci funkcji, które zwracają pełny string przez return."
# 3.5 #######################################################
print... |
06b37c4c13983bbe4f9446dc6736755b834f35c9 | LKlemens/university | /python/7zestaw/circle.py | 1,496 | 4.125 | 4 | #! /usr/bin/python2.7
# -*- coding: utf-8 -*-
from math import pi, sqrt
from point import Point
class Circle(object):
"""Klasa reprezentująca okręgi na płaszczyźnie."""
def __init__(self, x=0, y=0, radius=1):
if radius < 0:
raise ValueError('negative radius')
self.center = Point... |
a3bd09b6ff1ff0b93cfaf9f2d5db13d0b45ee7e6 | LKlemens/university | /python/8zestaw/solve1.py | 545 | 3.953125 | 4 | #! /usr/bin/python2.7
# -*- coding: utf-8 -*-
def solve1(a, b, c):
if a == 0 and b == 0:
print("infinity possibilities"
if c == 0 else "Solution cannot be found; {0} != 0".format(
str(c)))
return
if a == 0:
print "x can be any real value, y = {0}".forma... |
7ced31b92ac1ef68e66bacaf38bde1bcc71dd2bc | DevinDai13/Python | /Mastermind.py | 4,659 | 4.0625 | 4 | import random
print("Welcome to Mastermind")
print(' ')
# keep asking for input as long as the input is not valid
length_input = input('What size of patterns do you wan (4 or 5)? ')
while True:
if length_input != '4' and length_input != '5':
length_input = input('What size of patterns do you want (4 or 5)... |
c9894657052e2db7a9bafdf51ae0f63fe25258bb | mikkope123/ot-harjoitustyo | /src/city/city.py | 1,752 | 4.5 | 4 | import math
class City:
"""A class representing a city on the salesman's route.':
Attributes:
x1, x2: cartesian coordinates representing the location of the city on the map
"""
def __init__(self, x1: float, x2: float):
"""Class constructor that creates a new city
Args:
... |
88bbef0253f5f85f63d6c84110a2b7bf52ca5ca0 | Kenny-Jolley/LBOMD_utility_scripts | /md_lattice_stack.py | 3,667 | 3.703125 | 4 | #!/usr/bin/env python
# This function reads the lattice.dat file and creates a larger supercell
# by stacking multiple copies.
# The user selects the number of cells to stack in each direction, either on
# the command-line, or interactively.
# Kenny Jolley May 2016 python 2/3
import sys
def md_lattice_stack(cel... |
80d54c623186a58c2a0c5869a93adb307a5cba0e | Kenny-Jolley/LBOMD_utility_scripts | /md_setup_gen_random_system.py | 13,727 | 3.828125 | 4 | #!/usr/bin/env python
# This function builds a random lattice based upon user input
# Lengths and positions are in units of [Angstroms]
# Density is in units of [g/cm3]
# Kenny Jolley Oct 2016 python 2/3
from __future__ import print_function
import sys, os
import math
import random
import md_constants
def print... |
3bfcd17ab1c0496abf7e2f255fb5b9af5331d0c4 | JustinLee32/cai_niao_shua_ti | /按题号/299猜数字.py | 1,905 | 3.875 | 4 | # 299.猜数字
#你正在和你的朋友玩 猜数字(Bulls and Cows)游戏:你写下一个数字让你的朋友猜。每次他猜测后,你给他一个提示,告诉他有多少位数字和确切位置都猜对了(称为“Bulls”, 公牛),有多少位数字猜对了但是位置不对(称为“Cows”, 奶牛)。你的朋友将会根据提示继续猜,直到猜出秘密数字。
#
#请写出一个根据秘密数字和朋友的猜测数返回提示的函数,用 A 表示公牛,用 B 表示奶牛。
#
#请注意秘密数字和朋友的猜测数都可能含有重复数字。
#
#示例 1:
#
#输入: secret = "1807", guess = "7810"
#
#输出: "1A3B"
#
#解释: 1 公牛和 3 奶牛。公牛是... |
0cfc7bca00466bba62a8973db7830b0874d7ad9a | JustinLee32/cai_niao_shua_ti | /按题号/139 单词拆分.py | 3,495 | 3.765625 | 4 | # 给定一个非空字符串 s 和一个包含非空单词列表的字典 wordDict,判定 s 是否可以被空格拆分为一个或多个在字典中出现的单词。
#
# 说明:
#
# 拆分时可以重复使用字典中的单词。
# 你可以假设字典中没有重复的单词。
# 示例 1:
#
# 输入: s = "leetcode", wordDict = ["leet", "code"]
# 输出: true
# 解释: 返回 true 因为 "leetcode" 可以被拆分成 "leet code"。
# 示例 2:
#
# 输入: s = "applepenapple", wordDict = ["apple", "pen"]
# 输出: true
# 解释: 返回... |
f95111a6b828544e88a56970a99325227b1d068d | JustinLee32/cai_niao_shua_ti | /按题号/166 分数到小数.py | 1,412 | 3.953125 | 4 | # 给定两个整数,分别表示分数的分子 numerator 和分母 denominator,以字符串形式返回小数。
#
# 如果小数部分为循环小数,则将循环的部分括在括号内。
#
# 示例 1:
#
# 输入: numerator = 1, denominator = 2
# 输出: "0.5"
# 示例 2:
#
# 输入: numerator = 2, denominator = 1
# 输出: "2"
# 示例 3:
#
# 输入: numerator = 2, denominator = 3
# 输出: "0.(6)"
#
class Solution:
def fractionToDecimal(self, nu... |
d2fbf597351195ddbf3b8580a9b896d10c15d75c | JustinLee32/cai_niao_shua_ti | /按题号/153 寻找旋转排序数组中的最小值.py | 511 | 3.921875 | 4 | # 假设按照升序排序的数组在预先未知的某个点上进行了旋转。
#
# ( 例如,数组 [0,1,2,4,5,6,7] 可能变为 [4,5,6,7,0,1,2] )。
#
# 请找出其中最小的元素。
#
# 你可以假设数组中不存在重复元素。
#
# 示例 1:
#
# 输入: [3,4,5,1,2]
# 输出: 1
# 示例 2:
#
# 输入: [4,5,6,7,0,1,2]
# 输出: 0
class Solution:
def findMin(self, nums: list) -> int:
return min(nums)
if __name__ == '__main__':
sol =... |
12eed31a5b5c9ebcb1624ae5ca32b13974dc7ffc | JustinLee32/cai_niao_shua_ti | /按题号/205.py | 309 | 3.515625 | 4 | s = "abaa"
t = "bcdd"
flag = 1
dic1 = {}
if len(s) <= 1:
print("True")
dic1[s[0]] = t[0]
for i in range(1,len(s)):
if s[i] not in dic1 and t[i] not in t[:i]:
dic1[s[i]] = t[i]
elif s[i] in dic1 and dic1[s[i]]==t[i]:
continue
else:
flag = 0
break
if flag == 0:
print("False")
else:
print("True")
|
a4443fca9fa8071dc542a1ee0b63484338bb3c50 | Filipe-Amorim1/Scripts-Python | /Aula 13/Aula13_ex_2.py | 641 | 3.96875 | 4 | inicio = int(input('O início: '))
final = int(input('Digite o final: '))
passo = int(input('Digite o passo: '))
for c in range (inicio,final+1,passo):# lembrar de botar + 1 no final para contagem em um laço ,pois o ultimo n não conta conforme visto
print(c)
print('FIM')
for c in range(0,5): # essa estrutura fará ... |
7331333e7997165c83ce7b7c14871c5511e7c724 | Filipe-Amorim1/Scripts-Python | /Aula17-LISTAS/Desafio79_valoresUnicosEmUmaLista_aula17.py | 685 | 4.09375 | 4 | #: Crie um programa onde o usuário possa digitar vários valores numéricos e cadastre-os em uma lista.
# Caso o número já exista lá dentro, ele não será adicionado.
# No final, serão exibidos todos os valores únicos digitados, em ordem crescente.
valor =[]
while True:
try:
n =int(input('Digite um número: ')... |
b2035acc0a2b2d9a4e764809f20d64fee47e6aa0 | Filipe-Amorim1/Scripts-Python | /Aula16/Aula16_exemplos_TUPLAS.py | 1,335 | 4.25 | 4 | # Tupla é entre parenteses ()
# Lista é entre [] colchetes
# Dicionário é entre {} chaves
########### TUPLAS ##########
# tuplas são imutavéis
lanche = ('hamburguer','suco','pizza','pudim','alface')
print(lanche)
print(lanche[1])
print(lanche[3])
print(lanche[-2])
print(lanche[1:3]) # nesse caso como vimos , ele ... |
64408a8befa22a008631bf1d5f46f02a61fb0b8e | Filipe-Amorim1/Scripts-Python | /Aula18/Desafio89_aula18_boletim_listas.py | 1,085 | 3.78125 | 4 | # Crie um programa que leia nome e duas notas de vários alunos e guarde tudo em uma lista composta.
# No final, mostre um boletim contendo a média de cada um
# e permita que o usuário possa mostrar as notas de cada aluno individualmente.
# https://www.youtube.com/watch?v=7xrCJnniqMw&t=552s
lista = []
while True:
... |
00fefe5e093ea3f4cc2561a0d1ff54c2509a9586 | Filipe-Amorim1/Scripts-Python | /Aula 19 Dicionários/Exemplos_aula19.py | 1,557 | 4.1875 | 4 | filme = {'Titulo':'star wars','Ano':1977,'Diretor':'George Lucas' }
print(filme.values())
print(filme.keys())
print(filme.items())
print()
# usando o for para interagir com a var filme
# esse comando é igual o enumerate para listas e tuplas
for k,v in filme.items():
print(f'O {k} é {v}')
del filme ['Diretor'] # ap... |
744e938d38501aea487ccc54554851dec46f3bd3 | Filipe-Amorim1/Scripts-Python | /Aula09/Desafio22aula09manistring.py | 1,477 | 4.3125 | 4 | # Ler o nome de uma pessoa e mostrar
# nome com todas letras maiúsculas
# todas minúsculas
# letras ao todo sem considerar espaços
# letras tem o primeiro nome
nome = str(input('Digite seu nome completo:')).strip() # o .strip no final é para eliminar os espaços no ínicio e no fim para não conta-los
print('Analisando s... |
7a93885bf363e77b5a2faa17f55e2c83e0006603 | Filipe-Amorim1/Scripts-Python | /Aula16/Desafio75_Aula16_analise_de_dados.py | 749 | 4.125 | 4 | # Desenvolva um programa que leia quatro valores pelo teclado e guarde-os em uma tupla. No final, mostre:
# A) Quantas vezes apareceu o valor 9.
# B) Em que posição foi digitado o primeiro valor 3.
# C) Quais foram os números pares.
digite = (int(input('Digite um valor: ')),
int(input('Digite um valor: ')),
... |
0cbcf5fc45f1ff8287a3bc01e3b61e78f32db9d1 | Filipe-Amorim1/Scripts-Python | /Aula14/Desafio63_Fibonacci1.0.py | 840 | 4.15625 | 4 | #Escreva um programa que leia um número N inteiro qualquer
# e mostre na tela os N primeiros elementos de uma Sequência de Fibonacci. Exemplo:
# 0 – 1 – 1 – 2 – 3 – 5 – 8
# É uma sucessão de números que, misteriosamente, aparece em muitos fenômenos da natureza.
# Descrita no final do século 12 pelo italiano Leonardo Fi... |
27836db37d2d04c68ec02a61c1b07c053057755e | Filipe-Amorim1/Scripts-Python | /Aula 15/Desafio68_Aula15_Par_OU_ímpar.py | 1,418 | 3.875 | 4 | # Faça um programa que jogue par ou ímpar com o computador.
# O jogo só será interrompido quando o jogador perder,
# mostrando o total de vitórias consecutivas que ele conquistou no final do jogo.
'''from random import randint
num = 0
cpu = 0
escolha = str('')
while True:
usu = int(input('Digite um número: '))
... |
eac6933afc3d425a8e812527802619da6548b228 | Filipe-Amorim1/Scripts-Python | /Aula09/Desafio28_Aula10_.py | 876 | 4.1875 | 4 | # Fazer o PC pensar em um numero inteiro entre 0 e 5
# Usuario vai tentar descobrir qual foi o número esolhido pelo PC
# O programa deverá ecrever na tela se o usuário venceu ou perdeu
import random
import emoji
ale = int(random.randint(0,5))
num = int(input('Tente adivinhar o número que estou pensando de 1 até 5:').... |
395d1fab2a05c1ffb4ed95a51d41e55e3706685c | Filipe-Amorim1/Scripts-Python | /Aula 13/Aula13exemplos1.py | 1,192 | 4.125 | 4 | for c in range (0,6): # para c (c é o nome do laço pode ser qquer nome ) in (no) range (intervalo) 0 até 6 ,
print('oi') # sempre no útimo número o python vai parar ou sair do laço para o px comando. vai contar de 0 a 5 ou seja 6x saira ou parara no 7
print('Fim') # O print com a indentação mais re... |
ca525eb3c14354d285e51a8fe8a09ca2b53f341e | Filipe-Amorim1/Scripts-Python | /Aula 13/Desafio54_Aula13_Teste_de_maioridade.py | 805 | 3.734375 | 4 | print('\033[1;33m-------- Teste de Maioridade -------- \033[m')
from datetime import date # importamos a bibliotéca data
data_atual = date.today().year # var vai recebar a data atual do PC
totalmaior = 0 # var criadas para serem contadoras , vai contar quantas vezes no laço a idade foi maior ou igual a 21.
totalmenor... |
e32b1f1b4ba66043ac13b3121726bb3457a1b040 | Filipe-Amorim1/Scripts-Python | /aula08/desafio29aula10multadoacima80.py | 383 | 3.59375 | 4 | # Ler a velocidade do carro
# Se Ultrapassar 80 KM mostre uma msg dizendo que foi multado
# A multa vai cusatar R$7,00 por cada Km acima do limite
vel = int(input('Digite a velocidade que estava o carro:'))
if vel <= 80:
print('Velocidade permitida, tudo ok.')
else:
print('Essa velocidade não é permitida , voc... |
dff9d0f6b9dca11422d9d97ff54352aca8e6eacf | Faranaz08/assignment_3 | /que13.py | 600 | 4.1875 | 4 | #write a py program accept N numbers from the user and find the sum of even numbers
#product of odd numbers in enterd in a list
lst=[]
even=[]
odd=[]
sum=0
prod=1
N=int(input("enter the N number:"))
for i in range(0,N):
ele = int(input())
lst.append(ele)
if ele%2==0:
even.append(ele)
... |
80cfc3943169e693dfbae86309a0244164f9eba6 | FahimAlvi/3-level-Pygame | /a1/code/actors2.py | 17,413 | 3.6875 | 4 | from __future__ import annotations
import pygame
from typing import Optional
from settings import *
"""
Numbers set to distinguish between different objects(Used in actor_type() method)
Actor -> 0
Player -> 1
Monster -> 2
Star -> 3
Wall -> 4
Door -> 5
Key -> 6
Orb -> 7
Box -> 8
(This is just for convenience) :)
"""
... |
2bc4ac82a5bf789e25e3e54ecfb92a3812d369f8 | shengli881026/python3 | /list.py | 1,465 | 4.0625 | 4 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# list 是一种有序的集合,可以随时添加和删除其中的元素。
# tuple 另一种有序列表叫元组:tuple。tuple和list非常类似,但是tuple一旦初始化就不能修改。
# list和tuple是Python内置的有序集合,一个可变,一个不可变。根据需要来选择使用它们。
#
# 定义一个list,记录用户名
list_user = ['zhangsan','lisi',['qiba','liusiwu','qiwanglei'],'wangwu','zhaoliu']
#获取list_user 的list 长... |
66e15aa4617da596678c36f373c82d1c5953ac78 | malhas11/hangman-python | /hangman2.py | 4,485 | 3.890625 | 4 | from hangman_lib import *
import random
# This program WILL NOT RUN until you have added all the specified sub-programs
# Ensure that you test them first!
words = ["ant","baboon","badger","bat","bear","beaver","camel","cat","clam","cobra","cougar","coyote","crow","deer","dog","donkey","duck","eagle","ferret","f... |
b506970a3139ce19fa06546da25a2a40c8e4913b | gideonmandu/datastructures_-_algorithms | /src/binary_search_tree.py | 3,588 | 3.875 | 4 | from rich import print
class Node:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
class BinarySearchTree:
def __init__(self):
self.root = None
def insert(self, value):
new_node = Node(value)
if self.root is None:
... |
748aceace7fde6ba1a5af815cf8398c2a0e47e76 | gideonmandu/datastructures_-_algorithms | /src/big_o.py | 275 | 3.5 | 4 | from rich import print
def print_numbers(n):
for i in range(n):
for j in range(n):
print(i, j)
for k in range(n):
print(k)
def add_item(n):
return n + n
l = [1, 2, 3, 4, 5, 6, 7, 8]
if __name__ == "__main__":
add_item(10)
|
41a1cc6d65653c332c1c969673fc10288472ec87 | prbtkr19/Churn_Modelling | /churn_modelling_ANN.py | 4,333 | 3.765625 | 4 | #part-1 -Data Preprocessing
#importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
#importing the datasets
dataset=pd.read_csv("F:\P16-Deep-Learning-AZ\Artificial_Neural_Networks\Churn_Modelling.csv")
#creating matrces of features
x=dataset.iloc[:,3:13].values
y=dataset... |
5c983a2d3810ebc4e259fa0d533b25e6a289a4db | Luis-Salas/Coding_Dojo | /python/Python exercises/basic 13 in python.py | 1,151 | 3.703125 | 4 | # # print 1-255
#
# for i in range(1, 256):
# print i
# #print odd
# for i in range(1,256, 2):
# print i
# #print sum
# sum = 0
# for i in range(0, 256):
# sum += i
# print "new number",i
# print "sum:",sum,
# #iterating through arrays
# a = [1,2,3,4,7,8]
# print(a)
#
# #find max
#
# a = ... |
5163d0eeb62f8bc009c2d0658d58783fcd81f410 | Luis-Salas/Coding_Dojo | /python/Python exercises/names.py | 424 | 3.859375 | 4 | students = [
{'first_name': 'Michael', 'last_name' : 'Jordan'},
{'first_name' : 'John', 'last_name' : 'Rosales'},
{'first_name' : 'Mark', 'last_name' : 'Guillen'},
{'first_name' : 'KB', 'last_name' : 'Tonel'}
]
for student in students:
for key in students:
print student['first_name'],st... |
058c1152f6d2d467c1b18f387cc41f9a74213010 | JolanDejonckheere/5WWIPython | /07-while lus/blackjack.py | 265 | 3.65625 | 4 | kaart = int(input(''))
som = kaart
while som < 21 and kaart != 0:
kaart = int(input(''))
som += kaart
if som ==21:
print('Gewonnen!')
elif som > 21:
print('Verbrand (' + str(som) + ')')
else:
print('Voorzichtig gespeeld (' + str(som) + ')')
|
c86a458ead75b3757ac4fef4b059042b118e5358 | JolanDejonckheere/5WWIPython | /04-Variabelen/test.py | 259 | 3.5625 | 4 | #wisselen van waarde
#x, y = 2, 'hallo'
#x, y = y, x
#print(x,y)
#programma die discriminant berekent
a = float(input('a: '))
b = float(input('b: '))
c = float(input('c: '))
print(a,b,c)
#berekening
discriminant = b**2 - (4 * a * c)
print(discriminant)
|
d118ae56dc52dafae81e64e0dbfbc7f013032cc0 | JolanDejonckheere/5WWIPython | /05-Eenvoudige functies/de diatomist.py | 304 | 3.671875 | 4 | #invoer
r = float(input(''))
R = float(input(''))
pi = 3.14159265359
#berekening
n = 0.83*R**2/r**2 - 1.9
n = int(n//1)
op_c1 = r**2 *pi
op_c2 = R**2 *pi
procent = ((n * op_c1) / op_c2) * 100
procent = round(procent, 2)
#uitvoer
print(n, 'kleine circels bedekken', procent, '% van de grote circel')
|
071c8ad4972ca76cfd593dc5ca04b408401b8815 | dmoons/nimbuslorasim | /location_2d.py | 511 | 4.09375 | 4 | from math import sqrt
class Location2D():
def __init__(self, x, y):
"""2D Location defined by x and y coords"""
self.x = x
self.y = y
def distance(self, other):
"""Calculates distance between my location and another"""
if type(other) is not Location2D:
# TOD... |
56e56790e54f79d9d215d076aae2eeae15c6e88f | Xenomorphims/Python-Games | /Slider.py | 17,502 | 4.4375 | 4 | """
Show how to use a sprite backed by a graphic.
Name: Simple Slider Puzzle
Author: Innocent M Sakala
"""
import pygame
from pygame.locals import *
import random
import copy
import math
# Define some colors
BLACK = (0, 0, 0)
PI = 3.141592653
pygame.init()
# Set the width and height of the screen [width, hei... |
e4a3054cb59f288cca6daff6a054a85c18116be3 | nbharwani11/Code-In-Place | /final_project/final_project.py | 3,253 | 3.953125 | 4 | """
This program generates the Warhol effect based on the original image.
"""
import random
from simpleimage import SimpleImage
N_ROWS = 3
N_COLS = 2
BORDER_SIZE = 10
PATCH_NAME = 'face2.jpeg'
PATCH_SIZE = 570 + BORDER_SIZE * 2
WIDTH = ((N_COLS * PATCH_SIZE) - (BORDER_SIZE * (N_COLS - 1)))
HEIGHT = (N_ROWS * PATCH_SIZ... |
8c95c252d416f045497938b2d656b857e09b8562 | zkmake520/ProbabilisticModel | /NGram/NGram.py | 7,655 | 3.515625 | 4 | #here we can use wrapper to accerlate the whole process, since many text may be same, we can save the intermediate results
import operator
from math import log10
import re
import string
import random
import heapq
"""First Part:
Word Segmentation"""
def memory(f):
#memorize function f
table = {}
def fme... |
aa89f2af8044fd276cb6c20967af591d3412edd4 | naz0n/projecteuler | /09 pythagorean_triplet.py | 244 | 3.53125 | 4 | def squared(a,b,c):
if a**2 + b**2 == c**2:
return True
return False
def tripsum():
for a in xrange(500):
for b in xrange(a + 1, 500):
c = 1000 - (a + b)
if squared(a,b,c):
print a, b, c
return a * b * c
print tripsum()
|
d73a11c4503a5f96d40b6dcbcce245d8ff4bc2ea | alina-poliatska/python_homework | /laboratory3/task3.py | 456 | 3.953125 | 4 | import string as s
row = input("Введіть рядок: ")
separator = input('Введіть розділювач слів: ')
def sort(words, separator):
words = row.split(separator)
res = ''
result = str()
for element in sorted(words, key=lambda lenw: len(lenw)):
res = res + separator + element
list = res.split(... |
2b783a4762657b56447de189929a210aa8e69bac | exclusivedollar/Team_5_analyse | /Chuene_Function_3.py | 724 | 4.28125 | 4 | ### START FUNCTION
"""This function takes as input a list of these datetime strings,
each string formatted as 'yyyy-mm-dd hh:mm:ss'
and returns only the date in 'yyyy-mm-dd' format.
input:
list of datetime strings as 'yyyy-mm-dd hh:mm:ss'
Returns:
returns a list of strings where each element in
the returned... |
295541b5daa8e0352fa81a1cb365f39c097c059b | lanjing99/leetcode | /236.二叉树的最近公共祖先.py | 2,296 | 3.65625 | 4 | #
# @lc app=leetcode.cn id=236 lang=python3
#
# [236] 二叉树的最近公共祖先
#
# @lc code=start
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode... |
89616a2f732f01c41e8c4a862df1cfccd6224f03 | lanjing99/leetcode | /127.单词接龙.py | 3,663 | 3.765625 | 4 | #
# @lc app=leetcode.cn id=127 lang=python3
#
# [127] 单词接龙
#
# @lc code=start
from collections import deque
from collections import defaultdict
from typing import List
# 参考官方题解实现
# https://leetcode-cn.com/problems/word-ladder/solution/dan-ci-jie-long-by-leetcode-solution/
class Solution:
wordIDDic = dict()
no... |
cb191704b41164f485bfebafdaa99b9090b2516d | flatironinstitute/spikeforest2 | /working/website_upload/make_website_data_directory.py | 2,271 | 3.515625 | 4 | #!/usr/bin/env python
import argparse
import os
import json
help_txt = """
This script saves collections in the following .json files in an output directory
Algorithms.json
Sorters.json
SortingResults.json
StudySets.json
StudyAnalysisResults.json
"""
def main():
parser = argparse.ArgumentParser(description=hel... |
209f4bb62e69f1bea63d0bb712d3db572a106408 | SBenjaminVR/Peque | /directory.py | 11,812 | 3.5 | 4 | class Directory():
def __init__(self, clases, funciones, variables,Objetos):
self.Clases = clases #Directory of clases
self.Funciones = funciones #Directory of variables
self.Variables = variables #directory of the variables
self.Scope = '' #Direcotry of the scope
self.C... |
587fd46cb64acd2c3fce7d8c6796c49af59c3100 | SBenjaminVR/Peque | /localMemory.py | 1,706 | 3.75 | 4 | from direcciones import DireccionesMemoria
Dir = DireccionesMemoria()
# Initializes the given addresses with a None
def InsertAddresses(local, number, base):
for x in range(number):
local[str(x + base)] = None
return local
# Assigns the direction of the local memory according to the data type
def Assi... |
f292733892351a9b23a2ab0f3a43efc1835a74e0 | lindseyeggleston/programming_challenges | /tests/unittests_challenge2.py | 1,297 | 3.65625 | 4 | '''
Unittest for Challenge 2
To run the test in the terminal, go to root directory (programming_challenges/)
and run `make test2`
'''
import unittest
from src import challenge2 as c2
class TestPractice(unittest.TestCase):
def test_fizz_buzz(self):
result = c2.fizz_buzz(30)
answer = [1, 2, 'Fizz'... |
3a31ee9f90dddfa6f861efcb5636f2275fac5fd9 | brunomossmann007/python | /Python.py | 461 | 3.84375 | 4 | imprimir = print()
toda função vai o ()
\n = nova linha
sep="-" separar palavras em um print
end=(\n) = nova linha em um print
Declaração de variavel:
exemplo:
pais = "Italia"
type(pais)
string
quantidade = 4
type(quantidade)
int
imprimindo varivavel
print(pais, "ganhou", quantidade, "titulos mund... |
399a8d4b9b1d1f0b007581b5542c45e384c1f2ed | chiteri/shdnbi2013_machinelearning | /example_decision_tree.py | 1,698 | 4.0625 | 4 | from sklearn import tree
import numpy as np
import matplotlib.pylab as plt
################################################################################
# Make some fake datasets with 3 variables.
# The first four entries are dataset 1 and the second 4 are dataset 2.
#
# These are referred to as TRAINING samples.
... |
53c0bfe01391ab693d68167b7f8f0a8b4b7b460a | sstagg/bch5884 | /20nov05/exceptionexamplewithtry.py | 572 | 3.890625 | 4 | #!/usr/bin/env python3
# try:
# from scipy import *
# except ImportError:
# def printHello:
# print ("Hello")
numbers=0
avg=0
while True:
inp=input("Please give me a number or the word 'Done': ")
try:
x=float(inp)
avg+=x
numbers+=1
except ValueError:
if inp=="Done":
break
else:
print ("Inc... |
83abbf6a1bf6680946587cbfde3b23d6474a2cd7 | sstagg/bch5884 | /20nov17/classexample.py | 244 | 3.671875 | 4 | #!/usr/bin/env python3
class C1:
def __init__(self,value=1):
self.data=value
def setdata(self,value):
self.data=value
def display(pickle):
print("The data is",pickle.data)
class C2(C1):
def setdata2(self,value):
self.data2=value
|
c52a44b6754b5a484bceaa44e8032ec8c1740084 | sstagg/bch5884 | /20sep24/input.py | 261 | 3.8125 | 4 | #!/usr/bin/env python3
import sys
# first way to get input
x1=int(input("Enter the first x value: "))
print (x1)
y1=int(input("Enter the first y value: "))
print (y1)
#second way to get input
x2=int(sys.argv[1])
print (x2)
y2=int(sys.argv[2])
print (y2)
|
987de188f535849170f5d44dafef82c543ad1bb6 | sstagg/bch5884 | /20nov05/exceptionexample.py | 237 | 4.125 | 4 | #!/usr/bin/env python3
numbers=0
avg=0
while True:
inp=input("Please give me a number or the word 'Done': ")
if inp=="Done":
break
else:
x=float(inp)
avg+=x
numbers+=1
avg=avg/numbers
print ("The average is %.2f" % (avg)) |
fccfa3d066edeb88020d482a576106bb5e274e43 | sstagg/bch5884 | /20nov19/restaurant.py | 1,216 | 4.03125 | 4 | #!/usr/bin/env python3
class Employee:
def __init__ (self, name, idnum, salary=0):
self.name=name
self.salary=salary
self.idnum=idnum
def work(self):
print (self.name, "does stuff")
def giveRaise(self,percent):
self.salary=self.salary+(self.salary*percent/100)
def __mul__(self,num):
return (self.sa... |
0dc7ae4ae1777ca0b7c7ec9c6022567831f98f9d | BrianMourik/van-input-naar-uitput | /lab 2/pizza-calculator.py | 515 | 3.671875 | 4 | #Brian Mourik
##Pizza Calculator
print("********************************************")
print("Meatbarn Pizza's, there juicalisious!")
print("********************************************")
print("How many of these would you like?")
small = float(input("Small chicken coop: "))
medium = float(input("Medium beef supreme... |
05dbe1ba94d84ef4153a2b3d7a8201f7404a0f86 | fairscape/hctsa-py | /PeripheryFunctions/BF_ResetSeed.py | 522 | 3.765625 | 4 |
import random
def BF_ResetSeed(resetHow= 'default'):
'''
Allows functions using random numbers to produce repeatable results with a consistent syntax
:param resetHow = method for resetting the seed
:return: void
'''
if resetHow == 'default':
random.seed(0) # resets to using Marsen... |
84345bf4d8f17f7f422b9fe03319cf00c7639e24 | bhhs-roll/roll | /tools.py | 2,141 | 3.71875 | 4 | import streamlit as st
from google.cloud import firestore
from backend import database as db
import typing
viewBeforeLogin = """
## Please Login to access henos Roll Taking system
"""
viewAfterLogin = """
## How to Use
### > Mark Roll
When you select `mark roll`, the system will boot-up and then tak... |
470be253aedd38272ced16c119e3f378327e12f3 | lclukechang/crimsononline-assignments | /assignment1/question3.py | 3,173 | 3.859375 | 4 | class Person(object):
def __init__(self,name,gender):
#capitalize name
self.name = str.title(name)
#check gender
check = str.lower(gender)
if check != 'm' and check!= 'f':
raise ValueError("Please enter a valid value for gender: M or F")
else :
self.gender = gender.upper()
#to ... |
a5b40b90f3a078c39e13434587850b64ca63ffb8 | alokaviraj/python-program-3 | /greater 2 no..py | 181 | 4.125 | 4 | a=int(input('enter the number a='))
b=int(input('enter the number b='))
if(a>b):
print('a is greater')
elif(a==b):
print('a and b is equal')
else:
print('b is greater')
|
cee079505a684ef5a58041492ed437eba43572b5 | JayAgrawalgit/LearnPython | /1. Learn the Basics/1.9 Functions/1. What are Functions.py | 1,282 | 4.5625 | 5 | # Functions are a convenient way to divide your code into useful blocks,
# allowing us to order our code, make it more readable, reuse it and save some time.
# Also functions are a key way to define interfaces so programmers can share their code.
# How do you write functions in Python?
# As we have seen on previous tu... |
bee23cea1abfa614293169d30c500b608a513084 | JayAgrawalgit/LearnPython | /2. Data Science Tutorials/2.1 Numpy Arrays/5. Exercise.py | 458 | 3.9375 | 4 | # First, convert the list of weights from a list to a Numpy array. Then, convert all of the weights from kilograms to
# pounds. Use the scalar conversion of 2.2 lbs per kilogram to make your conversion. Lastly, print the resulting array
# of weights in pounds.
weight_kg = [81.65, 97.52, 95.25, 92.98, 86.18, 88.45]
im... |
a10abea0005837374d7908ed655aa4fddfe87e61 | JayAgrawalgit/LearnPython | /1. Learn the Basics/1.2 Variables and Types/1. Numbers.py | 628 | 4.4375 | 4 | # Python supports two types of numbers - integers and floating point numbers. (It also supports complex numbers, which
# will not be explained in this tutorial).
# To define an integer, use the following syntax:
myint = 7
print("Integer Value printed:",myint)
# To define a floating point number, you may use one of th... |
55d49ce7240c7af9c27430d134507103cc6739c7 | JayAgrawalgit/LearnPython | /1. Learn the Basics/1.11 Dictionaries/1. Basics.py | 688 | 4.15625 | 4 | # A dictionary is a data type similar to arrays, but works with keys and values instead of indexes.
# Each value stored in a dictionary can be accessed using a key,
# which is any type of object (a string, a number, a list, etc.) instead of using its index to address it.
# For example, a database of phone numbers could... |
903d31d02a6795018be711e8dfa2d344efc849c6 | naveenkumarkalaga/Bank_Loan_Prediction | /Loan_prediction.py | 3,774 | 3.921875 | 4 |
import pickle
import streamlit as st
import pandas as pd
# loading the trained model
pickle_in = open('classifier.pkl', 'rb')
classifier = pickle.load(pickle_in)
st.title('Bank Loan Prediction')
st.sidebar.header('User Input Parameters')
@st.cache()
# defining the function which will make the... |
a9ad5d63cd98a178b4efdf2343c9e4f083d42a24 | uc-woldyemm/it3038c-scripts | /Labs/Lab5.PY | 486 | 4.15625 | 4 | print("Hello Nani keep doing your great work")
print("I know you're busy but is it okay if i can get some information about you")
print("How many years old are you?")
birthyear = int(input("year: "))
print("What day you born")
birthdate = int(input("date: "))
print("Can you also tell me what month you were born")
bir... |
235bd7c02a7555c8d059e401b18bf9bb4c6ee2dc | PranilDahal/SortingAlgorithmFrenzy | /BubbleSort.py | 854 | 4.375 | 4 | # Python code for Bubble Sort
def BubbleSort(array):
# Highest we can go in the array
maxPosition = len(array) - 1
# Iterate through the array
for x in range(maxPosition):
# For every iteration, we get ONE sorted element.
# After x iterations, we have x sorted elements
# We don't swap on the... |
7a5ecb354bfdd283896bcbfdb5b177bd53b90b15 | vidyasagarr7/DataStructures-Algos | /GeeksForGeeks/Strings/WildCardMatching.py | 1,442 | 4.40625 | 4 |
"""
String matching where one string contains wildcard characters
Given two strings where first string may contain wild card characters and second string is a normal string.
Write a function that returns true if the two strings match. The following are allowed wild card characters
in first string.
* --> Matches wit... |
38333c31be9bf385cbc0ad0f612ce39907f30648 | vidyasagarr7/DataStructures-Algos | /GeeksForGeeks/LinkedList/MoveLastToFirst.py | 787 | 4.46875 | 4 | from GeeksForGeeks.LinkedList.SinglyLinkedList import LinkedList
"""
Move last element to front of a given Linked List
Write a C function that moves last element to front in a given Singly Linked List. For example, if the given Linked
List is 1->2->3->4->5, then the function should change the list to 5->1->2->3->4.
""... |
450aea9b577540d736e54b6953ba5b3c5ff6c06f | vidyasagarr7/DataStructures-Algos | /GeeksForGeeks/Tree/ConstructBT.py | 1,601 | 3.78125 | 4 | import sys
"""
Construct Special Binary Tree from given Inorder traversal
Given Inorder Traversal of a Special Binary Tree in which key of every node is greater than keys in left and right children, construct the Binary Tree and return root.
Examples:
Input: inorder[] = {5, 10, 40, 30, 28}
Output: root of following ... |
b5a1b48719e01685184f6546f5bac08e7804502e | vidyasagarr7/DataStructures-Algos | /Cormen/2.3-5.py | 761 | 4.125 | 4 |
def binary_search(input_list,key):
"""
Binary search algorithm for finding if an element exists in a sorted list.
Time Complexity : O(ln(n))
:param input_list: sorted list of numbers
:param key: key to be searched for
:return:
"""
if len(input_list) is 0:
return False
else ... |
c4105c8d7ba4ce406b1feb58b0cc22578b20985b | vidyasagarr7/DataStructures-Algos | /609-Algos/HW2/DeleteDuplicates.py | 656 | 4.0625 | 4 | from Karumanchi.Sorting import MergeSort
def delete_duplicates(input_list):
sorted_list = MergeSort.merge_sort(input_list)
i =0
while i < len(sorted_list)-1:
if sorted_list[i]==sorted_list[i+1]:
sorted_list[i],sorted_list[len(sorted_list)-1] = sorted_list[len(sorted_list)-1],sorted_list... |
f0420e011a39072b2edd46884b9bcdb1ede1270b | vidyasagarr7/DataStructures-Algos | /GeeksForGeeks/Arrays/CheckConsecutive.py | 1,492 | 4.125 | 4 | import sys
"""
Check if array elements are consecutive | Added Method 3
Given an unsorted array of numbers, write a function that returns true if array consists of consecutive numbers.
Examples:
a) If array is {5, 2, 3, 1, 4}, then the function should return true because the array has consecutive numbers
from 1 to 5... |
9b39d676112e22495601d26a0f8bbd7305d6bf12 | vidyasagarr7/DataStructures-Algos | /GeeksForGeeks/Strings/PalindromicSubstrings.py | 561 | 4.0625 | 4 | from GeeksForGeeks.Strings.LPS import find_lps
"""
Find all distinct palindromic sub-strings of a given string
Given a string of lowercase ASCII characters, find all distinct continuous palindromic sub-strings of it.
Examples:
Input: str = "abaaa"
Output: Below are 5 palindrome sub-strings
a
aa
aaa
aba
b
Input: st... |
7eefbcb7099c14384b4046d2cfcece1fba35a473 | vidyasagarr7/DataStructures-Algos | /GeeksForGeeks/Strings/InsertSpaceAndPrint.py | 916 | 4.15625 | 4 |
"""
Print all possible strings that can be made by placing spaces
Given a string you need to print all possible strings that can be made by placing spaces (zero or one) in between them.
Input: str[] = "ABC"
Output: ABC
AB C
A BC
A B C
"""
def toString(List):
s = []
for x in List:
... |
7a9007ebb484b6a6828283f77cde0433c2eb70fe | vidyasagarr7/DataStructures-Algos | /Karumanchi/Stack/Stack.py | 3,365 | 3.9375 | 4 |
class Stack1:
"""
Stack implementation using fixed size array
"""
def __init__(self,limit=None):
self.stack = []
self.limit = limit
def is_empty(self):
return not len(self.stack)
def push(self,data):
if len(self.stack) >= self.limit:
return 'stack o... |
dd9088ed2e952a61cbc2f117274edd650d4aae16 | vidyasagarr7/DataStructures-Algos | /GeeksForGeeks/LinkedList/ReverseAlternateKnodes.py | 1,182 | 4.15625 | 4 | from GeeksForGeeks.LinkedList.SinglyLinkedList import LinkedList
"""
Reverse alternate K nodes in a Singly Linked List
Given a linked list, write a function to reverse every alternate k nodes (where k is an input to the function)
in an efficient way. Give the complexity of your algorithm.
Example:
Inputs: 1->2->3-... |
2f07fe612f24a41d60bcd4f9f05a070ad45cc1b3 | vidyasagarr7/DataStructures-Algos | /GeeksForGeeks/LinkedList/DoublyLinkedList.py | 2,437 | 3.625 | 4 |
class Node :
def __init__(self,data=None):
self.data = data
self.next = None
self.prev = None
class DoublyLinkedList:
def __init__(self):
self.head = None
self.last = None
def add_node(self,value):
if not self.head :
self.head = Node(value)
... |
57e66fcfe37a98d3b167627e8d0451ad9f37f567 | vidyasagarr7/DataStructures-Algos | /GeeksForGeeks/Arrays/ConstantSumTriplet.py | 1,203 | 4.25 | 4 | """
Find a triplet that sum to a given value
Given an array and a value, find if there is a triplet in array whose sum is equal to the given value.
If there is such a triplet present in array, then print the triplet and return true. Else return false.
For example, if the given array is {12, 3, 4, 1, 6, 9} and given su... |
6356464fb2f5e1c1440e0a5af8c7bc2ab5188183 | vidyasagarr7/DataStructures-Algos | /GeeksForGeeks/Arrays/TwoRepeatingNumbers.py | 1,133 | 4.28125 | 4 |
"""
Find the two repeating elements in a given array
You are given an array of n+2 elements. All elements of the array are in range 1 to n.
And all elements occur once except two numbers which occur twice. Find the two repeating numbers.
For example, array = {4, 2, 4, 5, 2, 3, 1} and n = 5
The above array has n + ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.