blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
011ad8500b589a168a2b7bd4a4f42b2f94c7e7ca
SykoTheKiD/Trading-Entry-Calculator
/trade.py
554
3.546875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Holds a trade and its information """ class Trade: """ Holds the calculated entry and exit for a trade """ def __init__(self, stock, position_size, entry, stop, targets): self.stock = stock self.position_size = position_...
181966b554a3abfee83523ee86eb7317fa4813b9
Vong-Seiha/Python
/E.11.py
112
4.15625
4
userInput = input("enter a string: ") print(len(userInput)) if userInput == '': print("the string is empty")
34b63587cec3055acb60c9f6b21f3a627923a7dd
monteua/Python
/List/10.py
1,306
4.15625
4
''' Write a Python program to find the list of words that are longer than n from a given list of words. ''' def longest_word(num, string): new_string = list() string = string.split(" ") for i in string: if len(i) > int(num): new_string.append(i) print ("Words, which are longer tha...
c7f7265ca43539e4583554ab654a0b054d2b701d
CarlosDLA26/Datacademy-Platzi
/Reto5.py
503
3.859375
4
# Python Cardio # Reto 5: Rangos cambiantes def intervalo(a, b, c): if (a <= c <= b): print('El numero es: {}'.format(c)) else: print('El numero es: {}'.format(c)) c = float(input('Ingrese otro numero: ')) intervalo(a, b, c) def main(): a = float(input('Ingrese un numero: '...
4c10d623df1061097459d578582bb9fd62ed0a5c
ALINA49/luminarpython
/Core Python/Flow controls/for loop/pattern5.py
180
3.859375
4
n=int(input("enter the no.")) i=0 for i in range((i+1),n): for j in range (i,0,-1): print(j,end="") for k in range((j+1),(i+1)): print(k,end="") print()
657d0e501d6de53ebb10cfebce7fab4c87d3f09c
buptswh/coding_offer
/offer44_数字序列中的某一位数字.py
1,307
3.65625
4
# -*- coding: utf-8 -*- """ Created on Tue Apr 2 12:11:20 2019 @author: swh """ #数字序列中某一位的数字01234567891011121314... #计算所有的位数之间的数字序列量 class Solution: def countofintergers(self,digits):#digits为位数 if digits==1: return 10#一位数字有十个 count=9*10**(digits-1)#大于一位数字的有3位数有900个 ...
d4c5e8ee6c66dd9694cbf41e889f8b4da1f035bf
pyunixdevops/scripts
/Python/deco1.py
642
4.15625
4
#!/usr/bin/python3 def f1(l1): return([x for x in l1 if x%2==0]) #Calling function with args and assign the value f2=f1(range(1,5)) #print(f1()) #f2=f1() print(f1(range(1,5))) print(f2) print("type of f2-{f2}, type of f1-{f1}".format(f1=type(f1),f2=type(f2))) #Calling function without args and assign the value f...
07077e0e5987d268cb1bc3e26b90967dd0acd339
verted/euler
/euler15.py
412
3.671875
4
gridSize = def traverse(grid, i, j): if i == gridSize and j == gridSize: return 1; if grid[i][j] == 0: if(i!=gridSize): grid[i][j] += traverse(grid, i+1, j) if(j!=gridSize): grid[i][j] += traverse(grid, i, j+1) return grid[i][j] else: return g...
d46dd99e9bdbbabb35b9ea77ace0f6cc280ccc2a
pharick/python-coursera
/week2/7-chessboard.py
357
3.8125
4
x1 = int(input()) y1 = int(input()) x2 = int(input()) y2 = int(input()) x_diff = x1 - x2 if x_diff < 0: x_diff = x2 - x1 y_diff = y1 - y2 if y_diff < 0: y_diff = y2 - y1 if x_diff % 2 == 0: if y_diff % 2 == 0: print("YES") else: print("NO") else: if y_diff % 2 == 0: print(...
ce4c8e9a4888f8ccf497d39c76c45cad212a65e3
mynameisfiber/Misc-Old-Projects
/l-systems/dragon1.py
711
3.5625
4
#!/usr/bin/python # -*- coding: utf-8 -*- # Made by Michael Gorelick (mynameisfiber@gmail.com) # Copyleft 2009 # Dragon Curve # variables : X Y # constants : F + − # start : FX # rules : (X → X+YF), (Y → FX-Y) # angle : 90° import turtle, pytools set = "FX" rules = {"X":"X+YF","Y":"FX-Y"} for n in range(10): ne...
18919479d4a9662007d32c331039542121974c0c
vitaliuchik/ProgrammingBasics1-Python
/lab02-computing-pi-sqrt/compute_pi.py
1,036
3.59375
4
import math def leibniz(): n = int(input('Input leibniz pow: ')) pi = 0 plus = True count = 0 for i in range(1, 2*10**n + 1, 2): count += 1 if plus: pi += 1/i plus = False else: pi -= 1/i plus = True pi *= 4 print(coun...
0966d2036cedddccb08e354d0c13ee799101f26c
Jiezhi/myleetcode
/src/916-WordSubsets.py
1,390
3.515625
4
#!/usr/bin/env python3 """ CREATED AT: 2022-07-30 URL: https://leetcode.cn/problems/word-subsets/ GITHUB: https://github.com/Jiezhi/myleetcode FileName: 916-WordSubsets Difficulty: Desc: Tag: See: """ from tool import * class Solution: def wordSubsets(self, words1: List[str], words2: List[str]) -> Lis...
817a57fc54b3dc313a9c906b26b495e64f4398ad
nanxung/port-forwarding
/m.py
161
4.09375
4
#!/usr/bin/python2 #coding:utf8 a = input('number:') count=0 while a>1: if a%2: a=a/2 else: a=a*3+1 count=count+1 print a,count
7680e5fc945fd522179262f9a2402180856c8dac
xiaohaiguicc/CS5001
/Course_case/2018_11_27/sort.py
1,699
4.28125
4
class Sort: """Implements two sorting algorithms: selection sort and bubble sort""" @staticmethod def selection_sort(array): """Sort a list of numbers using selection sort""" # Each iteration of this outer for-loop puts one element into its proper place # After n iterations, every e...
efa358466483da66f339ad80c1a5e6949894596d
LisettevanNieuwkerk/Smartgrid10
/code/algorithms/brute_force.py
2,564
3.734375
4
from itertools import product def brute_force(self): """ This is a brute force algorithm, created in the beginning of the project. It takes very long for it to generate an answer (but we've tested it on a smaller replicated grid & it worked! (unfortunately these results are lost atm)). We haven't used ...
6e5092c2c821d0350ca1d75a295180f759753911
gabriellaec/desoft-analise-exercicios
/backup/user_116/ch120_2020_03_25_19_24_09_770425.py
1,058
3.703125
4
from random import randint dinheiro=100 while dinheiro>0: aposta=int(input("qual o valor da aposta? ")) if aposta !=0: opcao=input("a aposta é em um número ou paridade? ") if opcao == "n": numero=int(input("numero de 1 a 36: ")) roleta=randint(1,36) ...
634b92288602dac1f398ff6b4b467e158a47e927
prateekkonduru/VoodleWoodleLS
/VoodleWoodleLS.py
354
3.875
4
n= int(input("Enter the number of names you want this algorithm to apply: ")) j=0 while j!=n: name = input("Enter name of the person: ") list1 = list(name) for index,i in enumerate(list1): if i=="a" or i=="e" or i=="i" or i=="o" or i=="u" in list1: list1[index]="oodle" str1 = ''.join...
3314fbde875feb9a25038dd470b72977fd8642eb
Pranky18/hackerRank
/Day8Dictionaries.py
495
3.703125
4
#Storing number of entries in the phonebook in t t=int(raw_input()) #splitting input and saving it as a dictionary name_number=[raw_input().split() for i in range(t)] phonebook={k:v for k,v in name_number} while 1: try: userInput=raw_input() if(userInput in phonebook): print '%s=%s'%(us...
36d17d6c2944dc507087331f959fb139bcb01435
chefmohima/python
/queue_list_implement.py
870
4.3125
4
#List implementation of a queue #Add elements at rear end and remove elements from front class EmptyQueueError(Exception): pass class Queue: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def size(self): return len(self.items) ...
64d918b291457957b12fd333f0fad9c07fe1ade4
zingzheng/LeetCode_py
/110Balanced Binary Tree.py
846
3.890625
4
##Balanced Binary Tree ##Given a binary tree, determine if it is height-balanced. ##For this problem, a height-balanced binary tree is defined as a binary tree ##in which the depth of the two subtrees of every node never differ by more than 1. ## ##2015年8月14日 09:09:43 AC ##zss # Definition for a binary tree node. cla...
ad87d6326d5ad74bbcf24e6c0e59022453604c6a
RoshanPRaj/GitHubLeetcode
/merge_sorted_array.py
419
3.8125
4
class Solution(object): def merge(self, nums1, m, nums2, n): """ :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead. """ while n >= 1: nums1.remove(0) ...
da075f4e55116aa6be73a5835bea80af12443815
madhan23/programs
/factorial.py
70
3.734375
4
a=input("enter a no:") s=1 for h in range(1,a+1): s*=h; print(s)
e8f45bfadcc058b1696201a04412fd000cd27535
Danuminthar/PythonOnlineTraining
/Wifi_Hotspot_Enable/venv/wifi_hostpost.py
757
3.609375
4
#!/usr/bin/python3 print("Wifi_Enable_Program") print() import os os.system("cls") cmd="0" while cmd!="3": print("1-to start enable wifi") print("2-to stop enable wifi") print("3-to quit") cmd=input("Enter number (1,2,3) to choice option: ") if cmd=="1": SSID= input ("Please Enter SSID: ") ...
e3d3b73706daf391ed262c85552daed0b911a561
kenreitz27/mini_projects
/src/utils.py
707
3.703125
4
from os import name, system def clear_screen(): # for windows # print(name) if name == 'nt': _ = system('cls') # for mac and or linux else: _ = system('clear') def good_integer_between(a: int, b: int, u_input) -> bool: try: val = int(u_input) if val > b or va...
afdcb75e88ae689dd7de9db87d870c9bc81367b9
wangtaodd/LeetCodeSolutions
/647. Palindromic Substring 2.py
1,446
4.15625
4
""" Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes are counted as different substrings even they consist of same characters. Example 1: Input: "abc" Output: 3 Explanation: Three palindromic strings: "a", "b", "c". Exampl...
05951c19f39cf7ed34e099cce657fc2fd9fa89a5
filipmlynarski/stackoverflow_answers
/number_as_sum_of_powers.py
605
4.28125
4
#https://stackoverflow.com/questions/54261166/representation-of-a-number-as-a-sum-of-powers from itertools import product def is_sum_of_powers(X, n, N): largest_power = int(X ** (1/n)) powers = [i**n for i in range(1, largest_power+1)] for cases in range(1, N+1): for i in product(*[powers]*cases)...
29d0124ca11e1e1296116ff5ba9c64d336a55a2f
antiattack/python
/mosalas s.py
173
3.828125
4
print("hi") print() n=int(input("enter row: ").title()) m=int(input("enter clomn: ").title()) #print("*"*m,) b=1 for i in range(0,m,+1): print("*"*b) b=b+1
9736a3c0170f9ea4042c97f61f4f1d5bade1772d
Daviid1010/Data-Aid-Final
/KMeans.py
1,580
3.5
4
##https://pythonprogramminglanguage.com/kmeans-text-clustering/ from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.cluster import KMeans import pandas as pd import matplotlib.pyplot as plt import numpy as np from sklearn.decomposition import PCA data = pd.read_csv('LineItemData.csv', encoding=...
9ba98e93c36a9a6a3821d27759b0dc2991ba89f0
libangchui/pyhtonProject
/开发者模式/DesignMode/迭代器模式.py
1,110
4.21875
4
# if __name__=="__main__": # lst=["hello Alice","hello Bob","hello Eve"] # lst_iter=iter(lst) # for i in lst_iter: # print (i) # # print (lst_iter.next()) #使用迭代器模式构造可迭代对象 class MyIter(object): def __init__(self, n): self.index = 0 self.n = n def __iter__(self): ret...
5c10314479ffeaac9e153d5f028ecabf9377c08c
PetukhovaInna/2_lesson
/del_element_list.py
93
3.921875
4
names=['John','Paul','George','Ringo'] print([x for x in names if x=='John' or x=='Paul'])
a65bb9f0051772a1cab74ca182cc7fd0df6c18fd
divibisan/quizConvert
/quizConvert.py
2,040
3.6875
4
import re import sys def fix_none(s): # Converts None to empty string if s is None: return "" return s # Check for correct command line arguments if len(sys.argv) != 2: print("ERROR: missing filename as command line argument") quit() # Use regex to extract filename without extension to u...
2a7eba5078dc94081aef95eda56fc13d4b803d5d
gschen/where2go-python-test
/1806101073刘玉江/practice/Day0322/test.py
253
3.609375
4
def createTargetArray(nums,index): target = [] for i in range(len(nums)): target.insert(index[i], nums[i]) return target nums = [4,2,1,1] index = [0,0,2,0] print(createTargetArray(nums,index)) ls=[1,2,3,4] ls.insert(5,0) print(ls)
e3dbb106f4a9988cde9ed259e31264253697e566
kirsty-evans/hello-python
/step_4/sensor.py
311
3.53125
4
""" Sensor.py Reading out sensor data. """ def read_sensor(): # defining a function called read_sensor # do something to read the sensor and get data from it data = 10.4 # defining data as an example result = { "source": "voltage sensor", "value": data, } return result
4fe72162af56d881c78fdd84735dd8e4f3e997bd
Juvillatep/Entrega-2-proyecto
/codigo_fuente/UN Planea.py
3,767
3.5625
4
import pandas as pd Data = pd.read_excel('FI mecatrónica.xlsx', sheet_name='Hoja1') # Exporta el archivo .xlsx y lo define como dataframe def Seleccion_carrera( Programa): # Segun la carrera del estudiante nos seleccionara solo sus materias y malla curricular Carrera = Data[Data['CARRERA'] == Pr...
0fbd6d868b42c3603cebd1800be6254f9eef0170
mikhailBrann/OOP_task_4_testing
/main.py
7,242
3.8125
4
# для экономии строк обособленная функция считает рейтинг оценок def calculate_rating(course_list): total_points = 0 total_length = 0 # проверяем аттрибут на пустоту if bool(course_list): for course_val in course_list.values(): total_points += sum(list(course_val)) total_...
2ee99ef8117bfd5c1273850b83f3affb7a012976
JulianSalieri/lesson2
/years.py
825
3.9375
4
years_old = int(input('Введите ваш возраст от 3 до 65 месье:')) def practice(years_old): if 3 <= years_old <= 6: return 'Вы учитесь в детском саду' elif 7 <= years_old <= 18: return 'Вы учитесь в школе' elif 18 <= years_old <= 65: return 'Вы учитесь в ВУЗЕ или РАБОТАЕТ' else...
324f48b4e7a1cd8f6432bd6b8dde6b6d6764d91d
RITE-VAL/BIUTEE
/trees/node.py
3,382
3.71875
4
# -*- coding: utf-8 -*- class Node(object): def __init__(self, *args): ''' Node() 空のNode Node(int parent) depenent のみ Node(int parent, list words) dependent と Word のリスト Node(int dependent, int subject, int fucword) dependent, subject...
946ff65c8c5264ced86060df647441f626317ce8
pasalu/TicTacToe
/UI/BoardUI.py
3,339
4
4
from Tkinter import * from functools import partial import tkFont from Board import Board class BoardUI(Frame): """ View for the TicTacToe Board. """ BUTTON_WIDTH = 20 BUTTON_HEIGHT = 9 def __init__(self, master, controller, board, ai): """ Initializes the UI. :param ...
e1526cd163137daad7b9975711c4a04e03bf2999
dak529/exam-solutions-starter-py
/reporting.py
1,112
3.9375
4
sales_report = [ {"month": "Jan", "units_sold": 800}, {"month": "Feb", "units_sold": 1000}, {"month": "Mar", "units_sold": 900}, {"month": "Apr", "units_sold": 850}, {"month": "May", "units_sold": 900}, {"month": "Jun", "units_sold": 950}, ] if __name__ == "__main__": print("------------...
3cac4bb1075d2cc3162742aa4481ad8ae3cc449f
Matheus-Alborghetti/programacaoEstr
/Exerc02/exercicio1.py
337
4
4
a = int(input('Insira um valor: ')) b = int(input('Insira um valor: ')) c = int(input('Insira um valor: ')) if a + b < c: print(f"A soma de {a} + {b} é menor que {c}") else: print(f'A soma de {a} + {b} não é menor {c}') # Faça um algoritmo que leia os valores A, B, C e imprima na tela se a soma # de A + B é m...
b9813f1e4906aa1c303ef62c5b0b02672be4af01
ZhihaoJun/project-euler
/18.py
2,397
3.703125
4
#,Maximum path sum I # By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.]) # 3 # 7 4 # 2 4 6 # 8 5 9 3 # That is, 3 + 7 + 4 + 9 = 23. # Find the maximum total from top to bottom of the triangle below: # 75 # 95 64 # 17 47 82 # 1...
b02926aa90d305d8e6f3de143e3aa0ee5d0d1faf
AstroOhnuma/Unit2
/movie.py
398
4.03125
4
#Astro Ohnuma #9/13/17 #movie.py - getting age and finding out the most "scandalous" type of movie they can watch age = int(input('Enter your age: ')) if age>17: print('You can watch NC-17 movies') elif age>16: print('You can watch R rated movies') elif age>12: print('You can watch PG-13 movies(and R rated...
cea24ebef7255758bf2c971bff8b82d3237ae99f
millyhx/module2
/ch07_debugging/debugging_example.py
1,431
3.9375
4
# -*- coding: utf-8 -*- """ Created on Tue Dec 18 14:57:42 2018 @author: milly """ userInput = input("please give a number: ") result = userInput - 2 #WHEN I RUN THIS CODE, THIS ERROR SHOWS: #TypeError: unsupported operand type(s) for -: 'str' and 'int' userInput = input("please give a number: ") print(type(userInp...
ef634afa05381757442365b27e594e10fc573ef5
LeonardoSaid/uri-py-solutions
/submissions/2863.py
257
3.515625
4
while True: try: n = int(input()) m = 12 while n > 0: x = float(input()) if x < m: m = x n -= 1 print('%.2f' % m) except EOFError: break
2f12ae56b177136e8e931b5853938481ff351a2d
hybae430/Jungol
/LC/121_선택제어문_형성평가2.py
99
3.8125
4
i = int(input()) if i > 0: print('plus') elif i < 0: print('minus') else: print('zero')
7c5b9236781a4ad7dd2627580e7dc47a87782a79
anderssv49/python-course-gbg
/summer-2020/QAs_Kata/Algorithms/Sorts.py
3,754
4.5
4
# Code to print the list def printList(arr): for i in range(len(arr)): print(arr[i], end =" ") print() # Python program for implementation of Bubble Sort def bubbleSort(arr): n = len(arr) # Traverse through all array elements for i in range(n-1): # range(n) also work but outer loop wil...
5ebea3a1f31175a13c664adc0483a2e6e4cb2b7e
g47545496/270201020
/Labs/lab8.py
1,711
3.75
4
def sum_values(): a_list = [12, -7, 5, -89.4, 3, 27, 56, 57.3] b=0 for i in a_list: b+=i print(b) sum_values() def binary_values(a): c="" while a>0: c+=str(a%2) a//=2 return (c[::-1]) def binary_to_dec(b): d=0 b_rev =str(b)[::-1] for i in range(len(b_rev)): d+=(2**i)*int(...
8d5404dc95a94ea550bee48d9c29a3fead412914
cloudsecuritylabs/pythonclassaug2021
/functions-class5/1.functions.py
1,131
4.21875
4
''' for code to be efficient and easily understandable, it must include functions. --> Functions help programmers avoid reusing code, --> Functions can be shared among developers --> Functions are used to define a block of code that can be reused over and over. --> Functions are also known as methods, procedures, modul...
15b24a49ccf135d35167afe5fe0d82e16765bbb3
DennisMufasa/pythone_learning
/account.py
701
3.96875
4
class Account: # initializing class variables name and balance. def __init__(self,name,balance): self.name=name self.balance=balance # a few functions contained in the class Account ie deposit,withdraw,check def deposit(self,amount): self.balance+=amount def withdraw(self,a...
ab35f690af9e78ab7b94c76e15afa948b48819ae
ChrisHayduk/Gaussian-Elimination
/matrixManipulation.py
11,059
3.84375
4
class Matrix(object): def __init__(self, A): self.matrix = A self.numRows = len(self.matrix) if self.numRows != 0: self.numCols = len(self.matrix[0]) #Checks if the matrix is valid #If not, raises and handles an exception. Also returns ...
0b883405d9c3cd86161c609f09a76f4fcec59e4c
AndyLaBorde/python_nov_2017
/Andy_LaBorde/Type_List/typeList.py
754
3.984375
4
#input l = ['magical unicorns',19,'hello',98.98,'world'] #output # "The list you entered is of mixed type" # "String: magical unicorns hello world" # "Sum: 117.98" sum = 0 string = 'String:' numcheck = False strcheck = False for x in range(0, len(l)): if type(l[x]) == int: sum += l[x] numcheck = True elif type(...
a8d752157180596f8020cd093c5de9c69c2e3773
matrix-lab/machine-learning
/zhoufubing/Task3.py
2,212
3.53125
4
""" 下面的文件将会从csv文件中读取读取短信与电话记录, 你将在以后的课程中了解更多有关读取文件的知识。 """ import csv with open('texts.csv', 'r') as f: reader = csv.reader(f) texts = list(reader) with open('calls.csv', 'r') as f: reader = csv.reader(f) calls = list(reader) def get_phone_prefix(items): prefix = set() for item in items: if "(" i...
6af86255e341ba37ff75debdd3020872d4c210d6
Meyer23/menu_restaurante
/menu.py
1,115
3.90625
4
import sqlite3 from tkinter import * root = Tk() root.title("Bar Don Costa - Menú") root.resizable(0,0) root.config(bd=25, relief="sunken") Label(root, text=" Bar Don Costa ", fg="darkgreen", font=("Consolas", 28, "bold")).pack() Label(root, text=" Menú del día ", fg="green", font=("Consolas", 20, "bold")...
693af239bc71cb9126462380f49d4195390eecba
Sergey-Dubovsky/Otus_Py_Bs_2021_hw
/practice_06/main.py
1,738
3.53125
4
class User: def __init__(self, name, surname, post_address, cell_phone_number): self.name = name self.surname = surname self.post_address = post_address self.cell_phone_number = cell_phone_number self._password = "" self.pets = [] @property def password(self)...
20ebf5a2f60ad6ae7fdfe59299f9cd9e63aa6adb
FelypeNasc/PythonCursoEmVideo
/Aulas/Aula16/Aula16a.py
368
3.734375
4
# TUPLAS = SÃO IMUTÁVEIS lanche = ('Hambúrguer', 'Suco', 'Pizza', 'Pudim', 'Batata frita') print (lanche[1]) print (lanche[2:]) for comida in range(0, len(lanche)): print(f'Eu vou comer {lanche[comida]}') for comida in lanche: print (f'Eu vou comer {comida}') for pos, comida in enumerate(lanche): print (...
dd32abe794101479eacf74a875e164714aeca976
karikittie/best_game_ever
/game/prep_tests.py
1,010
3.578125
4
import random from game import Game from npc import NPC from player import Player class test_game(Game): def place_ships(self): ships = [tuple(['carrier', 5]), tuple(['battleship', 4]), tuple(['submarine', 3]), tuple(['destroyer', 3]), tu...
9352f94493b89a17071bf9b54625bd01f420b695
Rahat33/Programming-hero-test
/vowel-count.py
212
4.09375
4
text = input("Enter Your Text : ") count = 0 vowel = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'] for char in text: for n in vowel: if n == char: count = count + 1 print(count)
200e693cae3664d2e49596c3525fadb93653a200
mln95/python_newby
/generate_password.py
383
3.5
4
import random import time start_time = time.time print('Choose the Length of your password') userInput = int(input()) passwordGenerated = "" characters = 'azertyuiopqsdfghjklmwxcvbn0123456789$&.!#@()?*AZERTYUIOPQSDFGHJKLMWXCVBN' for i in range (0,userInput): randomNumber = random.randint(0,70) passwordGenera...
79e1bf48f6a6b05e567b84e89a3189cf6915b4a6
lewiqs/hack-check
/hack-check.py
3,556
3.703125
4
import requests # cd */python/ --> python pip -m install requests import json # cd */python/ --> python pip -m install json def basic(): # Will return basic results. email = input('What is your email: ') he = requests.get('https://hacked-emails.com/api?q=' + email) t = json.loads(he.text) data = ...
fffc0e9f35ca1e65556844c8782e6255b0b9b732
mrfc0301/Litao_Learning
/pycode/shell_sort.py
556
3.734375
4
# -*- coding:utf-8 -*- """ 作者:李涛 日期:2020年10月11日 """ #按步长进行插入排序 def insert_sort_gap(li, gap): for i in range(gap, len(li)): tmp = li[i] j = i - gap while j >= 0 and li[j] > tmp: li[j+gap] = li[j] j -= gap li[j+gap] = tmp #希尔排序 def shell_sort(li):...
10f0c8ef308a22ea19eb4ad913fcca4a1a2eae6b
thenagababupython/python_modules
/oops1/instance_varible/program 2.py
380
3.828125
4
class Student: """this is student class with required data""" def __init__(self,x,y,z): self.name=x self.rollno=y self.marks=z def display(self): print("Student Name :{}\n Rollno :{} \n marks: {} \n".format(self.name,self.rollno,self.marks)) s1=Student("nagababu",101,...
17bb136cb7500c21534a6c0eb9e7280b54ccce4a
wan-catherine/Leetcode
/problems/N1268_Search_Suggestions_System.py
1,025
3.515625
4
import bisect import collections class Solution(object): def suggestedProducts(self, products, searchWord): """ :type products: List[str] :type searchWord: str :rtype: List[List[str]] """ length = len(searchWord) res = [[] for _ in range(length)] for...
39b7882bdd2cd9cd7a41b637e4306243c57decbe
agustinc24/datascience_unsam
/Clase 2/tablamult.py
421
3.765625
4
""" @author: Agustin""" #.................TABLA DE MULTIPLICAR..................... print(' ',end='') for z in range(10): print(f'{z:>4d}',end='') print('\n---------------------------------------------') for a,fi in enumerate(range(0,10)): print(a,':',end='') valor=0 print(f'{valor:>4d}',end='') ...
f2f959efbc78afb5e098514d74f70dce07ebc061
RadTechDad/AtBS
/Chapter 5/chessDictionaryValidator.py
1,865
3.546875
4
# chessDictionaryValidator.py # AtBS - Chapter 5 # Code by Darrell Dudics MAX_PIECES = 16 validChessPieces = { 'pawn':8, 'knight':10, 'bishop':10, 'rook':10, 'queen':9, 'king':1 } validTiles = ['12345678', 'abcdefgh'] validColors = 'bw' def isValidChessBoard(board): allPieceCounter = 0 ...
8bb0e21a769f5b1910d56ece9bbcde2151cab390
PabloLanza/curso-python3
/exercicios-python/curso-python/ex072.py
415
3.890625
4
val = list() par = list() impar = list() while True: num = int(input('Digite um número: ')) val.append(num) if num % 2 == 0: par.append(num) else: impar.append(num) resp = str(input('Deseje cpntinuar? S/N: ')).strip().upper()[0] if resp in 'N': break print(f'Lista Complet...
710c26b62c208b2dd04225505ab7badde53ffd6c
williamboco21/datastructures
/exercise_files02.py
109
3.953125
4
fname = input("Enter the filename: ") fh = open(fname, 'r') for line in fh: print(line.upper().strip())
329e3cbdd600ac352663cfd306cdab0a61e6c205
DaniyalFarooque/DSA_Library
/segment_tree.py
2,706
3.546875
4
## BEGIN SEG TREE CLASS ========== class SegTree: def __init__(self, numElements: int, defaultValue, associativeFunct): self.size = 1 self.default = defaultValue self.funct = associativeFunct while self.size < numElements: self.size = (self.size<<1) self.st = ...
7a204e23954b897eec6cfa8cd0ef4e8574a1bffe
QMaury/QdishesPy
/dishes.py
1,675
3.828125
4
#!/usr/bin/env python import random import time # dishList = ['inSink', 'outSink', 'inMach', 'outMach'] inSink = random.randint(0, 1) # picks a random bool integer inMach = random.randint(0, 1) machClean = random.randint(0, 1) print(int(inSink)) # displays the boolean values declared above. mostly ju...
e5f93b40071da8e9a91a4ace691e4f89b659e4ac
Varun0801/Flask_Tutorials
/session.py
1,753
3.859375
4
# Unlike a Cookie, Session data is stored on server. # Session is a time interval between client logs into a server and it log out of it. # Data which is needed to be held across this session, is stored in a temporary directory on server. # Session with each client is assigned a Session ID. # Session data is stored on ...
2d2a314b9044341504feba00ef42d78aa8373d1d
udhayprakash/PythonMaterial
/python3/10_Modules/15_turtle_module/traffic_light2.py
865
3.96875
4
#!/usr/bin/python """ Purpose: """ import turtle def drawLight(T, S, c): T.speed(1000) S.clear() T.penup() T.setpos(0, 0) T.pensize(12) if c == 1: T.color("black", "orange") else: T.color("black", "gray") T.pendown() T.begin_fill() T.circle(50) T.end_fill() ...
f7451bae519ecb3dcb8a39c5b024bed4bee80f3f
clarizamayo/JupyterNotebooks
/Class Material/Week-07/script.py
1,847
4.21875
4
# from random import randint # class GuessingGame: # """ # max_guess = 3 # guesses = 0 # """ # def __init__(self): # self.max_guess = 3 # self.guesses = 0 # self.random_number = randint(1,3) # @staticmethod # def welcome_message(): # print("Welc...
fbda0e583fed7631d675e208885a73c089578c1c
dpaez16/Discount-Siri
/modules/audio_converter.py
887
3.6875
4
from pydub import AudioSegment, exceptions def convert_audio_file(file, output_format): """ Converts an audio file to a differt format. :param file: File to be converted. :param output_format: Output format the file will be converted to. :return: Converted file name, if possible. """ try...
fed014e01ccff83cab40b99fdce79372707c9aa6
Jayhello/python_utils
/python_utils/machine_learn/linear_regression/sk_example.py
743
3.71875
4
# coding:utf-8 import matplotlib.pyplot as plt import seaborn as sns import numpy as np from sklearn.linear_model import LinearRegression sns.set() def get_data(): rng = np.random.RandomState(1) x = 10 * rng.rand(50) y = 2 * x - 5 + rng.randn(50) # plt.scatter(x, y) # plt.show() return x, y ...
207649c48918743ec8ccc0fb70f90f0305706d02
RaphaelaJP/Introducao_Python
/ExerciciosPythonCursoEmVideo/ex020.py
575
3.65625
4
nome01 = input('Informe o nome do primeiro aluno: ') nome02 = input('O nome do segundo: ') nome03 = input('O nome do terceiro: ') nome04 = input('O nome do quarto: ') nome05 = input('O nome do quinto: ') nome06 = input('O nome do sexto: ') nome07 = input('O nome do setimo: ') nome08 = input('O nome do oitavo: ') nome09...
cafa3780bccaa4ee991233a4812a6b44538bea76
savadev/LeetCodeProblemSet
/climbingstairs.py
344
3.953125
4
#!/usr/bin/env python3 class Solution(object): def climbStairs(self, n): """ :type n: int :rtype: int """ a, b = 1, 1 for i in range(n): a, b = b, a + b return a if __name__ == "__main__": s = Solution() n = 3 result = s.climbStai...
2ea8b7792a08507b35c7fc922f49ae4fad73da8c
feadoor/hackerrank
/practice/algorithms/implementation/flatland_space_stations.py
713
3.9375
4
#!/usr/local/bin/pypy def maximum_distance_to_station(stations, city_size): sorted_stations = sorted(stations) if len(stations) > 1: maximum_internal_distance = max((sorted_stations[i + 1] - sorted_stations[i]) / 2 for i in xrange(len(stations) - 1)) else: maximum_internal_distance = 0 ...
ccf6f9f0c2e85c0213938ecdd72cd1c3a3d336f0
mrmenand/Py_transaction
/LeetCode/dp/70.爬楼梯.py
355
3.71875
4
# 70.爬楼梯 def memo(func): cache = {} def wrap(*args): if args not in cache: cache[args] = func(*args) return cache[args] return wrap class Solution: @memo def climbStairs(self, n: int) -> int: if n <= 1: return 1 return self.climbStairs(n - ...
5feed4ab18acdff7e17c011661555b4505e82eb7
bryanblancas/CodingProblems
/HackerRank/hastables/countTriplets/countTriplets.py
2,602
3.96875
4
#!/bin/python3 # -*- coding: utf-8 -*- import math import os import random import re import sys from math import factorial # Complete the countTriplets function below. def countTriplets(arr, r): ####Implementar defaultdic para evitar la validación de si existe un número en la hashtable #Los números...
29264770776b96064235eeb32e28478f9ee42206
CiyoMa/leetcode
/decodeWays.py
1,275
4.03125
4
""" Decode Ways A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message containing digits, determine the total number of ways to decode it. For example, Given encoded message "12", it could be decoded as "AB" (1 2) or "L"...
63e8f96466ac7ac700345c7cfdf20b5bd4830c63
BenignCremator/hunter_median
/hunter_median.py
1,288
3.84375
4
#!/usr/bin/python3 def hunter_median(data_set): '''Accepts a numerical 1D data_set in list, tuple, or numpy array form. The data set is assumed to be unordered and of uneven distribution. Iterates over the data set three times to find values that approximate the mean, the median, etc. ''' ...
42b86e03bf2a541b79e343a447a863a903bcb1cd
shahad-mahmud/learning_python
/previous/add.py
193
4.25
4
# addition operator -> + # what is statement num1 = 3 num2 = 4 # firstly addition operation is performed. # Then the outcome is assigned to the variable result = num1 + num2 print(result)
490bb52ec0e1a48099c67634225a02c3d3b18816
tthoonee2/pythonlearning
/esercizi di scuola/practiceSESH.py
859
3.71875
4
#pythagoras import math def pythagoras(cat1,cat2): hypo = math.sqrt(cat1**2 + cat2**2) return hypo def show_hypo(): cat1 = float(input('enter cat1: ')) cat2 = float(input('enter cat2: ')) print(pythagoras(cat1,cat2)) print(math.floor(pythagoras(cat1,cat2))) print(math.ceil(pythagoras(cat1,c...
22d6bba7cc8c0654e3670b4b59be2a3ffc33bb9e
ms-shakil/Some_python_project
/crud_op/Insert.py
1,240
3.6875
4
import json JSON_FILE ="./data.json" def Valid_Id(Arr,id): found = False for i in Arr: if i["id"] == id : found = True return found return found with open(JSON_FILE,'r') as fd: data = json.load(fd) print("There are {} in this file".format(len(data["Bio"])) ) IN...
848a3651fb4b1102d46605ae6a47ff557243868a
maxlyfe/Aulas-Modulo-01_BlueEdTech
/Aula 12/Exercicio.py
786
4.0625
4
# 1. Faça um programa que leia nome e média de um aluno, # guardando também a situação em um dicionário. No final, # mostre o conteúdo da estrutura na tela. A média para # aprovação é 7. Se o aluno tirar entre 5 e 6.9 está de # recuperação, caso contrário é reprovado. dicionario = {} nota = [] nome = input('Qual é...
845315d990079297e2125cf33b3715882ffb9050
nosrefeg/Python3
/mundo1/exercicios/018.py
190
3.78125
4
import math angulo = int(input('Digite o valor do ângulo: ')) print('Seno: {}, Cosseno: {} e Tangente: {} desse ângulo'.format( math.sin(angulo), math.cos(angulo), math.tan(angulo)))
51efa628d367c3baf627f9eb226811aeef768994
NuGelaLies/python-practise
/Day1/string.py
570
3.921875
4
string = 'hello world' print('字符串长度: %s' % (len(string))) print('单词首字母大写 %s:' % (string.title())) print('字符串大写: %s' % string.upper()) print('字符串小写: %s' % string.lower()) print('字符串判断大小写: %s' % string.isupper()) print('字符串开头是不是hello: %s' % string.startswith('hello')) print('字符串是否是以hello结尾: %s' % string.endswith('hello...
bd72b849ba5804ce385ad136999bfb2d74ace079
MatthiasGu/coding-challenges
/src/python/permutations.py
1,114
3.640625
4
# Problem - https://leetcode.com/problems/permutations/ class Solution(object): def permute(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ solution = [] if (len(nums) == 1): return [nums] solution.extend(return_permutations(nums...
49d967f9fd4b1bceae36752120231845b6444b9f
csolvex/sqlitestuff
/tut2.py
375
3.765625
4
# import sqlite3 module import sqlite3 # creates or connects to a db called mydb - here it is in a directory called data db = sqlite3.connect('data/mydb') # get a cursor object cursor = db.cursor() cursor.execute(''' CREATE TABLE users(id INTEGER PRIMARY KEY, name TEXT, phone TEXT, email T...
147a5a309dbec413d86ee2415d1db4128affd548
baitul-hossain/Coding_interview_sample_solution_in_Python
/boats_to_people.py
711
3.640625
4
# # PROBLEM: Given an array of people weight and # and integer as limit capacity of each boat, # return the minimum number of boats to carry # all people. # Weight = [ 2, 1, 3, 2], limit = 2 # SOLUTION: data = [ 2, 1, 3, 2] limit = 2 def problem_solution(data, limit): data.sort() left_point = 0 right_poi...
ee26f5eb08bc16a7154d98230c0c4f7491cf12f2
ChangLuis/PythonBasicsNote
/generator.py
1,514
4.375
4
# 當你在操作list時,常常會遇到生值,然後暫存的過程 def create_cubes(n): result = [] for x in range(n): result.append(x**2) return result print(create_cubes(10)) # 正常會這樣做,先開一個空的list,然後將所有生成的值存入,這個情況就會暫存值得情況 def create_cubes_yield(n): for x in range(n): yield x**2 print(create_cubes_yield(10)) # yield是一...
aee5d58d0f176fa960237a238187a750d56bcba0
velibakirtas/begin_py
/4-döngüler/6-döngümetotları.py
1,836
4.25
4
#RANGE METODU for item in range(10) : print(item) #range metodu ile ortada bir liste yokken belli bir aralığı işleme sokabiliriz #parametre içine girilen bir değer döngünün biteceği elemanı belirtir(0'dan 10'a kadar) for item in range(3,12): print(item) #parametre içine girilmiş iki tane değer varsa...
591b293a378978f7663eaa76685c2f0c170e9ef3
zantelope/cs-boxBlur
/boxBlur.py
1,663
3.671875
4
def boxBlur(image): #empty array to place values within the 3x3 matrix threeByThreeVals = [] #empty array to place the average of values within 3x3 matrix threeByThreeAvgs = [] #empty array to place average values into a matrix blurredMatrix = [] #find the values of elements within all 3x3 matrix...
9136d269ad920365c747a0fefcf3ad8e238e20c6
nx6110a5100/Internshala-Python-Training
/while.py
235
4.125
4
day=0 sq=0 total=0 print('Enter number of quats each day') while day<=6: day=day+1 sq=int(input('Enter the number of quats on {} day '.format(day))) total+=sq avg=total/day print('Average sqats is {} per day'.format(avg))
8754808b9744b4067eedef5e5d67a1c469df6725
shakirmengrani/Nutral_Network
/forwardStep.py
600
3.609375
4
import numpy as np import matplotlib.pyplot as plt class nn1(object): def __init__(self): self.inputLayersSize = 2 self.outLayersSize = 1 self.hiddenLayersSize = 3 self.w1 = np.random.randn(self.inputLayersSize,self.hiddenLayersSize) self.w2 = np.random.randn(self.hiddenLayersSize,self.outLayersSize) d...
63c580a007063402d27fcf34cee4c3e7ade69645
JacobFaulstich/my_first_turtle
/catch_a_turtle.py
2,149
4.25
4
''' Jacob Faulstich, 2/17/21 Create a turtle in a random location. If the turtle is clicked have the turtle move to a new random location and add 1 point to the score.''' #-----import statements----- import turtle as trtl import random as rand #-----game configuration---- shape = "turtle" color = "green" sp...
bd9d000313cf7a971e67af95369ef0b263ec7fd7
eFilipexCode/python-cs50-lessons
/litsts.py
137
3.515625
4
names = ["Harry", "Ron", "Emmanuel", "Phillip"] # We can add something to the list names.append("Draco") # Sort the items names.sort()
438ae062b4dee05103c6e6ca9d76f80e29068b5a
mwhit74/practice_examples
/linuxtopia_python/C_to_F_Table.py
137
3.5
4
#Temperature Converstion Table print("Celcius\tFahrenheit") for c in range(-20, 30, 5): f = 32+(212-32)/100*c print("%r\t%r" % (c,f))
789c3268ef7a245c7aeac7bf1193a8dd76ff848c
VishalDeoPrasad/HackerRank-Python
/Sum vs XOR.py
145
3.546875
4
def sumXor(n): ans = 1 while n: b = n&1 n >>= 1 if b == 0: ans *= 2 return ans print(sumXor(10))
14332a47f8176f89345a794f4a8739227996d0f7
vusaliko/Laboratorniye
/Лабораторная 8.1.py
265
3.921875
4
while True: print("Введите переменые A,B") a=int(input()) b=int(input()) if a!=b: if a>b: b=a else: a=b else: a=0 b=0 print("A=" + str(a) + " B=" + str(b))
c2b67df59ad8720e10525661fe3c3c884e8a7e08
NobTakeda/PythonTraining
/20210202/kame2.py
256
3.78125
4
import turtle t=turtle.Turtle() t.shape('turtle') t.circle(100)#円を描く t.forward(100)#向いている方向に100移動 t.right(90)#90度回転 t.forward(100) t.home() #原点に移動し、デフォルトの方向を向く(右側) turtle.mainloop()