blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
47ed28be2600764822b02f42bcb6dea3a47c44f4
hhnigdeli/Rundict
/rundict.py
12,443
3.546875
4
import pandas as pd import numpy as np import matplotlib.pyplot as plt import shlex from bs4 import BeautifulSoup from math import sin, cos, sqrt, atan2, radians class route(object): def kml_to_df( file_name,tag="LineString",seperator=","): """ to convert .kml file to Pandas DataFra...
48e14e35e898f8c5ba5a2c00cf53562c3d1c1896
idane19-meet/EAT_IT
/shikma/randomboxes.py
339
3.734375
4
import turtle import random turtle.tracer(1,0) turtle.shape("square") turtle.penup() turtle.goto(0,200) boxes_list=[] number_of_boxes=random.randint(1,3) for i in range (number_of_boxes): x = turtle.clone() x.shape("square") boxes_list.append(x) for c in boxes_list: c.goto(random.randint(-200,200),200)...
ecebcf52234188280f58627aa8a3eb1c9b877f82
NikithaReddyJ/pythonbasics
/whileloopbasics.py
124
3.890625
4
m=int(input("enter min number")) n=int(input("enter max number")) if m%2==0: m=m+1 while m<n: print(m) m+=2
cd81c5bec9036d22f68d76d14d2435f87dcff32b
AbhinnVerma/Learning
/Date validity w dict/Solution (Base).py
756
4.1875
4
# Program using Dict to input date & check whether valid or not m = {1:31, 2:28, 3:31, 4:30, 5:31, 6:30, 7:31, 8:30, 9:31, 10:30, 11:31, 12:30} idate = input('\nEnter the date in d/m/y : ') idate = idate.split('/') idate = [int(ele) for ele in idate] idate = tuple(idate) # value assignment if len(id...
7bba94df38571f4d6771ff29b70d70a1ff4e5a8a
Skxu3/SEC-Webscraping
/databaseOps.py
1,404
3.609375
4
import sqlite3 from urllib import request, error from sqlite3 import Error from fields import database """ Database utility functions """ def connectToDb(): try: conn = sqlite3.connect(database) return conn except Error as e: print(e) def createTable(conn, tableName, tableFields): ...
c90aba5d68fc97a430ac0f9fa83727533501a60c
msklarek/CodeWars-Python-Solutions
/katas/kyu_6/Duplicate_Encoder.py
207
3.546875
4
def duplicate_encode(word): result = '' b= word.lower() for i in b: if b.count(i) == 1: result = result + '(' else: result = result + ')' return result
288f4e52742a09c3b737a1f0285ed1940d0e3cc2
Krishna2709/Blockchain-python
/block.py
1,092
3.609375
4
from datetime import datetime from hashlib import sha256 # Create a class Block containing ... transaction...timestamp...previous_hash...nonce...hash class Block: # initialize the instance and transactions, previous_hash def __init__(self, transactions, previous_hash): self.timestamp = datetime.now()...
1ae35c0803250f5f699828be939706a43af73f2f
gabrielcontee/Challenges
/URI1259.py
507
3.59375
4
def input_lines(): k = 0 numbers = [] numberOfElements = int(input()) while k < numberOfElements: numbers.append(input()) k += 1 return numbers text = list(input_lines()) evens = [] odds = [] i = 0 while i < len(text): element = int(text[i]) if (element % 2 == 0): e...
00e73413b9429e48ab23e16e9c9ac060b26b08e8
gopalakrishnanngk/gopal
/fact.py
86
3.734375
4
number=int(raw_input()) fact=1 for i in range(1,number+1): fact=i*fact print(fact)
af33344e9fe8beb5ac37ac6a1c74924484ced788
gopalakrishnanngk/gopal
/amstrontgno.py
169
3.8125
4
num=371 sum=0 temp = num while temp > 0: digit = temp%10 sum += digit **3 temp //= 10 if (num==sum): print("yes") else: print("No")
3d2518040b3b58f37c394b5c8e542c17db9809bf
mikelovskij/eol_finesse_library
/eol_finesse_library/cavities.py
4,264
3.609375
4
import numpy as np def angle_finder(l): """Finds the angles of a triangle given the sides lengths Uses the cosine law: cos[alpha] = (b**2 + c**2 - a**2) / (2 * b * c) Args: l(list of floats): lengths of the triangle sides Returns: list of floats: angles are listed in order o...
cc214ba7065afe6849420f4c385a5b70c1617ace
gcrowder/weather-report
/weather_lib.py
2,806
3.609375
4
class Alert: """ Alert object takes in an alert dictionary from JSON weather data.""" def __init__(self, **kwargs): self.type = kwargs['type'] self.date = kwargs['date'] self.description = kwargs['description'] self.message = kwargs['message'] def __str__(self): retu...
da28ecf95d7bc74c4da2cb677846994db75d0fa1
kwkoh67/Self_study
/lotto_2.py
2,076
3.515625
4
๏ปฟ#-*- coding: utf-8 -*- # Manu from random import * import random # ๋ฒˆํ˜ธ List๋ฅผ ๋ฐ›์•„์„œ 1~47 ๋ฒ”์œ„ ๋ฐ 6๊ฐœ ๋ฒˆํ˜ธ์ธ์ง€, ์ค‘๋ณต ์ˆซ์ž ์—ฌ๋ถ€ ์œ ํšจ์„ฑ check, ์œ ํšจ์‹œ 1, ์œ ํšจ์•ˆํ•˜๋ฉด -1 ์„ return def Valid_Num(Input_Num): for i in Input_Num: if i < 1 or i > 47: print("์ˆซ์ž ๋ฒ”์œ„๋ฅผ ๋ฒ—์–ด๋‚ฌ์Šต๋‹ˆ๋‹ค") return -1 if len(Input_Num)>6: print("๋ฒˆํ˜ธ ๊ฐฏ์ˆ˜ 6๊ฐœ๋ฅผ ๋ฒ—์–ด๋‚ฌ์Šต๋‹ˆ๋‹ค") return -1 ...
6e8feba931149a18a1b8bc131af4e92995514511
dshahid380/Algos
/Data Structures/Fenwick_Tree_RSQ.py
645
3.578125
4
"""The normal Fenwick tree can only answer sum queries of the type [0;r] using sum(int r), however we can also answer other queries of the type [l;r] by computing two sums [0;r] and [0;lโˆ’1] and subtract them""" def update(val, idx): while(idx < len(A)): tree[idx] += val idx = idx | (idx + 1) def sum_upto(r)...
7cb9053dc4e534450532cab262be65da00bb7df5
dshahid380/Algos
/Greedy/activity_selection_problem.py
731
3.578125
4
from collections import defaultdict def sortFinal(arr): pairs = defaultdict(list) result = [] for pair in arr: pairs[pair[1]].append(pair[0]) for i in pairs: pairs[i] = sorted(pairs[i]) l = sorted(list(pairs.keys())) for i in l: for j in pairs[i]: result.append([j, i]) return result def activitySelec...
8345c088c8f478c6a097be2226a531550d854b8f
dshahid380/Algos
/practice/no_of_grid_paths.py
794
3.984375
4
"""A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below). How many possible unique paths are there? P...
bde9e6fb53859ceefe9c377fda745b49d26c7c73
dshahid380/Algos
/practice/No_of_path_in_grid_with_obstacle.py
1,502
4
4
""" A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below). Now consider if some obstacles are added to the...
eff5bfa9a0649a909014ef5c910948f5c78d0018
dshahid380/Algos
/Greedy/longest_unique_string.py
635
3.546875
4
def longest_unique_string(s): l, P = [], [] for i in s: if i not in l: l.append(i) else: P.append(len(l)) l = [] l.append(i) if len(s)==0: return 0 elif len(P)==0: return len(s...
a3cac45fc4c563c4c7d1f0b9d9648f32b3f6b9f4
fly2fire/EbookTranslator
/scripts/text_tokenizer.py
520
3.515625
4
from nltk.tokenize import sent_tokenize, word_tokenize class TextTokenizer: """Splits text into sentences""" def __init__(self, text_as_string): self.text = text_as_string def tokenize(self, tokens="sentences"): assert tokens in ["sentences", "words"] if tokens == "sentences": ...
d5c9dce57c98b8c472bec92f46b4d5522809395b
ashishsangale/leetcode-july
/word_search.py
901
3.8125
4
#Amazon #SImilar to Number of Islands problem class Solution: def exist(self, board: List[List[str]], word: str) -> bool: def search(board, i, j, word): if(len(word) == 0): return True if(i < 0 or i >= len(board) or j < 0 or j >= len(board[...
3107513c3f9fa1a0a7176330661e1cc91925578b
Swilee/Assignment_3
/poker.py
16,349
3.78125
4
import numpy as np from enum import Enum from enum import IntEnum from PyQt5.QtCore import * from abc import ABC, abstractmethod class Suit(Enum): """ Here an enum class is created to represent the suits. """ Hearts = 0 Spades = 2 Diamonds = 1 Clubs = 3 class HighCard(IntEnum): two ...
cc8ee888ba58db9d28aad127fce1ad2b381d9ab1
jasonhayes1987/MyProjects
/Ceasar Cipher.py
2,468
4.75
5
""" Author: Jason Hayes Description: The user inputs a word or phrase for the cipher to encrypt, and a 'key' to use for the encryption process. The key is a number between 0 and 26, and represents how many letters down the alphabet to move each character. The Cipher will print the position in the alphabet of e...
c386614c8fb3749cf6f088fdb34f88c56003a478
nargiza-web/python-exercise
/degree_conversion.py
101
3.78125
4
celcius = int(input('Temperature in C?\n')) fahrenheit = celcius * 1.8 + 32 print (f'{fahrenheit}F')
66d6a8f63354e1e48121aef112b2371c2cd75f9d
xiaochongchong86/yeproject
/test_mic_project/lib/ReadExcel.py
349
3.640625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- import xlrd def read_excel(excel_path): # excel_path = excelๆ–‡ไปถ่ทฏๅพ„ data = xlrd.open_workbook(excel_path) table1 = data.sheets()[0] nrows = table1.nrows for i in range(nrows): print "row %s: %s" % (i, table1.row_values(i)) if __name__ == '__main...
659e52f59a3d775b198b2a3cff558e746f27a33a
RoshanJacob/Bank-Game---Python.
/sketch.py
1,243
4
4
class Bank(object): def __init__(self, cardNumber, pinNumber, balance): self.cardNumber = cardNumber self.pinNumber = pinNumber self.balanceLeft = balance def verifyPerson(self): print(self.cardNumber) print(self.pinNumber) if(self.cardNumber == 3248): ...
f1553c409b3e0b32e5c3e84c60b3d4535c172e57
alexvoelker/CoffeeMachine
/main.py
3,108
4.125
4
from art import logo MENU = { "espresso": { "ingredients": { "water": 50, "coffee": 18, }, "cost": 1.5, }, "latte": { "ingredients": { "water": 200, "milk": 150, "coffee": 24, }, "cos...
a5843ec444389b71835daaa261bf6b6cbc234c8f
MacarronesSinTomate/MiPrimerPrograma
/comprar_helado.py
879
4.21875
4
apetece_helado_input = input("ยฟTe apetece un helado? ( Si / No ): ").upper() if apetece_helado_input == "SI": apetece_helado_input = True elif apetece_helado_input == "NO": apetece_helado_input = False else: print("Te he dicho que me digas si o no. No se que has dicho pero cuento como que no.") tienes_din...
c44261da08f2d044bbfc24942274c7222d298bff
toms3t/Advent_Of_Code_2018
/1.py
557
3.859375
4
import itertools frequencies = open('frequencies', 'r') freq_changes = [x.strip('\n') for x in frequencies.readlines()] def frequency_total(): return sum([int(x) for x in freq_changes]) def frequency_finder(resulting_frequency=0): freq_seen = {0} for f in itertools.cycle(freq_changes): resulting_frequency += ...
e3041fa5f5ab1b93a4b4c36d59ba428fc8630182
Legendarytruth/Arithmetic-Formatter
/arithmetic_arranger.py
4,028
3.53125
4
def arithmetic_arranger(problems, *result): arranged_problems = ""; firstnum = []; signs = []; secondnum = []; if(len(problems) > 5): return "Error: Too many problems." #splitting the problems into first number sign and second number checking if they are correct for i in problems: [num1, sign, nu...
31bedb4f0df5d8245de1ec0b24b7f24a01a24974
SheikhSaidee/Coursera_Assignment.github.io
/Coursera-PY4E/for_internal.py
659
4.09375
4
iter('Sarah') # String iter(['Sarah', 'Roark']) # List iter(('Sarah', 'Roark')) # Tuple iter({'Sarah': 26, 'Roark': 25} # Dict # Where iteration doesn't work #iter(30) # Integer #TypeError: 'int' object is not iterable #iter(22.6) ...
ddd2dff180b711d14c5c0052cb7757575a2cbfff
fatmind/yy-python
/algorithm/bubble_sort.py
697
3.65625
4
''' Created on 2013-3-31 @author: bohan.sj ''' class BubbleSort(): ''' implement ''' def sort(self, data): size = len(data) on = 0 for i in range(0, size): for j in range(i+1, size): base_value = data[i] compare_value = data[j] ...
d22c36aacf69c449e5ccdd7f2b497ec85918b7fc
Nihilnia/last10days
/Strings - Types.py
644
4.21875
4
#String Indexleme Ve Parรงalama a = "oh shit!" print(a[3:]) #shit! #reverse String print(a[::-1]) print(a[:len(a)-1]) #oh shit #Indexleme soldan baลŸlar saฤŸa doฤŸru gider. #Ilk index numarasฤฑ 0. #Parametre olarak verilen ikinci deฤŸer dahil deฤŸildir. #Sondan baลŸa doฤŸru indexleme -1 ile baลŸlar. print(a[-...
3ec30cac6a87e0e9152cf191e0f29a6aecc12a83
Nihilnia/last10days
/Armstrong Numbers.py
576
3.96875
4
# Armstrong Numbers from time import sleep while True: userChoice = input("Give me a number or 'Q' For quit: ") if userChoice.lower() != "q": sumsTotal = 0 numberLenght = len(userChoice) for x in userChoice: sumsTotal += pow(int(x), numberLenght) #q...
9e9bc310de47dd7ec2fcdd648eabd4bca4baf6d1
Wedge-Dev/IT-Automation-with-Python
/1. Crash Course on Python/Week 2 Basic Python Syntax/Module 2 Graded Assessment/Question 6.py
730
4.53125
5
#Complete the body of the format_name function. This function receives the first_name and last_name parameters and then returns a properly formatted string. def format_name(first_name, last_name): if last_name == "" and first_name == "": string = "" elif last_name == "" or first_name == "": string = "Name: " + l...
e104f1976757c594e970fda0ca3494e3c53f426d
Wedge-Dev/IT-Automation-with-Python
/1. Crash Course on Python/Week 1 Hello Python!/Module 1 Graded Assessment/Question 10.py
266
4.1875
4
#Most hard drives are divided into sectors of 512 bytes each. Our disk has a size of 16 GB. Fill in the blank to calculate how many sectors the disk has. disk_size = 16*1024*1024*1024 sector_size = 512 sector_amount = disk_size / sector_size print(sector_amount)
d67936bf74e5c4feb0fd8ac641926f45f93b52a2
Wedge-Dev/IT-Automation-with-Python
/1. Crash Course on Python/Week 2 Basic Python Syntax/Expressions and Variables/Expressions, Numbers, and Type Conversions.py
559
4.34375
4
#In this scenario, we have a directory with 5 files in it. Each file has a different size: 2048, 4357, 97658, 125, and 8. Fill in the blanks to calculate the average file size by having Python add all the values for you, and then set the files variable to the number of files. Finally, output a message saying "The avera...
8bf45cb5aab187691adfcdee2a9397db3e16e269
Arittx/python
/Reto 1/reto1.py
1,409
3.90625
4
#Mensaje de bienvenida print ("Bienvenido al sistema de ubicaciรณn para zonas pรบblicas WIFI") #Usuario y contraseรฑa userPreset = 51606 passwordPreset = 60615 user = int (input ("Nombre de Usuario:\n")) if user == userPreset: password = int (input ("Contraseรฑa:\n")) if password == passwordPreset: ...
ff6cac656c9fa25e146937e93fe0dc9b25a8392d
justin-cook-developer/CS_231_CUESTA
/midterm_1/page3.py
450
4.09375
4
def is_divisible_by(left, right): return left % right == 0 def factorials_up_to_ten(): factorial = 1 for i in range(1, 11): factorial = factorial * i print('factorial of', i, 'is', factorial) def in_ascending_order(a, b, c): return a < b < c print(is_divisible_by(20, 10)) print(is...
458248ae169f496aace5a4c9ba3a3599e92e1b1c
justin-cook-developer/CS_231_CUESTA
/lab_5/script.py
863
3.890625
4
# Justin Cook / justin_cook3@my.cuesta.edu # CIS 231 / Scovil # Lab 5 def isOdd(integer): isEven = integer % 2 == 0 msg = None if (isEven): msg = str(integer) + ' is even!' else: msg = str(integer) + ' is odd!' print(msg) def minutesToClosestHour(minutes): pastHalfHour = mi...
7f8f068ff1c4766bdb792260e007e6c01965d212
justin-cook-developer/CS_231_CUESTA
/assignment_2/min_and_max.py
248
3.765625
4
def min_and_max(nums): if (len(nums) == 0): return None highest = -inf lowest = inf for num in nums: if num > highest: highest = num elif num < lowest: lowest = num return (lowest, highest)
9032970f4c7caa639eaf9d2a4545e55806996d4d
VinceSevilleno/Iteration
/revision 4.py
248
4.125
4
answer = False while not answer: number = int(input("Please enter a number between the range of 10 to 20:")) if 10 <= number <= 20: answer = True print("You have entered a number within the range of 10 and 20.")
060cb4704699be7370408b285d364ad553890642
Software-chasers04/Python-Codes
/pattren.py
163
4.0625
4
''' * ** *** ''' n = int(input("Enter the line num:")) for i in range(n+1): print(i*"*") """ * *** ***** """ for i in range(n+1): print((2*i-1)*"*")
678b90e9bcdcf3fbf6a66b136de9ab2516070229
Software-chasers04/Python-Codes
/List as input user.py
482
4.03125
4
n = input("Enter the text of numbers:") list = n.split() sum = 0; for i in list : sum+= int(i) print(sum) # count the words, letters, digits in a text numofDigits = 0 numofLetters = 0 numofWords = 0 text = input("Enter the text and numbers:") for x in text: x = x.lower() if x>'a' and x<='z': num...
7d5f0af0fa298336271eb55b8288f18217003d6f
Software-chasers04/Python-Codes
/MAtrix.py
225
4.25
4
matrix = [ [1,2,3], [2,3,4], ] print(matrix) print(matrix[0][2]) print(matrix[1][2]) matrix[0][1]= 3 # adding value print(matrix[0][1]) #using nested loop for row in matrix : for col in row: print(col)
2efe23e9d9122a029f45b8b58d54d654589e6d2c
Software-chasers04/Python-Codes
/List-1.py
430
4.375
4
s = ["C","C++","Java","Python",3] print(s) # print the list print(s[0]) # print the index of the list print(s[2:]) # print the element of the list from index 2 print(s[-1]) # last element index = -1 print("Python" in s) # cheaking the list,this name is in the list or not print("Python" not in s) # same as previous prin...
4751722c5063db9dea223d8794aee1c5fcc7e72c
Software-chasers04/Python-Codes
/Area.py
237
4.0625
4
# Area of triangle B = float(input("Enter Base : ")) H = float(input("Enter Height : ")) Area = 0.5 * B * H print("Area of Triangle:" ,Area) #Circle r = float(input("Enter Radious : ")) Area = 3.1416*r*r print("Area of Circle :",Area)
fd8150ff9c687c91030f31f858a75514297396dd
jesee030/-python-
/venv/degree.py
361
3.703125
4
def countlevel(): ''' :return:ๆœ€ๅฐ้˜ถๆขฏๆ•ฐ ''' x=7 i=1 flag=0 while i <=100: if(x%2==1)and(x%3==2)and(x%5==4)and(x%6==5): flag=1 break else: x=7*(i+1) i+=1 if flag==1: return x else: print("can;t find ansert in ...
81c729e3ee21febcd236437e04bbf299274eab2f
Akshay-S-Jadhav/Python
/Birthday Paradox/leapyearnotleapyear.py
240
4.15625
4
# -*- coding: utf-8 -*- """ Created on Mon Oct 18 12:59:11 2021 @author: Admin """ year =int(input("Enter the year : ")) if (year%4==0 and year%100!=0 or year%400==0): print("Leap year") else: print("Not a Leap year")
95e13789d09b43a2cfe8475a887bbea52d55a327
cocoaaa/InteractML
/examples/utils/line.py
4,332
3.53125
4
## 2D line from vector import Vector as vec import holoviews as hv import pdb ############################################################################### # 2 dimensional Line class ############################################################################### class Line2d(): """ Representation of a l...
8a72348fd35a7b7732e8e2f1666b10b70b4ac632
augix/augix.github.com
/entries/mediawiki2vimwiki/convert.line.starts.with.a.whitespace.py
1,769
3.53125
4
#!env python ''' In Mediawiki, lines starting with a whitespace will be translated as code. I'm converting the Mediawiki source pages into Vimwiki pages. Therefor, I put a line of {{{ and }}} before and after the block of lines starting with whitespace.''' import re existing_code_start = re.compile("<\w+>") existing...
ad5b70a0cfe05633033a9af411a2fe3d677de171
alimaleki100/Python
/Pandas/MasteringPandas.py
520
3.578125
4
# -*- coding: utf-8 -*- """ Created on Tue Jan 23 16:00:20 2018 @author: a.maleki """ import pandas as pd import numpy as np data=pd.read_excel("C:/Users/a.maleki/Desktop/PandasData.xlsx") #print(data) df=pd.DataFrame(data) #print(df) df=df.set_index('ID') #print(df) #column selection #print(df['Nam...
5e564cf3074e9213f742d337387e9f6b5ad80d87
bauassr/Session3_Assignment3
/Assignment3.3.py
483
4.09375
4
# -*- coding: utf-8 -*- """ Created on Thu Mar 29 17:13:34 2018 @author: singh.shivam """ def Longest_Word(list_of_words): s="" for w in list_of_words: if len(s)<=len(w): s=w return s Words=["Acadgild","Data","DataScience","DataMart",...
56821f13d62c611b73199d656e41e5b1070eb3a6
ambitioninc/django-query-builder
/querybuilder/helpers.py
1,461
3.78125
4
def value_for_keypath(dict, keypath): """ Returns the value of a keypath in a dictionary if the keypath exists or None if the keypath does not exist. """ if len(keypath) == 0: return dict keys = keypath.split('.') value = dict for key in keys: if key in value: ...
edc29bfbd67a172d3a5dfe20e6c78c059ce61173
shoolic/prime-palindromes
/algorithm.py
2,696
4.03125
4
# Prime palindrome finder # Analysis of algorithms classes at Faculty of Electronics and Information Technology, Warsaw University of Technology # Maciej Szulik 2019 - 2020 import math def is_prime(n): return is_prime_sqrt_std(n) def is_prime_sqrt_std(n): for i in range(2, round(math.sqrt(n) + 1)): ...
cfbea12fc12e4cfd1aafab315f7018d3ab48be87
rames4498/Bootcamps_and_workshops
/workshop/slicing2.py
170
3.625
4
mylist = [3,4,[6,3,[5,'arunai',3],5],[6,['guvi',3,57],57],34,45] mylist2 = [3,45,5,4,56,34,65,43,'sherlock',54] #print(mylist2[8][4:7]) print(mylist[2][2][1][1:4])
5e46a0f54a7b43d08b0c62d67a1d00857afb85b7
rames4498/Bootcamps_and_workshops
/workshop/mutability_immutability.py
368
3.703125
4
#lists li = [45,54,56,'dtr',True,54.76] mytuple = (34,34,34,23,45,56,2,32,56,24) ''' #index print(li[4]) #negative indexing print(li[-1]) print(li[2]) #slicing print(li[2:5]) print(li[3:]) print(li[:]) print(li[:4]) ''' # integers #mutability, immutability a = 10 print(a) print(id(a)) ...
1ffd012a29fb1ef396d16a4ebd2e28d3aac9f6eb
Silicon014/ThinkPython-2nd
/6/6-5.py
297
4.0625
4
def gcd(a, b): if b == 0 or a == 0: return a + b elif a > b: return gcd(b, a % b) else: return gcd(a, b % a) def main(): a = int(input("enter a: ")) b = int(input("enter b: ")) print("the gcd of a and b is", end=" ") print(gcd(a, b)) main()
8a86a34d44747f583df15cd59ee5232411eb92d6
Silicon014/ThinkPython-2nd
/4/4-6.py
286
3.859375
4
import turtle import math def polygon(t, n, length): for i in range(n): t.fd(length) t.lt(360 / n) def circle(radius): bob_circle = turtle.Turtle() c = 2 * math.pi * circle n = 50 polygon(bob_circle, n, c / n) turtle.mainloop() circle(100)
b63e10ede30c420f5e65b829fd95ed6418626980
SakuraSound/asyncio_examples
/02-aiohttp/02-aiohttp_client_session.py
1,745
3.609375
4
import asyncio import aiohttp from datetime import datetime # Async descriptor defines this fucntion as a coroutine async def run(urls): loop = asyncio.get_event_loop() print("Accessing some websites") # These requests are done asynchrnously... in that other coroutines can operate while this one # wai...
9492e9cf41239a97e50db0680a1d476965c81d98
ricardoifc/RepoProgram
/Python/3er ciclo/1er BM/03/clase03-ricardoifc-master/ejercicio03.py
305
3.8125
4
""" @ricardoifc """ """ dato = [1, 2, 10, 11, 12, 13] resultado = [] for i in datos: if i%2 ==0: resultado.append(i) print(resultado) """ # Funcional - Aplicando funciรณn filter datos = [1, 2, 10, 11, 12, 13] resultado = filter(lambda x: x % 2 == 0, datos) print(resultado) print(list(resultado))
fd8d677d1afaad55b86aacceba29679a0df5b8dd
ricardoifc/RepoProgram
/Python/3er ciclo/1er BM/10/clase07-ricardoifc-master/ejercicio1.py
331
4.25
4
""" @reroes uso de la librerรญa itertools referencia: https://docs.python.org/3/library/itertools.html repeat() # repeat(10, 3) --> 10 10 10 """ from itertools import * print("Uso de la funciรณn repeat()") variable = list(repeat(20, 2)) print(variable) variable = list(repeat(1.2, 10)) print(v...
7de077d78ae34f2a805f76e36ef23f778a9199ce
ricardoifc/RepoProgram
/Python/3er ciclo/1er BM/04/laboratorio1-clase03-ricardoifc-master/problema3.py
295
3.71875
4
""" @ricardoifc Problema 3 """ fraseSplit = [] frase= ("No hay medicina que cure lo que no cura la felicidad") palabras = ["medicina", "cure" ,"cura", "felicidad"] fraseSplit = (frase.split()) print(fraseSplit) resultado = filter(lambda x1, x2: x1 == x2 ,fraseSplit, palabras) print(resultado)
c42a968d7726dd5399f476bdf205ef9f678fce17
ricardoifc/RepoProgram
/Python/3er ciclo/1er BM/02/clase02-ricardoifc-master/practica/ejercicio1.py
194
3.640625
4
""" Ejercicio 1 @ricardoifc """ #con lambda se aplica una funcion despues de x: ... y x siendo (2) valor_par = lambda x: x%2 == 0 print(valor_par(2)) print(valor_par(3)) print(valor_par(11))
2c32d6dd90b50a3801e8962faed154c9dc9b12c8
ricardoifc/RepoProgram
/Java/cf-parcial-bimestre-1-master/problema1/solucion_python/AtencionCanina.py
761
3.75
4
""" @ricardoifc """ print("----Atenciรณn Canina----\n") print("Datos del propietario\n") cedula = input("Su Cedula:\n") print("Datos del canino\n") nombre = input("Nombre del perro:\n") raza = input("Raza del perro:\n") edad = input("Edad del perro\n") peso = input("Peso del perro:\n") peso = float(peso) float(tarifa) ...
371cedb31c070d6b49fc7eed2ae3a4f2a75c67ce
ricardoifc/RepoProgram
/Python/3er ciclo/1er BM/05/clase04-ricardoifc-master/ejercicio2.py
197
4.0625
4
""" @ricardoifc ejercicio2 """ lista = [(100,2), (20, 4), (30, 1)] lista2 = ["b", "a", "c"] # uno en un zip las dos listas print(list(zip((sorted(lista2)),(sorted(lista, key = lambda x: x[1])))))
d9d55081b930d240207a42843686f4fb6808d924
ricardoifc/RepoProgram
/Python/3er ciclo/1er BM/10/clase07-ricardoifc-master/ejercicio5.py
639
3.765625
4
lista = [10, 9, 11, 12, 20, 19, 19] """ @ricardoifc """ from itertools import * lista = [10, 9, 11, 12, 20, 19, 19] print("suma aritmetica") # calculo la suma de la lista y divido por el tamaรฑo de la lista resultado1 = (lambda x: sum(x) / len(x)) (lista) print(resultado1) print("desviacion media") # por cada uno l...
d6c0ddd448c3a4361ce92bddb0f00f069a5fad3c
Naveenaz/Python_scripts
/override_function.py
604
4.03125
4
#!/usr/bin/python class SquareSumComputer: def __init__(self, a, b): self.a = a self.b = b def transform(self, x): print x * x def inputs(self): print range(self.a, self.b) def compute(self): print sum(self.transform(value) for value in self.inputs()) class C...
66374d3b16ed0e659a58421c5f2237e27aa07059
Theodor7/quadraticEquationSolverPython
/quadraticEquationSolver.py
415
3.578125
4
from math import sqrt print '\n*** QUADRATIC EQUATION SOLVER ***\n\nax^2 + bx + c = 0\n\nEnter a, b, and c:' a = input('a = ') b = input('b = ') c = input('c = ') d = b*b-4*a*c print '\nDiscriminant = ' + str(d) +'\n' if(d < 0): print 'NO SOLUTIONS' if(d == 0): print '1 SOLUTION:\n' + str((-b)/(2*a)) if(d ...
c3fbcdf75a468fe81dc58c7a29b70b2b92a65d5c
tanyayez/map_lab2_Tetyana_Yezerska
/buid_map.py
4,401
3.5
4
from geopy.geocoders import Nominatim import folium def read_file(path): '''(str) -> (list) This program reads data from file. Returns list of lists that consist of filminfo(name year etc) and location ''' with open(path, encoding="utf-8", errors='ignore') as f: info = f.read() in...
ec5ba56690f0fb143fe17a9c141d24c8191085f4
angelmm76/Python-edX
/lec 5 probl 7.py
221
3.53125
4
def lenRecur(aStr): ''' aStr: a string returns: int, the length of aStr ''' if aStr == '': return 0 return lenRecur(aStr[1:])+1 print 'longitud ' + str(lenRecur("dsh67t"))
d9c83da6dd6966299077a74a7c89c6ada5bae218
angelmm76/Python-edX
/lec 6 probl 2.py
311
3.953125
4
def oddTuples(aTup): ''' aTup: a tuple returns: tuple, every other element of aTup. ''' ans=() contador = 0 for elem in aTup: if contador %2 == 0: ans = ans + (aTup[contador],) contador += 1 return ans print oddTuples((3, 5, 6, 1, 'a'))
5244ec43e5c018c50ce35e13c143f3e6199edbb6
angelmm76/Python-edX
/prueba/src/prueba1.py
123
3.5625
4
''' Created on 05/12/2014 @author: Angel MM ''' def AddNumbers(x, y): return x + y print 'Hola' print AddNumbers(3, 8)
58f7e27f13245c8b18917f9378ed1f1228e73ac7
Candy945/selfteaching-python-camp
/exercises/1901050095/1001S02E04_control_flow.py
1,874
3.765625
4
#ไฝฟ็”จfor......inๅพช็Žฏๆ‰“ๅฐไนไนไน˜ๆณ•ๅฃ่ฏ€่กจ i = 1 #ๅ› ไธบไธ‹ไธ€่กŒๆœ‰ๆ•ฐ้›†ๅทฆๅผ€ๅง‹ไธบ1๏ผŒๆ‰€ไปฅ่ฟ™ไธ€่กŒๅˆๅง‹่ต‹ๅ€ผๅฏไปฅ็œ็•ฅ for i in range(1,10): #forๅพช็Žฏ๏ผŒๅ‡ฝๆ•ฐrange()ๆไพ›ไธ€ไธชๆ•ฐ้›†๏ผŒ่ฎฉiๅœจๆ•ฐ้›†ไธญ่ฟญไปฃ for j in range(1,i+1): print(i,"*",j,"=",i*j,sep='',end='\t') #print()ๅ‡ฝๆ•ฐ๏ผŒ้ป˜่ฎคๅฑๅน•่พ“ๅ‡บ๏ผŒsepๅญ—็ฌฆ้—ด้š”0ไธช็ฉบๆ ผ,end็ป“ๆŸ้—ด้š”ไธ€ไธชๅˆถ่กจไฝ print() #ๆ— ๅ‚ๆ•ฐๅณ้ป˜่ฎคๆข่กŒ็ฌฆ\n print() #็ป“ๆŸๆœฌๆจกๅ—ๆข่กŒ #############################...
4cf11c7555924a2680dbbd45af1888554fc6b7dd
Shuuichi77/GraphAlgorithm
/DM1/matriceadjacence.py
15,063
3.953125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Implรฉmentation d'un graphe ร  l'aide d'une matrice d'adjacence. Les n sommets sont identifiรฉs par de simples naturels (0, 1, 2, ..., n-1). """ class MatriceAdjacence(object): def __init__(self, num = 0): """Initialise un graphe sans arรชtes sur num sommets. ...
7bed3231e5ec359ae711b6a8fa559a52cbf5bd8e
ComputerScientist-01/Technocolabs-Internship-Project
/Minor Project/Weather GUI/main.py
1,639
3.578125
4
from matplotlib import pyplot as plt from matplotlib import dates from pyowm_helper import get_temperature degree_sign= u'\N{DEGREE SIGN}' def init_plot(): plt.figure('PyOWM Weather', figsize=(5,4)) plt.xlabel('Day') plt.ylabel(f'Temperature ({degree_sign}F)') plt.title('Weekly Forecast') def p...
0ed77eef77ab73d6e33712fc0ec65283e138bc21
JGSnyder/2020-Programs
/readability.py
955
3.890625
4
#! python3 # Author: JGSnyder # Date: 04 June 2020 # Use Coleman-Liau formula to compute grade level for submitted text def main(): text = input("Text: ") letters, words, sentences = count_text(text) # L is the average number of letters per 100 words # S is the average number of sentences per 100 wor...
5dc3fb94343e1b919f7ba61dbac0a41f1ea941c4
JimLakis/Array_vs_List_Speed_Test
/Graph_time_to_multiply_two_arrays_n_lists.py
2,559
4.03125
4
# Clocking time taken to multiply two arrays verses two lists. # Python v3.6 # Author: Jim L # January, 2019 import numpy as np import sys import time #from decimal import Decimal import matplotlib.pyplot as plt from pylab import * class GenArray: def __init__ (self, len): self._len ...
0f7ed1ce5611614a8d1a5fd67ac0986885610232
m3uma/validators
/tests/test_pass2.py
1,063
3.546875
4
import unittest from haslo.function import check_password class CheckPasswordTestCase(unittest.TestCase): def test_function_usage(self): check_password('haslo123') def test_password_min_length(self): # self.assertIsNone(check_password('H4$lo')) self.assertIsNotNone(check_password('H4$...
928e2ccb84ac5bce30e41a2e445e6348b9cde2c2
syed-ashraf123/deploy
/General Mini Programs and Competitive codes/Web Scraping/GetText.py
654
3.546875
4
html='''<html> <head> <style> P { color: green; } </style> </head> <body> My Mother has <font color="blue">blue</font> eyes.<br> My Mother has <P>blue</P> eyes.<br> <div>My Mother has <Span style="color: blue;">blue</Span> eyes.</div> <div color='red'>My Has has <Span style="color: blue;"...
b2c60654b8a8e7ccec9393e849565928d17e1d74
syed-ashraf123/deploy
/General Mini Programs and Competitive codes/Python/OOP1Class.py
265
3.890625
4
class user: def __init__(self): print("User has been made") new=user() print(type(new)) new1=user() print(type(new1)) class user2: def __init__(self,first): self.name=first new3=user2("Hey") new4=user2("Who") print(new3.name) print(new4.name)
70acf83a49faa5643f115d5a74594519e3495efb
syed-ashraf123/deploy
/General Mini Programs and Competitive codes/Python/Filter.py
116
3.53125
4
def remove_negative(a): return list(filter(lambda x:x<0,a)) a=[1,2,3,-1,-5,-6,4,-8] print(remove_negative(a))
0e9a9feeae5fc18a23923b2e48ae6b20f82b966d
fataik1/cs-module-project-iterative-sorting
/binary_search.py
1,199
4.3125
4
def binary_search(arr, target): low = 0 high = len(arr) -1 while low <= high: #1 compare the target element to midpoint mid = (high + low) // 2 #2 If the midpoint ellemnt matches our target; then we've #found what we're looking for, return the midpoint index if targ...
80ab28a469c4908c08fa9d2df0e8c421d6609940
mycho2003/TIY
/5/5-8.py
225
3.609375
4
username = ["admin", "mycho2003", "hayaboy", "hellobye", "pycharm"] for un in username: if un == "admin": print("Hello admin, the server is in critical condition!") else: print("Welcome, " + un + "!")
80a73d97d5472cbd2cc8887100e85794a3e78561
mycho2003/TIY
/5/5-9.py
251
3.90625
4
username = [] if username: for un in username: if un == "admin": print("Hello admin, the server is in critical condition!") else: print("Welcome, " + un + "!") else: print("We need to find some users!")
8b238d21621bf1ccadd74832fcbd2e309fd91f5e
mycho2003/TIY
/9/9-6.py
974
3.875
4
class Restaurant: def __init__(self, restaurant_name, cuisine_type): self.name = restaurant_name self.type = cuisine_type self.served = 0 def describe_restaurant(self): print("We are " + self.name + ", and we serve " + self.type + " food.") def open_restaurant(self): ...
a5b357127bca5e5f4e04a289feaebf8cdf5c0bc3
mycho2003/TIY
/6/6-11.py
470
3.71875
4
cities = {"Jamestown": {"country": "USA", "population": 3, "fact": "First colony in America"}, "Michaelville": {"country": "South Korea", "population": 4, "fact": "A lot of math"}, "Isabellapolis": {"country": "France", "population": 5, "fact": "Recognized for art"}} for city, info in cities.items(...
a475a2f8baee9d6b39f3b2ec806f3997849fccf3
mycho2003/TIY
/8/8-7.py
291
3.515625
4
def make_album(name, title, tracks = 0): if tracks: return {"Name": name, "Title": title, "Tracks": tracks} else: return {"Name": name, "Title": title} a = make_album("Me", "Em") b = make_album("You", "Uoy") c = make_album("Him", "Mih", 6) print(a) print(b) print(c)
051741f3f03b089367ad671a46c068d1fc82ca49
mycho2003/TIY
/5/5-7.py
374
3.984375
4
favorite_fruits = ["tomato", "mango", "pineapple"] if "banana" in favorite_fruits: print("You like bananas.") if "apple" in favorite_fruits: print("You like apples.") if "pineapple" in favorite_fruits: print("You like pineapples.") if "watermelon" in favorite_fruits: print("You like watermelon.") if "m...
ef77c03facd91da95f8dac0e4cc98afd6ae3df78
AdamRugh/BankAccountApp
/BankAccountApp/BankAccountApp.py
1,015
3.96875
4
class BankAccount(object): balance = 0 def __init__(self, name): self.name = name def __repr__(self): return "%s's account Balance: $%.2f" % (self.name, self.balance) #Show balance of account def show_balance(self): return "Balance: $%.2f" % (self.balance) #Deposit into account def deposit(self...
98245443238e67c7a47e862ad3086ee4fcc0333c
Nunustolemybike/python_exercice
/1.14.py
139
3.796875
4
a=0 g=0 b=int(input("entrez une valeur")) #while a<b: # print(g) # g=g+2 # a=a+1 for x in range(0, b, 2): print(x)
5a8a934c503bcd586ea6ddd54f66898f09b7af21
Nunustolemybike/python_exercice
/1.20.py
181
4.25
4
for x in range(3): print(x) for x in range(4,7): print(x) for x in range (2,8,2): print(x) chose= [0,1,2,3,4,5] print(chose.index(3)) print(chose.index(6))
2ae08f60afe030b765f78e3e8c763f31b619c4a9
Infernormal/git-practice
/function_a.py
397
4
4
from collections import Counter def most_common_value(number_list): """ returns the most common element of the list """ most_common = [] item_counts = Counter(number_list) most_common = item_counts.most_common(1)[0][0] return most_common if __name__ == "__main__": nums = [1, 1, 3, 3, 3, ...
9c6a6c09e2680bce434eefb9311b843ea98e2593
renovate-tests/cs251-toolkit
/cs251tk/toolkit/tabulate.py
4,857
3.5625
4
"""Make a nice table from the student results""" import re from sys import stdout from termcolor import colored COL = '|' ROW = '-' JOIN = '+' MISSING = '-' ANSI_ESCAPE = re.compile(r'\x1b[^m]*m') def sort_by_hw_count(user): """Sort students by the number of completed homeworks""" return sum([1 if hw['status...
3f5ac3380c8059f3b099ad6d141eaad8adf5028e
renovate-tests/cs251-toolkit
/bin/hw7.py
352
3.5625
4
import statistics import sys def avg(data): return sum(data) / len(data) def stdev(data): return statistics.stdev(data) def main(): data = sys.stdin.read().split() data = [int(datum) for datum in data] print('Average: {}'.format(avg(data))) print('Std Dev: {}'.format(stdev(data))) if __n...
16fd4cae05f2ee35ae80175c415d4fc745320842
Partyman901/ACIT2911-project
/views/view.py
1,025
3.546875
4
from models import DatabaseManager class View: """ this class is used to format repetitive output """ def __init__(self): """ prints this each time the class is called in order to format output """ print("\n First name Last Name Employee ID Phone Number Last Login ...
c92e12cd19ceabf29e0ce568ea0a046c1b071e47
lucylittle/python-small-apps
/format.py
151
4.125
4
age = 25 name = 'Swaroop' print ('{0} is {1} years old. Hello Mr. {0}'.format(name, age)) print ('Why is {0} playing with that python?'.format(name))
13bf72519fd43036307363ca5a5a79d794c510c0
lucylittle/python-small-apps
/if.py
119
3.65625
4
def fib(n): print 'n =', n if n >1: return n*fib(n-1) else: print 'end of the line' return 1 fib(5)
839818d71e511ea7e826fdd0a82ce867c00056f2
rchandanifb/Hacktoberfest-2019
/PYTHON/isPalindrome.py
230
4.125
4
def isPalindrome(): my_str = input("Enter a word: ") my_str = my_str.casefold() #ignore cases rev_str = reversed(my_str) if list(my_str) == list(rev_str): print("It's a palindrome") else: print("It's not a palindrome")
7bd71448bb1f620994cc9bf4e381fbf294d7ec21
RaulNinoSalas/Programacion-practicas
/Practica5/P5E7M.py
434
3.734375
4
"""RAUL NIO SALAS. DAW 1. PRACTICA 5. EJERCICIO 7. Escriu un programa que demani un nombre (lmit) i desprs et demani nombres fins a qu la suma dels nombres introduits superi un nombre inicial. El programa termina escribint la llista de nombres.""" lista=[ ] limit=int(raw_input("Escribe el limite: ")) while li...
11110aef1bc7307757c98c4eb8fa860f7939cb49
RaulNinoSalas/Programacion-practicas
/Practica5/P5E5.py
562
4.125
4
"""RAUL NIO SALAS, DAW 1. PRACTICA 5 EJERCICIO 5 Escriu un programa que te demani dos nombres cada vegada ms grans i els guardi en una llista. Per a terminar d'escriure els nombres, escriu un nombre que no sigui major a l'anterior. El programa termina escribint la llista de nombres..""" numeros=[ ] n1=raw_input(...