blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
df968beb2a09a5a573488c88082cfeb157a9b741
thosamanitha/python
/python/python.py
1,256
4.03125
4
# radius=4 # pi=3.14 # perimeter=2*pi*radius # print(perimeter) # area=pi*(radius**2) # print(area) # age=float(input()) # if 12<age<18: # g_s="teen" # print("g_s: " +g_s) # elif 18<=age<21: # print("Growth Stage:Young Adult") # elif 18>=21: # print("Growth Stage:Adult") # elif age<=12: # prin...
18d7eda436980e39885c58a19883ccee9225e794
ButchBet/Game-in-python
/rectangle.py
1,109
3.53125
4
import sys import pygame pygame.init() width = 400 height = 500 surface = pygame.display.set_mode((width, height)) #surface pygame.display.set_caption('Rectangle') ## Working with the colors ## Using a class .Color red = pygame.Color(255, 0, 0) green = pygame.Color(0, 255, 0) blue = pygame.Color(0, 0, 255) white = p...
d660acb905c6b098f6ea27256606fbcb5a7fc2cb
v1nnyb0y/Coursera.BasePython
/Coursera/Week.5/Task.30.py
282
3.65625
4
''' Количество различных элементов ''' def countNum(a): count = 0 last = float('-inf') for i in a: if (i != last): last = i count += 1 return count a = list(map(int, input().split())) print(countNum(a))
cf7ae57d863e390eb9f4170c0d27cb26c87d38de
saurabhkawli/PythonHackerRankCodes
/TestSmartNumber.py
612
3.921875
4
import math num = 1 val = int(math.sqrt(num)) print("num: ",num," Val: ",val) print("Num/val",num/val) print("GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG") num = 2 val = int(math.sqrt(num)) print("num: ",num," Val: ",val) print("Num/val",num/val) print("GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG...
797fc1ea37ea865d2873d0877dad7194ded9c682
MischaGithub/Python-project
/main_file.py
1,274
3.859375
4
import time #Import from the lottery file all that will be needed for display purposes #And to be able to write for the text file from lottery import legal_age, lottery_random, player_numbers, prize_catogery #Importing the date from datetime module to get the output of the date from datetime import date #Creating t...
81dc4a9c43e6499205735a14c93505e3bf31e50c
voodoopeople42/Vproject
/1/testc.py
1,067
4.125
4
import math what = input ( "what u want? (+, -, /, *, cos, sin, log, sqrt): " ) if what == "+": a = float (input("first number: ")) b = float (input("second number: ")) c = a + b print ("result: " + str(c)) elif what == "-": a = float (input("first number: ")) b = float (input("second number: ")) c = a - b ...
76bc7dedaecc1e88c3bae528125b2fa2860f3ce5
wail1994/pruches
/venv/Data.py
1,169
3.9375
4
import sqlite3 from tkinter import ttk import tkinter as tk conn = sqlite3.connect('Purchases.db') conn.execute('''CREATE TABLE IF NOT EXISTS Purchases (ID INT PRIMARY KEY NOT NULL, NAME TEXT NOT NULL, AGE TEXT NOT NULL, ADDRESS TEXT, ...
13ce35d609fe73c581fcadd5e175b3b4aa94eab7
ky2009888/learn_python_from_begin
/01-Python核心编程/代码/07-面向对象/03-面向对象其他/hm_04_类方法.py
316
3.59375
4
# 1. 定义类:私有类属性,类方法获取这个私有类属性 class Dog(object): __tooth = 10 # 定义类方法 @classmethod def get_tooth(cls): return cls.__tooth # 2. 创建对象,调用类方法 wangcai = Dog() result = wangcai.get_tooth() print(result)
fefaa9eb049a32fbf518d18f4bff6ff561e3ad74
maxx1256/scripts
/rate/mortgage.py
1,901
3.71875
4
class MortgageCalc(object): def __init__(self): self._balance = 211000.0 self._rate = 0.0375 self._periodsPerYear = 12 self._payPerPeriod = 2000.66 self._ratePaidTotal = 0.0 self._primePaidTotal = 0.0 self._ratePaidYear = 0.0 self._primePaidYear = 0.0...
f087f12bd1fa4e7b0bf884a58676e49dd99f5a27
nikhilNathwani/project_euler
/euler26.py
772
3.828125
4
import time import math primes=[2] start= time.time() def isPrime(num): sqrt= math.sqrt(num) for elem in primes: if num%elem==0: return False if elem>sqrt: return True return True def primesUnder(n): global primes curr= 3 while curr<n: #print curr, len(primes) if isPrime(curr): primes += [cur...
07a2e20be31df85c638ddb9a4e6af874e29a8130
wernicka/learn_python
/original_code/experiments/transit_expenses_calculator_v4.py
3,526
3.703125
4
# I do not understand how I fucked this up so much. Something about floats vs. strings? #error messages not_number = "Error message: not a number" too_small = "Error message: number too small" too_large = "Error message: number too large" #empty clean variables clean_weeks_vacation = "" # none of the options seem to...
423532a1100a2802712fae5921d603f916ff1ab5
python-yc/pycharm_script
/spider/basicuse_lxml_26_etree_and_soup.py
622
3.5
4
# -*- coding: utf-8 -*- from lxml import etree from bs4 import BeautifulSoup # 使用beautifulsoup4读取时,需要先使用read将文件读取出来,然后再进行使用 with open("./test.xml") as f: html = f.read() soup = BeautifulSoup(html, 'lxml') print(soup.find("book")) print('-'*10) print(soup.find(name="book")) print('=========================='*10) ...
a53e8435feed1ccc3985d8cd9b85109ea484b069
ShahriarXD/Junks
/04_input_function.py
118
3.921875
4
a = input("Enter a number: ") a = int(a) # Convert a to an Integer(if possible) a += 55 print(type(a)) print (a)
0e34598f139b35f6776d39b43d2c32a227d4a2a7
jiangkuan2018/algorithm
/prime.py
878
3.734375
4
# coding=utf-8 import math def sieve_of_eratosthenes(n):#埃拉托色尼筛选法,返回少于n的素数 primes = [True] * (n+1)#范围0到n的列表 p = 2#这是最小的素数 while p * p <= n:#一直筛到sqrt(n)就行了 if primes[p]:#如果没被筛,一定是素数 for i in range(p * 2, n + 1, p):#筛掉它的倍数即可 primes[i] = False p += 1 primes = [element for element in range(2,...
435a340c7f2bf6bca328abed4ee791c03ce2805c
CamiloBzt/proyecto_palabras_encadenadas
/temas/mostrar_temas.py
2,343
3.703125
4
import json def traer_temas(ruta: str) -> dict: """ Función que retorna un diccionario con los temas y palabras. :param ruta: ruta del archivo de temas. :return: diccionario de temas. """ archivo = open(ruta, 'r') dic_temas = json.loads(archivo.read()) archivo.close() return dic_te...
3f2c363094349e5a56faa83c3231b3c53ef4fcc1
gpreviatti/exercicios-python
/MUNDO_02/Aula_14/Ex62.py
520
4.09375
4
#melhore o desafio 061, perguntando para o usuário se ele quer mostrar mais #alguns termos. O programa encerra quando disse que quer mostrar 0 termos n = int(input('Digite um número: ')) r = int(input('Digite a razão: ')) termo = n cont = 1 total = 0 mais = 10 while mais != 0: total += mais while co...
f385b19544051242da85344b7ba5b0406378fc43
igorgabrig/AprendizadoPython---curso-em-video
/Mundo03/desafios/Desafios Modulos e Pacotes/ex107/main.py
489
3.84375
4
# Crie um módulo chamado moeda.py que tenha as funções incorporadas # aumentar(), diminuir(), dobro() e metade(). # Faça também um programa que importe esse módulo e use algumas dessas funções. import moeda valor = float(input('Digite um valor: ')) print(f'A metade de {valor} é {moeda.metade(valor)}') print(f'O d...
a467122e901e2ba7732798dae74c81d17d50d241
goswamiprashant/Machine-Learning
/matplotlib_4.py
298
4.0625
4
# to draw a bar graph import matplotlib.pyplot as plt x=[1,2,3,4,5,6] y=[12,34,22,10,45,21] tick_label=['one','two','three','four','five','six'] plt.bar(x,y,tick_label=tick_label,color=['green','blue'],width=.7) plt.xlabel("x-axis") plt.ylabel("y-axis") plt.title('bar-graph') plt.show()
b9aa84330526ef1a8a5ca9066490d6af052bff36
Nikolas2001-13/Universidad
/Nikolas_ECI_181/PIMB/Arena 2/arithmetic.py
209
3.578125
4
from sys import stdin def arithmetic(): a=int(stdin.readline().strip()) b=int(stdin.readline().strip()) x=a+b y=a-b z=a*b print(x) print(y) print(z) arithmetic()
2d18f1e7878a535d8938ec1d63eb303acdcd2c4d
yashwanth-ds/human-actions
/mlp/alcohal.py
1,404
3.5625
4
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.datasets import load_wine wine = load_wine() X= pd.DataFrame(wine.data, columns=wine.feature_names) data1=pd.DataFrame(X['alcohol'])#load the values in alcohol column to data1 data2=pd.DataFrame(X['malic_acid'])#load the values in mal...
bd8a2a0907d434376ba2b7d2dd8e891f88e7e5d4
PritKalariya/Python-practice-problems-and-exercises
/The Basics - Functions and Conditionals/Hot, Warm or Cold.py
434
4.1875
4
# Write a function that: # 1. Takes a temperature as parameter # 2. Returns 'Hot' if the temp is greater than 25 # 3. Returns 'Warm' if the temp is between 15 and 25, including 15 and 25 # 4. Return 'Cold' if temp is less than 15 def meter(temp): if temp > 25: return "Hot" elif temp >=15 and temp <=25:...
1157431041aad5849df9c0f5c26bd73594791aa5
lyricjixh/pychallenge
/challenge07.py
1,105
3.625
4
#!/usr/bin/env python # challenge level 6 from PIL import Image import urllib,string,StringIO url = "http://www.pythonchallenge.com/pc/def/oxygen.png" img = urllib.urlopen(url).read() data = Image.open(StringIO.StringIO(img)) y = 0 while True: col = data.getpixel((0, y)) # print "col: ", col if(col[0] == col[1] ...
2ab93852d6be16e2bcf1614de5aaf7846572908b
superpigBB/Happy-Coding
/Algorithm/K Closet In Sorted Array - Lai.py
5,865
3.5625
4
""" K Closest In Sorted list Medium Given a target integer T, a non-negative integer K and an integer list A sorted in ascending order, find the K closest numbers to T in A. If there is a tie, the smaller elements are always preferred. Assumptions A is not null K is guranteed to be >= 0 and K is guranteed to be <= A....
9f93d21a44525f98ac43c68841a9120ceb88319a
brandoneng000/LeetCode
/medium/893.py
580
3.71875
4
from typing import List import collections class Solution: def numSpecialEquivGroups(self, words: List[str]) -> int: res = set() for word in words: even = "".join(sorted(word[::2])) odd = "".join(sorted(word[1::2])) res.add((even, odd)) return len(res) ...
184a8033d5eaee11db5ce81fff40d62db29437fa
Hrkrabbe/Python
/Øving 7/Sortering.py
1,164
3.71875
4
__author__ = 'Anders' import timeit import random def main(): listelengde = 200 liste = [random.randint(0,listelengde) for i in range(listelengde)] liste1 = bubbleSort(liste[:]) liste2 = selectionSort(liste[:]) print("Usortert liste: ") print(liste) print() print("Liste sortert med bub...
edf03be03bb19ef848d5f6f7517b83b8175eb996
alvinzhu33/6.006
/6/tests.py
3,770
3.515625
4
import unittest from solve_puzzle import solve_puzzle def solved(n, m): return tuple(tuple(n * (m - j) - i - 1 for i in range(n)) for j in range(m)) def move(mv, config): n, m = len(config[0]), len(config) for i in range(n): for j in range(m): if config[j][i] == 0: k, l...
4f221cbe290f3e5c9b2fc5b2fa37ba9fd15c7b64
rimesta21/ZombieGame
/Zombies/Turn.py
1,570
3.625
4
# -*- coding: utf-8 -*- """ Created on Mon Jan 25 16:34:28 2021 @author: rimes """ import random from Zombies.Dice.greenDie import greenDie from Zombies.Dice.redDie import redDie from Zombies.Dice.yellowDie import yellowDie class Turn: def __init__(self): self.cup = {"red" : 3, "yellow" : 3, "gr...
606af434d714d6c7b924f996c7662ba6e30050a1
kcyoon689/Algorithm
/ETC/trump.py
675
3.59375
4
#2 # Trump Card list1 = ["Spade", "Heart", "Diamond", "Clover"] list2 = ["A", 2, 3, 4, 5, 6, 7, 8, 9, 10, "J", "Q", "K"] count = 1 for i in list1: for j in list2: print(count, i, j) count += 1 ############################################################################################...
53ea49ca1b2924a8e8f2f11fcf438302f81fee35
helenpark/PIP
/Algorithm and Data Structure Impl/Generator.py
341
4.09375
4
# Generator example def square(nums): for i in nums: yield (i * i) my_nums = square([1,4,2,5]) # OR: using comprehension # comprehension nums_comprehended = [x*x for x in [1,2,3,4]] # becomes: generator nums_generator = (x*x for x in [1,2,3,4]) print my_nums print nums_comprehended print nums_generator print l...
0dddcecae59283f218e4ce8efc83d4e15bb4a43b
PTLamTOP/A-Level
/29/check_age_new.py
3,549
3.703125
4
""" 1) класс, который принимает дату рождения в текстовый формат (01-05-1991). 2) написать property, которая возвращает возраст 3) вынести в статик метод метод перевода строки в дату 4) написать свойство которое говорить сколько человек прожил високосных год. )Узнать какие годы были высокосные и потом посчитать количес...
3aa582c3a80e8040a3a436fca17c7b4de4e5c6d5
Deepa-chinnu/python-lab
/Lab/Lab 3/football.py
3,647
4.3125
4
""" Title: Football Description: Define a class called “Ball” which defines the position of the ball by using x,y positions [x-coordinate, y-coordinate] and delta-x, delta-y which gives the amount change in x-direction and y-direction respectively. Define another class called “MyFavGame” which inherits the “Ball” c...
7ab72b4899e6c4202236a5dddf4cbaa3325463d7
bri4nle/ai-text-completion-project
/file_io.py
426
3.765625
4
class FileIO: """ This class provides file IO """ def __init__(self, file_name): self.content = '' self.__file_name = file_name def read(self): """ This function read the file input file and return its content :return: """ with open(self.__fil...
d9b2abada9bc6968e5f6e51a2a0de7fdf756510b
Ataago/Data-Structures-Algorithms
/src/recursions/007_recursion_sum_of_subset.py
564
4.0625
4
# !/usr/bin/env python3 # encoding: utf-8 """ Given a list a list of Integers, find any subset which adds up to a Target. @author: Mohammed Ataaur Rahaman """ def sum_of_subset0(integers, target, subset): if sum(subset) == target: print(subset) exit(0) if len(integers) == 0: ...
38ab475dee8ec4b68f53f3a5b18b5c611b9bb56b
katarzynawozna/metody-numeryczne-1
/Lista2/zadanie3.py
275
3.703125
4
def first_method(x): return (((x ** 2) + 1) ** (1 / 2)) - 1 def second_method(x): return (x ** 2) / ((((x ** 2) + 1) ** (1 / 2)) + 1) for x in range(25): print(f"For {x} first method gives: {first_method(2 ** x)} \n second method gives {second_method(2 ** x)}")
1a1a1ee0f841a67ee9fe38c78ef962be99a0da2d
yaroslav2703/CodeWars
/task18.py
345
3.671875
4
def sum_of_intervals(intervals): a = () for j in intervals: a = a + tuple(range(j[0], j[1])) a = sorted(list(set(a))) return len(a) print(sum_of_intervals([(1, 4), (7, 10), (3, 5)])) print(sum_of_intervals([(1, 5), (6, 10)])) print(sum_of_intervals([(1, 5), (1, 5)])) print(sum_of_intervals([(1...
43faf4fbc765556c1a1dee1717c1fa11c47bec5b
abay-90/NISprogramming
/Module 2/Class Lecture & Practise programming/CalculateAreaOfShape.py
1,075
4.3125
4
import math def calculate_area_of_shape(shape, length=0, height=0, width=0, radius=0): if shape == "square": return length * length if shape == "rectangle": return length * width if shape == "cube": return length * length * 6 if shape == "circle": # You could import Math...
d7d03a886938cbb9eef4cdcd0ee8f93af0fc33a0
daDaiMa/Algorithm
/leetcode精选TOP面试题/🌟TOP84.Largest Rectangle In Histogram/code.py
2,106
3.59375
4
# # 写的太臭了…… python的代码和c的一样长 # # class Solution: def largestRectangleArea(self, heights: List[int]) -> int: tree = SegmentTree.buildTree(0, len(heights)-1, heights) return self.getAns(tree, 0, len(heights)-1, heights) def getAns(self, root, start: int, end: int, heights: List[int]): if s...
36740e07bb487517982c60f24063e09d599d002e
laxmanlax/Programming-Practice
/CodeEval/hard/string_searching.py
3,357
4.375
4
#!/usr/bin/env python # Challenge description: # You are given two strings. Determine if the second string is a substring of the # first (Do NOT use any substr type library function). The second string may # contain an asterisk(*) which should be treated as a regular expression i.e. # matches zero or more character...
3f533f155808199a0daee84dcbadcb7acf37b0ad
FedorovMisha/PUL_LAB_1
/pz1_task2.py
1,335
3.546875
4
# Рассчитать объём и полную поверхность по заданным параметрам (вводятся с клавиатуры): # 2. Параллелепипеда (по трем сторонам) # Получить обьём паралеппипеда по трем сторонам def get_parallelepiped_volume(sideA, sideB, sideC): return sideA * sideB * sideC # Получить площадь полной поверхности параллепип...
edf3cbd549f2d8e6026efa2c26a9619a37e0a347
sruj01/Coursera-Python-Data-Structures
/ass10.2.py
475
3.578125
4
fn=input('Enter file name: ') if len(fn)<1: fn='mbox-short.txt' fh=open(fn) else: fh=open(fn) di=dict() li=list() li1=list() for l in fh: if l.startswith('From '): pos=l.find(':') li.append(l[pos-2:pos]) for item in li: di[item]=di.get(item,0)+1 for k,v in di.items()...
93ed6663b5f6fd877195a7d4cbb5efb7284e0921
JanaMojdlova/pyladies-7
/soubory/procvicovani/BONUS_4_pythagoras.py
546
3.578125
4
# -*- coding: UTF-8 -*- # Napis funkci, ktera ti pro dve zadane delky odvesen pravouhleho # trojuhelnika vypocita delku prepony. # (TIP budes potrebovat Pythagorovu vetu) # BONUS: Pridej funkce i pro vypocet strany, # pokud zname jednu odvesnu a preponu # Pythagorova věta: a**2 + b**2 = c**2 from math import sqrt ...
d5cec1594863e09e28d92b3c1fc531e35c2c682d
mtndcl/HACETTEPE
/HACETTEPE/2019-2020/BBM103_Introduction to Programming I/Quiz-5/quiz5-1.py
621
3.765625
4
import sys def draw(began_point, end_point, mid_point): if end_point>began_point : if mid_point>began_point: if end_point==began_point: print(' '*(mid_point-began_point)+'*'*((began_point<<1)+1),end='') else: print(' '*(mid_point-began_point)+'*'*((began_point<<1)+1)) else: if end_point==began_p...
fb620b5cafd8a78f476340c9dd49a667cf6637d3
nkoomson/CSS225Homework
/Week_10/Adventure_Game_Section_1.py
2,862
4.1875
4
#Section_1.py #Nelson Koomson #3/17/2021 #First Section of my Adventure Game from main_character import player def start(): #This is what the player should have on his way. #player.money = 10 #wounded = False #weapon = ["pepper_spray", "knife"] #Introduction print("This is a journ...
8b98e49fc36f8fe1bdca32d832e27ef3802b0dd1
bmoretz/Python-Playground
/src/DoingMathInPython/ch_06/growing_circle.py
634
3.921875
4
''' A Growing Circle ''' from matplotlib import pyplot as plt from matplotlib import animation def create_circle(): circle = plt.Circle( ( 0, 0 ), 0.05 ) return circle def update_radius( i, circle ): circle.radius = i * 0.5; return circle def create_animation(): fig = plt.gcf() ax = plt.axes( xlim = ( -10, 10...
3419cd9515ad20ba28de8ccc28c7160457adc630
ava6969/CS101
/Student.py
323
3.671875
4
class Student: def __init__(self, name, age, height): self.name = name self.age = age self.height = height def study(self): print(self.name, 'is studying') class HighSchoolStudent(Student): def __init__(self, name, age, height): super().__init__(name, age, heigh...
afe68280d5aff3021ab0030e22d6713a99a09ac7
disciuser/homework_koshulko
/hw3_koshulko.py
4,229
3.96875
4
"""Homework 3""" """Для запуска програмы нужно указать правильное размещение текстового файла в функции print_all в строках 90 и 95""" #task 1 def counting_letters(string,list_leters = ['a','e','i','o','u']):#функция посчета определенных букв counted_leters = 0 for check in range(0,len(str(string))): if string[che...
b3ad2471d168c8d6d1b4f47b6cad5ad7709c8412
nagask/Interview-Questions-in-Python
/Bitwise_Operations/Equality_NoComparisonOperators.py
259
3.84375
4
''' Created on Sep 20, 2015 @author: gaurav ''' def checkEquality(a,b): print(a,b) return not(a^b) if __name__ == '__main__': print(checkEquality(2,3)) print(checkEquality(2,2)) print(checkEquality(2,-1)) print(checkEquality(-1,-1))
3e5fd6f75d7729b1ffe1f4a52843a1e693f82769
TrCaM/Letter-Classifiers
/src/LogisticRegression.py
3,349
3.75
4
""" Assignment1.LogisticRegression ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Logistic Regression implementation """ import numpy as np import matplotlib.pyplot as plt def sigmoid(x): return 1 / (1 + np.exp(-x)) def least_squares(X, y): return np.linalg.inv(X.T @ X) @ X.T @ y def cost_function(w, X, y): ...
1088d0ec4864e0d15fe53418add5a8e8a9c1c03b
ElinorThorne/QA_Work
/Encryption4.py
559
3.78125
4
def ASCII(a): f = open(a, "r") msg = f.read() numbers=[] for chr in msg: x = ord(chr) numbers.append(x) return numbers def Key(a): ch = ord(a[0:1]) return ch def Encrypt(a, b): multiplied = [] for i in a: x = i+b multiplied.append(x) print(multiplied) #get inputs fileName = inp...
d1e882041caa42473d59758a5e816f73a7924de5
CodyBankz/SisonkeRising
/sisonkelength.py
927
3.90625
4
""" Program By: Koketso Maphothoma.. """ myList1 = [1,5,8,11,12,15] myList2 = [1,100,25] def Sisonke_length(list): length = 0 for index in list: length = length + 1 return length #Returning the length listLength = Sisonke_length(myList1) print("List 1 length :") print(listLength) length...
86f48fc479c372b0b5a989adc0a7ea53c6aa0a73
dhermes/project-euler
/python/complete/no095.py
1,856
3.65625
4
#!/usr/bin/env python # We use a sieve type method to calculate # the sum of all proper divisors up to n # by looping through all possible factors # and adding to the sum for each number # that the factor divides into from python.decorators import euler_timer def proper_divisor_sums(n): result = [0] * (n + 1) ...
d1fb1700f0dbbe6639c2a4af9019c3abdaa7fcb6
jsourabh1/Striver-s_sheet_Solution
/Day-10_Backtracking/question6_word_break.py
552
3.859375
4
#User function Template for python3 def wordBreak(line, dictionary): # Complete this funct def solve(line,dictt,string2,start): if start==len(line): return True word="" for i in range(start,len(line)): word+=line[i] ...
dc44121b7845aee45ad2da2e0866e485efbc4aab
Aasthaengg/IBMdataset
/Python_codes/p03307/s600961107.py
86
3.765625
4
N=int(input()) if N==1: print(2) elif N%2==0 and N>1: print(N) else: print(2*N)
42b7db75956cc2cceab687d8fe933a3a81caf5ae
anuteresa/Employee_Details
/employee_contact_details.py
2,001
3.53125
4
from tkinter import* import employee_backend window= Tk() def add(): employee_backend.insert(first_name.get(),last_name.get(),employee_id.get(),phone_no.get(),department_name.get()) list1.delete(0,END) list1.insert(END,(first_name.get(),last_name.get(),employee_id.get(),phone_no.get(),department_nam...
10c04155cfe1694964306ecbf669ecc241fabcc3
l8g/graph
/Graph/Bfs/BipartitionDetection.py
1,466
3.53125
4
# -*- coding: utf-8 -*- import sys sys.path.insert(0, "../Expression") from Graph import Graph from collections import deque class BipartitionDetection(): def __init__(self, g): self._g = g self._visited = [False] * g.v() self._colors = [0] * g.v() self._isBipar...
6dbd90ba9625817e1e54203220b26e96766faf82
Chansazm/Project_31_Dynamic_Programming
/allconstruct.py
615
3.5625
4
def allconstruct(target,wordbank): if target == '': return [] result = [] for word in wordbank: if target[0] == word[0]: suffix = target[len(word):] suffixwaysways = allconstruct(suffix,wordbank) #targetways = suffixwaysways.map(way => [word,...way]) ...
36148ff85fab3c3bf610ab9db0eb9e12832f14ca
junior333/lista-python
/ex11.py
189
3.953125
4
###Receba o raio de uma circunferência. Calcule e mostre o comprimento da # circunferência. raio=float(input('digite o raio de um circulo: ')) print(f'a circunferencia é {2*3.14*raio}')
a08f032eb8467531268d21d2884ee72bcbb8aaab
PiciAkk/factorial.py
/fact2.py
135
3.96875
4
def factorial(num): fact = 1 for i in range(1, num+1): fact = fact * i return fact print(factorial(int(input())))
89696db4ddb5bff68fe51ff6d767397b1292d877
maihan040/Python_Random_Scripts
/plusOne.py
1,413
4.1875
4
#!/usr/bin/python3 ''' plus_one.py Given a non-empty array where each element represents a digit of a non-negative integer, add one to the integer. The most significant digit is at the front of the array and each element in the array contains only one digit. Furthermore, the integer does not have leading zeros, exce...
a08212d4e139b83297451fd14c05063a977cda16
CHIAHSUNCHIANG/c_to_f
/c_to_f.py
100
3.75
4
temp = input("Please type in 'C: ") temp = float(temp) F_temp = temp*9/5+32 print(" 'F : ", F_temp)
553a6cbff21c2dce8b762b7808d1369bdbd4da3e
shivani1611/python
/ListCompare/main.py
505
3.84375
4
#!/usr/bin/env python3 import sys def main( ): # two lists to compare list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] list2 = ['b', 'd', 'f'] # remove all the elements that are in list2 from list1 for a in range( len( list2 ) - 1, -1, -1 ): for b in range( len( list1 ) - ( 1 ), -1, -1 ): if( list1[b...
b1881b8950b482e17c7cd17d453c5f6bca60ad10
BobbyHemming/maze-game
/CollisionFinder.py
2,233
3.640625
4
import pygame from Vector import Vector def collision_detection(player, walls): pos = player.pos vel = player.vel size = player.size collision_list = [] for wall in walls: wall_top = wall.rect.y wall_bottom = wall.rect.y + wall.rect.height wall_right = wall.rect.x + wall...
1009198ad21ce38799dea1f46463444fce6db103
hnaseem1/webmaps
/map1.py
1,245
3.578125
4
import folium import pandas #reading data from external txt file using pandas because it can make sense out of the structure data = pandas.read_csv("Volcanoes.txt") #storing the required columns in variables lat = list(data["LAT"]) lon = list(data["LON"]) elev = list(data["ELEV"]) #function to call later for volcano...
a4db44c52f996b4711725bb1cf38bee562e0ee0f
waltlrutherfordgmailcom/CTI110
/P4HW3_SumNumbers_WalterRutherford.py
1,084
4.3125
4
# This program asks the user to enter a series of positive numbers for a sum. # 3/6/2019 # CTI-110 P4HW3 - Sum of Numbers # Walter Rutherford # Define function. # Define variables. # Display introduction. # Create while loop. # Get the Integer. # Display Total. # Beginning of function. def Sum_function (...
a912e4d36338d8cefbf3781a36b335478117f99a
ivanmopa/sumalista
/otrasumalista.py
516
4.09375
4
#!/usr/bin/env python #-*- coding: utf-8 -*- #Hacer una función que reciba una lista de números, sume solamente #los positivos y devuelva el resultado de la cuenta. li = [] def suma(li): resultado = 0 for numero in li: if numero > 0: resultado = resultado + numero else: resultado = resultado return result...
d0d448a2e27c332c9a8d22fc4722600956d712f4
RenukaSenthil/tutorials
/prime.py
181
3.5
4
n=int(input()) for i in range(n): if i>1: for j in range(2,i): if (i%j) == 0: break else: print(i,end=" ") else: print("0")
4382dbb546b398130032c398b3ed96904b36338c
Rude-Crow/python
/Regex expressions.py
1,472
3.71875
4
import re def PasswordChecker(): #defines function called PasswordChecker passwd = input("Enter a password to check: ") #Gets user input passwd_check = re.match(r'^[a-zA-Z0-9@#$%^&+=]{1,8}$', passwd) #creates an expression to check against if passwd_check: print('Valid') else: ...
7f7a6be39e3cff47a39358aa13c96431398b82de
conrad1451/calendar-populator
/gtdHelperCode.py
17,306
4.03125
4
from datetime import datetime # ---------------------- MY STANDARD HELPER FUNCTIONS -------------------- # # returns true if 'theChar' is found in 'theStr' def foundInText(theStr, theChar): # returns true if 'theChar' is found in 'str' return theStr.find(theChar) != -1; # returns true if 'substr' is found...
04659bf85c6f9c2c36b96499c0ce3cbc62752fe7
ArnoutSchepens/Python_3
/Oefeningen/standalone/dictionary_4.py
1,032
4.3125
4
# Every character has an ASCII code (basically, a number that represents it). # Python has a function called chr() that will return a string if you provide the corresponding integer ASCII code. # For example: # chr(65) will return 'A' # chr(66) will return 'B' # All the way up to: # chr(90) will return 'Z' # Your ...
3b1bcce9eb77a9a2729258805beda987dbe941e4
jeysusmeister/calculadora
/main.py
2,861
3.5625
4
from modulos.Aritmetica import Aritmetica sigue = "y" while sigue=="y": try: operacion = int(input("\nIngrese la operación que desea realizar:\n\t1.-Suma.\n\t2.-Resta.\n\t3.-Producto.\n\t4.-División.\n\t5.-Salir.\n\t\t")) switcher = { 1:"Suma", 2:"Resta", 3:"Pro...
94056f4970ae5ee028d5746b5a833f14bf54faf0
theturbokhemist/Optimization-Algorithms-for-Traveling-Salesman-Problem
/opt_TSP.py
29,290
3.6875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Project Team #2 Authors: Daniel Gordin & Kyle Mikami """ #Import packages import numpy as np import pandas as pd import matplotlib.pyplot as plt import math import random as rnd import statistics import itertools from scipy.spatial import ConvexHull ...
8d232e675310da91e5385a1b94f8f45db12660f6
Kdoger/LeetCode
/leetcode_1.py
910
3.703125
4
''' 问题描述: 给定一个整数数组 nums和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那两个整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。 你可以按任意顺序返回答案 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/two-sum 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 ''' class Solution: def twoSum(self, nums, target): for i in range(len(nums)):...
49556b7afe7501383f6f848c66a3bbf8e4cda0d1
skiry/University
/Fundamentals of Programming/Assignment01/B.06.py
1,103
3.953125
4
year=int(input("I am gonna compute your age in number of days. Your year : ")) month=int(input("And your month : ")) day=int(input("Day : ")) age=0 import datetime actual=datetime.datetime.now() months=[] def assigndays(): months.append(31) months.append(28) months.append(31) months.append(30...
f345c78a8dc07f78c6b215a5275b7b6904e02529
Karngupt/pdsnd_github
/Bikeshare_Project_v2.py
8,050
3.859375
4
#!/usr/bin/env python # coding: utf-8 # In[ ]: import datetime as dt import pandas as pd import numpy as np import calendar # In[ ]: #Reading in raw data to enable user to view it chicago_orig=pd.read_csv("chicago.csv") newyork_orig=pd.read_csv("new_york_city.csv") washington_orig=pd.read_csv("washington.csv") ...
dec3f2ba1ce0644df31f326fc27cb37c26fda669
matthenschke/30-Days-of-Code-HackerRank
/day6.py
186
3.53125
4
# Enter your code here. Read input from STDIN. Print output to STDOUT test_cases = int(input()) for _ in range(test_cases): s = input() print("{0} {1}".format(s[::2], s[1::2]))
6e7583931facafefcc54a652884f5d19193d4b3b
BeiNNOnAir/grokking_algorithms
/ch4.py
1,058
3.65625
4
# 4.1 sum function def sum_(lst): if len(lst)==1: return lst[-1] else: return lst.pop()+sum_(lst) # test = sum_([3,4,5]) # print(test) # 4.2 count function def count_(lst): if len(lst)==1: return 1 else: return 1+ count_(lst[1:]) # test = count_([3,4,5]) # print(test) #...
b398fe50cfb5ed87228184cf64c8f2637731afbd
pfkevinma/stanCode_Projects
/stanCode_Projects/my_photoshop/shrink.py
1,541
4.15625
4
""" File: shrink.py Name: Pei-Feng (Kevin) Ma ------------------------------- Create a new "out" image half the width and height of the original. Set pixels at x=0 1 2 3 in out , from x=0 2 4 6 in original, and likewise in the y direction. """ from simpleimage import SimpleImage def shrink(filename): ...
e8e072f565b74063cbdceb5d833b3ffd8c7171d7
AndrewAct/DataCamp_Python
/Image Processing with Keras in Python/2 Using Convolutions/02_Image_Convolutions.py
1,208
4.28125
4
# # 8/16/2020 # The convolution of an image with a kernel summarizes a part of the image as the sum of the multiplication of that part of the image with the kernel. In this exercise, you will write the code that executes a convolution of an image with a kernel using Numpy. Given a black and white image that is stored i...
bd1426414c3dacb561ffc5f5da752531d9bb6a58
mwhooker/gallery_tool
/gallery.py
1,013
3.8125
4
""" gallery.py helps you calculate where to place your hanger All units in inches """ from fractions import Fraction # we hang frames at 57" on center CENTER = Fraction(57) def parse_input(s): """ >>> parse_input("5") Fraction(5, 1) >>> parse_input("5 7/8") Fraction(47, 8) """ parts = s...
5f9576f1a3f3084c859f12fa72baa03044901232
sergiovasquez122/Common-sense-data-structures
/chapter11/exercise1.py
395
4.1875
4
''' Use recursion to write a function that accepts an array of strings and returns the total number of characters across all the strings. For example, if the input array is ["ab", "c", "def", "ghij"] , the output should be 10 since there are 10 characters in total. ''' def total_characters(l, idx=0): if idx >= len(...
457762be3ea60a8f986177821bb4cf59b1993236
adibl/project1
/csv_cla.py
2,361
3.859375
4
""" writer: adi bleyer date: 11/11/2017 ths file contain the student class. the class have init, str methode. the clas handel amat students """ class Student: SCIENCE = [('physics', "5"), ('chemistry', "5"), ('arabic', "5"), ('biology', "5")] MATH = [("math", "5")] COMPUTER = [('computer sc...
49cdc3fd3963d6681a122e5142731c2f0e2c960f
AP-MI-2021/lab-3-ClaudiuDC21
/main.py
6,314
3.953125
4
from typing import List def show_menu(): print('1. Citire Date. ') print('2. Determinare cea mai lunga secventa cu proprietatea ca numerele sunt palindrome. ') print('3. Determinare cea mai lunga secventa cu proprietatea ca numerele sunt formate din cifre prime ') print('4. Determinare cea mai lunga s...
b95d84c0ec196e15a2142a6bd8932b5677e4aa9b
yhx0105/leetcode
/04_chazhaohepaixu/15_岛屿数量.py
1,168
3.8125
4
""" 给定一个由 '1'(陆地)和 '0'(水)组成的的二维网格, 计算岛屿的数量。一个岛被水包围, 并且它是通过水平方向或垂直方向上相邻的陆地连接而成的。 你可以假设网格的四个边均被水包围。 输入: 11110 11010 11000 00000 输出: 1 输入: 11000 11000 00100 00011 输出: 3 """ class Solution: def numIslands(self, grid): w=len(grid) l=len(grid[0]) res=0 for r in range(w): for...
15f9fab2b877165bc8b797f5af81037319579cce
sankethsunkad/sllab
/sl lab/5/5a.py
1,081
4.0625
4
conversions=set([]) amendd=[] def c_f(temp): final=(temp*1.8)+32 return final def f_c(temp): final=(temp-32)*(5/9) return final while('true'): print("1.Celsius to fahrenheit") print("2.fahrenheit to celsius") print("3.to print the convrsions value") print("press 0 to terminat...
d2244e2b701d415c28343bd4926a85e75a91c634
jxnu-liguobin/cs-summary-reflection
/python-leetcode/laozhang/tree/leetcode_105_.py
1,281
3.546875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # coding=utf-8 """ 105. 从前序与中序遍历序列构造二叉树 """ from typing import List from laozhang import TreeNode class Solution: ##待优化 def buildTree_(self, preorder: List[int], inorder: List[int]) -> TreeNode: if not preorder: return None val = preo...
95efdb9847e0d4362d38737b38f78a93af1db3ed
karthikh07/Python-core
/Basics/arithmatic.py
185
3.5
4
a=5 b=10 c = a+b d=a-b e=a*b f=a/b g=a**b #square h=a//b #div without float answer i=a%b print (c) print (d) print (e) print (f) print (g) print (h) print (i)
c7a823eee922684b22ece5bc3c9f08ab80f348c9
GalvanizeDataScience/building-spark-applications-live-lessons
/code/person.py
278
3.859375
4
# print print "hello world" # classes class Person(object): def __init__(self, name, company): self.name = name self.company = company def say_hello(self): return "Hello, my name is {0} and I work at {1}".format(self.name, self.company)
218592a365ff30b76b7636c5b1b48af46552d2b5
helas/takehome
/client_data/query_api.py
3,212
3.546875
4
import requests from datetime import datetime from datetime import timedelta class TakeHomeApiClient: # Calculate result of task 4a def highest_average_temperature_since_2000(self): # first, using the params bellow, we ask our API for the highest temperatures per city since 2000 now = datetim...
1f086346e820da605a418b435f2ddfc0d8721a6d
Diegokernel/holbertonschool-machine_learning
/supervised_learning/0x03-optimization/4-moving_average.py
395
3.90625
4
#!/usr/bin/env python3 """calculates the weighted moving average of a data set:""" import numpy as np def moving_average(data, beta): """calculates the weighted moving average of a data set:""" a = 0 bias_corrected = [] for i in range(len(data)): a = (beta * a + (1 - beta) * data[i]) ...
43a26e199791f63f3c7d8ce73ea816fe0d24fd28
DeshErBojhaa/sports_programming
/leetcode/Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree.py
936
4.03125
4
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right # Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree class Solution: def isValidSequence(self, ...
42ed21f6afec015ace7c9e6e608510caa253468a
mkiterian/oop
/computer.py
2,254
3.546875
4
class Computer(): def __init__(self, brand, memory_size, storage_size, os_type): self.brand = brand self.memory_size = memory_size self.storage_size = storage_size self.os_type = os_type #use name mangling to make it private self.__warranty = 12 def power_up(sel...
44f7855ed323edc5237bd66bc25a25a9bf1d77f5
amitjain17/FSDP2019
/DAY5/simpsons.py
533
3.828125
4
# -*- coding: utf-8 -*- """ Created on Sat May 11 21:38:32 2019 @author: NITS """ import re #import regular expression list3 =[] #intialize the list with open("simpsons_phone_book.txt",'rt') as simp: #open the text file list1 = simp.read() l...
ee1fab47670ab02048c0a3c94ebab55b11a101b1
dogeplusplus/DailyProgrammer
/247SecretSanta.py
1,448
3.8125
4
import random def secret_santa(participants): pairings = [] # Final pairings at the end participant_list = [x.split(' ') for x in participants.splitlines()] # Split participants into list of families # Random member from largest family remaining largest_family = max(participant_list,key=len) fami...
31be2f297b789c0414c69e40ab8647f41b60c3ca
Sushmitha999/python
/13.py
333
3.625
4
#modified encoding from itertools import groupby def encode_modified(alist): def aux(lg): if len(lg)>1: return [len(lg), lg[0]] else: return lg[0] return [aux(list(group)) for key, group in groupby(alist)] print(encode_modified("aaaabbbbcc...
a89e6a7f9b214058f5c68a492d5622980c226d7d
apang-ai/InterView
/InterView/DataStructures/6.LeetCode.py
976
3.984375
4
''' 给定一个仅包含大小写字母和空格 ' ' 的字符串 s,返回其最后一个单词的长度。如果字符串从左向右滚动显示,那么最后一个单词就是最后出现的单词。 如果不存在最后一个单词,请返回 0 。 说明:一个单词是指仅由字母组成、不包含任何空格字符的 最大子字符串。   示例: 输入: "Hello World" 输出: 5 题解: def lengthOfLastWord(s): # 判断如果不存在这个字符串就返回空 if not s: return 0 # rstrip 默认删除末尾的空字符,如果末尾是空字符,先删除 s = s.rstrip() # 倒叙遍历字符...
7cf036633f5d19256af8888d279a992c34d2a61a
cristinarivera/python
/untitled-24.py
181
3.671875
4
def find_last(s,t): n = s.find(t) while n > 0: return n n = n + 1 else: return n print find_last('baaa','a') #>>> 3
fe902ff7847005527c70d93c52716be9917e58ee
Jhon-Chen/Code_Practice
/C_miniWeb_server/01_miniWeb服务器_动态网页.py
1,595
3.6875
4
# 导入模块 import socket from application import app class WebServer(): # 定义初始化方法 def __init__(self): # 创建套接字 tcp_server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # 设置套接字属性 tcp_server_socket.setsocketopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, True) # 绑定端口 ...
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...
73340d763c3695ad266296a4261b1bad9d78e575
taylorcreekbaum/lpthw
/ex21/ex21-2.py
835
3.984375
4
def add(a, b): print(f"ADDING {a} + {b}") return a + b def subtract(a, b): print(f"SUBTRACTING {a} - {b}") return a - b def multiply(a, b): print(f"MULTIPLYING {a} * {b}") return a * b def divide(a, b): print(f"DIVIDING {a} / {b}") return a / b print("Let's do some math with just fu...
747a3d0d648ccd8e6e116e6a7fe3022963ce7a45
kenziebottoms/py-testing-calc
/calculator.py
968
4.09375
4
class Calculator(): """Performs the four basic mathematical operations Methods: add(number, number) subtract(number, number) multiply(number, number) divide(number,number) """ def add(self, x, y): """Adds two numbers together Arguments: x - ...