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
0107ef51c395c72c71ed04bed672f79608fffdb6
RagaPraneeth7/question3
/question3.py
1,013
3.609375
4
for _ in range(int(input())): # read number of test cases n= int(input()) # read the nth strip h=list(map(int,input().split())) # read the heights of the ground ino list b=h.reverse() # reversing the list h c=0 ...
295c7445e45723550c0d0a76740f9118233a601c
gautamkumar94/Introduction_to_Computer_Science_and_Programming-Using_Python
/decimalToBinary
254
3.734375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 25 09:14:25 2018 @author: gautam """ num = 11 result = '' if num == 0: result = '0' while (num > 0): result = str(num%2)+result num = num//2 print(result)
889597296986ae2a7882a3f939c23dcb98e41f1e
gautamkumar94/Introduction_to_Computer_Science_and_Programming-Using_Python
/string_immutable
945
3.515625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 24 07:50:13 2018 @author: gautam """ s ="hello" print(s) print(s[0]) #s[0]=1 /we cant change the value of strings s = "y" + s[0:len(s)] print(s) # LOOP IN STRING s = "abcdefgh" for index in range(len(s)): if s[index]=='i' or s[index] == 'o...
ccac15c3549eb4a098e3b4114856c6e09b8dad67
4n6strider/eve-bot
/deploy/keyword_exploration.py
9,455
3.53125
4
import streamlit as st import pandas as pd import numpy as np # Visualization import seaborn as sns import matplotlib.pyplot as plt sns.set(style="ticks", color_codes=True) # Making my visualizations pretty sns.set_style("whitegrid") # Combination exploration import itertools import yaml # Loading back processed dat...
cab16afde85b337fbd83c4161059214c88fe5ffc
faizsyam/LatihanGit
/day6.py
5,093
3.515625
4
# def bebas(kalimat, huruf) : # rmv = kalimat.replace(huruf.upper(), '') # rmv = rmv.replace(huruf.lower(), '') # print(rmv) # bebas('Anugrah', 'a') # def MainSuit(ply1, ply2) : # yang_boleh = ['batu', 'gunting', 'kertas'] # if not any(ply2 in s for s in yang_boleh) and not any(ply2 in s for s i...
088b284bf01116a6c8daf484caa9e58df3b75e40
faizsyam/LatihanGit
/day1.py
1,575
3.984375
4
import math print("Hello World!") def my_function(): # x = 4 # y = 3 # z = 2 # w = pow((x + y * z)/(x * y),z) # print(w) # a = int(input("Silahkan masukkan angka berapapun : ")) # print(f"Kuadrat dari {a} = {a**2}") # hari = int(input("Berapa hari? : ")) # tahun = hari//360 ...
424ccb48972c2d129c349de753ff4c2bd5416411
gaybro8777/LeetCodeSol
/algorithms/20_ValidParentheses.py
781
3.5625
4
class Solution: def isValid(self, s): """ nothing to say, very straight forward using stack, O(n) solution with best runtime 52ms, beats 99% """ if not s: return True list = [] # use list to keep track of brackets that are not mapped yet, used as stack ...
68cdb0040d8575c2bb76ee9ffe8934a202a26270
v13aer14ls/exercism
/bob.py
347
4.09375
4
# Python 3.x # Mantainer = Guilherme Amaral speech = input("Say something to Bob : ") if speech.strip()== "": print ("Fine. Be that way!") elif speech.endswith("?") and speech.isupper(): print ("Calm down, I know what I'm doing!") elif speech.isupper(): print ("Woah, chill out!") elif speech.endswith("?"): print ...
0ae6074efd9a9b393439a72b9f596d4baf09f7c8
v13aer14ls/exercism
/salao_de_beleza.py
1,538
4.21875
4
#!/bin/python2/env #Guilherme Amaral #Mais um exercicio daqueles hairstyles = ["bouffant", "pixie", "dreadlocks", "crew", "bowl", "bob", "mohawk", "flattop"] prices = [30, 25, 40, 20, 20, 35, 50, 35] last_week = [2, 3, 5, 8, 4, 4, 6, 2, 1] #1. Create a variable total_price, and set it to 0. total_price = 0 #2. I...
0f78ddd9c9cec9bd00090e7727dfca6145cc41db
deepakcse2k5/leetcode_prob_in_python
/remove_duplicates.py
307
3.609375
4
nums =[1,2,2,3,4,4] # print(nums.remove(2)) def remove_duplicates(nums): if not nums: return 0 slow =0 for fast in range(1,len(nums)): if nums[slow]!=nums[fast]: slow+=1 nums[slow]= nums[fast] return slow+1 print(remove_duplicates(nums))
ff01b081c831b0593ebb3722ee47ca04b2406991
Praneeth313/Python
/Loops.py
1,363
4.25
4
# -*- coding: utf-8 -*- """ Created on Thu May 6 23:02:40 2021 @author: Lenovo Assignment 5: Basic Loop Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of ...
1b5ffbfa1e49d1626eeedc2ea1125df86e895e3f
akshat12000/Python-Run-And-Learn-Series
/Codes/178) os_module2.py
1,442
3.75
4
import os import shutil os.chdir(r'D:\ieeepromo(materials)') fileiter= os.walk(r'D:\ieeepromo(materials)') # this is a generator object and it contains 3 different values which contains # current path, folder names and file names in the list format print(fileiter) for current_path,folder_names,file_names in ...
c18b81805afcd5246695b9f3a365f80ba383c3a8
akshat12000/Python-Run-And-Learn-Series
/Codes/13) formatting.py
218
4
4
name = "Akshat" age = 20 print("Your name is "+ name +" Your age is "+str(age)) #python 3 print("Your name is {} Your age is {} ".format(name,age+2)) #python 3.6 print(f"Your name is {name} Your age is {age+2} ")
c9c164a8be556c91eca2873acabfa475ad44b222
akshat12000/Python-Run-And-Learn-Series
/Codes/49) functions2.py
311
4.0625
4
# return vs print def add_three(a,b,c): return a+b+c add_three(5,5,5) # this will just evaluate the sum and not print it print(add_three(5,5,5)) # this will print the result as well # now lets see an another case def adder(a,b,c): print(a+b+c) adder(5,5,5) # now this will print our result
9018be0092cebcda903279b87fcdb9e78a8c79fb
akshat12000/Python-Run-And-Learn-Series
/Codes/98) list_comprehension_in_nested_list.py
389
4.53125
5
# List comprehension in nested list # We want the list --> [[1,2,3], [1,2,3], [1,2,3]] # Method 1)--> without list comprehension l=[] for i in range(3): p=[] for j in range(1,4): p.append(j) l.append(p) print(l) # Method 2)--> with list comprehension l1=[[i for i in range(1,4)] for _ in...
a275c5fbdb0596017e7fb31131e9d1b3286676a5
akshat12000/Python-Run-And-Learn-Series
/Codes/132) decorator_practice.py
967
4.09375
4
from functools import wraps def add_all(*args): total=0 for i in args: total+=i return total print(add_all(1,2,3,4,5)) # print(add_all(1,2,3,4,[5,6,7])) this will give an error so to resolve such problem we will use a decorator which gives an error # message to user if any value other than i...
8f9ef1a6b1b42b511331646021caa6a7e9b298eb
akshat12000/Python-Run-And-Learn-Series
/Codes/104) args_as_argument.py
296
4.28125
4
def multiply(*args): mul=1 print(f"Elements in args are {args}") for i in args: mul*=i return mul l=[1,2,3] t=(1,2,3) print(multiply(l)) # OUTPUT: [1,2,3] print(multiply(*l)) # OUTPUT: 6 , here all the elements of the list will get unpacked print(multiply(*t))
3790cba15164331e7f6d5ff4635b4190729526b7
akshat12000/Python-Run-And-Learn-Series
/Codes/86) fromkeys_get_copy_clear.py
1,523
4.25
4
# fromkeys d=dict.fromkeys(['name','age','height'],'unknown') # this will create dictionary like this {'name':'unknown','age':'unknown','height':'unknown'} print(d) d1=dict.fromkeys(('name','age','height'),'unknown') print(d1) # same as dictionary d d2=dict.fromkeys("ABC",'unknown') # this will create dictionary...
3513342cbbba1aee157d3c27dce319c2eef4bcbc
akshat12000/Python-Run-And-Learn-Series
/Codes/100) dictionary_comprehension_with_if_else.py
446
4.40625
4
# Dictionary Comprehension with if else statements # we have to create a dictionary in such a way that when key is odd then it's value will be 'odd' and same goes with even keys # Method 1)--> without dictionary comprehension d={} for i in range(1,11): if i%2: d[i]='odd' else: d[i]='ev...
9065b40cebe0cd5dbe74649d0ed526ac17b4e9d2
akshat12000/Python-Run-And-Learn-Series
/Codes/46) step_in_range.py
245
4.15625
4
for i in range(1,11): # i will increment by 1 print(i) print() # this automatically create a newline for i in range(1,11,2): # i will increment by 2 print(i) print() for i in range(10,0,-1): # i will decrement by 1 print(i)
4cd283528b382fab7369630629c6f46d0993590c
akshat12000/Python-Run-And-Learn-Series
/Codes/134) generators_intro.py
569
4.65625
5
# generators are iterators # iterators vs iterables l=[1,2,3,4] # iterable l1=map(lambda a:a**2,l) # iterator # We can use loops to iterate through both iterables and iterators!! li=[1,2,3,4,5] # memory --- [1,2,3,4,5], list, it will store as a chunk of memory!! # memory --- (1)->(2)->(3)->(4)->(5), genera...
38a7bf7a5a28e77694b47b8a66d28373290ae27b
akshat12000/Python-Run-And-Learn-Series
/Codes/180) fileseparator.py
1,065
3.78125
4
# In this program we will be having a folder which contains differnt types of files and we have to separate each type of file # in the new folder import os,shutil dict_extension={ 'audio':('.mp3','.m4a','.wav','.flac'), 'video':('.mp4','.mkv','.MKV','.flv','.mpeg'), 'document':('.pdf','.doc','.txt'), ...
774270d6ba73132502a73f02b4af0c67c1d89824
akshat12000/Python-Run-And-Learn-Series
/Codes/18) exercise3.py
72
3.6875
4
name=input("ENTER USER NAME ") print(f"Your USER NAME is {name[::-1]}")
82703ca80bd6745995fd86e4de8a7ae6e978efc5
akshat12000/Python-Run-And-Learn-Series
/Codes/137) generators_comprehension.py
444
4.21875
4
# Genrators comprehension square=[i**2 for i in range(1,11)] # list comprehension print(square) square1=(i**2 for i in range(1,11)) # generator comprehension print(square1) for i in square1: print(i) for i in square1: print(i) # Notice that it will print only once!! square2=(i**2 for i in r...
5e5bcdee2c5fd58e9532872a8c4403e8cf47d49f
akshat12000/Python-Run-And-Learn-Series
/Codes/22) string_methods2.py
298
4.25
4
string="He is good in sport and he is also good in programming" # 1. replace() method print(string.replace(" ","_")) print(string.replace("is","was",1)) print(string.replace("is","was",2)) # 2. find() method print(string.find("is")) print(string.find("also")) print(string.find("is",5))
1b93ee1eed49fe7f564e09c8108631fbfea5198e
akshat12000/Python-Run-And-Learn-Series
/Codes/35) while_loop.py
223
4.03125
4
# our target is to print "Hello World!" 10 times i=1 while i<=10: # this condition will execute 10 times and checked 11 times !! (And this will execute till our condition is true) print("Hello World!") i=i+1
7613ae3e2b62c471be17440d5ce22679b7d61d0d
akshat12000/Python-Run-And-Learn-Series
/Codes/119) any_all_practice.py
421
4.1875
4
# Write a funtion which contains many values as arguments and return sum of of them only if all of them are either int or float def my_sum(*args): if all([type(i)== int or type(i)== float for i in args]): total=0 for i in args: total+=i return total else: r...
ea0f61c783a093d998866e3b7843daa2cbd01e4a
akshat12000/Python-Run-And-Learn-Series
/Codes/126) closure_practice.py
399
4.125
4
# Function returning function (closure or first class functions) practice def to_power(x): def calc_power(n): return n**x return calc_power cube=to_power(3) # cube will be the calc_power function with x=3 square=to_power(2) # square will be the calc_power function with x=2 print(cube(int(input...
4f870296262c4138339a20311a6a49728ae7b8d3
akshat12000/Python-Run-And-Learn-Series
/Codes/131) exercise25.py
698
3.96875
4
from functools import wraps import time # Write a function which calculates square of all numbers from 1 to n and use a decorator funtion to print it's execution time def calc_time(any_function): @ wraps(any_function) def wrapper(*args,**kwargs): print(f"Executing.... {any_function.__name__}") ...
aeb5ee424c8294a4122393642bb9b64b79424775
akshat12000/Python-Run-And-Learn-Series
/Codes/117) exercise24.py
454
4.09375
4
# Write a program which takes many lists and gives the average of the matching index elements of the lists # Example --> [1,2,5], [6,4,3], [9,8,7] average= [(1+6+9)/3 , (2+4+8)/3, (5+3+7)/3] # Note: Try to use lambda function (Bonus) l1=[1,2,5] l2=[6,4,3] l3=[9,8,7] # Method 1) res=list(map(lambda l:sum(l)/le...
407cbae2cbdb48102e31c791a06f9f5d546bce7e
akshat12000/Python-Run-And-Learn-Series
/Codes/184) labelframe.py
1,387
3.9375
4
import tkinter as tk from tkinter import ttk win=tk.Tk() win.title("LabelFrame") label_frame=tk.LabelFrame(win,text='Enter your text below') label_frame.grid(row=0,column=0,padx=10) l=['What is your name: ','What is your age: ','What is your gender: ','Country: ','State: ','City: '] for i in range(len(l)): ...
7232967214c29480b14d437eba3a42e5a2b23a5f
akshat12000/Python-Run-And-Learn-Series
/Codes/52) greatest_among_three.py
365
4.125
4
# Write a function which takes three numbers as an argument and returns the greatest among them def great3(a,b,c): if a>b: if a>c: return a return c else: if b>c: return b return c x,y,z=input("Enter any three numbers: ").split() print(f"Greates...
ba1551611784af483ea8341a3fdbccc5a5d8b235
akshat12000/Python-Run-And-Learn-Series
/Codes/135) first_generator.py
932
4.5625
5
# Create your first generator with generator function # Method 1) --> generator function # Method 2) --> generator comprehension # Write a function which takes an integer as an argument and prints all the numbers from 1 to n def nums(n): for i in range(1,n+1): print(i) nums(5) def nums1(n): ...
fd70a0a0c399b7ea099ad0df2069b1b861f7ac6d
akshat12000/Python-Run-And-Learn-Series
/Codes/58) intro_to_lists.py
702
4.3125
4
# A list is a collection of data numbers=[1,2,3,4,5] # list declaration syntax and it is list of integers print(numbers) words=["word1",'word2',"word3"] # list of strings as you can see we can use both '' and "" print(words) mixed=[1,2,3,4,"Five",'Six',7.0,None] # Here the list contains integers, strings, float...
6e4c2e7befa69142746c399811790e4a5fb8272f
yegarti/arcade
/arcade/geometry.py
2,596
3.59375
4
""" Functions for calculating geometry. """ import math from shapely import speedups # type: ignore from shapely.geometry import Polygon, Point # type: ignore from typing import List from arcade import PointList _PRECISION = 2 speedups.enable() def are_polygons_intersecting(poly_a: PointList, ...
7baff5e347895952bd2c8b09dbd4741056bb8cc9
Irhaml/MyCode
/Codeforces/huhu.py
234
3.5
4
from math import gcd t = int(input()) for i in range(t): a=input() b=input() kpk=len(a)*len(b)//gcd(len(a),len(b)) a = a*(kpk//len(a)) b = b*(kpk//len(b)) if a==b: print(a) else: print(-1)
a91462403105c6ecd23734be93b5095bd0b7897f
Irhaml/MyCode
/Hackerrank/Python/Python_FindRunnerUpScore.py
607
3.734375
4
#//////////////////////////////////////////////////////# #/ This program was written by Muhammad Irham Luthfi. /# #/ Intended for educational use. /# #/ No rights reserved. /# #//////////////////////////////////////////////////////# n = int(input()) # Split the num...
09703f28cbf7607d734880d85e2745e18ad936df
HoriYeori/Co-mmunity_Mogakko
/모각코 Day 9/모각코9-2.py
1,997
3.765625
4
## Problem welcome_message = "★☆★ Scores' average calculator ★☆★" print(f"\n\t {welcome_message} \n") ## Get input print("전체 과목 개수를 입력하세요.") while True: try: nSubject = int(input("\t전체 과목 수 :\t")) while nSubject < 1: print("최소한 1개의 과목을 입력해야 합니다. 1 이상의 수를 입력하세요.") nSubject =...
c78a34deb226bd1cf931ca33a0decc662a770f8d
HoriYeori/Co-mmunity_Mogakko
/모각코 Day 8/모각코8-1.py
1,386
3.96875
4
## Problem welcome_message = "★☆★ Perimeter and Area of Rectangle ★☆★" print(f"\n\t {welcome_message} \n") ## Class definition class Rectangle(): ## Constructor def __init__(self, width=0, height=0): self.width = width self.height = height ## Methods # Getter def get_perimeter(se...
976326c2e40e92eee5b7ca92dac31b3be426062c
HoriYeori/Co-mmunity_Mogakko
/모각코 Day 7/모각코7-2.py
1,789
3.734375
4
## Problem welcome_message = "★☆★ Drink Vending Machine ★☆★" print(f"\n\t {welcome_message} \n") ## Business begin! drinks = {'물': {'price': 700, 'quantity' : 2}, '콜라': {'price': 1000, 'quantity': 5,}, '사이다': {'price': 1000, 'quantity': 0}, ...
7762c2f46ad73f36b705a94be64cc576412e8056
pedrohs86/Python_introduction
/Aula_14.py
280
4
4
i = 0 while i<10: print(i) i = i + 1 lista1 = [1,2,3,4,5] lista2 = ["ola", "mundo", "!"] lista3 = [0,"ola", "mundo", "!", 9.99, True] for i in lista1: print(i) for i in lista2: print(i) for i in lista3: print(i) for i in range(10,20,2): print(i)
f6ff85bebf05c377052e30a8e7c7e7ea9a7ec1a9
pedrohs86/Python_introduction
/hello.py
908
4.1875
4
#-*- coding: utf-8 -*- # coment test mensagem = "eae mano" # print ("Hello world!") # print ('Olá mundo!') """ comentario teste """ # print ( 2**2 ) #potência # print ( 10%3 ) #Resto da divisão # print (mensagem) var1 = 1 var2 = 1.1 var3 = 'string' var4 = True x = 2 y = 10 s = x # print (x == y) # print (x < y...
1ac3f8de0ab36adbaaca97349934663435c6a843
HaroldBernieGarcia/GARIproject
/DICE ROLLS.py
2,470
3.734375
4
""" HAROLD BERNIE P. GARCIA / Antonio Riotoc DATALOG LP1.3 APRIL 23, 2020 I have neither received nor provided any help on this (lab) activity, nor have I concealed any violation of the Honor Code.""" import random print("[1] [2] [3] [4] [5] [6]") print("_____________________________") print(...
405fb9c654d5b7d3b8566481b0221f9b5bb6ce73
mrave001/PY4E_DataStruct_Challenges
/DataStructChuck/ex_10/ex_10.py
811
3.75
4
# Write a program to read through the mbox-short.txt and figure out the # distribution by hour of the day for each of the messages. You can pull # the hour out from the 'From ' line by finding the time and then splitting # the string a second time using a colon. Once you have accumulated the counts # for each hour, pr...
978d7fb2d60c640712453587d26dd350146afd80
indradevg/mypython
/cbt_practice/decor1.py
482
3.84375
4
#!/usr/bin/env python3 ''' @decorfun, decorates decorval() wrapped around it as below. decaoval() = "This is a decorator" @decorfun(decaorval()) = decorfun("This is a decorator") This string/function is passed to inside_decore and "String" is call range times. ''' def decorfun(anyfun): def inside_decore(): for i...
f803ca25ed0928e6c2786d99f26a2f69b5c69dd2
indradevg/mypython
/cbt_practice/for1.py
609
4.34375
4
#!/usr/bin/python3.4 i=10 print("i value before : the loop: ", i) for i in range(5): print(i) ''' The for loops work in such a way that leave's behind the i value to the end of the loop and re-assigns the value to i which was initializd as 10 in our case ''' print("i value after the loop: ", i) ''' The below line ...
60b632548da2d753cd16665f8494f3cc605ac568
indradevg/mypython
/cbt_practice/reduce_map_filter.py
533
4.0625
4
#!/usr/bin/python3.4 from functools import reduce ''' Program demonstrating the function of 3 built in functions viz.., "reduce", "map", "filter" ''' ''' To Concatnate the Array elements as one string ''' def addval(a,b): return a + b ''' Find the vowels in the given string ''' def fvow(a): return a...
6b4a6be9df82c8277f21eb2bc1f136870cd27844
indradevg/mypython
/cbt_practice/timer.py
356
3.75
4
#!/usr/bin/python3.4 import os print ("Welcome to the timer") timr = int(input("Enter how many sec you need the timer for: ")) while timr >= 0: if (timr%5) == 0: print ("%s sec left" % ((str(timr)).zfill(2))) os.system('sleep 1') timr -= 1 else: os.system('sleep 1') timr -= 1 continue if timr == -1: ...
c2f6326aca79a61c5e83447d3d2b76730b8d75cf
yichuyuan2/Example
/Example_Principle_Of_For-loop.py
152
3.6875
4
#For循环原理 string = "FishC" it = iter(string) while True: try: each = next(it) except StopIteration: break print(each)
b6ea51a48ca6e63a766de59acfcd8f7a9fe58245
danamur/CursoPython
/Sentencias Condicionales/SentenciaCondicionalesSimples.py
556
4.125
4
print("Sistema para cualcular el promerdio de un alumno") nombre = input("Para comenzar, ¿Cual es tu nombre?: ") matematicas = float(input(nombre + " ¿Cual es tu calificacion en matematicas?: ")) quimica = float(input(nombre + " ¿Cual es tu calificacion en quimica?: ")) lenguaje = float(input(nombre + "¿Cual es t...
e81d068021e2eb248346daf25096163191768be6
danamur/CursoPython
/Bucles/BucleWhile - RaizCuadrada.py
689
4.15625
4
import math print("-------------------------------------------") print("| Programa de cálculo de la raíz cuadrada |") print("-------------------------------------------\n") numero = int(input("Introduce un número por favor: \n")) intentos = 0 while numero < 0: print("No se puede hallar la raíz de un ...
28eb2d6008a44852b91aa461dabc53c6eada65df
yantian001/BubbleShooter
/platforms/android/assets/www/dw.py
1,241
3.578125
4
#coding=utf-8 import os,requests def downloadRes(serverUrl,filename): cur_file_path = os.path.abspath('.') #print cur_file_path save_file_name = os.path.join(cur_file_path,filename) #判断文件路径是否存在 dirname = os.path.dirname(save_file_name) dirname=dirname.replace('/','\\') if os.path.ex...
6a81dfd0e9314c49f4d176c3fea363fc84ccde29
holler4amarshall/python-oop-model-bicycle-industry
/main.py
2,167
3.640625
4
from bicycle_industry import Bicycle, Bicycle_store, Customer def main(): #add data to name the bicycles ladies = Bicycle(name = "Trek Chelsea 9", weight = 4, cost = 150000) urban = Bicycle(name = "Breezer Uptown", weight = 3.5, cost = 20000) hipster = Bicycle(name = "Felt York", weight = 5, cost = 7...
8a42e7be0253588c08667afaeea7762448044acc
aanch2000/mycaptain2
/prog2.py
241
4.0625
4
list1=[] n = int(input("Enter number of elements to be entered in the list: ")) print("Enter elements to be entered in list") for i in range(0,n): a = int(input()) list1.append(a) for p in list1: if p>0: print(p,end=" ")
140f0a15b3c6ba0c00c0068f999eec12d490bbf0
naomifox/mass-email-delivery-code
/ZipLookup.py
1,530
3.609375
4
# # Class for looking up state by zips # import csv class ZipLookup: def __init__(self): self.zipLookupTable = self.getZipLookupTable(open('zip_code_database.csv','rb')) def getZipLookupTable(self, zipdump): """returns a dict with of first zip to city and state""" d = {} reade...
7f8cbe2b04311b982eb6c28daf58f62a839a1b8d
justinrling/SCU-Coursework
/COEN 146/Lab 5/SMTPClient-secure-gmail.py
1,298
3.8125
4
# Behnam Dezfouli # CSEN, Santa Clara University # This program implements a simple smtp mail client to send an email to a local smtp server # the program runs the ping command, and emails the result using smtp.gmail.com # NOTE: Do not forget to allow login from less secure apps in your gmail account. Otherw...
167b45d88b5534414a2f66b364f539479be0d3d3
Venkat004/MubdiScripts
/mubdiscripts/greekletters.py
668
3.828125
4
""" A List of Greek Letters, indexed by order """ ### Lowercase Letters gk_lower = [ "alpha", "beta", "gamma", "delta", "epsilon", "zeta", "eta", "theta", "iota", "kappa", "lambda", "mu", "nu", "xi", "omicron", "pi", "rho", "sigma", "tau", "upsilon", "phi", "chi", "ps...
793c8845d903fe5246b6cb368cd822406fcc76e6
thanasissot/myPyFuncs
/kthDigit.py
119
3.578125
4
def kthDigit(a, b, k): """return the Kth Digit from right of a**b""" return ((a ** b) % (10 ** k)) // (10 ** (k - 1))
0c28d1d950dbbdf74ec827583dd7c46c331bc4b0
thanasissot/myPyFuncs
/fibonacci.py
481
4.1875
4
# cached fibonacci cache = dict() def memFib(n): """Stores result in cache dictionary to be used at function definition time, making it faster than first caching then using it again for faster results """ if n in cache: return cache[n] else: if n == 0: return 0 ...
a08af9028018c7d3678f43c08612d0142f348d08
paulruvolo/SoftDesSp15Working
/tools/fileio/fileiotool_counter.py
1,138
3.859375
4
#!/usr/bin/env python """ A sample implementation of the file_counter component of the fileio tool """ import os import sys def update_counter(file_name, reset=False): """ Updates a counter stored in the file 'file_name' A new counter will be created and initialized to 1 if none exists. If the counter already ...
d3d4fe44bb69702cae5869b55e61b71b77a75025
Shivansh-Commits/Basic-Programming-Using-Python
/Program(3).py
361
4.1875
4
#Q) Print 'Hello' if the no. is only divisible by 3 #Print 'Python' if the no. is only divisible by 5 #print 'Hello Python' if the no. is divisible by both 3&5 for i in range(1,51): if(i%3==0 and i%5==0): print("Hello Python") elif(i%3==0): print("Hello") elif(i%5==0): print...
2287f21456a759314169e17077db1df0a4cde628
rohanlot/codes
/PS03_rlotlika.py
2,476
3.515625
4
# Problem Set X.X.X: <Descriptive Title Here> # File: filename.py # Date: 1 January 2019 # By: Full Name # Login ID # Section: Number # Team: Team Number # # ELECTRONIC SIGNATURE # Full Name # # The electronic signature above indicates that the program # submitted for evaluation is my individual work. I hav...
dd72a2b2d9d4cdeabf254d1aeb98490263f2f4ba
ahnt-moe-heinn/CP1404Prac
/Week 2/exercies1_week2.py
132
4.03125
4
# for i in range(0, 13, 3): # print("{:02}".format(i)) name = "Monty" money = 73.6 print("{} has ${:.2f}".format(name, money))
016163bd16525ebf1a5ac000351e5fe3b6236c64
ahnt-moe-heinn/CP1404Prac
/Week 2/adding_numbers_file.py
233
3.5625
4
output_file = open("numbers.txt", "r") first_number = int(output_file.readline()) second_number = int(output_file.readline()) result = first_number + second_number print(first_number) print(second_number) print("Result: ", result)
a68f953b12493731c6d2fcc717140d8d9ac15ff5
ahnt-moe-heinn/CP1404Prac
/Week 1/sales_bonus.py
128
3.53125
4
sales = float(input("Enter sales: $")) if sales < 1000: print((sales/100)*10) elif sales > 1000: print((sales/100)*15)
8c7c2d88fc52a5998aa15cec68977d3929dcf8cc
ACM-UCI/Fall-2016-Practice
/Fall-2016-Practice/Week-1/WashingPlates.py
555
3.609375
4
vals = input().split() n = int(vals[0]) k = int(vals[1]) if k > n: k = n payments = [0]*n deductions = [0]*n for i in range(n): vals = input().split() payments[i] = int(vals[0]) deductions[i] = int(vals[1]) # Translate problem to subtract all deductions, then add deductions to each payment earnin...
2e7cac0160efd7983040f78787f0bad513502f12
saist1993/DeepLearningAssignment
/Assignment1/hw1_knn.py
1,602
4.0625
4
# -*- coding: utf-8 -*- """ Created on @author: fame """ import numpy as np import traceback import collections def compute_distance(X,Y): """ :param X: Input matrix 1 :param Y: Input matrix 2 :return: Euclidean distance between two matrix i.e a float value """ return np.sqrt(((X - Y)*...
4dfc5803efeca21d8b2da74dd61dcb89adb13a68
realpython/python-mock-example
/tests.py
960
3.5625
4
import mock import unittest from google import google_calc_addition class TestGoogleCalc(unittest.TestCase): def test_google_calc_addition_without_mock(self): problem_one = google_calc_addition(1, 1) problem_two = google_calc_addition(1, 2) problem_three = google_calc_addition(1, 3) ...
b85dddbb9cca45aa98ce1f906fb65c95b77af3e1
akforeverr/python
/stud.py
370
3.90625
4
n =input("Enetr the no. of students:") student_data=["stud_roll no","stud_name","stud_class"] for i in range (0 , n) stud_roll no=input("enter the roll no") print stud_roll no stud_name =input("enter the name of student") print stud_name stud_class =input("enter the class name") print stud_class dict{'name':stud_n...
da598fea48209e536a44a0fce90fd535cad909d7
098799/project_euler
/archive/012/triang.py
324
3.578125
4
from itertools import count from math import sqrt, floor def numofdiv(n): if n == 1: return 1 suma = 0 for i in range(2,floor(sqrt(n))): if n%i == 0: suma += 2 return suma+2 suma = 0 for i in count(1): suma += i if numofdiv(suma)>=500: print(suma) br...
4bde418cf1775bbc3826f9486ed4f9dd7a9fd6ee
098799/project_euler
/archive/007/prime.py
279
3.625
4
import math def checkprimeness(a): for i in range(2,int(math.sqrt(a))+1): if a%i == 0: return False return True sum = 0 i = 1 lista=[] while sum<10001: i += 1 if checkprimeness(i): sum += 1 lista.append(i) print(lista[-1])
6a3d74cccdc65889a5899798a79a07e4fb17bfd1
098799/project_euler
/archive/077/primesummations.py
771
3.53125
4
from math import floor, sqrt ###SIEVE FOR PRIME NUMBERS nn = 10**3 def sieve(n): primes = [True for i in range(n)] primes[0] = False primes[1] = False for i in range(2,floor(sqrt(n))+1): if primes[i] == True: for j in range(i**2,n,i): primes[j] = False return pr...
c857f667883c927a1a96052fc99d6403e52a060d
JiaLee0707/2019-Python
/Ex05-01.py
213
3.53125
4
import random ## 변수 선언 ## A, B count=0 while True: count += 1 A = random.randrange(1,7) B = random.randrange(1,7) print("총 %d번 던져 주사위 A와 B가 같아졌습습니다."%count)
0281e0caca322b8701acc8610b38a0bb8f4bd039
JiaLee0707/2019-Python
/parking07-06.py
1,075
4.125
4
## 변수 선언 부분 parking = [] top, carName, outCar=0, "A", "" select = 9 ## 메인(main) 코드 부분 while(select != 3) : select=int(input("<1> 자동차 넣기 <2> 자동차 빼기 <3> 끝 : ")) if(select == 1): if(top>=5): print("주차장이 꽉 차서 못들어감") else: parking.append(carName) print("%s 자동차 들어...
726c06fd1ed070a5d3ee81f94ba83449adf69005
cpgaffney1/cs224w
/hw1/q1-starter.py
9,084
3.609375
4
################################################################################ # CS 224W (Fall 2018) - HW1 # Starter code for Problem 1 # Author: praty@stanford.edu # Last Updated: Sep 27, 2018 ################################################################################ import snap import numpy as np import matp...
143553b2f91743b4fb68457d6dc8d271320e74c7
Rahul-Kumar-Tiwari/30-Days-of-Code-Hacker_rank
/Day2_Data_Type.py
453
3.765625
4
i=4 d=4.0 s='HackerRank' # Declare second integer, double, and String variables. # Read and save an integer, double, and String to your variables. z = int(input()) x = float(input()) y = input() # Print the sum of both integer variables on a new line. print(z+i) # Print the sum of the double variables on a new line....
e58f837ab1a161e23b8af68e15cb9095961ab52c
Moglten/Nanodegree-Data-structure-and-Algorithm-Udacity
/Data Structure/queue/reverse_queue.py
329
4.21875
4
def reverse_queue(queue): """ Given a Queue to reverse its elements Args: queue : queue gonna reversed Returns: queue : Reversed Queue """ stack = Stack() while not queue.is_empty(): stack.push(queue.dequeue()) while not stack.is_empty(): queue.enqueue(stac...
21c4ac11a8600ce088b75d6864cc2f4c954f3192
Moglten/Nanodegree-Data-structure-and-Algorithm-Udacity
/Unscramble computer science/Task4.py
1,645
4.09375
4
""" Read file into texts and calls. It's ok if you don't understand how to read files. """ import csv with open('texts.csv', 'r') as f: reader = csv.reader(f) texts = list(reader) with open('calls.csv', 'r') as f: reader = csv.reader(f) calls = list(reader) """ TASK 4: The telephone company want to i...
0dc4e24f0689c8b6bef0ebbddf456e6d66c55309
Moglten/Nanodegree-Data-structure-and-Algorithm-Udacity
/Data Structure/arrays/Duplicate-Number_solution.py
269
4
4
def duplicate_number(arr): ''' input : a list have numbers from 1 to n one of kind and has one duplicate number output : that duplicate number ''' seen = set() for arr in arr: if arr in seen: return num seen.add(num)
52ae86f37a7dcccfb16ed76f8e04203be2deb70b
Moglten/Nanodegree-Data-structure-and-Algorithm-Udacity
/Show me Data Structure/LRU cache.py
1,743
3.71875
4
from collections import OrderedDict class LRU_Cache(object): def __init__(self, capacity): self.cacheDict = OrderedDict() self.maxlen = 0 self.capacity = capacity def get(self, key): # Retrieve item from provided key. Return -1 if nonexistent. try : self.cac...
1f573a4149ead6d50b1e84b51ac59de4514e5d77
mahapa1234/suanfa
/arrays.py
775
3.875
4
# encoding: utf-8 class Array(object): """ Represents an array. """ def __init__(self, capacity, fillValue=None): self._item = list() for count in range(capacity): self._item.append(fillValue) def __len__(self): return len(self._item) def __str__(se...
674081dd25e28e8a61c4fd3ca2e4edf536202954
mahapa1234/suanfa
/ss/binarySearch.py
553
3.921875
4
# encoding: utf-8 def binarySearch(target, sortedLyst): left = 0 right = len(sortedLyst) - 1 while left <= right: midpoint = (left + right)//2 if target == sortedLyst[midpoint]: return midpoint elif target < sortedLyst[midpoint]: right = midpoint - 1 ...
c65140c37a12de573ea7eed58136ecefec08a949
5l1v3r1/estudos
/conecta.py
249
3.703125
4
#!/usr/bin/python import socket ip = raw_input("Digite o IP: ") porta = input("Digite a porta:") conecta = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if conecta.connect_ex((ip, porta)): print "Porta fechada !" else: print "Porta aberta !"
81e9afbc1bc6ee322512be88392812a0f43a74c2
Soren568/friendships
/flask_app/models/friendships.py
1,078
3.515625
4
from flask_app.config.mysqlconnection import connectToMySQL DB = 'friends_schema' class Friendship: def __init__(self, data): self.friends_first_name = data['friends_first_name'] self.friends_last_name = data['friends_last_name'] self.first_name = data['first_name'] self.last_name = ...
2d295c341153fb12a552c069131b966d1e0ffb3e
k-sanyal/auto_corrector
/Correct_func.py
1,724
3.765625
4
def dist0(word): return {word} def dist1(word): # Разбиваем слово на всевозможные части (левая - правая) pairs = [(word[:i], word[i:]) for i in range(len(word) + 1)] # переставляем последнюю букву левой части с первой буквой правой части transposition = [] for half1, half2 in pairs:...
3a4bc89881d658594ece1373b6451e711776dfb9
rijulsoni/Python-Games
/PythonGame.py
334
3.90625
4
import random randnumber=random.randint(1,50) print(randnumber) userinput=None guesses=0 while(userinput != randnumber): userinput=int(input("Enter Your Number")) guesses += 1 if userinput==randnumber: print("You guessed it right!, Congratulations") print(f"You Guessed the number in {guess...
38b7b5030e6d39b2adaabe73e14b40e637a14e3b
feleck/edX6001x
/lec6_problem2.py
623
4.1875
4
test = ('I', 'am', 'a', 'test', 'tuple') def oddTuples(aTup): ''' aTup: a tuple returns: tuple, every other element of aTup. ''' result = () i = 0 while i < len(aTup): if i % 2 == 0: result += (aTup[i:i+1]) i+= 1 #print result return result # ...
8781f9f96a111b4edb2772afc5bee20e7861a881
deadsquirrel/courseralessons
/test14.1mod.py
1,059
4.15625
4
''' Extracting Data from JSON In this assignment you will write a Python program somewhat similar to http://www.pythonlearn.com/code/json2.py. The program will prompt for a URL, read the JSON data from that URL using urllib and then parse and extract the comment counts from the JSON data, compute the sum of the number...
cdf92e1f7a42445d30530d13d47c865e94335f7a
deadsquirrel/courseralessons
/pr_test3.2.py
364
3.671875
4
# N number Fibonacci Sequence import math import sys n = int(sys.argv[1]) j = 0 k = 0 for i in range(n+1): print "-i: ",i print "j=",j print "k=",k if i == 1: result = j + i else: result = j + k print " - - - - -R=",result j = k print "j2=",j k = result print ...
301976d398994597d21e0131881587dedb620d2a
deadsquirrel/courseralessons
/test56.py
1,220
4.09375
4
''' examples for me ''' #---------- i = 0 while i < 3: print(i) i += 1 else: print(0) #---------- #razobrat >>>names = ['Amir', 'Bear', 'Charlton', 'Daman'] >>>print names[-1][-1] #---------- >>> list1 = [3, 4, 5, 20, 5, 25, 1, 3] >>> l...
4a42429d92f94c05ed39a8911f6f9249c42113ba
deadsquirrel/courseralessons
/test_gui.py
1,806
3.59375
4
# -*- coding: utf-8 -*- from Tkinter import * def printer(event): print ("AND AGAIN 'Hello world!'") def printer2(event): print ("Ha-Ha!'") root = Tk() ''' ent = Entry(root,width=20,bd=3) ''' but = Button(root, text="Это кнопка", width=30,height=5, bg="white",fg="red") ...
da0372c67d1f10dd0deca61e2db7efdcc2339eed
deadsquirrel/courseralessons
/summ_num.py
504
4.09375
4
#!/usr/bin/env python ''' Read through and parse a file with text and numbers. You will extract all the numbers in the file and compute the sum of the numbers. ''' import re fname = raw_input("Enter file name: ") s = 0 fh = open(fname) for line in fh: y = re.findall('[0-9]+', line) if y != []: ...
3697bcefdabe43168fbc49f3a24411b8529df4b9
Phys767-Spring17/Eileen_project_MC_examples
/MCdice5050.py
7,815
3.90625
4
import random def rolldice(): """ Generate a dice rolling, where you have 50/50 odds. Generates random number between 1 and 100. Returns False if <= 50, returns True if >= 51. """ roll = random.randint(1, 100) if roll <= 50: return False elif roll >= 51: return True def dalemb...
94350168a9d5d16801e0c605337e521a10d7cd0b
Lv-474-Python/ngfg
/src/tests/app/helper/test_google_docs_url_validator.py
1,233
3.546875
4
""" Tests for a google doc url validator """ from app.helper.google_docs_url_validator import validate_url def test_validate_url_valid(): """ Test for google doc validator validate_url() Test case for when a valid url has been provided """ url = 'https://docs.google.com/spreadsheets/d/AbCde1' ...
97caae6c7fcaed2f8c0442dec8166a3c26b7caf5
pduncan08/Python_Class
/Wk3_Sec4_Ex3a.py
704
4.28125
4
# Lists - Exercise 3 # Python indexing starts at 0. This will come up whenever you # have items in a list format, so always remember to ask for # 1 less than whatt you want! John_Skills=["Python", "Communicateon", "Low Salary Request", 1000] print(John_Skills) Applicants=[["John", "Python"],["Geoff", "Doesn't Know P...
3a64eea8f6c059e1972e0085b9764de6f4fbb085
LDMa777/SnacksMachine
/Snacks_Machine.py
5,693
3.578125
4
class snacks: nombre_snacks="" cantidad_snacks="" precio_snacks="" class ingreso: nombre_ingreso="" apellido_ingreso="" dni_ingreso="" codigo_ingreso="" permiso_ingreso="" class gestion: nombre_gestion="" precio_gestion="" cantidad_gestion="" class totales: ...
5d3a7630d5121213e1ce3c7d5239dbe963cb8eee
non26/testing_buitIn_module
/project3-p155ข้อ2.py
329
4.09375
4
print('Quadratic Equation is ax^2 + bx + c') a=float(input('Enter a: ')) b=float(input('Enter b: ')) c=float(input('Enter c: ')) if a != 0: value1=(-b+(b**2-4*a*c)**0.5)/2 value2=(-b-(b**2-4*a*c)**0.5)/2 print('solutions: {0:,.2f} and {1:,.2f}'.format(value1,value2)) else: print('This isn\'t a Quadratic Equ...
5394d2d8237802a930e1c43b1fffc5fb1f2a1090
non26/testing_buitIn_module
/superMethod/test1_superMethod.py
603
4.53125
5
""" this super method example here takes the argument of two, first is the subClass and the second is the instance of that subClass so that the the subClass' instance can use the superClass' attributes STRUCTURE: super(subclass, instance) """ class Rectangle(object): def __init__(self, width...
0c589e0a5e3ab159b1589effa2031d3c389fa483
non26/testing_buitIn_module
/project3-p156ข้อ3-แก้ไขใช้for.py
468
3.875
4
print('CAFEINE VALUES') cafe1=130 cafe3=130 #start cafe3=130 bc h start at 1 h1=1000000000 for h in range(1,25): cafe1=cafe1*0.87 cafe3=cafe3*0.87+130 if cafe1 <= 65 and h1>h: h1=h print('One cup:less than 65 mg. will after {0} hours'.format(h1)) if h==24: print('One cup: {0:.2f} mg. will ...
f31816fec154d08f18eaa849cbd8d8ca3920bb2e
SoyUnaFuente/c3e3
/main.py
571
4.21875
4
score = int(input("Enter your score: ")) # if score in range(1, 51): # print (f"There is no prize for {score}") if 1 <= score <=50: print (f"There is no prize for {score}") elif 51 <= score <=150: medal = "Bronze" print(f"Congratulations, you won the {medal} medal for having {score} points ") elif 1...