blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
c725fe6593e00577464ac362d49b159b4f3b5c2a
OJRR-91/Python
/secon_poor.py
1,064
3.5625
4
num=int(input()) lista_Cal=[] for i in range(num): nombre=input() Calificacion=float(input()) lista=[Calificacion,nombre] lista_Cal.append(lista) lista_Cal.sort() while(True): n=0 if lista_Cal[n][0]!=lista_Cal[n+1][0]: if lista_Cal[n+1][0]==lista_Cal[n+2][0]: print("{}".f...
ee57d6cc5c897691b85a483d1303ee5aac86bfd4
miraclesumail/python-study
/eg9.py
2,060
3.796875
4
# coding=utf-8 import time from functools import wraps # A simple decorator def timethis(func): @wraps(func) def wrapper(*args, **kwargs): start = time.time() r = func(*args, **kwargs) end = time.time() print(end-start) return r return wrapper # Class illustrating ...
87e434a67794924a44e7e69bf610bf31a8db4ba6
Vivek-DataScientist/assignments
/text mining/tex.py
2,993
3.53125
4
import requests # Importing requests to extract content from a url from bs4 import BeautifulSoup as bs # Beautifulsoup is for web scrapping...used to scrap specific content import re # regular expressions from nltk.corpus import stopwords #importing stopwords import matplotlib.pyplot as plt #importing plots from w...
7b00eeb8b64b2a82868481b3a960cf37ef2c83eb
max-fex/QAHelpers
/Checking ProductID against shortened URL.py
1,303
3.53125
4
""" This script is designed for getting product IDs by shortened URLs. E.g. when opening short link https://r.zdbb.net/u/6t80 user is redirected to full path: https://www.amazon.com/gp/product/B003N9M6YI The last part of full path is the required ProductID: B003N9M6YI. """ # Importing "request" module ...
88aeb3ef2d586230d3ac8f419c18240e7f187cc5
NWScraper/nws
/tools/search_url.py
1,436
3.515625
4
""" Script to check if sites are responding. :var str input_file: Path to input TXT file (one search query per line) :var str output_file: Path to CSV output file to create """ import csv from urllib.parse import urlparse from googlesearch import search # https://github.com/MarioVilas/googlesearch # files used: input...
d36a975ec02fb78680db10662fa893782100f92b
minwei1997/PrepareDataByJson
/utils/DataAug_Rot_funciton.py
8,858
3.515625
4
import numpy as np from numpy import random import cv2 def rotate_im(image, angle): """Rotate the image. Rotate the image such that the rotated image is enclosed inside the tightest rectangle. The area not occupied by the pixels of the original image is colored black. Parameters ---...
a4ea92591693c1a1f9bb4ef2e2c794a701920b92
Aletrip-dev/impacta2
/2 - SEGUNDO SEMESTRE/LP2/Aulas/003_Aula3.py
1,042
4.0625
4
#listas '''dados = [1,2,3] mult = dados[1] * dados[2] print (mult)''' #dicionários # dicio vazio == dados = {} '''dados ={1:"Alex",2:"João"} print (dados[1])''' '''clientes = [] clientes.append("Alex") #adiciona a lista clientes.append("João") clientes.append("Carlos") clientes.append("Marcos") clientes.remove("Alex...
8ea2288b722952bdbac7a14a42ffd4385c483989
wenjiejiang-1993/teamwork
/products1.py
942
3.515625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat May 30 20:07:32 2020 @author: jiangwenjie """ def relevant(products, preferences): checklist=products.copy() for i in range(0,len(products)): p1 = products[i] plist2 = products.copy() plist2.remove(p1) poutput=[...
3aacc2aa76a45af7adf4d7e87b34801e84a2bd5d
mehtasahil31/CSC-591-ASE
/hw/2/Num.py
3,088
3.640625
4
import random from Col import Col class Num(Col): # Initializing def __init__(self, pos, oid, txt): # super(Num, self).__init__() self.pos = pos self.oid = oid self.txt = txt self.mu = self.m2 = self.sd = 0 self.lo = 10**32 self.hi = -1*self.lo s...
362165525e6718eeef6016e6d08147faf5977346
kazanture/leetcode_tdd
/leetcode_tdd/longest_subs_wout_rpt_chars.py
864
3.875
4
""" https://leetcode.com/problems/longest-substring-without-repeating-characters/ Given a string, find the length of the longest substring without repeating characters. """ class LongestSubsWOutRpt: @staticmethod def length_of_longest_substring(input_str): seen = {} max_sub_length = 0 c...
d4fa12d02ba4c3a42bbd7c1be821fe0045eadaa4
susanqisun/test
/app.py
389
3.515625
4
import streamlit as st import pandas as pd import numpy as np import models_app df = pd.read_csv('https://raw.githubusercontent.com/susanqisun/test/main/movie_list_final.csv') movie_title = st.selectbox( 'Please scroll down to see the list of movies and Select a movie you like to get recommendations.', ...
c867c8a880e3dcb052e515d3d12e930e73a21ed1
Prashant-Bharaj/A-December-of-Algorithms
/December-14/py_imhphari.py
407
4.21875
4
def encrypt(text,s): result = "" for i in range(len(text)): char = text[i] if (char.isupper()): result+=chr((ord(char)+s-65)%26+65) else: result+=chr((ord(char)+s-97)%26+97) return result text = input("Enter string:") s = 3 print ("Input: ...
74333e1703da00835d780b10b90a5dc812b7cb0a
Prashant-Bharaj/A-December-of-Algorithms
/December-10/py_anuppriya_determinant.py
372
3.890625
4
import numpy as np m=int(input("Enter the no of rows:")) n=int(input("Enter the no of columns:")) mat=[] for i in range(0,n): mat.append([]) for i in range(0,m): for j in range(0,n): mat[i].append(j) mat[i][j]=0 for i in range(0,m): for j in range(0,n): mat[i][j]=int...
3df5cc66d02b5bc038f2a7703832404d1c6fc862
Prashant-Bharaj/A-December-of-Algorithms
/December-30/python_drstrange11.py
163
3.96875
4
# Dec 30 sides = int(input('Enter the sides: ')) print(f"Number of diagonals = {sides*(sides-3)//2}") # SAMPLE I/O # Enter the sides: 4 # Number of diagonals = 2
fb3f388b9b5c39c0f4148a6cfe69656509e18d9b
Prashant-Bharaj/A-December-of-Algorithms
/December-02/python_AkshayaRC.py
961
3.796875
4
side1=s1=angle1=a1=[] sss=sas=aaa=0 side2=s2=angle2=a2=[] side1=sorted(input("enter sides of triangle1 (seperated by comma)").split(",")) s1=[int(i) for i in side1] side2=sorted(input("enter sides of triangle2").split(",")) s2=[int(i) for i in side2] angle1=sorted(input("enter angles of triangle1").split(",")) ...
0acfcda2b63610658524e80be13a4b21b7a74c69
Prashant-Bharaj/A-December-of-Algorithms
/December-05/python_surudhi.py
388
3.71875
4
def moveDisk(fp,tp): print(fp,"=>",tp) def moveTower(height,fromPole, toPole, withPole): if height >= 1: moveTower(height-1,fromPole,withPole,toPole) moveDisk(fromPole,toPole) moveTower(height-1,withPole,toPole,fromPole) def Hanoi(n): moveTower(n,"left","right","middle") ...
815a286a5012c245dcfa0a769bccd945f520649f
Prashant-Bharaj/A-December-of-Algorithms
/December-22/python_prasanna77cr7.py
303
3.859375
4
def freq(str): str = str.split() str2 = [] for i in str: if i not in str2: str2.append(i) str2.sort() for i in range(0, len(str2)): print(str2[i], ':', str.count(str2[i])) x=input('Enter') x=x.lower() freq(x)
01f4af2bd9a81bc0896bd21904e8ffd21adb1fa4
Prashant-Bharaj/A-December-of-Algorithms
/December-31/python_shrufire.py
742
3.671875
4
def Distance(start, point, length): return min((start[0]-point[0])%length,(point[0]-start[0])%length) + min((start[1]-point[1])%length,(point[1]-start[1])%length) def ClosestEnemyII(strArr): start = [] for i in range(0,len(strArr)): if "1" in strArr[i]: start = [i, strArr[i].fi...
dc4ef0ebeef0cd8b309b1b78fa9345e6590703f6
Prashant-Bharaj/A-December-of-Algorithms
/December-21/python_aashish2000_currCon.py
534
3.703125
4
coun1=str(input("From Country: ")) bucks=float(input("Currency I have: ")) coun2=str(input("To Country: ")) import csv conv_coun1=None conv_coun2=None with open('Dec21-Exchange_Rates.csv', encoding="utf8", errors="ignore") as csvfile: reader=csv.reader(csvfile) for row in reader: if row[0]==coun1: conv_coun1=flo...
57db860f8675efaf29e76feceaf105064db61e55
Prashant-Bharaj/A-December-of-Algorithms
/December-19/py_ajaykrishnan23.py
195
3.90625
4
import string def hash(s): s = list(s) for i in range(len(s)): s[i] = ord(s[i]) x = sum(s) print(x) print('Output:' + str(int(x/(((len(s))**2))))) hash(input('enter string'))
8c3582bb8bedfb1358494ddeb1c58309a5a29bbe
Prashant-Bharaj/A-December-of-Algorithms
/December-25/python_crytotech.py
979
3.78125
4
matrix=[["*" for i in range(0,10)] for j in range(0,10)] print("\nSanta's location(row-column) (seperated by new line): ") sr=int(input()) sc=int(input()) print("Child's location(row-column) (seperated by new line): ") cr=int(input()) cc=int(input()) #print(sr,sc,cr,cc) j=sc for i in range(sr,cr+1): if matrix[...
5bcc02ea2aca5ad7569b181b0782f83230084bf3
Prashant-Bharaj/A-December-of-Algorithms
/December-05/python_raf1800.py
285
3.984375
4
def Hanoi(n,lt,rt,mt): if n >= 1: Hanoi(n-1,lt,mt,rt) print(lt + " => " + rt) Hanoi(n-1,mt,rt,lt) def main(): n=int((input("Enter number of disks in left tower: "))) Hanoi(n,"Left","Right","Middle") if __name__ == "__main__": main()
f06228b39300a153e2fe4c5695b0fdd251f074cc
Prashant-Bharaj/A-December-of-Algorithms
/December-09/python_AkshayaRC.py
226
4.15625
4
import re def IsURL(url): match=re.search(r'^http|https://.*$',url) mat=re.search(r'.com',url) if match and mat: print("true") else: print("false") url=input("Enter url: ") IsURL(url)
96376840e0a8b29bc849deabc22565ea780af20e
Prashant-Bharaj/A-December-of-Algorithms
/December-04/python_shrufire.py
543
4.0625
4
def fib(n): a=0 b=1 if n==1: c=a elif n==2: c=b while (n-2)>0: c=a+b a=b b=c n=n-1 return c n=int(input('Enter the value of N(Nth term): ')) if n>3: print(n,'th term of the Fibonacci Series is ',fib(n)) elif n==3: print(n,'...
32b41db24674e0f84d0880978055b63231ef4a2e
Prashant-Bharaj/A-December-of-Algorithms
/December-29/python_raf1800.py
231
3.890625
4
def strings(n): stringcount = int(n * (n-3)/2) + n print("Number of strings: {}".format(stringcount)) def main(): x=int(input("Enter number of people: ")) strings(x) if __name__ == "__main__": main()
bfc08253c3ca1ecc6a122bc57d61230c2f4eaafc
Prashant-Bharaj/A-December-of-Algorithms
/December-22/python_surudhi.py
487
3.765625
4
def Remove(duplicate): final_list = [] for num in duplicate: if num not in final_list: final_list.append(num) return final_list wordstring = input('Enter the string: ') words = wordstring.split() wordlist=[] for i in words: wordlist.append(i.lower()) wordlist.sort() ...
fac259c2c94bbf63228d56ccaae58f543086921c
Prashant-Bharaj/A-December-of-Algorithms
/December-07/python_sartsha.py
424
3.828125
4
def IsApproximatelyEqual(a,b,t): if t.strip()=='': a = int(a+0.5) b = int(b+0.5) if a==b: return True else: return False else: t = float(t) diff = a-b if diff<0: diff = -1.0*diff if diff<=t: return True else: return False a = float(input('Enter first number ')) b = float(input('Enter ...
b1a9872d756bedde62e846bf9cbca324c7901bee
Prashant-Bharaj/A-December-of-Algorithms
/December-13/python_aashish2000_lexArr.py
569
3.71875
4
def binarySearch (arr, l, r, x): if r >= l: mid = l + (r - l)//2 if arr[mid] == x: return mid elif arr[mid] > x: return binarySearch(arr, l, mid-1, x) else: return binarySearch(arr, mid + 1, r, x) else: return -1 from itertoo...
8a4ae3b87c5cf4eacbef91bda3279275280b6d06
Prashant-Bharaj/A-December-of-Algorithms
/December-09/python_Raahul46_IS_THIS_URL.py
409
4.15625
4
#!python3 """ Hi there. This file doesn't contain any code. It's just here to give an example of the file naming scheme. Cheers! """ import validators def isurl(link): value=validators.url(link) if(value==True): print("It is a URL") else: print("It is not a URL") def main(): string=str(in...
d417396398c1b926c546e2abaea6dcd8e0917afc
Prashant-Bharaj/A-December-of-Algorithms
/December-05/python_drstrange11.py
389
4.03125
4
# Dec 5 def Hanoi(n, l='left', r='right', m='middle'): if n == 1: print(f"{l} => {r}") return Hanoi(n-1, l, m, r) print(f"{l} => {r}") Hanoi(n-1, m, r, l) num = int(input("Number of disks ")) Hanoi(num) # SAMPLE I/O # Number of disks 3 # left => right # left => middle # right => middl...
00ee003548ea3e85ef2757bf1e811067c02e2aa2
Prashant-Bharaj/A-December-of-Algorithms
/December-08/python_drstrange11.py
772
4.0625
4
# Dec 8 # Install the package pattern # Dec 8 import pattern.en def SingularPlural(s, cat): singular = pattern.en.singularize(s) plural = pattern.en.pluralize(singular) if type(cat) == int: if cat in [1, -1]: print(singular) else: print(plural) elif type(cat) ==...
9acdb45a83c23d053156573e3a964cb2ce953e73
Prashant-Bharaj/A-December-of-Algorithms
/December-09/python_surudhi.py
309
4
4
import re def IsURL(str1): p = re.search('^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$', str1) if p: print('True') else: print('False') str1 = input('Enter the URL: ') IsURL(str1)
44b839c5230a7ace17617a4db2086da9ab52c71b
Prashant-Bharaj/A-December-of-Algorithms
/December-31/python_Raahul46_closest_cell.py
1,507
3.96875
4
#!python3 """ Hi there. This file doesn't contain any code. It's just here to give an example of the file naming scheme. Cheers! """ row=int(input("ENTER THE NO. OF ROWS:")) col=row new=[] one=[] two=[] matrix=[] for m in range(0,row): for n in range(0,col): num=int(input("ENTER NO:")) if(num in [...
d0bc34cd075ff465a26e140fc6e3273de92c168f
Prashant-Bharaj/A-December-of-Algorithms
/December-02/python_sartsha.py
1,178
3.71875
4
def AAA(a1,a2): if a1 == a2: return True return False def SAS(s1,s2,a1,a2): if (s1[0]/s2[0]) == (s1[1]/s2[1]): if a1[2] == a2[2]: return True if (s1[1]/s2[1]) == (s1[2]/s2[2]): if a1[0] == a2[0]: return True if (s1[2]/s2[2]) == (s1[0]/s2[0]): ...
abea4c035ea808db4257d1c670d4743be4c89264
Prashant-Bharaj/A-December-of-Algorithms
/December-19/python_sartsha.py
135
3.5
4
def simpleHash(s): l=[] for i in s: l.append(ord(i)) b=sum(l) print(b/len(s)) s=input("Input: ") simpleHash(s)
c05a8bfb64f4ad26d60179408c210ef79b4a49a7
Prashant-Bharaj/A-December-of-Algorithms
/December-28/python_Raahul46_identical_diagonals.py
994
4.0625
4
#!python3 """ Hi there. This file doesn't contain any code. It's just here to give an example of the file naming scheme. Cheers! """ import numpy as np temp=0 numd=0 matrix=[] new=[] row=int(input("ENTER THE NO. OF ROWS:")) col=int(input("ENTER THE NO. OF COLS:")) print("//THE FUNCTION CHECKS FROM TOP LEFT TO BOTTOM ...
aaccdf9af59888466be3408965cdd106938e70d7
Prashant-Bharaj/A-December-of-Algorithms
/December-20/python_drstrange11.py
1,682
3.578125
4
# Dec 20 # Referred Geeksforgeeks as it was complex import sys class Graph(): def __init__(self, v): self.V = v self.graph = [[0 for column in range(v)] for row in range(v)] def printSolution(self, dist): print("Vertex \tDistance from Source") for node i...
c217f0d9187aaa355f56074aac6096fb3d25ce82
Prashant-Bharaj/A-December-of-Algorithms
/December-08/python_raf1800.py
1,161
4.1875
4
def SingularPlural(s1,s2): if s2.isnumeric(): if(int(s2)==-1 or int(s2)==1): print(s1) else: if(s1[-1] == 's' or s1[-1] == 'x' or s1[-1] == 'z'): print(s1 + "es") elif(s1[-1] == 'y'): print(s1[:le-1]+"ies") else: ...
026451c515ced96df1eaa9d6932b754e5c61ab88
Prashant-Bharaj/A-December-of-Algorithms
/December-28/python_raf1800.py
579
3.640625
4
import sys def IdDia(mat,m,n): for i in range(m-1): for j in range(n-1): if(mat[i][j]!=mat[i+1][j+1]): print("Diagonals Unidentical") sys.exit(0) print("Diagongals Identical") def main(): mat=[] m=int(input("Enter number of rows: ")) n=int(input("...
22d5a8be889012a503d13600d9458f57ed42543c
Prashant-Bharaj/A-December-of-Algorithms
/December-08/python_sartsha.py
618
3.859375
4
import inflect p = inflect.engine() a=input("input 1 :") b=input("input 2 :") if b.isdigit(): if b not in ['-1','1']: if a[-1]!="s": print(p.plural(a)) else : print (a) else : if a[-1]== "s" : print(a[:-1]) else : print(a) else : ...
eeb39103d68b96c5916254396df679bbdb1013a0
Prashant-Bharaj/A-December-of-Algorithms
/December-22/python_crytotech.py
1,006
3.703125
4
import sys import operator def wcount(filename): f=open(filename,'r') word=f.read().lower().replace("."," ").replace(","," ").split() w=sorted(word) wc={x:w.count(x) for x in w} return wc def print_words(filename): printw=wcount(filename).items() for x,y in printw: print(x, y) ...
4e41a06281e547894b57e2bdd258cc78ebea7188
Prashant-Bharaj/A-December-of-Algorithms
/December-08/python_AkshayaRC.py
926
4.15625
4
from pattern3.en import singularize,pluralize def SingularPlural(word,num): try: num=int(num) if num==-1 or num==1: w=singularize(word) else: w=pluralize(word) print(w) except ValueError: if type(num) is str: if word==singulari...
128c6f64e8ef2526808e45904d7d660d7657710b
Prashant-Bharaj/A-December-of-Algorithms
/December-22/python_drstrange11.py
501
3.625
4
# Dec 22 # Change the text file if you want with open('text.txt') as file: l = file.readlines() word = [] for line in l: for x in line.split(): word.append(x.lower()) word_distinct = set(word) final = [] for word_1 in word_distinct: c = 0 for words in word: if words == word_1: ...
1cdc4d2f8574b9bd160d9b23eda4c7d6b56aee60
Prashant-Bharaj/A-December-of-Algorithms
/December-04/python_raf1800.py
287
3.8125
4
def Fib(n): first = 0 second = 1 for i in range(0,n): print(first,end=" ") ne = first + second first = second second = ne def main(): n=int((input("Enter number of series elements: "))) Fib(n) if __name__ == "__main__": main()
932fa35552ade7c426b9f10b9b5757c8b454fb46
Prashant-Bharaj/A-December-of-Algorithms
/December-09/python_prasanna77cr7.py
125
3.546875
4
import validators url=input("ENTER THE INPUT") a=validators.url(url) if a: print("TRUE") else: print("FALSE")
6e9db93389eef5af57800fada8768fd9b875af6f
maurotfilho/eldcare
/FlaskDBHelper.py
7,866
3.671875
4
import sqlite3 def dictionary_row_factory(cursor, row): """Dictionary based row factory function (see https://docs.python.org/2/library/sqlite3.html#sqlite3.Connection.row_factory) This is very useful to compose json responses from query results :param cursor: sqlite3 cursor :param row: a...
79aba8c721574e9f36bc4897c9f7d7df7d0454dd
FritzHeider/CS-1.3-Core-Data-Structures
/Code/set.py
1,730
3.546875
4
from hashtable import HashTable class HashIterator: def __init__(self, hashset): self._hashset = hashset self._index = 0 def __next__(self): if self._index < (len(self._hashset._keys)) : if self._index < len(self._hashset._keys): result = (self._hashset._keys[self...
2cf76827fcd53820d515b16bbd6d954a08c415b7
nipunpuri/Python
/Python for Informatics/8.1.py
513
3.890625
4
a = [1,2,3,4,5,6] print "The original list" print a def chop(t): #In this function we have modified the argument and returned None. i.e. I am changing the value of the original argument and not creating a new one del t[len(t)-1] del t[0] return None t1 = chop(a) print "The chopped list" print t1 def middle(t)...
7e92ae4fade5b6b9dc8faae4c42cfe38f3a7328d
mykhamill/Projects-Solutions
/solutions/binary_converter.py
1,154
4.53125
5
#!/usr/bin/python # -*- coding: latin-1 -*- # **Binary to Decimal and Back Converter** # - Develop a converter to convert a decimal number to binary or a binary number # to its decimal equivalent. import argparse from sys import argv from math import ceil def convert(dec=None, bi=None): if bi is not None: retu...
9f8c68f24a7e689715844ce0cf8981eb44c6a245
mykhamill/Projects-Solutions
/solutions/unit-converter.py
1,620
4.625
5
#!/usr/bin/python # -*- coding: latin-1 -*- # **Unit Converter (temp, currency, volume, mass and more)** # - Converts various units between one another. The user enters the type of unit # being entered, the type of unit they want to convert to and then the value. # The program will then make the conversion. unit...
74cef59913e3ad0b41ef6b96f42247532bb05f04
HarshadGare/Python-Programming
/Operators/02 Assignment.py
110
3.75
4
a = 10 b = 2 a += b print(a) a -= b print(a) a *= b print(a) a /= b print(a) a **=b print(a) a //= b print(a)
20901b4771d861dc44e44e0f12d0e6dd1fdb6fdc
HarshadGare/Python-Programming
/TKinter/06 Mouse Click Event.py
354
3.75
4
from tkinter import * root = Tk() def leftclick(event): print("Left Click") def rightclick(event): print("Right Click") def middleclick(event): print("Middle Click") f = Frame(root, width=500, height=500) f.bind("<Button-1>", leftclick) f.bind("<Button-2>", rightclick) f.bind("<Button-3>", middl...
a6c0922464287a4937d8b7feec4ab7d830437b9a
HarshadGare/Python-Programming
/Datatypes/01 Numbers.py
151
3.640625
4
No1 = 10 # integer No2 = 20.5 # float No3 = 5+7j # complex print(" Integer No.: ", No1) print(" Float No.: ", No2) print(" Complex No.: ", No3)
018154d3c1f30d1ae0fe627319e2ab4b69b71e0c
NataliaHoelscher/python
/additional task from Slava/Listen.py
2,896
4.0625
4
# Добавить 5 элементов в список и удалить первый и последний элемент (удаление сделать 2 способами - функциями и slice) import copy a = [a for a in range(1, 11)] print(f"HomeWork 3.1: {a}") # удаление 1 a.pop(0) print(f"HomeWork 3.1: {a}") a.pop(8) print(f"HomeWork 3.1: {a}") # удаление 2 a.remove(2) print(f"HomeWork ...
4dafa09f27e57c4b7337b6cc61758551998b6bb8
mca-pradeep/python
/operators.py
359
4.15625
4
#Operators in python #Assignment Operator totalMarks = 45 print(totalMarks) #Arthmatic Operator #5 types #+-*/% print(2+2) print(10 -2) print(4*4) print(12//4) print(13%4) #Logical Operator # AND OR NOT print(5 > 2 and 2) print(0 < -1 or 4) print(not 0) #Relational Operator # < > == >= <= != test = 4 if test == 5: ...
7e515d7664b3a50cfcd4ac30692e821a6cc62e91
ksodhi-uwyo/Algorithms-DataStructures
/karatsuba.py
1,719
4.375
4
#Karan Sodhi #Karatsuba multiplication algorithm #it is assumed that the number of digits in a number is of the form n=2**k #Function to carry out the recursive karatsuba multiplication def karatsuba(X,Y,n): n_half=n/2 if (n==1): T=X*Y else: #divide the digits of input numbers in ...
e9906a4f458dfe50683b856faf00ad78bef9b692
xueliblossom/learn-Python
/list-created.py
154
3.859375
4
# -*- coding: utf-8 -*- #列表生成式 string = ['Hello', 'HEYAN', 24, 'graduate'] l = [s.lower() if isinstance(s, str) else s for s in string] print l
1d894803ec56e2337ebe3a5b18039454491d646a
xueliblossom/learn-Python
/generator.py
236
3.921875
4
# -*- coding: utf-8 -*- #生成器 #key word:yield def fib(maxn): n, num1, num2 = 0, 0, 1 while n < maxn: yield num2 num1, num2 = num2, num1 + num2 n = n + 1 g = fib(8) i = 0 while i <5: i =i + 1 print g.next() print g
d73fb73b347967ecd700e00b14291a739e043f0d
sandinocoelho/URI-Online-Judge
/1036.py
362
3.609375
4
import math entrada = input().split() a = float(entrada[0]) b = float(entrada[1]) c = float(entrada[2]) delta = (b ** 2) - (4 * a * c) if delta <= 0 or a == 0: print("Impossivel calcular") exit() else: delta = math.sqrt(delta) x1 = (-b + delta) / (2 * a) x2 = (-b - delta) / (2 * a) print("R1...
9b879f8556195c5275a829b03d5d0816e524fe48
sandinocoelho/URI-Online-Judge
/1045.py
500
3.84375
4
entry = input().split() entry = [float(i) for i in entry] entry.sort(reverse=True) a, b, c = entry[0], entry[1], entry[2] if a >= b + c: print("NAO FORMA TRIANGULO") exit() if (a**2) == ((b**2) + (c**2)): print("TRIANGULO RETANGULO") elif (a**2) > ((b**2) + (c**2)): print("TRIANGULO OBTUSANGULO") elif...
6d1a10fad671e736f238aee75a1022eab66a5161
sandinocoelho/URI-Online-Judge
/1019.py
264
3.859375
4
# -*- coding: utf-8 -*- ''' Escreva a sua solução aqui Code your solution here Escriba su solución aquí ''' seconds = int(input()) hours = int(seconds/3600) minutes = int((seconds%3600)/60) seconds = seconds % 60 print("%d:%d:%d" %(hours,minutes,seconds))
1f6243ad6ffe15276d72d7be7f03424d54f11758
sandinocoelho/URI-Online-Judge
/1061.py
947
3.6875
4
from datetime import datetime entryDayBegin = input().split() entryHourBegin = input().split(" : ") entryDayEnd = input().split() entryHourEnd = input().split(" : ") dateBegin = datetime(2017, 4, int(entryDayBegin[1]), int(entryHourBegin[0]), int(entryHourBegin[1]), int(entryHourBegin[2])) dateEnd = datetime(2017, 4,...
0064c6341194b61c6c780c2bb18fba97aaeebf72
sandinocoelho/URI-Online-Judge
/1059.py
75
3.609375
4
# -*- coding: utf-8 -*- for x in range(1,101): if x%2 == 0: print(x)
5ae76389a961143dbc2b8e6059e68ca9956fd58a
sandinocoelho/URI-Online-Judge
/1115.py
431
3.890625
4
while True: entry = input().split() entry = [int(i) for i in entry] if entry[0] == 0 or entry[1] == 0: exit() else: if entry[0] > 0 and entry[1] > 0: print("primeiro") elif entry[0] < 0 and entry[1] > 0: print("segundo") elif entry[0] < 0 and entry...
3d293d8b9c4fcc3c2c53897624b486f9bb6ba11c
cydkab/DNA_search_sequence
/DNA_sequence_check.py
3,174
3.96875
4
# open database and sequence, read it # calculate the times a small sequence appears on the scv file # match the dna database to verify if it exists import csv import sys import re if (len(sys.argv)) < 3: print("Usage: python dna.py data.csv sequence.txt") else: sys.argv[1] # database of DNAs sys.argv[...
67a8506a54d8def4b36970754f5c6bdebb9a1e8e
Nicolas-le/argumentRetrieval
/code_base/ES/compare_topics.py
802
3.5
4
def topic_match_count( query_topics_dict, document_topics_dict ): """ Compares the hidden topics of a query and a document and counts the matches. :query_topics_dict: dictionary of the 10 highest ranked hidden query topics found by empath :document_topics_dict: dictionary of the 10 highest r...
377b7dc5725a4006b3b6c4b5515f24bdd2fd0896
RafaRomero8/My-First-curso-in-phyton
/videojuego.py
659
3.90625
4
import random #es el paquete que tiene funciones aleatorios #se pone punto al final punto y accedemos a la funcion o modulo def run(): numero_aleatorio = random.randint(1,100)#randint genera un umero entero que va de A a un numero b numero_elegido = int(input('elige un numero entre el 1 y 1...
9fbc2104036397228492bab0ca0574ea4cc3647a
RafaRomero8/My-First-curso-in-phyton
/tuplas_dos.py
1,137
4.1875
4
def run(): """ def coordenadas(): return (5,4) coordenada = coordenadas() coordenada print(coordenada) x,y = coordenadas() #desempaquetada print(x,y) my_tuple = (8,) print(my_tuple) # range(comienzo,fin,pasos) my_range = range(1, 5) my_ranges = range(0, 7, 2...
07e9dfe88b0bddafb5a2e64b1ab01f4e9b91f4c6
BobSherwan/Prac02
/Name.py
397
3.703125
4
#1 #in_file = open("name.txt", "w") #userName = str(input("Enter Name")) #print(userName, file = in_file) #in_file.close #2 #in_file = open("name.txt", "r") #firstLine = in_file.readline() #print("Your name is {}".format(firstLine)) #3 in_file = open("numbers.txt", "r") firstLine = in_file.readline() secondLine = in_...
6cb01304ec0669e58d722f3094d136466af1dc49
HodongMan/python-study
/ch3/factorial.py
263
3.921875
4
def factorial(n): ''' return n!''' return 1 if n < 2 else n * factorial(n-1) if __name__ == "__main__": print( factorial(42) ) print( factorial.__doc__) print( type(factorial) ) fact = factorial print( fact ) print( fact(5) )
84ba44cc001c189e5a16d40137499587dacb7545
gigaflw/SJTU-Chinese-Word-Segmentation
/kernel/segmentation_by_retrieve.py
7,620
3.828125
4
#_*_encoding:utf-8_*_ """ Code responsible for service logic """ SEN_MARK = ',。?!……;' # "Sentence mark" # It is used in function "Special_mark_seg.quot_string_set". If each is detected, # it means the string between the quotation marks is regarded to be a sentence # rather than a word. class RetrieveSeg: """Segm...
431494e601dd2827cd424ab7c09b8f76346f07c2
caitlin-tibbetts/cs-6375-final-project
/algorithms/feature_selection.py
2,335
3.640625
4
import numpy as np def partition(x): """ Partition the column vector x into subsets indexed by its unique values (v1, ... vk) Returns a dictionary of the form { v1: indices of x == v1, v2: indices of x == v2, ... vk: indices of x == vk }, where [v1, ... vk] are all the unique values ...
7678a990ff5a544ab2f8fa334a4f3d09e3550f90
cgmcintyr/hackupc
/src/cities.py
3,044
3.59375
4
# -*- coding: utf-8 -*- """City data is kept here""" from collections import namedtuple import math City = namedtuple('City', ['name', 'province', 'population', 'latitude', 'longitude', 'bounding']) # degrees to radians def deg2rad(degrees): return math.pi*degrees/180.0 # radians to degrees def rad2deg(radians):...
8a38ff89f317d7059fd6fe34aa10fcb23f7c1fe8
Hortule/idz
/labs/lb2.1.py
561
4.28125
4
from math import sqrt x = float(input('Введите значение аргумента: ')) if x <= -6: y = 1 print("X = {0:.2f} Y = {1:.2f}".format(x, y)) elif -6 < x < -4: y = -0.5 * x - 2 print("X = {0:.2f} Y = {1:.2f}".format(x, y)) elif -4 <= x <= 0: y = sqrt(4 - (x + 2) ** 2) print("X = {0:.2f} ...
671dc81c750e5cde89af2dc55a879f61de12fcfb
Hortule/idz
/program8.py
1,960
4.46875
4
# Word Jumble # # The computer picks a random word and then "jumbles" it # The player has to guess the original word import random def jhelp(hword): return { 'питон': 'этот яп', 'анаграмма': 'важный элемент этой игры', 'простая': 'прилагательное характеризующее легкость этой игры', ...
5af735a4b32265a61a8d812464877a227c34719c
mikerojaswa/PythonPractice
/recursion.py
316
3.859375
4
count = 0 memo = {} def fib(n): global count if n in memo: return memo[n] print(f'Calculating: {n}') if n == 0: return 0 elif n == 1: return 1 else: memo[n] = fib(n-1) + fib(n-2) count = count + 1 return memo[n] answer = fib(10) print(f"Answer: {answer}") print(f"Number of iterations {count}")
307346c13ab5bc0cd216b2812bff32128982809a
samahDD/ProjectX
/ProjectX_Translation_Application/Language.py
629
3.6875
4
class Language: def __init__(self,getTranslationLanguage,languageNumber): self.getTranslationLanguage = getTranslationLanguage self.languageNumber = languageNumber def getLanguage(self): getTranslationLanguage = input("Please enter the language you want to translate:\n").lo...
a3f351fe63e659bbfd27940c8e791ddd0b0e425c
shubhjot31d/MLalgorithms
/19103112_ID3.py
5,952
3.5
4
#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import pandas as pd # In[31]: data=pd.read_csv("bank.csv") # In[32]: data # In[4]: import csv import math import random # In[5]: class DecisionTree(): tree = {} def learn(self, training_set, attributes, target): self.t...
fbf98d469601b650a7dae0265c0f952bf2d25211
heyefu19920626/PythonLearning
/basics/fileAndExpection.py
1,264
3.6875
4
import json file_path = 'test.txt' # read the entire file with open('test.txt',encoding='utf8') as file: content = file.read() print(content) # read the file by line with open(file_path,encoding='utf8') as file: for lines in file: print(lines.rstrip()) print(lines) # read the file by line and save in list w...
89165ad523e88658c90a53575761c1ff07fe2b55
DaryaShitova/alg_and_ds
/avl_tree/avl_tree.py
22,403
3.515625
4
from avl_node import AVLNode class AVLTree: def __init__(self): """Default constructor. Initializes the AVL tree. """ self.root = None self.size = 0 def get_root(self): """@returns the root of the AVLTree """ return self.root def get_height(self):...
ac6c019f997cb84d6b4707233e0516d770a2fcd9
DaryaShitova/alg_and_ds
/hashing/double_hash_set.py
8,514
3.75
4
from open_hash_node import Open_Hash_Node class Double_Hash_Set(): def __init__(self, capacity = 0): self.hash_table = [None] * capacity self.table_size = 0 def get_hash_table(self): """(Required for testing only) @return the hash table. """ return self.hash_ta...
69f514d02c381be78248ae87ad54f39d4a0812c3
Lnleite/Graphs
/projects/graph/src/graph.py
4,016
4.1875
4
""" Simple graph implementation """ class Queue: def __init__(self): self.storage = [] def enqueue(self, value): self.storage.append(value) def dequeue(self): if len(self.storage) > 0: return self.storage.pop(0) else: return None class Stack: ...
a15fa9041bcd0a8951d523ffdc87d4f185115539
JJAnony/PythonBeginner
/lesson_6.py
238
3.8125
4
a = int(input('Entre com um numero:')) isCousin = 0 for x in range(1, a + 1): if a % x == 0: isCousin += 1 if isCousin == 2: print('o numero {} é primo'.format(a)) else: print('o numero {} não é primo'.format(a))
243f6f4640a25a8591522f3d56ecf9b4d305e972
JJAnony/PythonBeginner
/lesson_10.py
365
3.921875
4
set_int = {1, 2, 3} set_int_2 = {1, 2, 3, 4, 5, 6} is_subset = set_int.issubset(set_int_2) print('1 é um subconjunto de 2: {}'.format(is_subset)) is_subset = set_int_2.issubset(set_int) print('2 é um subconjunto de 1: {}'.format(is_subset)) list_animals = ['cachorro', 'cachorro', 'gato', 'gato', 'elefente'] set_anim...
2b2274dfeda894a7c4efc1ed0cc810c945d5bea9
JJAnony/PythonBeginner
/lesson_1.py
77
3.6875
4
print('Meu Primeiro Programa em Python') a = 2 b = 3 sum = a + b; print(sum)
f8267a50f823e6e9f75c94cc6ea66c87c916108b
CodingSinger/pytest
/iter_generator.py
269
3.84375
4
#coding=utf-8 print([1,3]) print(iter([1,3])) l = [x for x in range(10)] #x为l中的元素 print(l) l1 = [d not in '234' for d in '23d45'] # d not in '234'为l1中的元素 print(l1) print(all(d not in '234' for d in '23d45')) print(d not in '234' for d in '23d45')
ef4f71d77a041ace79b81469fdb4ac85b486dc2f
yggdr/rohrleitung
/examples.py
1,865
3.5625
4
from functools import partial # pip install toolz from toolz.curried import interpose from rohrleitung import Pipeline, L def three_n_plus_one(n): if n % 2: return 3 * n + 1 else: return n / 2 @L def collatz_length(n, l=0): if int(n) < 1: raise ValueError('Nope') if n == 1: ...
730da9a83617aa4f26d28e5e164b6550be425007
OlyaIvanovs/automate_with_python
/web_scraping/lucky.py
844
3.53125
4
""" This programm allows type a search term on the com- mand line and have a computer automatically open a browser with all the top search results in new tabs. """ import sys import webbrowser import bs4 import requests import pyperclip print("Googling...") # Get search term from command line if len(sys.argv) > 1: ...
5658429376ecb97a621188d37eebaaabf8122522
akahrsp/Acadview_MMU
/Examples/nameswap.py
235
3.65625
4
name = raw_input("what is your name ") num = len(name) name1 = list(name) i = 1 while (i <= num/2) : temp = name1 [i - 1] name1 [i - 1] = name1 [num - i] name1 [num - i] = temp i = i + 1 name = ''.join(name1) print name
47334e58fe1819a693e3e8562dbe61764611060b
akahrsp/Acadview_MMU
/Examples/fibonacci.py
249
4.125
4
def add (first , second): return first + second num = int(raw_input("Enter how many fibonacci no you want ")) sec = 1 fir = 0 i = 1 while (i <= num ) : print '%d ' % (sec) temp = sec sec = add(sec , fir) fir = temp i = i + 1
22b683c1947c14c62804c14f9acdeaea5a3a4df3
Nordlxnder/Beispiele
/Threading/thread Beispiel.py
1,452
3.609375
4
#!/usr/bin/env python # -*- coding: utf-8 -* import threading from queue import Queue import time exitFlag = 0 class sensoren (threading.Thread): def __init__(self, name): threading.Thread.__init__(self) self.name = name def run(self): print ("Starting " + self.name) #print_time(self...
8d33af03ce44b8e06038659c52db4c0e93ec13a7
MelodyChu/Juni-Python-Practice
/codewars_v1.py
2,771
4.03125
4
# Sum of range in sequence """ n = 2 def series_sum(n): result = 1.00 startingnum = 1 if n == 1: result = 1.00 for i in range(2,n+1): startingnum += 3.00 result += 1 / (startingnum) return str("{0:.2f}".format(result)) print (series_sum(n)) """ #Facebook like button question...
4ef5c359bbc93f1db6c15daf89f1c8eed3a57bae
MelodyChu/Juni-Python-Practice
/recursion_review.py
1,460
4.25
4
# write a fn that sums the first n numbers; n is input """ def sumn(n): result = 0 for i in range(0,n+1): result += i return result print (sumn(n)) """ """ n = 5 def sumn(n): if n == 1: return 1 return n + sumn(n-1) print (sumn(n)) """ """ n = 5 def factorial(n): if n == 1: ...
2ee3b7c6685c72d0c96c1a5debb91c886fe4f6cf
MelodyChu/Juni-Python-Practice
/merge_sort_1.py
2,142
4.03125
4
# merge sort; put together 2 lists a & b # take first index from both lists; compare them ; see which one is bigger; sort # assume both lists are sorted individually...? should be same length..? x = [9,1,1,6,7,8,100] def mergesort(x): if len(x) == 1: return x elif len(x) > 1: midpoint = int(l...
e227eab2609ef35330db29e84a131713b7dee8ff
MelodyChu/Juni-Python-Practice
/mergesort.py
1,149
3.90625
4
# merge sort attempt a = [1,1,2,3,4,5,10] def mergesort(a,lefthalf,righthalf):# what should variable inputs be? would recursive here beo only for splitting list if len(a) == 1: #base case; if length of list is 1, return list (no need to sort) return a if len(a) > 1: midpoint = len(alist)/2 ...
79ca794d2afe5eb1c0d1999c374415e6f044a6d2
MelodyChu/Juni-Python-Practice
/recursive_binary_search.py
6,048
3.953125
4
""" a = [1,1,2,3,4,5,10] x = 2 def binary(x,a): first = 0 last = len(a)-1 midpoint = int((first + last) / 2) # base case if len(a) == 0: return False elif a[midpoint] == x: return True elif x < a[midpoint]: return binary(x, a[0:midpoint]) elif x > a[midpoint]: ...
3567217fc930ac7a8ed38331bbbaa684e8ba4679
Nazmun1996/Python
/Python/Python File Searching/title.py
887
4.03125
4
import re def search_by_title(): fhand = open('GUTINDEX.ALL') print("Search by Title:") for line in fhand: if not line.startswith(" [") and not line.startswith("TITLE") and not line.startswith("~"): if not line.startswith(" ") and not line.startswith("TITLE") and not line.startswith(...
4ba0fed9e35c6e05c150eb51274c9da43b085ad3
jchan221/CIS2348_HW_1
/CIS2348_HW_1_20.py
562
4.09375
4
# Joshua Chan # 1588459 user_num1 = int(input('Enter integer:')) print('\n''You entered:', user_num1) print(user_num1,'squared is',user_num1**2) print('And',user_num1,'cubed is', user_num1**3,'!!') # Above will take the user's input, square and cube it, and output it user_num2 = int(input('Enter another integer:...
700b71effd1c1dbbf36f25799a9e6a4727bbe4f7
nickhuang1997/COSC-122
/student_files/genetic_similarity_binary.py
753
3.671875
4
""" File: genetic_similarity_binary.py Author: your name should probably go here A module to find the genetic similarity between two genomes. To find how many genes are in common, we use a binary search """ from classes import GeneList ## Uncomment the following line to be able to make your own testing Genes # from ...
eb7ef601541e887a4616d1394a430b30e5e1f20a
nickhuang1997/COSC-122
/Class 1.py
307
3.5625
4
# -*- coding: utf-8 -*- """ Created on Wed Jul 19 12:52:41 2017 @author: Nick """ #OOP Review class example: eyes = 'brown' age = 22 def method(self): return 'this is a method, same as a function' #exampleObj = example() #exampleObj.eyes #this access data from 'eyes'