blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
55ee8937042be5492d54ff6fd8dcc533508a882f
Sannso/Cosas-de-python
/Python/noveno_archivo_POO_herencia2.py
1,219
3.953125
4
class Persona(): def __init__(self, Nombre, Edad, Lugar_de_recidencia): self.Nombre = Nombre self.Edad = Edad self.Recidencia = Lugar_de_recidencia def Descripcion(self): print ("\nNombre: " + self.Nombre + "\nEdad: " + str(self.Edad) + "\nLugar de recidencia: " + self.Recidenci...
f0d87f8fbd7479a0561cc22f930eab4f91558754
Sannso/Cosas-de-python
/Python/CompuGrafica/pruebaspygame/plano/mymain.py
1,215
3.75
4
import pygame as pyg from fileslib.libreria import * if __name__ == "__main__": pyg.init() pantalla = pyg.display.set_mode([ANCHO,ALTO]) drawplano(pantalla) pyg.draw.circle(pantalla, [250,0,0], getplanopos(-50,50, [2,2], CENTRO), 10, 1) #drawrect(pantalla, "recta", -200, 200) # ---- Dibujo d...
8f61573b28ea695b946975dc990335950d61b34e
Sannso/Cosas-de-python
/Python/archivos_externos/punteros_seek_archivos_externos.py
1,689
3.703125
4
# Cuando se habre un archivo el puntero se encuentra en el principio de todo, # y cuando se lee el archivo el puntero se ubica en la parte final de todo, # con seek, nosotros podemos elegir el lugar en donde se va a ubicar el puntero archivo_texto=open("archivo.txt", "r") print(archivo_texto.read()) #print(archivo_te...
8229ac3352d9476a206a5874e36863b5a64df0f6
Sannso/Cosas-de-python
/Python/Parcial_II/MontoVeinte.py
661
3.59375
4
from AbstractRetirarMonto import * class MontoVeinte(AbsRetirarMonto): def __init__(self): self.__denominacion = 20000 self.__cantidad = 2; def retirarMonto(self, monto): dineroR = int(monto) if((dineroR/self.__denominacion) >= 0): contador = 0; for x in range(1,3): if((dineroR-self.__denominacio...
37542e9c631e01bf80a3f8e000eb335b5f95036e
Sannso/Cosas-de-python
/Python/graficos/labels.py
970
3.609375
4
from tkinter import * """ Label sintax: variableLabel= Label(contenedor, opciones) opciones: Text, Anchor, Bg, Bitmap, Bd, Front, Fg: color de fuente, width, height, image, justify... """ raiz = Tk() raiz.title("ventana de pruebas") raiz.config(bg="yellow") raiz.iconbitmap("gato.ic...
3988f2ef4fc2eed9d9bce829df6257f0b67e748b
Sannso/Cosas-de-python
/Python/tercer_archivo.py
628
4.03125
4
valor= int(input("Introduce un valor cualquiera: ")) valor2= int(input("Introduce el segundo valor: ")) print("El valor fue: ", valor + valor2) # prueba de in print("") print("-- Sistema de eleccion de asignaturas --") print("Asignaturas: Matematicas - Español - Laboratorio de física") eleccion = input("Escoja la as...
8ed80626633a50181dcf5e489f1b61e6d76e1915
Mizzzo/search-algos-comparison
/binary_search.py
619
3.5625
4
def create_data(n): temp = [i for i in range(n)] return temp n = 100 target = n + 11 ma_list = create_data(n) def binary_search(input_list,target): found = False low = 0 high = len(input_list) - 1 mid = int((high + low) / 2) while (low <=high) and (not found): curr = input_list[mi...
fceb408e92c1ef6a32b8d93854794fef5af3d369
ashrithathmaram/Python
/Sum_of_natural_numbers.py
429
4.25
4
print "Input a number 'n' to find the sum of the first 'n' natural numbers" try: n = int(raw_input("Number: ")) x = 0 for val in range(1, n+1): x = x + val print x except ValueError: print "Please input a number" print "Input a number 'n' to find the sum of the first 'n' natural numbers" try: n = int(...
42496cf3840efed2d6cc512dad7a54a63683246d
ashrithathmaram/Python
/prime_checker.py
367
4.21875
4
print "Is it a prime number?" try: x = int(raw_input("Number: ")) for val in range(2, x): y = float(float(x)/val) if (y == int(y) and y > 1): print "This number is not prime" break if (x != 1 and x != 0 and x > 1): print "This number is prime" else: print "This number is not prime" except ...
47e3615980a136e4ac41c1d385c505d4501aa946
cha63506/archive-328
/python/pic.py
412
3.640625
4
#!/usr/bin/python import Image from random import choice def MakeKey(): img = Image.new('RGB', (256, 256), 'white') # create new white image (256x256) pixels = img.load() # create the pixel map for i in range(img.size[0]): # for every pixel: for j in range(img.size[1]): pixels[i, j] =...
0557eed76111f396a69a229610ee4b5844afbd52
halilcanmetu/ProgrammingAssignments
/SplitPDF-odd-reversedeven/Odd_ReverseEven_PDF.py
1,009
3.625
4
#!/usr/bin/python3 from PyPDF2 import PdfFileReader, PdfFileWriter pdf_document = "X.pdf" pdf = PdfFileReader(pdf_document) # Output files for new PDFs output_filename_even = "even_reversed.pdf" output_filename_odd = "odd.pdf" pdf_writer_even = PdfFileWriter() pdf_writer_odd = PdfFileWriter() # Get r...
fb83f85cbe9bbd91a0255618d715631fccf812bc
elsa-k-donovan/WallBreakers
/Week_2/2_Multisets/FindAllAnagramsInAString.py
465
3.71875
4
class Solution: def findAnagrams(self, s: str, p: str) -> List[int]: """ Find solution with multiset and without multiset """ #compare counts of characters rather than calculating anagrams #counter of p charCount = collections.Counter(p) ...
c2a3f87f7ede1977cd0ecf687d97d3c5b048f442
MrElectro1/Python_Class
/7.1Dictionaries.py
515
3.8125
4
#Eric Hayden 05/02/2021 try: #Dictionary price= { 'TSLA': '710', 'NIO': '40', 'PLUG': '30', 'UBER': '55', 'TLRY': '20', 'PLTR': '23', 'LYFT': '56', 'AAPL': '132', 'LAZR': '23', 'PFE': '39' } Ticker= input('Please enter the t...
cdcb0d6faea481f87004cae8c97cc9f714927c05
MrElectro1/Python_Class
/PythonFiberOpticPartTwo.py
1,012
4.15625
4
# Eric Hayden 03/25/2021 # Introdusing the software, telling the customer the pricing print("Hello welcome to Fiber Optic Inc.") print("The pricing of our fiber optic cabling starts at $0.87/ft but is discounted if bought in bulk. the bulk pricing is 101ft to 250ft is $0.80 per foot, 251ft to 500ft is $0.70, and more t...
9bba34d441a231ff031de2a95b94af9cf47b555c
manhcuogntin4/Code_Gym
/poem.py
405
3.84375
4
def split_poem( poem ): return poem . split ('\n') def reverse_line( st ): s ="" for i , c in enumerate( st ): s += st [len( st )- i -1] return s def reverse_poem(poem): # Your code goes here lines = split_poem ( poem ) #print(lines[n-1]) result=[] for line in lines: s= reverse_line(line) result.append(s)...
3a806b4890413080714cba1e7c7b508e7bcfeb2b
manhcuogntin4/Code_Gym
/Iterables and Iterators.py
2,008
4.09375
4
''' The itertools module standardizes a core set of fast, memory efficient tools that are useful by themselves or in combination. Together, they form an iterator algebra making it possible to construct specialized tools succinctly and efficiently in pure Python. To read more about the functions in this module, check o...
c2d52666784b4bcb1cdfc1cca13e9f353af50ee0
student-work-agu-gis2021/lesson4-functions-and-modules-kaitoagu
/temp_functions.py
756
3.609375
4
def fahr_to_celsius(temp_fahrenheit): """ Function for converting temperature in Kelvins to Celsius Paramaters --------- fahr_to_celsius:<numerical> converted temperature in celsius Returns --------- <numerical> classified numbers """ converted_temp=(temp_fahrenheit-32)/1.8; return converted_temp def temp_class...
3f1269f04de8224deb83530cc825a783004d4479
Lucas4dum/Lista3python
/exercicio1.py
970
4.375
4
# Escreva um programa que leia uma matriz de ordem 3 x 5 de elementos inteiros, # calcule e mostre na tela: # a) menor número da matriz; # b) soma dos números múltiplos de 3 da matriz; # c) maior número da 3ª coluna da matriz (índice 2); # d) média dos números da matriz; import random matriz=[] total3=media=total=0 f...
e704c2a538a11ee956fabf2d6edd98f8defd0f73
harveylabis/ECE-bot-review
/fetch_item.py
1,406
3.671875
4
"""FETCH QUESTIONS, CHOICES, AND KEY ANSWER WITH GIVEN ID This program will fetch an item from questions in json file, given question id. author: pororomero created: 7/18/2021 """ import json import sys topics_links_filename = "queLinks.json" def open_a_file(filename): try: with open(filename, 'r') as f...
da741ce7a38e582b2dcdaa7dfe9216423f59e085
MoMaT/slides
/2018/may/code/random_bot.py
352
3.671875
4
import random from collections import namedtuple Move = namedtuple("Move", "board square") def read_move(): return Move(*map(int, input().split())) def write_move(move): print(move.board, move.square) while True: enemy_move = read_move() count = int(input()) moves = [read_move() for i in range(count)] w...
ff9f101f96cdadf9f2420f036006eae02cec4c85
elandt/devTools
/python/learning_python/Ch3/calendars_start.py
1,628
4.3125
4
# # Example file for working with Calendars # # import the calendar module import calendar from datetime import date # create a plain text calendar today = date.today() cal = calendar.TextCalendar(calendar.SUNDAY) st = cal.formatmonth(today.year, today.month, 0, 0) print(st) cal = calendar.TextCalendar(calendar.MOND...
975a1d91c481baac03d2c9c938c3d076c7cd2cf9
elandt/devTools
/python/python_essential_training/Chap03/sequence.py
1,167
4.4375
4
#!/usr/bin/env python3 # Copyright 2009-2017 BHG http://bw.org/ print('This is a List') # lists are mutable and use [] x = [1, 2, 3, 4, 5] for i in x: print(f'i is {i}') print('This is a Tuple') # tuples are immutable and use () y = (5, 4, 3, 2, 1) for i in y: print(f'i is {i}') print('This is a Range') # ra...
d1afd9b3cc24d160089916f76c1b1d13bc440cea
elandt/devTools
/python/python_essential_training/Chap02/blocks.py
185
3.859375
4
#!/usr/bin/env python3 # Copyright 2009-2017 BHG http://bw.org/ # Blocks don't define scope. x = 42 y = 73 if x < y and y == 73: print('x < y: x is {} and y is {}'.format(x, y))
a76f4a8a015a1541d6a2b81a8e3164f46f0e9be7
elandt/devTools
/python/python_essential_training/Chap13/types.py
206
3.515625
4
#!/usr/bin/env python3 # Copyright 2009-2017 BHG http://bw.org/ x = '47' # y = float(x) # y = complex(x) y = int(x) print(f'x is {type(x)}') print(f'x is {x}') print(f'y is {type(y)}') print(f'y is {y}')
1de4c96b6f16ae17c5c6af8385b281215fd10d1e
kauwelab/cubap
/readme/README_makeAllelePopKey.py
1,618
3.625
4
########################## Make Allele Population Key File makeAllelePopKey.py Created by: Matt Hodgman Email: matthodg@byu.edu ########################## Purpose: to make a file that links to the main codon usage bias file and stores the population information for each allele, i.e. how many individuals from each...
f8a3c02661f06512c18703f03bbb5542f868a75b
hitzqt/python3
/RockPaperScissors.py
1,105
4.125
4
#! /usr/bin/python3 flag=True playRound=1 types={'rock','paper','scissors'} while flag: decision1=input('player 1 please make a dicision within rock, paper or scissors:') while not decision1 in types: decision1=input('wrong input, only accept rock, paper or scissors:') decision2=input('player 2 please make a dici...
b682743aa7f407d058af4c3fc7d7f551d41e3657
Vinoth1195/Machine-Learning
/Predictinghouseprice/optimize.py
454
3.625
4
import numpy as np from costfunction import costfunction1 def optimize(x,y,Theta,alpha): for i in range(1499): m = x[:, 0].size h = np.matmul(x, Theta) diff = np.matmul(np.transpose(x),(h-y)) Theta = Theta-(alpha*(1/m)*diff) #print(j) ...
b6a7a5604d5ea50a60a127b0bc66b0ee5a4cd93b
MertBurma/CharacterRecognitionUsingMoments
/Character Recognition/Character Recognition.py
9,610
3.578125
4
from PIL import * from PIL import Image import numpy as np import math from PIL import Image, ImageDraw from PIL import Image from PIL import ImageFont from PIL import ImageDraw from PIL import ImageEnhance def main(): img = Image.open('sayılar.jpg') img_gray = img.convert('L') # converts the image to graysca...
281f2ab0a304ec6f775f679e1013e7d92c6c7b2a
joaolucas1337/Jogo-da-Adivinha-o-em-Python
/Jogo da Adivinhação.py
716
3.6875
4
from random import randint pc = randint(0, 10) print('Tente me ganhar... Acabei de pensar em um número de 0 a 10!\n') print('Será que você consegue me ganhar?\n') chutes = 0 while True: player = int(input('Qual seu palpite? ')) chutes += 1 if player == pc: print("Parabéns, você me v...
3c4bb86f122809366b6baebc7d80e967d14b12e0
Jenko-gpu/Jenko-gpu
/TimeFinder.py
2,207
3.765625
4
class Time: def __init__(self,hours=0,mins='00'): self.__hours = str(hours) if mins==0: mins="00" self.__mins = str(mins) def __str__(self): return self.__hours+":"+self.__mins class Date: def __init__(self,day,month): self._day=str(day) sel...
9dec3a199856ac45517a1d303b80c5d6cb90cb1a
vongola12324/SortComparison
/quick.py
598
3.515625
4
def sort(data): if len(data) <= 1: return _sort(data, 0, len(data)-1) def _sort(data, left, right): if left < right: pivot = partition(data, left, right) _sort(data, left, pivot - 1) _sort(data, pivot + 1, right) def partition(data, left, right): pivot = (left + right...
7eef4d494e0f0f1d931907f8685f16e22abbbdbe
zhannaseitova/week8
/3rd/cycle_c.py
93
3.609375
4
a=int(input()) b=int(input()) int x for x in range(a, b): if x = ceil(sqrt(x): print(x)
5b1edbea9ee56c87ec4bce7d3627d3006d37ce0d
zhannaseitova/week8
/3rd/while_d.py
79
3.828125
4
n = int(input()) while n>= 2: if n/1 ==2: print('YES') else: print('NO')
b7703168b71f9086f11e38ee3b09aa903ab25a2f
JackMc/advent_of_code
/day2/solution.py
500
3.84375
4
from collections import Counter def has_three_letters(str): c = Counter(str) return len([k for k in c if c[k] == 3]) > 0 def has_two_letters(str): c = Counter(str) return len([k for k in c if c[k] == 2]) > 0 two_counter = 0 three_counter = 0 with open('input.txt') as input: for line in input: ...
222eb6a145320b0c91b7b496668e14f191cdd713
makuznet/hse
/lesson-1_swap_letters/lesson_1_dz_4.py
4,795
3.9375
4
# # элементы в переменной text преобразуйте в нижний регистр, # а затем запишите наоборот, с последнего элемента по первый # text = "WOW,NOEL SEES LEON" # text = "WOW,NOEL SEES LEON" # исходная строка # Из строки text создаем список chunk, # разделяя строку на элементы с помощью метода .split(',') (запятая) # предва...
865113ad5dcefdfb86821ef0066aa4c472110e8d
makuznet/hse
/lesson-2_list_comprehension/lesson-2-hard-mode-1-while.py
1,246
4.21875
4
# Напишите код, который проверяет делимость числа на 5. # Числа нужно выбрать из списка. Если число делится, # алгоритм должен выйти из цикла и вывести на экран искомое число и строку "делится на 5". # Если не делится, выводим на экран "это не делится на 5, продолжим поиск". # Продолжаем пока не найдем такое, которое б...
9c9ba08dae96e999f50a7c0de3829c3ca0d2253b
Code-Institute-Submissions/annies-riddle
/utils.py
1,220
3.796875
4
import json def check_username(userscores, username): ''' If username was empty or already stored in the user scores file, then it is invalid, otherwise it is fine ''' if username == "" or username in userscores: return False return True def check_answer(riddle, answer): ''' Ch...
ed37ea2c34181eb9591f47379e9e00181707c1f0
typark99/python-washu-2014
/day4/search.py
819
3.875
4
def linear_search(mylist, element): steps = 0 for item in mylist: steps += 1 if item == element: return item print steps return None def binary_search(sorted_list, element): print "Input list is {0}".format(sorted_list) print "Input size is {0}".format(len(sorted_list)) middle = len(sorted_list)/2 m...
e108696ea55da969a6a806d0237d5d0603df6f4d
typark99/python-washu-2014
/day3/ordinal.py
403
3.75
4
def ordinal(n): negative = False try : n = int(n) except: return "Improper input" if n <0: n = abs(n) negative = True last_digit = n % 10 second_to_last_digit = (n % 100) /10 endings = {1: "1st", 2:"nd", 3: "rd"} ending = "th" if second_to_last_digit != 1 and last_digit in ending: ...
f38621ee594007452b31d6701aafcd776f25d66a
cloudsecuritylabs/learningpython3
/ch1/mormi_multiplication.py
180
3.96875
4
first_num = input("tell me the first number: ") second_num = input("tell me the second number: ") multiply = int(first_num) * int(second_num) print(f"the answer is {multiply}")
3c0245ed5efd33feee6927ca8836552b6455bfe3
jribbans/SequentialAuctions
/auction/SequentialAuction.py
3,153
3.9375
4
""" Implements a class that runs a sequential auction of homogeneous goods, where one good is auctioned off in each round. Bidders pay the second highest price in each round. """ import random class SequentialAuction: """Sequential auction where the bidder with the highest bid in each round pays the second highe...
c976e075405c4cbb372aee86a6eddcda1aa6b5e5
airuibel/python-1
/study/unittest_sample/ut-01.py
521
3.640625
4
import unittest def addNum(a, b): return a + b def delNum(a, b): return a - b def ploy(a): if a < 0: raise ValueError if 0 == a: return 1 if 1 == a: return 1 return a * ploy(delNum(a, 1)) class TestFun(unittest.TestCase): def testAdd(self): self.assert...
af9de800df19da6905e1c73a4ff1ac8beb1cd5ab
asmaasalih/forumsworkshop
/main.py
1,258
3.78125
4
class ATM: def __init__(self,balance,bank_name): self.balance = balance self.bank_name = bank_name self.withdrawals_list = [] def show_withdrawals(self): for withdrawal in self.withdrawals_list: print("withdrawal: "+str(withdrawal)) def print_information(self): print("Welcome to "+ self.bank_nam...
946abe4c594808d31dc08ca1ea94638bec6a3c22
Skilld18/gbws
/square_utils.py
642
3.625
4
#!/usr/bin/python def row_check(board): return (len(board) < 3 or sum(board[0:3]) == 15 and len(board) < 6 or sum(board[3:6]) == 15 and len(board) < 9 or sum(board[6:9]) == 15) def col_check(board): return ((len(board) < 7 or (board[0] + board[3] + board[6]) == 15) and ...
4af039c9bafbc884d3b26a7a7a6c0a4fc364b077
Maecena/Py.FarmGame
/items.py
3,308
3.59375
4
import random class ItemType(object): #edible will affect eating food and cooking later def __init__(self, name, sellable, baseBuy, baseSell, tags): self.name = name self.sellable = sellable self.baseBuy = baseBuy self.baseSell = baseSell self.tags = tags def __str_...
2444950857879967ac3bb1e6b30b196a0f3467b7
VirgilioAraujo86/4linux_python
/matriz.py
396
3.6875
4
#!/usr/bin/python3 '''Dado uma matriz m= [ [6,2,6] [7,3,6] [10,2,1] ] Calcular a soma das diagonais exempo: 6+3+1+6+3+10''' matriz = [ [6,2,6], [7,3,6], [10,2,1] ] a = 0 cont = 0 '''for x, y in enumerate(matriz): a += y[x] print(x, y) ''' for x in matriz: a += x[cont] co...
9e28c305145a9e94f9f40788282486e739eb0599
Nacriema/n-puzzleProblem
/grid.py
3,454
3.515625
4
''' Implement trạng thái, là một node của trò chơi. Mình tham khảo tại trang: https://github.com/andavies/n-puzzle/blob/master/grid.py ''' import math import copy class Grid: ''' Biểu diễn trạng thái của lưới: state, path_history, và heuristic score. ''' def __init__(self, input_state): # Đừ...
8f3f3d2b11884ac00660dc558a37b8269dd6cb78
sparklemousse/useful-python
/attachment-scraper.py
2,511
3.546875
4
""" Created on Tues 28 February 2017 @author: paulcronk Tested on Python 3.5. Uses Beautiful Soup 1. This script takes a set of URLs from a csv file 2. It then passes these URLs through Beautiful Soup to count the number of words and scrapes some headings 3. The results are written into a csv file """ #import urllib...
b3777d1e8b735cf022985fb0c6f7b40368803617
matlh/ETL_Python
/Análise de dados com Python e pandas/ETL_AdventureWorks.py
2,893
3.671875
4
import pandas as pd, matplotlib.pyplot as plt plt.style.use('seaborn') #Importa base de dados df = pd.read_excel('AdventureWorks.xlsx') #Exibe as 5 primeiras linhas da base de dados print(df.head()) #Número de linahs e colunas print('\n', df.shape) #Tipos de dados print('\n', df.dtypes) #Receita tot...
2c000f053dc8ad8412afef5941cf77ae1db69e26
pborgen/OFCP-AI
/deck.py
1,042
3.578125
4
__author__ = 'Alastair Kerr' # -*- coding: utf-8 -*- import random class Deck(object): def __init__(self, deck=None, current_position=0): if deck is None: possible_cards = [] suits = ["h", "d", "s", "c"] for suit in suits: for i in range(1,14): ...
13ab48582bde8d13eca5a9b9afadd80d7e1aa4d1
Lemburse/Leetcode
/Valid Sudoku.py
1,113
3.5625
4
class Solution: def isValidSudoku(self, board): """ :type board: List[List[str]] :rtype: bool """ for i in range(9): v = [] for p in board[i]: if p!='.': v.append(p) if len(v) !=len(set(v)): ...
c31cf26d89e42af74b0eb5448c5d0c824c0bbcbf
DuB0k/PythonApps
/staircase.py
859
4.5
4
#!/bin/python3 ''' Consider a staircase of size N=4: # ## ### #### Observe that its base and height are both equal to N, and the image is drawn using # symbols and spaces. The last line is not preceded by any spaces. Write a program that prints a staircase of size ...
3412365a338f0c230d77c18417eca2b28829b4cb
pzd3mir/pythonExercises
/KPW_hs2020_Uebung2/Polynom.py
650
3.953125
4
"""Schreiben Sie ein Programm, welches die Koeffizienten a, b, c, d sowie den Wert x des Polynoms y=a * x3 + b * x2 + c * x + d berechnet""" print('Um den Wert zugehörigen y Wert von y =a * x3 + b * x2 + c * x + d auszurechnen, bitte geben sie folgende Werte ein') print('Bitte geben sie den Wert für a ein') a = int(...
fbaa5fd85513e6ea216c1e348777661eb79a3d8f
utashi85/python
/hello.py
261
3.78125
4
# 関数 def increment(x): return x + 1 # 初期化 i = 0 # loop や if 文のブロックは indent で表現 while i < 100: print(i, 'Hello, World!!') i = increment(i) print('End') # indent が異なる End は最後に一回だけ表示される
380c0fafef710fcb5ed717f3bd5f204274451aa7
just-hugo/UnitedFlightBooking
/UnitedAirportGenerator.py
444
3.5625
4
import random def airport_generator(): airports = [] #open() will open a file and return a corresponding file object . Refer here for information on arguments and parameters: https://www.programiz.com/python-programming/methods/built-in/open airportsfile = open(r'airports2.txt') for line in airportsf...
67b46bc52f553d64a2e54b565ca65e512cdcaa40
yurtaiev/atqc
/core/fibonacci.py
400
4.21875
4
from math import sqrt def fibonacci_recursive(n): if n == 0: return 0 elif n == 1: return 1 else: return fibonacci_recursive(n - 1) + fibonacci_recursive(n - 2) def fibonacci_math(n): return int(((1 + sqrt(5)) ** n - (1 - sqrt(5)) ** n) / (2 ** n * sqrt(5))) def fibonacci_y...
a05ef3ce68ba189b2c32e463475c7df6906901b3
kjcoursera/Machine_Learning
/Solving_without_inbuilt_functions/findind_matrix_sum.py
429
3.859375
4
# -*- coding: utf-8 -*- """ Created on Tue Aug 6 14:56:50 2019 @author: kanchana """ import numpy as np A = np.random.rand(3,3) print(A) m = A.shape[0] n = A.shape[1] i = 0 j = 0 temp = 0 for i in range(m): for j in range(n): temp = temp + A[i,j] ...
b71411d0754ea84333800598fafe78334fe336cd
georgeiniesta/Python-Tests_Intro_Python
/first/main - 2021-04-29T155654.883.py
321
4.03125
4
# Demostración de la función sorted() firstGreek = ['omega', 'alfa', 'pi', 'gama'] firstGreek2 = sorted(firstGreek) print(firstGreek) print(firstGreek2) print() # Demostración del método sort() secondGreek = ['omega', 'alfa', 'pi', 'gama'] print(secondGreek) secondGreek.sort() print(secondGreek)
3e927eef0471f56a61d174b2baa3ca63f4df019e
georgeiniesta/Python-Tests_Intro_Python
/first/main - 2021-04-29T155208.834.py
288
3.71875
4
# Demostración del método swapcase() print("Yo sé que no sé nada.".swapcase()) print() # Demostración del método title() print("Yo sé que no sé nada. Parte 1.".title()) print() # Demostración del método upper() print("Yo sé que no sé nada. Parte 2.".upper())
6157e629deeedefed8c2824272a0161ff7f40a16
georgeiniesta/Python-Tests_Intro_Python
/first/main - 2021-04-29T151700.636.py
271
3.828125
4
# Indexando cadenas exampleString = 'silly walks' for ix in range(len(exampleString)): print(exampleString[ix], end=' ') print() # Iterando a través de una cadena exampleString = 'silly walks' for ch in exampleString: print(ch, end=' ') print()
10c912c578629c7dd887333cb35db9c92aa6aea4
georgeiniesta/Python-Tests_Intro_Python
/first/main - 2021-04-29T161141.568.py
617
3.921875
4
cadena1 = input("Ingresa la primera cadena: ") cadena2 = input("Ingresa la segunda cadena: ") # esto es lo que vamos a hacer con ambas cadenas: # - quitar los espacios # - cambiar todas las letras a mayúsculas # - convertirla a una lista # - ordenar la lista # - unir los elementos de la lista en una cadena #...
80a619e0bbf5a0d0aaa092eba50bdf354833ada3
jdonszelmann/koenbot
/namechanger.py
1,899
3.53125
4
import random def generate_expr(a,b): infront = "" operator = "^" def invertandor(): nonlocal operator,a,b,infront if random.choice([True,False]): if a.startswith("¬") and operator == "v": a = a[1:] operator = "->" elif b.startswith("¬") and operator == "^" and infront.start...
608a02873eb83ed14b75da5a873754fa8c9089f4
acharist/python-mipt
/turtle/star.py
278
3.8125
4
from turtle import Screen, Turtle screen = Screen() turtle = Turtle() turtle.shape('turtle') turtle.speed(10) def star(n, length): i = 0 while(i < n): turtle.forward(length) turtle.right(180 - (180 / n)) i += 1 star(5, 400) screen.mainloop()
8549750c5263708a2491bebbb20c672474a472b2
kim-hyo/codeit-python
/02_abstract_013_014_stylework.py
936
3.984375
4
def is_evenly_divisible(number): return number%2 == 0 # 코드를 작성하세요 # 테스트 print(is_evenly_divisible(3)) print(is_evenly_divisible(7)) print(is_evenly_divisible(8)) print(is_evenly_divisible(218)) print(is_evenly_divisible(317)) def calculate_change(payment, cost): change = payment - cost fifty_th...
fbda577ba4e1ab6b7394d63fbbdc7ac7fc3ffc94
kim-hyo/codeit-python
/04_application_03_file_baseball.py
1,563
3.84375
4
import random def generate_numbers(): numbers = [] cnt = 0 while cnt != 3: b_num = random.randint(0, 9) if b_num in numbers: continue else: numbers.append(b_num) cnt += 1 print(f"0과 9 사이의 서로 다른 숫자 3개를 랜덤한 순서로 뽑았습니다.\n") ret...
dfaabd32b9b75f58ff77d033ce34c278b2927d49
neeraj-bhadani/Face-Recognition-in-Python
/face_detection.py
573
3.578125
4
import cv2 face_cascade = cv2.CascadeClassifier("haarcascade_frontalface_default.xml") img = cv2.imread("C:\\Users\\Neeraj Bhadani\\PycharmProjects\\face_recognition\\pic1.jpg") # reading the image as grayscale gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # search the coordinates of the image face...
b039000c9dc50e2207fa41ea354788e7b1194485
mohsenabedelaal/holbertonschool-machine_learning
/supervised_learning/0x07-cnn/3-pool_backward.py
2,520
4.5
4
#!/usr/bin/env python3 """Performs back propagation over a pooling layer of a neural network""" import numpy as np def pool_backward(dA, A_prev, kernel_shape, stride=(1, 1), mode='max'): """ Performs back propagation over a pooling layer of a neural network - dA is a numpy.ndarray of shape (m, h_new,...
c6a929bc4aad48ceb4e782047aea050b2ff041c6
mohsenabedelaal/holbertonschool-machine_learning
/supervised_learning/0x02-tensorflow/1-create_layer.py
623
3.671875
4
#!/usr/bin/env python3 """ Module to create a layer """ import tensorflow as tf def create_layer(prev, n, activation): """ a function that create layers :param prev: the tensor output of the previous layer :param n: the number of nodes in the layer to create :param activation: is the activation fu...
ccb8b646297730b8f1a3c15b02dc3f0800ec58b7
mohsenabedelaal/holbertonschool-machine_learning
/supervised_learning/0x06-keras/1-input.py
1,197
3.90625
4
#!/usr/bin/env python3 """Builds a neural network with the Keras library""" import tensorflow.keras as K def build_model(nx, layers, activations, lambtha, keep_prob): """ Builds a neural network with the Keras library - nx is the number of input features to the network - layers is a list cont...
5c067a05f8fe591833c23a0f4e3de0c20ddb096e
mohsenabedelaal/holbertonschool-machine_learning
/math/0x04-convolutions_and_pooling/2-convolo_grayscale_padding.py
1,834
4.03125
4
#!/usr/bin/env python3 """Performs a convolution on grayscale images with custom padding""" import numpy as np def convolve_grayscale_padding(images, kernel, padding): """ Performs a convolution on grayscale images with custom padding - images is a numpy.ndarray with shape (m, h, w) con...
2169024e7e9034cbf38a2d37c682eb812082cb00
Remcovandelogt/HU_Python_vb1_2017
/Final Assignments/NS_Functie.py
556
3.5625
4
def opdr(): aantalkm=int(input('Hoeveel km moet je afleggen: ')) if aantalkm>=50: print('je treinrit kost 15 euro + {} euro'.format(aantalkm*0.60)) else: print('Treinrit kost {} euro'.format(aantalkm*0.80)) opdr() def ritprijs(): leeftijd=int(input('Wat is je leeftijd: ')) weekendri...
c567995eccc032fb4ccabc7c0d086058116a9d56
alinemokfa/python_practice
/lists.py
277
3.9375
4
list = [2, 4, 6, 8, 10] list2 = [12, 14, 16] list3 = [1, 'hi', [3,4,5]] print(len(list)) print(list[4]) print(list + list2) print(list3[2][1]) print(list2) # remove function removes the first occurence of a value (not index) # if you know the index, use del del(list[1])
e626ed627a4e2eb6690843573ea987ec22183c6c
Saravji/KaggleTrainer
/Trainer/Model/Model.py
1,946
3.546875
4
import abc class Model(object, metaclass=abc.ABCMeta): """ A wrapper for all models integrated into the system. """ def __init__(self, properties_dict): """ Called whenever a new model is instantiated :param properties_dict: the additional properties with which to initialize th...
4937072e696468a27913ac9582431308cdd0e645
mwcz/euler
/py/q5.py
495
3.796875
4
#!/usr/bin/python # 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? # hmm, to be divisible by 1..20, the number must # have prime ...
989bdd0364e5459b7d76f3b2f62d1527572a1acd
mwcz/euler
/py/q14.py
1,029
3.921875
4
#!/usr/bin/python # Problem 14 # 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 # ...
1acfd6aa1b62b2d15c0b4569506d9350c4a5c505
mwcz/euler
/py/q20.py
209
3.90625
4
#!/usr/bin/python # Problem 20 # n! means n * (n * 1) * ... * 3 * 2 * 1 # # Find the sum of the digits in the number 100! from math import factorial as f print( sum( [ int(n) for n in str( f(100) ) ] ) )
49964968c96de517d66c8efb8c0cf87210d6924a
lee-taekgyu/total_review
/32_area.py
96
4.21875
4
r = float(input("INSERT YOUR LENGTH :")) PI =3.14 def area(r): return r*2*PI print(area(r))
f57f00b96199b3b67b75396e73b875d1326af6fa
lee-taekgyu/total_review
/12_input.py
79
3.625
4
userinput = input("INSERT :") print("You are {} years old.".format(userinput))
fd5403cd4fb2fb3a38389b74f13915afd36463e1
lee-taekgyu/total_review
/17_if_currency.py
253
3.59375
4
d = {'USD':'1,203.82', 'EUR':'1,365.73', 'JPY': '11.22', 'CNY':'172.04'} num = float(input("Write your money :")) #nation = str(input("Write your nation : ")) for nation in d.keys(): print(round(float(d[nation].replace(',','')))*int(num),"KRW")
b16d59b4db127e139d101c55d09286e8d9fdb622
saraft/POO
/01-carro/carro.py
934
3.625
4
class Carro def __init__(self): self.gas=0 self.pas=0 self.km=0 self.lim_pas=2 self.lim_gas=10 def __str__(self): return "Pas:"+str(self.pas)+", Gas:"+str(self.gas)+", Km:"+str(self.km) def mostrar(self): print(self) def entrar(self): if se...
51a9e54cee00876fd55fd6fab35a2c3cad485cfe
Mo-Code21/senior_project
/Calibration.py
1,637
3.59375
4
# 5/13/21 # Mohammed # Processing sensor data and controlling motor # Importing Libraries import serial import time import csv import numpy as np import tkinter as tk # Main function def motor(): window = tk.Tk() window.configure(background="white") window.geometry("220x80") window.title("Motor Cont...
8fd94000bdd39be7d033ece625767e9c369f484c
fenech/advent2020
/day21/pt1.py
638
3.5625
4
import sys import re def parse(lines): allergens = {} ingredients = [] for line in lines: p = line.index("contains") i = re.findall(r"\w+", line[:p]) ingredients.extend(i) for a in re.findall(r"\w+", line[p + 8 :]): if a in allergens: allergens[...
e93b291f8fe2308d255197f79bfe74dd6b7d2b58
fenech/advent2020
/day18/pt2.py
953
3.5625
4
import sys import re def add(form): while True: m = re.search(r"(\d+) \+ (\d+)", form) if m is None: return form form = ( form[: m.start()] + str(int(m.group(1)) + int(m.group(2))) + form[m.end() :] ) def mul(form): while True: m = re.search(r"...
3d000f8c9eaeb5f289dc0a2c7623ee92a07ffee4
TSalacki/DB-Fake-Data-Generator
/clientSample.py
3,112
3.5
4
import datetime import random import string import coolname import names def random_date(start, end): """ This function will return a random datetime between two datetime objects. """ delta = end - start int_delta = (delta.days * 24 * 60 * 60) + delta.seconds random_second = random.randra...
d90dd2221b9db3a3b19d821d8fd5c000c1769a73
tnz5/advent-of-code-2020
/day_2/main.py
1,582
3.78125
4
# Day 2: Password Philosophy RANGE_POS = 0 LETTER_POS = 1 PWORD_POS = 2 MIN_INDEX = 0 MAX_INDEX = 1 def parse_input(pw_list): pw_dicts = [] for pw in pw_list: pw_dict = {} r = pw[RANGE_POS].split('-') pw_dict['min'] = int(r[MIN_INDEX]) pw_dict['max'] = int(r[MAX_INDEX]) ...
2261ca3460917cdbef19165a711672463da6206f
TomasBalbinder/Projekty
/next_programs.py
3,988
4.0625
4
# easy script for change position letter for back to forward entrance = input("Enter text: ") letters = list(entrance) for letter in letters[::-1]: print(letter,end="") """ easy program for compared palindroms """ entrance = input("Enter text: ") entrance = entrance.replace(" ", "") le...
a056ff6a3222eb8d9481d2b43622bf430e9d944a
TomasBalbinder/Projekty
/procvicovani.py
797
3.921875
4
for number in [1, 2, 3]: print(number) for word in ["green", "blue", "red"]: print(word) print("===============") for number in [1, 2, 3]: print(number) if number == 2: break for word in ["green", "blue", "red"]: print(word) print("===============") # Tady je videt, ze break ve...
77a18265499cbb7714a3e2cf914ce0c3dab60a96
marinajacks/nowcoder
/Sorts.py
977
3.609375
4
# -*- coding: utf-8 -*- """ Created on Sun Oct 20 20:52:56 2019 @author: 陈彪,版权所有 这个是一个排序算法的总结,将所有的排序算法都重新写一遍,然后我们首先会分析算法的时间 复杂度,然后简单介绍一下这些算法的原理,最后使用python实现,然后我们会使用测试案例 来进行测试。 """ import random '''首先映入眼帘的就是冒泡排序,这是一个让人理解起来最简单的排序算法,这个算法的时间复 杂度是O(N^2),从下面的程序中也能看出来这个算法的时间复杂度确实是O(N^2). ''' def bubble(a): for i in...
8da7bce97d50a6b13b06bd5ca3ace7b72eb109a2
william012364/SPE10117
/lab4p3q2.py
932
4.125
4
''' Algorithm maxMin An algorithm program to read three number A, B, and C and prints the largest value and the smallest value. 1. Read A, B, C 2.1 if A > B then largest <- A else largest <- B 2.2 if C > largest then largest <- C 3.1 if A < B then smallest <- A else smallest <- B...
b9369b7752df0c6d20dd38fb896ec168e2e7005b
JuanCasian/Algorithms
/longest_common_substring/longest_common_substring.py
1,270
3.5
4
def print_grid(str1, str2, grid): for letter in str2: print(letter, end ='\t') print("") i = 0 for row in grid: for column in row: print(column, end ="\t") print(str1[i]) i += 1 def find_grid_max(grid): maxval = 0 maxrow = 0 maxcol = 0 for i ...
b1faad4589bcf4c78101731c417740e0d025ed5a
Galahad3x/AdventOfCode2019
/day14/day14.py
1,862
3.640625
4
import math f = open("input.txt", "r") ingredients = {} inventory = {} for line in f.readlines(): ing = line.split(" => ")[0].split(", ") out = line.split(" => ")[1][:-1] ingredients[out] = ing inventory[out.split(" ")[1]] = 0 print(ingredients) print(inventory) objective = "1 FUEL" def get_ore(ob...
69d0b56d3d6015590cbaf7475bf36dd6f3bf32dc
NCobane/ML_Practice
/ud501/Lesson2.py
1,253
3.578125
4
# Import relevant libraries import pandas as pd import matplotlib.pyplot as plt # Define functions def import_stock(symbol): """ Read in stock CSV based on data stored in Stock_Data/<symbol>""" df = pd.read_csv("Stock_Data/{}.csv".format(symbol)) # read in data return df def test_run(): df = pd.rea...
9e1722430af68e28dc86a90cdf9f39eed5fc8b51
wamakimaN/password-store
/run.py
5,508
3.875
4
#!/usr/bin/env python3.6 import random import string import getpass from password import Account, Site def create_acc(user, key): """ function to create a new account """ new_acc = Account(user, key) return new_acc def create_site(sname, suser, skey): """ function to create a new account...
957de4b4feb920c86a2bce213c8d9ec3ca5f6c91
SamThandi118/Scrabble-Coursework
/Scrabble-coursework/task2.py
322
4.3125
4
# Sam Thandi 20/11/2020 coursework def onlyEnglishLetters(word): usersWord = word # .isalpha checks to see if the input is in the alphabet. If yes then returns True, if not returns False usersWordCheck = usersWord.isalpha() print(usersWordCheck) word = input("Enter a word: ") onlyEnglishLetters...
4ce5b464bc8561352ecc7690b4a65f0a5db47a9c
YuriiGl/Hillel_home_work_1
/lesson_10/lesson_10-1.py
737
4.09375
4
# 1. Программа которая при запуске должна: # Создать текстовый файл, записать в него построчно данные, которые вводит пользователь. # Окончанием ввода пусть служит # пустая строка. Каждая введённая строка, в файле, должна начинаться с новой строки. # new_file = open('new_text.txt', 'w') while True: any_text = inp...
86b0419c421fce52f322258fd52b402d29ca98e7
YuriiGl/Hillel_home_work_1
/Lesson_2/Lesson2-2.py
226
4.1875
4
integer_namber=int(input('Please enter an integer number: ')) print('The next number for the number ',integer_namber,' is ',integer_namber+1) print('The previous number for the number ',integer_namber, ' is ',integer_namber-1)
9c23349644e1ddfbea96aaef7f93205be15f713c
YuriiGl/Hillel_home_work_1
/Lesson_2/Lesson2-3.py
135
3.859375
4
speed=int(input('Enter speed: ')) time=int(input('Enter time: ')) if speed>=0: print(speed*time) else: print(100+ (speed*time))
5ef75fa20bb642a988c72a75485e809db392409e
yiwang0601/survmeth895
/exercises/ipython_log.py
745
3.9375
4
# IPython log file get_ipython().magic(u'cd desktop') get_ipython().magic(u'cd SURVMETH895') get_ipython().magic(u'cd assignment') get_ipython().magic(u'logstart') get_ipython().magic(u'pwd ') #Easy task get_ipython().magic(u'run assignment2.py') #Less easy task #Program to find the mean of all numbers stored in a lis...
1e0a805f5dba95d84921c5a7c14ed3097ce3d7a2
tcoln/Python-Leetcode
/105.前序中序构造二叉树.py
835
3.921875
4
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def buildTree(self, preorder, inorder): """ :type preorder: List[int] :type inorder: List[int] ...
0783bf7e86d54c7ddadaa73fd89551c3b77e56c1
tcoln/Python-Leetcode
/147.InsertionSortList.py
1,637
4.0625
4
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def insertionSortList(self, head): """ :type head: ListNode :rtype: ListNode :note: 插入排序,跟数组不一样,从前往后找插入位置...