blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
10c40e8613f5bbbbe80ddf3eab957a17b9e3d8bd
enerhy/Regression
/My_multiple_linear_regression_BE_adjR.py
3,727
3.921875
4
# Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('50_Startups.csv') X = dataset.iloc[:, :-1].values y = dataset.iloc[:, 4].values # Encoding categorical data # Encoding the Independent Variable from sklearn.prepro...
c53c0bc56ae90307031538bc8aa859b82abcb049
user160244980349/sde-math
/mathematics/sde/nonlinear/symbolic/g.py
992
3.515625
4
from sympy import Add, sympify, Number, diff from mathematics.sde.nonlinear.symbolic.operator import Operator class G(Operator): """ Performs G operation on function """ nargs = 3 _dict = dict() def __new__(cls, *args, **kwargs): """ Creates new G object with given args ...
5733d279e393704e2b0a23a4ef0d0bacd30c8ed6
gustavo-mota/PuzzlesIA
/SlidingPieces/queue.py
867
3.8125
4
import copy # fila class Queue: def __init__(self): self.__queue = [] def __len__(self): return len(self.__queue) def is_empty(self): if (len(self.__queue) == 0): return 0 return 1 def __add__(self, Noh): self.__queue.append(Noh) # elimina e...
66b6d73c24d3f9ad7633fef6dc0ca8e6bda4c6ff
DebadityaShome/Coders-Paradise
/Python/Level 0/maxinList.py
481
4.4375
4
''' Create a findMaximum function that receives a list as a parameter and returns the maximum value in the list. As you iterate over the list, you may want to keep track of the current maximum value in order to keep comparing it with the next elements of the list. Input : A list Output : Maximum number in the list ...
7e9bb938e2ba7dd54d89ea659d55abecd16306a3
DebadityaShome/Coders-Paradise
/Python/Level 0/GCD.py
299
4.03125
4
""" Write a findGCD function that takes in two numbers as input a and b and finds the greatest common divisor of the two. Input # Two numbers Output # GCD of numbers Sample Input # a = 8, b = 12 Sample Output # 4 """ import math def findGCD(a, b): return math.gcd(a,b) print(findGCD(20,30))
425047df6352162424ba774c093c7bbdf2f0bad8
lukesmith96/TileDriver
/TileDriver/TileDriver.py
6,639
3.953125
4
from random import randint # # Dir [0:UP 1:DOWN 2:LEFT 3:RIGHT] # @author: Luke Smith # # State class holds an instance of the game # with a specific tile state, this is used when # trying to discover the most efficient path class State: # @param # tiles : matrix of integers representing the board # path : S...
7ac056d2c0fc474703861bddb359fce320bf2473
t1123/hangman
/hangman.py
1,242
3.8125
4
def hangman(word): wrong = 0 stages = ["", "______ ", "| ", "| | ", "| 0 ", "| /|\ ", "| / \ ", "| " ] rletter = list(word) board = ["_"] * l...
47fb517b85282e463afa2bca3ea7d11087ff1cd7
pcurry/Math-toys
/python/roman_numerals.py
5,967
4.34375
4
#!/usr/bin/env python2.7 """ Write a method that converts its argument from integer to roman numeral if a numeric value is passed, or from roman numeral to an integer if a roman numeral is passed. Your solution should rely on the parameter's class to determine its type and if a non-roman numeral character is passed (...
cce4430ef082a11860afe6ee5e08fd28da0f9908
voyagerdva/Algorithms
/Lection_7_rapid_exponentiation.py
347
4.0625
4
"""" Fast exponentiation """"" def expon(a: float, n: int): if n == 0: return 1 else: return expon(a, n - 1) * a print(expon(3, 5)) def exponBin(a, n): if n==0: return 1 elif n%2 == 1: return exponBin(a, n-1) * a else: return exponBin(a**2, n//2)...
b82403f9d7c2027d3fa679215596adafe8c551f7
voyagerdva/Algorithms
/MergeSort/mergeSort.py
506
3.953125
4
from merge import merge as mrg def splitIntoTwoSortedList(originalList): left = originalList[:len(originalList) // 2] firstList = mergeSort(left) right = originalList[len(originalList) // 2:] secondList = mergeSort(right) return (firstList, secondList) def mergeSort(originalList): if len(or...
b69ccee563c90101fc411ea7868e442bafc075a2
voyagerdva/Algorithms
/Lection_8_generate_permutations.py
863
3.8125
4
def finds(number, A): """ Ищет number в A и возвращает True - если такой есть, False - если такого нет. """"" for xx in A: if number == xx: return True return False def generate_permutations(N:int, M:int=-1, prefix=None): """ Генерация всех перестаново...
1ac5988cf9b2965be1faa381b40bdaf37debd547
Pigot12/smallproject
/2020.py
168
3.796875
4
day = int(input("Πόσες μέρες μας μένουν για να τελειώσει το 2020; ")) if(day = 5): print ("Σωστό") else: print ("Λάθος")
58663a5735a0272b8e9c35664d2e62470842188b
amile/sql
/venicles.py
344
3.578125
4
import sqlite3 import csv conn = sqlite3.connect("cars.db") cursor = conn.cursor() venicles = csv.reader(open("venicles.csv", "rU")) cursor.executemany("insert into inventory values(?, ?, ?)", venicles) conn.commit() cursor.execute("select * from inventory") rows = cursor.fetchall() for r in rows: print r[0], ...
39d49374fa5c82c1aad8bf535e853849b321e0a4
cdngnoob/playground
/python/4.1.2/aufgabe412.py
616
3.90625
4
try: firstNumber = input('Erste Zahl: ') firstNumber = int(firstNumber) kindOf = input('Rechenart: ') secondNumber = input('Zweite Zahl: ') secondNumber = int(secondNumber) if kindOf == '+': result = firstNumber + secondNumber elif kindOf == '-': result = firstNumber - secondNumber elif kindOf == '/':...
2eaa655f8b4f188ffffb16a3c2b8144ef15c37cc
cdngnoob/playground
/python/4.3.3/aufgabe433.py
277
3.5
4
from turtle import * register_shape('ship',((0,10),(5,0),(15,0),(20,10))) t = Turtle() t.shape('ship') t.color('blue') #for i in range(361): # t.forward(1) # t.setheading(i) t = Turtle() t.shape('ship') t.color('blue') for i in range(0,360,18): t.forward(20) t.left(18)
52f9d7a7b4a8d84ffbee8b14db58f9693dedafd3
sucharita05/python_mini_orojects
/Tip_Calculator/main.py
405
4.34375
4
print("Welcome to tip calculator!") bill = float(input("What was the total bill?₹ ")) tip = int(input("How much tip would you like to give? 10, 12, or 15? ")) person = int(input("How many people to split the bill? ")) tip_percent = (tip)/100 total_bill = (bill * tip_percent) + bill avg_bill = total_bill / person final...
9e96ab4aa96d030876de7d37ec911913b4f1b4cc
ashehta700/PythonTutorial
/Day3/writeFile.py
330
3.703125
4
# Writring to files using write function fileObj= open('testfile.txt', 'w') fileObj.write('I am writing using write function') #seek fileObj.seek(50) fileObj.write('I am written using seek') fileObj.close() #append fileObj= open('testfile.txt', 'a') fileObj.write('\n I am appending to the file') ...
6ac42b8467f483306ae1d33f032b16c9170f8e43
ashehta700/PythonTutorial
/Day3/reLibrary.py
674
4.3125
4
# Module Regular Expressions(RE) specifies a set of strings(pattern) # that matches it. import re p = re.compile('[a-j]') #this creates a regular expression that contains letters from a to e tst="welcome to iti, Python Day3, RE module" #findAll will return with a list of the founded letters within the patte...
9c6774b4a3fa51fabaa1bc482bf623e9d51b8ca5
jpmcb/interview-problems
/ctci/2_7.py
958
3.71875
4
# Intersection def intersect(llist1, llist2): # Check that their tails are at least the same if llist1.tail != llist2.tail: return False # get the shorter of the two shorter = llist1 if len(llist1) < len(llist2) else llist2 longer = llist1 if len(llist1) >= len(llist2) else llist2 # ...
62711f812cc3ae6f0929f8e0bdf2a6d4fd9a747e
jpmcb/interview-problems
/ctci/3_1.py
1,563
4.15625
4
# Three in one # -------------- # implementation: A fairly simple array that holds 3 stacks class Multistack: def __init__(self, stacksize): self.numstacks = 3 self.array = [0] * (stacksize * self.numstacks) self.sizes = [0] * self.numstacks self.stacksize = stacksize def push...
2dc89136e16a2d3ba1d32d8bbfb009d3561fc901
jpmcb/interview-problems
/ctci/1_1.py
1,060
3.859375
4
# Is Unique: # Implement an algorithm to determine if a string has all unique characters. What if you cannot utilize additional data structures? import unittest def isUnique(input): # Assuming ascii 128 settup if (len(input) > 128): return False else: charSet = {} for x in input: ...
b29b563ecb71c0ff724fe1c7bb3753d5ecb2addd
jpmcb/interview-problems
/udemyPyInterview/heaps/testing.py
253
3.765625
4
import collections as c import heapq s = 'tree' # Will count the number of chars in the s string d = c.Counter(s) print(d) l = list(s) # Start with a list and build a heap from the list h = [(d[char], char) for char in d] heapq.heapify(h) print(h)
d5441df6f4d34b0603a3202f24c2964264afab91
jpmcb/interview-problems
/udemyPyInterview/linked_lists/cycle_check.py
1,098
4.09375
4
# Given a singly linked list, write a function which # takes in the first node in a singly linked list # and returns a boolean indicating if the linked list # contains a "cycle". # A cycle is when a node's next # point actually points back to a previous # node in the list. This is also sometimes known as a # cir...
51b74dc7c4a3c704ad07f4e518a80ff5af231811
jpmcb/interview-problems
/udemyPyInterview/sorting/bin_search.py
553
3.859375
4
# Returns the index of the element (or where the element should be inserted) def bin_search(A, x): l = 0 r = len(A) - 1 m = None while l <= r: m = (l + r) // 2 #print('mid: ', m) if A[m] == x: return m elif A[m] > x: r = m - 1 e...
b251679b3eb8724b520bb2814282da4d9c7e9dcc
lixiang007666/Algorithm_LanQiao
/数论/beizu_dingli.py
987
3.671875
4
#若a,b是整数,且gcd(a,b)=d,那么对于任意的整数x,y,ax+by都一定是d的倍数,!!!!!!!!特别地,一定存在整数x,y,使ax+by=d成立。!!!!!! #针对任意给出的x,y,z,可以假设用x与y分别往一个很大的容器里倒水和倒出水,那么如果z=mx+ny,找到合适的正整数m与n即为所求,其中m与n为负时,往外倒水,为正时,往里倒水。 #若z<=x+y且z%d==0,说明存在m、n使得最终剩余水为z。根据贝祖等式,d为x、y的最大公约数。 class Solution(object): def canMeasureWater(self, x, y, z): """ ...
5ab1baec298cb658582e9cdf518cc517e6b98e61
Jlow314/Learning_Python_from_Corey
/Less6 - Conditionals and Booleans.py
1,098
4.34375
4
if True: print("Conditional was True") language = "Python" if language == "Python": print("Conditional was True") language = "Java" if language == "Python": print("Language is Python") elif language == "Java": print("Language is Java") elif language == "Javascript": print("Language is Javascript"...
c7117449c3ecc61fb8efdf77bf4ea47d661a4b6d
Jlow314/Learning_Python_from_Corey
/OOP 2 - Class variables.py
973
3.984375
4
class Employee: raise_amount = 1.04 num_of_emps = 0 def __init__(self, first, last, pay): self.first = first self.last = last self.pay = pay self.email = f"{first}.{last}@company.com" Employee.num_of_emps += 1 def fullname(self): return f'{self.first} "...
e638959efba458f5107fcdacde1a2b64704cc44c
bryanbharper/TerminalTalk
/server/Orator.py
855
3.734375
4
"""!@file """ import random, font class Orator: """!@brief Stores information about a connected client. An Orator objects is used to represent a client. Each client has a moniker and color associated with them. The moniker is provided by the client. The color is assigned randomly each time the clien...
bd9d20620a2cc59d5481d1ed3df1caf33a545a54
v0rtex20k/COMP_160-wordInterpret
/main.py
878
3.578125
4
########################################################################## # # Tufts University, Comp 160 wordInterpret coding assignment # # main.py # wordInterpret # # simple main to test wordInterpret # NOTE: this main is only for you to test wordInterpret. We will compile # your cod...
2f6aa2c6e92172e26eab937790fac3736d06e843
Adrian-Garcia/Programming-Languages
/1er Parcial/Parser y Scanner/parser.py
1,412
3.75
4
# Implementación de un parser # Reconoce expresiones mediante la gramática: # EXP -> EXP op EXP | EXP -> (EXP) | cte # la cual fué modificada para eliminar ambigüedad a: # EXP -> cte EXP1 | (EXP) EXP1 # EXP1 -> op EXP EXP1 | vacío # los elementos léxicos (delimitadores, constantes y operadores) # son reconocidos por e...
626d41da46a62cbb5ce8d0427ad29add6e160d91
Patel-Jenu-1991/client-side
/xml_parsing_loops.py
392
4.34375
4
#!/usr/bin/env python3 # XML Parsing 2 (Extracting all the data using loops) from xml.etree import ElementTree as et doc = et.parse("cars.xml") # outputs the make, model and cost of each car to the screen print() for element in doc.findall("CAR"): print(element.find("MAKE").text + " " + element.find...
ce52fd98693eb38ed0ee1b2bc8b844a6d61f1488
jalicea/mtec2002_assignments
/midterm/midgame2.py
6,396
3.578125
4
import random kills = 0 totalkills = 0 flask = 0 maxhealth = 100 health = 100 rem = 0 attack_min = 0 attack_max = 0 red_moss = 0 totalred = 0 green_moss = 0 totalgreen = 0 bosshealth = 200 bossdamage = 1 def med(): if flask == "1": maxhealth - health == rem rem + health == health def stat(): p...
e1ba397adbe7e98f51ac2527f12a8684c01fba50
cjsivley/homework
/CS 415 Operating Sys/SimplePythonChat/spcServer.py
3,263
3.515625
4
# Python program to implement server side of chat room. import socket import select import sys import string from _thread import * """The first argument AF_INET is the address domain of the socket. This is used when we have an Internet Domain with any two hosts The second argument is the type of socket. SOCK_STREAM m...
87491295d4f45f879b8d42b4b741c698eac8010e
pdcodes/PythonLearnings
/Basics/lists.py
822
4.4375
4
# Playing around with lists a bit more monday_temps = [4.5, 4.6, 4.8] print(monday_temps) print("Appending...") monday_temps.append(8.7) print(monday_temps) print("Clearing...") monday_temps.clear() print(monday_temps) print("Recreating") monday_temps = [4.5, 4.6, 4.8] print("Getting index of 4.5...") print(monday_...
9bab84d60357d8235434839e6dc6d158db2cd787
kwebam/c-149
/List1.py
541
3.78125
4
from tkinter import * import random root = Tk() root.title("Luck friend wheel") root.geometry("500x500") list1 = ["Aaron", "Ayaan", "Amol", "Bisman", "Niska", "Rudra"] print(list1) def randomNumber(): random_no = random.randint(0,4) print(random_no) random_lucky_friend = list1[random_no] ...
20024d1250a80d40cd1b7757cb8d98d912129d53
hocht/practicas2
/Sandwiches ciclo while.py
2,536
3.71875
4
#alimentar una lista de otra por medio de un ciclo for listaDePedidos = ['sandwich de jamon','sandwich de atun', 'sandwich montecristo','sandwich de jamon', 'sandwich de aceitunas y jamon serrano','sandwich imperial', 'sandwich de tres quesos','sandwich de salmon', ...
027217291bea31feef4211c8786994f8e2a4f657
jakemat29/python_repo
/ex02.py
634
4.15625
4
print "i'll count the chickens" print "chickens=", 25 + 30 / 6 #30/6=5->25+5=30 print "roosters=", 100 - 25 * 3 % 4 #25*3=75 -> 75%4=3 -> 100-3=97 print "is it true 3+5>7-2", 3 + 5 > 7 - 2 # <, >, <=, >= returns boolean values print "PEDMAS applies here", 3 * (82%7) / 2 # PEDMAS applies here *P= Parenthesi...
862436257eb7bec2c5d83a29a4c4c75fcedacacc
jakemat29/python_repo
/ex05.py
361
3.828125
4
x = "there are %d number of people" %10 s = "success" f = "failure" y = "you'll either be a %s or a %s " %(s,f) print x print y print "I said %r" %x print "I also said '%s'" %y print "*" * 100 hilarious = False joke_evaluation = "isnt that joke funny?! %r" print joke_evaluation %hilarious w = "hai there, this is "...
4e9c3eadd768f0bc60a7b527acd57357547e47e6
makakin/learn-python
/core-python-programming/chapter.02/forAndRange.py
590
3.921875
4
# --coding: utf-8 -- __author__ = 'lovexiaov' nameList = ['zhangsan', 'lisi', 'wangwu', 'maliu'] for name in nameList: print "the current name is: %s" % name print '-' * 20 # add a comma on the end of print sentence, it will not wrap a new line for name in nameList: print name, print print '=' * 20 # range(...
126c9db227dd233fea71a03ff609c6cc5abde742
makakin/learn-python
/core-python-programming/chapter.06/stack.py
785
3.890625
4
""" this demo simulate a FILO stack """ __author__ = 'weixy6' stack = [] def pushit(data): stack.append(data) def popit(): if len(stack) == 0: print 'there is no data to pop' else: stack.pop() def viewstack(): print stack def showMenu(): pr = '''Use Introduction: p(U...
30c38ba2ca2690b797ab7577314f5c5e5b6cfacf
MrChuse/Evolution
/brain/nn/Dense.py
709
3.75
4
import numpy as np class Dense: def __init__(self, num1, num2, learning_rate=0.01, bias=True): self.mt = 2/num1 * np.random.randn(num1, num2) # new weights according to Andrew Ng self.bias = np.zeros((1, num2)) self.lr = learning_rate def forward(self, data, bias=True, prnt=False): ...
17938aed71f08b8921018471a9cdba87a3f81102
MrChuse/Evolution
/brain/baseBrain.py
380
3.703125
4
from abc import ABC, abstractmethod class BaseBrain(ABC): """ Base class for all brains to inherit Methods ------- make_a_move(self, sensor_data): The main method to calculate the next move """ def __init__(self): super().__init__() @abstractmethod def make_a_move...
d375c324fce639654a13e386991023dfc8ccbebb
adwiza/learn
/set_game.py
903
3.640625
4
NUMBERS = [1, 2, 3] SYMBOLS = ['DIAMONDS', 'SQUIGGLE', 'OVAL'] SHADINGS = ['STRIPPED', 'SOLID', 'OPEN'] COLORS = ['RED', 'GREEN', 'PURPLE'] class Card: def __init__(self, number, symbol, shading, color): if any([ number not in NUMBERS, symbol not in SYMBOLS, shading not...
f305b02c444f2fd534853af65a03311565f57e1d
pranavmodi07/DevOps103
/calc.py
228
3.5
4
def add(x.y): """Add Function""" return x+y def sub(x,y): """Subtract Funtion""" return y def multiply(x,y): """Multiply Funtion""" return x*y def divide(x,y): """Divide Funtion""" return x/y
01926e122be049f98edb430434f14aae527f269f
OrdinaryCoder00/CODE-WARS-PROBLEMS-SOLUTIONS
/8Kyu - Find the Integral.py
255
3.515625
4
def integrate(coefficient, exponent): # write your code here y = float((((coefficient) / (exponent + 1)))) if y.is_integer(): y = str(y) y = y.replace('.0','') else: y = str(y) return y+'x'+'^'+str(exponent+1)
8f537bd132cf732c59b33773445fcaee0ca63cc7
OrdinaryCoder00/CODE-WARS-PROBLEMS-SOLUTIONS
/8Kyu - Find numbers which are divisible by given number.py
93
3.6875
4
def divisible_by(numbers, divisor): return [num for num in numbers if(num%divisor == 0)]
667b3b09b63f6a0f0a0a8821bb1ec37165dadd77
OrdinaryCoder00/CODE-WARS-PROBLEMS-SOLUTIONS
/8Kyu -altERnaTIng cAsE <=> ALTerNAtiNG CaSe.py
448
4.125
4
import re def to_alternating_case(string): #your code here x = '' regex = re.compile('[@_!#$%^&*()<>?/\|}{~:]') for i in string: if i.isupper(): x = x + i.lower() elif i.islower(): x = x + i.upper() elif i.isdigit(): x = x + i elif i.i...
de8d39a6487ed092b2b44c965570daabbfde5a2a
OrdinaryCoder00/CODE-WARS-PROBLEMS-SOLUTIONS
/8Kyu - Count by X.py
146
3.765625
4
def count_by(x, n): """ Return a sequence of numbers counting by `x` `n` times. """ y = n return [x*i for i in range(1,y+1)]
e61f036bfe7a57ad1deb176f4e392850b276031b
OrdinaryCoder00/CODE-WARS-PROBLEMS-SOLUTIONS
/8Kyu - Multiple of index.py
205
3.609375
4
def multiple_of_index(arr): new_list = [] for i,a in enumerate(range(len(arr))): if(i!=0): if(arr[i]%i == 0 and i>0): new_list.append(arr[i]) return new_list
bbb6a86a869f6a31c821608dd3019ecfc7f01fc8
OrdinaryCoder00/CODE-WARS-PROBLEMS-SOLUTIONS
/8Kyu - Who ate the cookie?.py
315
3.65625
4
def cookie(x): #Good Luck if(isinstance(x,(str))): return "Who ate the last cookie? It was Zach!" elif(isinstance(x,(int,float)) and type(x) == int or type(x) == float): return "Who ate the last cookie? It was Monica!" else: return "Who ate the last cookie? It was the dog!"
c41a08405ab2c513b3f088df3fda14709860afba
OrdinaryCoder00/CODE-WARS-PROBLEMS-SOLUTIONS
/8Kyu - Sum without highest and lowest number.py
228
3.546875
4
def sum_array(arr): #your code here if(arr==[] or arr==None or len(arr)<=2): return 0 else: new_arr = arr new_arr.remove(min(arr)) new_arr.remove(max(arr)) return sum(new_arr)
ce6c616c6b267f7afa020843a37a176928ad606f
OrdinaryCoder00/CODE-WARS-PROBLEMS-SOLUTIONS
/8Kyu - Hello, Name or World.py
263
3.640625
4
def hello(name=""): if(name==""): return "Hello, World!" else: return 'Hello, ' + name.capitalize() + '!' #test.assert_equals(hello(), "Hello, World!") to resolve this error when no #argument is passed try the def hello(name="")
b4bd80f9138ea3cd4a7f1e07b5e4725feaf32fb1
OrdinaryCoder00/CODE-WARS-PROBLEMS-SOLUTIONS
/8Kyu - Pythagorean Triple.py
189
3.859375
4
def pythagorean_triple(integers): integers = tuple(integers) a,b,c = sorted(integers) if ((c**2) == (a**2 + b**2)): return bool(1) else: return bool(0)
ae2045d8d77b93bfcf8f8c7b6c3cf4cfc428d1ef
OrdinaryCoder00/CODE-WARS-PROBLEMS-SOLUTIONS
/8Kyu -Total amount of points.py
248
3.71875
4
def points(games): total = 0 for i in games: x,y = i.split(':') if(x>y): total = total + 3 elif(x<y): total = total + 0 elif(x==y): total = total + 1 return total
aac7f0bc0475ae7ecb1f0edeeb595ad6bd3de664
prashant-2906/Hacktoberfest-Ankita
/factorial.py
137
3.859375
4
#determine the factorial of number #copyright prashant-2906 n=int(input()) fact=1 for a in range(1,n+1): fact*=a; print(fact,end="")
6720a4ba29ff89354f6cfa828b1e5fd2f0fd9b3b
ssarvesh/PythonBasics
/StringPrg/strings.py
978
3.734375
4
str = ' Hello Srinivas Kolaparthi! ' print (str) print (str[0]) print (str[2:5]) print (str[2:]) print (str * 2) print (str + "TEST") print(str.lower()) print(str.upper()) print(str.strip()) #removes spaces print(str.replace('a','z')) print(str.count('a')) print(str.find('s'),'th position') print (str[:-5]) #-------...
96dd4bdcca4451ad3344a0348e5a1ff0b3227a55
eshlykov/junk
/school-31/coding/python/intro04.py
103
3.609375
4
n = int(input()) k = 1 while n != 1: if n % 2 == 0: n /= 2 else: n = 3 * n + 1 k += 1 print(k)
d7a69025a9aef9f1e426c42b8888684291cff39d
eshlykov/junk
/school-31/coding/mccme.ru/mccme0310.py
140
3.8125
4
n = int(input()) for i in range(2, int(n ** 0.5) + 1): if n % i == 0: print('composite') break else: print('prime')
1b64afc13eb3796d48328a9cb4f162e7deeeb482
eshlykov/junk
/school-31/coding/mccme.ru/mccme3101.py
117
3.71875
4
a, b = [int(i) for i in input().split()] def gcd(a, b): while b != 0: a, b = b, a % b return a print(gcd(a, b))
f02c3a321a77382e0ee765858cd492409a5e91af
iamthedkr/Cheating-In-Exams
/7.py
463
4.1875
4
import datetime date = datetime.datetime.now() y=date.year m=date.month d=date.day a=input("Enter Date: ") b=a.split("/") if(int(b[2])==y): if(int(b[1])==m): if(int(b[0])==d): print("Date is equal") elif(int(b[0])>d): print("Date is greater") else: print("Date is less") elif(int(b[1])>m...
737b1e679bf4ab0d395cb4184e30423f0389da23
pabin/university_recommendation
/recommender/graph_plot.py
1,488
3.5
4
import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib import style style.use('ggplot') def graph_plot(): csv_filepathname = "/home/raj/PycharmProjects/university_recommendation/" \ "database/clean70k.csv" names = ['University', 'Major', 'Degree', 'Seaso...
0aabb54910d27be49af53db8a29a221c2ac5df0b
mmellott/capstone-frontend
/src/_lesson.py
1,344
3.71875
4
#!/usr/bin/python """ Define Lesson class that holds lesson data to be used by the interface. Lesson text is loaded from html files in lessons/. Main program will just call get_lessons to get a list of all lessons that the interface should present. """ import os import _interface class Lesson: """ Basically just ...
7c985f5f44e796251584d097e1dd4405a41355ea
QAMilestoneAcademy/PythonForBeginners
/DataTypeStringNumberPrint/calculator.py
462
4.1875
4
while True: num1 = int(input("number1:\t")) num2 = int(input("number2:\t")) option = input("Please enter operation - add,multiply,divide,subtract:\t") if option=="add": print("add",num1+num2) elif option=="subtract": print("difference",num1-num2) elif option=="multiply": print("m...
1ae0c53f0d1a214cbc8595259a456f6b210f2f34
QAMilestoneAcademy/PythonForBeginners
/functions_modules/turtle/rectangle_turtle.py
539
3.671875
4
# Rectangle # Fd 300 rt 90 fd 150 rt 90 # Fd 300 rt 90 fd 150 rt 90 import turtle import time s = turtle.Screen() s.bgcolor("light blue") t=turtle.Turtle() t.pen(pencolor="red", fillcolor="purple", pensize=10, speed=2) t.begin_fill() t.fd(200) t.rt(90) t.fd(100) t.rt(90) t.fd(200) t.rt(90) t.fd(100) t.end_fill() time....
e7b84ed0fd8f2349cabd5c9bc5d8590920fdb2f8
QAMilestoneAcademy/PythonForBeginners
/conditional_learn/input_age.py
224
4.15625
4
# age=int(input("Whats ur age")) # print(age>=32) # name=input("whats ur name") # name=name.capitalize() # print("Anuradha" in name) name=input("What is your name") name=name.strip().capitalize() print("Anuradha" in name)
25941577cbc92e3f8eb7c8f304e1f0feb62543f5
QAMilestoneAcademy/PythonForBeginners
/ProgramFlow/if_learn.py
1,160
4.21875
4
#Statement following if condition are indented within if #indented statements excute if condition within if bracket meets name="Anuradha" # if(name == "Anuradha"): if(10>5): print("10 is greater then 5") #will execute in any condition print("program ended") #Let's guess the output: spam = 7 if spam > 5: print(...
8719a1e23c3ae44769ddd84db69bc064a34f84ad
QAMilestoneAcademy/PythonForBeginners
/ProgramFlow/for_learn.py
868
4.875
5
# The for loop is commonly used to repeat some code a certain number of times. This is done by combining for loops with range objects. for i in range(5): print("hello!") for l in range(0,20,2): print(l) # The range function creates a sequential list of numbers. # The code below generates a list containing all of...
6275c574613d3998041d966fe9ad4de14eea200e
QAMilestoneAcademy/PythonForBeginners
/objectoriented/coin_part1_class_objects_variables.py
549
3.96875
4
class Pound: value=1.0 color="gold" num_edges=1 diameter=22.5# in millimeter thicknes=3.15#in mm heads=True coin1=Pound() print(type(coin1)) print(coin1.value) coin1.color="greenish" print(coin1.color) coin2=Pound() print(coin2.color) #classes are base templates an object is being made from.Act...
34810dc1c3be9717dfb8b0a6ce8c10dc9ea35208
peopledoc/novapost.cookbot
/novapost/cookbot/settings.py
3,479
3.5
4
"""Build :py:class:`Recipe` tree from configuration files.""" from ConfigParser import ConfigParser, NoOptionError import re from context import Context DEFAULT_RECIPE = 'novapost.cookbot.recipes:Recipe' class ConfigParserReader(object): """Read configuration from :py:mod:`ConfigParser` files. See `Config...
cc1bdd65b0fa70965a191b67478fe9e7f68ad718
syedahmedullah14/Python-programming-examples
/Dictionary_programs/grade_calculator_using_dict.py
1,919
4.34375
4
# Q. Program to create grade calculator in Python '''Given different scored marks of students. We need to find grades. The test score is an average of the respective marks scored in assignments, tests and lab-works. The final test score is assigned using below formula. 10 % of marks scored from submission of Assignmen...
c6e77cf811fe2346320f858fca003187384d5c3c
syedahmedullah14/Python-programming-examples
/String_programs/remove_ith_character_string.py
216
3.890625
4
# Q. Ways to remove i’th character from string in Python #Method 1: s='Anonymous' print(s[:2]+s[3:]) # Method 2: ''' s='Anonymous' new_s='' for i in range(len(s)): if i != 2: new_s=new_s+s[i] print(new_s) '''
701cec67c217d33330153edf63d69911df00a5a5
syedahmedullah14/Python-programming-examples
/List_programs/even_odd_elements_list.py
765
4.34375
4
# Q. Python program to print odd Numbers in a List l1=[2,-3,4,-5,6] even=0 odd=0 for i in l1: if i%2==0: even+=1 else: odd+=1 print('even:', even, 'odd:', odd) ''' # list of numbers list1 = [10, 21, 4, 45, 66, 93, 11] only_odd = [num for num in list1 if num % 2 == 1] odd_count = len(only_odd) ...
f7b291e7ef56a8ce3e79b7eb1b1a2a2620dbd3b7
syedahmedullah14/Python-programming-examples
/Dictionary_programs/check_order_dict.py
633
4.21875
4
'''Given an input string and a pattern, check if characters in the input string follows the same order as determined by characters present in the pattern. Assume there won’t be any duplicate characters in the pattern. Examples: Input: string = "engineers rock" pattern = "er"; Output: true Explanation: All 'e' in t...
c286c088f9d05e30c620cf11ea48d2f7fb0d38af
syedahmedullah14/Python-programming-examples
/List_programs/clear_list.py
221
3.984375
4
# Q Different ways to clear a list in Python #Method 1: using pop() list1=[1,2,3,4,5] for i in range(len(list1)): list1.pop() print(list1) # Method 2: using clear() method list1=[1,2,3,4,5] list1.clear() print(list1)
7c13c5f3af109eb878d873deb445f07740f50ca2
syedahmedullah14/Python-programming-examples
/Dictionary_programs/merge_dict.py
373
4.3125
4
# Q. Merge two dictionaries def mergedict(dict1,dict2): return (dict1.update(dict2)) dict1={'a':1, 'b':2} dict2={'c':3} print(mergedict(dict1,dict2)) print(dict1) # MEthod 2 '''def Merge(dict1, dict2): res = {**dict1, **dict2} return res # Driver code dict1 = {'a': 10, 'b': 8} dict2 = {'d': 6, '...
33e30905251b0bf56e8cc140c4e5c4e2f3c05163
syedahmedullah14/Python-programming-examples
/List_programs/even_number_list.py
587
4.28125
4
# Q. Python program to print even Numbers in a List l1=range(1,10) for i in l1: if i % 2==0: print(i) ''' # list of numbers list1 = [10, 21, 4, 45, 66, 93] # using list comprehension even_nos = [num for num in list1 if num % 2 == 0] print("Even numbers in the list: ", even_nos) ''' ''' # Python p...
520e21de44576a226ef696cf586c5722f9b6739d
syedahmedullah14/Python-programming-examples
/String_programs/reverse_words_in_string.py
315
4.03125
4
# Q. Reverse words in a given String in Python ''' We are given a string and we need to reverse words of given string ? Examples: Input : str = "geeks quiz practice code" Output : str = "code practice quiz geeks" ''' str_ = "geeks quiz practice code" s=str_.split(' ') rev=s[::-1] join=' '.join(rev) print(join)
c348fc0018e033ca91a575fedf29ed8eca6fcdf5
marykthompson/ribopop_probe_design
/scripts/probe_site_selection.py
2,930
3.5
4
import numpy as np import itertools def conseq_point_dist(array): """Finds the difference (distance) between consequtive points in an array""" first_probe_site = [] dist_between_probe_sites = np.append(first_probe_site, [t - s for s, t in zip(array[:], array[1:])]) return dist_between_probe_sites def ...
71ea51e7f260dc5a9126c9940ce2ded1b050201f
em0flaming0/Tic-Tac-Toe
/tictactoe.py
3,222
3.90625
4
#!/usr/bin/python def CheckMove(row, col, board, valid): if not board[row][col] == "-": print "Move Not Valid Please Select New Move..." valid = False return valid else: valid = True return valid def testCheckWin(board): if(board[0][0] and board [0][1] and board[0][2] == "X"): return Tr...
ab5ea10f19e0a1baca4d9d00091f86b77d550c4a
gloomikon/Paradigms
/lab4.py
3,408
3.71875
4
class Ticket: def __init__(self, number, name, surname, train, carriage, date1, time1, date2, time2): self.number = number self.name = name self.surname = surname self.train = train self.carriage = carriage self.date1 = date1 self.time1 = time1 self.date2 = date2 self.time2 = time2 def print_info(se...
714053d8cae9c08906a015874091cc58e032fe52
slott56/navtools
/navtools/solar.py
6,290
3.875
4
"""Location of the sun. This lets us compute whether an arrival is in daylight, or in the dark. Further, with some interpolation along legs of a route, it lets us inject noon waypoints that are reminders to send notifications of progress. >>> from navtools.navigation import Lat, Lon >>> import datetime >>> lat = La...
61646bd195c7bb9b54263258ba4410fa5d43bde9
pragatipal/eduAlgo
/edualgo/LinkedList.py
7,538
3.796875
4
from .__init__ import print_msg_box class Node: def __init__(self,val): self.val = val self.next = None class linkedlist: def __init__(self): self.head = None self.tail = None def append(self,val): if self.tail is None: self.head = Node(val) ...
cd5925b5093cc941127bfdde7720188dc5e1a477
gyhdtc/coding-at-will
/p2p/test/condition.py
632
3.59375
4
import threading import time condition = threading.Condition() # 创建condition对象 def func(i): print("in func..", i) condition.acquire() # 如果没有with语句,必写这句,否者报错 condition.wait() # 阻塞,等待其他线程调用notify() print("in func..", i) condition.release() # 与acquire()成对出现 # 启10个线程 for i in range(10)...
9cac4e58b030b50be33c93d398078caef22711f4
puzhongwei/python_learn
/qsort.py
569
3.921875
4
print('helow word!') def mysort(a, low, high): if low < high: i = low j = high tmp = a[low] while i<j and a[j] >= tmp: j -= 1 if i<j: a[i] = a[j] i += 1 while i<j and a[i] < tmp: i += 1 if i<j: ...
bbf1827c9c0007afa0ac2cbcb71c8d99760cbdfa
c-okelly/Programming-1-Python
/Lab 18/P18P2.py
497
3.984375
4
__author__ = 'conor' """ def take_in_string(): return a string of words def search_in_string(): words = take_in_string() count times code is found in list """ def search_in_string(): sentence = string_input() count = sentence.count("code") print("The word code was found %s times" % (coun...
84e394c05106c9691218f31250039d6e29f5f6aa
c-okelly/Programming-1-Python
/Lab 8/P8P4.py
1,372
3.984375
4
__Author__ = "Conor O'Kelly" def find_range(): number = get_input_int() #Numbers in range of 0-20, 21-40, etc range_0 = 0 #0-20 range_1 = 0 #21-40 range_2 = 0 #41-60 range_3 = 0 #61-80 range_4 = 0 #81-100 range_5 = 0 #101 plus while number > 0: if number <= 20 an...
faa257fc1c3c4c183165a7f028d324f117cabc28
c-okelly/Programming-1-Python
/Lab 17/P17P1.py
961
4.09375
4
__author__ = 'conor' """ Find divisor of one number test greater then 0 if not create tuple with 1 and number as divisors For i in range 2 to half number plus one. Test that it can be divided if can create new tuple with combination of both """ # Find the common deivsor of both numbers def find_divisors(number_1...
810142350e7183b496ff852a7d2b085ea58f8cbc
c-okelly/Programming-1-Python
/Lab 13/P13P1.py
670
4.25
4
__author__ = 'conor' """ Program to print out the largest of two numbers entered by the user Uses a function max implemented using code from class """ def max(a, b): #take to arguemtns and returns the largest if a > b: return a else: return b # Prompt the user for two numbers def get_...
d1375cdf5da95a4db914983f290e0e18003f5184
c-okelly/Programming-1-Python
/Lab 16/P16P3.py
1,042
3.671875
4
__author__ = 'conor' """ def find_if_perfect_number(number): find all integer if all integer add = number return number else: return def series(): def get_input(): x = int(raw_input("Enter limit of perfect number search")) """ def find_if_perfect_number(number): #Find integ...
d3e5a945f23e135cf44cf8706a5184be18c28f68
c-okelly/Programming-1-Python
/Lab 3/p3p3.py
352
3.71875
4
def tax(income): income_1 = income * 0.6 income_2 = income * 0.4 first_level = income_1 * 0.135 second_level = income_2 * 0.23 total_tax = first_level + second_level total = total_tax + income print 'Income is', income, "tax due is", total_tax print "The total amount of inital price ...
f7054721d3e01e19490e9d642d20c6bbeb1439cf
jenyf/T04_RodriguezRamon.VegaHuaman
/Ejercicio_08_Rodriguez_Ramon.py
953
4
4
#Ejercicio_08 #Detector de bajo rendimiento academico alumno,horas_dedicadas_al_estudio_por_dia,total_de_horas_por_semana="",0,0 # INPUT alumno=input("Ingrese alumno:") horas_dedicadas_al_estudio_por_dia=int(input("Ingrese horas dedicadas al estudio por dia:")) # PROCESSING total_de_horas_por_semana=horas_dedicadas_a...
ec817f612aa2cac7ae9c83efa7bb1f166674dad9
LuLuuD/MSAI-Learn
/CV-Emmahuu/Code/Python basic practice/action6_0414.py
485
3.578125
4
# -*- coding:utf-8 -*- #@Time: 2020/4/14 #@Author: EmmaHuu #@File: action6_0414 """ """ import queue class MovingAverage: def __init__(self, size: int): self.container = queue.Queue(size) def next(self, val: int) -> float: if self.container.full(): self.container.get() self.container.put(val, block = True...
e0aa065fd19bd2a6343e86f9fb9a289b06604e30
Dhruvil42/Stock-Market-Analysis-for-Tech-Stocks
/Tech Stocks Analysis.py
7,064
3.75
4
# Here in this Project, we'll look forward to analyse data from the stock market for the Top 5 tech stocks # We'll use pandas library to extract data and analyse information, visualize it and look at different # perspective for risk analysis based on historical data. #%% Importing Libraries import numpy as np ...
536da16dbf2a61d5650209ee280c7aeed404d6f2
mattmurray/advent_of_code_2020
/day_05/answer.py
1,971
3.65625
4
# --- Day 5: Binary Boarding --- # https://adventofcode.com/2020/day/5 # load data with open('input.txt', 'r') as f: data = [line.strip() for line in f] def parse_string(s, range_min, range_max, upper_char, lower_char): all_seats = list(range(range_min, range_max)) for char in list(s): num_seats ...
8d5316680e0d6dc4fad98b61147390886854d723
SOFTinc1/Basic-Python-Projects
/Python/atm.py
3,901
3.9375
4
print('Welcome to UTILITY Bank') print('insert your card') restart = 'y' balance = 300000 chance = 3 print('welcome Hussayn Abdulrahmon') cus_pin = int(input('enter your pin ')) if cus_pin == (1234): while(cus_pin!=90000): print('welcome') #while restart not in('n','NO','no','N'): atm_menu = i...
a2327ae303e0eaa9d3556997568ef91bd7d91a0f
ZMaguffin/Python-Functions-Project
/Project 3.py
2,648
4.15625
4
# CSCI 310 Organization of Programming Languages, Spring 2018 # Program #3: Procedural/Object-Oriented Assignment # Author: Zack Maguffin # Date Due: 9 April 2018 # This assignment simulates life in the real world, specifically at your first job. def hlbackwards(myList): newList = [] for x in reversed(m...
eea6da1624a2d6015588745034fdfe187298864d
ellaellen/Projects
/ComputerVision/filters.py
18,342
3.5625
4
import numpy as np import cv2 class KalmanFilter(object): """A Kalman filter tracker""" def __init__(self, init_x, init_y, Q=0.1 * np.eye(4), R=0.1 * np.eye(2)): """Initializes the Kalman Filter Args: init_x (int or float): Initial x position. init_y (int or float):...
c9dbd32e79b4ed299c95daec373675974172f11d
brando90/interview_practice_for_zeren
/remove_duplicates_linked_list.py
3,954
3.90625
4
''' Q: Remove duplicates from linked list. but solve the problem you need to know something...so ask. Interviewer has to: 1) Give you the API (= interfence for talking to someone else's software) himself (if he doesn't use the standard library API, he might have a specific question with specific restrictions) 2) Use ...
8c3c4298249deb51d254fdc82da47e39f5a9f60f
Ich1goSan/LeetcodeSolutions
/longestCommonPrefix.py
371
3.5625
4
def longestCommonPrefix(self, strs: List[str]) -> str: result = "" if(len(strs) == 0): return "" if(len(strs) == 1): return strs[0] prefix = strs[1] for i in range(len(strs)): while strs[i].find(prefix) != 0: prefix = prefix[0:len(prefix)-1] if(prefix ...
ddcf1d790a85743289bf836a09a0a5d832cdd7aa
Ich1goSan/LeetcodeSolutions
/maxSubArray.py
229
3.515625
4
def maxSubArray(self, nums): currentSum = nums[0] maxSum = nums[0] for i in range(1, len(nums)): currentSum = max(currentSum + nums[i], nums[i]) maxSum = max(currentSum, maxSum) return maxSum