blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
a0690ab38ff550e8c49c2d2c16c189acc0650e72
ptdk1020/PasswordStrength
/scripts/feature_maps.py
3,103
3.765625
4
"""This file contains feature extracting and data enrichment functions""" import string from zxcvbn import zxcvbn def length(password): return len(password) def num_lowercase(password): """Count the number of lower case letter""" lower_alphabet = string.ascii_lowercase count = 0 for letter in p...
b1af5a819fec8f7af33372db4917f731076ac37e
z1223343/Leetcode-Exercise
/014_435_Non-overlappingIntervals.py
1,669
3.984375
4
""" 5 level solutions: 1. brute force. It takes me half a day to understand 2. DP (using starting points) 3. DP (using ending points) 4. Greedy Algorithm (starting points) 5. Greedy Algorithm (ending points) 1. time O(2**n) space O(n) 2. time O(n**2) space O(n) 3. time O(n**2) space O(n) 4. time O(nlogn) space O(1) 5....
92d782d7fc8227c42c4d17be5f5f399f1a681943
garderobin/Leetcode
/leetcode_python2/lc221_maximal_square.py
1,897
3.5625
4
# coding=utf-8 from abc import ABCMeta, abstractmethod class MaximalSquare: __metaclass__ = ABCMeta @abstractmethod def maximal_square(self, matrix): """ :type matrix: List[List[str]] :rtype: int """ class MaximalSquareImplRotateArray(MaximalSquare): """ DP巧思:连续的...
a6ae8faf9e0e9f5eef62f62260ab150aaa4f6027
wzygadlo/Python_Tools
/dog.py
671
3.859375
4
''' How to make a valid dict key: __hash__ __eq__ or __cmp__ But! I still recommend using ONLY int str tuple of int and/or str or other immutable things that are easy to compare ''' class Dog(object): def __init__(self, name): self.name = name def __repr__(self): fmt ...
839680394b8e424e8ef4a6e4318788f0fbfd32f0
chrisreddersen/Character-non-repeat
/first_non_repeat.py
341
3.75
4
# -*- coding: utf-8 -*- """ Created on Mon Sep 9 07:22:01 2019 @author: creddersen """ def first_non_repeating_letter(string): list = [i.lower() for i in string] for i in range(len(list)): if list.count(list[i]) == 1: return string[i] return "" ...
01331f451354e8537ee85542d1c419261658ca2a
francescaberkoh/Ass6
/Assignment6b.py
4,967
3.640625
4
''' Created on May 19, 2019 @author: Francesca ''' from tkinter import* import random root = Tk() deck = [] #Make deck of cards for suit in ["of_spades", "of_clubs", "of_diamonds", "of_hearts"]: for v in range(1,14): deck.append([v,suit]) dealerdeck = [] playerdeck = [] #Making the...
1efec82b035fab09319d5ba75843a453def198d4
Faranheit15/Hacktoberfest-2020
/property decorator.py
605
3.84375
4
class Celsius: def __init__(self,temperature=0): self.temperature=temperature def to_fahrenheit(self): return (self.temperature*1.8)+32 @property def temperature(self): print("Getting value...") return self._temperature @temperature.setter def temp...
2855fde258319f7b790e55f719fe4788d945a280
zouhuigang/handwriting
/test-plus.py
2,357
3.65625
4
class sort(object): def __init__(self,name): self.name = name self.iter = 0 self.max_iter = 0 self.score = 0 self.total_score = 0 self.avg_score = 0 def add_items(self): if self.score > 0.5: self.iter += 1 self.total_score ...
7d58b82d60cef48068b879e63e6e86f7ab86a2dd
Alex760164/python_advanced
/home_works/home_work_2/main.py
361
3.515625
4
from src.circle import Circle from src.point import Point if __name__ == '__main__': # Testing libraries of Point and Circle small_circle = Circle(Point(12, 12), 425) big_circle = Circle(Point(9, 1), 10293.4) if (small_circle < big_circle): print('Test #1 is OK') if (small_circle == small...
8b0808bcbf323756364a221c75c75c8b332529c3
Logirdus/py_lessons
/stepic_4_modules/ring_perimeter.py
190
3.6875
4
''' Программа расчета периметра круга с использованием модуля math ''' from math import pi radius = float(input()) print(2 * pi * radius)
b0ce2ad95582f41d4d910c5fd74d37fa688b39a9
WASSahasra/sclPython
/Select. Not Select 1st.py
157
4
4
x=int(input("Enter Mark 1 ")) y=int(input("Enter Mark 2 ")) if x>=50 and y>=50: print("You Are Selected") else: print("You Are Not Selected")
1e6ef71cb07175699473a356977a93fec39985ab
JTMaher2/RunCode-Solutions
/Just_a_ord_friend/Just_a_ord_friend.py
278
3.75
4
#!/usr/bin/env python3 import sys import string sum = 0 valid_chars = set(string.ascii_letters.replace("_", "")) with open(sys.argv[1]) as fileInput: for line in fileInput: for c in line: if c in valid_chars: sum += ord(c) print(sum)
40f00677c885b0377c7b7a3975356493a4575643
samyuktahegde/Python
/datastructures/stack/stack_using_queues_1.py
995
3.9375
4
# class Queue: # def __init__(self): # self.items = [] # def isEmpty(self): # return self.items == [] # def enqueue(self, item): # self.items.insert(0,item) # def dequeue(self): # return self.items.pop() # def size(self): # return len(self.it...
f1fe296a849c5565d120b04d4354f10afd3dfa91
evanakat/rockpaperscissors
/rockpaperscissors.py
1,977
4.125
4
import random lives = 3 count = 0 print('*type either rock, paper, or scissors*') while lives > 0: print(f"**You have {lives} lives, play wisely**") player1 = input('Make your move: ').lower() if player1 == "quit": break rand_num = random.randint(0,2) if rand_num == 0: p...
47aa735208551e408f949a72451dd6320fec67d4
rscai/python99
/python99/lists/p127.py
679
3.734375
4
# Group the elements of a set into disjoint subsets. # a) In how many ways can a group of 9 people work in 3 disjoint subgroups of 2, 3 and 4 persons? # Write a predicate that generates all the possibilities via backtracking. from python99.lists.p126 import combination # group l into len(nums) subsets, nums imply numb...
35adbbd493f1b4aa219be240535195ca00e31a65
Iranaphor/PythonGame_RPG
/Python Game - RPG/RPG - V1/RPG-V1-001.py
182
3.640625
4
import time import datetime i = 10 while ( i < 11 ): print ("i:", i) i = i - 1 time.sleep(0.5) # print (datetime.datetime.now().time()) if (i < 1): i = 10
16d98ef7cc0be54ec7568f35c1e5dbcc9f000360
JLevins189/Python
/Labs/Lab4/Lab9Ex10.py
503
3.859375
4
def remove_substring(my_str1, indice1, indice2): str = "" my_str1.replace(" ", "") for counter in range(0,indice1): str += my_str1[counter] for counter in range(indice2+1,len(my_str1)): str += my_str1[counter] print(str) my_str1 = input("Input a string") indice1 = int(inpu...
245725e4aabda18373d9ace8fbef9898319291ee
JIANG09/LearnPythonTheHardWay
/ex3.py
796
4.40625
4
# coding=utf-8 print("I will now count my chickens:") # print a sentence print('Hens', 25 + 30 / 6) # print a name, with a calculation after it. print("Rooster", 100 - 25 * 3 % 4) # same as above print("Now I will count the eggs:") # count eggs: print(3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6) # a calculation print("...
e084786bc60c730ed6466aa176a08fe5009113ac
mgirardin/Project-Euler-Solutions
/Solutions_Python/P014.py
1,195
3.96875
4
records = [-1 for x in range(0, 1000000)] # guarda tamanhos de chains já conhecidos class collatz: # classe para guardar o número analisado e o tamanho de sua chain iterations = 0 number = 0 def apply(self): apply_collatz(self, self.number) return 1 ...
288cbb797c03c5c9053acc02e04a302a4c174e80
PepAnalytics/Python
/homework3/second.py
511
3.859375
4
def new_func(**kwargs): for key, value in kwargs.items(): print(f"{key} is {value}") firstname = (input('Enter the name: ')) lastname = (input('Enter the lastname: ')) email = (input('Enter the email: ')) country = (input('Enter the country: ')) age = (input('Enter your age: ')) pho...
11ecec2bc2d11ff40d2f80414b249189facc54aa
mouday/SomeCodeForPython
/python_psy_pc/python基础/pandasTest.py
381
3.640625
4
import pandas as pd #基于numpy csv=pd.read_csv("bricks.csv",index_col=0) print(csv) print(csv.nation)#获取列 print(csv["nation"]) csv["note"]=[1,2,3,4,5,6,7,8,9]#新加列 print(csv) csv["densty"]=csv["area"]/csv['peple'] print(csv) print(csv.loc["ch"])#获取行数据 print(csv["nation"].loc["ch"])#获取元素 print(csv.loc["ch"]["nation"]) prin...
acef4b985d230567ce62ea81f22a7f00a98997f5
udhayprakash/PythonMaterial
/python3/04_Exceptions/16_warnings.py
713
3.703125
4
#!/usr/bin/python3 """ Purpose: Handling warnings """ import warnings for each_attribute in dir(warnings): if not each_attribute.startswith("_"): print(each_attribute) print() warnings.warn("This is not good practice 1") # Adding filter to display on specific warnings warnings.filterwarnings( "ignore...
6f1c0f06923b751eaf302a53151e9d100f1c2a12
lordofsraam/cloaked_happiness
/sideways.py
671
4.21875
4
def PrintSideWays(stringy): maxlen= 0 tokens = stringy.split() #Find the longest word in the string (so we know how many times to iterate down) for h in tokens: if len(h) > maxlen: maxlen = len(h) #We never actually use the lines variable but it could be used to return the 2d array instead of just...
e961eae4ed9fe0d275569b5446e80026537537f5
baralganesh/Python-Simple-Programs
/06_ListComprehensions.py
802
4.3125
4
import random main_list = [] # Length of list can be anywhere between 10 digits to 20 length_main_list = random.randint(10,20) # Get numbers randomly from 1 to 100 and add to the main_list # Now main_list created and can be play araound while len(main_list) <= length_main_list: main_list.append(random.randint(1,...
ca3a386f53a4188c14157684d129133a9bd007be
EUD-curso-python/control-de-flujo-admspere
/control_de_flujo.py
5,877
4.0625
4
"""Guarde en lista `naturales` los primeros 100 números naturales (desde el 1) usando el bucle while """ S = 1 naturales = [] while S < 101: naturales.append(S) S += 1 print("\n\tLos primeros 100 números naturales desde 1 ==> ",naturales) """Guarde en `acumulado` una lista con el siguiente patrón: ['1','1...
aae1e2239b71e463b772a36d70bf360c868d9037
rdonati/course_registration
/register.py
1,557
3.515625
4
import time import platform from pynput.keyboard import Key, Controller from tkinter import * num_of_courses = 5 def print_data(): crns = [] for i in range(num_of_courses): crns.append(entries[i].get()) for i in range(num_of_courses): print("{}: {}".format(i + 1, entries[i].get())) def submit(): crns = []...
700413b6761ca37f71e0b66b782137ec95d92f1b
kssgit/Meerithm
/김성수/프로그래머스 LV2/타겟 넘버.py
796
3.765625
4
# 타겟 넘버 # DFS 사용하여 모든 경우의 수를 구했다. answer = 0 def solution(numbers, target): global answer dfs(0,numbers,target,0) return answer def dfs(indx , numbers, target, value): global answer if indx == len(numbers) and target == value: answer +=1 return if indx == len(numbers): ...
bd6cbe865dec3d1d176cd0a56f27d3b594c1ba12
ole511/hello_world
/57二叉树的下一个结点.py
1,407
3.765625
4
''' 给定一个二叉树其中的一个结点,请找出中序遍历顺序的下一个结点并且返回。 注意,树中的结点不仅包含左右子结点,同时包含指向父结点的指针。 ''' # -*- coding:utf-8 -*- # class TreeLinkNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # self.next = None class Solution: def GetNext(self, pNode): # writ...
cd1841d1a03f8b285808ee2a2522fbc6ddd0c25a
Uxooss/Lessons-Hellel
/Lesson_09/9.1 - Numeric_sys_convert.py
1,716
4.1875
4
''' Написать функцию для перевода десятичного числа в другую систему исчисления (2-36). Небольшая подсказка. В этой задаче вам понадобится: - список - метод `revers()` (или срез [::-1], или вместо `revers()` использовать `insert()` тогда не придётся разворачивать список), чтоб развернуть список, метод `...
b3a15dd3c088c07156d98e6f14a333042993f578
Priyanka29598/guvi
/test13.py
161
3.71875
4
j=int(input()) iscomposite=0 for i in range(2,j): if(j%i==0): iscomposite=1 break if(iscomposite==1): print("no") else: print("yes")
d8c9c717e225cbdcf6c9ffcf8cb5e42494f936d5
j4robot/master-python
/FreeCodeCamp/ScientificComputingWithPython/main.py
890
4.25
4
#This is a course on Scientific Computing Using Python array = [(x ** 2) for x in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] ] #print(array) raw = [1, 2, 1, 3, 2, 1, 4, 5] #print(set(raw)) def max_num(a, b, c): if a >= b and a >= c: return a elif b >= a and b >= c: return b else: return c ...
23d1e58bd35d8421c646569a7a058c78169aa7a1
kevinr78/Todo-List
/Todo.py
4,193
4.21875
4
# todo list def todo_list(list1): user = False while not user: add_items = input("Enter the things to todo :") list1.append(add_items) add_more = input("Do you to add more items (Y/N) : ").upper() if add_more == "Y": while add_more == "Y": ...
39b4ab8cbbeca3cd3eef2193f6f93c3d7c7961ce
ronaldaguerrero/practice
/python2/python/OOP/methods.py
431
3.578125
4
class User: def __init__(self, username, email_address): self.name = username self.email = email_address self.account_balance = 0 def make_deposit(self, amount): self.account_balance += amount guido = User("Guido van Rossum", "guido@python.com") monty = User("Monty Python", "monty@python.com") guido.make_...
6d22df32346e30824d1eb464e297db2e6d7d3417
rupaku/codebase
/python basics/inheritance.py
1,225
4.40625
4
''' inhertance By using inheritance, we can create a class which uses all the properties and behavior of another class. The new class is known as a derived class or child class, and the one whose properties are acquired is known as a base class or parent class. It provides re-usability of the code. '''...
2df99932dd0861afb5159edade898ad92e89e926
pureforce/bread_buying_problem
/bread_buying_problem.py
8,012
4.21875
4
""" Author: Jani Bizjak E-mail: janibizjak@gmail.com Date: 15.04.2020 Updated on: 20.04.2020 Python version: 3.7 Assumptions 1: Solution assumes that given sellers list is ordered by the arrival day of sellers. Otherwise a list sorting needs to be done first. Assumption 2: I assume input arguments are valid and theref...
671989d16dc3068938516858ba12cc6806fa0e90
LeBoucEtMistere/Website-Monitor
/stats.py
2,941
3.75
4
from threading import Lock from time import time from collections import Counter class Stats: """ An object that holds data over a specific timeframe and computes stats on this data. It can be accessed from multiple threads safely. """ def __init__(self, timeframe): """ the constructor of th...
af790ae66271a50e94e6a5c908b968c508fe78ef
mickulich/PythonCourse
/ex2/compare_a_b.py
426
4.125
4
# -*- coding: utf-8 -*- # Данный сценарий сравнивает два целых числа, # и опередляет наименьшее из двух чисел, или же # их равенство a = input(u'Input integer a: ') b = input(u'Input integer b: ') if a<b: print 'a - the smallest of two numbers' elif a==b: print 'a and b are equal' else: print 'b - the sma...
457c61ff372fed2cfb1353580df8ad2637482389
Satelee/EthicalHacking
/20. Learn Python Intermediate/197. TernaryOperator.py
500
4.0625
4
## 197. Ternary Operator ## # can also be called 'conditional expressions' # is an operation that evaluates to something based on the condition being true or not # same as an if-else statement, but it is a shortcut # condition_if_true if condition else condition_if_false # if checks condition, if it is true it wil...
da244fed9ab59c645f7de69cdb2dc3f4580b5c6e
HelenMaksimova/new_python_lessons
/lesson_05/task_5.5.py
673
3.921875
4
# Представлен список чисел. Определить элементы списка, не имеющие повторений. # Сформировать из этих элементов список с сохранением порядка их следования в исходном списке from random import randint num_lst = [randint(1, 10) for _ in range(15)] uniq_nums = set() tmp = set() for item in num_lst: if ite...
6c2042743217958d31b17978acc15c586268e007
rushirg/30-day-leetcoding-challenge
/june-leetcoding-challenge/week-1/reverse-string.py
917
3.765625
4
""" Week 1 - Problem 4 Reverse String https://leetcode.com/problems/reverse-string/solution/ """ # method 1 class Solution: def reverseString(self, s: List[str]) -> None: """ Do not return anything, modify s in-place instead. """ stringLength = len(s) for i in range(stringL...
23200ee2b9758733d935e01ef8f5bbaf45c2b9da
blont714/Project-Euler
/Problem 7.py
548
3.78125
4
import math def main(): prime_number_list = [] number = 2 while(len(prime_number_list)<10001): if judge_prime(number): prime_number_list.append(number) number += 1 print(prime_number_list[-1]) def judge_prime(number): if number%2==0 and number!=2: r...
e067a959a436055f10df5cb2bc92d1d34af7c39b
vovo255/PygameOnlineChess
/Сервер/Chess.py
1,137
3.546875
4
import chess LETTERS = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] NUMBERS = ['1', '2', '3', '4', '5', '6', '7', '8'] class Board(chess.Board): def __init__(self): super().__init__() def pos_to_lett(self, y, x): return LETTERS[x] + NUMBERS[y] def move_piece(self, x1, y1, x2, y...
bd214182ab114232335522dfc6fbbcb99e3bde24
kyeeh/holbertonschool-machine_learning
/supervised_learning/0x0D-RNNs/7-bi_output.py
2,844
3.9375
4
#!/usr/bin/env python3 """ RNN module """ import numpy as np class BidirectionalCell: """ Represents a bidirectional cell of an RNN """ def __init__(self, i, h, o): """ class constructor - i: dimensionality of the data - h: dimensionality of the hidden state - ...
5d1c3e31a993543a63a2e8fd43ddf8577a6676f3
brennanmk/Battleship
/ships.py
4,113
4.1875
4
class ship: # parent ship class, written by Hank Pham & Brennan Miller-Klugman # constructor takesin ship name as a parameter def __init__(self, shipName, RowStart, columnStart, RowEnd, columnEnd, isSunk=False, creatingShip=False): self.name = shipName self.ShipRowStart = RowStart self....
6016322b5b3a920b06f307b8a05312dff9acef54
maxfraser/learnpython
/exercises/excercise5.py
213
3.640625
4
import random number1 = int(random.randint(1,100)) number2 = int(random.randint(1,100)) print(number1) print(number2) if (number1*number2 > 1000): print(number1+number2) else: print(number1*number2)
d56ba21f9519d40cc920ff5b9500641b6786f21b
olinkaz93/Algorithms
/Interview_Examples/Leetcode/234_PalindromeLinkedList.py
1,705
4.09375
4
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, val=0, next=None): # self.val = val # self.next = next # we keep fast runner and slow runner # fast runner goes to the end of the list # when it reaches , the point of slow runner will revers...
ccf32ecc16c0a41df727156cc94a0226cf04424e
alicekykwan/ProjectEuler-First-100
/pe052.py
693
3.65625
4
from collections import * from itertools import * from random import * from time import * from functools import * from fractions import * from math import * ''' It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order. Find the smallest positive integ...
2fbaa17d89760232d2f7f52ccc85b350b2d04eca
tigervanilla/Guvi
/even_to_odd.py
112
3.78125
4
n=int(input()) if n%2: print('1') else: ans=1 while not n%2: ans*=2 n//=2 print(ans)
77f56ec4f72c22aa6b8d3d58d36ca3d7f94a6779
coolmich/py-leetcode
/solu/241. Different Ways to Add Parentheses.py
970
3.546875
4
from collections import defaultdict class Solution(object): def diffWaysToCompute(self, input): """ :type input: str :rtype: List[int] """ def compute(operator, i1, i2): if operator == '+': return i1+i2 if operator == '-': return i1-i2 if o...
a0783664ed040e7414af0932a87191d2afecfb72
shubhangiranjan11/Hackaifelse
/if else6.py
153
4.09375
4
user=int(input("any number")) if user%2==0: print("even number") elif user!=2: print("odd number") else: print("number is not working")
5f8f75bb7f45503ec40381ed37796da5477f0a34
digicosmos86/MicroInventor_Hugo
/content/unit1/lesson7.files/binary.py
209
3.9375
4
def int_to_bin(num): return bin(num)[2:] def str_to_bin(string): return [bin(ord(ch))[2:].zfill(8) for ch in string] if __name__ == "__main__": print(int_to_bin(123)) print(str_to_bin("123"))
b3ff0fa25546436ba0dc27f50520d6514f46299c
sajjad0057/Practice-Python
/DS and Algorithm/Max_Pairwise_product.py
1,383
3.765625
4
# n = int(input("Enter The no of array length : ")) # num = [] # for i in range(n): # x = int(input()) # num.append(x) # result = 0 # for i in num: # for j in num: # if i != j: # x = i*j # if x>=result: # result = x # # print("Maximum Pairwise pro...
cf61dd32ca2eb55f400b002c812fe022ac187e2d
Usernamebart/python_course_by_adrian_gonciarz
/hw_day6.py
2,351
4.0625
4
#Zadanie2 - oblicznie BMI # Napisz metodę calculate_bmi, która przyjmie 2 parametry: # • Wagę w kilogramach # • Wzrost w metrach # I zwróci wartość współczynnika BMI dla tych danych https://pl.wikipedia.org/wiki/Wska%C5%BAnik_masy_cia%C5%82a # Policz współczynnik BMI dla następujących danych: # • Waga 80.3 k...
b2b6097c171d98bcceb1660013430787ef81e23f
nidamirza9/Python-for-Data-Science
/Learn_Basic.py
3,217
4.15625
4
##Learn python.org #Nida Mirza #5CE-1-->30 #Learn the Basic: ##1.Hello, World! print('\n---------------------------\n') print('Nida Mirza') print('5CE-1') x=1 if x==1: print("Enroll-no:180630107030") print('\n---------------------------\n') print('---------------------------\n') print('\nA:') m...
7da3b90e5cb269ac3c67e3af296aeba1a60e4bed
ChiniGumy/ejercicios-espol
/Examen 2016 1S Mejora/Tema 1/Tema 1.py
2,505
3.5
4
from os import write def cargar_datos(nombre_archivo): diccionario_datos = {} archivo_datos = open(nombre_archivo, "r") lineas = archivo_datos.readlines() archivo_datos.close() # depues de un readlines ya se puede cerrar el archivo, ya que no se lo llama despues diccion...
6cc8734c2b5441af7b058c263c386f224b9f654e
aspadm/labworks
/module1-2/roots_protect2.py
2,067
3.75
4
# Кириллов Алексей, ИУ7-22 # Защита уточнений корней, метод касательных from math import sin, cos def f(x): #return x*2-4 return sin(x) def fs(x): return cos(x) a, b = map(float, input('Задайте границы отрезка: ').split()) eps = float(input('Задайте точность по х: ')) max_iter = int(input(...
9e474c42dbc89428d1ef919d7bfb01c978984f57
Syase4ka/SomePythonExercises
/theVolumeOfLiquid.py
749
4.21875
4
""" Calculates the volume of liquid held in a disposable cup """ import math def cone_volume (bottom_radius, top_radius, height): """ Calculates the volume of liquid held in a disposable cup Arguments: bottom_radius - bottom radius of a truncated cone (float) top_radius - top radius of a truncated ...
974e81f2c1e786c86e6f2e2170b1c62a175b6f30
ankeetshankar/D04
/HW04_ch08_ex05.py
1,921
4.71875
5
# Structure this script entirely on your own. # See Chapter 8: Strings Exercise 5 for the task. # Please do provide function calls that test/demonstrate your # function. #Exercise 8.5. A Caesar cypher is a weak form of encryption that involves “rotating” each letter by #a fixed number of places. To rotate a letter mean...
d541b716ce8bd9951812e58d2cb714246c8b3a7a
Mighel881/SimplePasswordGen
/PwGen.py
530
3.65625
4
#importing shit import random, string #PEE PEE POO POO #raw_input asking for user input to return as a string, then convert into an integer password_length = int(input("HOW LONG DO U LIKE THEM?")) #POO POO PEE PEE password_characters = string.digits + string.punctuation #sets a blank list (of strings, individual charac...
4d5bb399813631e9bf77c5cdd2a18ba51bfdcd24
shadmanhiya/Python-Projects-
/hourrate.py
813
4.1875
4
""" Write a program to prompt the user for hours and rate per hour using input to compute gross pay. Pay the hourly rate for the hours up to 40 and 1.5 times the hourly rate for all hours worked above 40 hours. Use 45 hours and a rate of 10.50 per hour to test the program (the pay should be 498.75). You should ...
1d3e8fb09df2ab1a5c8934598b599c75621931c5
nlakritz/codingbat-python-solutions
/logic-2/lone_sum.py
199
3.71875
4
def lone_sum(a, b, c): subtract = 0 if a == b or a == c: subtract += a if b == a or b == c: subtract += b if c == a or c == b: subtract += c sum = a+b+c return sum - subtract
b0e9db768d8b1ec351971dc26c531a0b9c98a928
PlumpMath/exercises-for-programmers
/python/ex-6.py
456
4
4
# 퇴직 계산기 import datetime current_age = int(input('What is yout current age? ')) retire_age = int(input('At what age would you like to retire? ')) left_years = retire_age - current_age current_year = datetime.date.today().year retire_year = current_year + left_years print('You have ' + str(left_years) + ' years left ...
7a767cc5d9e9641f4bd309d99a7b58285dad5fa6
Trietptm-on-Coding-Algorithms/projecteuler-1
/Problem2.py
996
4.21875
4
#! /usr/bin/env python from math import sqrt """\ Project Euler problem 2 Even Fibonacci numbers Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonac...
7720c6fb1d6a14ed37a2179ea1b5c69cb54f1e8e
fubst0318/webscrawl_cn
/multiprocessing_content/mulpStart.py
256
3.609375
4
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' 这是一个multiprocessing的模块开始模块 ''' from multiprocessing import Pool def f(x): return x * x if __name__ == '__main__': with Pool(5) as p: print(p.map(f, [1, 2, 3]))
035c04836fe664bb17d15d560d77f16debd19737
padth4i/beginner-scripts
/hangman.py
919
4.09375
4
import time from random_word import RandomWords name = input("What is your name? ") print("Hello, " + name, "Time to play hangman!") time.sleep(1) print("Start guessing...") time.sleep(0.5) # Return a single random word r = RandomWords() word = r.get_random_word() guesses = '' turns = 10 misses = '' while t...
d9d766e9113248a329930156b5757fa499e09bfb
iamgbn-git/git-hub-exercises
/Solutions/_rectangle_class.py
416
4.34375
4
#Question 53 '''Define a class named Rectangle which can be constructed by a length and width. The Rectangle class has a method which can compute the area. Hints: Use def methodName(self) to define a method.''' class Rectangle: def __init__(self, l , w): self.length = l self.width = w de...
708b9695866ad97f2b61c60cf8ccce811de006d5
ISSOtm/1234-golf
/program_stats.py
654
3.71875
4
#!/usr/bin/python3 import sys import string banned_chars = "'\"0123456789" illegal_chars = [] char_count = 0 line_id = 0 with open(sys.argv[1], "rt") as in_file: for line in in_file: line_id = line_id + 1 col_id = 0 for char in line: col_id = col_id + 1 if char in banned_chars: illegal_chars.appen...
332159b5701af9fcf781bb62a8575b749f565717
vany-oss/python
/pasta para baixar/netcha/exer 41classifcao de ateletas.py
494
3.71875
4
from datetime import date actual = date.today().year nasc = int(input('Data do seu nascimento ')) idade = actual - nasc print(f'O ateleta tem {idade} anos.') if idade <= 9: print('Classificaçao: Mirim.') elif idade <= 15: print('Classificação Infantil.') elif idade <= 19: print('Classificação Junior.') eli...
2ba26b307e6cd11e7e813b0c74e899f54983c919
tummybunny/py-tetris
/Tetris.py
9,459
3.5625
4
""" By Alexander Yanuar Koentjara - my attempt to learn Python by creating simple app """ import pygame from random import randrange from pygame.locals import * from pygame.draw import lines, line displaySize = width, height = (240, 400) blockSize = 20 score = 0 level = 1 downTick = 30 class RecyclingColors: fro...
75f769c4efeb620a4a5ff4645955b7181d302da8
andrewtammaro10/TicTacToe
/Tammaro TicTacToe.py
5,771
3.9375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Aug 31 20:48:40 2021 @author: drewtammaro """ position = input( "Choose a position: " ) print( position ) spaces = ['A1','B1','C1','A2','B2','C2','A3','B3','C3'] #{space: '_' for space in board} board = dict.fromkeys(spaces) #board = {boardlist: '_' ...
cf194dd4a902b25fa8f0c36e89b3c52dd42afb53
gdwyer3/Minesweeper_ML
/Generate.py
2,513
3.59375
4
import json import random import time str_index = 0 bomb_count = 5 class Generator(): def __init__(self, bomb_count, height, width): self.bomb_count = bomb_count self.height = height self.width = width self.board = [[0 for i in range(width)] for j in range(height)] ...
04c43ec0339b2c18da755586f81841fd81c2ca4d
sadique720/python-basics
/P.P.P/if else elif.py
183
4
4
x=int(input("enter a number")) if (x==1): print("One") elif (x==2):+ print("Two") elif (x==3): print("Three") elif (x==4): print("Four") else: print("Wrong input")
277a66889972517c48b0d969a888d2a27229a60c
surender-karu/HackerRankProblems
/arrays/repeated_str.py
555
3.640625
4
s = 'a' a = 10 def repeatedString(s, n): str_len = len(s) if str_len == 1 and s == 'a': return n count_a_in_str = 0 for c in s: if c == 'a': count_a_in_str = count_a_in_str + 1 if count_a_in_str == 0: #no a in s return 0 num_repeats = n // st...
c54b88dea51a0e2ce5c1ae9dab5357e5628f73fb
B-Weyl/AdventOfCode
/Day9/sol.py
676
3.53125
4
import sys def main(): s = input() total = 0 skip = False garbage = False answer = 0 x = 0 for c in s: if skip: skip = False continue if c == '!': skip = True continue if garbage and c == '>': garbage = Fal...
f8d8da479204fbe0b197b7f9fa4f8de3ac4fe8dd
Lucas01iveira/curso_em_video-Python
/Exercício_50.py
323
3.828125
4
def main(): s_par = 0 par = [] for i in range(6): n = int(input('Digite um numero inteiro: ')) if n%2 == 0: s_par += n par.append(n) print('Voce digitou {} números pares: {}'.format(len(par),par)) print('A soma desses valores eh igual a {}'.format(s_par)) main...
153298e4b323b0188ab6d657943338d64c4d811e
miguelsh410/networking_down_under
/manchester_encoding.py
1,854
3.96875
4
""" Manchester Encoding Sends a message across a wire using Manchester Encoding. """ import time import RPi.GPIO as GPIO # Data channel to transmit on DATA_CHANNEL = 12 # Speed between transitions CLOCK_SPEED = .005 BITS_IN_A_BYTE = 8 # Setup the pins GPIO.setmode(GPIO.BCM) GPIO.setup(DATA_CHANNEL, GPIO.OUT) # P...
766beb5086ba910ccb6ac72dee65aa669e8f3339
jgrynczewski/testowanie_waw
/0_exceptions.py
716
3.984375
4
import math def circle_area(r): if type(r) not in [int, float]: return "Podales nieprawidlowy typ. Podaj liczbe" elif r < 0: return "Kolo o takim promieniu nie istnieje." else: return math.pi*r**2 # print(circle_area(1)) # print(circle_area(0)) # print(circle_area(-1)) # print(circ...
fc36d45540747a3e7007cb0fa605a1621ffc9d7b
paul0920/leetcode
/question_leetcode/5_6.py
738
3.984375
4
def longestPalindrome(s): """ :type s: str :rtype: str """ if not s: return s max_len = 0 start = 0 for i, char in enumerate(s): start_1, len_1 = is_valid_palindrome(i, i, s) if len_1 > max_len: start = start_1 max_len = len_1 s...
54d331e05d671bc05e26ed4f96770bda5682b0b0
Jakoma02/pyGomoku
/pygomoku/models/tile_generators.py
5,507
3.5
4
""" A module of helper board-related (mostly tile-generating) functions """ from .constants import Direction def horizontal_generator(board): def row_generator(r): for c in range(board.size): yield board[r][c] for row in range(board.size): yield row_generator(row) def vertical_g...
b6c816eb9bdbbc9381ff96d7c282dc703f162ff7
avkramarov/gb_python
/lesson1/Задание4.py
462
4.0625
4
# Пользователь вводит целое положительное число. # Найдите самую большую цифру в числе. Для решения используйте цикл while и арифметические операции. user_number = int(input("Введите число >>>")) max = 0 while user_number > 0: a = user_number % 10 user_number //= 10 if a > max: max = a p...
ba33ce6940599e88acb5a239c6d0893a19068b6e
RobinHou0516/Homework
/print/name3.py
148
3.625
4
name='Robin Kawensanna Smartest Unrivalled' age='14' grade='9th' grade.title school='JXFLS' print('My name is '+name+'. I am a '+age+' year old '+grade+' grader at '+school+'.')
8852fd4d0ec513515df38a65f6b8458b2940a7df
amitmtm30/PythonCode
/Function/FunctionArgument.py
465
3.890625
4
# There are three types of argument in python : # 1. Positional Argument # 2. Keyword Argument # 3. Default Argument ####################### Positional Argument ############################# def sum(a, b): print("The sum is : ", a + b) #sum (100,50) # Here value is assigened to 100 and b is 50 sum (50, b=10) ###...
b05a6dbf105cab661aa6d2ed45ff408e8d14f903
funfoolsuzi/coding_dojo_essence
/python_oop_demo/store.py
844
3.640625
4
from product import Product class Store(object): def __init__(self, location, owner): self.location = location self.owner = owner self.products = [] def add_product(self, prod): self.products.append(prod) return self def remove_product(self, prodname): for ...
d2a5fc977e7e9ade75e1e49bbf7aa5fd2a209a32
adriene-tien/ProblemSolving
/LeetCode/Easy/ValidParentheses.py
1,146
3.90625
4
# LeetCode Easy # Valid Parentheses Question # O(n) time complexity # O(n) space complexity as we use trackStack. Worst case for space is that every character is a left bracket # so trackStack is fully populated with all characters of s, but is still able to return false at the end class Solution: def isValid(self...
e56c653e8748a10d1f321ac658a8fa5c05a579a0
hiroshima-arc/aws_sam_python_hands-on
/sam-app/fizz_buzz/fizz_buzz.py
462
3.703125
4
class FizzBuzz: @staticmethod def generate(number): value = number if value % 3 == 0 and value % 5 == 0: value = 'FizzBuzz' elif value % 3 == 0: value = 'Fizz' elif value % 5 == 0: value = 'Buzz' return value @staticmethod de...
9fccd657b7a78186528213f15fb03e5e278635dd
marloncard/byte-exercises
/04-iteration-3/iteration3.py
1,268
4.4375
4
#!/usr/bin/env python3 """ * Create a variable and assign it to the array below [2, 34, 12, 29, 38, 1, 12, 8, 8, 9, 29, 38, 8, 9, 2, 3, 7, 10, 12, 8, 34, 7] * Write a function that will take in this variable * It will return the median number in the array * It will return the average of that array * It will return t...
70d7800f351b7adebb372c24e4e945c8a91fa901
MrHamdulay/csc3-capstone
/examples/data/Assignment_2/njrmic001/question3.py
446
4.375
4
#question3.py #A program to calculate the value of PI, compute and display the area of a circle with radius entered by the user #Author: Michelle Njoroge from math import* a=2 b=sqrt(2) pi=2*(a/b) while b<2: b=sqrt(2+b) pi=pi*(a/b) print("Approximation of pi:",round(pi,3)) y=eval(input("Enter t...
adacb18a6c3bdbd4632a1482cd0055bf3a60a0f3
NourAlaaeldin/Python-projects
/Tuples.py
190
3.53125
4
#creating a tupple #we can't modify a tupple coordinates = (2,3) print(coordinates) print(coordinates[0]) #we can create a list of tupples #ex of using tupples : sorting data
46e2c1cbebadda10f4ed300a6a5848699f5a89ff
Prerna983/260567_PythonPractiseLTTS
/comments.py
525
4.53125
5
# This program evaluates the hypotenuse c. # a and b are the lengths of the legs. a = 3.0 b = 4.0 c = (a ** 2 + b ** 2) ** 0.5 # We use ** instead of square root. print("c =", c) # This is a test program. x = 1 y = 2 # y = y + x print(x + y) print("I've also learnt multi-line comments") # to make a multi line # comm...
f4039b0f8b7162f024cc28c67db69244924c0d31
Igor-Ferraz7/CursoEmVideo-Python
/Curso/Mundo 1/Desafio035.py
427
3.5
4
am = '\033[33m' vd = '\033[4;32m' vm = '\033[4;31m' az = '\033[34m' r = '\033[35m' ci = '\033[36m' des = '\033[m' a = int(input(f'{ci}Primeira reta{des}:')) b = int(input(f'{ci}Segunda reta{des}:')) c = int(input(f'{ci}Terceira reta{des}:')) if a < b + c and b < a + c and c < a + b: print(f'{vd}As retas acima podem...
978af9e14b5f80257c47e9e6c784c66e3e1628e8
rojan-rijal/internmate
/microservices/airbnb/app/apptconn.py
1,580
3.640625
4
#Module Name: Airbnb API Client for Python #Date of the code: 4/19/20 #Programer(s) Name: Janeen Yamak, Brittany Kraemer, Rojan Rijal #Brief description: This file is a client for the Airbnb api. A user shall input the city, state, and offset and it shall return a list of apartments located in th...
e14ed769c82de0f6685808a25c4f8668aa2b7313
IamWenboZhang/LeetCodePractice
/844BackspaceStringCompare.py
631
3.625
4
class Solution(object): def backspaceCompare(self, S, T): """ :type S: str :type T: str :rtype: bool """ s0 = [] t0 = [] for i in range(len(S)): if S[i] == "#": if len(s0) > 0: s0.pop() else: ...
a7d68d48ecadf2b7a574d38737e845ddce62eb7d
chazkiker2/code-challenges
/misc/return_next_number/test_return_next_number.py
434
3.796875
4
import unittest from return_next_number import * class ReturnNextNumber(unittest.TestCase): def test(self): self.assertEqual(addition(2), 3, "2 plus 1 equals 3.") self.assertEqual(addition(-9), -8, "-9 plus 1 equals -8.") self.assertEqual(addition(999), 1000, "999 plus 1 equals 1000.") ...
e6f963291cc4c21d76b1e63a2da084c2a93f27eb
subezio-whitehat/CourseMcaPython
/c2python/c2p10.py
183
4.28125
4
#10. Accept the radius from user and find area of circle. r=int(input("\nEnter the radius of circle:")) area=3.14*r*r print("\nThe area of the circle with radius %d is %f!" %(r,area))
df0e2428f220d4d2f1356b160295f04db583f163
mateogolf/python
/list2dict.py
567
4.0625
4
def make_dict(arr1, arr2): new_dict = {} #Error Case: what is arrays are different length if len(arr1) >= len(arr2): keys = arr1 data = arr2 else: keys = arr2 data = arr1 for i in range(0,len(keys)): new_dict[keys[i]] = data[i] print "{}: {}".format(ke...
304ec11d2ef3dcda59568b86881751cc4faa8149
wgay/allpyprj
/test.py
455
3.9375
4
#! /usr/bin/python3 counter = 100 #整型变量 miles = 1000.0 #浮点型变量 name = "runoob" #字符串 print(counter) print(miles) print(name) #多个变量赋值 a = b = c = 1 a,b,c = 1,2,"runoob" ''' python标准数据类型 Number(数字) 不可变 String(字符串)不可变 List(列表)可变 Tuple(元组)不可变 Set(集合)可变 Dictionary(字典)可变 ''' #Number Python3支持int,float,bool,complex(复数)
a2e5684a013575d7edc30331087915fd8e425970
paosq/test-assignment
/task1.py
338
4.3125
4
def rectangle_area(a, b): """ Calculates the area of a rectangle given its side lengths :param a: first side of the rectangle :param b: second side of the rectangle :return: area of the rectangle :raises ValueError: if either number was negative """ if a<0 and b<0: return "erro...
c7c76fe1b6c1153994ee6daf516fa42d5f39cb24
revanthnamburu/Codes
/PilingCubesVertical.py
725
4.15625
4
#You are given a horizontal numbers each representing a cube side. #You need to pile them vertically such a way that,upper cube is <= lower cube. #Given you can take the horizontal cube side from either left most or from right most. #If it can be piled up vertivally retirn 'YES' or else return 'NO' #EX:3,2,1,1,5 ...
39040c19312c025f6ae625cb71e50b414e6e0654
jkz/python-www
/www/utils/functions.py
186
3.59375
4
def header_case(name): splits = name.replace('-', '_').split('_') if splits[0].upper() == 'HTTP': splits = splits[1:] return '-'.join(w.capitalize() for w in splits)
28f434d25df9d199c0a1d9377b71b7bad42e7c59
Jiawei-Wang/LeetCode-Study
/819. Most Common Word.py
430
3.796875
4
class Solution: def mostCommonWord(self, paragraph: str, banned: List[str]) -> str: """ remove all punctuations change to lowercase words count for each word not in banned set return the most common word """ ban = set(banned) words = re.findall(r'\w+'...