blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
545k
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
545k
675ab06bd6f1512e00daa95ab82697de8d3a6f08
m-m-adams/ChallengeServer
/Solutions/ChallengeClient.py
3,125
3.5625
4
import socket import time import select ########################################################### # Class declarations ########################################################### ########################################################### # Challenge Interface # This class is a...
6739e2d0bbde7dd5b96001abf6c3e775c765acb2
BMHArchives/ProjectEuler
/Problem_9/Problem_9.py
605
3.6875
4
import numpy as np import math def round_up(n, decimals=0): multiplier = 10 ** decimals return math.ceil(n * multiplier) / multiplier def FindAnswer(): sum = 1000 numbers = [] range_a = round_up(sum/3, -2), range_a = int(range_a[0]) range_b = int(sum/2) for a in range(1,range_a): ...
c5db4886b9e216f7da109bcfdd190a2267d7258b
BMHArchives/ProjectEuler
/Problem_1/Problem_1.py
1,128
4.21875
4
# Multiples of 3 and 5 #--------------------- #If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. #Find the sum of all the multiples of 3 or 5 below 1000. numberCount = 1000 # Use this number to find all multiples under the numberCount total...
84fa0e7c67f83e895ab25832db97d086807a4689
luturol/learning-python
/snake-game/app.py
5,442
3.546875
4
import os from msvcrt import getch class SnakeGame(object): screen = None def __init__(self, rows_count, column_count): self.screen = self.initialize_screen(rows_count, column_count) self.collided = False def initialize_screen(self, rows_count, column_count): #creat...
c0d728b393c1b9184357b51442f0f3ee96e0db3d
edvalvitor/projetos
/python/media2.py
1,215
4.15625
4
#Programa para calcular a média e quanto falta para passar #Centro Universitário Tiradentes #Edval Vitor #Versão 1.0.1 while True: print("Programa para calcular média da UNIT") print("Se você quer calcular a sua média digite 1") print("Se quer calcular quanto precisa para passar digite 2") opcao = int...
868fa6af1abc4794475a805bc1aba88de1c468ee
wragon/Fall_Detection_System
/user.py
868
3.78125
4
# About User Info class UserInfo: name = "" number = "" location = "" def __init__(self): self.set_user() def set_user(self): self.set_name() self.set_number() self.set_location() def set_name(self): self.name = input ("사용자 이름: ") #self.name =...
7a1672a4dcf3a4b717001d7504315692b5209305
lucasmarcao/slot_pra_python
/slot_para_python/jogodatabuada.py
1,087
3.5
4
import random cont=0 try: testandomatriz = random.sample([1,4,2],counts=[5,5,5], k=7) print(testandomatriz) except Exception as e: print("famoso erro") print("Você precisa de 10 pontos para ganhar") while(cont<10): prim = random.randint(1,11) seg = random.randint(1,11) print("a...
7396455c9f1af991085a0a7954f7a75c55ea7986
qilin-link/-algorithm015
/Week_08/merge.py
1,181
3.796875
4
############################### # leetcode [56] 合并区间 ############################### from typing import List class Solution: def merge(self, intervals: List[List[int]]) -> List[List[int]]: if not intervals: return [] n = len(intervals) res = [] left = intervals[0][0] ...
f87ddea432ce38f221e1d2bd793f375b7d27a125
martius-lab/GateL0RD-paper
/src/environments/remote_control_gym.py
19,880
3.65625
4
""" Simple control task where an agent can control a robot after accessing a computer. The goal is to bring the robot to a goal location The scenario is implemented in the OpenAi Gym interface (gym.openai.com) """ import gym from gym import spaces, logger import remote_control_gym_rendering as rendering i...
a0411df383523974ac3d9bfec5c4031066dcfe93
Serge-Mavuba/Python-List-Comprehensions
/Lists Comprehensions.py
3,665
4.34375
4
# List = [1,2, "collection ", "of", "data", "surronded", "by", "brackets", "and", "the", # "elements", "are", "separated", "by", "commas"] # List comprehensions = # ["is", "also", "surronded", "by", "brackets","but", "instead", "of", "a", "list", "of", "data", "inside" # "you", "enter", "an", "expression", "followed...
b436c92cebb0c6af8e53b211d2b85bb68374ea4b
diagram-ai/vishwakarma
/vishwakarma/pdfplot.py
4,625
3.609375
4
# -*- coding: utf-8 -*- ''' Build visualizations for continuous distributions [Uniform, Gaussian, Exponential, Gamma] Example: from vishwakarma import pdfplot pdfplot.gaussian(mu, sigma) Attributes: Todo: ''' import requests import tempfile import os import random import shutil import string import date...
077c33b4377263224f651ff989fd186d289d71ff
hongweifei/Fly-python
/compiler/ast.py
2,156
3.546875
4
from .token import * from enum import Enum,unique,auto @unique class TreeType(Enum): NONE = auto() # IMPORT = auto() # include,import RETURN = auto() # return VAR = auto() # 变量声明 FUNCTION = auto() # 函数声明 UNION = auto() # 定义联合体 STRUCT = auto() # 定义结构体...
c219b35384dcc23574658cfcbae883f4223f8709
LRG84/python_assignments
/average7.5.py
538
4.28125
4
# calculate average set of numbers # Write a small python program that does the following: # Calculates the average of a set of numbers. # Ask the user how many numbers they would like to input. # Display each number and the average of all the numbers as the output. def calc_average (): counter = int (input('How ...
cfa1235528a3b32f4c93e015f89ef13b2b8053be
LRG84/python_assignments
/Celsius_5degree_increments.py
323
3.984375
4
#write a program that outputs a table of celsius temperatures from 1-100, in increments of 5 #in addition, the corresponding farenheit temperature should be listed. #upload to github for a in range (0,101,5): cel_temp = a far_temp = cel_temp * (9/5) + 32 print ('celsius =',cel_temp,'farenheit =',far_temp...
0095ae6aada5352dee242b1ec05a027fd695de99
VishLi777/python-practice
/bonus_practice1/task6_1_1.py
490
3.90625
4
# Реализуйте функцию fast_mul в соответствии с алгоритмом двоичного умножения в столбик. # Добавьте автоматическое тестирование, как в случае с naive_mul. def fast_mul(x, y): if x == 0 or y == 0: # add condition return 0 r = 0 # r = 1 while y > 0: if y % 2 == 1: r +...
6cbc3f38656ead6125e3c1cc360d9e0e2a1de979
ttitus72372/GitHubTesting
/main.py
597
3.546875
4
''' x = 0 while x <= 10: x +=1 print(x) #print(x) list1 = [1,4,7,9,11,34,65] for item in list1: #print(item) if item <= 20: print(item) numb1 = int(input("Please enter a number:\n")) numb2 = int(input("Please enter another number:\n")) numb3 = numb1 + numb2 print(numb3) ''' list2 = [] counter = 0 while...
66a863f91af4b1fb778e0b8edface323d321f370
RasmusKnothNielsen/PicoCTF2019
/General_Skills/whats_the_difference/whats_the_difference_solution.py
597
3.546875
4
# Whats-the-difference # General skills # PicoCTF 2019 # Author: Rasmus Knoth Nielsen # Open the kitters.jpg file and read it into memory with open('./kitters.jpg', 'rb') as f: kitters = f.read() # Open the cattos.jpg file and read it into memory with open('./cattos.jpg', 'rb') as f: cattos = f.read() flag =...
1420c19f9f80614f5d3b6ba122ed7b1d9f51122f
shihan123a/Daily_-summary
/绘图函数/递归函数.py
238
4.03125
4
import sys def Factorial(num): if num == 1 : return 1 else: result = num * Factorial(num-1) return result if __name__ == '__main__' : result = Factorial(5) print('5的阶乘是:{}'.format(result))
833bd691452513944dabb2af51272c90c70c8eaf
lucasrwv/python-p-zumbis
/lista III/questao04.py
273
4.125
4
#programa fibonacci num = int(input("digite um numero ")) anterior = 0 atual = 1 proximo = 1 cont = 0 while cont != num : seun = proximo proximo = atual + anterior anterior = atual atual = proximo cont += 1 print("o seu numero fibonacci é %d" %seun)
ddfd3b2738cce2d2d41f57cd21687fa488e76f2b
lucasrwv/python-p-zumbis
/lista II/questao02.py
259
3.953125
4
# ano bixesto ano = int(input("digite o ano: ")) if ano % 4 == 0 and ano % 100 != 0 : print("o ano é bissexto") elif ano % 4 == 0 and ano % 100 == 0 and ano % 400 == 0 : print("o ano é bissexto") else : print("o ano nao é bissexto")
fef2ed2eaf412fa0a834c78b34b9b44a5539ad8a
vijaykumar0425/hacker_rank
/find_angle_mbc.py
232
3.5625
4
# Enter your code here. Read input from STDIN. Print output to STDOUT import math import sys AB = int(sys.stdin.readline()) BC = int(sys.stdin.readline()) sys.stdout.write(str(int(round(math.degrees(math.atan2(AB,BC)))))+'°')
87b9e6213dcff364197171e9afeaedb337ffb85d
cloew/KaoEnum
/kao_enum/enum.py
310
4
4
class Enum: """ Represents an Enum Value """ def __init__(self, name, value): """ Initialize the enum """ self.name = name self.value = value def __repr__(self): """ Return the string representation of this code """ return self.name
a57a741e02e04d1f68da45e92fcbf8185c338f36
mizanur-rahman/HackerRank
/Python3/30 days of code/Day 15: Linked List/Solutions.py
992
4.0625
4
class Node: def __init__(self,data): self.data = data self.next = None class Solution: def display(self,head): current = head while current: print(current.data,end=' ') current = current.next def insert(self,head,data): #Complete ...
ef5382ae6d2ee520c0557fd3e6a391a23aaee001
Ashokkommi0001/Python-Patterns-Numbers
/_1.py
234
4.09375
4
def _1(): for row in range(7): for col in range(7): if (col==3 or row==6) or (row<3 and row+col==2): print("*",end="") else: print(end=" ") print()
a0767955d16ae2f862b4a531a76a8184e8787d48
LucasVanni/Curso_Python
/Exercícios/ex031.py
346
3.703125
4
viagem = float(input('Qual a distância da sua viagem? ')) if viagem <= 200: valor = viagem * 0.5 else: valor = viagem * 0.45 valor = viagem * 0.5 if viagem <= 200 else viagem * 0.45 print('Você está prestes a começar uma viagem de {}KM.'.format(viagem)) print('E o preço da sua passagem será de R${:.2...
5fdcd02074edb64c999337c33c6c19bc83969632
LucasVanni/Curso_Python
/AulasCursoemVideo/Desafio 034.py
246
3.890625
4
salario = float(input('Digite o valor do salário: ')) if salario >= 1250.00: aumento = (salario * 10/100) else: aumento = (salario * 15/100) print('Com o salário de R${}, irá ter um aumento de R${}'.format(salario, aumento))
793d6472ec2b57d50651c22328f73ab33782cfac
LucasVanni/Curso_Python
/AulasCursoemVideo/Desafio 020 - nome dos quatro alunos ordem sorteada.py
412
3.703125
4
import random n1 = str(input('Digite o nome do primeiro aluno a ser sorteado: ')) n2 = str(input('Digite o nome do segundo aluno a ser sorteado: ')) n3 = str(input('Digite o nome do terceiro aluno a ser sorteado: ')) n4 = str(input('Digite o nome do quarto aluno a ser sorteado: ')) lista = [n1, n2, n3, n4] ...
28727bb99a537272c5e73381d48e565bcf9316c3
LucasVanni/Curso_Python
/Exercícios/ex017.py
346
3.859375
4
from math import hypot co = float(input('Comprimento do cateto oposto: ')) ca = float(input('Comprimento do cateto adjacente: ')) hip = hypot(ca, co) hi = (co ** 2 + ca ** 2) ** (1/2)# maneira matemática print('A hipotenusa vai medir {:.2f}'.format(hip)) print('A hipotenusa no método matemático vai medi...
fd589aec05438820a5d63f54515ef62ea4d2f5b1
mrerikas/Mastery_Python
/find_duplicates.py
523
4.0625
4
def find_duplicates(list): duplicates = [] for item in list: if list.count(item) > 1: if item not in duplicates: duplicates.append(item) return duplicates print(find_duplicates(['a', 'b', 'c', 'a', 'd', 'd', 'e', 'f', 'g', 'f'])) # or without function() list = ['a', ...
14743b046284e9c60f213351695433fd0c763a11
jcheong0428/psy161_assignments
/sandbox20160216.py
1,050
3.84375
4
def size(A): i=[] while type(A)==list: i.append(len(A)) A=A[0] return tuple(i) def slicer(lst,slicelist,i=0): res = [] if isinstance(slicelist,slice): return res else: print lst, slicelist, for i,e in enumerate(lst[slicelist[i]]): print i,e ...
a085d9ff5c97264c048a0f265806c906647d90df
shyam-de/py-developer
/d2exer1.py
1,091
4.1875
4
# program to check wether input number is odd/even , prime ,palindrome ,armstrong. def odd_even(num): if num%2==0: print("number is even") else: print( 'number is odd') def is_prime(num): if num>1: for i in range(2,num//2): if (num%i)==0: print('...
c0a5c9e9dffd82f9bf748ed09963ebde4e9c8fd1
ShimizuKo/AtCoder
/ABC/100-109/109/B.py
233
3.5625
4
N = int(input()) word_list = [] ans = "Yes" for i in range(N): word = input() word_list.append(word) if i != 0: if not(word[0] == word_list[i - 1][-1] and word_list.count(word) == 1): ans = "No" break print(ans)
4d6fdfa22d2fb1555731651c32a588dde6552795
ShimizuKo/AtCoder
/企業コン/三井住友2019/B.py
120
3.609375
4
N = int(input()) ans = ":(" for x in range(1, N + 1): n = int(x * 1.08) if n == N: ans = x break print(ans)
1a2a51b714e82ae71922c9dfb5d3b002923d53b3
Crow07/python-learning
/python learning/循环/for.py
390
3.984375
4
for i in range(3): print('loop',i) for i in range(0,6,2): print("loop",i) age_of_crow = 22 count= 0 for i in range(3): guess_age = int(input("guess age:")) if guess_age == age_of_crow: print("yes,all right") break elif guess_age > age_of_crow: print("smaller") else: ...
d5f5fc08d19273e530ff46658c3b67804bebf92d
tweatherford/COP1000-Homework
/Weatherford_Timothy_A9_Sort_Search_Rainfall.py
3,810
3.703125
4
''' Assignment#9: Rainfall Version - Sorts data, searches array, and outputs to file. Programmer: Timothy Weatherford Course: COP1000 - Intro to Computer Programming ''' #Initial Variables rainArray = [] count = 0 file = open("rainfallData.txt","r") sortStatus = False outputFile = open("Weatherford_Timothy_A9_Python_Ra...
f179a86035e710a59300a467e2f3cd4e9f8f0b15
tweatherford/COP1000-Homework
/Weatherford_Timothy_A3_Gross_Pay.py
1,299
4.34375
4
##----------------------------------------------------------- ##Programmed by: Tim Weatherford ##Assignment 3 - Calculates a payroll report ##Created 11/10/16 - v1.0 ##----------------------------------------------------------- ##Declare Variables## grossPay = 0.00 overtimeHours = 0 overtimePay = 0 regularPay = 0 #Fo...
f9e3d8e6a7ab0bc54e40128daf95ab132f5360f7
BVGdragon1025/-wiczenia
/Semestr 1/cwiczenia4/cwiczenia6.py
245
3.65625
4
a = int(input("Podaj liczbę: ")) b = 0 c = 0 while a % 2 == 0 or a % 3 == 0: b += 1 if a % b == 0: if a == b: break c = a + b print(b) else: if b == a: break continue
ef8a51fe8281b47ccb7f0e64986aab70d585982a
BVGdragon1025/-wiczenia
/Semestr 1/cwiczenia6/cwiczenia2.py
521
3.640625
4
from statistics import median tab = [] n = int(input("Podaj początek zakresu: ")) x = int(input("Podaj koniec zakresu zakresu: ")) while True: if n == 0 or x == 0: print("Podałeś gdzieś zero") break else: for i in range(n, x): i += 1 tab.append(i) tab_2 = tab[...
6db7314e823010875b7f68d7defd4b094a144cb2
BVGdragon1025/-wiczenia
/Semestr 1/cwiczenia9/cwiczenia2.py
857
3.8125
4
import statistics tel = { "Jan": "123456789", "Robert": "123456789", "Andrzej": "123456789", "Karol": "123456789", "Romek": "123456789", "Szymon": "123456789", "Grzegorz": "123456789", "Karolina": "123456789", "Anna": "123456789", "Maja": "123456789" } """for i in range(10): ...
5375af97c9022b28682ef915e1bad014247daf7b
BVGdragon1025/-wiczenia
/Semestr 1/cwiczenia7/cwiczenie7.py
1,282
3.5
4
import random tab_r = [] tab_u = [] tab_w = [] print("Zaczynamy losowanie liczb...") for i in range(0, 6): a = random.randint(1, 49) if a in tab_r: a = random.randint(1, 49) tab_r.append(a) if a not in tab_r: tab_r.append(a) print("Wylosowałem") print("Teraz wprowadź swoje liczby...
80c1d701bc33441af1a566dc9853b1b1a89de84b
BVGdragon1025/-wiczenia
/Semestr 1/cwiczenia4/cwiczenia2a.py
141
3.640625
4
x = float(-254) while x >= -320: while x % 2 != 0 and x % 5 == 0: print(x) x -= 1 else: x -= 1 pass
a703c51fb4b25f59051085a1477c78f14144477d
BVGdragon1025/-wiczenia
/Semestr 1/cwiczenia5/polacz91011.py
935
3.640625
4
import random tab = [] print("1 - Lotto") print("2 - Multi Multi") print("3 - Mini Lotto") w = int(input("Wybierz które losowanie chcesz przeprowadzić: ")) if w == 1: for j in range(0, 6): i = random.randint(1, 49) if i in tab: i = random.randint(1, 49) tab.append(i) ...
2cdb9ee58bed41b39c88a0e6995e8d8cf59e6684
BVGdragon1025/-wiczenia
/Semestr 1/cwiczenia7/cwiczenia2.py
168
3.515625
4
tab = [] for i in range(0, 10): a = int(input("Podaj dowolną liczbę: ")) tab.append(a) i += 1 print("Wybrane elementy: ", tab[1], tab[4], tab[7], tab[9])
1d9f8283d44840cf14f3177d10e95a282fae61d7
BVGdragon1025/-wiczenia
/Semestr 1/Prace zaliczeniowe/Program7.py
2,396
4
4
import dateutil.easter import datetime def menu(): print("Witaj w programie!") print("Co chcesz zrobić? ") print("[1] Dowiedzieć się co było wczoraj i jutro ") print("[2] Odkryć w jaki dzień się urodziłeś ") print("[3] Dowiedzieć się kiedy Wielkanoc") choice = input("Wybierz funkcję: ") if...
caddf242f33906c4946ff9491dd58336338c6072
BVGdragon1025/-wiczenia
/Semestr 1/cwiczenia.py
412
3.59375
4
x1 = input("Podaj 1 wartość: ") x2 = input("Podaj 2 wartość: ") dod = int(x1)+int(x2) # dodawanie wartosci x1 i x2 odj = int(x1)-int(x2) # odejmowanie wartości x1 i x2 mno = int(x1)*int(x2) # mnozenie wartości x1 i x2 dzi = int(x1)/int(x2) # dzielenie wartosci x1 i x2 print("Wynik dodawania: ", dod) print("Wynik...
046ecafc48914b85956a7badd6b8500232a57db4
lathika12/PythonExampleProgrammes
/areaofcircle.py
208
4.28125
4
#Control Statements #Program to calculate area of a circle. import math r=float(input('Enter radius: ')) area=math.pi*r**2 print('Area of circle = ', area) print('Area of circle = {:0.2f}'.format(area))
362eb0297bbb144719be1c76dc4696c141b72017
lathika12/PythonExampleProgrammes
/sumeven.py
225
4.125
4
#To find sum of even numbers import sys #Read CL args except the pgm name args = sys.argv[1:] print(args) sum=0 #find sum of even args for a in args: x=int(a) if x%2==0: sum+=x print("Sum of evens: " , sum)
a1fe59470da2ee519283240483f8fa24917891b3
lathika12/PythonExampleProgrammes
/ifelsestmt.py
316
4.375
4
#Program for if else statement #to test if a number is even or odd x=10 if x%2==0: print("Even Number" ,x ) else: print("Odd Number" , x ) #Program to test if a number is between 1 to 10 x=19 if x>=1 and x<=10: print(x , " is in between 1 to 10. " ) else: print(x , " is not in between 1 to 10. " )
5a44a5e2780e3c2db32b8dd8a46720fa2682655a
RohitGupta06/RohitPythonAssignments
/Module 2/Exercise II-A/math_eq_b.py
164
4.03125
4
# Evaluate using formula # Initialization x = 2 y = 5 # Evaluation A = ((2 * x) + 6.22 * (x + y)) / (x + y) # Displaying the result print("The value of A is",A)
8715a1bb07778f3099ca3d443663d0721ae908bf
RohitGupta06/RohitPythonAssignments
/Module 2/Exercise II-B/upper.py
193
4.375
4
# Taking the string input from user user_input = input("Please enter your string: ") # Changing in upper case updated_string = user_input.upper() print("The changed string is:",updated_string)
57b0f6f47db94524924487b5a6780da8855141f9
naflymim/vscode-python-pandas-work
/dataframe_ex_01.py
388
3.890625
4
import numpy as np import pandas as pd array_2d = np.random.rand(3, 3) # print(array_2d[0, 1]) # print(array_2d[2, 0]) df = pd.DataFrame(array_2d) print(df.columns) print(df) df.columns = ["First", "Second", "Third"] print(df.columns) print(df) print(df["First"][0]) print(df["Second"][2]) print(df["Third"]) df["Thi...
070c621faf5ceb32087b3f9ce6bbc2e3b4b100f7
carfri/D0009E-lab
/labb2-5a.py
604
3.65625
4
import math def derivative(f, x, h): k =(1.0/(2*h))*(f(x+h)-f(x-h)) return k ##print derivative(math.sin, math.pi, 0.0001) ##print derivative(math.cos, math.pi, 0.0001) ##print derivative(math.tan, math.pi, 0.0001) def solve(f, x0, h): lastX = x0 new = 0.0 while (abs(lastX) - abs(new...
7d4b9473e8da1f4df6818bd37ec202a1c9644b32
fitosegrera/simplePerceptron
/app.py
662
3.546875
4
from perceptron import Perceptron inputs = [-1,-1,1] weightNum = len(inputs) weights = 0 learningRate = 0.01 desired = 1 iterate = True iterCount = 0 ptron = Perceptron() weights = ptron.setWeights(weightNum) while iterate: print "-"*70 print "Initial Weights: ", weights sum = ptron.activate(weights, inpu...
1097ed658416acf59c22137682dc327629e02078
DiegoC386/Taller-Estructura-de-Control-For
/Ejercicio_10.py
627
3.75
4
#10. El alcalde de Antananarivo contrato a algunos alumnos de la Universidad Ean #para corregir el archivo de países.txt, ya que la capital de Madagascar NO es rey julien #es Antananarivo, espero que el alcalde se vaya contento por su trabajo. #Utilice un For para cambiar ese Dato with open('paise.txt') as archivo: l...
4562ef887b02ca21d7e322717c4b1c6f41b21543
Anna-Joe/Python3-Learning
/exercise/testfunction/city_functions.py
266
3.625
4
def formatted_city_country(city,country,population=0): if population!=0: formatted_string=city.title()+','+country.title()+' - population '+str(population) else: formatted_string=city.title()+','+country.title() return formatted_string
99ef2163869fda04dbe4f1c23b46e56c14af7a17
TredonA/PalindromeChecker
/PalindromeChecker.py
1,822
4.25
4
from math import floor # One definition program to check if an user-inputted word # or phrase is a palindrome. Most of the program is fairly self-explanatory. # First, check if the word/phrase in question only contains alphabetic # characters. Then, based on if the word has an even or odd number of letters, # begin co...
d11e7f3d340926f13326a0ed63661d049452ac74
dovelism/Kmeans_4_Recommendation
/Kmeans4MovieRec.py
6,850
3.578125
4
# -*- coding: utf-8 -*- """ @Author:Dovelism @Date:2020/4/5 11:30 @Description: Kmeans'implement for recommendation,using Movielens """ import pandas as pd import matplotlib.pyplot as plt import numpy as np from scipy.sparse import csr_matrix import helper # Import the Movies dataset movies = pd.read_csv('movies.csv'...
bf9df75e6eb4ccf29ec267fbec0836f73ec99394
pavan142/spellwise
/spellwise/algorithms/soundex.py
4,076
3.59375
4
from typing import List from ..utils import sort_list from .base import Base class Soundex(Base): """The Soundex algorithm class for for identifying English words which are phonetically similar Reference: https://nlp.stanford.edu/IR-book/html/htmledition/phonetic-correction-1.html """ def __init__(...
88f082a0fed712513d2968e461b00eed445526ab
sss4920/python_list
/python_basic/lab7_5.py
465
3.9375
4
''' 학번과 점수를 dictionary 를 이용하여 5개 정도 정의한다 사용자로부터 학번과 점수를 입력받아 만약 기존에 해당 학번이 없으면 dictionary 에 추가한다 성적이 높은 순으로 출력하라. ''' a={'201914009':10,'20000000':20,'100000000':30,'342ㅕ49':40,'24234':50} s = input("학번:") s1 = int(input("점수:")) if s not in a: a[s]=s1 li=sorted(a,key=a.__getitem__,reverse=True) for x in li: pri...
8c657b49cd4e298ea17b2b5573e1f7438e49a680
sss4920/python_list
/python_basic/lab5_10.py
146
4.125
4
""" 람다함수를 이용하여 절대값을 출력하라. l=[-3,2,1] """ L = (lambda x:-x if x<0 else x) l=[-3,2,1] for f in l: print(L(f))
db36adc273138a78165f9e36a09d17835a172688
sss4920/python_list
/python_basic/lab02_3.py
179
3.890625
4
""" 문제: 원주율을 상수 PI로 정의하고 반지름을 입력받아 원의 넓이를 출력하라 """ PI=3.141592 r=int(input('반지름: ')) print('넓이:'+str(PI*r*r))
6a6547bf2b47de116649d2a8f2465262114b1898
sss4920/python_list
/python_basic/lab7_6.py
565
3.78125
4
''' 이름: 전화번호를 가지는 딕셔너리를 생성하여 5개의 원소로 초기화하고 이름을 입력하면 해당 전화번호를 출력하고 해당이름이 없다면 전화번호가 없습니다를 출력 마지막에 전체의 이름과 전화번호를 출력 ''' dic = {"김수현":"1111","ㅇㅇ":"2222","ㄱㄱ":"3333","ㄴㄴ":"4444","ㄷㄷ":"5555"} name = input("이름:") if name in dic.keys(): print("%s 전화번호는 %s"%(name,dic[name])) else: print("해당 전화번호가 없습니다.") for x in dic: ...
92b81af21b824c8ce3bf88d939f61f697ba3994f
sss4920/python_list
/python_basic/lab4_7.py
239
3.765625
4
""" 팩토리얼 계산과정과 값을 출력하라. """ a = int(input("양의 정수:")) b = " " sum = 1 for x in range(a,0,-1): sum *= x if x != 1: b+=str(x)+"*" else: b+=str(x) print("%d! ="%a,b,"= %d"%sum)
4f4a148d6e3745e74a0c2c4bded6f284cf54a992
sss4920/python_list
/python_basic/lab5_8.py
581
4.09375
4
""" 매개변수로 넘어온 리스트에서 최소값과 최대값을 반환하는 함수 min_max를 정의한다 프로그램에서 ㅣ=[3,5,-2,20,9]를 정의한 후 , min_max를 호출하여 최소값은 m1최대값은 m2에 저장하고 이를 출력하라 """ def min_max(l): """ :param l: 리스트 :return: 최소값,최대값 """ min1=l[0] max1=l[0] for x in l: if min1>x: min1=x if max1<x: max1...
66f78d22a851951ee3d7a66ade4e75d6e2dbc4e7
sss4920/python_list
/python_basic/lab2_8.py
250
3.796875
4
""" 사용자로부터 x좌표와 y좌표를 입력받아, 원점으로부터의 거리를 출력한다. """ from math import * a = int(input("x좌표:")) b = int(input("y좌표:")) distance = sqrt(a*a + b*b) print("원점까지의 거리",distance)
fd35e801070b1beb3e12a927293fd2ec5d16314e
sss4920/python_list
/python_basic/ㅇㅇ.py
140
3.546875
4
test=int(input()) for x in range(test): a,b=input().split() a=int(a) temp='' for y in b: temp+=y*a print(temp)
39929223fd0fa0624313263ef16cee26b11cbb50
sss4920/python_list
/cruscal/1922.py
809
3.6875
4
import sys input = sys.stdin.readline def union(array,a,b): left = find(array, a) right = find(array, b) if left>right: array[left]=right else: array[right]=left def find(array, a): if a==array[a]: return a return find(array,array[a]) def cycle(array...
c0bbb76252f023738872456fb82bfd0e23eb3a50
kdserSH/Training-Python-SHMCC
/OOP/OOP-CS.py
970
3.984375
4
#实例可以修改实例变量,不能修改类变量,程序调用时优先寻找实例变量,其次再找类变量。 class role(object): #定义类 n = 123 #类变量 def __init__(self,name,role,weapon,life_value=100,money=15000):#构造函数,init是传参数用的,用于调用方法时传参数。 self.name=name #实例变量 self.role=role self.weapon=weapon self.life_value=life_value self.money=mo...
6e82dc8d6d525baa5c9bd4e27cadc1827cfc9d65
ravenclaw-10/Python_basics
/lists_prog/avg_of_2lists.py
355
3.90625
4
'''Write a Python program to compute average of two given lists. Original list: [1, 1, 3, 4, 4, 5, 6, 7] [0, 1, 2, 3, 4, 4, 5, 7, 8] Average of two lists: 3.823529411764706 ''' list1=[1,1,3,4,4,5,6,7] list2=[0,1,2,3,4,4,5,7,8] sum=0 for i in list1: sum+=i for i in list2: sum+=i avg=sum/(len(lis...
a113879ec0112ff4c269fb2173ed845c29a3b5e5
ravenclaw-10/Python_basics
/lists_prog/max_occur_elem.py
708
4.25
4
# Element with maximum occurence in a list=[2, 3, 8, 4, 7, 9, 8, 2, 6, 5, 1, 6, 1, 2, 3, 4, 6, 9, 1, 2] . #Python program to check if the elements of a given list are unique or not. n=int(input("Enter the no. of element in the list(size):")) list1=[] count=0 max=0 print("Enter the elements of the lists:") for ...
44dd23671d3c68a9356024dcf69785c0c520033e
ravenclaw-10/Python_basics
/lists_prog/string_first_last_same.py
409
3.953125
4
'''Write a Python program to count the number of strings where the string length is 2 or more and the first and last character are same from a given list of strings. Sample List : ['abc', 'xyz', 'aba', '1221'] Expected Result : 2 ''' list1=['abc','xyz','aba','1221'] list2=[] for i in range(0,len(list1)): ...
bea7e17c53d59d9b6f9047eeef0bb63995cc5669
jennywei1995/sc-projects
/StanCode-Projects/break_out_game/breakoutgraphics_extension.py
17,526
3.671875
4
""" stanCode Breakout Project Adapted from Eric Roberts's Breakout by Sonja Johnson-Yu, Kylie Jue, Nick Bowman, and Jerry Liao ------------------------- File: Breakoutgraphics_extension.py Name: Jenny Wei ------------------------- This program creates a breakout game. This file is the coder side, which build the impor...
7e3d68562bfb27ebe0dec9fd95a2a1e8b488ad60
LevinWeinstein/attendance_formatter
/attendance.py
4,733
3.625
4
#! /usr/bin/env python3 """ Filename : attendance.py Author : Levin Weinstein Organization : USF CS212 Spring 2021 Purpose : Convert a directory full of attendance lists to a single, aggregated attendance sheet Usage : ./attendance.py --directory="DIRECTORY" --event=[lecture|lab] > ${OUTPUT_FILE}...
6094c69f6d4fa7a0bb59fc8da0eb7fb379832514
Boukos/AlgorithmPractice
/recursion/rec_len.py
328
4.1875
4
def rec_len(L): """(nested list) -> int Return the total number of non-list elements within nested list L. For example, rec_len([1,'two',[[],[[3]]]]) == 3 """ if not L: return 0 elif isinstance(L[0],list): return rec_len(L[0]) + rec_len(L[1:]) else: return 1 + rec_len(L[1:]) print rec_len([1,'two',[[],...
609f6c607a6f8d3f363cd4c983c9c552fc58a6b1
NIKHILDUGAR/codewars4kyuSolutions
/Snail.py
352
3.59375
4
# https://www.codewars.com/kata/521c2db8ddc89b9b7a0000c1 def snail(array): res = [] while len(array) > 1: res = res + array.pop(0) res = res + [row.pop(-1) for row in array] res = res + list(reversed(array.pop(-1))) res = res + [row.pop(0) for row in array[::-1]] return res i...
7788a1f6524ed2aff9aa7b3368ff41b13418a4c4
Uvernes/DSRI_2021
/utility/nearest_rotation_matrix.py
1,761
3.515625
4
import numpy as np import math import sys """ Input ----- R - 3 by 3 matrix we want to find nearest rotation matrix for Output ------ Nearest rotation matrix """ def exact_nearest_rotation_matrix(R): A = np.dot(R.transpose(), R) m = np.trace(A) / 3 Q = A - m * np.identity(3) q...
cb227b2f3eb1500e66e84c4461846205e4c4ab63
eyeCube/Softly-Into-the-Night-OLD
/levels.py
3,835
3.578125
4
''' levels.py level design algorithms ''' import libtcodpy as libtcod import random from const import * import tilemap # generate # main procedural level generator # Parameters: # Map : TileMap object (pointer) # level : current dungeon level that we're creating # nRooms : maximum number of "rooms" t...
15f68fe0b019bb466d2d7bcfbd83c6baabf2efc4
eyeCube/Softly-Into-the-Night-OLD
/searchFiles.py
925
4.125
4
#search a directory's files looking for a particular string import os #get str and directory print('''Welcome. This script allows you to search a directory's readable files for a particular string.''') while(True): print("Current directory:\n\n", os.path.dirname(__file__), sep="") searchdir=input("...
9b1bc8b4678f0961b00ed39cb8f3f62a1cbab015
sahilchutani91/facial_keypoints
/models.py
4,312
3.59375
4
## TODO: define the convolutional neural network architecture import torch from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F # can use the below import should you choose to initialize the weights of your Net import torch.nn.init as I class Net(nn.Module): def __init__(sel...
00573e96c1c60760e541eb3c56859594e59eecc9
ministry78/pythonStudy
/HeadFirstPython/test.py
785
3.71875
4
# -*- coding: UTF-8 -*- __author__ = 'drudy' import random secret = random.randint(1,100) guess = 0 tries = 0 print "你好,我是电脑机器人,接下来我们开始一个猜数字的游戏!" print "游戏规则是:我会随机给1至100的数字,你来猜我给的数字,猜对了有奖品哦!机会只有6次哦!" while guess != secret and tries < 6: guess = input("你猜的数字是多少,请输出来?") if guess < secret: print "小了哦!还有...
551d3fc22b4c95da30104a073383c1e463bd7f5a
mnjey/RSA
/seventh_frame_wordlist_attack.py
1,667
3.609375
4
#By now,we have found that the structure of plaintext frame. #In this program,we give the prefix of the fourth plaintext frame.And we already have get the sixth plaintext frame which ends with "." and the eighth plaintext frame is " "Logic",we just construct a wordlist of the words which looks meaningful. import os ...
dc58c81a1ae7e98ab3f20f62ff3067b576e0f4f9
sasuketttiit/Hacker-Rank
/hurdle_race.py
138
3.53125
4
def hurdleRace(k, height): potion = 0 max_jump = max(height) if k < max_jump: potion = max_jump - k return potion
bfa76a889d6e60cc8e1cbd408f90217e07da3284
NagarajuSaripally/PythonCourse
/Methods/nestedStatementsAndScope.py
727
3.75
4
''' Scope is LEGB rule: Local: Names assigmned in any way with in a function E: Enclosing function locals : Names in the local scope of any and all enclosing function Global : Names assigned at the tope-level of a module file or declared ina def with in the file: B : Built-in - Names preassigned in the built in names...
8774264a6b3b9972dcda87929f0943e96d3906e6
NagarajuSaripally/PythonCourse
/ObjectAndDataStructureTypes/someFunMethods.py
8,191
4.21875
4
""" The parameter weekday is True if it is a weekday, and the parameter vacation is True if we are on vacation. We sleep in if it is not a weekday or we're on vacation. Return True if we sleep in. sleep_in(False, False) → True sleep_in(True, False) → False sleep_in(False, True) → True """ def sleep_in(weekday, vacati...
8097283ba70a2e1ee33c31217e4b9170a45f2dd1
NagarajuSaripally/PythonCourse
/StatementsAndLoops/loops.py
2,014
4.75
5
''' Loops: iterate through the dataypes that are iterable, iterable datatypes in python or in any language string, lists, tuples, dictionaries keywords to iterate through these iterables: #for syntax for list_item in list_items: print(list_item) ''' # lists: my_list_items = [1,2,3,4,5,6] for my_list_item in my...
30cf7566ca858b10b86bf6ffc72826de02134db2
NagarajuSaripally/PythonCourse
/Methods/lambdaExpressionFiltersandMaps.py
1,141
4.5
4
''' Lambda expressions are quick way of creating the anonymous functions: ''' #function without lamda expression: def square(num): return num ** 2 print(square(5)) #converting it into lambda expression: lambda num : num ** 2 #if we want we can assign this to variable like square2 = lambda num : num ** 2. # we are...
06d57c0fd60d591256825eb4992e2eded1d6b70a
GabrieLima-dev/udacity_exercises
/teste.py
190
3.625
4
idade_inteiro = int(input()) idade = idade_inteiro if idade < 12: print('crianca') elif idade < 18: print('Adolecente') elif idade < 60: print('Adulto') else: print('Idoso')
3f947479dbb78664c2f12fc93b926e26d16d2c34
ankurkhetan2015/CS50-IntroToCS
/Week6/Python/mario.py
832
4.15625
4
from cs50 import get_int def main(): while True: print("Enter a positive number between 1 and 8 only.") height = get_int("Height: ") # checks for correct input condition if height >= 1 and height <= 8: break # call the function to implement the pyramid structure ...
27dc314ba44397a66b2f0916dc25df92d1d8535b
Zeriuno/adventofcode
/2016/d4.py
1,381
3.515625
4
def get_ID_tot(param): """ Opens the param file, looks for the real rooms and returns the sum of their sector IDs """ tot_ID = 0 list = open(param, "r") for r in list: r = Room(r) if (r.is_real): tot_ID += room.ID return tot_ID class Room: """ Room object. """ def __init__(self): """ Creation o...
e10a267a92be6ae4eb564140f7fc1d9fdd80b53e
Everton42/video-youtube-rsa
/criptografia-cifra-de-cesar/criptografia.py
391
3.578125
4
def cripto_cesar(texto,p): cifra = '' for i in range(len(texto)): char = texto[i] if(char.isupper()): cifra += chr((ord(char) + p - 65) % 26 + 65) else: cifra += chr((ord(char) + p - 97) % 26 + 97) return cifra texto = 'Nininini' p = 28 print('texto: ',text...
86589672dfb4163954b2b7454a0f7d275bad8938
nedstarksbastard/LeetCode_Py
/leetcode.py
3,480
3.75
4
def twoSum( nums, target): """ https://leetcode.com/problems/two-sum/description/ :type nums: List[int] :type target: int :rtype: List[int] """ d = {} for index, num in enumerate(nums): if target - num in d.keys(): return [d[target-num], index] d[num] = inde...
f82577df1e996d7a18832b14f029d767235ee714
tckl91/02-Pig-Latin
/pig_latin.py
1,855
3.78125
4
def is_vowel(ch): if ch in ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']: return True else: return False def cut(word): if len(word) == 1: return (word, '') else: for n in range(0, len(word)): if is_vowel(word[n]): return (word[:n], word[...
b9233a3d426c1e037e23ca892c7426b8acdaf153
kenglishhi/kenglish-ics699
/sandbox/whitespace_test.py
526
3.609375
4
#!/usr/bin/python from string import * dna = """ aaattcctga gccctgggtg caaagtctca gttctctgaa atcctgacct aattcacaag ggttactgaa gatttttctt gtttccagga cctctacagt ggattaattg gccccctgat tgtttgtcga agaccttact tgaaagtatt caatcccaga aggaagctgg aatttgccct tctgtttcta gtttttgatg agaatgaatc ttggtactta gatgacaaca tcaaaacata ctct...
eeecf3d2b4bf2cee7e59ba996215d4c85d6cd944
scienceacademy/python_examples
/conditional_examples.py
274
4.09375
4
print("Enter two numbers") x = int(input("x: ")) y = int(input("y: ")) if x > y: print("x is bigger") elif y > x: print("y is bigger") else: print("they're the same") age = int(input("How old are you? ")) if age > 12 and age < 20: print("You're a teenage")
be5f73e2e74a92d9d0c94eef14c6771a6c642a27
rameym/UW-IT-FDN-100
/hw5.py
3,319
4.4375
4
#!/usr/bin/env python3 ''' Assignment 5 1. Create a text file called Todo.txt using the following data, one line per row: Clean House,low Pay Bills,high 2. When the program starts, load each row of data from the ToDo.txt text file into a Python list. You can use the readlines() method to import all lines as ...
fda998e4ecca4119973210c287411f612af6bc0f
saffiya/quiz_game
/quiz/quiz.py
1,463
4.0625
4
def show_menu(): print("1. Ask questions") print("2. Add a question") print("3. Exit game") option = input("Enter option: ") return option def ask_questions(): questions = [] answers = [] with open("questions.txt", "r") as file: lines = file.read().splitlines() for i, tex...
75189396066ec93f1ed51015039fa29011aeb5a5
odayibas/astair
/controller-logic/pmvModel.py
4,834
3.5625
4
import math import sys from datetime import datetime """ --- Input Parameters --- Air Temperature (Celsius) -> ta Mean Radiant Temperature (Celsius) -> tr Relative Air Velocity (m/s) -> vel Relative Humidity (%) -> rh Metabolic Rate (met) -> met (1.2) Clothing (clo) -> clo (0.3) ...
8e72f93ab40369d2bfcad78fced401e3f3d072ac
rounakbanik/stanford_algorithms
/week6/median.py
3,203
3.53125
4
def find_parent(ele_num): if ele_num% 2 == 1: return ele_num/2 return ele_num/2 - 1 def find_children(ele_num): return 2*ele_num + 1, 2*ele_num + 2 def insertmax(hlow, num): hlow.append(num) ele_num = len(hlow) - 1 while ele_num > 0: if num > hlow[find_parent(ele_num)]: hlow[ele_num], hlow[find_parent(e...
b91c80ad878426912f994ee6f2112d62416acf0e
SagarikaNagpal/Python-Practice
/QuesOnOops/PythonTuples.py
154
4.09375
4
tuple = ('abcd',786,2.23,'john',70.2) tinyTuple = (123,'john') print(tuple) print(tinyTuple) print(tuple[1:3]) print(tinyTuple+tuple) print(tinyTuple*3)
18d9399b5e6fe4e0c089b392e7fd436dcb0cc790
SagarikaNagpal/Python-Practice
/QuesOnOops/D-15.py
263
4.0625
4
# Question D15: WAP to input 10 values in a float array and display all the values more than 75. floatArray=[34.9,65.3,56.3,50.7,54.7,87.9,76.8] for val in floatArray: if(val>75): print("The numbers which are greater than 75 are : ",val)