blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
545k
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
545k
bdbcca0ec37a5d448e6a492e68a2e3b8cbdf0dd2
rookiy/PATBasic
/pb1009.py
339
3.5
4
#!/usr/bin/env python import sys def main(): sys.stdin = open('./1.txt', 'r') sentence = raw_input().split() sentence.reverse() sys.stdout.write(sentence[0]) for (index, item) in enumerate(sentence): if index == 0: continue sys.stdout.write(' '+item) if __name__ == '__m...
f6645d28a341e87a6196eb7cd967cc3d48e74813
Aegon007/homework
/adv_algorithm_2/hw1_prime_num.py
5,888
4
4
#!/usr/bin/python3 import os import sys import argparse import pdb import random import math def gen_random_numbers(k): '''The prime number theorem assert that about one in ln n of the integers near n is a prime. Thus if we make 2ln n random choices, we will have high probability that one of our choices...
9f4453482bdef690acfe9972bb6721efbe8681b8
PonPonMan/learn-python
/functional/do_map.py
259
4.09375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- print(list(map(str, [1, 2, 3, 4, 5, 6, 7, 8, 9]))) # 练习 def normalize(name): return name[0].upper() + name[1:].lower() # 测试: L1 = ['adam', 'LISA', 'barT'] L2 = list(map(normalize, L1)) print(L2)
efd7fb3312ffb601c9cfb881fa16f79f02f7bd8d
derek-whitaker/tree-leaves
/Learning/sorting-algorithms.py
807
3.96875
4
#bubble sort def bubble_sort(A): n = len(A) for passnum in range(n): for i in range(n-1): if A[i] > A[i+1]: A[i+1],A[i] = A[i],A[i+1] return A #merge sort def mergeSort(arr): print("Splitting ",arr) if len(arr) > 1: mid = len(arr) //2 L = arr[:mid...
bfb9716c70a9e3ece1250973c0d75591fcb05b92
yatingupta10/Dev.py
/Week 2/Student Submissions/rishabh_jindal/prog-5.py
258
3.8125
4
def getGCD(q,div): while div%q!=0: nxtQ=div%q div=q q=nxtQ return q num1=int(raw_input("enter number 1:")) num2=int(raw_input("enter number 2:")) if num1>num2: print getGCD(num2,num1) else: print getGCD(num1,num2)
da92ad583a6d089ca5e23f73200f4fc4899f49b3
yatingupta10/Dev.py
/Week 1/Student Submissions/rohit_yadav/Q_2.py
638
4.03125
4
num1=int(input("Enter the first number: ")) num2=int(input("Enter the second number: ")) sum = num1 + num2 print("sum of " + str(num1) + "+" + str(num2) + ":" + str(sum)) diff = num1 - num2 print("diff of " + str(num1) + "-" + str(num2) + ":" + str(diff)) mul = num1 * num2 print("mul of " + str(num1) + "*" + str(num...
f3c02f12042c88774520e3751880cf28a22c4e7d
yatingupta10/Dev.py
/Week 2/Student Submissions/rishabh_jindal/prog-3.py
721
3.78125
4
import time from random import randint def linear_search(A,item): start_time=time.time() i=0 for x in A: if(item==x): ls_time=time.time()-start_time print "Linear search time:",ls_time return i; i+=1 return -1 def binary_search(A,item): start_ti...
bfc33a6cb08d3983360c366fa15631e427069a4f
parkero2/Spacer
/main.py
199
3.578125
4
def spacer(): msg = input("Input message to space out: ") marr = [] for a in range(len(msg)): marr.append(msg[a]) final = ' '.join(marr) print(final) spacer() spacer()
cbc3dccecd24bff52de4a50c1086d85a134b011a
hua-hnust/pycode
/com/xhua/test01.py
780
3.90625
4
#coding=utf-8 name = "xhua" age = 23 height = 174 print "My name is " + name + ",My age " + str(age) + ",My height " + str(height) #这是一个注释,下面学习数组的用法 array = [2,1,5,3] print array[2] array.append(6) print array for num in array: print num print "通过下标遍历" for i in range(0,len(array)): print a...
79355c4b98aa40764d6485c82e9b152d351e336c
hua-hnust/pycode
/com/xhua/classdemo.py
760
3.8125
4
#!/usr/bin/python # -*- coding: UTF-8 -*- class person: def __init__(self,name,age,sex,birthday): self.name = name self.age = age self.sex = sex self.birthday = birthday def display(self): print self.name,',',self.age,',',self.sex,',',self.birthday p = per...
872570c7acd0d9f12c5c34cd4a23679cfa819e74
jiongyzh/leetCode
/container_with_most_water.py
582
3.5
4
class Solution(object): def maxArea(self, height): """ :type height: List[int] :rtype: int """ idx_head = 0 idx_tail = len(height) - 1 max_volume = 0 while idx_head != idx_tail: max_volume = max(max_volume, min(height[idx_head], height[idx...
7e8674fe03a88015f0862bff078411e6cefbac42
jiongyzh/leetCode
/add_two_numbers.py
1,876
3.65625
4
class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def addTwoNumbers(self, l1, l2): lr = ListNode(0) lc = lr carry, sum_val = 0, 0 while l1 or l2: if l1: sum_val += l1.val ...
45adefcb747daaf35e145dbea043bf84cc72ff1d
jiongyzh/leetCode
/Merge k Sorted Lists.py
633
3.78125
4
# Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def mergeKLists(self, lists): """ :type lists: List[ListNode] :rtype: ListNode """ all_node_vals = [] head =...
97056d19c1eba9b7072b0a26ea9c174110c8764a
nguyenkhacbaoanh/mini-project-1
/sqlite3_demo.py
613
4.03125
4
import sqlite3 # help(sqlite3) conn = sqlite3.connect('database.db') c = conn.cursor() # c.execute("""CREATE TABLE membre ( # name text, # income integer, # outcome integer # ) # """) # c.execute("INSERT INTO membre VALUES ('Bao Anh', 300, 200)") # c.execute("INSERT INTO membre VAL...
46d309551906d1da152f811ad0a08e10b5cc8244
TheDisturbed50/CITS205
/MidTerm/donut-shoppe_tjcalhoun.py
10,659
4.1875
4
# Thomas Calhoun & # MIDTERM # tjcalhoun@alaska.edu 10 Mar 2016 # Python 3.5.1 # MidTerm Question # 21, good curve ball! (Its a good thing I have a passion for donuts!) (Missed the 2hr deadline) # ...And missed that deadline from writing this by like 10 minutes! But at least I get to so some fluff # before the next ...
b16159eb34cfde15dbab85030d4bcba247c43840
TheDisturbed50/CITS205
/hw9_tjcalhoun/hw9-atm_tjcalhoun.py
11,434
3.890625
4
# Thomas Calhoun # homework #9 # tjcalhoun@alaska.edu 31 Mar 2016 # Python 3.5.1 """ Calhoun Banking. Watching your money, so you don't have to! """ ####################################################################################################################### # Definition of some menu text to keep functio...
e53e8876c5ac9d045f042168504e0194a9159990
Ashokkommi0001/Python-Patterns-Alphabets-Lower_case
/w.py
234
3.90625
4
def w(): for row in range(6): for col in range(7): if (col%3==0 and row<5) or (row==5 and col%3!=0): print("*",end=" ") else: print(end=" ") print()
f3d8dd65fb43e4615aa0512c01ffd6a6f8e4518d
ngardiner7/udacity
/data-analyst/term1/project-explore-us-bike-share-data/bikeshare_2.py
7,506
4.25
4
import time import pandas as pd import numpy as np CITY_DATA = { 'chicago': 'chicago.csv', 'new york city': 'new_york_city.csv', 'washington': 'washington.csv' } MONTHS = ['january', 'february', 'march', 'april', 'may', 'june'] def get_filters(): """ Asks user to specify a city, m...
31e255b7d6ae188343cdcee72a892bcd7fef5079
julie0919/algorithm
/baekjoon/0731_10988.py
72
3.875
4
word = input() if word[::-1] == word: print(1) else: print('0')
f268159ec44ce549164f41a080df719b09cb5e3f
julie0919/algorithm
/swea/0811_1936.py
162
3.796875
4
a, b = map(int, input().split()) if a == b: pass elif (a == 1 and b == 3) or (a == 2 and b == 1) or (a == 3 and b == 2): print('A') else: print('B')
cc6d18785eff0406ff7f38f18f15476375e31b76
calekochenour/mansfield-double-up-gpx-analysis
/01-code-scripts/mansfield_gpx.py
2,484
3.84375
4
import re import gpxpy def extract_gpx_data(gpx_file_path, attribute='elevation'): """Reads in a GPX file and returns a list of values for a specified GPX attribute. Parameters ---------- gpx_file_path : str File path to the GPX file (.gpx extension). attribute: str Name of t...
b7221e01920c7f23ca17bc5e067034f310252cbe
huihui7987/ReadingNoteofWebScrapingWithPython
/web scaping with python/C2_advanced HTML parsing.py
5,908
3.6875
4
#coding:utf-8 # CSS是可通过id或者class来进行筛选,下面说明BS的对于那些标签的选择 # "<span class="red">Heavens! what a virulent attack!</span>" replied <span class="green">the prince</span>, not in the least disconcerted by this reception. # 如上,有红色字有绿色 from urllib.request import urlopen from bs4 import BeautifulSoup html = urlopen("http://www...
3cb4c2efbe2624fae7383b683dd70e4c23d03489
JaD33Z/Python-Operations-by-Data-Type-CheatSheet
/string-ops.py
12,845
4.5
4
# ================================ ~ * STRING OPERATIONS EXAMPLES * ~ ================================== # # ~~ STRING METHODS AND DEFINITIONS LIST AT BOTTOM OF PAGE ~~ # -------------------------------------------------------------------------------------------------- # # ...
8a6f43718253cc247b6371914fd357f0f3c87420
zouhami/TLG-Course
/quiz.py
2,814
4.03125
4
#!/usr/bin/env python3 from PIL import Image # this library is for displaying images print('Hi this is Hami first game building with python3') response = input('Let\'s get started amigo! You ready? (yes/no): ').lower().strip() score = 0 total_q = 5 odd_numbers= ['1', '3', '5', '7', '9'] # list of odd numbers # Pict...
ace3e0b41c87cc8a1ecbb50b04459ffd9efaea91
KalinaKa/Explosive-Dragon
/d6/seek_file.py
637
3.765625
4
#CTR+q, DIRECTORY METODY #znaki zajmują różną liczbę bajtów. #wszystkie operacje i zapisy tekstu, będą tam gdzie kursor stoi # w trybie 'r' ustawia sie na poczatrku pliku #tu automaatycznie sie zamyka plik, ale w read nie, tam sami zamykamy #file.seek() -> wez ustaw sie na tej pozycji with open('lokomotywa.txt', encod...
f0089d540a3a8c11e28a2a5142f5be5d4e92adb7
KalinaKa/Explosive-Dragon
/d3/04-zadania.py
5,195
3.734375
4
# 1. czy liczba jest podzielna przez 3 lub 5 lub 7 tested_value = int(input("Podaj liczbę całkowitą:\n")) print(type(tested_value)) if tested_value % 3 == 0: print("Twoja liczba jest podzielna przez 3. :)") elif tested_value % 5 == 0: print("Twoja liczba jest podzielna przez 5. :)") elif tested_value % 7 == ...
87630c67dd67688308ad3292d8f2a1f7922a188e
KalinaKa/Explosive-Dragon
/d4/06-petla2.py
734
4.0625
4
#sposob na wykorzystanie: menu :) #Tu zaklada, ze ma nieprawidlowe nazwisko i probuje wydobyc prawidlowe. nieprawidlowe = True while nieprawidlowe: nazwisko = input("Podaj nazwisko drukowanymi literami lub Q aby zakończyć: ") #instrukcja Quit() wychodzi z petli. if nazwisko.upper() == 'Q': print("Do...
3c3ac7431e7e908aafa2fde7fc3573a2f7de119b
KalinaKa/Explosive-Dragon
/d5/11-slownik.py
1,430
3.859375
4
# -*- coding: utf-8 -*- elementy = { 1:"ola", 0:"ala", 2:"ela" } print(elementy) print(elementy[2]) slownik = {"imie": "Adam", "nazwisko":"kowalski", "wiek":32} # klucze: dict_keys - obiekt, ktory przechowuje klucze print(slownik.keys()) # wartości print(slownik.values()) # items() zwraca parę - klucz oraz wartoś...
5483f23cfbf44f9df0ebfb8b6052cc6323ba60df
KalinaKa/Explosive-Dragon
/practise/towar.py
1,215
3.609375
4
class Towar(object): vat_pct = 0.23 ile_produktow = 0 def __init__(self, name, color, price): self.name = name self.color = color self.price = price Towar.ile_produktow += 1 def __str__(self): return f'Spodnie {self.name}, kolor: {self.color}' \ ...
cf54ac4737fc782d8004b1b7500675662e12894c
GreyProgramming/PythonW1
/BackToBack.py
228
3.828125
4
msg = input("What message do you want to reverse? ") j = -len(msg) word = "" i=-1 while i>=j: if msg[i]==" ": print(word) word="" else: word=msg[i]+word i-=1 if search in word: print(word)
e154edb662576a048157f393ed2e88bc16db97f6
GreyProgramming/PythonW1
/characterfinder.py
272
3.703125
4
found = 0 msg = input("Enter a search string: ") find = input("What are you searching for?") i=0 while i<len(msg): if msg[i]==find[0]: if msg[i:i+len(find)]==find: found+=1 i+=len(find)-1 i+=1 print("done! found",found,"instances.")
071d094d4e8ad94c7b030742933d21f048bcf083
GreyProgramming/PythonW1
/BasicLoop.py
177
3.828125
4
Base = int(input("What times table do you want to see? ")) print("Printing times table of ",Base) i=1 while i<=10: print(Base,"*",i,"=",(i*Base)) i=i+1 print("Goodbye!")
ccfc68f496a8b53f9e40728e22727c128c6b2aa8
vaishakik/APS_2019
/CODES/Climbing Leader board using Dense ranking.py
1,428
3.59375
4
#!/bin/python3 import math import os import random import re import sys # Complete the climbingLeaderboard function below. def climbingLeaderboard(scores, alice): print(alice) R1 = [0 for x in range(len(alice))] R = [0 for x in range(len(scores)+1)] for k in range(len(alice)): ...
9ed6c79583004f0d7a78fb3ce89a9ad85d25a8e3
Pradeepsimhabj/Sample
/Missing number.py
86
3.640625
4
l=[1,2,4,5] m=[1,2,3,4,5] for i in m: if(i not in l): print('missing',i)
12876268665a529240ba0efba3db4327f2ac7f31
redg25/ProcessAutomationDemo
/py_files/manage_att_folders.py
913
3.5625
4
import os import datetime as dt def get_folder_path(attachment_dir): ''' Check if the current date folder exists under the root folder given as input'\ If not, creates the folder''' current_year = str(dt.datetime.now().year) current_month = str(dt.datetime.now().month) ...
1834a1101f6c00c6f99615a1a2996b96fb48e02e
leotsyang/tf2-attention
/decoder.py
3,694
3.53125
4
''' The decoder's job is to generate predictions for the next output token. 1. The decoder receives the complete encoder output. 2. It uses an RNN to keep track of what it has generated so far. 3. It uses its RNN output as the query to the attention over the encoder's output, producing the context vector. 4. It combin...
88764f06cb2c08601ac9afafdbb6d0b7cefd3fe8
vprogramer/Recept_Book
/class_attributes.py
322
3.59375
4
class Test: val1 = 1 val2 = 2 def __init__(self, data1, data2): print(self.val1, self.val2) val1 = data1 val2 = data2 print(val1, val2) print(self.val1, self.val2) self.val1 = data1 self.val2 = data2 print(self.val1, self.val2) t1 = Test(5, ...
845ce2f7ff6cc38ec3098c77394abeb5897a868a
TwylaWeiyuTang/Blockchain
/backend/blockchain.py
3,183
3.5625
4
from backend.blockchain.block import Block # since we import the whole block file, this file will also executes the codes that are not in # the Block function, as long as it's in block.py file class Blockchain: """ Blockchain: a public ledge of transactions. Implemented as a list of blocks - dataset of tra...
2f49c71ad30518ba58099564b307b8b1723fe5b2
luzpaz/floor-planner
/src/text.py
5,031
3.578125
4
import sdl2 from view import FontSize class Text: """Wrapper class around text to be displayed. Contains the relative position and size to the application screen size (%), the font, and the text color.""" def __init__(self, relative_x = 0, relative_y = 0, font = FontSize.SMALL, color...
880838d4b00444c6f8f48fd9161fc8eb3651845d
yizhenxiao/zhoubao
/sum.py
827
3.578125
4
#path="D://学习//code//C语言//strlen.txt" def sum(): count = 0 filename = open("aaab.txt",'r') filecontents = filename.read() for filecount in filecontents: if filecount == '\n': count += 1 if filecontents[-1] != '\n': count +=...
c7fb4d0c6ded639441a9f0c62d961e873ba4e81c
pavankjadda/PythonRestApi
/com/demo/domain/Car.py
1,211
3.53125
4
#self and this are same. It can be anything but it should be first paramater in method from com.demo.domain.Owner import Owner class Car: def __init__(self,make,model,color,year,owner): self.make=make; self.model=model; self.color=color self.year=year; self.owner=owner; ...
2069cdf48656121df91bcc30ffe95be6a01d0392
ksharonkamal/workshop
/day3/2.py
236
4.125
4
#program to sum all items in dictionary dict1 = {"tony" : 100 , "thor" : 200 , "peter" : 300 ,"strange" : 400} sum = 0 # for i in dict1.values(): # sum+=i for i in dict1: sum+=dict1[i] print("sum of items in dict1 is ",sum)
e83b64d903cac5789dd4d5ee490309d296e501c4
AstralVX/oidhex_to_dot
/oidhex_to_dot.py
3,342
3.5625
4
# Supports both hex notation with and without spaces def oid_hex_to_dot(oidhex_string_orig): # Remove any spaces oidhex_string = '' for c in oidhex_string_orig: if c != ' ': oidhex_string += c ''' Input is a hex string and as one byte is 2 charecters i take an e...
2161f98d42039ff94a775975c4c56a79ba737c3e
kigawas/lintcode-python
/answers/easy/binary-tree-inorder-traversal.py
628
3.859375
4
""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param root: The root of binary tree. @return: Inorder in ArrayList which contains node values. """ def inorderTraversal(self, root): ...
b458fd8c02ee10fae191746befd45720c2972d6a
anthonypitts2022/FarmersMarketFinder
/markerFinder.py
3,031
4.3125
4
def read_markets(filename): #A dictionary mapping zip codes to lists of farmers markets zip_to_markets = {} #A dictionary mapping towns to set of zipcodes town_to_zip = {} with open(filename, 'r') as f: for line in f: market_as_list = line.split("#") ...
1dd5384c6ec265ad5b8c40b6c0b9f4fd05226e90
Raghumk/TestRepository
/File_IO.py
778
3.71875
4
#Reading keyboard input # Input & Output works in command line ''' Name = input("Enter Name: ")\ print (Name) ''' file = open('File_IO.py') print ("Name of file : ", file.name) print("Open/Closed : ", file.closed) print("Opening mode: ", file.mode) print ("File contents\n------") print(file.r...
c0421854953fd6080d9eefc56fade47695ffa823
Raghumk/TestRepository
/Functions.py
1,076
4.46875
4
# Parameter functions is always pass by reference in Python def fun1( Name ): Name = "Mr." + Name return Name def fun2(Name = "Raghu"): Name = "Mr." + Name return Name print (fun1("Raghu")) print (fun1(Name="Kiran")) # Named argument print (fun2()) # Default argument #### Variable l...
661fe981ec3b27d9b9d4f5d36e30634bf642d196
Raghumk/TestRepository
/Tuples.py
310
4.40625
4
#Tuples are sequence of Immutable (unchangable) objects tup1= ('physics', 'chemistry', 1997, 2000) tup2 = (1, 2, 3, 4, 5 ) tup3 = "a", "b", "c", "d" print (tup1, "\n", tup2 , "\n" , tup3 ) # accessing tuple elements is same as accessing list element print (tup1[1]) # chemistry. del tup1
b5ead5724223aa75a12f6e8d88c07e3348231d4c
griimick/feature-mlsite
/app/static/hindi-dependency-parser-2.0/hindi-pos-tagger/bin/lemmatiser.py
1,258
3.59375
4
#!/usr/bin/env python ''' Usage: python lemmatiser.pl lemmaFile < input > output The input should have two colums <html> word1 tag1 word2 tag2 . ''' import sys import re lemmaDict= {} # word : { pos : lemma} def loadLemmatiser(file): for line in open(file): line=line.strip() word= line.split('\t...
66ed753d7c82152fdc2135c2cadc62e58cc0883b
ejvr527/AP156
/03 Electrical circuits/circuit_initial.py
3,294
3.65625
4
import cmath import numpy as np import matplotlib.pyplot as plt import sympy from sympy import Symbol, simplify from sympy.solvers import solve print "\nElectrical Circuits\n" vo = Symbol("vo") vr = Symbol("vr") ir = Symbol("ir") ic = # complete the line il = # complete the line r = # complete the line omega = Symbol(...
3cab211f34ebc7becd0855bc094d8da6846a8505
JaimePillar/Information-Security-with-Python
/4.3_Gerador_Wordlists_-_with_itertools.py
357
3.953125
4
import itertools result=itertools.permutations('abc',3) ##result: <itertools.permutations object ...> ################### String=input('String a ser permutada: ') len_result=4 len_result=len(String) result=itertools.permutations(String,len_result) #result=itertools.permutations(String) for c in result: ##print(c) ...
e6a9b60ee7a3e087b5303fffda18f2cdb70f6ad2
granth19/Old-Python-Stuff
/Dice Roll Sim.py
831
3.609375
4
import random import turtle def roll(): d1 = random.randint(1,6) #d2 = random.randint(1,6) #return d1+d2 return d1 myTurtles = [turtle.Turtle() for t in range(7)] yStart = -200 def setup(): loc = -100.0 for i in range(len(myTurtles)): myTurtles[i].speed(30) myTur...
0b422c905b8d168413ad1d1ff293e74ad04caf83
pjconde/Python-Examples
/OOPPython.py
2,283
3.703125
4
#Pablojose Conde #pjconde@gatech.edu def isPalindrome(aString): if aString == "": ## Sets the base case, the base case being if the string is empty return True elif aString[0] == aString[-1]: ## Establishes a check to see if the first and last characters match aString = aString[1:-1] ## Cuts t...
db3d10376bc5a7212c4d691069ee633db573f96b
AnshulDasyam/python
/syntax/scratch_2.py
93
3.859375
4
xyz = str(input("first name")) zyx = str(input("last name")) print("reverse=",zyx ," ",xyz)
51f46441049a5c7eba357d3cc7ebea7e731e94cb
AnshulDasyam/python
/syntax/scratch_3.py
251
3.875
4
inp = int(input('enter a number ')) if inp < 1000 : print("less than 1000") if inp < 100 : print("less than 100") if inp < 10 : print("less than 10") else : print("more than 1000") if inp ==9 : print ("9") print("all done")
5298fb4d1315eae602f72720e9633db9ac834c65
BDanalysis/HBOS-CNV
/mytime.py
1,454
3.671875
4
import time as t class MyTimer(): def __init__(self): self.unit=['year','month','day','H','M','S'] self.prompt="not begin yet" self.lasted=[] self.begin=0 self.end=0 #开始计时 def __str__(self): return self.prompt __repr__=__str__ def __add__(self,oth...
81dec16b272a8efb85cf48cd9835118c24542633
khitermedachraf/-Python
/demarer votre projet avec PYTHON/premier_script.py
1,206
4.0625
4
# -*- coding: utf8 -*- quotes = [ "Ecoutez-moi, Monsieur Shakespeare, nous avons beau être ou ne pas être, nous sommes !", "On doit pouvoir choisir entre s'écouter parler et se faire entendre." ] characters = [ "alvin et les Chipmunks", "Babar", "betty boop", "calimero", "casper", "le ...
ebb4fa83384b3234036dfdba8131b812ac18e21d
NelsonM9/ejercicios-de-python
/ejercicio3.3.py
348
3.859375
4
n1 = int(input("ingrese un numero")) n2 = int(input("ingrese otro numero")) if n1 > n2: print("el primer numero ingresado que es "+str(n1) + " es mayor que el segundo numero que es "+str(n2)) pass else: print("el segundo numero ingresado que es "+str(n2) + " es mayor que el primer numero...
13952f7bf9c8779650ed2616d0be8d2f00c197ad
zjam9333/StudyOpenCV
/demos/Image Processing in OpenCV/Histograms/histogramsBackprojection.py
4,336
3.859375
4
# It was proposed by Michael J. Swain , Dana H. Ballard in their paper Indexing via color histograms. # What is it actually in simple words? It is used for image segmentation or finding objects of interest in an image. In simple words, it creates an image of the same size (but single channel) as that of our input imag...
1cf09ac0a8ed8124fec1f4001535f31928da4e69
zjam9333/StudyOpenCV
/demos/Core Operations/Basic Operations on Images/basicOperationsOnImages.py
3,712
3.875
4
# Goal # Access pixel values and modify them # Access image properties # Setting Region of Image (ROI) # Splitting and Merging images # Almost all the operations in this section is mainly related to Numpy rather than OpenCV. A good knowledge of Numpy is required to write better optimized code with OpenCV. # ( Exampl...
b21492a054e9d403007fa76f8fecf5ed6b119710
zjam9333/StudyOpenCV
/demos/Image Processing in OpenCV/Template Matching/templateMatching.py
3,286
3.9375
4
# Template Matching # Goals # In this chapter, you will learn # To find objects in an image using Template Matching # You will see these functions : cv2.matchTemplate(), cv2.minMaxLoc() # Theory # Template Matching is a method for searching and finding the location of a template image in a larger image. OpenCV comes...
f3da208fab30417e89ffefd190b5a0a0214076fc
zjam9333/StudyOpenCV
/demos/Image Processing in OpenCV/Histograms/histograms2D.py
2,030
3.953125
4
# Introduction # In the first article, we calculated and plotted one-dimensional histogram. It is called one-dimensional because we are taking only one feature into our consideration, ie grayscale intensity value of the pixel. But in two-dimensional histograms, you consider two features. Normally it is used for findin...
98e5230a3284639e39848e08fc0d595a29eb2b80
septos/python_software
/program_kasir.py
2,386
3.84375
4
print(""" =========================================================== PROGRAM KASIR SEDERHANA =========================================================== ( 1 ) Baju ( 2 ) Tas ( 3 ) Jam """) # x = [] # harga_barang = [] def tanya(): while True: # print("=====Barang Tidak Tersedia,Silahkan Pilih Lainny...
15446910f4f2665c32c67c628fc1a86c5aad33a9
Shweta-yadav12/loop
/Loopquestionno9.py
498
3.796875
4
# Courses # Login/Signup # Question 9 # Ek algorithm banao jo user se 2 number input lega. Aur fir unn number ko multiply # karke print kare. Jaise, agar input hai 5 aur 4 tab 20 print hona chahiye. Note:- # Aap * yaani ki multiply operator ka numbers ko multiply karne ke liye use nhi kar # sakte. Aap aur kisi bhi ...
29febb3ad31775376f1c51bcca04b245f2881ba7
Shweta-yadav12/loop
/Loopqusonno1-7.py
198
3.515625
4
# Question 7 # Yeh pattern print karo. # 5 5 5 5 5 # 4 4 4 4 4 # 3 3 3 3 3 # 2 2 2 2 2 # 1 1 1 1 1 i=5 while i>0: a=5 while a>0: print(i,end="") a-=1 print() i-=1
24851e56fd5704a5693657d13cee92004aa81d7c
kneesham/cmp_sci_4250
/Main.py
2,458
4.25
4
### # Name: Theodore Nesham # Project: 4 # Date: 11/02/2019 # Description: This project was used to show inheritance, polymorphism, and encapsulation. The parent class is Product # and the two children classes are Book and Movie. The two subclasses override the print_description # function sho...
a74acfcb9120c3774fd6d9d0bf305c70dfe1d84e
duhizjame/PPI-materials
/02_python_constraint/2_04.py
931
3.578125
4
# 4 9 2 # 3 5 7 # 8 1 6 # import constraint def o(x,y,z): if x+y+z == 15: return True problem = constraint.Problem() # Promenljive: # a b c # d e f # g h i problem.addVariables("abcdefghi", range(1,10)) problem.addConstraint(constraint.AllDifferentConstraint()) # Dodajemo ogranicenja za svaku vrstu pr...
72524d2672bec70b8bdaf2947ae9ce5009bc0169
bachanid23/GameDesign2021
/Level2File.py
4,671
3.609375
4
#Deeya Bachani #K_UP=up arrow #K_DOWN=down arrow #K_LEFT=left arrow #K_RIGHT= right arrow #creating screen/basics import pygame, time, sys,os, datetime from pygame.locals import * os.system('cls') print(sys.path) pygame.init() pygame.time.delay(100) WIDTH=800 HEIGHT=800 #create the objects white=[255, 255, 255] pu...
90f462b4239534e77f8400a7a94352c925e6a236
bachanid23/GameDesign2021
/TrialofHangman.py
5,444
3.6875
4
import os, sys, time, pygame, random, math pygame.init() #Create my display screen WIDTH = 800 # uppercase because it behaves as constant HEIGHT = 500 screen = pygame.display.set_mode((WIDTH,HEIGHT)) pygame.display.set_caption("Hangman GAME!") # Define Colors WHITE = [255,255,255] BLACK = [0,0,0]...
0adbeeee4f40539fa9d9eb942f5e25a71c51aa76
Neromaru/SoftservElementary
/Task3/main.py
3,422
4.09375
4
from math import sqrt NOT_EXISTS = 0 class TriangleBank: def __init__(self): self.bank = {} @staticmethod def normalize_string(string): lower = string.lower() no_spaces = lower.replace(' ', '') no_tabs = no_spaces.replace(' ', '') return no_tabs @staticmeth...
832dcc93d966246f33219bcab7fabb21853fb7ed
MohamedElashri/Physics
/Statistical Mechanics/Ising/Python/2d/IsingModel.py
8,143
3.9375
4
#coding: utf-8 #---------------------------------------------------------------------- ## 2d Ising model Monte-Carlo Simulation ## Author: Mohamed Elashri ## Email: elashrmr@mail.uc.edu ## Algorithm ## 1- Prepare some initial configrations of N spins. ## 2- Flip spin of a lattice site chosen randomly ## 3- Cal...
c269df6a9e5ab28181e7073991e7fcd6756e1c6d
ahermassi/Spell-Checker
/src/trie/trie.py
1,712
4.125
4
from src.node.trie_node import TrieNode class Trie: def __init__(self): self.root = TrieNode() def __contains__(self, word): """ Returns if the word is in the trie. :type word: str :rtype: bool """ word = word.strip() root = self.root f...
2b6ce01d7aa7c9738783adb6effb498bdef9e73c
lily01awasthi/PythonAssignment-III
/acdemyapp/academy/academy.py
3,637
4
4
from acdemyapp.student.student import Student import csv import pandas as p class Academy: course_list = ['python', 'java', 'JavaScript', 'Django', 'php'] def menu(self): print("welcome...!") print(""" 1.Inquiry courses/Register 2.Display students 3.Update student inf...
5b4c5d6d68ffe29f0fdc8bab6032ad96559faff0
ugo-developement/Customer-Order-DB
/CustomerFile.py
413
3.515625
4
class Customer: def __init__(self, custID, created, custStatus, custName, birthday, emails): self.custID = custID self.created = created self.custStatus = custStatus self.custName = custName self.birthday = birthday self.emails = emails class CustomerEmails: de...
f48fdd0706c433f5071996f93ab1c02e35ecf2cc
Robbyyasin11/python_sederhana
/13 - Operator Bitwise.py
1,792
3.984375
4
#Operator Bitwise , operator binar, binary a = 9 b = 5 # Bitwise OR atau (|) c = a | b print(2*"=","OR",2*"=") print("nilai : ",a," , binary : ",format(a,"08b")) print("nilai : ",b," , binary : ",format(b,"08b")) print('------------------------------------- (|)') print("nilai : ",c,", binary : ",format(c,"08b")) #nil...
55fb5e629c88e95a69855bb0c07353b6d190e15b
luoxiangyi222/Casper_Dynamic_NN
/data_preprocessing.py
4,530
3.96875
4
# comp4660 assignment 2 code # Author: Xiangyi Luo (u6162693) # Time: May 2020 """ Data pre-processing is very important. This module provide some pre processing functions As we have small depression data set, the LDA was used for dimension reduction. In this assignment, I want to show that how dimension reduction tec...
2c8763833f5a9f714c3b9d8d5e006aa2d468527c
cgebbe/coursera_win_competition
/auxiliary/check_pandas.py
168
3.671875
4
import pandas as pd df = pd.DataFrame() df.loc[0,"hello"]="world" df.loc[1,"foo"]="bar" df.head() #%% dfafsf #d print("youu") #%% afadsfa # # print("we") df.head()
dab9fcae2205cbc16c6962132aecc3d85ef6d3c7
poipiii/data-structures-and-algorithms-mini-project
/binarysearch.py
1,124
3.78125
4
from supermarket_model import SuperMarket def binarySearch(theValues, target,key): theValues = sorted(theValues, key=lambda x: getattr(x, key)) print([getattr(i,key) for i in theValues]) result = [] low = 0 high = len(theValues) -1 # until the target is found while low <= high and ...
7cc635765f2564097dfc91b8f0d07dc2b391aa64
ipetruniv/python-course-alphabet
/build_in_methods_iterators/tmp.py
134
3.90625
4
data = [3, 3, 6, -5, 5] print("So the normal way you might go about doing this task in python is using a basic for loop:".split())
d33d4476700e44dd2b956edc283fd1feaf3602c5
milenxxaa/Meupython
/maximonumeros.py
514
4.0625
4
def main(): ''' teste da funcao maximo ''' minha_lista = [23,74,634,89,35,3,964,345] maior_numero,indice = max_lista(minha_lista) print("O maior elemento é: ", maior_numero) print("O indice = ", indice) def max_lista(lista): ''' (list) -> int, int recebe uma lista de inteiros e retorna o ...
b5977407fe1d14ca422a0579a95b15956e23b3a3
Aniruddha10/Python-Learning
/MathStats.py
309
3.890625
4
# -*- coding: utf-8 -*- """ Created on Wed Jan 22 12:30:06 2020 @author: chakanc """ def square(x): return x**2 def cube(x): return x**3 def sum(start, end, funct): total=0 for i in range(start, end+1): total+=funct(i) return total print(sum(3,5,square)) print(sum(3,5,cube))
1a8a0e1d2e407a235a2b1de46554967d9ac13193
Aniruddha10/Python-Learning
/EmployeeMgmt/Python101/Day4/Animals.py
846
3.8125
4
# -*- coding: utf-8 -*- class Animal: _dogcount=0 def printmyname(self): print("It is me ") class Dog(Animal): __name = "" def __init__(self,aname): self.__name = aname Dog._dogcount +=1 def speak(self, sound): print('{} barking {}'.format(self.__name, sound)) ...
5be0400e627b24b561d77359734224fc67d7dcd8
e-888/25_11
/1.py
201
3.9375
4
a=int(input("введите первое число")) b=int(input("введите второе число")) if a>=b: for i in range(b,a+1): print(i) else: for i in range(a,b+1): print(i)
eb4875c0c56ae7932dc651141752f40e1906d2ce
anu003/Python-Programs
/Count_Letters.py
271
3.875
4
def count(ipstr): count_letters = {} letters = tuple(ipstr) for e in letters: if e not in count_letters: count_letters[e] = 1 else: count_letters[e] = count_letters[e] + 1 return count_letters print count("Hello")
a2247fd6cebe6cb6402b76386e1f1d0c40c0deab
anu003/Python-Programs
/directionReduction.py
495
3.53125
4
def dirReduc(arr): # your code reducible_dir = {"NORTH":"SOUTH", "SOUTH":"NORTH","EAST":"WEST", "WEST":"EAST"} i = 0 while i < len(arr)-1: if reducible_dir[arr[i]] == arr[i+1]: del arr[i] del arr[i] i = 0 else: i = i + 1 return arr a =...
a400497e631338337e736f5ceaf53768129d8a87
anu003/Python-Programs
/Format_Duration.py
2,425
3.8125
4
def format_duration(seconds): #your code here hours = 0 days = 0 years = 0 result = "" minutes, seconds = divmod(seconds, 60) if minutes >= 60: hours, minutes = divmod(minutes, 60) if hours >= 24 : days, hours = divmod(hours, 24) if days >= 365: ...
259fc54c5558abe927e02cb35c0a27f6c572e739
anu003/Python-Programs
/test.py
995
3.5
4
##def reverse_fun(n): ## # start flippin! ## pass ## list_str = list(n) ## len_str = len(list_str) ## result = "" ## ## for j in range(0, len_str): ## temp = "" ## for i in range(len_str-1, -1, -1): ## temp = temp + list_str[i] ## temp_str = list(temp) ## l...
0403b0ae8ddb20642734cb691b463bae50172863
frolovconst/AML_labs
/lab6/run.py
1,773
3.78125
4
import numpy as np from sklearn.metrics import f1_score from utils import load_data, train_test_split X, Y = load_data("iris.csv") X_tr, Y_tr, X_t, Y_t = train_test_split(X,Y,.7) class KNN: def __init__(self): """ Your initialization procedure if required """ pass def fit(se...
71d86359cefe427f8d6ea21189e7fdb69745506c
CTKogstrom/PerformantProgrammingInPython
/Assignment2/pakudex.py
3,859
3.609375
4
from pakuri import Pakuri def print_menu(): print("\nPakudex Main Menu") print("-----------------") print('1. List Pakuri') print('2. Show Pakuri') print('3. Add Pakuri') print('4. Remove Pakuri') print('5. Change Pakuri Level') print('6. Exit \n') def handle_list_pakuri(pa...
8cd3a67b2ed32d0eda729aeb1ad07b85f287e65a
IshteharAhamad/project
/core_python/position_of_substr.py
399
3.9375
4
str = input("Enter the main string here : ") sub = input("Enter here sub string : ") flag = False # default flag position = -1 #last index position while True: position = str.find(sub,position+1,len(str)) #inceament of position and find substr also length if position==-1: break print("found the p...
9e57670ba74f3b907558aa6761fb1390a4117ffb
IshteharAhamad/project
/core_python/format.py
326
3.59375
4
name = "khan" rn = 176 sal = 15000 print("{} is good boy \n{} Roll no. \n{} salary ".format(name,rn,sal)) print("********************************* remove the duplication *****************************") str = input("enter string : ") l = [] for i in str: if i not in l: a =l.append(i) out = ''.join(l) print...
e451ddffa0a174f7ab8f76a6eaea0022c74cfca6
IshteharAhamad/project
/super.py
355
4.03125
4
class Parent: def __init__(self,name):#without super function only child class constractor exicute #self.name=name print(name) class Child(Parent): def __init__(self): print("hello this is child class") Parent.__init__(self,name="now exicute parent class")#without using super fun...
d7b9f50ad31055bb350a616befb99c2f7c314959
ACow3/python
/python/OOP/chaining.py
954
3.640625
4
class User: def __init__(self, name, email): self.name = name self.email = email self.account_balance = 0 def make_deposit(self, amount): self.account_balance += amount return self def make_withdrawl(self,amount): self.account_balance -= amount retur...
af49f169d9e2af222d3b8e8743c804e7cf1c632b
valentinomaretto/valentin
/calculadora.py
772
4.09375
4
print("CALCULATOR") answer=1 infinito=1 while infinito > 0: operation=input("what operation do you want to do? (sum/subtraction/multiplication/division)").upper() first_number=float(input("First number:")) second_number=float(input("Second number:")) if operation=="SUM": answer=fir...
20c9a0d4e9570f393123df7103fd4bd2944b4e25
valentinomaretto/valentin
/counting_points.py
424
3.703125
4
print("Contador de puntos, comas y espacios") puntos="." comas="," espacios=" " frase=input("Escribi tu frase:") coma=0 punto=0 espacio=0 for letra in frase: if letra in comas: coma += 1 elif letra in puntos: punto += 1 elif letra.isspace()==True: espacio +=1 p...
5ff80d3a28c2ef88716785598784f4137b5cb444
valentinomaretto/valentin
/bazinga.py
565
3.59375
4
list_to_replace=[1,2,3,4,56,6,67,8,9,0,10,12,13,14,15,16,17,18,19,20,21,22,23,45,2356,45,786,2456,12233] sustitution=None for position in range(len(list_to_replace)): if list_to_replace[position] % 5 == 0 and list_to_replace[position] % 3 == 0: sustitution="bazinga" elif list_to_replace[posit...
d0d10ecfaf1ecac67fde333499a78c5b7a0a061b
DenisPecherin/Lab-2-
/3.py
386
4
4
# Решите задачу о Ханойской башне def moveTower(height, fp, tp, wp): if height >= 1: moveTower(height-1, fp, wp, tp) moveDisk(fp, tp) moveTower(height-1, wp, tp, fp) def moveDisk(fp,tp): print("Переложить диск с",fp,"на",tp) n = int(input("Введите высоту башни\n")) moveTower(n,"A","B","...
580d41a8f9f430feaac5bdfbd8126afffa481d00
Tochi-kazi/Unit3-10
/calculate_average .py
358
4.15625
4
# Created by : Tochukwu Iroakazi # Created on : oct-2017 # Created for : ICS3UR-1 # Daily Assignment - Unit3-10 # This program displays average print('type in your score') userinput = input() counter = 0 numtotal = 0 for userinput in range (0,100): numtotal = numtotal + userinput counter = counter + 1 ...
fe04436833bfa56150b8f4b5be03d818ee04ebeb
kashishy/MLTraining
/mlpackage01/MLPractical15.py
1,181
3.921875
4
import pandas as pd # for deciding number of digits after decimal from numpy import set_printoptions # start by capital letter is class of code (here MinMaxScaler) from sklearn.preprocessing import MinMaxScaler # to load code in a file we have to use round brackets after name filename = 'indians-diabetes.data.csv' hna...
065b0083267121b5455b604014ebe77bc8978adc
kashishy/MLTraining
/mlpackage01/MLPractical28.py
486
3.625
4
import numpy as np arr = np.array([11, 22, 33, 0., 44, 55]) # this is for only numpy type array print("arr.sum() = ", arr.sum()) # this can be used in any type of numerical array(old or numpy type) print(np.sum(arr)) print("arr.std() = ", arr.std()) # for numpy type array print("arr.mean() = ", arr.mean()) # for old...