blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
bbd26c32ec4a10fc6d4d480461ef6bee10529e21
alexkryu4kov/DreamJob
/src/app/models/profile/unknown/find_course.py
185
3.578125
4
def find_course(courses: list, skill: str) -> list: return [{ 'url': course['url'], 'name': course['name'], } for course in courses if course['skill'] == skill]
a516efeb3427e86be2c8bf8d3920b638e4324349
Lusarom/progAvanzada
/ejercicio14.py
224
3.9375
4
inchft = 12 cmin = 2.54 altura = float(input('Inserta tu altura:')) feet = int(input('Numero en ft:')) inch = int(input('Numero en inch:')) cm = (feet * inchft + inch) * cmin print('Tu altura en centimetros es:', cm)
60320d5057c442b10d5c2551d3b1cf8a834681f1
AlexandraFil/Geekbrains_2.0
/python_alg/lesson_1/lesson_1_4.py
684
4.09375
4
'''4. Пользователь вводит две буквы. Определить, на каких местах алфавита они стоят, и сколько между ними находится букв.''' character_1 = input('Введите букву: ') character_2 = input('Введите вторую букву: ') ord_1 = ord(character_1.lower()) - 96 ord_2 = ord(character_2.lower()) - 96 if ord_1 != ord_2: between ...
10b81c13ef5e7440f94d7cbf22b005e663ae76a3
AnneNamuli/python-code-snippets
/my_sum.py
137
4
4
def my_sum(x, y): return x + y x = input("Enter number: ") y = input("Enter number: ") print "The sum of X and y is %d" % my_sum(x, y)
9285d41d2d21168a974b9c0db0d2304e28d2b936
seanlopez/python-new-test
/第三周/源码/names.py
1,099
3.796875
4
__author__ = "Alex Li" import copy #names = "ZhangYang Guyun Xiangpeng XuLiangChen" '''names = ["4ZhangYang", "#!Guyun","xXiangPeng",["alex","jack"],"ChenRonghua","XuLiangchen"] print(names[0:-1:2]) print(names[::2]) print(names[:]) #range(1,10,2) for i in names: print(i) name2 = copy.deepcopy(names...
29899f8444c9b71edcf29370204923af672e548f
WestComputing/PyProblemsJS
/patterns/sort.py
1,172
3.8125
4
import random m = int(input("How many numbers? ")) + 1 reference_numbers = [] for n in range(1, m): reference_numbers.append(n) random.shuffle(reference_numbers) numbers = reference_numbers[:] print(numbers, end=3 * "\n") length = len(numbers) width = len(str(m)) for i in range(length // 2): j = length - i -...
bd5bd6bf77ba51db2e9df5ef1585b64f878dc3a1
nekapoor7/Python-and-Django
/Python/ListPrograms/Smallest.py
181
3.890625
4
"""Write a Python program to get the smallest number from a list.""" list1 = list(input().split()) print(list1) small = min(int(x) for x in list1 if x == min(list1)) print(small)
194dab1e9eb08c13ff1c139d9ff4a9eefa590300
dancollins/rosalind
/protein.py
1,939
3.5
4
''' The 20 commonly occurring amino acids are abbreviated by using 20 letters from the English alphabet (all letters except for B, J, O, U, X, and Z). Protein strings are constructed from these 20 symbols. Henceforth, the term genetic string will incorporate protein strings along with DNA strings and RNA strings. The ...
db925f0d734a86aca445d1159d7ffd1d9f85e751
mehulchopradev/keyur-python
/com/xyz/college/college_user.py
679
3.640625
4
# Super class / Parent class / Base class # every class in python implicilty inherits from a built in class in python called as `object` class CollegeUser(object): def __init__(self, name, gender): # self - Student object, Professor object, any sub class object reference self.name = name ...
3f221208cedd69d82c8e0774ac14d60b7a994820
enrib82/Pr-ctica-5.-Ejercicios-while-y-listas.-
/ej. 8-5.py
770
4.25
4
# -*- coding: cp1252 -*- """Enrique Ibáñez Orero - 1º DAW - Practica 5 - Ejercicio 8 - Pràctica 5. Escribe un programa que te pida primero un número y luego te pida números hasta que la suma de los números introducidos coincida con el número inicial. El programa termina escribiendo la lista de números.""" print 'E...
b9ec358e81fe19566ceffbcededa720f34afad37
jonatanjmissora/SQLITE3_PERSONAS
/database.py
2,258
3.765625
4
import sqlite3 # crear una tabla def crear_tabla(): conn = sqlite3.connect("personas.db") c = conn.cursor() c.execute("""CREATE TABLE listado ( nombre text, apellido text, edad text) """) conn.commit() conn.close() def insert_one(nombre, apellido, edad): conn = sqlite3.connect("personas.db") c...
0a943c0695ead713ae4af9a6837b78ad04a3af69
KeranSiva/100-days-of-code
/Chapter-08-Files/os_code.py
832
3.5625
4
import os import shelve # Wrangling with path os.path.join() # Joins String into system Path os.getcwd() # Current Working Directory os.chdir(path="") # Change folder to path os.makedirs() # Create new folders os.path.abspath('.') # Return absolute path os.path.basename() # Returns filename os.path.dirname() #Return...
58ba8d8523f5313235cb99b770d1cdb8b371d204
AdamZhouSE/pythonHomework
/Code/CodeRecords/2897/60643/267678.py
526
3.5
4
words=input() digits=[] for word in words: init=int(0)#规范每个都是32的长度 for i in range(len(word)): alp=word[i] temp=1<<(ord(alp)-ord('a'))#1左移相应位数 ord是char转成ASCII数字:97 chr是将ASCII转成char :a init=init|temp#做或运算 digits.append(init) maxLen=0 for i in range(len(words)-1): for j in range(...
b7174cd98ca095b5454f7b726eb27467f9fd521f
chjfth/pyutils
/pycode/cheese/incremental_rsync/fwrite_random.py
594
3.59375
4
#!/usr/bin/env python3 # coding: utf-8 import os, sys import random def fwrite_random(filepath, offset, len): """Write random content to filepath, at offset, len bytes.""" fh = None if os.path.isfile(filepath): fh = open(filepath, "rb+") else: fh = open(filepath, "wb") buf = bytearray(len) for i in range(...
16038f4f1485c216cd8e967db3769a513e04dd45
janenicholson1/Python
/escape1.py
148
3.84375
4
No1 = input ("Please enter first no: ") No2 = input ("Please enter second no: ") No3 = int (No1)+int(No2) print ("%s + %s = %d" %(No1,No2,No3))
6996b452bfa960e051217c71d59d9f9fa5058300
Mosesvalei/Password-Locker
/userdata_test.py
2,568
3.765625
4
from userdata import UserData import unittest,pyperclip class TestUserData(unittest.TestCase): ''' This is a test class that tests cases for creating and authenticating user data ''' def setUp(self): ''' Function to set initial variables for testing ''' self.new_userdat...
48f5a38f4a662fba819406efa9c93317431a0bd2
Andr-Malcev/SP
/Lab 3/3.1 Средний уровень.py
160
3.65625
4
import math k = int(input('K: ')) Y = 0 for n in range(1, k+1): Y = Y + ((-1)**(2*n))*((n**2-9)**2)/math.factorial(3*n) print('Сумма: ', Y)
610686f94709b21e8813a38b08739039f566eecf
UriSeadia/Euler-Project
/src/036_double_base_palindromes.py
841
3.78125
4
# The decimal number, 585 = 1001001001 (binary), is palindromic in both bases. # # Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2. # # (Please note that the palindromic number, in either base, may not include leading zeros.) import time def is_palindrome(number_as_str...
c625fe8d9dbb26452325ae750b7319529ff15486
agni-c/ds-algo-works
/leetcode/group_anagrams.py
464
3.59375
4
class Solution: def sortString(self,str): return ''.join(sorted(str)) def groupAnagrams(self, strs: List[str]) -> List[List[str]]: dict = {} res=[] for str in strs: ss = self.sortString(str) if ss in dict: dict[ss].a...
4ed601b3604793534d97909e391218fa3cfad231
raghav94603/265151_learnings
/dictionaryUnsolved02.py
153
3.734375
4
user_list =list(map(int, input().split())) nested_dict = current = {} for i in user_list: current[i] = {} current = current[i] print(nested_dict)
92102b82c32a216a971622d3dafb8b56a36cb7c3
xiaojiang990209/leetcode
/solved/863_saw_answer.py
1,336
3.734375
4
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def distanceK(self, root, target, K): """ :type root: TreeNode :type target: TreeNode :type K: int ...
e0040825128763b60f4ebabfe00601f52f418d3a
marcinszymura/python_kurs
/homework/classes/zad_extra.py
2,250
3.875
4
# Przykład # użycia: # >> > przytnij( # data=[1, 2, 3, 4, 5, 6, 7], # start=lambda x: x > 3, # stop=lambda x: x == 6, # ) # # [4, 5, 6] def przytnij(data: list, start: str, stop: str) -> list: """ Funkcja do przycinania listy :param data: lista :param start: poczatek listy :param stop: ...
7ac57c1a0e6baa7ff4f2f1548bc750c2bfa1c38f
liuwq168/entity_embeddings_categorical
/entity_embeddings/util/preprocessing_utils.py
2,226
4.15625
4
from typing import List, Tuple import numpy as np import pandas as pd from sklearn import preprocessing from sklearn.preprocessing import LabelEncoder def series_to_list(series: pd.Series) -> List: """ This method is used to convert a given pd.Series object into a list :param series: the list to be conve...
9d9dad095529054ba235a88cfd89de9555ba88f6
marcuslind90/python-challenges
/ctci/16-8.py
1,811
3.828125
4
class Solution(object): small = ["Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"] teens = ["", "", "Twenty", "Thirty", "Fourty", "Fi...
c4c3906ec9f6bb3f399ca9581e91c59795718500
Ayyanchira/DMV_NC
/Question.py
1,020
3.953125
4
# -*- coding: utf-8 -*- """ Created on Tue Nov 20 14:34:09 2018 @author: monic """ class Question: def __init__(self, question, answer1, answer2, answer3, answer4, correct_answer): self.question = question self.answer1 = answer1 self.answer2 = answer2 self.answer3...
03a845d78054e766e122e783f18edac59351246f
ProgramaTICas/Comunidad-Ada
/Tema POO/MainGeneral.py
677
3.734375
4
from Estudiante import * from Curso import * #Estudiantes Estudiante1 = Estudiante("Crisly", 22,"2013") Estudiante2 = Estudiante("Nathalie", 17,"2015") Estudiante3 = Estudiante("Kembly", 20,"2016") Estudiante4 = Estudiante("Laura", 28,"2017") Estudiante5 = Estudiante("Carolina", 10,"2018") print(Estudiante1.getNombre...
d0e8e7e7bd289b17476dc47844595fc96a810670
benjaminwwong/elementary-combinarotics
/Mandelbrot.py
236
3.734375
4
def Mandelbrot(): c = complex(float(input("Re:")),float(input("Im:"))) li = [] z = complex(0,0) while abs(z) < 2: z = z^2 + c if z in li: break li.append(z) print(z)
e2d6bde2669d4e2e1d8b9cb1074004600f919e19
joaopmo/TP2-ALGII
/src/chr_tsp.py
2,274
3.546875
4
import numpy as np import networkx as nx from networkx.algorithms.matching import max_weight_matching from networkx.algorithms.euler import eulerian_circuit # Esta função aparece na documentação do Networkx mas não funcionou na minha versão. # Por isso simplesmente copiei a implementação da fonte: # https://networkx....
74cfddcd6c2707e3d554b7e21dd2234f8cfaab41
zizouvb/codewars
/6kyu/directions_reduction.py
485
3.515625
4
def dirReduc(arr): i=0 while i<len(arr)-1: if (arr[i]=="NORTH" and arr[i+1]=="SOUTH"): del arr[i-1:i+1] i=0 elif arr[i]=="SOUTH" and arr[i+1]=="NORTH": del arr[i-1:i+1] i=0 elif arr[i]=="WEST" and arr[i+1]=="EAST": del arr[i-1:i...
5afaffbdbc16dfb3b2147c3af480f4ae5dd4bd44
hansewetz/gitrep2
/src/python/tests/add_del_str_repr/test1.py
512
4.0625
4
#!/usr/bin/env python # test class class Person: def __init__(self, fname, lname): self._fname = fname self._lname = lname def __str__(self): return 'fname: ' + self._fname + ', lname: ' + self._lname def __repr__(self): return repr((self._fname, self._lname)) def _...
0b9bb442bc389f15a345676a93ef9011008b4300
HighHopes/codewars
/6kyu/Find the missing term in an Arithmetic Progression.py
1,037
4.25
4
"""An Arithmetic Progression is defined as one in which there is a constant difference between the consecutive terms of a given series of numbers. You are provided with consecutive elements of an Arithmetic Progression. There is however one hitch: exactly one term from the original series is missing from the set of num...
a9a4caf86458c65669d46b741ba4970ed112a613
DeveloperJoseph/PYTHON---DE---0---10000
/Modulo 1/ejercicio12.py
3,944
4.46875
4
#PYTHON CONDITIONS AND IF STATEMENTS #Supports the usual logical conditiions from mathematics: # Equals: a==b # Not Equals: a!=b # Less than: a<b # Less than or equal to: a<=b # Greater than: a>b # Greater than or equal to: a>=b #These conditios can be used in several ways, mos commonly in "if statements" and loops, #A...
d3217a7cc89e29c4ee1cdd4a7f6e8e48eb7d917c
flametest/leetcode
/merge_sorted_array.py
1,382
3.921875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2017-10-06 10:16:09 # @Author : Jun Jiang (flametest@gmail.com) # @Link : http://example.org # @Version : $Id$ class Solution(object): def merge(self, nums1, m, nums2, n): """ :type nums1: List[int] :type m: int :type n...
24bbe6af2a0161825ce0e2e2c6e6d8129d1e89d7
cmccandless/stunning-pancake
/0/2/6.py
804
3.578125
4
#!/usr/bin/env python # https://projecteuler.net/problem=26 import unittest def sieve(limit=10000): not_prime = set() for x in range(2, limit): if x in not_prime: continue yield x not_prime.update(range(x + x, limit, x)) def mult_order(n): x = 10 k...
9725d7165436c2f58156a7d4a812a604577de254
Qu3d45/ZeroToMasterPython
/Advent_of_Code/day1_ex2.py
2,796
4.28125
4
# --- Day 1: The Tyranny of the Rocket Equation --- PART 2 # Fuel itself requires fuel just like a module - take its mass, divide by three, # round down, and subtract 2. However, that fuel also requires fuel, and that # fuel requires fuel, and so on. Any mass that would require negative fuel should # instead be treat...
6772c89c166a3ca70077a1537a2862d679d90227
viniielopes/uri
/iniciante/1164.py
335
3.6875
4
qtd = int(input()) for i in range(qtd): n = int(input()) valor = 0 for j in range(n): valor += j if valor == n: print("{} eh perfeito".format(n)) break elif valor > n: print("{} nao eh perfeito".format(n)) valor = n break if valor != n: print("{} nao eh perfei...
0b87f654fc99f7513e8ebb73bb02d65bad0cd8df
avinash-rath/pythonlab
/facprime.py
282
4.03125
4
nu = int(input('enter the number: ')) i=1 k=0 print('the factors are') while i<=nu: if nu%i==0: print(i) k=k+1 i=i+1 print('the number of factors are ',k) if k==2: print('the number is a prime number') else: print('the number is not a prime number')
773908b47bfe0590d18f79bfe3e0a3c60510982a
songyingxin/python-algorithm
/回溯法/leetcode/leetcode_22_parenthesesGenerates.py
1,432
3.8125
4
class Solution: def generateParenthesis(self, n): result = [] item = [] left_num = 0 right_num = 0 self.back_track(n*2, item, left_num, right_num, result) return result def back_track(self, n, item, left_num, right_num, result): """ left_n...
85a26045a4935e2f21754e65d8a954ffd2dddf49
msps9341012/leetcode
/linkedlist/reorderList.py
1,459
3.921875
4
from linkedlist import SingleLinkedList,ListNode ''' def reorderList(head): if head==None: return None length=0 node=head while node.next: node=node.next length=length+1 fast=head slow=head dummy=ListNode(0) node=dummy while length>0: for i in ran...
8cb6d0552df6cbd44d7462aa9a0fdc5b91f90474
denny61302/100_Days_of_Code
/Day19 Racing Game/main.py
1,371
4.1875
4
from turtle import Turtle, Screen import random colors = ["red", "yellow", "green", "blue", "black", "purple"] turtles = [] for _ in range(6): new_turtle = Turtle(shape="turtle") turtles.append(new_turtle) is_race_on = False screen = Screen() screen.setup(width=500, height=400) user_bet = screen.textinput(ti...
6ddf9fda36be46b2b7ed586b4c86e25991da7263
BolotZhusupekov07/sorting_algorithms_visualized
/test.py
4,929
4.21875
4
import unittest import random def bubble_sort(arr): if len(arr) == 1: return swapped = True while swapped: swapped = False for i in range(len(arr) - 1): if arr[i] > arr[i + 1]: arr[i], arr[i + 1] = arr[i + 1], arr[i] swapped = True def ...
445c2ba495aa233a2f51c4eecfd4c24e4530f8ee
Teldrin89/DBPythonTut
/LtP16_re_part2.py
908
4.375
4
import re # to match zero or one specific string use re.compile function and # and a "+" with additional string to be matched and "?" that # will be used to find either 0 or 1 of the specified additional # string # create a random string randStr = "cat cats" # use re.compile function to set a criteria to match both wo...
8b61395ec01da85c353f99895a5bcaca02ac0746
vromanuk/algorithms-and-ds
/Recursion/reverse.py
296
3.984375
4
def reverse(string: str) -> str: if string: return reverse(string[1:]) + string[0] else: return string if __name__ == '__main__': assert reverse('kayak') == 'kayak' assert reverse('l') == 'l' assert reverse('follow') == 'wollof' assert reverse('') == ''
03be2797f975e6575c39185079494d6b29f0f754
rakibsarwer/Python-Problem-Solving-Shubin-s-Book-First-part1
/posNeg.py
147
4.0625
4
num = input("Enter Your Number :") numb = int(num) if(numb>=0): print(numb, " is Positive Number") else: print(numb," is negetive Number")
92ba36c3d647c9481493b9a8fa7a804cb225fab2
okellogabrielinnocent/data_structure_gab
/reverse_array.py
860
4.5
4
# program to reverse an array or string # method 1 # 1) Initialize start and end indexes as start = 0, end = n-1 # 2) In a loop, swap arr[start] with arr[end] and change start and end as follows : # start = start + 1, end = end - 1 def reverse_list(arr, start, end): while start < end: arr[start], arr[end] = ar...
c39a26b1ccfb8028fdd176eb070dfbcc09f2bfa6
akashghanate/OpenCV
/Basics/drawImageShapes.py
1,077
3.765625
4
import cv2 import numpy as np #create a black image image=np.zeros((512,512,3),np.uint8) #draw a diagonal line blue and thickness 5 pixel cv2.line(image,(0,0),(511,511),(255,0,0),5) cv2.imshow("Line",image) #draw rectangle # if you put thickness as -1 it fills the rectangle image=np.zeros((512,512,3),np.uint8) cv2...
96baae166cab4dea3ae1556a6148285f47f37015
Allen-Maharjan/CHATBOT
/answer.py
2,097
3.546875
4
def answer(*args): question = args[0] name = args[1] program = '' answers = open('Answers.txt','r') line = answers.readlines() if (name == 'ss' or (name == 'co' or program == 'cm') ): if(question=='who'): return(line[4]) elif(question == 'where'): return(line[5]) elif(question == 'how'): ...
d94c8758afe17ebc63efe16ad989cc9c5d4b0578
eric496/leetcode.py
/linked_list/147.insertion_sort_list.py
2,440
3.984375
4
""" Sort a linked list using insertion sort. Algorithm of Insertion Sort: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. At each iteration, insertion sort removes one element from the input data, finds the location it belongs within the sorted list, and inserts ...
896d79610d503e7511604a83f2762910aeca4290
jesuisundev/leet-code-fun
/easy/67-add-binary/solution.py
685
4.125
4
class Solution(object): def addBinary(self, a, b): """ - Convert a and b into integers x and y, x will be used to keep an answer, and y for the carry. - Carry non -zero - While carry is nonzero: y != 0: - Current answer without carry is XOR of x and y: answer = x^y. -...
b64e7b00c319081154b8031ad721a738ed5370d8
Stoggles/AdventofCode
/2015/day12.py
568
3.5625
4
import json def decode_elements(element, ignore_red=False): global total if isinstance(element, list): for item in element: decode_elements(item, ignore_red) if isinstance(element, dict): if ignore_red and "red" in element.values(): return for key in element.keys(): decode_elements(element[key], ign...
dc95ecd1b7d1e802f2509ce612ce607e997e38da
PoonamGhutukade/Machine-learning
/Week4/Pandas/panda_series.py
3,587
3.5
4
import pandas as pd import re from Week4.Utility.Util import UtilClass class PandaSeries: def __init__(self): self.obj1 = UtilClass() def calling(self): while True: try: print() print("1. Create and display a one-dimensional array using Pandas modul...
c46cde35a9fc6e67b6fc341ba7f1c33c685b8caf
ElKroko/progra-usm-exes
/Certamen 1/EA_2_banco.py
1,503
4.03125
4
# hacer un programa que simule el proceso de evaluacion crediticia de un banco # se debe validar que la edad minima de la persona es 18 anos, que sus ingresos son mayores a sus egresos, # y que al final del mes la persona pueda pagar la cuota de su prestamo. # La cuota esta definida como el monto pedido entre el num...
0812c0ae86f6fb8dc5547661c9e76c8c3e874591
LordOfTheThunder/Coding
/Companies/Google/findShortestPath/findShortestPath.py
2,637
4.46875
4
# Company: Google # Question: You are given an M by N matrix consisting of booleans that represents a board. Each True boolean represents a wall. Each False boolean represents a tile you can walk on. # # Given this matrix, a start coordinate, and an end coordinate, return the minimum number of steps required to reach t...
2b84e8438831e873eccb54531f71c97c5484ff0e
ksopyla/Matplotlib_examples
/2.Plot_features/2.1_Colors_and_lines.py
595
4.03125
4
# 2.1 Changing colors and line widths # import necessary libraries import matplotlib.pyplot as pl import numpy as np n = 256 X = np.linspace(-np.pi, np.pi, n, endpoint=True) C, S = np.cos(X), np.sin(X) # create a new figure with dimensions 10x8 inches, set dpi to 80 pl.figure(figsize=(10, 8), dpi=80) # plot cosine...
89012147a797696ed86a7dcc8247f4e8c72a26ba
AlexandruGG/CS50x-Problem-Sets
/Problem Set 6/bleep/bleep.py
1,459
3.890625
4
from cs50 import get_string from sys import argv def main(): # If the user doesn't provide exactly one argument, print usage and exit while len(argv) != 2: print("Usage: python bleep.py dictionary") exit(1) # Get the list of banned words from the dictionary provided ...
688be7192a98c96a6351ecbe6c467676c9921a00
KushRawat/CN-DSA-Python
/Practice_1/LLt_swapTwoNodes.py
1,895
3.53125
4
from sys import stdin #Following is the Node class already written for the Linked List class Node : def __init__(self, data) : self.data = data self.next = None # def swapNodes(head, i, j) : def swapNodes(head, i, j): if i == j: return head currNode = head prev = None f...
c423aaa0024c802bb69b9b9b54588909adb34a3a
bksaini078/DynamicProgramming
/HackerRank/shape_classes_area.py
1,092
4.28125
4
'''Problem Description The program takes the radius from the user and finds the area of the circle using classes. Problem Solution 1. Take the value of radius from the user. 2. Create a class and using a constructor initialise values of that class. 3. Create a method called as area which returns the area of the class a...
98b0c8e2fcf48de999230700efff5f78f4daef19
navnath-auti/College
/Sem4/Python'/exp8/Minheritance.py
438
3.953125
4
class Father: fathername = "" def show_father(self): print(self.fathername) class Mother: mothername = "" def show_mother(self): print(self.mothername) class Son(Father, Mother): def show_parent(self): print("Father :", self.fathername) print("Mother :", s...
5b8ae5c0e9c4b7f86561645ea0bde42f26034702
DVDBZN/Schoolwork
/CS136 Database Programming With SQL/PythonPrograms/Midterm/Midterm Program.py
2,932
4.125
4
#Define the function that processes the budget def processBudget(incomes, expenses): totalIncome = sum(incomes) totalExpenses = sum(expenses) #Difference is income minue expenses #If expenses are greater, the difference will be negative difference = totalIncome - totalExpenses #Print out total...
8aba28dfeb8d1532b54ba3bc10fb284535af2372
spaulen/IntroToProg-Python
/HomeInventory.py
4,448
3.890625
4
# ------------------------------------------------------------------------ # # Title: Assignment 05 # Description: Working with Dictionaries and Files # When the program starts, load each "row" of data # in "ToDoToDoList.txt" into a python Dictionary. # Add each dictionary "...
43abc5454962902e38547c9f93e248dc30e2d11c
bgoonz/UsefulResourceRepo2.0
/MY_REPOS/PYTHON_PRAC/projecteuler/euler035.py
1,006
3.796875
4
#!/usr/bin/env python """ Solution to Project Euler Problem 35 http://projecteuler.net/ by Apalala <apalala@gmail.com> (cc) Attribution-ShareAlike http://creativecommons.org/licenses/by-sa/3.0/ The number, 197, is called a circular prime because all digit_rotations of the digits: 197, 971, and 719, are themselves pr...
fabb52ae22af327e9874223e5861cd6e58b423a8
virenkhandal/internpursuit-ml
/round1.py
3,906
3.578125
4
from os import major import pandas as pd def round1_filter(students, employer): filtered = students drop = set() """ Majors/Minors filter """ employer_majors = employer['Majors/Minors'].values[0].split(';') # print(employer["Name"].values.tolist()[0], ": ", employer['Majors/Minors'].values...
2200de03b30819967b47fffa348e9290ec0f3b69
danting123/lab02
/number_list.py
1,210
4.09375
4
def find_reverse(numbers): #TODO: find the reverse of the list return numbers[::-1] def find_max(numbers): #TODO: find the maximum of the list return max(numbers) def find_min(numbers): #TODO: find the minimum of the list return min(numbers) def find_sum(numbers): #TODO: find...
f242f626659c959acafe60ccf056df4d588d45f4
EduardoFF/easy_cozmo
/easy_cozmo/line_detection_utils.py
10,286
3.578125
4
import numpy as np import cv2 import math import sys def auto_canny(image, sigma=0.33): # compute the median of the single channel pixel intensities v = np.median(image) # apply automatic Canny edge detection using the computed median lower = int(max(0, (1.0 - sigma) * v)) upper = int(min(255, (1.0 + sigma) * v...
c8d10c824ab7672a3d2eccfc17ebcd94e91a769c
ateitelbaum/PrecipitationCrimeCorrelation
/pdfPlot.py
1,304
3.828125
4
#creates a double bar graph of average weekly violent crime rate during dry weather and precipitation #!/usr/bin/env python3 import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import random import math import numpy as np fig, ax = plt.subplots() def plot(crimes, dryMeans, precipMeans): N = 8 ...
f8e557139f3219403131f735470fbf3cb1f69b0f
ahad-emu/python-code
/Coding/21_zip.py
303
4.5
4
mylist1 = [1, 2, 3] mylist2 = ['a', 'b', 'c'] #two list zip together list3 = list(zip(mylist1, mylist2)) print(list3) #print two list as a tuple for item in zip(mylist1, mylist2): print(item) #print one value of the tuple in zip function for item,value in zip(mylist1, mylist2): print(value)
1f85dea17ea5a1a35f736b0f88416cb90c51621e
nozma/the_self_taught_programmer_challenges
/ch06/prob05.py
193
3.75
4
# -*- coding:utf-8 -*- def main(): strlist = ["The", "fox", "jumped", "over", "the", "fence", "."] print(" ".join(strlist[:-1]) + strlist[-1]) if __name__ == '__main__': main()
8580e8f1871ba117604ad11f891dc112276bd22d
AgentT30/InfyTq-Foundation_Courses
/Programming Funcamentals Using Python/Day 9/luhn_algorithm.py
994
3.84375
4
def validate_credit_card_number(card_number): # start writing your code here double = [] card_number = str(card_number) for i in range(0, len(card_number), 2): number_double = int(card_number[i]) * 2 if number_double > 9: number_double = str(number_double) double....
72befd201c3966b5467279235e23d534b258dabe
joaquim-fps/ufrj-alg-grafos-2017-2
/Lista 2/egipcio.py
900
4.1875
4
from fractions import Fraction def get_fraction(): while True: fraction = input().split('/') num = int(fraction[0]) den = int(fraction[1]) if den >= num: return Fraction(num,den) def format_fractions(fractions): formatted_fractions = [] for divisor i...
d46a2254a1ee57f8a15a59393c30160440503b8b
notagamer12/Python2020
/rectangles_07.py
2,717
3.90625
4
from points import Point class Rectangle: """Klasa reprezentująca prostokąty na płaszczyźnie.""" def __init__(self, x1, y1, x2, y2): # Chcemy, aby x1 < x2, y1 < y2. if x1 >= x2 or y1 >= y2: raise ValueError("prawidłowe współrzędne powinny spełniać warunek x1 < x2, y1 < y2...
199a597227b3c1d99aeb13f32ee9f0010384ea15
sunghyungi/pandas_study
/data_structor/df_apply_min_max.py
675
3.625
4
import seaborn as sns print("# titanic 데이터셋에서 age, fare 2개 열을 선택하여 데이터프레임 만들기") titanic = sns.load_dataset('titanic') df = titanic.loc[:, ['age', 'fare']] print(df.head()). print() # 사용자 함수 정의 def min_max(x): return x.max() - x.min() print("# 데이터프레임의 각 열을 인수로 전달하면 시리즈를 반환") result = df.apply(min_max) print(res...
b544a47378d2c15b62119c2cb5231417d71739e8
raunakpalit/myPythonLearning
/DataStructures/array_advance_game.py
673
4.125
4
# Array Advance Game # You are given an array of non-negative integers. For example: # [3, 3, 1, 0, 2, 0, 1] # Each number represents the maximum you can advance in the array. # Is it possible to advance from the start of the array to the last element? # Example of Unwinnable: [3, 2, 0, 0, 2, 0, 1] def array_advance(...
e3eeaef48c75541f8b39a62843862cea9864d7b3
JulietaCaro/Programacion-I
/Trabajo Practico 8/Conjuntos/Ejercicio 8.py
1,900
4.3125
4
# Definir un conjunto con números enteros entre 0 y 9. Luego solicitar valores al usuario y eliminarlos del conjunto mediante # el método remove, mostrando el contenido del conjunto luego de cada eliminación. Finalizar el proceso al ingresar -1. # Utilizar manejo de excepciones para evitar errores al intentar quitar ...
7dc63c84ccc58f3bf4bf239bf7a7ddb11165b31d
charlesfracchia/SDIP-Arduino
/demo2/send_time_to_arduino.py
3,312
3.765625
4
''' Receives OBMP data from Arduino and prints to the screen. Sends the current time to the Arduino to sync timestamps for OBMP. Instructions: 1) First run the Arduino code: e.g., OBMPduino_demo1_v2 2) Then run this script via python send_time_to_arduino.py 3) Follow the instructions printed to the terminal 4) O...
06d7e7b95f2c78c2f84dcafc0522f002229b0e5b
Mayuri0612/Data_Structures-Python
/Dynamic/uglyNum.py
1,067
4.1875
4
# ugly umber are those numbers which is inly divisible by 2,3 and 5 # Function to get the nth ugly number def getNthUglyNo(n): ugly = [0] * n # To store ugly numbers # 1 is the first ugly number ugly[0] = 1 # i2, i3, i5 will indicate indices for 2,3,5 respectively i2 = i3 =i5 = 0 ...
196db266b6a98c691175b8cb448961355e045245
jamesro/Project-Euler
/Problem09.py
588
4.3125
4
""" A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. """ def PythagoreanTriplet(product): for i in range(1,999): for j in rang...
0e5311b73b1dbc2e57263ddf3091fa5e00b1e75b
shander3377/virtual_Atm
/Atm.py
1,002
3.875
4
class atm(object): def __init__(self, cardnumber, pin): self.cardnumber = cardnumber self.pin = pin def checkBlance(self): print("You have 3lakh money in ur bank account") def withdraw(self, amount): newAmount = 300000-amount print("Your have withdr...
cf15c9c50c4b04850a4d9ea75fd36206e0862c45
devesh-bhushan/python-assignments
/assignment-5/Q-6 commonElements.py
615
3.96875
4
""" program to count the common elements in the string """ lst = list([]) element = int(input("enter the no of elements in the list 1 - ")) for i in range(element): data = eval(input("enter the data in the list 1 - ")) lst.append(data) lst2 = list([]) element2 = int(input("enter the no of elements in the list 2...
05a210942870fc404146d68b67ad0112e36f71fe
Denisss21/Denis.k
/concatenation.py
181
4.15625
4
print("Hi, today you are studying what's this concatenation") a = str(input("Enter the first word: ")) b = str(input("Enter the second word: ")) print("Result is: ") print(a+' '+b)
2ee2bf74517462d8f1af667ebe770b245212d910
Lgt2x/PPC-Projet
/market_simulation/server_utils/city.py
1,810
3.53125
4
""" City object, to simulate a bunch of houses consuming electricity """ from multiprocessing import Barrier from random import randint, random from colorama import Fore, Style, Back from .serverprocess import ServerProcess from .home import Home from .sharedvars import SharedVariables class City(ServerProcess): ...
8e9fdbdb19c30e506c62147408202d82f85fbcb3
sai-pher/Programming_Basics_in_Python
/resources/tool_kits/M3_Tool_Kit.py
2,445
4.28125
4
# TODO: Write Milestone 3 tool kit from typing import List, Tuple class Person: # Instance variable type annotations. # These do not define the variable, only provide a suggestion for what the type should be # to allow the developer to know how to work with the variable. # # This also allows us ...
d6394fbaeb6c067f56afc3ae057e0492dc76a9f5
mronowska/python_code_me
/zadania_na_zajeciach/zad8.py
297
3.921875
4
lista_for = [] lista_while = [] #for for i in range (0, 101): if i % 3 == 0 and i % 2 == 0: print(i) lista_for.append(i) #while i = 0 while i <= 100: if i % 2 == 0 and i % 3 == 0: print(i) lista_while.append(i) i += 1 print(lista_for == lista_while)
d5697a757422776a49ed4378692a3bac6c8c61fa
htmlfarmer/valua
/csv.py
823
3.625
4
# https://www.geeksforgeeks.org/xml-parsing-python/ import csv def saveFile(filename, url): # url of rss feed url = 'http://www.hindustantimes.com/rss/topnews/rssfeed.xml' # creating HTTP response object from given url resp = requests.get(url) # saving the xml file with open('topnewsfeed.xml...
c304be6542e39edc6b73ceb321135dfb4e9ccd94
swapnilshinde367/python-learning
/for_loop.py
727
4.1875
4
# pylint: skip-file # for loop, use of else in for loop arrstrName = 'Swapnil' for strLetter in arrstrName : print strLetter arrstrFruitNames = [ 'Mango', 'Apple', 'Guava', 'Jackfruit' ] for strFruitName in arrstrFruitNames : print strFruitName # For index arrstrFruitNames = [ 'Mango', 'Apple', 'Guava', 'Jackfru...
21eebb17417a82d13c51e2f744279daea1f76d32
lcacciagioni/hackerrank
/algorithms/warmup/diagonaldifference/diagonaldifference.py
664
3.78125
4
#!/usr/bin/env python3 # This script will try to solve the problem described in: # https://www.hackerrank.com/challenges/diagonal-difference def diag_diff(matrix, size): sum_first_diag = 0 sum_second_diag = 0 for i in range(size): for j in range(size): if i == j: sum_fir...
5d955bec5b68b472f4b4d4bc51509d1accd84877
RuslanaGural/python_labs
/Gural_Task_4-2.py
379
3.546875
4
#Створення прикладних програм на мові Python. Лабораторна робота № 4.2. Гураль Руслана. FI-9119 import math print('''' Створення прикладних програм на мові Python. Лабораторна робота №4.2 Гураль Руслана. FI-9119''') x = int(input('x = ')); y = int(math.log10(x) + 1); print('y = ', y);
fb3fff8c948adb2a63db1f0a6f53d4b852e25ab9
jjloftin/cs303e
/combos.py
233
3.65625
4
def subsets(a,b,lo): hi = len(a) if(lo == hi): print(b) return else: c = b[:] b.append(a[lo]) subsets(a,c, lo + 1) subsets(a,b, lo + 1) def main(): a = ['a', 'b', 'c'] b = [] subsets(a,b,0) main()
6118a5a6f4d4aac127cfd4883e553dc04ef68088
aasparks/cryptopals-py-rkt
/cryptopals-py/set1/c4.py
1,745
3.5
4
""" **Challenge 4** *Detect single-character XOR* One of the 60-character strings in this file has been encrypted by single-character XOR. Find it. """ import c1, c2, c3 import unittest DEBUG = False ## It'll be a little slow but I think the best approach ## here will be running challenge3 on all 60 lines. def dete...
ec0bc00a7411b98e8519df2ac816c19e93a2cab4
Sarthak-Singhania/Work
/Class 11/untitled8.py
247
3.640625
4
def search(l,n,x): for i in range (n): if l[i]==x: return i return -1 a=[2,3,10,40,4] l=sorted(a) x=10 n=len(l); result=search(l,n,x) if result==-1: print('Not found') else: print('Found',x,'at',result+1)
979b1f505a3dc5aba934e5cf5f7dbcbffd989025
adambjorgvins/pricelist
/flights.py
653
3.875
4
def check_grade(grades:int): grade = [] sum_of_grades = sum(grade) if sum_of_grades / len(grades) < 5: return False else: return True def read_line(line): name_grade = line.strip().split(" ") name = name_grade[0] grade = name_grade[1:] pass_fail = check_g...
b098997ee60f7fa1039fa9b66c2d34b17bb141dd
MarcBalle/MUSI
/AIV/Flujo_optico/Ejercicio3/main.py
4,991
3.515625
4
## EJERCICIO 3 - EYE TOY ## ## Marc Balle Sánchez ## ## Se desarrolla un programa que, empleando la cámara integrada en el ordenador, permite la interacción ## con una pelota flotante en la pantalla a través del movimiento corporal. ## Cada vez que la pelota sea golpeada, esta cambiará de color y se desplazará hacia...
aa6d64a031e1925a7bfeef2016bcd53b7fc94936
pflun/advancedAlgorithms
/rotateArray.py
426
3.96875
4
# multiple rotate: https://mnmunknown.gitbooks.io/algorithm-notes/content/522_string.html class Solution(object): def rotate(self, nums, k): second = nums[k:] second.extend(nums[:k]) return second def rotate2(self, nums, k): i = 0 while i < k: nums.append(nu...
5a20183c03a95bef104778255bf486dd6a42b14d
SeelamVenkataKiran/PythonTests
/Pandas/Test40p.py
3,124
4.03125
4
import pandas as pd import numpy as np #x = pd.read_csv("I:\\GitContent\\Datasets\\Bank_full.csv") #reading from web to create dataframe x = pd.read_csv('https://raw.githubusercontent.com/ajaykuma/Datasets/master/Bank_full.csv') df = pd.DataFrame(x) print(df.columns) print(x.values) df[df.age > 80] df[df.age > 80].educ...
d2089fc8cabdb12fad6bffd289f830c4c34e5f3e
python-for-humanists-penn/Python_for_Humanists_Working_Group
/2_19_2018/Florian_activity_for_2_19_2018.py
917
3.890625
4
# -*- coding: utf-8 -*- """ Created on Mon Feb 19 13:11:03 2018 @author: florian """ """ Activity - Using what we just learned, first, write a method that prints the first 500 characters from your text. Then, break those 500 characters into a list of lines. """ # solution: def first_500_char...
35a58f6da9a484ef52faf39ddcc92e4a86e92ef1
mythopoeic/Python
/Hacker Rank/namedtuple.py
265
3.890625
4
from collections import namedtuple N = int(raw_input()) Students = namedtuple('Students',raw_input()) mySum = 0 for i in range(N): grade = Students(*raw_input().strip().split()) mySum += int(grade.MARKS) average = mySum/float(N) print "%.2f" % average
ef310c2ca36c047cbbc8ce38850ed3395bf53a6b
gschen/sctu-ds-2020
/1906101019-贾佳/Day0529/lab01.py
1,872
4.0625
4
class Node(): #构造函数 def __init__(self,data): #定义属性 self.data = data self.next = None # n1 n2 n3 n = Node(-1) n1 = Node(1) print(n1.data) print(n1.next) n2 = Node(2) n3 = Node(3) #n1 -> n2 -> n3 n1.next = n2 n2.next = n3 print(n1.next.next.data) #单链表 #增加一个结点,删除一个结点,查找等操作/函数 ...
135792b96beaca673e3799c8c0fde6fbdd813833
Pypy233/python
/homework/static_end/1/problem.py
409
3.609375
4
class Solution(): def solve(self, A): return [i for i in A if self.prime(i)] #judge whether x is prime or not def prime(self, x): if x == 1 or x == 2 or x == 3: return True if x == 4: return False if x <= 0: return False for i in r...
3d7914c52eb9a1b6bc43f05cb34649b2c1ed6782
ati-ozgur/course-python
/2022/examples-in-class-2022-09-16/example_if_wrong2.py
203
3.671875
4
born_year = 2010 # indentation is mixed tabs and spaces are used together # it will not work if born_year > 1997: print("You have born in 1998 or greater") print("You have born in 1998 or greater")
bd154e75fb79591d69162290cb93aa372b402fdc
nvnavaneeth/3D-segmentation-visualizer
/utils.py
954
3.5
4
import numpy as np from matplotlib import pyplot as plt import nibabel COLORMAP = [(0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 0, 1)] def load_img(file_path): """ Reads a nifty image volume and returns it as a numpy array. Output dimensions: [depth, y, x] """ img = nibabel.load(file_path).get_data() ...
e2ac2c818ac4a7e03d31326c119fe1c279f51ab2
neilaronson/fraud_detection_case_study
/data_cleaning_with_os.py
6,249
3.5625
4
import pandas as pd import numpy as np from sklearn.preprocessing import scale from sklearn.model_selection import train_test_split from itertools import izip class DataCleaning(object): """An object to clean and wrangle data into format for a model""" def __init__(self, filepath, training=True): """R...