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
2db9fc416ebd7d63033eb5d30f83e7c51b1733aa
GabrielCardoso2019/Curso-de-Python
/Modulo03/A-Tuplas.py
1,130
4.34375
4
lanche = ('Hambúrger', 'Suco', 'Pizza', 'Pudim', 'Batata Frita') # Tuplas são imutáveis # lanche[1] = 'Refrigerante' <-- Não funciona # print(lanche) # trás do 1 ao 3 item print(lanche[1:3]) # Trás do 1 ao 0 (Python ignora um número) print(lanche[:2]) # Trás o 3º item de trás para frente print(lanche[-3:]) # Mostra to...
7ea861a9e6985443ae72773fc9a843f8b544f8bc
GabrielCardoso2019/Curso-de-Python
/Estudos-Refeitos/ex39-Condicoes-Aninhadas.py
898
4
4
from datetime import date from time import sleep print('-=' * 20) print(' ALISTAMENTO MILITAR') print('-=' * 20) nome = str(input('Digite seu nome: ')) anoNasc = int(input('Digite seu ano de nascimento: ')) idadeAtual = date.today().year - anoNasc print('-=' * 20) print(' PROCESSANDO...') sleep(2...
ea2c28dce9823d5715dd221cdf11c4f5f241ec4a
GabrielCardoso2019/Curso-de-Python
/Modulo03/Desafio091-Dicionario.py
619
3.515625
4
from operator import itemgetter from random import randint from time import sleep jogo = {'1º Jogador': randint(1, 5), '2º Jogador': randint(1, 5), '3º Jogador': randint(1, 5), '4º Jogador': randint(1, 5)} ranking = list() print('\033[1;31m---- VALORES SORTEADOS ----\033[m') for v, k in jogo.i...
b28b3606991a7db7c433ad3d0a13e09217f9e79d
GabrielCardoso2019/Curso-de-Python
/Estudos-Refeitos/ex34-Condicoes.py
363
3.9375
4
salario = float(input('Digite o seu sálario para o ajuste. R$')) if salario > 1250.0: salario = salario + (salario * 10 / 100) print(f'Seu salario teve um aumento de 10%. Você passa a receber {salario}') if salario < 1250.0: salario = salario + (salario * 15 / 100) print(f'Seu salario teve um aumento d...
cdfc2afe96a4aa346785c42cd8ef95aeaa14c775
GabrielCardoso2019/Curso-de-Python
/Modulo01/Desafio010-Operador-Aritmetico.py
133
3.5625
4
rs = float(input('Quanto você tem na carteira? ')) us = rs/3.27 print('Com R${} você compra US${:.2f} Dólar(es)'.format(rs, us))
613a8d93e318db132f662e6e5664a405cdb1016b
GabrielCardoso2019/Curso-de-Python
/Modulo02/Desafio044-Condicoes-Aninhadas.py
1,171
3.828125
4
from time import sleep print('-=-' * 10) print('{:^30}'.format('G`CARDOSO STORE CAR')) print('-=-' * 10) produto = str(input('Digite qual é o produto: ')) preco = float(input('Digite o valor do produto: R$')) print('''FORMAS DE PAGAMENTO [ 1 ] à vista dinheiro/cheque [ 2 ] à vista cartão [ 3 ] 2x no cartão [ 4 ] 3x ...
dd486609daf9a5b19f519f20aeb09e76a6b58f5b
textualfactor/Text_Analysis
/src/Cluster_TF.py
31,000
3.515625
4
#Importing requisite packages import numpy as np import falconn import timeit import math import random import matplotlib.pyplot import gensim class Cluster_TF: #Class Description # 1) Vectorizes user-given array of words # by matching words with corresponding (key match) # vectors in google/glove # 2) Groups similar ...
0ebe39137dfbed152d19fb204d630f9586c4acd9
ducminhgd/interview
/coding/python/sum_of_pairs.py
1,639
4.03125
4
"""Consider you have a list of integers and a number n, find a pairs of elements which are sum equal to n and a pairs are unique, (a, b) is equal to (b, a) Example: n = 10 nums = [1, 3, 5, 6, 3, 4, 5, 7, 2, 2] expected = [(3, 7), (5,5), (6,4)] """ inputs = [ { 'n': 10, 'nums': [1, 3, 5, 6, 3, ...
9fc1e64346eebcf55d4e747c48335478e572365c
theDreamBear/algorithmn
/python/222.完全二叉树的节点个数.py
1,655
3.546875
4
# # @lc app=leetcode.cn id=222 lang=python3 # # [222] 完全二叉树的节点个数 # # @lc code=start # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right def treeHigh(root): h = 0 while roo...
de9d7e4ad2993358c0ca5ecad2e07b112763d2a4
uni1023/myPy
/Algorithm/p00-1-abs.py
773
3.78125
4
# '절댓값 구하기' # 문제 : 어떤 숫자의 절댓값 구하기 # 입력 : 절댓값을 구할 실수 a # 출력 : a의 절댓값 # 1 a가 0보다 크거나 같은지 확인함. 만약 그렇다면 a를 결과로 돌려줌 # 2 1의 경우가 아니라면(a가 0보다 작으면) -a를 결과로 돌려줌 import math #절댓값 알고리즘 1(부호 판단) # 입력: 실수 a # 출력: a의 절댓값 def abs_sign(a): if a >= 0: return a else: return -a # 절댓값 알고리즘 2(제곱-제곱근) # 입력: 실수...
80fffee8b2c024b53a1df284bd99f3c864509986
matiasdepino/-
/main.py
473
3.625
4
# Import a library of functions called 'pygame' import pygame from Main_functions import * # Initialize the game engine pygame.init() #call main routine size = [1300, 600] # Define size of windows size[0] = int(input("Ancho de la ventana:")) size[1] = int(input("Alto de la ventana:")) blue = int(input("BLUE: ")) red...
04dcef105dad1c9beb24f33ff7b64eec1908cccd
Supertatortots/Python-Practice
/Python Basics.py
8,716
4.34375
4
# Comments in Python use the '#' symbol ''' Multi-line comments are denoted via three single or three double quotes And are ended with the matching set of three single or double quotes ''' ''' Let's start off by defining some variables In Python, there's no `let`, `const`, or `var` keyword to declare variables Python...
7e9bf89b8bb08c33a4cff615c60b0732705b7e1a
Hives/advent-of-code
/aoc-2017-python/lib/list_things.py
193
3.609375
4
from functools import reduce def flat_map(f, xs): return reduce(lambda acc, current: acc + current, map(f, xs)) def flatten(xs): return [item for sublist in xs for item in sublist]
d0a65eda833714e0123919dd301cfcfd7a1880e3
Hives/advent-of-code
/aoc-2017-python/day_02.py
755
3.53125
4
#! /usr/bin/python3 from functools import reduce from itertools import permutations puzzle_input = [[int(n) for n in line.strip().split("\t")] for line in open("inputs/day_02.txt").readlines()] def part_1(spreadsheet): return reduce( lambda acc, row: acc + max(row) - min(row), spreadsheet, ...
b785ed5bff4e17cb22b7ee84e0144ab222dedd45
green-fox-academy/FulmenMinis
/week-04/day-03/fibonacci.py
386
4.25
4
# Fibonacci # Write a function that computes a member of the fibonacci sequence by a given index # Create tests that covers all types of input (like in the previous workshop exercise) def fibonacci(n=0): if n < 0: return False elif n == 0: return 0 elif n == 1 or n == 2: ret...
ebe6600f721f507c7a99c8af70280ac3c1a7680e
green-fox-academy/FulmenMinis
/week-02/day-01/average_of_input.py
371
4.0625
4
# Write a program that asks for 5 integers in a row, # then it should print the sum and the average of these numbers like: # # Sum: 22, Average: 4.4 print("Choose five numbers!") a = input("1: ") b = input("2: ") c = input("3: ") d = input("4: ") e = input("5: ") sum = int(a) + int(b) + int(c) + int(d) + int(e) average...
9075667a1939360e984bb616273f586d15e41499
green-fox-academy/FulmenMinis
/week-04/day-01/dominoes.py
1,045
3.78125
4
from domino import Domino def initialize_dominoes(): dominoes = [] dominoes.append(Domino(5, 2)) dominoes.append(Domino(4, 6)) dominoes.append(Domino(1, 5)) dominoes.append(Domino(6, 7)) dominoes.append(Domino(2 ,4)) dominoes.append(Domino(7, 1)) return dominoes dominoes = initialize_d...
a0aacffaecbcb78b56a2f2beecb7d2bf0b143f68
green-fox-academy/FulmenMinis
/week-03/day-04/number_adder.py
264
4.25
4
# Write a recursive function that takes one parameter: n and adds numbers from 1 to n. def recursive_function(n): if n == 0 or n == 1: return n else: return (recursive_function(n-1) + recursive_function(n-2)) print(recursive_function(10))
19684231d4bc2fa7ee4e71da4563451022e7c826
green-fox-academy/FulmenMinis
/week-04/day-03/sum.py
790
4.1875
4
# Sum # Create a sum method in your class which has a list of integers as parameter # It should return the sum of the elements in the list # Follow these steps: # Add a new test case # Instantiate your class # create a list of integers # use the assertEquals to test the resu...
c00eecf4477640096d2653f3020a42bdf1f20672
green-fox-academy/FulmenMinis
/week-04/day-01/teacher_student.py
575
3.84375
4
#Teacher Student # Create Student and Teacher classes # Student # learn() # question(teacher) -> calls the teachers answer method # Teacher # teach(student) -> calls the students learn method # answer() class Student(object): def question(self, teacher): teacher.answer...
dcd05b18ca7d27ad9baba3e3bfb5928ba0731eab
green-fox-academy/FulmenMinis
/week-03/day-03/colored_box.py
380
3.875
4
from tkinter import * root = Tk() canvas = Canvas(root, width='300', height='300') canvas.pack() # draw a box that has different colored lines on each edge. canvas.create_line(10, 10, 290, 10, fill='blue') canvas.create_line(10, 10, 10, 290, fill='green') canvas.create_line(10, 290, 290, 290, fill='silver') canvas.c...
b3fe3eba4d6cf91946fd8908abeb114ace87d792
green-fox-academy/FulmenMinis
/week-03/day-04/string2.py
703
4.03125
4
# Given a string, compute recursively a new string where all the 'x' chars have been removed. #Solution 1 def remover(text): if text == '': return '' if text[0] == 'x': return '' + remover(text[1:]) return text[0] + remover(text[1:]) print(remover('Xerxes knew it')) #Solution 2 for more un...
29109f6f4dd6932523c63ff32de11b4598cfd4ff
green-fox-academy/FulmenMinis
/week-02/day-03/string02.py
661
4.15625
4
# Create a function called 'reverse_string' which takes a string as a parameter # The function reverses it and returns with the reversed string #Solution 1 reversed = ".eslaf eb t'ndluow ecnetnes siht ,dehctiws erew eslaf dna eurt fo sgninaem eht fI" reversed = reversed[::-1] print(reversed) #Solution 2 def slowreve...
1262ad5057308e5a99f3ca4b617580be87c08307
green-fox-academy/FulmenMinis
/week-02/day-03/list01.py
404
3.796875
4
# Saturn is missing from the planet_list # Insert it into the correct position #Solution 1 planet_list = ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Uranus", "Neptune"] planet_list.insert (5, "Saturn") print(planet_list) #Solution 2 planet_list = ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Uranus", "Neptu...
42779b9007cb5d2901b2555c57ea6bd4239a3cf8
green-fox-academy/FulmenMinis
/week-02/day-02/factorio.py
194
4.1875
4
# - Create a function called `factorio` # that returns it's input's factorial def factorio(num): total=1 for a in range(1, num+1): total *= a return total print(factorio(5))
dccb568f3641f67654bdd50f53f9a1069bb41094
green-fox-academy/FulmenMinis
/week-03/day-03/starry_night.py
703
3.828125
4
from tkinter import * import random root = Tk() canvas = Canvas(root, width='300', height='300') canvas.pack() # draw the night sky: # - The background should be black # - The stars should be small squares # - The stars should have random positions on the canvas # - The stars should have random color (some shade of g...
bcba579d05ef897b3ec5da17706f145db18994b6
green-fox-academy/FulmenMinis
/week-02/day-02/sum.py
281
4.03125
4
# - Write a function called `sum` that sum all the numbers # until the given parameter #Solution1 def sum(num): total=0 for a in range(num+1): total += a return total #Solution2 def sum(*args): total = 0 for a in args: total += a print(total)
3c7361f73a5fdee8d31f86f9961ba5f5239060cb
green-fox-academy/FulmenMinis
/week-02/day-05/armstrong_number.py
1,108
4.4375
4
#Exercise # #Write a simple program to check if a given number is an armstrong number. # The program should ask for a number. E.g. if we type 371, the program should print out: # The 371 is an Armstrong number. # What is Armstrong number? # An Armstrong number is an n-digit number that is equal to the sum of the nt...
f06890de2b296a4144e4ddff76f4cd4d4a003a61
green-fox-academy/FulmenMinis
/week-05/pallida exam/unique_chars_test.py
625
3.625
4
import unittest from unique_chars import unique_characters class TestUniqueCharacters(unittest.TestCase): def test_empty_string(self): self.assertEqual(unique_characters(""), []) def test_one_word(self): self.assertEqual(unique_characters("anagram"), ["n", "g", "r", "m"]) def tes...
f0bcacd257e329b9376e7c1fbe00161b8772c248
chicolucio-python-learning/hacker-rank
/array_2d/array_2d.py
802
4.15625
4
def hourglass_sum(arr): """Return the maximum hourglass sum in a given array Parameters ---------- arr : array an array of integers Returns ------- integer The maximum hourglass sum in a given array """ sum_pattern = [] for line in range(len(arr) - 2): a...
64ee7fdbbb9f94ab27d04185d9269743bf40931e
ttiedt/Python_BellmanFord
/bellman_ford_tiedt.py
2,100
3.703125
4
''' Tyler Tiedt 4/1/19 Bellman Ford Algorithm CPCS 447 ''' import sys # sets up the bellman ford algorithm def init(graph, start_node): dist = {} prevNode = {} for node in graph: dist[node] = sys.maxsize prevNode[node] = None dist[start_node] = 0 return dist, prevNode # perfor...
eef3efc9d6fbb3a27978cd4bdbba4c680eee92b1
depecik/-rnekler
/PythonTemelleri/Fonksiyonlar3.py
1,404
4.15625
4
# say = input("Kontrol etmek istediğiniz sayıyı giriniz") # toplam = 0 # for i in say: # toplam += int(i)**(len(say)) # if toplam == int(say): # print("Armstrong Sayısı") # def sayiKontrol(*args): # toplam = 0 # sayi = "" # for i in args: # toplam += int(i)**(len(args)) # sayi+=i ...
3ceaf5c9c00b3a0b81df6f8f52f02d5617e67ffe
depecik/-rnekler
/PythonTemelleri/IfElse.py
889
3.78125
4
# a = int(input("Sayıyı Giriniz")) if not a%2==0 : print("Sayı Tektir") else: print("Sayı Çifttir") vize1 = int(input("I. Vize Notunuzu Giriniz")) vize2 = int(input("II. Vize Notunuzu Giriniz")) final = int(input("Final Notunuzu Giriniz")) Notu = round((vize1*0.3)+(vize2*0.3)+(final*0.4)) print(85*0.30) print...
0ce32b95a87250c09449924c27c2cb985e7ba050
milanoid/python-beyond-the-basics
/Section8/pytest/myprogram.py
508
3.734375
4
import sys def doubleit(x): if not isinstance(x, (int, float)): raise TypeError var = x * 2 return var def doublelines(filename): with open(filename) as fh: newlist = [str(doubleit(int(val))) for val in fh] with open(filename, 'w') as fh: fh.write('\n'.join(newlist)) if...
5a343c04cdb6cfb412c6089d3cff80b601f7f226
ShivaVkm/PythonPractice
/.vscode/pythonKeywordList.py
200
3.53125
4
# Today we will find the list of keywords in python programming language import keyword result = keyword.kwlist # kwlist is the property in python which gives you the list of keywords print(result)
8164ea4320540ca503dc3493c629c74666eeec1f
ShivaVkm/PythonPractice
/playWithTrueFalse.py
769
4.25
4
# True means 1 and False in 0 print(True) # you will get True print(False) # you will get False print(True+False) # you will get 1 because True = 1 and False = 0 print(True == 1) # verification for trueness' value as equal to 1 print(False == 0) # verification for falseness' value as equal to 0 print(True+True) print(...
43f2015be68b8585cd2ae861f1ee61835efd0835
ShivaVkm/PythonPractice
/singleInheritance.py
243
3.71875
4
class Animal: color = "white" def speak(self): print("Animal is speaking") class Dog(Animal): # color = "Brown" def bark(self): print("The dog is barking") d1 = Dog() d1.speak() print(d1.color) d1.bark()
ef5d36d0e22ecb53855fd42ccdbd87bf0212cf36
ShivaVkm/PythonPractice
/multipleInheritance.py
501
3.84375
4
class Animal(object): def __init__(self): self.name = "Horse" print("This is the animal class") class Dog(object): def __init__(self): self.nameOfDog = "Juju" print("This is the dog class") class Cat(Animal, Dog): def __init__(self): Animal.__init__(self) ...
4665ca8a4c41e3c877e79823851220d6881d0ef3
zahidul123/python_codes
/havingnewinPython/HowmanyPalindrome.py
765
3.9375
4
varRange=int(input("Enter the range of number: ")) varCountnumber=int(input("Counting number In Decimal point :")) if varRange is 1 and varCountnumber is 1: print("number of palindrome is 1") if varRange is 2 and varCountnumber is 1: print("number of palindrome is 2") if varRange and varCountnumber >= 2: if...
06d0fbab24d3254058ce17c8d96d8719bc0b8ca5
zahidul123/python_codes
/havingnewinPython/pythonpackages/pandasdataframe.py
1,265
3.984375
4
dict = {"country": ["Brazil", "Russia", "India", "China", "South Africa"], "capital": ["Brasilia", "Moscow", "New Dehli", "Beijing", "Pretoria"], "area": [8.516, 17.10, 3.286, 9.597, 1.221], "population": [200.4, 143.5, 1252, 1357, 52.98] } import pandas as pd brics = pd.DataFrame(dict) print(bric...
881544df5c42a68316c1cf46dd9d047837781495
andre205/CPSC230
/TAndrews_Assignment8/TAndrews_Assignment8.py
416
3.84375
4
#geometry.py #area of circle #circumference of a circle #volume of a sphere #volume of a cylinder import math def area(r): return math.pi * (r**2) def circumference(r): return 2 * math.pi * r def svolume(r): return (4/3) * math.pi * (r**3) def cvolume(r,h): return math.pi * (r**...
f769042760ac0607db204b194995d64e3f50cf2b
andre205/CPSC230
/TAndrews_Assignment1/TAndrews_Assignment1.py
525
3.96875
4
#Price with tax calculator with nested ifs pretaxprice=float(input("How much does the item cost?")) if pretaxprice >= 0: taxrate=float(input("What is the percent sales tax?")) if taxrate >= 0: taxdecimal=(taxrate)/100 posttaxprice=(pretaxprice)*(1 + taxdecimal) print("...
fa1ead85ec576a9d9f3f7595e855b0afcc5c2abc
rpt/project_euler
/src/problem001.py
597
4.1875
4
#!/usr/bin/env python3 # Problem 1: # 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. # Answer: # 233168 def problem1(n): def sumd(x, n): k = (n - 1...
5b066df24fa0f9c8e0e4e6713c851b33e59f50dd
rpt/project_euler
/src/problem005.py
834
3.734375
4
#!/usr/bin/env python3 # Problem 5: # 2520 is the smallest number that can be divided by each of the numbers # from 1 to 10 without any remainder. # What is the smallest positive number that is evenly divisible by all of # the numbers from 1 to 20? # Answer: # 232792560 from problem010 import erat...
2ff61339ec388d0d17068ad482594065c8e1ba13
CaioSouzaR/Gerador_Senha
/gs.py
1,139
3.546875
4
import random, string from tkinter import * # metodo gerar senha def gerador_senha(): tamanho = int(entrada_valor.get()) chars = string.ascii_letters + string.digits + 'ç!@#$%¨&*()-_=+;:' + '0123456789' rnd = random.SystemRandom() mostrar_senha["text"] = ''.join(rnd.choice(chars) for i in range(tam...
50e24a2c3469f779f96da1b588b970557b180d46
nafiz6/line-of-action-ai
/board.py
10,287
3.546875
4
import arcade from piece import Piece BLACK = 1 WHITE = -1 NONE = 0 SCREEN_WIDTH = 1024 SCREEN_HEIGHT = 768 TILE_WIDTH = 80 START_X = (SCREEN_WIDTH - TILE_WIDTH * 7) / 2 START_Y = (SCREEN_HEIGHT - TILE_WIDTH * 7 ) / 2 class Board(): def __init__(self, size): global START_X g...
3c5a6ec994c6ecca5994ead1967f3e49b68ee8c6
ddw02141/BOJ
/math/1676.py
336
3.59375
4
def factorization(x, num): exponential = 0 while x % num == 0: exponential += 1 x //= num return exponential if __name__ == "__main__": N = int(input()) fac2 = fac5 = 0 for i in range(1, N + 1): fac2 += factorization(i, 2) fac5 += factorization(i, 5) print(m...
2b23c2fc1d833eee27c5cc2a2d89b87bdb5b0c60
feliperojas/mision_tic_G11
/s11/11.7_condicionales_anidados.py
426
3.96875
4
numero_1 = int(input("Ingrese el numero 1:")) numero_2 = int(input("Ingrese el numero 2:")) if numero_1 == numero_2: resultado = numero_1 * numero_2 print(f"El resultado es: {resultado}") else: if numero_1 > numero_2: resultado = numero_1 - numero_2 print(f"El resultado es: {result...
131b4cf86a7397635444c706def806e4b4d2968d
feliperojas/mision_tic_G11
/s12/12.2_while_sumatoria.py
160
3.625
4
numeros = 500 contador = 100 suma = 0 while contador <= numeros: suma = suma + contador contador+=1 print("El resultado de la suma es:", suma)
92a3adf7ecb1add99a6e4af4439e75694eff7781
feliperojas/mision_tic_G11
/s22/22.4_tkinter_radio_button.py
1,153
3.703125
4
from tkinter import * # bloque de funciones def mostrar_mensaje(): nombre = info_entrada.get() opcion = seleccion.get() if opcion == 1: mensaje = "HOLA " + nombre elif opcion == 2: mensaje = "ADIOS " + nombre mensaje_salida.configure(text = mensaje) info_entrada.set("...
fa5db782ee165dcff854355785a0c3586197d8f1
feliperojas/mision_tic_G11
/s17/17.2_operadore_basicos.py
157
4.0625
4
numeros1 = [1,2,3,4,5] numeros2 = [1,2,5,6] print(numeros1 + numeros2) print(numeros1 * 3) print(numeros1 == numeros2) print(numeros1 <= numeros2)
6ace8d3c9b9532387765af5af0946ba399615d4e
feliperojas/mision_tic_G11
/s13/13.7.1_for_cantidad_numero_par.py
814
3.9375
4
numeros_guardados = [] suma = 0 numeros_almacenar = int(input("Digite la cantidad de numeros que desea almacenar: ")) # Valido que el usuario ingrese un numero mayor que 0 while numeros_almacenar <= 0: print("Por favor ingrese un numero positivo") numeros_almacenar = int(input("Digite la cantidad de...
17775b90c4c481fc479e5567c87965b4a7bf911f
feliperojas/mision_tic_G11
/s19/19.2_try_except.py
427
3.734375
4
numeros_cedula = [1,2,3,4,5,6,7,8,9,10] try: print(contador) except: print("Ocurrio un error") try: numero = int (input("Digite un numero")) except: print("Ocurrio error de tipo de dato") try: print(len(numeros_cedula)) print(numeros_cedula[15]) except: print("Ocurrio un...
423255b6c464d68e2aa7cf6ce7c0877e714fd345
feliperojas/mision_tic_G11
/s12/12.3.1_while_validar_intentos.py
416
3.8125
4
MAXIMOS_INTENTOS = 3 password = "1234" contador = 0 intento = input("Ingrese su contraseña: ") if intento == password: print("Trasaccioín existosa") else: while(contador < MAXIMOS_INTENTOS): intento = input("Ingrese su contraseña: ") if intento == password: print("Trasa...
72e3ae9b7a0808a20a3ec062f482e9b449a0ece5
feliperojas/mision_tic_G11
/s13/13.2_for_sumador.py
162
3.734375
4
suma = 0 print("Vamos a sumar los numero 1-10") for numeros in range(1,11): suma = suma + numeros print(f"La suma de los numeros de 1-10 es {suma}")
b52d0c0a4d9e2bbfdaf9e535f734d57f264ce467
feliperojas/mision_tic_G11
/s24/25.6.1_obtener_data_columnas.py
328
3.859375
4
import sqlite3 conexion = sqlite3.connect("db/datos1.db") print("Conectado exitosamente") cursor = conexion.cursor() cursor.execute("SELECT id, nombre from empleados where salario >300 and salario < 1450") data = cursor.fetchall() ''' for info in data: print(info[1]) ''' [print(linea) for linea ...
e6ab0440e1390620c1e59c4de5c23cb14b53f584
feliperojas/mision_tic_G11
/s5/1.4_tipos_datos.py
815
4.0625
4
"""Realizar un programa que simule a una persona que saluda a otra persona, deben solicitar que el usuario ingrese nombre, apellido, edad comida favorita y color favorito. El sistema debe imprimir dos mensajes 1 Salundado al usuario, 2 Diciendo algun comentario referente a la comida y al color ingresado""" print("...
303c154afaa831b39882865c536de7666c8af7c3
JiungChoi/NeuralNetworkOnColab
/regressionFunc2.py
914
4.21875
4
import matplotlib.pyplot as plt import numpy as np ## 입력 데이터 x의 개수 만큼 반복함 def cost(x, y, w): c = 0 for i in range(len(x)): hx = w*x[i] c = c + (hx -y[i])**2 return c/(len(x)) x_data = [1, 2, 3] y_data = [1, 2, 3] plt.plot(x_data, y_data, 'ro') plt.show() print(cost(x_data, y_data, -1)) print(cost(x_...
0e31adffb5307465a9cb5ed761338b2170089f44
devsbranch/ehc-bc-py38-25-10-2020
/coursework_submissions/first_steps_the_curious_mind_00/felix_course_00_workpaper_09.py
3,406
4.53125
5
# Numbers: """ Numbers are objects that hold value and can be classified as integers or float """ # Strings: """ A string is a sequence of aphabetic characters. """ # List: """ A list is a collection of items which can be changed or ordered """ # Tuples: """ Tuples are a collection of oredered items whic...
568801afbd4cbc9a584c44f96407d08b125e3706
devsbranch/ehc-bc-py38-25-10-2020
/coursework_submissions/the_bird_that_goes_far_and_never_returns_01/Jachin Manda - assignment 2 - submission.py
9,281
4.5
4
""" Hey guys this is my example algorithm I prepared to help our friend Bessy with her last request. - download the chinook database - locate the database download location/ where i placed it - copy the pathname for the database - store the database pathname in a variable of my choice - prepared an SQL query to get emp...
6dcd995d6698f222d4fa89a77975d85bbbc32a2d
quocphan99/Algorithm
/Backtracking/eight-queen.py
1,542
3.875
4
horizontal = [False, False, False, False, False, False] diagonal_1 = [False, False, False, False, False, False, False, False, False, False, False] diagonal_2 = [False, False, False, False, False, False, False, False, False, False, False] result = [-1, -1, -1, -1, -1, -1] length = 6 # def queen(i, flag): # j = 0 ...
323da2d0ca9709ec40988893cad83b84457db7da
SergeySysoev386/python
/hw4-4.py
226
3.625
4
parent_list = [2, 2, 2, 7, 23, 1, 44, 44, 3, 2, 10, 7, 4, 11] child_list = [el for el in parent_list if parent_list.count(el) < 2] print(f'Элементы списка, не имеющие повторений: {child_list}')
4a7935d48b3f8e89563f85dd7d0d1ef2868ebaca
ko-tech/pythone-dev
/Chapters 2 - 4/pizzas.py
1,300
3.84375
4
# 4.1: Pizzas def pizzas(): pizzas = ["pepperoni pizza", "meat-lovers pizza", "hawaiian pizza", "veggie pizza"] for pizza in pizzas: print(pizza.title() + " is delicious\n") print("\n\nThese are all my favorite pizzas") # 4.2: Animals def pets(): animals = ["goldfish", "dogs", "cats", "sn...
292cc1e28a6615ac04e76cab0a981ea0d2437bc7
ko-tech/pythone-dev
/Chapters 2 - 4/Seeingtheworld.py
565
3.78125
4
# 3.8: Seeing the world places = ["russia", "australia", "netherlands", "japan", "brazil"] print(places) print("\nThis is the list in alphabetical order") print(sorted(places)) print("\nThe original list") print(places) print("\nThis is the list reversed") places.reverse() print(places) places.reverse() print("\nThis...
26fc1c3a3cdf22596abb2a01cb173f789b04df2b
ko-tech/pythone-dev
/Chapter 5/Conditional Tests.py
1,933
3.84375
4
# 5-1: Write a series of conditional tests. def conditional_test(): car = "challenger" print("Is car == 'challenger'? I predict True") print(car == "challenger") print("Is car == 'charger'? I predict False") print(car == "charger") food = "pasta" print("\nIs food == 'pasta'? I predict Tru...
5c276bb25f152e8fdac6a5baf1caa2c6584aa668
douglascorrea/learning_python
/mit_book/s_3_2_for_loops.py
318
3.9375
4
""" Implementing it withou use string function to split it into a list of numbers """ s = input('Input a list of numbers separated by comma: ') acc = '0' total = 0 for n in s: if n != ',': acc = acc + n else: total = total + float(acc) acc = '0' total = total + float(acc) print(total)
9a33538b6c30cd1a914e289e9b1066d451b4aaea
mvp18/Machine-Learning-Assignments-in-Python
/scripts/Perceptron/perceptron.py
2,232
3.546875
4
# Execute as 'python3 perceptron.py' import numpy as np # Data Loading dataset = np.genfromtxt('./data6.csv',delimiter=',') test_data = np.genfromtxt('./test6.csv',delimiter=',') num_attributes = dataset.shape[1]-1 X_train = [dataset[i][:num_attributes] for i in range(len(dataset))] y_train = [int(dataset[i][-1]) fo...
973f7fb9badadbe5a11ed3c69f4e504936e27e49
dianayuying/Python
/CodeWars/SecondsTimeConversion.py
185
3.71875
4
""" Convert seconds to hh:mi:ss format """ def make_readable(seconds): return str(int(int(seconds/60)/60)).zfill(2)+":"+str(int(seconds/60)%60).zfill(2)+":"+str(seconds%60).zfill(2)
f7cf35fdda21f7d188dcd709c7c202cbce05eafa
Matroskin-omgtu/omgtu_practic
/app.py
140
4.03125
4
print('Hello world') for n in range(100): print("iteration: {}".format(n+1)) if (n+1) % 2 == 0: print('This even iteration')
f23bb8d8860a8211169cbd212e5c0e4acd80be16
CXZ7720/SE-LAB-training
/training 1.py
217
3.8125
4
def main(): a = input() if int(a) == 1: print("Yeonggyun Kim") find2(a) def find2(input): if int(input) == 2: print("Hello. My name is Yeonggyun Kim. I'm 25 years old and I live in seoul.") main()
4c4a0bbca410c0388d42abe95322c047f78b30f3
zz3430gs/Py_Game_RPG
/graphics/pcdungeon.py
998
3.5625
4
'''This is my attempt at a procedural dungeon generator, once one is made, blitting it to the suface should be pretty e4asy. this file will be full of classes for the purpose of creating this dungeon... no idea how it will go.''' import math class Room: # room coordinates # TILE SIZE WILL ALWAYS BE 25px d...
609be722d708afcfbb8f4ebf0b081b1f006df23b
vshashankrao/python-projects
/project 3/test_time.py
2,935
3.953125
4
""" Object Oriented Programming, Spring 2019 Test module for Homework 3, Problem 2 """ from problem2 import Time if __name__ == "__main__": t1 = Time() t2 = Time(2, 30, "am") t3 = Time(10, 10, "am") t4 = Time(12, 0, "pm") t5 = Time(12, 15, "pm") t6 = Time(2, 0, "pm") t7 = Time(3, 12, "pm")...
62e38e1793f97ef518b8294d165f8a65def4a1fc
Momin-C/LeetCode
/35 Search Insert Position.py
424
3.75
4
#PROBLEM 35 #SOURCE: https://leetcode.com/problems/search-insert-position/ def searchInsert(nums, target): if target in nums: return nums.index(target) else: if target<nums[0]: return 0 if target>nums[-1]: return len(nums) for i in range(0,len(nums)-1): ...
782ef335c90528611eea033bf7be27a19c594796
Momin-C/LeetCode
/1304 N Unique Integers Summing to 0.py
260
3.65625
4
#PROBLEM 1304 #SOURCE: https://leetcode.com/problems/find-n-unique-integers-sum-up-to-zero/ n = 3 def sumZero(n): lst = [] if n%2 != 0: lst = [0] for i in range (1,int(n/2)+1): lst.extend([i,i*-1]) return lst print (sumZero(3))
48513ac461e87f4861db2bd4177360a5a0e37bf9
Momin-C/LeetCode
/557 Reverse Words in String III.py
321
3.890625
4
#PROBLEM 557 #SOURCE: https://leetcode.com/problems/reverse-words-in-a-string-iii/ s = "Let's take LeetCode contest" #s'teL ekat edoCteeL tsetnoc def reverseWords(s): mod = s.split(" ") string = "" for i in range(len(mod)): string+=mod[i][::-1] + " " return string.strip() print (reverseWords(s))...
a00f7008869fd2e9370bc46314554eefa46f233e
twilight21/Inflastudy
/inflastudy/time_tools.py
1,771
4.0625
4
# -*- coding: utf-8 -*- """ Author: Camilla Nore Date: 2015-09-04 """ # Tools to get timedifferences in quarters import numpy as np import pandas as pd def year_quarter_to_datetime(year, quarter): """ Convert year and quarter strings to a numpy datetime. This will come in handy when we want to compare tim...
f746de4262b1c9f975a55ee02581b7a873ce1146
tglaza/Automate-the-Boring-Stuff-with-Python
/while_break_yourName_input.py
514
4.28125
4
#this is similar the first yourName program, except it uses a break to end the program #break statements are useful if you have several different places in a while loop that would allow you to leave from that point name = '' while True: #this would never be False so it's an infinite loop because it's always True ...
0e6003ec7f2584da91bd4fe119b8013b23d8b88d
willcosta45/cursogit
/python/praticas_bucles.py
520
3.796875
4
#contador=0 #email=False #miEmail=input("Introduce tu direccion de email: ") #for i in miEmail: #if(i=="@" or i=="."): # contador=contador+1 #if contador==2: # print("Email es correcto") #else: # print("El emailno es correcto") #for i in range(5,50,3): # print(f"valor de la variable {i}") ...
56a7c5cca95932245af50bec0b440ba0e9456def
willcosta45/cursogit
/python/ejercicio_1.py
289
4
4
num1=(int(input("introduce el primer numero"))) num2=(int(input("introduce el segundo numero"))) def Devuelvemax (n1,n2): if n1 < n2: print(n2) elif n2 < n1: print(n1) else: print("son iguales") print("El numero mas alto es ") Devuelvemax(num1,num2)
22ffb3ef660c08f0ce89483a5da23416407dcc59
Aurobinda811/snake-water-gun
/snake-water-gun.py
2,388
3.90625
4
print(" \t\t\t Welecome to Snake , Water , Gun game\n\n") import random attempts= 1 your_point=0 computer_point=0 while (attempts<=10): lst=["snake","water","gun"] ran=random.choice(lst) print("what do you choose snake, water or gun") inp=input() if inp==ran: print("tie") prin...
3caa06220975d573f9400da144c54c853555addc
robbailiff/database-operations
/sqlite_functions.py
1,920
4.84375
5
""" Here is some practice code for using the sqlite3 module with Python. Here I was experimenting with applying functions in SQLite statements. I have included comments throughout explaining the code for my own benefit, but hopefully they'll help someone else too. Hope you like the code. Any tips, comments or genera...
c09ddf5468098443586349d55a599be68ef82b99
janFrancoo/Python-Projects
/Library Application with Database/main.py
1,028
3.65625
4
import time import dbLibrary print("""*********************************** Welcome to the Library Application Processes: 1. Show books 2. Find a book 3. Add a book 4. Delete a brook Enter 'q' for quit. ***********************************""") lib = dbLibrary.Library() while True: process = input("Process: ") ...
44e86526ccf17448b2cd542ef8e4fdb0b76715d4
abhishek2chikun/200daysofdsa
/Day 19 deque as Linked List.py
2,440
3.9375
4
class Node: def __init__(self,data=None): self.data=data self.next=None class deque: def __init__(self): self.head=None self.tail=None def enqueue(self,element,res="nr"): element=Node(element) if self.head is None: element.next=self....
70eef0f3c86499e4b3a9f66960333941c3f373ad
abhishek2chikun/200daysofdsa
/Day 16 Stack as Array and Linkedlist.py
1,739
4.09375
4
#Creating a Stack through array #Creating stack function def createstack(): stack=[] return stack def isEmpty(stack): return len(stack)==0 def push(stack,item): stack.append(item) print(item,"is pushed to you stack:",stack) def pop(stack): if isEmpty(stack)==True: print("\nSt...
6a09a4def49b5bd77b1d7c9c6f4470784fd323f9
abhishek2chikun/200daysofdsa
/Day 17 MinMaxStack using array.py
1,254
4.09375
4
#Using Array MixMaxStack class minmaxstack: def __init__(self): self.minmax=[] self.stack=[] def peek(self): return self.stack[len-1] def pop(self): if len(self.stack)==0: print("Stack is empty Insert Item") else: self.minmax.pop() ...
97076107939d10ae012100d4090666c9743fea07
abhishek2chikun/200daysofdsa
/Day 23 Full binary tree.py
683
4
4
class Node: def __init__(self,data,left=None,right=None): self.data=data self.left=left self.right=right def is_Full(root): if root is None: return True if root.left is None and root.right is None: return True if root.left is not None and root.right is n...
2c6366884a7b8881e6f2cb838f52ceac78b34a44
Guima01/black-pendant
/main.py
1,228
3.6875
4
""" Platformer Game """ import arcade # Constants SCREEN_WIDTH = 1000 SCREEN_HEIGHT = 650 SCREEN_TITLE = "Black Pendant" SKULL_SCALING = 1 class MyGame(arcade.Window): """ Main application class. """ def __init__(self): # Call the parent class and set up the window super().__init__...
dbce17ea7cf614435436b86a3af728bf39d7bdf1
najoven/algorithm
/SWEA/D2/200806 4839 이진탐색/4839.py
734
3.578125
4
import sys sys.stdin = open('input.txt', 'r') T = int(input()) def bin_search(P, key): arr = range(0, P+1) start = 1 end = len(arr) - 1 count = 0 while start <= end: middle = int((end+start)/2) count += 1 if key == arr[middle]: return count elif key < ...
0e0aab6a4379351f14faa72761b9803c058b5898
ccc117/py
/test2.py
393
3.578125
4
lst=[10,40,30] tp=('a','b','c') dt=dict(zip(tp,lst)) print(dt) for i in lst : print(i,end=' ') print() for i in tp : print(i,end=' ') print() for i in dt : print(i, "=>", dt[i]) print(len(dt)) print(max(lst)) print(max(tp)) print(max(dt)) print(min(lst)) print(min(tp)) print(min(dt)) print(sum(lst)) #print(...
2eac5987b8f4c73c94f50ca9d1bae726d5ad6759
ccc117/py
/test.py
274
3.984375
4
x='hello python!' print(len(x)) print(x[len(x)-1]) print(x.count('o')) print(x.count('py')) print(x.count('py')) print(x.find('py')) print(x.find('py')) print(x.index('py')) print('-'.join(x )) print(x.upper()) print(x.lower()) print(x.replace('py','p')) print(x.split(' '))
b52a2655ff51a8871fbe66f00b8e0c7edc5443c8
yuanhuan2005/python27
/my/my_class.py
798
3.796875
4
#!/usr/bin/env python class MyUser: def __init__(self, user_id=None, username=None, age=0): self.user_id = user_id self.username = username self.age = age user_id = None username = None age = 0 def get_username(self, user_id): if user_id == self.user_id: ...
e9392be67ccbea2550b6fa3ad45d7744793f2f0a
gsnidero/snorkel
/snorkel/labeling/lf/core.py
3,894
3.59375
4
from typing import Any, Callable, List, Mapping, Optional from snorkel.preprocess import BasePreprocessor from snorkel.types import DataPoint class LabelingFunction: """Base class for labeling functions. A labeling function (LF) is a function that takes a data point as input and produces an integer labe...
f6e9058b2851fb2499d47970a74fb78b6b067d65
dtransposed/Cracking-The-Coding-Interview
/Chapter_6-Math-and-logic-puzzles/7-TheApocalypse.py
1,211
3.796875
4
from random import random class PopulationSimulation(): def __init__(self, no_families): self.is_boy = None self.family = None self.population = no_families def boy_or_girl(self): if random() > 0.5: self.is_boy = 1 else: self.is_boy...
4933a20d4ee137991b4b6af0613a248d81d28e54
rrsalian16/Machine-Learning
/Numpy/rref.py
1,377
3.78125
4
import numpy as np def row_echelon(A): """ Return Row Echelon Form of matrix A """ # if matrix A has no columns or rows, # it is already in REF, so we return itself r, c = A.shape if r == 0 or c == 0: return A # we search for non-zero element in the first column for i in range(le...
eabf324b210dc32321e34519dffdd0b762b9b30c
liuxinyuanxy/supercalculator
/super.py
3,995
3.515625
4
import math import os def clear():os.system('cls') def fac(x): s = 1 for i in range(x): s = s * (i + 1) return s os.system("color F0") os.system("title supercalculator --code by liuxinyuan") print("这是一个超级计算器,克服了传统计算器拥有范围限制的弊端,但如果计算量过大(如1e10000以上的运算)仍会使计算出错甚至导致程序崩溃") print("每次计算完成后,请输入exit退出程序,或按回...
047b5a1915a5056087bd6dae77e9ef448e144ce6
Itggot-Lucas-Glimfjord/euler
/14.py
1,113
4.03125
4
""" The following iterative sequence is defined for the set of positive integers: n --> n/2 (n is even) n --> 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 --> 40 --> 20 --> 10 --> 5 --> 16 --> 8 --> 4 --> 2 --> 1 It can be seen that this sequence (starting at 13...
bce4fa8e5de6532bf9ccf127c3bb8966cccb9457
mehul-k/ntu-foodbev
/Locations.py
4,336
3.65625
4
## width = 1400 height = 750 # This Dictionary contains the name of canteens as its keys and lists of data as its values. # each key will be the canteen's name while the value of the key will contain a list # each list = [coordinates of canteen in a tuple , tuple containing average price of each food at canteen, a li...
b8e33d7680affba72f34f2d8ba64cb09f10cafc3
lgoodridge/Asteroids-AI
/ai/ai_player.py
2,149
3.578125
4
from asteroids.player import Player class AI_Player(Player): """ Defines the player ship, controlled by an AI. """ # Size of the decision vector DECISION_VECTOR_SIZE = 4 def __init__(self, x, y, ai_brain): super(AI_Player, self).__init__(x, y) self._brain = ai_brain def sen...
43d180dea65f2b5d65ec2da20c6524b0e42047c5
mareaokim/hello-world
/03_8번Gregorian.py
456
4.1875
4
def main(): print("Gregorian epact value of year.") print() year = int(input("Enter the year (e.g. 2020) : ")) c = year // 100 epact = (8+(c//4) - c + ((8*c+13)//25) + 11 * (year % 19)) % 30 print() print("The epact value is" , epact, "days.") main() >>>>>>>>>>>>>>> ...
d0a504f3603a3c9471c2826dd00cada6044f1a21
mareaokim/hello-world
/03_3번weight.py
700
4.28125
4
def main(): print("This program calculates the molecular weight of a hydrocarbon.") print() h = int(input("Enter the number of hydrogen atoms : ")) c = int(input("Enter the number of carbon atoms : ")) ox = int(input("Enter the number of oxygen atoms : ")) weight = 1.00794 * h + 12.01...