blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
3.06M
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
3.06M
fcfcbf9381003708979b90a0ca204fe54fe747cc
amit-shahani/Distance-Unit-Conversion
/main.py
1,193
4.25
4
def add_unit(list_of_units, arr): unit = str(input('Enter the new unit: ').lower()) conversion_ratio = float( input('Enter the conversion ration from metres: ')) list_of_units.update({unit: conversion_ratio}) # arr.append(unit) return list_of_units, arr def conversion(list_of_units, arr): ...
5ec1bf0690ceb85f212932ab3f3c51c5bce55fe7
FR3NKru/geekbrain
/HomeWorks/les1/5.py
756
3.640625
4
proceeds = int(input('Введчите выручку предприятия: ')) outlay = int(input('Введчите расходы предприятия: ')) if proceeds > outlay: print('Ваша фирма работает в прибыль') profitability = (proceeds-outlay)/proceeds print('Рентабельность фирмы: ', profitability) employees = int(input('Введите численность ...
da2b799d587329cbba52e21feff899ab69fe98e8
Yanda29/-Prak4Algo_Yanda-Puspita-Sari_061092100001
/ElemenKom4(2).py
1,088
3.765625
4
print("@ @ @@@@@ @ @ @@@@ @@@@@") print(" @ @ @ @ @ @ @ @ @ @ @") print(" @ @@@@@ @ @ @ @ @ @@@@@") print(" @ @ @ @ @@ @ @ @ @") print(" @ @ @ @ @ @@@@ @ @") import sys ulang=9 while ulang==9: print("==========KONVERSI=============") pr...
a651156196c0edf43db78c0bfe5b4dd09b325ab0
palanikumar123456/calculator_application
/calculator_app/calculator_main_app.py
1,110
4
4
""" calculator main application file. This applicaiton is our caluculator functionality appliction. It provides aritmetic operations on two numbers like addition, subtraction, multiplication division. """ from additions import add from multiplications import mul from divisions import div from subtractions import sub ...
3d40a68e7f049d454c9c9687129cd6037e025fc4
iafinn/LA-culinary-clusters
/data-processing/haversine.py
875
3.875
4
from math import radians, cos, sin, asin, sqrt def haver(lon_list, lat_list, lon2, lat2): """ this very useful function is from: https://stackoverflow.com/questions/4913349/haversine-formula-in-python-bearing-and-distance-between-two-gps-points Calculate the great circle distance between two points i...
8f3858c86e097af9d2b246ddecb834c5abd9e584
Max143/python-math
/Mathematical Problems/Perfect Number - easy.py
578
4
4
''' Python Program to Check if a Number is a Perfect Number A perfect number is a whole number, an integer greater than zero; and when you add up all of the factors less than that number, you get that number. Examples: The factors of 6 are 1, 2, 3 and 6. 1 + 2 + 3 = 6 The factors of 28 are 1, 2, 4, 7, 14...
f43b03ba82e698dd36db6bac76150a7514119084
Max143/python-math
/Mathematical Problems/Not solved Yes/Digits at Ten’s Place -very hard.py
350
3.65625
4
''' Python Program to Form an Integer that has the Number of Digits at Ten’s Place and the Least Significant Digit of the Entered Integer at One’s Place sanfoundary source ''' n=int(input("Enter the number:")) tmp=n k=0 while(n>0): k=k+1 n=n//10 b=str(tmp) c=str(k) d=c+b[k-1] print("The new...
746dd2131405b18c007289ef79ffffc8d7442aea
DavidSMtz/TestingSistemas
/ene-jun-2020/David Sena/Practica4/Pokemon.py
965
3.5
4
from abc import ABC, abstractclassmethod import requests class Pokemon():#Constructor de la clase def __init__(self,name,weight): self.Name = name self.Weight = weight class BiblioPoke(ABC):#Clase abstracta para que esta sea la interface @abstractclassmethod def Search(id): ...
fea7530045475d850342160d178dbcdf1027790b
jvalin17/FileComparison
/FileCompare/FileComparisonTest.py
8,343
3.828125
4
import unittest import io import os #importing file comparison function from file_checker import FileComparison class TestFileComparison (unittest.TestCase): #setup test object, FileComparison class object and directory path def setUp(self): unittest.TestCase.setUp(self) self.file...
854578f9b15446d000ae6a2b8e0578e84bc4b802
JiyeKim/rosalind
/jykim/lcsm.py
2,763
3.796875
4
""" Problem A common substring of a collection of strings is a substring of every member of the collection. We say that a common substring is a longest common substring if there does not exist a longer common substring. For example, "CG" is a common substring of "ACGTACGT" and "AACCGTATA", but it is not as long as po...
3168f759cd26fec16382fd28e75b6f58f0842d91
chefgs/py_samples
/arithmatic.py
332
3.984375
4
# # arithmetic if __name__ == '__main__': a = int(input()) b = int(input()) sum = a + b print(str(sum)) if b < a: diff = a - b print(str(diff)) else: print("Difference: Input b is greater than a. So output will be in negative, hence ignored") prod = a * b print(s...
a5f7e54bd93e3445690ab874805e4e57005cecde
galhyt/python_excercises
/roads.py
2,852
4.125
4
#!/bin/python3 import math import os import random import re import sys # # Complete the 'numberOfWays' function below. # # The function is expected to return an INTEGER. # The function accepts 2D_INTEGER_ARRAY roads as parameter. # # returns the number of ways to put 3 hotels in three different cities while the dis...
63fe4733ee2ab64784cd7c0b22ca01d49c247ace
Calebjoshua/LetsUpgrade-Python
/day 5 assignment python/primeNumbers.py
239
3.609375
4
def prime(num): for i in range(2, num): if num % i == 0: return False else: return True fltrobj = filter(prime, range(2500)) print("prime numbers between 1-2500:", list(fltrobj))
e51c980cb80e88b4b6ff1fc7e9e617e7cf4b895e
sirJiggles/probability-scripts
/lottery.py
2,617
3.84375
4
# Value a ball can be (1-49) possibleValues = range(49) amountOfBalls = 6 # calculate the number of leafs in the tree for this # we know we have 49 numbers so when we select one # number the possible choices for the next number goes down # by one (no mater what happened in the presvious choice!) # for our example it...
13f3f54d9921ba0435ee87bd210aa2e370f602cb
tuliofalmeida/GrupoProg2019
/IMC. Aline.py
876
3.859375
4
# IMC alturaFloat = 1.59 pesoFloat = 52.0 imc = pesoFloat/(alturaFloat**2) print(imc) print("Muito Abaixo do Peso?", imc < 17.0) print("Abaixo do Peso Normal?", imc >= 17.0 and imc <=18.5) print("Dentro do Peso Normal?", imc > 18.5 and imc <= 25.0) print("Acima do Peso Normal?", imc > 25.0 and imc >= 30.0) ...
ec98981be4a4bbd7e20966bc21d51c05610a8f33
Ouassim001/van-input-naar-output
/pizzacalculator.py
522
4.03125
4
print("----------------------------------------------") print("pizza small kost 5$") print("pizza medium kost 8$") print("pizza large kost 10$") pizzasmall = int(input("hoeveel pizza small wil je? ")) pizzamedium = int(input("hoeveel pizza medium wil je? ")) pizzalarge = int(input("hoeveel pizza large wil je? "...
89694e6e9a739d07786309bcd7d9b59aed07031f
uncoding/Python
/test_if.py
213
3.53125
4
#!/usr/bin/env python # -*- coding: utf-8 -*- age = raw_input('please input age') if age > 18: print 'this is a adult man' print 'can do somethings' else: print 'this is a child' print 'can not do the works'
9cee7dccd02c51061af57ae544e9696bde451141
roger933/Test
/division.py
332
3.96875
4
def division (num1,num2): return num1 / num2 num1 = int(input("Introduzca el primer numero ")) num2 = int(input("Introduzca el segundo numero ")) try: resultado = division(num1,num2) print("El resultado es %d " % resultado) except ZeroDivisionError: print("No se puede dividir ent...
1bd458f150f97dd84780f65da401e59ec7fbfd5a
pkiop/Timechecker_web
/TimeChecker_web/backend/server/templates/python_class_example.py
260
4.25
4
#python_class_example.py class MyClass: """A simple example class이건 독 스트링""" i = 12345 def f(self): return 'hello world' def __init__(self, a): self.i = a # def __init__(self): # self.i = 22222 x = MyClass(3) print(x.i) print(x.f())
a9624ef9c928c1f86a5c4a376546ebcbb2af3a63
steviedupree14/CSCI220
/sortDriver.py
484
3.71875
4
## sortDriver.py from sort import * def main(): list1 = [18,12,1,24,6,30,8,3,15,22] print ("Unsorted list:") print (list1) selSort(list1) print ("\nSorted list:") print (list1) l2 = ["ban", "home", "apple", "cow", "doe", "zoo"] print ("Unsorted list:") print (l2) selSort(l2...
d08ae3ca4333091d25e9a234a4879edda1cfa77f
steviedupree14/CSCI220
/hangman.py
5,212
3.859375
4
# Christopher Moore # hangman.py # Problem: This program plays a game of Hangman using a text file containing secret # words. # Certification of Authenticity: # # I certify that this lab is my own work, but I discussed it with Professor Stalvey # many, many times (sorry). from random import * from g...
74faffa606f66e7272cc4fba106e75eda378cfde
malldisaesar/-100DaysOfPython
/Day 3/rollercoaster.py
419
4
4
print("Welcome to the rollercoaster!") height = int(input("What is your height in cm? ")) if height >= 120 : print("You can ride this roller coaster, Enjoy!") age = int(input("How old are you?")) if age > 18 : print("You have to pay $12") elif age >= 12 and age <= 18: print("You have to ...
e65f118183df43c8c0d66015f75696f52c1e9ee3
blackplusy/1101
/例子-1115-04.列表操作.py
533
3.75
4
#coding=utf-8 l=['kobe','rose','AI'] #列表的访问 #1.直接访问 print(l) #2.遍历访问 for i in l: print(i) #3.成员访问 if 'kobe' in l: print('24') #索引和切片 l=[1,3,5,7,9] print(l[0]) print(l[-3]) print(l[:-2]) print(l[1:3]) print(l[::-1]) #列表的修改 l=[1,3,5,7,9] print(l) l[2]=0 print(l) l[-3]=999 print(l) #列表的拼接 ...
399be6a3dbc6d28005e86a09493bdf62efe123d7
V0lund/Hangman
/Hangman.py
1,200
3.953125
4
print("H A N G M A N") print("The game will be available soon.") # Global variables words = ['python', 'java', 'kotlin', 'javascript'] # functions def word_choice() -> str: from random import randint return words[randint(0, 3)] def game_play() -> int: tries = 8 while tries > 0 and '-' ...
c14420ac81ffec947353d9d74bc0c12d2bf8d256
Diogoflowers/Jogo-da-velha-PYTHON
/Jogodavelha.py
3,386
3.96875
4
jogovelha = [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '] def Tabela(): print(' │ │') print( f' {jogovelha[0]} │ {jogovelha[1]} │ {jogovelha[2]}') print(f' ...
a3773cef0a598b914cbc25e16abed5b05f364f6d
daone92277/programming_exercises
/Week5_OOP/assignments/animal.py
1,240
3.828125
4
class Animal(): def __init__(self, name, health): self.name = name self.health = health def walk(self): self.health -= 1 return self def run(self): self.health += 5 return self def display_health(self): print "the", self.name + "...
ddf400145e4172097df1882284b9a2bcdc6632fe
tipishev/advent_of_code_2017
/03b.py
1,530
3.953125
4
from collections import defaultdict directions = RIGHT, UP, LEFT, DOWN = '→↑←↓' def spiral(): counter = 0 while True: counter += 1 for _ in range(counter): yield RIGHT for _ in range(counter): yield UP counter += 1 for _ in range(counter): ...
cf75bb3e8b40e1682138e32268f05da5b1748bed
tipishev/advent_of_code_2017
/17b.py
443
3.5625
4
def stops_at(length, after, step_size): return (after + step_size) % length def run(step_size, num_iterations): buffer = [0] current = 0 for it in range(1, num_iterations + 1): stop_at = stops_at(it, current, step_size) insert_at = stop_at + 1 if insert_at == 1: buf...
791db445b1a5c4ad439a65d02a5c1aa71a0de307
RichardPotthoff/state-machines
/LedCube.py
37,023
3.625
4
""" A 4x4x4 cube of LEDs for the visual display of the state of a state machine with 256 states: 4x4x4 LED-positions x [red | green] x [continuously on | blinking] = 256 The x,y,z coordinates are in gray-code [0,1,3,2], or [00,01,11,10] in binary: wrap-around top/bottom, left/right, back/front. Each neighbouring...
10deac28b62f9a9d0b8196a31f5505f782ec1b02
WesRoach/coursera
/specialization-intro-discrete-math-computer-science/delivery-problem/code/lib.py
14,654
4
4
import networkx as nx import math from itertools import permutations, chain, combinations def cycle_length(g, cycle): """ Quiz: Cycle Weight ------------------ This function takes as input a graph g and a list of vertices of the cycle. (Each vertex given by its index starting from 0.) The gra...
ca4d91259df8f6e121732590d5c91eaf35a1002c
WesRoach/coursera
/specialization-intro-discrete-math-computer-science/number-theory-and-cryptography/week2/quiz-diophantine-equations-code/diophantine_equations.py
687
3.703125
4
def extended_gcd(a, b): assert a >= 0 and b >= 0 and a + b > 0 if b == 0: d, x, y = a, 1, 0 else: (d, p, q) = extended_gcd(b, a % b) x = q y = p - q * (a // b) assert a % d == 0 and b % d == 0 assert d == a * x + b * y return (d, x, y) def diophantine(a, b, c)...
611e26e3690cfd562d5722bddb58675617e24b52
WesRoach/coursera
/specialization-data-structures-algorithms/algorithmic-toolbox/week3/solutions/1_money_change/python/change.py
404
3.984375
4
# Uses python3 import sys def get_change(m): denominations = [10, 5, 1] coins = 0 for denomination in denominations: if m >= denomination: coins_of_denomination = m // denomination coins += coins_of_denomination m -= coins_of_denomination * denomination retu...
5c23070568b655b41f55e81f65a2d5840bd9b9c8
WesRoach/coursera
/specialization-data-structures-algorithms/algorithmic-toolbox/week3/solutions/7_maximum_salary/python/largest_number.py
979
4.3125
4
from typing import List from functools import cmp_to_key def compare(s1: str, s2: str) -> int: """Returns orientation of strings producing a smaller integer. Args: s1 (str): first string s2 (str): second string Returns: int: one of: (-1, 0, 1) -1: s1 first produces sm...
6e4f5a3ee7c774e48614cc58985c8ad015ee424b
WesRoach/coursera
/specialization-intro-discrete-math-computer-science/delivery-problem/week1/labs/plot.py
3,838
3.71875
4
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.7.1 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # + import networkx as nx import matplotlib.pyplot as p...
d310e56245b953d987ad36dd88207201d3fc8ffd
forksofpower/exercism-practice
/python/pangram/pangram.py
251
3.890625
4
import string def is_pangram(words): # create alphabet alphabet = set(string.ascii_lowercase) # create set from words string_set = set(words.lower()) # check if alphabet is in string_set return alphabet.issubset(string_set)
a829d3a8988537e38ce371aff2b007d0cdc08f29
anujmodii/My_Captain_Python
/Q6.py
261
4.03125
4
a=int(input("Enter 1st side")) b=int(input("Enter 2nd side")) c=int(input("Enter 3rd side")) if a==b and b==c: print("Equilateral Triangle") elif a!=b and b!=c and a!=c: print("Scalene Triangle") else: print("Isosceles Triangle")
6e7e6449171cd39bf9c0c986e6378e433d46de84
S-North/Roasting-code
/chatroom.py
3,062
3.734375
4
import random import modules.console as console import modules.bot_code as bot_code # we can put our bot functions in here and reference them with bot_code.function_name() from colorama import init, Fore init(autoreset = True) #Set autoreset to True else style configurations would be forwarded to the next print stateme...
8ac569146e5c407d8ca33facd09ac571d4a79c15
skyey6/pythonlearn
/Course12-字典/dict02.py
747
4
4
""" 使用内置函数dict,或者是字典的生成式语法来创建字典 """ # dict函数(构造器)中的每一组参数就是字典中的一组键值对 person = dict(name='王大锤', age=55, weight=60, home='中同仁路8号') print(person) # {'name': '王大锤', 'age': 55, 'weight': 60, 'home': '中同仁路8号'} # 可以通过Python内置函数zip压缩两个序列并创建字典 items1 = dict(zip('ABCDE', '12345')) print(items1) # {'A': '1', 'B': '2', 'C': ...
423c4247d7df7f11089c44b4d57883d20d801783
baxter-t/Practice
/codingProblems/deleteNth.py
588
4
4
''' Given a list lst and a number N, create a new list that contains each number of lst at most N times without reordering. For example if N = 2, and the input is [1,2,3,1,2,1,2,3], you take [1,2,3,1,2], drop the next [1,2] since this would lead to 1 and 2 being in the result 3 times, and then take 3, which...
d5610400e3577e4bab9cc2165166db9106e58480
baxter-t/Practice
/codingProblems/betterThanAvg.py
287
3.75
4
''' Better than average Given an array of class points, and your points, determine if you are better than the average ''' def better_than_average(class_points, your_points): return sum(class_points)/len(class_points) < your_points print(better_than_average([1,2,3,4], 4))
9901dd9ebb20c27db8e1519bcd71db450b7a7b2e
baxter-t/Practice
/codingProblems/productFib.py
399
4.25
4
''' Find the product of nth fibonacci numbers ''' def nthFib(n): if n == 0 or n == 1: return n return nthFib(n-1) + nthFib(n-2) def prodFib(prod): n = 2 product = nthFib(n) * nthFib(n - 1) while product <= prod: if product == prod: return True n += 1 ...
06915475790b3e09156ef24f30eb482aabfe4803
baxter-t/Practice
/codingProblems/binMultiple.py
294
3.625
4
inp = '110' def binToInt(inp): reversd = inp[::-1] total = 0 for i, k in enumerate(reversd): total += (2 ** i) * int(k) return total def binMultiple(b, m): return binToInt(b) % m == 0 print(binToInt(inp)) print(binMultiple(inp, 3)) print(binMultiple(inp, 4))
5db8181c806f08641b78fa4ddef6a7fd2859586c
baxter-t/Practice
/codingProblems/missingPosInt.py
440
3.984375
4
''' Given an array of integers, find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well. ''' def missingInt(arr): for i in range(len(arr) - 1): ...
917da9bbee12041cfce3f96a1bb16d2ec075a752
semih7/Echo-Client-Server-Chat-App
/Client.py
1,298
3.515625
4
import socket #soket kütüphanesi kullanılmak üzere import edildi. IP = "localhost" #Bağlanılacak olan ip adresi yazıldı. Port = 8080 #Server'ın dinlediği port numarasına bağlantı kurmak için tanımlandı. my_username = input("Username : ") ...
67be931f837cb3ea62e98270ca371a63ac6f9dfe
modlinski/project_euler
/problem_3_largest_prime_factor.py
1,399
4.03125
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ :brief: Module containing solutions of Project Euler Problem 3. :author: Michal Modlinski :created: 04.08.2017 """ from time import time import itertools from math import sqrt def largest_prime_factor_1(number): beg = 2 for num in itertools.count(beg): ...
ac62d41b303030a68923c3eda0a1985901e00c28
spashii/minimax-algorithm
/t3.py
1,362
3.546875
4
x=['X','X','X'] o=['O','O','O'] p1='X' ai='O' # X is player # O is AI # T is tie score={ 'X': int(1), 'O': int(-1), 'T':int(0) } def PosWin(maze): for i in range(3): for j in range(3): if(maze[i][j]==''): return '' for i in maze: if i==x: return 'X' elif(i==o): return 'O' if(maze[0][0]=='X' and...
af6d5fe2380e398440bd0031e03db2ad6ee69b1e
ixobert/advent-code-2020
/Day-2/main.py
1,316
3.828125
4
import argparse from typing import List parser = argparse.ArgumentParser() parser.add_argument('--input-file', default='input.txt') def run(entries:List[str]) -> int: result = len(entries) for minimum, maximum, character, word in entries: character_count = word.count(character) if character_co...
80daf8c1d9cf8ebb13cbc9540336f91b4d972101
ixobert/advent-code-2020
/Day-7/main.py
2,437
3.75
4
import argparse from os import remove from typing import Dict, List, Tuple parser = argparse.ArgumentParser() parser.add_argument('--input-file', default='input.txt') def run(target:Tuple[int, str], entries:Dict[str, Tuple[int, str]]) -> int: def breadth_search(rules:Dict[str, Tuple[int, str]], root:str, target:...
2f78c4ea18183aed5070cc83fd697dd27a43fd8f
celrose/DataStructs
/linkedlist/liststack/__init__.py
767
3.9375
4
from linkedlist import LinkedList from linkedlist.node import LinkedListNode class Stack: def __init__(self): self.items = LinkedList() def push(self, item): self.items.append(item) def pop(self): if self.size() == 0: return None else: current ...
621e68e7032a8ec9a307ea915ef622341b1a69f7
EdwardRutz/data-scraping
/scraper.py
618
3.703125
4
# Find text on a page with Beautiful Soup from urllib.request import urlopen # handle server requests to url from bs4 import BeautifulSoup html = urlopen('https://treehouse-projects.github.io/horse-land/index.html') # Pass in the url to scrape soup = BeautifulSoup(html.read(), 'html.parser') # create BSoup object...
0d8d6e17a34b339d0d2dea52d2a706c0412551f2
Shambhavi-gupta19/DigitalAlpha
/Test/Quest1.py
1,410
3.796875
4
#Question1: import re sen=[] updated_sen=[] v=0 u=0 l=0 s=0 r=0 str=input("Enter a paragraph with atleast 4 sentences : ") #print the paragraph: print("Paragraph : \n",str) #Updating the middle sentence: sen=str.split(".") sen[int((len(sen)-1)/2)]="UST Global specializes in Healthcare, Retail & Consumer Goods, Banki...
c7002b9503d9b3e5051d700d4e5c2160107ce4c0
Shambhavi-gupta19/DigitalAlpha
/4thApril/ques4.py
277
3.859375
4
print("Prime numbers between 900 and 1000 are : \n") for n in range(900,1001): if n > 1: for i in range(2,int(n/2)): if (n % i) == 0: break else: print(n) if n%10 == 9: print(n ,"is a palindrome")
e038f6d5e16d8f4903a1f467634d36b9142d351b
Shambhavi-gupta19/DigitalAlpha
/4thApril/ques2.py
478
3.59375
4
import re str = "#Python is an interpreted high level programming language for general-purpose programming*." updated_str = re.sub('[^A-Za-z0-9 ]+', '', str) print("Updated string is : ",updated_str) str2 = str.split(' ') for i in range(len(str2)): if(str2[i] == str2[i][::-1]): print("Pallindrome is : ",st...
6bbbf5b59d2ccad85ea2bd1391d9af4472f09c16
Shambhavi-gupta19/DigitalAlpha
/April5/ques5.py
604
4.0625
4
import math num1=int(input("Enter 1st number ")) num2=int(input("Enter 2nd number ")) print("{}! : {}".format(num1, math.factorial(num1))) print("{}! : {}".format(num2, math.factorial(num2))) print("LCM of {} and {} : {}" .format(num1, num2, ((num1*num2)/math.gcd(num1, num2)))) print("HCF of {} and {} : {}" .format(n...
0b52e4ad1eef997e3a8346eb6f7ea30c4a591bb9
JankaGramofonomanka/alien_invasion
/menu.py
1,794
4.21875
4
from button import Button class Menu(): """A class to represent a menu.""" def __init__(self, screen, space=10): """Initialize a list of buttons.""" self.buttons = [] self.space = space self.height = 0 self.screen = screen self.screen_rect = screen.get_rect() #Number of selected button. self.select...
196fcd8fc1f84a3ea61fe21d0bc82c0c3487c101
kame2lam/Machine-Learning-Algorithm
/1.數據預處理/ch1-4.py
320
3.53125
4
from sklearn import preprocessing import numpy as np #原始數據X X = np.array([[3, -2., 2.], [2., 0., 0.], [-1, 1., 3.]]) #初始化數據預處器,最大絶對值縮放 min_max_scaler = preprocessing.MinMaxScaler(feature_range=(-2,6)) #數據轉換並打印 X_minmax = min_max_scaler.fit_transform(X) print(X_minmax)
10b3a083dd971ad6d15fb3835cfe5f550c313558
Roitta11/Caesar-Cipher-Encryption-and-Decryptionwith-Tkinter
/CaesarCipherProject.py
3,160
4.03125
4
from tkinter import * import tkinter.font as font import tkinter as tk # Caesar Cipher Encryption Algorithm def encryption(): cipherText.delete(0,'end') plainText= str(userMessage.get()) keyValue = int(userKey.get()) cipher="" for i in plainText: if i==' ': cipher = cipher +...
0295c1509be22a96fa0be89fc1224de1d7719aa4
laszlokiraly/advent-of-code
/2017/day11.py
1,194
3.578125
4
""" solution for day 11 part 1 and 2 """ import re import util DAY11_INPUT = util.load_input('day11.input')[0] def solve(input_data): """ solve day 11 part 1 and 2 """ x_coor = 0 y_coor = 0 max_distance = 0 for direction in re.split(r'[,]+', input_data): if direction == 'n': ...
d4edf1b727f6088e6cfa4686098e8af79da7cb65
laszlokiraly/advent-of-code
/2017/day10_2.py
2,331
3.625
4
""" solution for day 10 part 2 """ DAY10_INPUT = "206,63,255,131,65,80,238,157,254,24,133,2,16,0,1,3" def convert_to_ascii(input_data): """ convert input data to ascii representation """ result = [ord(c) for c in input_data] result += [17, 31, 73, 47, 23] return result def hash_knot(input_dat...
ee19f685bf59a801596b6f4635944680ada27bc9
MateuszSacha/Iteration
/development exercise 1.py
317
4.3125
4
# Mateusz Sacha # 05-11-2014 # Iteration Development exercise 1 number = 0 largest = 0 while not number == -1: number = int(input("Enter a number:")) if number > largest: largest = number if number == -1: print("The largest number you've entered is {0}".format(largest)) ...
d65301d59c5b05379a78b94156db6ef71a43138e
MateuszSacha/Iteration
/iteration starter task 4.py
234
4.03125
4
# mateusz sacha # 20-10-2014 # iteration starter task 4 total = 0 for count in range(0,5): number = int(input("Please enter number:")) total = total + number print("The total of the numbers you entered is {0}".format(total))
8995e16a70f94eddc5e26b98d51b1e03799ef774
MateuszSacha/Iteration
/half term homework RE3.py
302
4.1875
4
# Mateusz Sacha # Revision exercise 3 total = 0 nofnumbers = int(input("How many number do you want to calculate the average from?:")) for count in range (0,nofnumbers): total = total + int(input("Enter a number:")) average = total / nofnumbers print("The average is {0}".format(average))
f21ec0da60229bc4bf168c2da676832921d3a603
Aakash-Sunkara/Python-Coursera
/Lists.py
429
4.09375
4
fname = input('Enter the file name:') words = list() file = open(fname) for line in file: pieces = (line.rstrip()).split() for element in pieces: # if element in words is True: # continue # else: Why doesn't this work?? Why are elements repeated?? # words.a...
91d6856ffaad8eb3aad5747690f0080979f09593
Aakash-Sunkara/Python-Coursera
/Remove duplicates from list.py
374
4.0625
4
n = int(input("Enter number of elements : ")) # 'map' is a function score = list(map(int, input("\nEnter the numbers : ").strip().split()))[:n] # dict.fromkeys takes items from list as keys. Since keys can't be duplicated, # we get unique values and duplicates are removed score = list(dict.fromkeys(score)) score.sor...
69888758ed2df56b02e2ccedcc7bd8b6d729d552
Poppy-Wang/Python-Demo
/selenium6.py
5,451
3.6875
4
''' 自动化测试框架:unittest 1.单元测试:是指对软件中最小可测试单元进行检查和验证,对于单元测试中单元的含义,一般来说,要根据实际 情况去判断其具体含义,如C语言中单元指一个函数 function add(int a,int b){ } java里单元指一个类,图形化的软件中可以指一个窗口或一个菜单等,总的来说,单元就是人为规定的最小的测试 功能模板,单元测试是在软件开发过程中要进行的最低级别的测试活动,软件的独立单元将在与程序的其他部分相 隔离的情况下进行测试 2.unittest框架是python的单元测试框架,java->junit 3.unittest=TestCase+TestResult ...
5cbed6cdc2549ec225e478fb061deeff30cf5666
lleonova/jobeasy-algorithms-course
/4 lesson/Longest_word.py
305
4.34375
4
# Enter a string of words separated by spaces. # Find the longest word. def longest_word(string): array = string.split(' ') result = array[0] for item in array: if len(item) > len(result): result = item return result print(longest_word('vb mama nvbghn bnb hjnuiytrc'))
4d583ade0e0b6941f2396bc9f15f3b32212b039f
lleonova/jobeasy-algorithms-course
/3 lesson/Fibonacci_recursion.py
303
3.984375
4
# The equation for the Fibonacci sequence: # φ0 = 0, φ1 = 1, φn = φn−1 + φn−2. # # Equation: # F0 = 0 # F1 = 1 # F2 = 1 # Fn = Fn-1 + Fn-2 def fibonacci(n): if n == 0: return(0) elif n == 1: return(1) return(fibonacci(n-1) + fibonacci(n-2)) print(fibonacci(9))
8a69feedb8da68729ee69fd193a3db2d8c59dc88
lleonova/jobeasy-algorithms-course
/2 lesson/Fibonacci.py
1,251
4.28125
4
# The equation for the Fibonacci sequence: # φ0 = 0, φ1 = 1, φn = φn−1 + φn−2. # # The task is to display all the numbers from start to n of the Fibonacci sequence φn # Equation: # F0 = 0 # F1 = 1 # F2 = 1 # Fn = Fn-1 + Fn-2 def fibonacci(n): fibonacci_1 = 1 fibonacci_2 = 1 if n == 0: print(0)...
04e373740e134f7b71f655c44b76bba0c51bd6a1
lleonova/jobeasy-algorithms-course
/3 lesson/Count_substring_in_the_string.py
720
4.28125
4
# Write a Python function, which will count how many times a character (substring) # is included in a string. DON’T USE METHOD COUNT def substring_in_the_string(string, substring): index = 0 count = 0 if len(substring) > len(string): return 0 elif len(substring) == 0 or len(string) == 0: ...
ce18fcd87767095b84e6773b9d93797f160dd660
jamessonfaria/maratona_python
/day_07/save.py
248
3.5
4
import csv def save_to_csv(jobs): file = open('jobs.csv', 'w') writer = csv.writer(file) writer.writerow(['title', 'company', 'location', 'how_old', 'link']) for job in jobs: values = list(job.values()) writer.writerow(values)
12c8d29b8315f3edae30eb5d36d5de4db89101a0
alxmirandap/Coding
/HackerRank-Statistics/day0_1.py
370
3.515625
4
#!/usr/bin/python3 # -*- coding: utf-8 -*- from utils import Utils from stats import Stats input() line = input() values = line.split() numbers = [int(i) for i in values] numbers.sort() average = Stats.mean(numbers) median = Stats.median(numbers) mode = Stats.mode(numbers) print(Utils.scale(average...
974c7fc80bae44d34e06d7aee9d08f4134b02caf
alxmirandap/Coding
/HackerRank-Statistics/stats.py
3,615
3.640625
4
#!/usr/bin/python3 # -*- coding: utf-8 -*- from functools import reduce import math class Stats: @staticmethod def mean(points): """Returns the arithmetic mean of points """ return sum(points)/len(points) @staticmethod def median(points): """Returns the median of points """ N = len...
0f7931d8a9cf228d246beb412da42d93b1abe13f
Rejig00/Uber-Data-Analysis
/src/Python/temp_box.py
518
3.5625
4
import pandas as pd import datetime import matplotlib.pyplot as plt import numpy as np df = pd.read_csv("uber_nyc_enriched.csv") data_to_plot = np.array([df.query('temp >= 75 and borough == ["Manhattan"]').pickups.values, df.query('temp < 75 and borough == ["Manhattan"]').pickups.values]) plt.boxplot(data_to_plot...
b95a0082db1cfb1bbebe61108590f47a3b64267e
jakpop/python-exercises
/cwiczenia3/zad2.py
383
3.875
4
import datetime def convertDateFormat(date, date_format): date_format = date_format.replace('yyyy', '%Y') date_format = date_format.replace('yy', '%y') date_format = date_format.replace('mm', '%m') date_format = date_format.replace('dd', '%d') return date.strftime(date_format) dt = datetime.dat...
e0dcb054aac0c16d3a617d95f07b996a6ed4a237
tuscanmoon/MSc-Project-Work
/dataClasses.py
11,063
3.5
4
####################################################### # # Name: DataClasses.py # Description: Defines the classes used in the Text CategorizationCategory system # It is abstracted one layer up from the persistent data storage, # this data storage is via a RDBMS. The workings of the datab...
4fbd1885afcf84ebfed9b7757650ea774d2bde74
StackSquirrel/StackSquirrel.github.io
/date_match.py
494
3.734375
4
#! python3 # Written by Donna MacLeod, Sept 2018 # date_match.py - matches dates with regex format: Thursday, September 20, 2018 # \w+.\d+,.\d{4} matches August 7, 2018 # \w?\w?\w?\w{3}day,.\w+.\d+,.\d{4} matches Wednesday, August 7, 2018 import re source = open('./texts/text-with-dates.txt') text = sou...
d3dcd6ddc0cd2a494061767139b8c1e17d9505ea
Priyadharshinii/Playerrr
/oddintervals.py
128
3.984375
4
num1=int(input("Enter a number")) num2=int(input("Enter another number")) for i in range(num1,num2+1): if i%2!=0: print i
d50ab3f5beb62e8146a7e1ec2c8f66faf5673123
pragatirahul123/practice_folder
/codeshef.py
244
3.90625
4
num=int(input("enetr a numb:")) if (num%2==0) : if (num >200): print("bingo") elif( num%2!=0 ): if (num < 200): print("ringo") else: print("codeshef") else: print("codeshef")
c291e79cd5f13190327a2d1fa51dcdbf0668be78
pragatirahul123/practice_folder
/list_user_pair.py
132
3.765625
4
list=[4,2,3,1,5,6] user=int(input("enter a number")) index=0 while index<(user): print(list[index],"",end="") index=index+1
66db39164628280219e3849c8cddeed370915ccb
pragatirahul123/practice_folder
/codeshef1.py
206
4.1875
4
# Write a program to print the numbers from 1 to 20 in reverse order. # Output: 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 var=20 while var>=1: print(var," ",end="") var=var-1
754bba52f8cfa074da85490534e6349282e3f984
pragatirahul123/practice_folder
/incement_dec.py
123
3.734375
4
var=4 bar=2 while var>=0: print(var) var=var-2 while bar<=4: print(-bar) bar=bar+2 #output #4 #2 #-2 #-4
717ed5e8a448d0ee945b06370ee0e8c0bd9d734c
pragatirahul123/practice_folder
/charact_sum.py
177
3.59375
4
list1=["m","na","i","mo"] list2=["y","me","s","na"] index=0 new=[] while index<len(list1): var=list1[index]+list2[index] new.append(var) index=index+1 print(new)
4796a5ae9f06e10195b26452c95e7d756231058a
Francepnadeau/Final_Project_2017
/Implementations/Recurrences_Myers_v1.py
1,684
3.625
4
# France Paquet-Nadeau # Feb 23, 2017 # Recurrences in Gene Myer article 'What's behind BLAST' p.10 #VARIABLES: # k represents the length of the query. # d is the number of errors. # s is the size of the alphabet. import sys def sum1(k,d,s): #summation for inserts total=0 #corresponds to the ...
80f4e24ad2a152d442be8df2bed6bafd536020e6
levictorsmith/cs450
/week01/teach01.py
2,003
3.640625
4
import random import numpy as np class Movie: def __init__(self, title = "", year = "", runtime_min = 0): self.title = title self.year = year self.runtime_min = runtime_min if runtime_min >= 0 else 0 def __repr__(self): return self.title + " (" + self.year + ") - " + str(self.runtime_min) + " mi...
2165226143649bceb331a4994aefedd7386fb67e
YuzheSHI/Learning_Computer_Vision
/LearningCV/pixelOperation.py
326
3.75
4
import numpy as np import cv2 img = cv2.imread("test.JPG") px = img[100,100] print(px) # select some pixels of image blue = img[100,100,0] print(blue) # access only blue pixels # numpy array methods to access color scale print(img.item(100,100,0)) # blue print(img.item(100,100,1)) # green print(img.item(100,100,2)) ...
3f69d6abcca9971f266402b6eda42e62a399aab2
OdayaGU/TestProject
/TestProject/src/homework_1.py
373
4.15625
4
import pandas as pd print ("welcome to your first HW: FILTER BY. So yallaa...") df = pd.DataFrame({"ID":[703,783,788,780,790],"NAME":["John","James","Marry","Gil","Roy"], "LEVEL":[5,5,4,5,4],"GRADE":[87,88,90,65,100]}) print (df) print ("--------------") print ("Your task: given the dataframe above print on ...
7b1e6f250a0ce1c0f619ad35e740fa8fcdc2280a
lakeo/practise
/trie.py
683
3.796875
4
# encoding=utf8 class Node: def __init__(self): self.is_left = False self.nodes = {} self.count = 0 class Tree: def __init__(self): self.root = Node() def insert_word(self, word): curr = self.root for c in word: if c not in curr.nodes: ...
c4cccc3d4865be2d14ddefda9550e0d90487d017
vanDeurs/Games
/die.py
447
3.84375
4
from tkinter import * from random import randint randomNumber = randint(1,6) def throw(): text.delete(0.0, END) text.insert(END, str(randomNumber)) if randomNumber % 2 == 0: print("You threw an even number.") else: print("You threw an odd number") window = Tk() text = Text(window, width=...
3491a2c56d9e5761996237f2be8060de2a8a6e4b
BDDM98/Evaluador-Posfijo
/compilador.py
2,100
4.1875
4
# -*- coding: utf-8 -*- class Pila: """ Representa una pila con operaciones de apilar, desapilar y verificar si está vacía. """ def __init__(self): """ Crea una pila vacía. """ # La pila vacía se representa con una lista vacía self.items=[] def apilar(self, x): ...
332d1b054b97606699fa9b83c16d3aac45518822
tomisingloria/CISS-441
/a2/a2assignment.py
2,506
3.765625
4
import csv import sqlite3 db_file = 'swift_lyrics.db' conn = sqlite3.connect(db_file) def create_swift_table(): """ Here i am creating the table for my data. """ c = conn.cursor() sql_str = """ create table if not exists taylor_swift_lyrics ( id integer primary key autoincrement, ...
e4b579ed067e3f38d42efc1f1d6956d5a49e0226
AnanyaAppan/DSA-sem-2
/classStuff/2.py
519
3.75
4
a = [] n = input('enter size of matrix:') print 'enter elements of matrix ' for i in range(n): a.append(map(int,raw_input().strip().split(' '))) c = [] for i in range(n): c.append([]) for j in range(n): c[i].append(a[i][j]) for i in range(n): for j in range(n): for k in range(n): ...
02698d4e884ca9cd38ba889f81c799faefbe3d07
ankit-sinhation/5th-Semester
/guessing no 1.py
839
3.84375
4
import random jackpot=random.randint(1,100) print("Guess the jackpot no between 1 to 100.") #print("the jackpot number is" ,jackpot) counter=1 guess=input("Guess kar bro : ") while guess!=jackpot: try: guess=float(guess) if(guess==jackpot): exit elif(guess<jackpo...
0db9f4302d3a522123975fa9e9f5f62bf73ed506
buianhduc/C4T-B10
/session11/P6/calculate_total.py
417
3.78125
4
computer = { 'HP':20, 'DELL':50, 'MACBOOK':12, 'ASUS':30, } computer['TOSHIBA'] = 10 computer['FUJISTSU'] = 15 computer['ALIENWARE'] = 5 price = { 'HP':600, 'DELL':650, 'MACBOOK':12000, 'ASUS':400, 'TOSHIBA':600, 'FUJISTSU':900, 'ALIENWARE':1000, } total = 0 for key in com...
c2e1da523b5d12b49154c64af3f148a5b35a99e7
buianhduc/C4T-B10
/hackathon/SS2/Hack2.py
58
3.640625
4
n=int(input("Nhap n: ")) for i in range(n+1): print(i)
c218eddbbaa529e97e66158edb31357455f4e370
buianhduc/C4T-B10
/hackathon/SS2/Hack4.py
127
3.71875
4
from turtle import * i=int(input("Nhap so canh: ")) angle=360/i for n in range(i): forward(50) right(angle) mainloop()
2cb8a12d3f5815249c4f3d3d4f6d3f15901d854d
buianhduc/C4T-B10
/session2/practice/stamgiac.py
140
3.59375
4
d = float(input("Nhap base cua tam giac: ")) h = float(input("Nhap chieu cao cua tam giac: ")) s=(h*d)/2 print("Dien tich tam giac la: ", s)
df0e88838df692efea96bc545ecacac1aa87167f
Sbhavyarao/Python-ICPS
/Lab Assignments/Lab1/Q2.py
462
3.875
4
import operator def Merge(dist1, dist2): return {**dist1, **dist2} # Merging two dictionaries by using '**kwargs' Dist1 = {"Mani": 92, "Nani": 85, "pane": 78, "hhr": 65} Dist2 = {'d': 45, 'r': 67, 'y': 56, 'T': 87, 'h': 34} Dist3 = Merge(Dist1, Dist2) print("Merged Dictionary: ", Dist3) sorted_d = sorted(Dist...
e7af9bbfa7c3def17b7e734fb06bfd6a99297a8c
Data-Semi/DataStructure-Project4-A_star-route-planner
/test.py
1,508
3.640625
4
from helpers import load_map from student_code import shortest_path MAP_40_ANSWERS = [ (5, 34, [5, 16, 37, 12, 34]), (5, 5, [5]), (8, 24, [8, 14, 16, 37, 12, 17, 10, 24]) ] MAP_10_ANSWERS = [ (4, 9, -1) ] def test(shortest_path_function): map_40 = load_map('map-40.pickle') map_10 = load_map(...
3bc968d6d2f61843265ca08654c7cd81c637f659
DanIurcu/Test
/FavoriteFruit.py
241
4.0625
4
from random import randint fruits=["Banana","Apple","Kiwi","Pear","Orange"] name=input("What's your name? ") print("Hello "+name+", your favourite fruit is "+fruits[randint(0,len(fruits)-1)]) print() input("Press return to continue...")
5f061b9eeb3bfbb4e7425e3356e3bd5cfe19b77f
Ys-Zhou/lab-projects
/_1_python_basic/daikan.py
1,234
3.765625
4
# objectを明示的に継続しなくてもいい class Daikan: def __init__(self, name: str, money: int): # 出来ればメンバー変数のスコープを小さくにする(__memberはprivate、_memberはprotected、memberはpublic) self._name = name self._money = money def greet(self): print('name:%s money:%d' % (self._name, self._money)) class Akudaik...