blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
13d1516229289abeef0c72c02adcc621a6ccd050
GeorgeKailas/python_fundamentals
/03_more_datatypes/3_tuples/03_13_tuple_to_list.py
96
3.5
4
''' Write a script that takes a tuple and turns it into a list. ''' t = 1,2,3,4 print(list(t))
9f70218c1803cd94c963790d0e61825b33d93c28
GeorgeKailas/python_fundamentals
/15_aggregate_functions/15_03_my_enumerate.py
392
4.34375
4
''' Reproduce the functionality of python's .enumerate() Define a function my_enumerate() that takes an iterable as input and yields the element and its index ''' my_list = ["apple", "banana", "orange"] nl = [] for idx, item in enumerate(my_list): print(idx, item) # def my_enumerate(x,y): # for w in my_...
8d4783926acb7f5c24d4fe7d31123a8656432f84
GeorgeKailas/python_fundamentals
/03_more_datatypes/2_lists/03_11_split.py
616
4.28125
4
''' Write a script that takes in a string from the user. Using the split() method, create a list of all the words in the string and print the word with the most occurrences. ''' # s = input("write a sentence:") # s_s = s.split() # higest_count_word = "" # count_word_dict = {} # for i in s_s: # if s_s.count(i) == ...
6d7681a78a191f6f14fd8bf4ec6c29f2baf9ed17
mohammedjasam/Programming-Cup-2017-Fall
/ProblemIPoetryTower.py
922
3.53125
4
N, M = map(int, input().split()) diceList = [] wordList = [] totalWordList = wordList[:] totalWordList = wordList[:] for i in range(M): wordList.append(input()) for i in range(N): diceList.append(input()) print(wordList, diceList) mainCount = 0 tempWordList = wordList[:] for word in tempWordList: temp...
e12f18e5e8cd9748cc74326b444d9e0f36c2e0c0
priyaa98/GUVI
/CheckNum.py
586
3.53125
4
class CheckNum: def __init__(self): self.n=input() def checking(self): flag=0 c=0 for i in self.n: if(i.isdigit()): continue elif(i=='.'): c=c+1 if(c==1): continue ...
d37ba19e35703f7ff3b3850c2f9c2a6cae4cd9eb
priyaa98/GUVI
/Multiples.py
366
3.828125
4
class Multiples: def __init__(self): self.n=int(input()) def findmul(self): lst=[] for i in range(1,6): lst.append((self.n)*i) for i in range(0,len(lst)): if(i==len(lst)-1): print(lst[i]) else: print(l...
47faedfb40a9cc852978faa3ae7fd359b3358b22
priyaa98/GUVI
/AmstrongNum.py
612
3.625
4
class amstrongnum: def __init__(self): self.numchar=input() def findamstrong(self): countnum=0 sumn=0 num=int(self.numchar) while(num>0): if(num%10>=0): countnum=countnum+1 num=int(num/10) num=int(self.numchar...
9b07c48a75bab6015075da5f33ff7fa52b450811
priyaa98/GUVI
/CountDigit.py
324
3.71875
4
class countdigit: def __init__(self): self.numchar=input() def count(self): countnum=0 num=int(self.numchar) while(num>0): if(num%10>=0): countnum=countnum+1 num=int(num/10) print(countnum) cd=countdigit() cd.count...
2c4b3742a66bb3af9e36eb883df1160b5eb238a0
fspaolo/scikit-learn
/examples/linear_model/plot_polynomial_interpolation.py
1,641
4.3125
4
#!/usr/bin/env python """ ======================== Polynomial interpolation ======================== This example demonstrates how to approximate a function with a polynomial of degree n_degree by using ridge regression. Concretely, from n_samples 1d points, it suffices to build the Vandermonde matrix, which is n_samp...
f38b7df89fbd719b1dd71630f3d67648e763b5fe
MertErciyas/Van_input_naar-_output
/Opdrachten/de_Speelhal_Input.py
316
3.640625
4
ticket = int(input("hoeveel tickets willen jullie? 1 kost €7,45\n")) vipTicket = int(input("hoeveel mensen willen VIP tickets? 1 minuut is €0,37\n")) ticketKosten = float(7.45) vipTicketKosten = float(0.37) print("Dat word dan:") print(int(((ticket * ticketKosten) + (vipTicket * vipTicketKosten))* 100),"cent")
7c9b882ad2b32ecc082efd7b1ae46b57cc4549b5
CadezDavid/ProjectEuler
/Resene naloge/euler10.py
249
3.515625
4
def je_praševilo(stevilo): if stevilo < 2: return False for i in range(2, int(stevilo ** 0.5) + 1): if stevilo % i == 0: return False return True sum = 0 for stevilo in range(1, 2 * 10 ** 6): if je_praševilo(stevilo): sum += stevilo
23f3a709a50c69d28edeccff7e9e0f1430b10d01
CadezDavid/ProjectEuler
/Resene naloge/euler33.py
886
3.5
4
import fractions # def krajsanje(n, m): # list = [] # m = [i for i in str(m)] # n = [i for i in str(n)] # k = list(set(m).symmetric_difference(n)) # if min(m, n) / max(m, n) == min(k[0], k[1]) / max(k[0], k[1]) # list.append([m, n]) def odstrani_skupne(m, n): if '0' in str(n): ...
b77bcf3f60ab2fd9021aaa6377e9e168f942e605
CadezDavid/ProjectEuler
/Resene naloge/euler112.py
339
3.625
4
def bouncy(stevilo): if stevilo < 100: return False return not (sorted(str(stevilo), reverse=False) == list(str(stevilo)) or sorted(str(stevilo), reverse=True) == list(str(stevilo))) bouncy_stevil = 0 stevilo = 1 while 100 * bouncy_stevil < 99 * stevilo: if bouncy(stevilo): bouncy_stevil +=...
80cda5e3a27fecc3dcc4f189fbc3f01109cc1307
deepshikhadas20/Data-visualization
/Data-visualization-master copy/Teacher refrence/scatterplot.py
242
3.53125
4
import pandas as pd import plotly.express as px df = pd.read_csv("data.cvs") fig = px.scatter(df, x="population", y="Per capita", size="Percentage",color="Country", size_max = 60) fig.show()
2b85e5a04e14e8c51656c009ed782d5cc83604b1
ishanarora04/pythonAlgos
/SubPrimeUVA.py
568
3.609375
4
if __name__ == '__main__': while True: value1 = [int(i) for i in input().split(" ")] if(value1[0] == 0): break current_reserves = [int(i) for i in input().split(" ")] for i in range(value1[0]): value = [int(i) for i in input().split(" ")] cur...
db1411eaa24c985464e3e854917772a5da64ad4f
ishanarora04/pythonAlgos
/10815Andy.py
623
3.609375
4
if __name__ == '__main__': dict = {} while True: q = input() print(q) if q == "": print() break for elem in q.split(): interm = elem.lower() if len(interm) > 1 and interm[-2] == "'" and interm[-1] == 's': interm = ...
0feca5331d3693d311919fa10eb03ac63b17765d
ishanarora04/pythonAlgos
/ONPTransformSPOJ.py
621
3.671875
4
if __name__ == '__main__': q = int(input()) for i in range(q): exp = input() stack1 = [] stack2 = [] for elem in exp: if elem == '(': continue elif elem == ')': elem1 = stack1.pop() elem2 = stack1.pop() ...
1e8e99cdd710a2cf3de27add14589d6bce226560
jeonghoonkang/BerePi
/apps/flask/data_chart/code/utils.py
671
3.625
4
import sys import os def recursive_search_dir(_nowDir, _filelist): dir_list = [] try: f_list = os.listdir(_nowDir) except FileNotFoundError: print("\n"+_nowDir) sys.exit(1) for fname in f_list: if os.path.isdir(_nowDir + "/" + fname): dir_list....
2763e5877a8f922ce48ac09df89def174aa4aed8
Sean-Xiao-x/new1
/variable.py
1,070
4
4
#message = 'hello world!' #print(message) #name = 'adA lovelace' ##.title () #print(name.title()) ##.upper() #print(name.upper()) ##.lower() #print(name.lower()) #first_name = 'ada' #last_name = 'lovelace' #space = ' ' #full_name = first_name+space+last_name #print(full_name) #print('hello,'+full_name.title()+'!') #...
9e5250d0412bdc7584681d6c63d38bc636a2ef3c
gwyneth-b/searchbot
/backend/boto-develop/frontend/calculator.py
774
4.15625
4
import re class Calculator(object): """this class has a search phrase, the phrase will be checked against a regular expression making sure it is a simple integer expression using only (+-/*) and will evaluate this expression if it is of the correct form""" def __init__(self, phrase): self.phrase = phrase def i...
a7e6fe4b791c23fa13d3d6b15566bbdffc4a1f5a
avirois/Knowledge4S
/static/classes/ForumMessage.py
2,568
3.703125
4
class ForumMessage(): """ Class for object of Forum Message that constructed from ID, CourseID, Date, UserName, Message, PreMessage """ def __init__(self, ID, CourseID, Date, UserName, Message, PreMessage='-1', SubMessages=[]): """Ctor function for object of Forum Message""" self.ID = I...
8f9a93ffae7864ceabb902b7059d4b99b5e8fd25
avirois/Knowledge4S
/static/classes/Faculty.py
668
3.875
4
class Faculty(): """ Class for object of Faculy that constructed from faculty id and name """ def __init__(self, id, name): """Ctor function for object of faculty""" self.id = id self.name = name def getID(self): """The function retruns id of faculty""" retu...
88fdc37b65775b218766655cf45c7502ca1021fd
TaranMNeeld/python-practice
/ReverseArray.py
747
4.15625
4
def reverse_array(arr): # Reverse and return an array without using any built in array functionality newArr = [] solution = 2 if solution == 1: for i in range(1, len(arr) + 1): newArr += arr[-i] return newArr if solution == 2: # Reverse an return the same a...
59a643ab0397b23d4ea4a2e214a39e119d319139
deeptigargb/deeptigargb
/deeptigargb/dags/print_semicolon.py
114
3.875
4
print ("hello") a = 'hello;' \ 'what;' \ 'is;' \ 'your' \ '' for i in a.split(';'): print (i)
827a59dc0b0bbec25f6b26b60404cc2aedde4fb0
Sexyrabbit/A-project
/P4/submit_1/P4_homework.py
9,986
3.78125
4
# coding: utf-8 # # 问题: 有哪些因素会让船上的人生还率更高? # ## 参考文献: # [Calculation and Visualization of Correlation Matrix with Pandas](https://datascience.stackexchange.com/questions/10459/calculation-and-visualization-of-correlation-matrix-with-pandas) # # [Matplotlib Color map](https://matplotlib.org/api/cm_api.html) # # [mat...
b38a7d9358df492a6f3105f63e54ecbe466e2331
Dominicohai/Image-Classifier-AIPND
/get_pet_labels.py
1,438
3.65625
4
# PROGRAMMER: Ohaedoghasi Olisanonso # DATE CREATED: October 7, 2019 # PURPOSE: Create the function get_pet_labels that creates the pet labels from # the image's filename. This function inputs: # - The Image Folder as image_dir within get_pet_labels function and # ...
6b0ee2755affabc9d0f65e553d8edcc70eaeb224
michaelmccoll/W2_WkEnd_Object_Oriented_Karaoke
/classes/guest.py
359
3.53125
4
class Guest: def __init__(self,guest_name,fav_song,wallet): self.guest_name = guest_name self.fav_song = fav_song self.wallet = wallet def reduce_wallet(self,amount): self.wallet -= amount def fav_song_on_list(self,song_list): return [print("Whoohoo") for song i...
1c7546ce3d78110a0cf940df5a1cc6710da80f20
harrychou/personal_notes
/python/03_list_example.py
534
3.78125
4
import sys # Load the sys module # to execute: python 03_list_example.py test.dat if len(sys.argv) != 2: # Check number of command line arguments : print("Please supply a filename") raise SystemExit f = open(sys.argv[1]) # Filename on the command line svalues = f.readlines() # Read all lines into a list f.close() ...
6139e50da6c274b4ca79999ef11c512380d9eafa
Michael-Data-Science-spec/movie_map
/data_from_list.py
1,690
3.90625
4
""" module to work with .list file and extract data from it """ import re import pandas as pd def read_data(file_name='locations.list'): """ reads data from file """ data = open(file_name, 'r') line = data.readline() while line != '==============\n': line = data.readline() data_ls...
85d27abf11a7315303bff5ae286f37f80b1668bf
BorisVV/camelCase
/camelCase.py
1,651
4.3125
4
''' Problem from Lab 1 at MCTC. Program that turns a sentence into camel case. The first word is lowercase, the rest of the words have their initial letter capitalized, and all of the words are joined together. ''' # camelCase = "fOnt proCESSOR and ParsER" def convertToCamelCase(camelCaseSentence): splitCamelCase =...
b0cdd5c8ad2e38b4265a02947ce451b94060323c
HSTing/Prediction-of-Outcomes-in-Animal-Shelter
/divide.py
1,101
3.578125
4
import csv __author__ = 'Shih-Ting Huang', 'Wei-Yao Ku' """ CSCI-630: Final Project Author: Shih-Ting Huang (sh3964), Wei-Yao Ku(wxk6489) Extract dog and cat data """ def main(): """ Extract dog and cat data :return: None """ i = 0 filename = input() with open(filename + '.csv', newline=...
98c94d0bacdae45c8147111ec9d15b09cb5abfec
sam-iitj/HackerRankMachineLearning
/botclean.py
792
3.734375
4
#!/usr/bin/python def next_move(posr, posc, board): def funct(key): return abs(posr-key[0]) + abs(posc-key[1]) indexes = [] for i in range(5): for j in range(5): if board[i][j] == "d": indexes += [[i, j]] indexes = sorted(indexes, key=funct) targ...
74f227ef47e649f894b98352dd86d7aaa031de99
Cipalex/session3
/Classes.py
1,690
4.25
4
class car: def __init__(self, name, year): self.name = name self.year = year def __repr__(self): """This is called when print of class is executed""" return f'Car with name {self.name} made in {self.year}' c1 = car('Dacia', 1990) c2 = car('Opel', 1999) print(c1.name, c1.year) ...
49676d2bf31354b1787ee698400c7c55c4cd6ddc
hacktoolkit/code_challenges
/project_euler/python/079.py
3,465
3.671875
4
"""http://projecteuler.net/problem=079 Passcode derivation A common security method used for online banking is to ask the user for three random characters from a passcode. For example, if the passcode was 531278, they may ask for the 2nd, 3rd, and 5th characters; the expected reply would be: 317. The text file, [keyl...
1ed27b49caaf3eb846c2dbfa4e255b94cca4dc1e
hacktoolkit/code_challenges
/project_euler/python/148.py
3,610
3.59375
4
"""http://projecteuler.net/problem=148 Exploring Pascal's triangle We can easily verify that none of the entries in the first seven rows of Pascal's triangle are divisible by 7: 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 However, if we check the first one hundred rows, we will find that only 2361 ...
004898167ee21b8fd7ace8dcfdf12ff834e2cff1
hacktoolkit/code_challenges
/project_euler/python/038.py
1,758
3.84375
4
"""http://projecteuler.net/problem=038 Pandigital multiples Take the number 192 and multiply it by each of 1, 2, and 3: 192 x 1 = 192 192 x 2 = 384 192 x 3 = 576 By concatenating each product we get the 1 to 9 pandigital, 192384576. We will call 192384576 the concatenated product of 192 and (1,2,3) The same can be ac...
47a93cc10bcf67a2152684c308ce349e0debfab0
hacktoolkit/code_challenges
/project_euler/python/089.py
1,569
3.9375
4
"""http://projecteuler.net/problem=089 Roman numerals The rules for writing Roman numerals allow for many ways of writing each number (see About Roman Numerals...). However, there is always a "best" way of writing a particular number. For example, the following represent all of the legitimate ways of writing the num...
09ce3089ee9295a935a965d5fcc5e9f7f5ab035f
hacktoolkit/code_challenges
/project_euler/python/032.py
1,784
3.8125
4
"""http://projecteuler.net/problem=032 Pandigital products We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once; for example, the 5-digit number, 15234, is 1 through 5 pandigital. The product 7254 is unusual, as the identity, 39 x 186 = 7254, containing multiplicand,...
497e98398ee10a7484fab6573a3e31cf715cf0e4
hacktoolkit/code_challenges
/project_euler/python/085.py
2,295
3.90625
4
"""http://projecteuler.net/problem=085 Counting rectangles By counting carefully it can be seen that a rectangular grid measuring 3 by 2 contains eighteen rectangles: - 6 1x1 - 4 1x2 - 2 1x3 - 3 2x1 - 2 2x2 - 1 3x2 Although there exists no rectangular grid that contains exactly two million rectangles, find the area...
5f30c87c621e42443fbe5d6e4786efe99e92b141
hacktoolkit/code_challenges
/project_euler/python/745.py
2,254
3.6875
4
#!/usr/bin/env python3 """https://projecteuler.net/problem=745 Sum of Squares For a positive integer, n, define g(n) to be the maximum perfect square that divides n. For example, g(18) = 9, g(19) = 1. Also define S(N) = \sum_{n=1}^N g(n) For example, S(10) = 24 and S(100) = 767. Find S(10^{14}). Give your an...
82a713874f5cb2a1e5a21a066bf675c86b759bac
hacktoolkit/code_challenges
/project_euler/python/019.py
1,008
3.8125
4
"""http://projecteuler.net/problem=019 Counting Sundays You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or shin...
afbe873eaa8d062e56b56f97b1e1945a4957e8c9
hacktoolkit/code_challenges
/companies/pagerduty/bst_compare.py
1,930
3.859375
4
class BST: def __init__(self, bst_node): self.head = bst_node class BSTNode: def __init__(self, value, left_child = None, right_child = None): self.value = value self.left = left_child self.right = right_child class LL: def __init__(self): self.head = No...
b5241d6003aa469b7dc3e327844b69979c06a69b
hacktoolkit/code_challenges
/project_euler/python/020.py
452
3.875
4
"""http://projecteuler.net/problem=020 Factorial digit sum n! means n (n 1) ... 3 2 1 For example, 10! = 10 9 ... 3 2 1 = 3628800,and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. Find the sum of the digits in the number 100! Solution by jontsai <hello@jontsai.com> """ from ut...
298ee79ee0a4f3fd828c8d432ae8cfc685d8b86f
hacktoolkit/code_challenges
/project_euler/python/022.py
1,050
3.84375
4
"""http://projecteuler.net/problem=022 Names scores Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical positio...
f8351a92804a42b1908a1af0be64d90dbe96ea56
Nax316/first-repo
/Assignments/assignment07.py
243
3.859375
4
# Assignment 7 : x=10 y=11 print("Values of x and y is",x,"and", y) x,y=y,x print("Values of x and y is",x,"and", y) # ======================OUTPUT========================= # Values of x and y is 10 and 11 # Values of x and y is 11 and 10
d1b5e053e355e6ec8d160509d89557ac62e192f4
Nax316/first-repo
/Assignments/assignment38.py
651
3.796875
4
# Assignmnet 38: Write a program to show pass by refrence method def compare(phoenix_to_slc , phoenix_to_tampa): if phoenix_to_slc > phoenix_to_tampa: print ("SLC is far from Phoenix as compared to Tampa, Florida") elif (phoenix_to_slc < phoenix_to_tampa): print ("Tampa,Florida is far from Phoen...
ee7869e8265a982f1d0ebb20b44e29d77e752f0e
Nax316/first-repo
/Assignments/assignment59.py
1,610
3.9375
4
# Assignment 59 : Run the program and observe the output class PrintDetails: def printheader(self, c, no=1): print(c*no) class PurchaseBill: def __init__(self, bid, billamount): self.__billid = bid self.__billamount = billamount def getbillid(self): return self.__billid ...
61b806810e313cadda8ee2df38d999bd4e831df4
Nax316/first-repo
/Assignments/assignment23.py
436
3.5
4
# Assignment 23 : string1 = "Infosys Limited" string2 = "Mysore" print(string1[:4]) print(string1[-1]) print(string1 * 2) print(string1[:-1] + string2 + string1[:-1]) print(string2[1]) print(string2[4]) print(string1 * 2 + string1[:1] + string2) # ======================OUTPUT========================= # Info # d # In...
eff7c854749c2bb9739217e504d272234c4fcda0
Nax316/first-repo
/Assignments/assignment60.py
3,045
3.6875
4
# Assignment 60 : Implementation of association relationship using a retail application scenario class customer : counter = 1000 #class variable def __init__(self, telephoneno, customername, add): customer.counter += 1 self.__customerid = customer.counter self.__customername = customerna...
a7eb472405d0a4325b78018f80cd4da9a589adfd
Nax316/first-repo
/Assignments/assignment56.py
2,501
3.90625
4
# assignment56: Program on Inheritance class Customer: def __init__(self, id=0, name=None): self.__customerid=id self.__customername=name def setcustomerid(self, id): self.__customerid = id def setcustomername(self, name): self.__customername = name def getcustomerid(...
f385805e2c5f1652e7e4adef313a585b6d1f11b2
nandhinisundar/tasks-in-python
/datastructures.py
592
4.0625
4
laptop=['hp','dell'] laptop.insert(1,'apple') top=laptop[0]; print(laptop) dict={'@':01,'&':02,'$':03} print(dict['$']) for i in dict: print(i) class Queue: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def enqueue(self, item): self.items.i...
847e1c24e7d5bba8da2b8491b08ab8a8483991b9
kennyfrc/pybasics
/lmpthw/solutions/ex39_sql_create/test.py
794
4
4
class Person(object): def __init__(self, first_name, last_name, age, pets): self.first_name = first_name self.last_name = last_name self.age = age self.pets = pets class Pet(object): def __init__(self, name, breed, age, dead): self.na...
75fda664cb9e8f4d367477db7b267c76e41bcf16
stradtkt/Making-Tuples
/making_tuples.py
212
3.859375
4
my_dict = { "Speros": "(555) 555-5555", "Michael": "(999) 999-9999", "Jay": "(777) 777-7777" } def make_tuple(the_dict): the_tuple = list(tuple(the_dict.items())) print(the_tuple) make_tuple(my_dict)
c3db86107413657fcbd4775839f5eaef9ec8af37
Single430/pyecharts
/pyecharts/charts/parallel.py
2,425
3.546875
4
#!/usr/bin/env python # coding=utf-8 from pyecharts.base import Base class Parallel(Base): """ <<< Parallel chart >>> Parallel Coordinates is a common way of visualizing high-dimensional geometry and analyzing multivariate data. """ def __init__(self, title="", subtitle="", **kwargs): ...
350e7a6ad1af058c5f343c69a42334b7753b11d4
ravi-kumar7/Power-Programmer
/Basic/Reformed String/code_python.py
740
3.640625
4
import re def modify_sentence(array): for i in range(len(array)): word=array[i] length=len(word) if (i+1)%2!=0: front=0 end=length-1 new_word=[None for i in range(length)] for j in range(len(word)): if (j+1)%2==0: ...
b77abc4bbcb3e5b60dd2d71745b274208d325387
ravi-kumar7/Power-Programmer
/Dynamic Programming/Coin Change/code_python.py
743
3.53125
4
def coin_change(amount, denominations, denom_count, memory): if amount==0: return 1 if amount<1 or denom_count==0: return 0 if memory[amount][denom_count] is None: first = coin_change(amount-denominations[0], denominations, denom_count, memory) second = coin_change(amount, de...
7c6f7404fd530bb6b799f7463b2aa9ddcc5c1926
cosmosZhou/sympy
/axiom/algebra/et/given/et/mul/ne_zero/eq.py
612
3.5625
4
from util import * @apply def apply(given): is_nonzero, eq = given.of(And) if not eq.is_Equal: is_nonzero, eq = eq, is_nonzero x = is_nonzero.of(Unequal[0]) a, b = eq.of(Equal) return is_nonzero, Equal((a * x).expand(), (b * x).expand()).simplify() @prove def prove(Eq): from axiom im...
da37f56692f08406244b1068dcb0b87bb04d5e0b
cosmosZhou/sympy
/axiom/algebra/gt_zero/lt_zero/imply/lt_zero.py
357
3.640625
4
from util import * @apply def apply(is_positive_x, is_negative_y): x = is_positive_x.of(Expr > 0) y = is_negative_y.of(Expr < 0) return Less(x * y, 0) @prove def prove(Eq): x, y = Symbol(real=True) Eq << apply(x > 0, y < 0) Eq << -Eq[1] * Eq[0] Eq << -Eq[-1] if __name__ == '__main__...
3b71448767b97b26fd7102b09cf3a9c3e263c11d
cosmosZhou/sympy
/axiom/algebra/gt/given/gt/relax.py
539
3.609375
4
from util import * @apply def apply(given, lower=None, upper=None): lhs, rhs = given.of(Greater) if lower is not None: assert lower <= lhs lhs = lower elif upper is not None: assert upper >= rhs rhs = upper return Greater(lhs, rhs) @prove def prove(Eq): from axio...
801e4354c30445ead495a2af1b4db3222a985c24
cosmosZhou/sympy
/axiom/algebra/le_zero/ge_zero/imply/is_zero.py
389
3.546875
4
from util import * @apply def apply(is_nonpositive, is_nonnegative): x = is_nonnegative.of(Expr >= 0) _x = is_nonpositive.of(Expr <= 0) assert x == _x return Equal(x, 0) @prove def prove(Eq): x = Symbol(real=True) Eq << apply(x <= 0, x >= 0) Eq <<= Eq[0] & Eq[1] Eq << Eq[-1].simpl...
79a3d7b3897c4633ed3df9d1b1d746525d23524a
cosmosZhou/sympy
/axiom/algebra/lt/gt/imply/lt/abs/both.py
728
3.65625
4
from util import * @apply def apply(x_less_than_y, x_greater_than_y_minus): x, y = x_less_than_y.of(Less) _x, _y = x_greater_than_y_minus.of(Greater) assert x == _x assert y + _y == 0 return Less(abs(x), abs(y)) @prove def prove(Eq): from axiom import algebra y, x = Symbol(real=True) ...
256815484e810e56e9dfa2951a3c86ffba09bd4f
cosmosZhou/sympy
/axiom/algebra/ge/ge/imply/ge_zero.py
488
3.640625
4
from util import * @apply def apply(greater_than, less_than): x, a = greater_than.of(GreaterEqual) y, b = less_than.of(GreaterEqual) return GreaterEqual((x - a) * (y - b), 0) @prove def prove(Eq): from axiom import algebra x, y, a, b = Symbol(real=True) Eq << apply(x >= a, y >= b) Eq ...
20bfacb7012cf7e46644fa6c8aed6e4f98f5264e
cosmosZhou/sympy
/axiom/algebra/ge/le/imply/eq.py
381
3.546875
4
from util import * @apply def apply(greater_than, less_than): a, b = greater_than.of(GreaterEqual) _a, _b = less_than.of(LessEqual) assert a == _a assert b == _b return Equal(a, b) @prove def prove(Eq): a, b = Symbol(real=True) Eq << apply(a >= b, a <= b) Eq <<= Eq[0] & Eq[1] ...
5094b4c3ea9d28aced596121051a622c5aab706e
cosmosZhou/sympy
/axiom/algebra/ge/ge/imply/ge/mul.py
578
3.8125
4
from util import * @apply def apply(a_less_than_b, x_less_than_y): a, b = a_less_than_b.of(GreaterEqual) x, y = x_less_than_y.of(GreaterEqual) assert b.is_nonnegative assert y.is_nonnegative return GreaterEqual(a * x, b * y) @prove def prove(Eq): from axiom import algebra a, x = Symbol...
fda771a7d5f235a09c8d526714626c9e2e06fc1e
cosmosZhou/sympy
/axiom/algebra/lt/lt/imply/lt/abs/mul.py
531
3.65625
4
from util import * @apply def apply(x_less_than_a, y_less_than_b): abs_x, a = x_less_than_a.of(Less) abs_y, b = y_less_than_b.of(Less) x = abs_x.of(Abs) y = abs_y.of(Abs) return Less(abs(x * y), a * b) @prove def prove(Eq): from axiom import algebra x, y, a, b = Symbol(real=True) ...
6da2fdc2bed80e251728abad3af0a7877ad76a10
cosmosZhou/sympy
/axiom/sets/all_ne/imply/notin/__init__.py
714
3.5625
4
from util import * @apply def apply(given): (x, y), (lhs, *rhs) = given.of(All[Unequal]) if len(rhs) == 2: rhs = Range(*rhs) if lhs.is_integer else Interval(*rhs) else: [rhs] = rhs if x == lhs: return NotElement(y, rhs) if y == lhs: return NotElement(x, rhs) @pro...
14aacec2b3594757e0591502e6c706864daf2b76
cosmosZhou/sympy
/axiom/algebra/arg_expi/to/mul/arg.py
678
3.5625
4
from util import * @apply def apply(self): z, r = self.of(Arg[Exp[ImaginaryUnit * Arg * Expr]]) assert r <= 1 and r >= -1 or 1 / r >= 1 or 1 / r <= -1 return Equal(self, Arg(z) * r) @prove def prove(Eq): from axiom import algebra n = Symbol(integer=True, positive=True) z = Symbol(complex=Tr...
42c710335a13e6668ff72cd2a147947168c6b310
cosmosZhou/sympy
/axiom/keras/eq_sigmoid/imply/eq/residual/gated_linear_unit.py
988
3.546875
4
from util import * @apply def apply(eq): (x, (hx, fx)), gx = eq.of(Equal[Symbol + Mul[sigmoid]]) assert x.is_symbol assert gx._has(x) and fx._has(x) and hx._has(x) [n] = x.shape return Equal( Derivative[x](gx), Identity(*x.shape) + (Derivative[x](fx) * (1 - sigmoid(fx)) * Identity(...
af037d88794b2a999f97faac48d1d37dbd2e417b
cosmosZhou/sympy
/axiom/algebra/ne_zero/ne/imply/ne/scalar.py
548
3.609375
4
from util import * @apply def apply(unequality, eq): assert eq.is_Unequal assert unequality.is_Unequal unequality.rhs.is_zero divisor = unequality.lhs return Unequal(eq.lhs / divisor, eq.rhs / divisor) @prove def prove(Eq): from axiom import algebra x, a, b = Symbol(real=True) Eq <...
0639b69dbfa2c090dfde978ef8750cafba6b8200
cosmosZhou/sympy
/axiom/algebra/cond/cond/ou/given/ou.py
754
3.71875
4
from util import * @apply def apply(cond1, cond2, ou): if not ou.is_Or: if cond2.is_Or: cond2, ou = ou, cond2 elif cond1.is_Or: cond1, ou = ou, cond1 else: return args = ou.of(Or) cond = cond1 & cond2 return Or(*((arg & cond).simplify() for...
02b07704cbd0487ad66be31d3d8181434bedb363
cosmosZhou/sympy
/axiom/algebra/eq/ge/imply/ge/add.py
445
3.78125
4
from util import * @apply def apply(eq, x_less_than_b): if not eq.is_Equal: eq, x_less_than_b = x_less_than_b, eq a, x = eq.of(Equal) b, y = x_less_than_b.of(GreaterEqual) return GreaterEqual(a + b, x + y) @prove def prove(Eq): a, x, b, y = Symbol(real=True) Eq << apply(Equal(a, x)...
758c0164f41b2ebffd0d4b8b10ab8cd0f1950169
cosmosZhou/sympy
/axiom/algebra/eq_pow/eq_ceiling/imply/eq/cubic_root.py
2,192
3.6875
4
from util import * def cubic_root(A): res = A.of(Expr ** 3) if res is not None: return res args = [] for arg in A.of(Mul): if arg.is_Pow: args.append(arg.of(Expr ** 3)) elif arg.is_Rational: p, q = arg.p, arg.q if p < 0: p = ...
4ad1227477ee02125d04a25696a8f354e9c82a71
cosmosZhou/sympy
/sympy/matrices/expressions/determinant.py
3,168
4
4
from sympy import Basic, Expr, S, sympify class Determinant(Expr): """Matrix Determinant Represents the determinant of a matrix expression. Examples ======== >>> from sympy import MatrixSymbol, Det, eye >>> A = MatrixSymbol('A', 3, 3) >>> Det(A) Det(A) >>> Det(eye(3)).doit() ...
d4789483cf745eaf67b0c0b52fc34d00896122a8
cosmosZhou/sympy
/sympy/matrices/expressions/transpose.py
9,606
3.765625
4
from sympy import Basic from sympy.functions import adjoint, conjugate from sympy.matrices.expressions.matexpr import MatrixExpr from sympy.core.sympify import _sympify class Transpose(MatrixExpr): """ The transpose of a matrix expression. This is a symbolic object that simply stores its argument withou...
efad046b702b1e96b4fa2bd8549a6f488acdd203
cosmosZhou/sympy
/axiom/algebra/ge_zero/gt/imply/gt/sqrt.py
970
3.5
4
from util import * @apply def apply(is_nonnegative, gt): x = is_nonnegative.of(Expr >= 0) y, S[x] = gt.of(Greater) return Greater(sqrt(y), sqrt(x)) @prove def prove(Eq): from axiom import algebra x, y = Symbol(real=True) Eq << apply(x >= 0, y > x) Eq << algebra.gt.ge.imply.gt.transit.a...
29aad6953866cfd1a8a5cecedb72cbdb2e828560
cosmosZhou/sympy
/axiom/algebra/ge_zero/lt/imply/floor_is_zero.py
787
3.5625
4
from util import * @apply def apply(is_nonnegative, less_than): if not less_than.is_Less: less_than, is_nonnegative = given x = is_nonnegative.of(Expr >= 0) _x, M = less_than.of(Less) assert x == _x return Equal(Floor(x), 0) @prove def prove(Eq): from axiom import algebra x = ...
feab85581301b11c4291ec7c99d697620b0e0de5
Tele-Pet/informaticsPython
/Homework/Week 4/bookExercise4.6_v2.py
1,037
4.25
4
# Exercise 4.6 Rewrite your pay computation with time-and-a-half for overtime and create a function called computepay which takes two parameters (hours and rate). # Enter Hours: 45 Enter Rate: 10 Pay: 475.0 def computepay(hours, rate): if hours > 40: overtime = hours % 40 pay = ((overtime * 1.5) * rate) + (40 *...
70986bbe5fb7a1ad4336314d4bf8e5a99fea447b
Tele-Pet/informaticsPython
/Homework/Week 5/bookExercise5.2_viaOldSkool_v2.py
592
3.984375
4
# Exercise 5.2 Write another program that prompts for a list of numbers as above # and at the end prints out both the maximum and minimum of the numbers instead # of the average. # sys.maxint The largest positive integer supported by Python’s regular integer # type. This is at least 2**31-1. The largest negative integ...
43a64f71918228a25fc2c58aeb1c3c4a2ac553b4
Tele-Pet/informaticsPython
/Homework/Week 7: Files/bookExercise7.2_v1.py
1,053
4.09375
4
# Write a program to prompt for a file name, and then read through the file and # look for lines of the form: X-DSPAM-Confidence: 0.8475 # When you encounter a line that starts with “X-DSPAM-Confidence:” pull apart the # line to extract the floating point number on the line. Count these lines and the # compute the tot...
67fdcd90866941fdae2dda168cf4a3bce303ddb1
vincentdavis/special-sequences
/seqs/Bipartite.py
1,713
3.6875
4
"""Bipartite.py Two-color graphs and find related structures. D. Eppstein, May 2004. """ from seqs import Graphs from seqs.Biconnectivity import BiconnectedComponents from seqs import DFS class NonBipartite(Exception): pass def TwoColor(G): """ Find a bipartition of G, if one exists. Raises NonBi...
42797139b042b205b55a9fbea6b757a526783eb8
jimbrayrcp/Pong_Game
/pong/scoreboard.py
1,636
3.984375
4
# ################################ # Copyright (c) 2021 Jim Bray # All Rights Reserved # ################################ from turtle import Turtle FONT = ("courier", 80, "normal") ALIGN = "center" class Scoreboard(Turtle): def __init__(self): super(Scoreboard, self).__init__() self.penup...
eef3c0993bf651d12e2a1c3e85a72f38a2121495
robert-dzikowski/pyspecs
/pyspecs/_should.py
4,907
3.515625
4
class _Should(object): """ Should-style assertion class. """ def __init__(self, value): self._value = value self._invert = None self._expect = None @property def should(self): self._invert = False self._expect = EXPECTED return self @property...
3292a564ee5555c7ea7aab04895dd290050d1f10
Dishikagoel/MatrixCalculator
/main.py
3,238
4.03125
4
def PrintMatrix(Matrix): for row_index, row in enumerate(Matrix[1:]): for element_index, element in enumerate(row): print("{} ".format(' ' * (Matrix[0][element_index] - len(element)) + element), end="") if row_index < len(Matrix) - 2: print("") def Matrix_Input(m, ...
aa9e47a6c4e669998a5f0f73d8adc17fb38be3d8
fongsoul/hexo-circle-of-friends
/component/getTime.py
1,391
3.8125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ 处理时间相关作用的组件 """ import re # 时间查找(中文、标准) def time_zero_plus(tempStr:str): """ 时间查找(中文、标准) :param tempStr: str, :return: str """ if len(tempStr) < 2: tempStr = '0' + tempStr return tempStr def find_time(tempStr:str): time = '' ...
ccf65ab989f4922045de9641f2539f8226e6e1eb
j-clarisse/HighSchool-Python-Lessons
/2.Concatenation_Typecasting/names.py
420
4.4375
4
# Name: Names Program # Date: # Author: # Description: Program asks the user for their first name and then asks for their last name. The program must then print these together. # HINT: Use the input() function (don’t forget to store it in a variable) and remember to concatenate (‘,’ or ‘+’)!! # Answer: first = inpu...
c4c4b79e3cc9c10a3dd68dc671186d3d1a0959b4
carty64/Jeff-Repo
/listy.py
484
3.625
4
import random def func(): try: x = int(raw_input('Please enter an integer less than 20: ')) if x > 20: l = random.sample(range(1,21),x) print l deets = [] while len(l)>0: y = int(raw_input('Select a postion: '))-1 while y + 1> len(l): y = int(raw_input('Out o...
101984ba8119b03efe384ec993ca4b89c7a3fd62
nikhil1699/cracking-the-coding-interview
/python_solutions/chapter_04_trees_and_graphs/problem_04_08_first_common_ancestor.py
2,148
3.90625
4
""" Chapter 04 - Problem 08 - First Common Ancestor Problem Statement: Design an algorithm and write code to find the first common ancestor of two nodes in a binary tree. Avoid storing additional nodes in a data structure. Assume that this tree is not necessarily a binary search tree. Assume that nodes in the tree do...
385d0c8680f32f61cf336f73eb0f7f49560ed7e0
nikhil1699/cracking-the-coding-interview
/python_solutions/chapter_04_trees_and_graphs/problem_04_02_make_bst.py
982
4
4
''' Chapter 04 - Problem 02 - Minimal Tree Problem Statement: Given a sorted (increasing order) array with unique integer elements, write an algorithm to create a binary search tree with minimal height. Solution: To create a minimal height BST, the input array must be traversed according to the binary search algorith...
54f01fa381a02108e914a1b518fc49b832d8c0f9
nikhil1699/cracking-the-coding-interview
/python_solutions/chapter_04_trees_and_graphs/problem_04_10_check_subtree.py
1,565
3.953125
4
""" Chapter 04 - Problem 10 - Check Subtree Problem Statement: T1 and T2 are two very large binary trees, with T1 much bigger than T2. Create an algorithm to determine if T2 is a subtree of T1. A tree T2 is a subtree of T1 if there exists a node n in T1 such that the subtree of n is identical to T2. That is, if you cu...
3fee8a6c59cc3e9fefac803de28730028c60d082
nikhil1699/cracking-the-coding-interview
/python_solutions/chapter_03_stacks_queues/problem_03_06_animal_shelter.py
3,162
3.9375
4
""" Chapter 03 - Problem 6 - Animal Shelter Problem Statement: An animal shelter, which holds only dogs and cats, operates on a strictly "first in, first out" basis. People must adopt either the "oldest"(based on arrival time) of all animals at the shelter, or they can select whether they would prefer a dog or a cat (...
e56bc8082100370816dc02838a910599a880998d
nikhil1699/cracking-the-coding-interview
/python_solutions/chapter_04_trees_and_graphs/problem_04_07_build_order.py
2,914
4.125
4
""" Chapter 04 - Problem 07 - Build Order Problem Statement: You are given a list of projects and a list of dependencies (which is a list of pairs of projects, where the second project is dependent on the first project). All of a project's dependencies must be built before the project is. Find a build order that will ...
cb40580a6c575cfd4f16d00b3ec3f855fa5a1da1
nikhil1699/cracking-the-coding-interview
/python_solutions/chapter_01_arrays_and_strings/problem_01_05_one_away.py
2,381
4.09375
4
""" Chapter 01 - Problem 05 - One Away - CTCI 6th Edition page 91 Problem Statement: There are three types of edits that can be performed on strings: insert a character, remove a character, or replace a character. Given two strings, write a function to check if they are one edit (or zero edits) away. Example: pale, p...
fc9cb76081cfdf326726d5befe2f840011d4426f
nikhil1699/cracking-the-coding-interview
/python_solutions/chapter_01_arrays_and_strings/problem_01_04_palindrome_permutation.py
2,436
4.09375
4
""" Chapter 01 - Problem 04 - Palindrome Permutation - CTCI 6th Edition page 91 Problem Statement: Given a string, write a function to check if it is a permutation of a palindrome. A palindrome is a word or phrase that is the same forwards and backwards. A permutation is a rearrangement of letters. The palindrome does...
a691643e2f9af4d5734448b5d614cb12dda199b7
Ajedigray/fullstack-nanodegree-vm
/logs_analysis_project/logsdb.py
3,544
3.546875
4
#!/usr/bin/env python2.7 from __future__ import division import datetime import psycopg2 DBNAME = 'news' b = "\033[1m" r = "\033[0;0m" bullet = " " + u'\u2022 ' views = ' views' def header(): """header prints the header text for the rporting tool""" print (b + "\nReporting Tool for the News Database\n"...
4c238146b06ea6cfe21e80801b11851ea512e841
Elzanaomi/Elza-Naomi-Alifah-Zain_I0320032_Tiffany-Bella_Tugas-6
/I0320032_Soal 2_Tugas 6.py
320
3.578125
4
# input jumlah data n = int(input("\nBanyaknya Data: ")) # input data print() # Membuat baris baru data = [] jum = 0 #hasil for i in range(0, n): temp = int(input("Masukkan data ke-%d: " % (i + 1))) data.append(temp) jum += data[i] rata2 = jum / n print("\nRata-rata = %0.2f" % rata2)
8bc1524c67af607e6a23e798996516f8dca88079
kmgaurav2611/GFG_Solutions
/extra/sol.py
504
3.796875
4
def printArray(arr, size): for i in range(size): print(arr[i], end = " ") print() return def getSuccessor(arr, k, n): p = k - 1 while (arr[p] == n and 0 <= p < k): p -= 1 if (p < 0): return 0 arr[p] = arr[p] + 1 i = p + 1 while(i < k): arr[i] = 1 i += 1 return 1 def printSequences(n,...
834decca1105d8117c87373251c817a71b932303
EtienneMela/Algo_IIM
/Jour 2 & 3/startCafe.py
824
3.5
4
from BlockChain import BlockChain def startBlockchain(*args): blockchain = BlockChain() [blockchain.add(arg) for arg in args] return blockchain def printBlocks(blockchain): i = 0 while i < len(blockchain.chain): print(blockchain.getFormattedBlock(i)) i += 1 # -- Start the blockcha...
d31ab4dc06fc6ea0ac1f91eec629f7c595ef9f31
EtienneMela/Algo_IIM
/Jour 1/shell_sort.py
1,282
3.640625
4
# TRI DE SHELL # Le tri de Shell trie chaque liste d'éléments séparés de n positions chacun avec le tri par insertion. # L'algorithme effectue plusieurs fois cette opération en diminuant n jusqu'à n=1 ce qui équivaut à trier tous les éléments ensemble. import time, sys def shell_sort(array): comparaisons = iter...
786abe29117c53e75da294284c93c62a3189616a
clhoneycutt/CodingDojo
/Python/python_OOP/animal.py
1,162
3.828125
4
class animal: def __init__(self, name, health=100): self.name = name self.health = health def walk(self): self.health -= 1 return self def run(self): self.health -= 5 return self def display_health(self): print("Health: ", self.health) # dog =...
d8d1a7ff60ba2a9497e4c26eea7d4f6a24807f8a
DataScienceGU/Collecting_Data
/MassShootingDataCleanliness.py
1,788
3.625
4
import pandas as pd in_filename = 'mass_shootings.csv' bad_data_filename = 'bad_data_for_mass_shootings.txt' # Specifically, you should identify missing and incorrect values. # You can then record: # • The fraction of missing values for each attribute. # • The fraction of noise values, e.g. gender = ‘fruit’. # Missi...