blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
3831fc305f09e600ec60b2290dfa375c4c207aac
gwy15/leetcode
/src/478.在圆内随机生成点.py
973
3.75
4
# # @lc app=leetcode.cn id=478 lang=python3 # # [478] 在圆内随机生成点 # from typing import List from utils import * from matplotlib import pyplot as plt # @lc code=start import random import math class Solution: def __init__(self, radius: float, x_center: float, y_center: float): self.x, self.y, self.r = x_cent...
5849613f068902e073ff951e58b019aa228a8a0d
Aasthaengg/IBMdataset
/Python_codes/p02713/s902191382.py
265
3.625
4
import math from functools import reduce def gcd_list(num_list): return reduce(math.gcd, num_list) K = int(input()) sum = 0 for a in range(1, K+1): for b in range(1, K+1): for c in range(1, K+1): sum += gcd_list([a, b, c]) print(sum)
8250d8d04888fca5c1eb523ab5901672fbcd313b
leifos/search-face
/search_face_project/serp/chatnoir_search.py
2,669
3.890625
4
import json import urllib import urllib2 def read_api_key(key_file_name): """ Reads the API key from a file called key_file_name. Returns either None (no key found), or a string representing the key. Remember: put *.key in your .gitignore file to avoid committing it! """ # See Python Anti-Patte...
8eb59dea431351a2610ca729c33e7c7ef73a5adb
SapnaGulati/python
/src/search/linearsearch.py
495
4.25
4
# Linear Search - Python3 # Procedure linear_search is used to search an element sequentially. # Worst-case complexity O(n) def linear_search(list, search_element): for i in range(0, len(list)): if (search_element == list[i]): print("Element found at position: ", (i+1)) #Test with hardcoded da...
99d8c6d62bc5cf2a9136d049d0cbf86d642b71ff
quinceleaf/implementing-webhooks
/web/apps/common/utils.py
944
4.375
4
def check_if_all_bool(*, elements: list) -> bool: """Check if all elements in list are either True or False""" result = True for element in elements: if not isinstance(element, bool): return False return result def check_if_all_none(*, elements: list) -> bool: """Check if all...
957b1111f1b7b61620f3ebf381ba0744822aa8d4
nolngo/Bank-Account
/BankAccount.py
2,448
4.09375
4
from random import randint class bankAccount: def __init__(self, full_name, account_number): self.full_name = full_name self.account_number = account_number self.routing_number = 987654321 self.balance = float(0) self.interest = float(0) def deposit(self): amoun...
b20d17916565894c0ad9d4c6695c25d8b0ded9b1
CA2528357431/python-base--Data-Structures
/21/21.py
2,829
3.703125
4
# 二叉树 # 27非递归遍历 class tree: def __init__(self, root, left=None, right=None): self.nodes = [] self.root = root self.left = left self.right = right self.data = None # root作为排序依据 # data存数据 # 后续几个二叉树用例就不带数据了 @property def lisp(self): ...
313ab95c5a3f66452e2aa4ddc6ab86d331f62a5e
DongyunHan/algorithm_study
/searching/p_1920.py
577
3.8125
4
# p_1920 def binary_search(lookup_table, i): start = 0 end = len(lookup_table)-1 while start <= end: mid = (start + end)//2 if(lookup_table[mid] == i): return 1 elif lookup_table[mid] < i: start = mid +1 else: end = mid -1 return 0 ...
fa6a93176fdfb94d36675fab8e3530c5951127cd
TianYuWang1996/mystuff
/ex44d.py
1,226
4.0625
4
## 三种方法的组合使用 class Parent(object): ##创建一个继承object类的Parent类 def override(self): ##Parent类的override方法 print("PARENT override()") def implicit(self): ##Parent类的implict方法 print("PARENT implicit()") def altered(self): ##Parent类的altered方法 print("PARENT altered()") class Child(Parent): ##创建一个继承Parent类的Child类 d...
0b0f9228146d7c9f8e5447d9cb3df780f3953d01
atpaino/stocktradinganalysis
/stockdatastructs.py
1,353
3.53125
4
from trading import DATA_PATH class MarketDatapoint: """ Contains various data corresponding to a particular day for a particular symbol. """ def __init__(self, line): """ Initializes this datapoint by extracting data from the CSV line given. """ #Break up data from the...
b9cde854f8ba64f38a5b8efa2d6a527e2c088ae7
dylanplayer/ACS-1100
/lesson-2/example-1.py
211
3.5625
4
# Print # Challenge: print an integer print(1) # Challenge: print a float print(3.5) # Challenge: print a string print("Hello World") # Challenge: print the value of a variable variable = 3 print(variable)
ef2f2c5b259360af2a6f68b7c37deee0caf74548
gangh/myleetcode
/solutions/014-longest-common-prefix/longest-common-prefix.py
922
3.921875
4
# Write a function to find the longest common prefix string amongst an array of strings. # # If there is no common prefix, return an empty string "". # # Example 1: # # # Input: ["flower","flow","flight"] # Output: "fl" # # # Example 2: # # # Input: ["dog","racecar","car"] # Output: "" # Explanation: There is n...
66f634ed32e0323d48e315c0b504ab938a4d10ff
lvrcek/advent-of-code-2020
/day05/1.py
680
3.734375
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Advent of Code 2020 Day 5, Part 1 """ def convert_row(row): bin_row = '0b' + ''.join(['0' if c == 'F' else '1' for c in row]) return int(bin_row, 2) def convert_col(col): bin_col = '0b' + ''.join(['0' if c == 'L' else '1' for c in col]) return int(b...
8ce17e694aee63c3bb5b2286ca630d8c2e28ae5b
Laura-ss/Python
/Prácticas/1. Primeras pruebas/ejercicio_4_buscar_repetidos.py
700
3.84375
4
#cadena = input("Escribe lo que quieras:") #subcadena = "" #for i in cadena.split(): # if subcadena.find(i) >= 0: # print (i, "está repetida") # subcadena = subcadena + " " + i #Si se prueba con el ejemplo "Hola quería decir que no todo es tan sencillo",el programa falla porque confunde el "que" de "quer...
1ad19bc1f5691a3bdea9ae6d36ec7dda1561641c
pushker-git/LeetCodeTopInterviewQuestions
/Codesignal and Geekforgeeks Combined/linkedListMiddle.py
763
3.71875
4
# Singly-linked lists are already defined with this interface: # class ListNode(object): # def __init__(self, x): # self.value = x # self.next = None # def findMiddleElement(l): first = l second = l if l is not None: while first is not None and first.next is not None: firs...
a9f681eef0021969c802e65f3b5708bce0f32830
Yogesh-Singh-Gadwal/YSG_Python
/Advance_Python/Day-23/20.py
365
3.71875
4
# Class & Object class Employee(): # method def m1(self,a,b): print('Sum of value is :',a+b) def m2(self): print('Product value is : ',(a*b)) # NameError: name 'a' is not defined ee = Employee() v1 = float(input('Enter user value -1 : ')) v2 = float(input('Enter user ...
9eaade892e2d813c5b508f07fbc2b9e37fdf6d86
bubagirl/PyPokemon
/pokemon_v_0_4.py
4,985
3.671875
4
import random class Pokemon(object): def __init__(self, name, level, poke_type, hp, atk, defense, special_attack, special_defense, speed): self.name = str(name) # Название покемона self.level = level # Уровень покемона self.poke_type = poke_type # Тип покемона self.hp = hp # О...
9f3d4b379e580ca69451b0ddeba96552849d7299
robertopedroso/euler
/python/problem20.py
396
4.03125
4
from util import memoized @memoized def fac(n): """Returns the factorial of n""" if n == 1: return 1 return n * fac(n-1) def sumdigits(n): """Returns the sum of the digits in n""" digits = [int(x) for x in str(n)] return reduce(lambda x, y: x + y, digits) if __name__ == "__main__": # prob...
86bd6ced464296280984a14d62797e03a454e1a4
pprat2000/CompBio
/Assignment1/Assignment1_Question1.py
374
3.78125
4
#Comp Bio Fall 2018 #Assignment 1, Question 1 #SBU ID : 112027432 #Taking input dnaString = input() #Creating a dictionary nucleotideCount = {"A":0, "C":0, "G":0, "T":0} #Counting the nucleotides for nucleotide in dnaString: nucleotideCount[nucleotide] += 1 #Printing the Count for nucleotide in sorted(nucleotideCo...
da01ccc0d29a6f70703376026115dedd99648697
Kartavya-verma/Python-Projects
/LeetCode/gfg_repeating_ele.py
135
3.671875
4
arr = [1, 4, 2, 3, 5, 4] for i in arr: if arr.count(i) > 1: print(arr.index(i)+1) break else: print(-1)
bc8519c748d146e1f5856c7db117ff510b8ee554
marthaluka/Python4Bioinformatics2019
/Scripts/modify_input_seq.py
559
3.625
4
#!/usr/bin/env python print("Please enter your DNA sequence: ") dna = input() print(dna) dna.upper() print(dna) #GC_content= dna.count('G')+dna.count('C') trna = 'AAGGGCTTAGCTTAATTAAAGTGGCTGATTTGCGTTCAGTTGATGCAGAGTGGGGTTTTGCAGTCCTTA' C_count=trna.count('C') G_count=trna.count('G') GC_content= (G_count+C_count)/l...
8ab965c411acd436a84ea2def5665d9fa44d57fb
jdcera4/holbertonschool-higher_level_programming
/0x0A-python-inheritance/2-is_same_class.py
249
3.78125
4
#!/usr/bin/python3 """function that returns True if the object is exactly an instance of the specified class ; otherwise False """ def is_same_class(obj, a_class): """Return false or True""" return True if type(obj) is a_class else False
8499f6a176acd72aa6a131769419451d58554f68
Tonychan0329/Group-project
/place.py
1,045
4
4
''' Created on 2019年5月11日 @author: tony ''' class place(object): ''' place class represent the location of the CLP electric charging station ''' numplace = 0 # class variable to record number of location def __init__(self,area,location,address): ''' constructor method ...
5e3a5b000c69b3edd506afbfafdcc371587ad1fe
yokolet/transcript
/eng_to_kana/consonant_converter.py
4,614
3.625
4
class ConsonantConverter: def __init__(self): self.vowels = 'aeiou' self.consonants = 'dgʤʒklmnptvʧŋɹʃðθ' def d_rule(self, word, ph, p_idx): # d, dz -- dd, z if p_idx+1 < len(ph) and ph[p_idx+1] == 'z': return 'z' elif p_idx >= 1 and ph[p_idx-1] in self.vowel...
7b1408118b47d038bd6b5354ead8e47f893a0c9e
mouraja/jogo_da_velha_python
/game/JogoDaVelhaPlay.py
3,377
3.546875
4
import re class JogoDaVelhaPlay(): def __check_win_vertical(self, player, positions): plays = positions for row in range(3): print("Check vencedor") if positions['A'][row] != ' ' and positions['A'][row] == positions['B'][row] == positions['C'][row]: print("V...
05f3f86c63494226a546528f9c6166c267d84276
lhn1703/advent_of_code
/year_2022/day_2/main.py
3,507
3.75
4
with open('input.txt', 'r') as input_file: input_text = input_file.read().splitlines() points = { 'rock': 1, 'paper': 2, 'scissors': 3, 'lose': 0, 'draw': 3, 'win': 6 } total_score = 0 for line in input_text: round_score = 0 opponent_move = line.split()[0] player_move = line....
1f4d4cb972b49efde0727f9332da039c2447df69
QMHTMY/Arithmetic
/chain.py
6,420
3.859375
4
# -*- coding:UTF8 -*- #!/usr/bin/python #链表,节点 class Node: '''链表的构造快:节点的数据结构''' def __init__(self,initdata): self.data = initdata self.next = None def getData(self): return self.data def getNext(self): return self.next def setData(self,newdata): self.data ...
d8e171595040e5808de20bbd59cb4494a71d86f3
saeidshirazi/Crypto
/reverse_cipher.py
154
3.578125
4
getmsg = input("please enter your msg: ") i = len(getmsg)-1 reversmsg = "" while (i >= 0): reversmsg += getmsg[i] i = i -1 print(reversmsg)
68ec4dff9e9c403fa87b0825315100f9f80e0872
aamodpant15/make-batch
/make_batch.py
956
3.59375
4
# -*- coding: utf-8 -*- """ Created on Sun May 10 12:28:29 2020 @author: Aamod Pant """ import sys import os #save command line argument as name of the file to create file batname=sys.argv[1] #batch file name to create # batname='testfile' #IMPORTANT: Replace this file path to your environment locat...
85429e49c30b6c8261e83414b80d7fb9a6fee831
jeekim/Docknet
/src/docknet/layer/abstract_layer.py
4,368
3.6875
4
from abc import ABC, abstractmethod from typing import Union, Dict, Tuple import numpy as np class AbstractLayer(ABC): def __init__(self, dimension: int, params: Dict[str, np.array]): """ Initializes the layer, given a dimension and a dictionary of parameters :param dimension: the layer d...
78bd250403f7d17fb0f6cc55e8aca2176a7c7840
dtgee/AlgorithmLibrary
/PyInterview/Competitive/FBPuzzles/FacebookBalance/Solution.py
4,494
3.734375
4
import sys import fileinput import os __author__ = "Lucas Ou-Yang" class Balance: BASE_WEIGHT = 10 balanceNum = None leftBalance = None rightBalance = None leftWeight = None rightWeight = None # "Height" as in how high up it's # stacked on other balances, 0 is ground leve...
a3447355e5040117183178a3b659e24b1c75819c
pankajkumarsolanki/pythonMaster
/pythonByDoing/exercise.py
3,136
4.03125
4
import random # #lottery_numbers = set(random.sample(range(22), 6)) # lottery_numbers = {8, 0, 4, 6, 20} # # # Here are your players; find out who has the most numbers matching lottery_numbers! # players = [ # {'name': 'Rolf', 'numbers': {1, 3, 5, 7, 9, 11}}, # {'name': 'Charlie', 'numbers': {2, 7, 8, 22, 10, ...
ddefb44a51d2c058f1a1c3974db08a85cca075d4
rhasanrakib/Neural-Network-Lab
/covariance.py
938
3.640625
4
print("Enter Input vector :") input_vector = [float(x) for x in input().split() ] sum=0 n = len(input_vector) for i in range(n): sum = sum+input_vector[i] x_mean = sum/n sum=0 print(x_mean) print("Enter Weight vector :") weight_vector = [float(x) for x in input().split()] print(weight_vector) learning_rate =...
151a019a17cf9a5346344d2f3f22b06f1ea32082
jbmitchell7/simplepythonprojects
/gameof3s.py
615
3.890625
4
def run(): current = input("Type a number: ") current = float(current) while current != 1: if current % 3 == 0: print ("%d 0" % current) current = current / 3 elif ( current + 1 ) % 3 == 0: print ( "%d 1" % current ) current = ( current + 1 )...
5dde1c0e2ea8acb09e72fd367f81ac968a4d5193
Ahmed--Mohsen/leetcode
/scramble_string.py
2,506
4.0625
4
""" Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representation of s1 = "great": great / \ gr eat / \ / \ g r e at / \ a t To scramble the string, we may choose any non-leaf no...
e40cc659d695c0b2f4d127bd61a1998859a447b0
SSDeepthiKatta/Python
/LAB3/SourceCode/LAB3/t1.py
1,577
4.0625
4
#Lab Assignment-3 #Question -1 #Pick any dataset from the dataset sheet in class sheet and make one prediction model using your imagination with Linear Discriminant Analysis*. # Some examples are: # a.In the report provide convincible explanations about the difference of logisticregression and Linear Discriminant Analy...
eaf7306c2a7071411e8f3c0a542e6b91bcf43a49
fedealdosivi/python-mini-projects
/enumerar.py
101
3.515625
4
#!/fede/bin/env python lista=[] i=0 while i<10: lista.append(i) i=i+1 for i in lista: print i
eed5990fe119f6b274573316708cbca81df92ff8
zhengfuli/leetcode-in-python
/n069_Sqrt(x).py
835
3.671875
4
class MySqrt(object): def mySqrt(self, x): """ :type x: int :rtype: int """ # 1 binary search has similar performance as Newton's in low resolution requirement # but it requires special handling when dealing with numbers between 0 and 1 # if x < 0: # ...
70e9cf59e556038497c0adbc8e44b74f1aca1ba2
blacklc/Practice-for-python
/src/Test/orderTest.py
1,133
3.84375
4
#!/usr/bin/env python #coding:utf-8 ''' Created on 2016年5月11日 @author: lichen ''' #排序 ll=[4,2,7,8,9] print 'before 排序,the list\'s members are',ll ll2=sorted(ll) print 'after 排序,the list \'s members are',ll2 #自定义排序 def zdypx(x,y): #针对字母排序忽略大小写,原理为全部都转换成大写或者小写即可 if 'A'<x<'z' and 'A'<y<'z': x=x.upper() ...
3d4ad86d15b29b8b56e6ab9bfba17e5e2e4318b2
acarlam/Python-sample
/desafio.py
188
3.53125
4
#desafio.py nome = input("Qual seu nome ") idade = input("Qual idade ") calc1 = int(100) - int(idade) calc = int(2019) + int(calc1) print(f"Oi {nome} você fará 100 anos em {int(calc)}")
ac039e0d43053afb24aac8533f85107511e123cc
oforiaddaejnr/HuffmanEncoding
/Encode.py
481
3.671875
4
from Huffman_Tree import Huffman_Tree def encode(string): string.frequency() string.buildHuffmanForest() string.min_heapify() string.buildTree() string.encode() def decode(binary): string.decode(binary) if __name__ == '__main__': text = input("Input string you would like to encode: ") st...
6237beb1393cddd50c74167c1efc3f8145c12c8c
tracebyte/LeetCode
/python/TwoSum.py
1,954
3.90625
4
# https://leetcode.com/problems/two-sum/ # Given an array of integers, return indices of the two numbers such that they # add up to a specific target. # TLDR! class Solution: """ Actual code that used for leetcode submission """ def twoSum(self, nums, target): """ :type nums: List[i...
b1d62705d1126c3ed1caf4aa39a6a2965b76dc7b
sourjp/gof-design-patterns
/flyweight/flyweight-jp.py
759
3.59375
4
"""I referred below sample. https://ja.wikipedia.org/wiki/Flyweight_%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3 """ class Stamp: def __init__(self, type: str) -> None: self.type = type def __str__(self) -> str: return self.type class StampFactory: # To share in instances, use class var. ...
41f628dee244932cc32aeae44114a2dfba30e2e2
shourya192007/A-dance-of-python
/AYAN/ChangingPassword.py
370
3.78125
4
#Changing passsword script a = "GouthamKrishna" b = "abcxyz" c = str(input("Enter Username ")) d = str(input("Enter Password ")) if a == c and b == d: b = str(input("Enter New Password ")) elif a != c and b == d: print("The username is wrong") elif a == c and b != d: print("The password is wrong") else: ...
44118be6a78653e3e824f2587c41ef2a834ae504
SkylarRan/MyLeetCoding
/4.stack/42.TrappingRainWater.py
295
3.765625
4
class Solution: def trap(self, height) -> int: stack = [] stack.append(height[0]) for i in range(1, len(height)-1): if __name__ == "__main__": solution = Solution() # while True: height = [0,1,0,2,1,0,1,3,2,1,2,1] print(solution.trap(height))
b62e1b63af3fcd8a8fc8c70f94c6513374f34cc0
BirajN/pythongames
/pong_class_model.py
7,142
4.375
4
#============================================================ #This program allowes user to play "classic arcade game Pong". #------------------------------------------------------------ #Date:Jun-27/015 Class: Coursera/Fundamental_Computing_I/w5 #============================================================ ''' ==...
314f0e7bd376e1e4235b13c1a6ca3334907ad99f
JT4v4res/Discrete-Mathematics-num-theory
/mmc_and_mdc_with_primes.py
435
3.5625
4
# -*- coding: utf-8 -*- import math import numpy def mdc(a, b): rest = None while rest != 0: rest = a % b a = b b = rest return a # Function mmc def mmc(n, n2): a = n b = n2 #initializing rest rest = None while rest is not 0: rest = a % b a = b b = rest return (n * n2) / a x = int(input()) y...
ac1951e6b4d4151d10c18c15405417cd5e67e3e1
sai-byui/WAT
/wat/dictionary/nouns.py
1,181
3.75
4
from ..grammar import Word,WordType,NOUN from .. import abstract ''' This module simply contains a list of nouns we'll likely need. ''' @WordType(NOUN) class Class (Word): ''' The noun "class". ''' # def __init__(self): # super(self.__class__,self).__init__(NOUN) def create(self,**optio...
cbf64d4ad6bf6adab850aa7f222205ed770a468b
ercromwell/genetic-algorithm
/GeneticAlgorithm.py
4,963
3.5
4
from ExpressionTree import ExpressionTree import random #1: Generate random expression Trees def generateTrees(size): treeArray = [] for x in range (0, 1000): lst = expressionListGenerator(size) treeArray.append(ExpressionTree(lst)) return treeArray #2: Calculate fitness function for each tr...
d5a234e28930a84b4f1cc016bcae4fd610289799
DingXiye/PythonDemo
/PythonDemo/src/com/11.类和对象/BIF.py
789
3.75
4
''' Created on 2018年6月9日 相关的方法 @author: dingye ''' #1.issubclass(class,classinfo):如果第一个类是第二个类的子类,则返回true from inspect import getargs class A: pass class B(A): pass print(issubclass(B,A)) #2.isinstance(object,classinfo):第一个参数是第二个参数的实例对象,返回true b=B() print(isinstance(b, B)) print(isinstance(b,A)) #3.hasattr(ob...
18b8bd6ba080cf31f8977ad7ac72e2a565474674
cliodhnaharrison/CA117Lab
/Lab 03.2/stutuple_32.py
295
3.828125
4
from collections import namedtuple Student = namedtuple("Student", ["firstname", "surname", "id"]) def show_student(s): line1 = "First name: {}".format(s.firstname) line2 = " Surname: {}".format(s.surname) line3 = " ID: {}".format(s.id) print("\n".join([line1, line2, line3]))
5b9d5d389ee9252f3be9c3e6cdd1ec16b9d20727
sum008/python-backup
/Practice/bst.py
2,256
3.921875
4
''' Created on Jul 7, 2020 @author: Sumit ''' class Bst(): data=0 left=None right=None def __init__(self,data): self.data=data root=None def insert(data): p=1 global root if root==None: root=Bst(data) else: current=root ...
609d434964e1274bb373df0d4a44ee183af12ab7
geniayuan/MachineLearningCoursera
/ex1/gradientDescent.py
672
3.515625
4
import numpy as np from computeCost import computeCost def gradientDescent(X, y, theta, alpha, iterations): # Initialize some useful values m = len(y); # number of training examples n = len(theta); # number of variables + 1 # X is m * n, the first column are all 1 # y is m * 1 # theta is n * 1 ...
9bc1fb1b6dd06527afb5180790fc4dba0a767c08
abasllari/SDA_LH1AL
/examples/example_40.py
969
3.515625
4
import os import random def generate_random_value(start, end): x = random.randint(start, end) return "example_file_{}.txt".format(x) def create_and_fill_specified_number_of_lines(name, number_of_lines): # Writing to file (appending) with open(name, 'a') as f: # file_name mode (append)...
df10eaee122852fdc02dd9fed34d4808a7c1046e
valaparthvi/College-Python-Assignments
/Chapter4/chapter4_4_zerodivisionerror.py
348
3.984375
4
num1 = int(input("Enter number1: ")) num2 = int(input("Enter number2: ")) try: division = num1 // num2 print("%d / %d = %d" % (num1, num2, division)) except ZeroDivisionError as e: print("Sorry! Cannot divide by 0.") ''' Output: python3 chapter4_4_zerodivisionerror.py Enter number1: 19 Enter number2: 0 Sor...
e0861f0d00c87f003f6ae39a424503086702fd2c
yvonneyeh/codesignal
/reverseInParentheses.py
1,097
4.03125
4
# Write a function that reverses characters in (possibly nested) parentheses in the input string. # Input strings will always be well-formed with matching ()s. def reverseInParentheses(inputString): # look at all characters # add everything within () into a stack # pop items from stack into new string ...
3ae8a4615407f7c26cba0c23663fbd20b21b42eb
Larionov0/DimaKindruk_Lessons
/OOP/Start/Homework/3.py
654
3.78125
4
class Slime(): name = "" weight = 0 def prilipat(self, other): """ Этот метод принимает self, а также other - другого слизня. И он прилепляет второго слизня к себе, таким образом вес self увеличивается на величину, равную весу второго слизня :param other: др...
d090a2e55107a5e38e71a9a670addb90ef6fed29
JoePanes/XAI-COVID19
/code/preprocessing/process_weather.py
8,884
4.0625
4
""" Processes all of the .csv files present within the raw weather folder and extracts the temperature and humidity, averages all of their values for a given date then writes them into the processed folder. Uses weather data from this website: https://rp5.ru/Weather_archive_in_Chisinau Click "See on map" to access oth...
3750a66d90e44a2dd0325af2e5fbc85685e30b91
AKozhemyako/lesson06_classess
/chapter07_exersise/homework07_1.py
2,989
4.375
4
# 1 Выводим имена ученых names = ['Эйнштейн', 'Ньютон', 'Коперник', 'Кеплер'] print('задание 1: ') print(names) #2 Переменная names ссылается на список. Написать цикл for, который выводит каждый элемент списка. print('задание 2:') for n in names: print(n) #3 список numbersl имеет 100 элементов, а numbers2 являетс...
510f7c07454e2fa074067ceae5d8707538a10937
vp999/feature_engineering_project
/q03_skewness_sqrt/build.py
387
3.59375
4
# Default imports from scipy.stats import skew import pandas as pd import numpy as np ny_housing = pd.read_csv('data/train.csv') # Write your Solution Here: def skewness_sqrt (data): data['GrLivArea_1']=np.sqrt(data['GrLivArea']) data['SalePrice_1']=np.sqrt(data['SalePrice']) return (skew(data['GrLivArea...
9b8536bdf6e7d6e0c50474f5825208fd657fde14
EdsonRodrigues1994/Mundo-3-Python
/desafio098.py
2,318
4.125
4
'''Faça um programa que tenha uma funcao chamada contador(), que receba tres parametros: inicio, fim e passo e realize a contagem. Seu programa tem que realizar tres contagens através da função criada: A) DE 1 ATÉ 10, DE 1 EM 1 B) DE 10 ATÉ 0, DE 2 EM2 C) UMA CONTAGEM PERSONALIZADA''' from time import sleep def conta...
1eb1a0df257e245e1117c3f755a94e30fdee045e
kamni/Tic-Tac-Toe
/dist/tictactoe.app/run.py
7,347
3.640625
4
""" UI classes for running this app. Logic can be found in ttt.py. """ import kivy kivy.require('1.8.0') from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.uix.button import Button from ttt import TicTacToeBoard HUMAN_NAME = "[color=c60f13]You[/color] " COMPUTER_NAME = "[color=2ba6cb]Josh[/...
a6bd386eae25afd20ffb0298135c45853ee6ac93
jayeshd7/ML-Sckit
/Classroom1.py
767
3.53125
4
# -*- coding: utf-8 -*- #classroom1 assigment import pandas as pd #import data s x_panads = pd.get_dummies(dataset,columns =['country'],prefix = 'countr') dataset = pd.read_csv('') x = dataset.iloc[:, :-1].values y = dataset.iloc[:, 3].values from sklearn.preprocessing import Imputer imputer = Imputer(mi...
a78babbf2b009274c227152fcbe6088c2d481e30
OCC111/pc-code
/1-进程.py
251
3.59375
4
from threading import Thread import time def sing(): for i in range(10): print("singing!") time.sleep(1) def dance(): for i in range(10): print("dancing") t1 = Thread(target=sing) t2 = Thread(target=dance) t1.start() t2.start()
b0af5614253ffb154b8788ebe2b886522cdf702b
AmGhGitHub/SAGA_Python
/py_lesson14.py
2,411
3.828125
4
pressure_psia = [1250.145, 629, 7850.2, '450.6', 14.7, '1287.02', 844.1] length_pressure = len(pressure_psia) ## while loop with float conversion # index = 0 # while index < length_pressure: # pressure_kpa = float(pressure_psia[index]) * 6.89476 # print(f"{float(pressure_psia[index]):0.2f} psia = {press...
404d98c0b20fdf8abd2d1c45a4277a478a2fc43d
vsdrun/lc_public
/depth-first-search/753_Cracking_the_Safe.py
2,977
3.796875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ https://leetcode.com/problems/cracking-the-safe/description/ There is a box protected by a password. The password is n digits, where each letter can be one of the first k digits 0, 1, ..., k-1. You can keep inputting the password, the password will automatically be ...
c41e6637ff4a1ef7749fe8d458d143a051f97e32
joellerena/I_accompany_you_to_code
/codes/codigo11.py
264
3.578125
4
# -*- coding: utf-8 -*- """ Created on Tue Sep 3 13:01:54 2019 """ palabras = "Mi amiga María Cristina" numero = 19 todo = "Primero: '{0}' y segundo: '{1}'".format(palabras,numero) print(todo) todo = "Primero: '{1}' y segundo: '{0}'".format(palabras,numero) print(todo)
2eb03c92a77a3fc6b08e97735deaa05fd95e906d
ngoctu69/Search-Algorithm
/search_algorithm.py
10,408
3.671875
4
import pygame import graphUI from node_color import white, yellow, black, red, blue, purple, orange, green import math """ Feel free print graph, edges to console to get more understand input. Do not change input parameters Create new function/file if necessary """ def printPath(graph, edges, edge_id, start, goal, Par...
dff4dd69edd8210b961990ffa03fb1675fd2540b
LucasPAndrade/_Learning
/_Python/Fundamentos-CursoEmVídeo/Desafio 097.py
236
3.71875
4
print('=' * 10) print('DESAFIO 097 - Função escreva') print('=' * 10, '\n') def escreva(msg): n = len(msg) print('~' * (n + 2)) print(f' {msg}') print('~' * (n + 2)) t = str(input('Digite uma mensagem: ')) escreva(t)
895adab74e23acf0028e0df323a3b51af1a8b199
chihangwang/Final-Project-Twitter-Big-Data
/Cloud_Final_Phase_3-master/ETL/q4_map_reduce/1/reducer.py
2,186
3.59375
4
#!/usr/bin/python import sys import time def sort_tweetid(tweetid_str): tweetid_list = tweetid_str.split('<15619nolife>') if (len(tweetid_list) == 2): return tweetid_str sorted_list = [] output_str = '' for i in range(0, len(tweetid_list), 2): record = [tweetid_list[i], tweetid_li...
5607740bade4b4f7f711524082978c0c9f485d3d
snehilk1312/AppliedStatistics
/Python/statistics_with_Python/03_Python_Enviroment/Script_Files/04_readingData.py
789
3.578125
4
import pandas as pd import numpy as np lecturerData = pd.read_csv('/home/atrides/Desktop/R/statistics_with_Python/03_Python_Enviroment/Data_Files/Lecturer Data.dat', sep='\s+') print(lecturerData) lecturerData['job'] = lecturerData['job'].replace({1:'lecturer', 2:'students'}) # saving data lecturerData.to_csv('f...
0b9a4f0b5c173237d0dd9be8396ad32b81799874
ProgFuncionalReactivaoct19-feb20/clase04-davisalex22
/Ejercicio1.py
311
4.0625
4
""" Ejercicio 1 : Clase 4 Autor = @davisalex22 """ # Declaracion de Listas listaA = [10, 2, 3, 4] listaB = ["a", "b", "c", "d"] # Uso de list, zip y sorted listaFinal = list(zip((sorted(listaA)), (sorted(listaB, reverse=True)))) # Muestra en pantalla de resultados print(listaFinal) print(max(listaFinal))
cbd488092ce2d08917415469e3b2eeeea3bdd9b1
lqqnjust/leetcode
/102.py
917
3.875
4
from typing import List from queue import Queue # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: if not root: return []...
cb054cbfe7bb61cd20c8db2f3f3c45d4d439915a
chris-malloy/cs_fundamentals
/hash_tables/my_hash_table.py
1,635
3.8125
4
class LinkedListNode: def __init__(self, value): self.key = key self.value = value self.right = None self.left = None class LinkedList: def __init__(self): self.start = None self.end = None def append(self, key, value): new_node = LinkedListNode(key,...
d0245f48b22c0092a90af2c4a320c340345a985e
A-meerdervan/DataProcessingGit
/Lab/Week1/PyScrap/tvscraper.py
4,186
3.546875
4
#!/usr/bin/env python # Name: # Student number: ''' This script scrapes IMDB and outputs a CSV file with highest ranking tv series. ''' # IF YOU WANT TO TEST YOUR ATTEMPT, RUN THE test-tvscraper.py SCRIPT. import csv, codecs, cStringIO import unicodedata from UnicodeWriter import UnicodeWriter from pattern.web import ...
41cf602017ddef266906dc1b96c18942dc0c1a8a
dfaivre/code-challenges-001
/py/hacker-rank/interview_prep/03_sorting/02_mark_and_toys.py
1,047
3.71875
4
# https://www.hackerrank.com/challenges/mark-and-toys/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=sorting&h_r=next-challenge&h_v=zen #!/bin/python3 import math import os import random import re import sys # Complete the maximumToys function below. def maximumToys(prices,...
fff6d0f3fd7e120616815cc92332debf10829403
DeekshithSimhachalam/python
/Range&Step.py
419
3.921875
4
# for i in range(1,11): # print(i) ##prints i everytime in a newline # i = range(1, 11) ##includes 1 in range and excludes 11 # print(list(i)) ##prints the output in a form of list # i = list(range(1, 22, 2)) ##prints range of i with a step of 4 # print(i) # for i in range(100): # print(i) # i = range(1...
9cf06d76a238c70bec03be2714b0a1bee227fcd4
obrunet/Daily_coding_challenges
/Exercism/Python/02.raindrops.py
1,498
4.78125
5
""" https://exercism.io/tracks/python/exercises/raindrops converts a number into a string that contains raindrop sounds corresponding to certain potential factors. A factor is a number that evenly divides into another number, leaving no remainder. The simplest way to test if a one number is a factor of another is to ...
b352acea7ef98923f60b9077f2185615c7b861bb
diassor/platzi_pyhton_2019
/16_subclass_main.py
1,827
4.03125
4
# -*- coding: utf-8 -*- # vamos a agregar la funcion delete a nuestro script # crud [c]reated , [r]read or retreive, [u]ptade, [d]elete clients = 'Edwin, Alejandro, ' def create_clients(client_name): global clients if client_name not in clients: clients += client_name _add_comma() els...
41502c7ac5dc8f3893a6b2884ac5a559707c8591
Erdem7/MetaForm
/KütüphaneOrtaDüzey.py
1,892
3.890625
4
import os kitapListe = list () kitap = ["İnce memed","Yaşar Kemal"] menu = """ {1} Kitap Ekle {2} Kitap Çıkar {3} Kitapları Listele {0} Çıkış """ def kitapEkle(kitap:tuple,liste:list): liste.append(kitap) print("ekleme işlemi yapıldı") print("Ana menüye dönmek için Enter'a basınız") ...
71d1e383281477fbc8876f15143af2dfcbbdedba
mgzahara/opencv
/tutorials/coreOps/layerImages.py
1,480
3.71875
4
import numpy as np import cv2 #layer a non-rectangular image over another - one w/o a background #each step is illustrated def imshow(title, img): cv2.imshow(title, img) cv2.waitKey(0) cv2.destroyAllWindows() #img2 is going to be put in the top let corner of img1 #img2 must have less than or equal di...
60245907175b8ce473430fa0ac92de7a857561a4
KornevL/learning_python
/week7/how_many_words.py
233
3.578125
4
#!/usr/bin/env python3 import sys # inFile = open('input_text.txt', 'r', encoding='utf8') inFile = sys.stdin # any file in input words = set() for line in inFile: words.update(set(line.split())) print(len(words)) inFile.close()
45d1fab85de9f1dc9f37d666009d7109716dc6c9
RyanNand/MyProjects
/PersonalProjects/Python/IntermediatePythonTutorial/19_Asterisk_Operator.py
3,414
4.84375
5
# The asterisk operator - Multiple uses: multiplication, exponents, unpacking, replicating, # Can use it for multiplication and exponential functions result = 5 * 7 # Multiply print(result) result = 2 ** 4 # Exponential function - Equivalent to 2^4 print(result) # Can use it for replication zeros = ...
188d6864308f49abbb8060c60017ba61b4d22551
dclancy89/python_oop_modular_store
/manage.py
478
3.515625
4
from product import new_product from store import new_store # Product(price, item_name, weight, brand) store1 = new_store("123 Sesame Street", "Daniel Clancy") product1 = new_product(5, "Cookies", "16oz", "Oreo") product2 = new_product(10, "Chicken", "2lbs", "Perdue") print "adding products" store1.add_product(prod...
1b425b4a7f8a278d03d8951d4aefe6430ec4b96f
mengjiaoliwang/practice
/day01/triangle.py
596
3.671875
4
#!/usr/bin/python #coding=utf-8 '''************************************************************************* > File Name: triangle.py > Author:李梦娇 > Mail:mengjao_liwang@yeah.net > Created Time: 2017年12月05日 星期二 19时47分07秒 ************************************************************************''' i=1 while i<=5: ...
7046ddf87f8e897a0e1d476fe767c9f6215e7c76
khorshed/ML-R-Python
/Part 1 - Data Preprocessing/Section 2 -------------------- Part 1 - Data Preprocessing --------------------/data_preprocessing_template.py
616
3.625
4
# Data Preprocessing Template # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset=pd.read_csv('Data.csv') x=dataset.iloc[:, :-1].values y=dataset.iloc[:, 3].values # Splitting the dataset into the Training set and Test set from sklearn.cro...
5a2ff9dfed43f5c6ba0cc593d380dec8661fe5ec
AliFaghirzadeh/Python_Assignments
/Assignments/9_1_SeriCalculation.py
601
3.921875
4
# this function calculates the factorial of the given number def fact(n): if n == 0: return 1 result = n while n > 1: n -= 1 result *= n return result # function to calculate combination C(m,n) def comb(n, m): return fact(n) // (fact(n - m) * fact(m)) # this ...
72adc1cbbe2c6b07248cbab3b4d930ce0c4b6499
rickardotavares/2021_1_desenv_web_1
/exercicios_alunos/Paulo Barcelos/Exercícios em Aula 03.03.2021.py
865
3.90625
4
print ('Olá, Mundo!') class MeuMundo: def _init_(self): _nome = nome def set_nome(self, nome): self._nome = nome def get_nome(self): return self._nome variavel = 9.50 print(variavel) print(type(variavel)) variavel = 'Maria Torres' print(variavel) print(type(var...
17c9c6591f042c1cb926d2f808c3a292564fcd95
davidqian91/startfromhere
/practice_in_python/rotatelist2.py
1,063
3.953125
4
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param head, a ListNode # @param k, an integer # @return a ListNode def rotateRight(self, head, k): if k == 0 or head is None: ret...
27395280050a63ee801b091a1bc816b227e1408d
quadrant26/python_in_crossin
/Lesson/lesson28.py
153
3.5625
4
sentence = "I am an English sentence" print(sentence.split()) section = 'Hi. I am the one. Bye.' print(section.split(".")); print('aaa'.split("a"))
7ea6f57a2cad0e1c3003864312a43e7b2aae2e1a
AXS3/Number-Guessing-Game
/Number Guessing Game.py
427
3.984375
4
import random for x in range(10): z = random.randint(1,11) print('Guess a number from 1 - 10') if (z % 2) == 0: print('The Number Is Even') else: print('The Number Is Odd') if z < 5: print('The Number Is Smaller Than 5') else: print('The Number Is Larger Than 5') y = input('What Is The Numbe...
e65abe5fe9f8e769d6aa6b389b652afd7897ff86
liliandelgg/textadventure
/textadventurer.py
547
3.65625
4
start = ''' Welcome to Bikini Bottom. You want to meet Patrick at the new Glove World, but many characters conspire to get in your way. Follow your heart and make good decisions. ''' print(start) print("Cove or Salty Splat?") user_input = input() if user_input == "Cove": print("You decide to go to ...
083ca547819242edebae84caeb9147504a7c4f5b
marmikc/programming-problems
/random-weighted-shuffle/NaiveSolution.py
1,163
3.890625
4
"""Randomly shuffle or sample a set of items with weights.""" import random class WeightedShuffler: def __init__(self, items): self.all_items = [] self.total_weight = 0 for item, weight in items: self.total_weight += weight self.all_items.append((item, weight)) ...
1a24b748bd59e0308af9986e69452524bbf89f57
kaiyungtan/Immo_BeCode
/Clean_data/functions.py
3,424
4.3125
4
import pandas as pd df = pd.read_csv("nom_du_csv.csv") columns_names = {} for x in df.columns.tolist(): columns_names[df.columns.tolist().index(x)] = x # For now, each row can be clean, without listing them by ourself # In the future, we can make a dictionnary with only the sensible columns # so as not to have a t...
aa07caf3864e85f89cad0a4043603f3cbcd8e794
wp6530/studypython
/01python基础/列表生成器_生成器_迭代器/生成器的使用.py
815
3.9375
4
# -*- coding:utf-8 -*- # 进程>线程>协程 def task1(n): for i in range(n): print("正在搬第{}块砖!".format(i)) yield None def task2(n): for i in range(n): print("正在听第{}首歌!".format(i)) yield None # g1 = task1(5) # g2 = task2(10) # while True: # try: # # g1.__next__() # #...
57186d82d77c38b53802e75e4b1839d48a55819b
madhukishore123/devops-python-1
/python-scripts/functions.py
2,113
4.21875
4
#!/usr/bin/python print "***************function***************" def print_func( var1 ): #This prints a passed string into this function print var1 return # Calling print_func print_func("Testing function calling.") # Printing & Calling print_func print print_func("Testing function calling.") # Storing print_func re...
6c3fb402bdbcaebedfb9650274315f0ebd056f02
xtanmaygarg/HackerRankSolutions
/Python/Regex & Parsing/Group(), Groups() & Groupdict().py
104
3.546875
4
import re S = input() X = re.findall(r'([a-zA-Z0-9])\1+', S) if X: print(X[0]) else: print(-1)
94047815d52f9e286fb099714409cc1eff9fc2f4
antrax1257/Curso-Basic-python
/4.-Eliminando_Elementos_de_1_Lista.py
728
4.375
4
#Removiendo Elementos de una lista #Creando una lista List=[1,2,3,4,5,6, 7,8,9,10,11,12] print("Lista Inicial") print(List) #Removiendo elementos de List #Hacemos uso del Metodo Remove() #Remove() elimina elementos de la lista List.remove(5) List.remove(6) print("\nLista depues de eliminar elemento...
b53372b3239941c0907851d687010bd2da9b7bfd
llallum/Project-Euler
/Multiples of 3 and 5.py
422
4.1875
4
""" 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. """ var = 0 temp = 0 while var < 1000: var+=1 if var%3 == 0: temp += var ...
a112409b4943604b79433b840993d8e080f89879
jversoza/p4a-spring-16-examples
/p4a-class25/scores.py
4,888
4.125
4
""" data set will look like this [[23], [56] ... ] <--- size going to be length of data set when we first calculate the centroids [[23], [56]...] <--- size is going to be k clusters will look like each sub list is a cluster each element in cluster... is the original index of the actual data point [[1, 2, 8], [9, 10, ...