blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
d325c66ffd6d0c3439fa29f1e66feaa3149d9eb4
arifcahya/introduction
/BMI CALCULATOR by Deniss/BMI_calculator.py
331
4.375
4
#BMI Calculator weight = float(input("Enter your weight in kg: ")) height = float(input("Enter your height in cm: ")) BMI = weight / (height/100)**2 if BMI<18.5: print("Underweight") elif (BMI >= 18.5) and (BMI < 25): print("Normal") elif (BMI >= 25) and (BMI < 30): print("Overweight") else: print(...
a7e84ddbe0c713c9854bb886e33aa28221f93082
arifcahya/introduction
/lokeshsethia21BCON195(BMI).py
826
4.3125
4
print("\t\tWelcome To Body Mass Index Calculator") Weight=int(input("Please Enter Your Weight(in kg):- ")) Height=float(input("Please Enter Your Height(in feet):- ")) H1=Height/3.28 BMI=Weight/(H1**2) print("Your Body Mass Index is",BMI) if BMI<=18.5: print("You Are Undernourished, Kindly have some Healthy Diet☻☻")...
ebaff8896cfb2e070c6985e3b2bf9633b36a3e0b
Adelina09/PythonProjects
/file.py
549
3.71875
4
#!/usr/bin/env python3.8 guesses = [] count = 1 ans = 'python' word = '' while count < 10: guess = input ('guess a letter: ') guesses.append(guess) if ''.join(word) == ans: print('you win') break elif len(guess) > 1 and ans == guess: print(ans) print('you win') ...
22925975acc4b77043935436418a29bccecf9910
plgisele/python3-mundo1
/ex008_02.py
519
4.1875
4
# Escreva um programa que leia um valor em metros e o exiba convertido em quilômetro, hectômetro, decâmetro, decímetro, centímetro e milímetro. x = float(input('Digite a distância em metros: ')) km = x * 0.001 hm = x * 0.01 dam = x * 0.1 dm = x * 10 cm = x * 100 mm = x * 1000 print('A medida {:.2f}m corresponde a:'.f...
ab22187301eaa87c77cece5af61524a86e12a4a9
plgisele/python3-mundo1
/ex007.py
239
3.90625
4
# Desenvolva um programa que leia duas notas de um aluno, calcule e mostre a sua média. nota1 = float(input('Nota 01: ')) nota2 = float(input('Nota 02: ')) media = (nota1 + nota2) / 2 print('A média do aluno é {:.1f}.'.format(media))
7934d43ffca92c054d0a676a3097e873f4e82803
blantj/2016_election_modeling_v2
/app.py
1,266
3.5
4
#Import libraries import streamlit as st import matplotlib.pyplot as plt import pandas as pd from pickle import load # st.title('2016 Election Modeling') st.markdown('See how your county voted in the 2016 election relative to its regression predicted vote proportion') # df = pd.read_csv('Data/election_full_dataset.cs...
2963d32c479acb40ce765c24420a2fea85e0de83
Koki333/Newbie-code
/cal.py
334
3.734375
4
years = [y for y in range(1900, 2001)] months = "jan feb mar apr may jun jul aug sep oct nov dec" days = "mon tue wed thu fri sat sun" days_n = [d for d in range(1, 32)] def cal(): for year in years: for month in months.split(): for day in days.split(): print(day, month, ye...
631a8c483fd2c0e46c9e7ec534818e4c39f60e2b
joanasean/iX
/homework/week1/day2/tic_tac_toe/tic_tac_toe-exercise.py
2,296
4.28125
4
# -*- coding: utf-8 -*- """ Ejercicio. Tic-tac-toe We are going to build a program that allows us to play tic-tac-toe on the terminal In a nutshell, the tic-tac-toe board can be thought of 3 lists inside another one board = [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "] ]...
9c1cb03e6afa9fec4bf1763427f857ecc6db4f87
qvbit/Big-Data-Analytics-Projects
/homework5/code/plots.py
2,419
3.765625
4
import matplotlib.pyplot as plt # TODO: You can use other packages if you want, e.g., Numpy, Scikit-learn, etc. import numpy as np from sklearn.metrics import confusion_matrix def plot_learning_curves(train_losses, valid_losses, train_accuracies, valid_accuracies): # TODO: Make plots for loss curves and accuracy ...
0e7d1ce9cecc35040aa13d2d880102daa466c5c0
peap/advent-of-code
/2015-py/day-05/nice.py
1,057
3.765625
4
import re vowel = re.compile(r'[aeiou]') double = re.compile(r'([a-z])\1') naughty_pairs = ['ab', 'cd', 'pq', 'xy'] def is_nice(name): has_three_vowels = len(vowel.findall(name)) >= 3 has_double = len(double.findall(name)) >= 1 naughty = False for pair in naughty_pairs: if pair in name: ...
4769b4387b91a9bfae6ad3f2ce9bab1bc604528b
RonaldYou/Competitive-Programming
/Rabbit Girls.py
208
3.765625
4
a = int(input()) b = int(input()) c = a%b if c == 0: print(0) elif a<b: print(b-a) else: if b-c > c: print(c) elif b-c < c: print(b-c) else: print(c)
7ea645c67c4269886f7acdd008619ec05319bc59
navyad/navnlp
/exp_othello.py
631
3.796875
4
from nltk.corpus import stopwords, shakespeare import nltk file_name = 'othello.xml' _all_words = shakespeare.words(file_name) # exclude stopwords print "Total words \n" _words = [x for x in _all_words if x not in stopwords.words() and x.isalpha()] print "total words", len(_words) # 10 most frequent words print "M...
dfc2c3a029e90315c67fd39130c92d0897a57b26
sphinx-gallery/sample-project
/sample-gallery-1/plot_0_samplemodule.py
605
3.84375
4
""" SampleModule example ==================== This example will demonstrate the ``power`` function and ``class_power`` from our package 'SampleModule'. """ import SampleModule.module SampleModule.module.fun_power(2,3) #%% # The function ``power`` returns the first number raised to the power of the # second number. ...
d678e1b34a663a087c159055f7078d36370e364f
fernandezjames24/python-training
/PythonBasics/Conditions/Conditions.py
1,573
4.3125
4
# changed integer variable number to 16 from 10 to fulfill condition #1 number = 19 # changed second_number to 'not 11' to become False so if second_number # is on the condition phase # it will invert False to True since 'not' operator is an inverter. This will fulfill # condition #6 second_number = not 11 # on t...
4582541b7a3bf7fb7a6106f2afc466be0b1856ed
icyang0/laundryMate
/speechAssets/customSlotTypes/PYTEST.py
196
3.515625
4
import fileinput, sys for line in fileinput.input("test.txt", inplace=True): line = line.replace("cleaned", "dry cleaned") # sys.stdout is redirected to the file sys.stdout.write(line)
71a57b05f0cec4d1d9d61c62adaa8a54b6dba189
petebunting/rsgis_scripts
/Text/FindReplaceTextDIR.py
4,461
3.640625
4
#! /usr/bin/env python ####################################### # A script to find and replace strings # within all text files in a directory # # Author: Dan Clewley # Email: daniel.clewley@googlemail.com # Date: 03/07/2012 # Version: 1.0 ####################################### import os.path, sys, re # Add extension...
300c5b6f208080799bb07443efdd926d504df93a
timolson/cointrader
/src/main/resources/commonrandom.py
5,341
3.578125
4
""" Functions used to create random data """ from random import gauss import numpy as np import pandas as pd from common import DAYS_IN_YEAR, ROOT_DAYS_IN_YEAR, arbitrary_timeindex import scipy.signal as sg def generate_siney_trends(Nlength, Tlength , Xamplitude): """ Generates a price process, Nlength return...
b4832cb29b36a14fc1cb339273f4ca25fa57ba5a
BruceW-Lelouch/Tic-Tac-Toc-Game-demo
/tic-tac-toc-v2.1.py
4,012
3.5
4
class tik_tak_tok: def __init__(self): self.board = [" | | ", "-----", " | | ", "-----", " | | "] self.step = 0 self.all_symbol = ["O", "X"] self.symbol = "X" self.empty = [(3,1), (3,3), (3,2), (1,3), (1,1), (1,2), (2,3), (2,1), (2,2)] def draw(self): fo...
4b18362a777d0cfa513dffe2e653a5e698d8c7b6
codewithgsp/hyperskill-todolist
/Problems/Extreme Points/task.py
706
3.859375
4
# The following line creates a dictionary from the input. Do not modify it, please import json test_dict = json.loads(input()) min_key = '' max_key = '' min_value = min(test for test in test_dict.values()) max_value = max(test for test in test_dict.values()) # Work with the 'test_dict' for test in test_dict: if min...
4350bac1d7ee45574a5b1b2ee53cc1cedd473f32
advaitshukla/Histogram-Project
/histogramgraph.py
2,655
3.65625
4
import Tkinter import Image, ImageTk, ImageDraw import math def histprint(hist): histHeight = 120 # Height of the histogram histWidth = 256 # Width of the histogram multiplerValue = 1.5 showFstopLines = True fStopLines = 5 # Colours to be used backgroundColor = (51,51,51) # Background...
9fefe99e78a144d5d741e68be49ef69f56397b32
markbac17/automated-teller-machine
/view.py
1,619
4.125
4
def get_account(): print() user_account_num = input("Enter account number: ") user_input_pin = input("Enter pin: ") user_login_details = [user_account_num, user_input_pin] return user_login_details def show_menu(): print() print("Welcome to Mark's Savings Bank") print("Select one of the...
6f0e1cd78300805a612dc5add54d152c39826458
cgaribay/TC1028.proyecto-final
/el_auto_usado.py
1,999
3.546875
4
#import datetime from pathlib import Path import productos import vendedores import ventas lista_productos = [] lista_vendedores = [ ["1", "2", "3"], #Vendedor ID ['juan perez', 'mariana lopez', 'pedro gonzalez'] #Nombre ] lista_ventas = [ ["1", "1", "2", ...
b947fe7ad9e0ff91df184ae628e5ad6330fe0d92
wanglida/Python_Learning
/list.py
1,291
4.21875
4
# 列表练习 listM=['math','physics','chemistry','biology'] listC=['Chinese','English','politics','history'] listG=['Geography'] print(listM[2]) print("Subjects : ",listM+listC+listG) # +号表示列表的连接 listM.append('Information Technology') # 列表最后添加一个元素 print(listM*2) # 重复输出列表二次 del listC[3] print(listC) # 删除列表第4元素 ...
e43d8627664213b19e91d2a47b8ca825fca41e6a
Ponchoalfonso/SurfaceRunoffAnalysis
/src/array_search.py
701
3.515625
4
def findIndex(arr, predicate): for idx, value in enumerate(arr): if predicate(value): return idx return -1 def findLastIndex(arr, predicate): for idx, value in enumerate(arr[::-1]): if predicate(value): return len(arr) - 1 - idx return -1 def find(arr, predica...
6aafde377641fa4f0c2f895bebb194b7e7cd7696
bema97/home_work
/ch3task_2.py
124
3.890625
4
words=(input("Please, enter any words: ")) list_1=words.split() list_1.sort(key=len) list_1=" ".join(list_1) print(list_1)
8abb8ca9ca3444ab3bde3d7e285bd0d85b64a32d
bema97/home_work
/ch2task_9.py
184
3.953125
4
numbers= int(input("Enter the count of the numbers that needs to be summed: ")) resoult=[] for integer in range(1,numbers +1): resoult.append (integer) print (int(sum(resoult)))
a1216c121dfc8ac2ef7cad8dde9b7106ae25fe2f
bema97/home_work
/ch2task_11.py
486
3.9375
4
string = "Bermet" #exercise 1 print (string[2]) #exercese 2 print (string[4]) #exercise 3 print (string[:4]) #exercise 4 print (string[:3]) #exercise 5 for n,letters in enumerate(string): if n % 2==1: print(letters) #exercise 6 for i,letters in enumerate (string): if i % 2==0: ...
bd9bcb5cd24a4f9463ffe4f08e99725c4f070057
melvin5281/python
/variables.py
504
4
4
# marks = 45+67+78+45+54 # print(marks) # print((marks)/5) # data types # Numbers - integers, # - float # - double # Boolean - True or False # String # Numbers # integers # int number_of_employees # money variable below is a float because it has a decimal point. money = 10000.0 # The variable below...
dac6b94c2aa6a93fdb002657adfb7aa483034e67
yogawidi/SG-Basic-Gen.03
/DataTugas/answer3.py
992
3.859375
4
data1 = "DataSet.txt" def readData(data1): x = [] with open(data1) as data : for line in data : x = line.split() return x #step 1 : y = readData(data1) z = [] reversed_number = [] for i in y: if (i.isdigit() == True) : z.append(i) # end of step 1 : to show the numbers, you can uncomment synta...
cbb37dcf38535488ef492099b859b182e8780aab
brendagitau/mobi-bank-account-python-
/bank.py
6,052
4.09375
4
from datetime import datetime class Account: def __init__(self,name,phone): self.name=name self.phone=phone self.balance=0 self.transactionfee= 30 self.loanlimit=1000 self.loan=0 self.transactions=[]#create a dictionary to store transactions ...
3db1b02f33f216fa92ac7abdd2a2240ee7aaf205
sofiliatou97/eisagwgh
/7-triliza.py
2,815
3.9375
4
from random import * # 3x3 gameboard gameboard = [(['.']*3) for i in range(3)] row_col = [0] turn = 1 def input_valid(values): global player if len(values) != 2: print "Input format: row,col (ex.1,2)" return 0 try: if (1 <= int(values[0]) <= 3) and (1 <= int(values[1]) <= 3): ...
0e397ecaa01be1d9967b16766e46cb3627f69f16
roshan2004/rosalind
/fib/fib.py
640
3.71875
4
#!/usr/bin/env python """ Given: Positive integers n<=40 and k<=5. Return: The total number of rabbit pairs that will be present after n months if each pair of reproduction-age rabbits produces a litter of k rabbit pairs in each generation (instead of only 1 pair). Sample Dataset 5 3 Sample Output 19 """ def get_...
c1f9b05e94c28f85412477eda4bfab3a6dc24045
roshan2004/rosalind
/village/ini4/ini4.py
500
3.984375
4
#!/usr/bin/env python """ Problem Given: Two positive integers a and b (a<b<10000). Return: The sum of all odd integers from a through b, inclusively. Sample Dataset 100 200 Sample Output 7500 """ import sys def odds(a,b): """Return odd integers from a to b inclusive""" return [i for i in range(a,b+1) ...
860188b0545ae2f262d394b87eafc6c9c1bc5d43
shailesh7259257155/percent1
/percent_of.py
111
3.6875
4
a = input("total number \n") b = input("how much % \n") sum = float(a) * float(b) / 100 print(sum)
6fa16dffb157e341b4a3767708e83c4417f0562a
MrunaliniChopade/FST-M1
/python/Python_Activity_09.py
354
4.09375
4
listOne = [6,9,34,78,91] listTwo = [13,56,86,23] print("First List ", listOne) print("Second List ", listTwo) thirdList = [] for num in listOne: if (num % 2 != 0) : thirdList.append(num) for num in listTwo: if (num % 2 == 0) : thirdList.append(num) # Print result pri...
abc2d7b0f22aef2600c6d91f4653a1f634b3b08b
bharris12/cardiacGPU
/genParams.py
1,681
3.59375
4
import random length_of_cables = input("Enter the number of cells in a cable you want: ") number_of_cables = input("Enter the number of cables you want: ") #num_params = input("Enter the number of paramaters you want to randomize: ") num_params = 17 # if you want to make the parameter file include the constants for...
5c2f91213867a73cd96b121ab01eb33e036f5062
marcioshochi/data-scientist-trainning
/code-python/solutions/15_classify_solutions.py
12,639
3.625
4
# # Fitting and Evaluating Classification Models - Solutions # Copyright © 2010–2018 Cloudera. All rights reserved. # Not to be reproduced or shared without prior written # consent from Cloudera. # ## Introduction # * A classification algorithm is a supervised learning algorithm # * The inputs are called *featur...
d21d46d6944d0e479ef387ca65eca9e62e3ea6ef
marcioshochi/data-scientist-trainning
/code-python/supplements/03_dataframes_supplement.py
1,489
3.703125
4
# # Transforming DataFrames - Supplement # Copyright © 2010–2018 Cloudera. All rights reserved. # Not to be reproduced or shared without prior written # consent from Cloudera. # ## Contents # * Selecting columns using Python list comprehension # * Replacing valid values with null values # ## Setup # Create a Sp...
b9cb1ada0e1ca1268e4e2ca3acfc5ec3e4d3c0f0
josecervan/Python-Developer-EOI
/module2/recursion/factorial.py
200
3.84375
4
def factorial(n): if n > 1: return n * factorial(n - 1) elif n in (0, 1): return 1 if __name__ == '__main__': for i in range(6): print(f'{i}! = {factorial(i)}')
8e8376edab1d5a40b447012eddc2853a9e7bde79
josecervan/Python-Developer-EOI
/module2/algorithms/sorting/selection_sort.py
905
3.5625
4
import random def min_pos(nums): pos = 0 minimo = nums[pos] for i in range(len(nums)): if nums[i] < minimo: minimo = nums[i] pos = i return pos def selection_sort(lst): sorted_list = lst.copy() for i in range(len(sorted_list) - 1): pos = min_pos(sort...
94c9df799213ffa86f6fb3471739660e436e71cc
josecervan/Python-Developer-EOI
/module2/exam/p1.py
347
4.09375
4
def is_anagram(s1, s2): """ :param s1: string 1 :param s2: string 2 :return: boolean value (are they anagrams?) """ return ''.join(sorted(s1.lower())) == ''.join(sorted(s2.lower())) print(is_anagram('tea', 'eat')) print(is_anagram('tea', 'treat')) print(is_anagram('sinks', 'skin')) print(is_an...
d940149705e5897a2d0604be113293fcc74acde5
josecervan/Python-Developer-EOI
/module2/iterators/fibonacci.py
1,214
3.546875
4
class Fib: def __init__(self, n_terms): self.n_terms = n_terms self.prev = 1 self.post = 0 self.item_n = self.prev + self.post self.items = list() def __iter__(self): self.reps = 0 return self def __next__(self): if self.reps < self.n_terms: ...
4ab8d6754693eb1a712b1b98f424f260905d8e7b
josecervan/Python-Developer-EOI
/module2/algorithms/sorting/insertion_sort.py
1,095
3.984375
4
import random def insertion_sort(source_lst): lst = source_lst.copy() for i in range(1, len(lst)): token = lst[i] j = i - 1 while j >= 0 and token < lst[j]: lst[j + 1] = lst[j] j -= 1 print(lst) lst[j + 1] = token return lst if __n...
a7f210ebd947b61c87714becfc7085ce8954df5d
josecervan/Python-Developer-EOI
/module2/gui/peluqueria/p.py
665
3.5
4
# Importa el módulo GUI tkinter import tkinter as tk def coste(): cost = 15 if (jarron.get()): cost = cost + 5 if (regalo.get()): cost = cost + 2 cost_label.config(text="El coste total es {}€".format(cost)) # Crea ventana raíz para interfaz de usuario root = tk.Tk() frame = tk.Frame(root) frame.pack() tosc...
3305609b1ea2a7a05dcec59c23f8fe8c2629ceac
josecervan/Python-Developer-EOI
/module2/databases/intro/prueba2.py
296
3.734375
4
import sqlite3 connection = sqlite3.connect('students.db') cursor = connection.cursor() cursor.execute("CREATE TABLE IF NOT EXISTS students (nombre VARCHAR(100), nota_media INTEGER, email VARCHAR(20))") cursor.execute("INSERT INTO students VALUES ('Pilar', 8, 'pilar@ejemplo.com')") connection.close()
db8116d6d1ae6d081f90195e2762415c241db05f
josecervan/Python-Developer-EOI
/module2/poo/cartesian_coords_sys/cartesian_models.py
1,277
3.921875
4
from math import sqrt class Point: def __init__(self, x=0, y=0): if isinstance(x, (int, float)) and isinstance(y, (int, float)): self.x = x self.y = y else: raise TypeError def __str__(self): return f'({self.x}, {self.y})' def quadrant(self): ...
8127783138f5792d67cc46b9fba5a46e8069538b
josecervan/Python-Developer-EOI
/module2/poo/vehicles/catalogue.py
331
3.609375
4
def catalogar(lst): for item in lst: print(f"{type(item).__name__}: {item}") def check_wheels(lst, n_wheels=2): print('--') print("Checking vehicles with {} wheel/s".format(n_wheels)) print('--') for item in lst: if item.ruedas == n_wheels: print(f"{type(item).__name__}...
ed32dec6751e06977bf8a30cf25e20ab9f66831c
josecervan/Python-Developer-EOI
/module2/challenges/2_val_triangles/2_val_triangles.py
1,401
4.21875
4
""" Source: https://en.wikipedia.org/wiki/Minkowski_inequality """ import random def minkowski_inequality(a, b, c): return a + b > c and b + c > a and a + c > b def minkowski_ineq_instead(a, b, c): if minkowski_inequality(a, b, c): return True, [a, b, c] else: new_c = 0 while not...
611fb8f1d9c01f9443cf72ee96c5de5b18fe409f
josecervan/Python-Developer-EOI
/module2/higher_order_funcs/replacing_for_loop.py
410
3.703125
4
from functools import reduce numbers = list(range(1, 7)) # # Filter for odd numbers odds = list(filter(lambda x: x % 2 == 1, numbers)) # Square all odd numbers squared_odds = list(map(lambda x: x ** 2, numbers)) # Calculate total total = reduce(lambda x, y: x + y, numbers) # Results print(f'Numbers: {numbers}') p...
f567262464535c2957c02f95ca4f91770e6a9065
caihuach/.leetcode
/20.有效的括号.py
645
3.53125
4
# # @lc app=leetcode.cn id=20 lang=python3 # # [20] 有效的括号 # # @lc code=start class Solution: def isValid(self, s: str) -> bool: sLen = len(s) if sLen == 0: return True if sLen % 2 == 1: return False pairs = {")": "(", "}": "{", "]": "["} lefts = pair...
41d577a04f44f8620172590230a999c9ec682b6c
mushthofa/HackerRankPython
/Corr/corr.py
632
3.875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jul 1 22:22:07 2017 @author: mush """ from math import sqrt def mean(a): return sum(a)/len(a) def corr(a, b): nom = 0 dena = 0 denb = 0 ma = mean(a) mb = mean(b) for i in range(len(a)): nom += (a[i]-ma)*(b[i]-mb) ...
e7858eb6803658e63dad18ef977e9cb4b0a1f52d
jessigbeatty/hello_world
/threads.py
1,364
3.859375
4
import threading import time import os ### A game where you try to guess how much time has passed since you started running the game. def time_elapsed(): """Counts seconds passed since started and stores them in a global variable, t """ global t global running t = 0 while running: t +=...
b8bbbabe6c9f2f07600bdfcf773099340f7429a6
leveneg/2017adventofcode
/09/main.py
846
3.765625
4
#! /usr/bin/env python3 import sys INPUT = [c for c in sys.stdin.readline().strip()] #INPUT = '{{<a!>},{<a!>},{<a!>},{<ab>}}' def solve(): score = level = garbo = 0 ignoreNext = inGarbage = False for c in INPUT: #print('c: {}, inGarbage: {}, ignoreNext: {}'.format(c, inGarbage, ignoreNext)) ...
d0e34a4d169c4be32b230f301250fd7b24390861
Marcus-Mosley/ICS3U-Unit2-04-Python
/pizza.py
620
4.15625
4
#!/usr/bin/env python3 # Created by Marcus A. Mosley # Created on August 2020 # This program calculates the total cost of a pizza import constants def main(): # This function calculates the total cost of a pizza # Input diameter = int(input("Enter the diameter of the desired pizza (inch): ")) # Pr...
918e908ef04ef2d47bc72188bacd1f2f0347e48a
DylanGuidry95/ScriptItUp
/Restart/Main.py
577
3.578125
4
import sys, pygame from Node import Node from Algorithm import AStar pygame.init() size = width, height = 500, 500 screen = pygame.display.set_mode(size) Nodes = [] xMax = 7 yMax = 6 for x in range(0,xMax): for y in range(0,yMax): if x == 3 and (y == 1 or y == 2 or y == 3): n = Node(x,y,False) else: n = ...
9e6d6543a80085059fb339d87e3394a8a4360467
bobmwaniki/andela_tests
/fibonachi_test.py
418
3.875
4
import unittest class FibonacciTest(object): """docstring for FibonacciTest""" def test_length(self): self.assertEqual(len(fibonachi_sequence(5)), 5, msg= 'The list should have 5 elements') def test_output_list(self): self.assertEqual(fibonachi_sequence(6), [1,1,2,3,5,8], msg='The list does not contain...
3618adda4506d50a75bf241ced5298aa185e1dfc
leahsteinberg/bittorrent
/messages.py
700
3.765625
4
from bitstring import BitArray, BitStream def int_to_bytes(number): #TO DO... CASE OF **3 AND **4 ARE BADDDDDDDD if number < 256: result = '\x00\x00\x00' + chr(number) elif number < 256**2: result = '\x00\x00' + chr(number/256) + chr(number%256) elif number< 256**3: number2 = number/(256**2) nu...
cd8f259024dc3668e985d575edbdcd279c3c7683
f-rizi/TicTacToe
/logic.py
2,428
3.921875
4
class TicTacToe: def __init__(self, size): self.size = size self.reset() # This function is called whenever a new game is started. # all the cells in the board are set to '.' # that shows nobody has selected these cells def reset(self): self.board = [['.'] * self.size for i ...
2312287390afe658c5859198e95f4a271e98dd1e
jamccormick/PiClass
/DutyCycle.py
830
3.515625
4
#!/usr/bin/env python3 import RPi.GPIO as GPIO from time import sleep GPIO.setmode(GPIO.BOARD) motorIn1 = 16 motorIn2 = 18 motorEnable = 22 GPIO.setup(motorIn1, GPIO.OUT) GPIO.setup(motorIn2, GPIO.OUT) GPIO.setup(motorEnable, GPIO.OUT) print("Turning motor on.") GPIO.output(motorIn1, GPIO.HIGH) pwm1 = GPIO.PWM(mot...
18fa2d5319055508be645e679b9437bb7e3d0c78
good-repos/PyCleverAlgorithms
/src/algorithms/swarm/ba.py
3,541
3.609375
4
#!/usr/bin/env python """ Bat Algorithm """ from random import random, normalvariate import math def iif(condition, true_part, false_part): return (condition and [true_part] or [false_part])[0] def objective_function(v): return sum(map(lambda x: x**2, v)) def random_vector(min_max): return list(map(...
6935bbc5fd494f6f89a5902e136a6cef1f8f79e0
JeffreyMFarley/hew
/hew/structures/kd_tree.py
3,074
3.75
4
import collections import math from hew.structures.vector import distance_euclid_squared as distance_fn # ----------------------------------------------------------------------------- # Adapted from: # http://code.activestate.com/recipes/577497-kd-tree-for-nearest-neighbor-search-in-a-k-dimensi/ # -------------------...
3ebe296c0db1fe95162ef377b26970c58ed44193
Ayush7911/Python-Rn
/Ex6.py
445
4.3125
4
first_name= input('Your first name: ') last_name= input('your last name: ') #old style formatting. print('Hello %s %s' %(first_name,last_name)) #new style foematting. print('Hello {} {}!' .format(first_name, last_name)) print('Hello {0} {1}!' .format(first_name, last_name)) #this is where , you will feel the differ...
d7d4756347d9e55ef1835e4faadeedc9b68cbb0e
Ayush7911/Python-Rn
/listnames.py
160
4.03125
4
names=['Ayush','Dipesh','Dinesh','Ram','Hari','Azra','Simran','Cena'] e_name= [x for x in names if 'e' in x] print("list of names that has -e- char: ",e_name)
d703e9b336813b7a38ce299717326ad18ea03c3b
Ayush7911/Python-Rn
/ifstatement.py
137
3.640625
4
if input('words: ') == 'Foo': print("Great!") print("You entered 'Foo'") #Normal statement out of block print("Good Bye!")
586473aac105142ac6d371901187282f5fde6ca4
khomyakovskaya/startPython
/user_check.py
498
4.3125
4
#Программа, которая считет по просьбе пользователя #Пользователь может указать начало и конец счета, а также шаг start = int(input(" Введите начало отсчета: ")) finish = int(input("\n Введите конечную точку отсчета: ")) step = int(input("\n Укажите шаг для счета: ")) for i in range(start, finish, step): ...
4662e2aab8d93b18f7b46f01b8895e60872389e1
AffeProgrammer/five-letter-words
/reverse_lexico.py
1,299
4.09375
4
""" reverse_lexico.py Donald Knuth, Art of Computer Programming, Volume 4 Facsimile 0 Variation on Exercise #30 Each letter of the word "spied" appears in reversed lexicographic order. Find more words whose letters appear in reverse lexicographic order. """ from get_words import get_words def in_reverse_sorted_order...
d685bd0509f45e5f7d53eb2f1ce56de1b9ba9ea9
jasper-oh/coding-test-algorithm
/1_CodingTestStart/02_implement/implement_03.py
439
3.5
4
# Movement of Knights in Chess input_data = input() row = int(input_data[1]) column = int(ord(input_data[0])) - int(ord('a')) + 1 moves = [(2, -1), (2, 1), (-2, -1), (-2, 1), (1, 2), (-1, 2), (1, -2), (-1, -2)] result = 0 for move in moves: next_column = column + move[1] next_row = row + move[0] ...
00f46452739c47f70ef8c06202d0a7d9769acbb8
jasper-oh/coding-test-algorithm
/1_CodingTestStart/05_binary-search/binary_search_1.py
679
3.78125
4
# 이진 탐색 # 코딩 테스트 문제에도 나옴. # start 와 end 는 어떻게 사용되는 놈이지? def binary_search(array, target, start, end): while start <= end: mid = (start + end) // 2 if array[mid] == target: return mid elif array[mid] > target: end = mid - 1 else: start = mid + 1 ...
3681772ba4ccc36a690d485cb4fbaee44909aeff
Orieus/one_def_classification
/labelfactory/activelearning/test_block_psel.py
5,612
3.6875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This script is aimed at evaluating the behavior of tourney_prob, which computes the selection probabilities in a set of size N. The selection probability p for tuple (k, N, m) is the probability of selecting the k-th best sample in a ranked set of N ...
b01191f18404828a52551106cb4337ef60434bbc
Orieus/one_def_classification
/labelfactory/activelearning/test_psel.py
7,761
3.671875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This script is aimed at evaluating the behavior of tourney_prob, which computes the selection probabilities in a set of size N. The selection probability p for tuple (k, N, m) is the probability of selecting the k-th best sample in a ranked set of N ...
13224dc9fcec4ab83b19f310343d38b47e2f4079
kwon0136/TIL
/python/dictionary.py
473
3.90625
4
lunch = { '한식집': '02-', '중식집' : '031-', '일식집' : '054-' } # 4-1. 기본 for key in lunch: print(key) # key print(lunch[key]) # value # 4-2. key 기본 for key in lunch.keys(): # --> ['한식집', ...] print(key) # 4-3. value 반복 for value in lunch.values(): # --> ['02-', '031-', ...] print(value) # 4-4....
0f0a109d30a43408e1a61da475e7723a18f8460d
Iridium-Lo/maths
/Averages/meanDiff/fMeanDiff.py
371
3.984375
4
from typing import List def diff(nums: List[int]) -> List[int]: return [abs(nums[i] - nums[i + 1]) for i in range(len(nums) - 1)] def mean(lst: List[int]) -> float: return sum(lst) / len(lst) def mean_diff(nums: List[int], diff) -> None: return round(mean(diff(nums)), 1) nums = [3, 1, 2, 5, 1, 5, -7, 9...
37061b1ef8dd6b5ed36a7e828c030bf652f06249
marinaap/Ling.P
/exercício0010.py
408
3.9375
4
#Crie um programa que leia quanto dinheiro uma pessoa tem na carteira e mostre qntos dolares ela pode comprar reais = float(input('Quanto dinheiro voce tem na carteira? R$ ')) dolar = reais / 5.45 if reais >= 5.45: print('Com R${:.2f} reais será possível comprar U${:.2f} dolares'.format(reais, dolar)) else...
27c3f29a99517e9198ec50c5ebf9223828820993
rpwr021/code.a.day
/python/filter_list_of_lists/filter_lists.py
718
3.75
4
# Filter a list of lists, such that only the highest earning surname will be returned. ANP = [ ["Steve", "Peterson", 101229], ["Mary", "Peterson", 111029], ["Mark", "Williams", 99118] ] def filterlist(inpt): xdict = {} op = [] for i in inpt: try: if xdict[i[1]] < i[2]: # ...
2d2931608aca4526d982ba43d7163e3739a65fca
justind-dev/Collatz
/collatz.py
3,254
3.9375
4
# Collatz Conjecture # Cycle through all numbers, for each cycle: # 1 - record steps to 1 for each number. # 2 - Record # of odd numbered steps, # 3 - Record # of even numbered steps, # 4 - Record highest number achieved class Number: def __init__(self,number): self.starting_number = number sel...
3a2173c17c5a4f0bea32f430b3c8bed6e0e8bbed
nick102401/ProjectCollaborationPlatform
/FastApi/common/demo.py
357
3.90625
4
if __name__ == '__main__': month = "JanFebMarAprMayJunJulAugSepOctNovDec" # 将所有月份简写存到month中 n = input("请输入月份代表的数字:") pos = (int(n) - 1) * 3 # 输入的数字为n,将(n-1)*3,即为当前月份所在索引位置 findmonth = month[pos:pos + 3] print("月份的简写为:" + findmonth + ".")
b63f0024d81aa5f6544c05cf56beed31c060771e
kazu914/atcoder
/practice/arc067/c/main.py
963
3.5
4
#!/usr/bin/env python3 import collections as cl import sys def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def yakusu(n): ans = [] for i in range(1, int(n**(1/2)//1) + 1): ...
3cca4e7c2eb4e3037f71f46f940dac29f82f4c56
cyobero/portfolio
/python/simple-nba-betting/src/app.py
726
3.8125
4
from utils import get_results from urllib.error import HTTPError if __name__ == "__main__": team = "" year = 2022 while True: user_input = input( """ Enter team and year season ends (example: `bos 2022` returns game results for Boston Celtics 2021-2022 season) [p...
99f34519f8de03afb2e07042ccf596a763b9759c
marchelazo/LABPYTHON
/historia.py
881
3.71875
4
import random, string libreriacarr=["COMPUTER SCIENCE","INGENIERIA EMPRESARIAL","ADMINISTRACION"] libreriaamigo=["Tuki","Paola","GE","Mencos"] libreriaedad=["18","19","20"] historia_lenght=200 historieta= libreriaamigo + libreriacarr + libreriaedad texto="" texto2="" texto3="" #print(historie...
5cc7ac89fd3229d7230b67728beb0007af363e7c
devesh17/Test1
/PythonApplication1.py
553
3.78125
4
input_count = int(input()) seat_plan = {1:"WS",2:"MS",3:"AS",4:"AS",5:"MS",0:"WS"} for i in range(input_count): current_seat = int(input()) front_seat = 0 seat_type = "" x = current_seat % 12 y = 2*( (6 -x) % 6) + 1 if((x > 6)): front_seat = current_seat - (2*(x-6)) + 1 ...
a5d52d0d23f830861e736598dcf2b27dc2627f23
cmcahoon01/pythonPhysics
/physics.py
4,693
3.796875
4
from graphics import * import time import random speed = int(input()) grav = 100 drag = 1 friction = 0.99 squish = 2 fall = 0 class Ball(Circle): def __init__(self, pt, r, w, bs, yS=0, xS=0): Circle.__init__(self, pt, r) self.window = w self.xSpeed = xS self.ySpeed = yS ...
b45f14375e5673818739f15f1ec2fc201ecc5156
jasonrbr/advent-of-code-2020
/challenge3.py
625
3.515625
4
def getTreesHit(terrain, xSlope, ySlope=1): trees_hit = 0 currentX = 0 rowLength = len(terrain[0]) for rowIndex in range(0, len(terrain), ySlope): if terrain[rowIndex][currentX] == '#': trees_hit += 1 currentX = (currentX + xSlope) % rowLength return trees_hit with open...
6954a34ad762bab5870976aee3a7ee749cb46874
AlyssiaPH/PythonBase64
/decode_encode/decode.py
3,260
4.15625
4
"""Module encode #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ from decode_encode.helpers import * def ascii_list_to_char(code_list): """ Convert an int list to ascii list :param code_list: :type code_list: list :return a list of ascii: """ for i in range(len(code_list)): co...
b4cdb142fd4b425de0ffb819bf81b17c00736f41
vmchenni/PythonTest
/Module-3-Practice/ClassOverriding.py
481
3.671875
4
class Rectangle(): def __init__(self,length,breath): self.length=length self.breadth=breath def getArea(self): print(self.length*self.breadth, "Area of rectangle") class Sqaure(Rectangle): def __init__(self,side): self.side= side Rectangle.__init__(self,side, sid...
795b2c2cb7c4f68f9170db0532c290d1dcea6eb6
vmchenni/PythonTest
/Module-3-Updated/Module-3-Assignment-10.py
386
4.25
4
# Write a program that accepts a comma separated sequence of words as input and prints the words in a comma-separated sequence after sorting them alphabetically. # Suppose the following input is supplied to the program: # without,hello,bag,world # Then, the output should be:bag,hello,without,world myinput=input("Enter...
0131164b73a26f8a3a412d7379b77ecf315f22a8
vmchenni/PythonTest
/Module -2 Case Study-2.py
1,076
3.5
4
# Encryption and De-Cryption is not implemented, As my machine is not allowing to install packages # Open database file for reading file = open("DatabaseForUsers.txt", "r+") # Collect reference ID from User print("Enter Reference ID:-") sReferenceIDFromUser = str(input()) # Collect finger print from user print("Enter...
227e0e196babd17af58aa80bb1128b15a1f0d81c
vmchenni/PythonTest
/Module-3-Assignment/Assignment-3.py
155
3.515625
4
# 3.Suppose list1 is [2445,133,12454,123], # what is max(list1) ?a)2445b)123c)12454d)1334 list1=[2445,133,12454,123] print(max(list1)) # Answer: # 12454
93d7fcce1e6868ba82fdf11fa9cde50ce362443a
vmchenni/PythonTest
/Module-3-Updated/Module-3-Assignment-3.py
399
4.4375
4
# Weather forecasting organization wants to show is it day or night. So, # write a program for such organization to find # whether is it dark outside or not. # ANSWER from datetime import datetime now = datetime.now() current_hour = int(now.strftime("%H")) print("Current hour is:-", current_hour) if current_hour > 19 ...
04e522376d99f80e305fc675360181569db41050
vmchenni/PythonTest
/Module -4 NumKeyAndPandas/SlicingInNumpy.py
341
3.671875
4
import numpy as np # arr=np.arange(2,20) # print(arr) # print(arr[6]) # arr=np.arange(20) # print(arr) # # arr_slice=slice(1,10,3) # print(arr_slice) # # print(arr[arr_slice]) # arr=np.arange(20) # print(arr[5:]) #prints all elements starting index # # print(arr[:15]) # Prints elements to upto index x=np.empty([3,2...
f94362471cb1e1497cd90da59b221a6a8f162e19
vmchenni/PythonTest
/Module-5/Module-5-Assignment/Module-5-Assigment-2.py
506
3.875
4
# 2. The dataset given, records data of city temperatures over the years 2014 and # 2015. Plot the histogram of the temperatures over this period for the cities of # San Francisco and Moscow import pandas as pd import matplotlib.pyplot as plt import numpy table = pd.read_csv("CityTemps.csv") table.head() # plt.plot(t...
5604d406bed0bc1d1adfb64b54e5f44854587407
jailway/AdventofCode
/day 06/day06.py
3,943
3.9375
4
def load_data() -> [(int, int)]: """ Loads points coordinates from input file :return: Cooordinates array of tuples """ coords = [] with open('06_input.txt', 'r') as f: for l in f.readlines(): x, y = l.split(", ") coords.append((int(x), int(y))) return coords...
dce1241014ff7ecd49fc747bd4b49b698aea6cee
MacBookProne/PythonPractice
/tuples.py
648
4.21875
4
#!/usr/bin/python tup1 = ('Lincoln', 'JFK', 'Jefferson', 'Hamilton'); tup2 = ('1804','1963', '1865', '1825') print("tup1[0]: ", tup1[0]) #prints index tup1 0 print("tup2[1:5]: ", tup2[1:5]) #prints the dates of tup2 print(tup1[-2]) #prints the index of -2 tup3 = ('Adams', 'Roosevelt', 'Obama', 'Taft', 'Grant') ...
e210c2970958069abb5970f30ebba3e4444e87a4
nikhil366/opencv-Python
/04_Image_gradient_Edge_Detection/Sobel_x_gradient.py
1,189
4.03125
4
'''Here in this we will discuss about Sobel_x Gradient''' import cv2 import numpy as np from matplotlib import pyplot as plt from numpy.lib.type_check import imag image_path = ('/home/nikhil/Desktop/Data/ni.jpg') image = cv2.imread(image_path, 0) image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # laplacian lap = cv2....
dbbc9a876e0a293aa5aaf90ce7e672c7a49de3d1
nikhil366/opencv-Python
/02_Computer_vision_MATLAB/02_opencv_MATLAB.py
973
3.65625
4
''' In this file we learn how we can open multiple images ''' import cv2 as cv import numpy as np from matplotlib import pyplot as plt img_path = ('/home/nikhil/Desktop/Data/Black_white_image.jpg') img = cv.imread(img_path) ret, th1 = cv.threshold(img, 50, 255, cv.THRESH_BINARY) ret, th2 = cv.threshold(img, 200, 255...
705d12cb55f2bfee98e9956715f9606dd89e2a46
nikhil366/opencv-Python
/03_CV_Morphological_on_Image/03_Morphological_Transformation.py
1,316
3.5625
4
'''Morpholgical transform are some simple operation based on image shape it is only perfromed on binary image''' import cv2 import numpy as np from matplotlib import pyplot as plt from numpy.lib.shape_base import get_array_prepare image_path = ("/home/nikhil/Desktop/Data/colorball.jpg") img1 = cv2.imread(image_path,...
e37f92521fdc0cb9835a5e09a7d0674ef04c8318
nikhil366/opencv-Python
/02_Computer_vision_MATLAB/01_opencv_MATLAB.py
591
3.6875
4
''' Matplotlib is a comprehensive library for creating static animated, and interactive visualizations in Python. Matplotlib makes easy things easy and hard things possible in this file we learn how we can open image via matplotlib ''' import cv2 from matplotlib import pyplot as plt image_path = "/home/nikhil/Picture...
f3d14faa4d7fb7e0e0b56e93506481160d0270a0
rakib06/LearnPythonBasic
/HackerRank/Problem Solving/staircase.py
610
3.953125
4
#!/bin/python3 import math import os import random import re import sys # Complete the staircase function below. def staircase(n): for i in range(n): print(' ' * ((n - i) - 1) + '#' * (i + 1)) def miniMaxSum(arr): arr.sort() print(arr) n = len(arr) maxSum, minSum = 0,0 for i in rang...
77bf3568089d84dca57ebccf21f5df9caf089b6b
rakib06/LearnPythonBasic
/CRO/Molecule.py
620
3.578125
4
def spin_words(sentence): my_list = sentence.split() result = '' for i in range(len(my_list)): x = my_list[i] if len(x) >= 5: x = x[::-1] if i != 0: result = result + ' ' + x else: result += x return result s = 'rettel rettel Kata than in etirW than desre...
4348641d69d9947c8745dec361dbc0e51a8a5f07
rakib06/LearnPythonBasic
/Thesis/DFLP_31_oct_code/DFLP_31_oct_code/src/cost_sort_read_and_write.py
1,700
3.734375
4
# function for cost (4th) element key, will be used for cost def take_cost(elem): return elem[4] # Open a file fo = open("test.txt", "r+") print ("Name of the file: ", fo.name) # function for read all the output line by line and store it to line_list line = fo.readlines() line_list = [] for i in range(0, len(li...
185b0a6eb16b34b04e208cbcb2277a607667f65e
rakib06/LearnPythonBasic
/HackerRank/Easy_problems.py
2,261
4
4
def finding_the_percentage(): if __name__ == '__main__': n = int(input()) student_marks = {} for _ in range(n): name, *line = input().split() scores = list(map(float, line)) student_marks[name] = scores query_name = input() print('{0:.2f}...