blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
3294703130510616c3b08a0c5aaa47a708804b93
siralomarahmed/100DaysOfCode
/SourceCode/Python/day026.py
580
3.90625
4
# ------------------------------------ # # Author: Ahmed A. M. ALOMAR # Date: May 6 - 2020 # # Description: # * Example of Dictionary modification # ------------------------------------ # speed = { "slow": 40, "fast": 60, "very fast": 100 } print(speed) more_speed = { "very fast" : 200, "average": 50, "n...
5b2855641050a06e17ca4d01b1df7c67c7ebfccc
npkhanhh/codeforces
/python/round745/1581A.py
272
3.609375
4
from math import factorial from sys import stdin for _ in range(int(stdin.readline())): n = int(stdin.readline()) res = 1 for i in range(1, 2 * n + 1): res *= i if i != 2*n: res %= 10 ** 9 + 7 print((res // 2) % (10 ** 9 + 7))
10b28cc39c3a4b69bc1ea57b32df933c0eb26261
vijayshersiya/pythoncodes
/Day 2/hands3.py
600
4.40625
4
# -*- coding: utf-8 -*- """ Created on Wed May 8 21:36:33 2019 @author: Vijay """ #Hands On 3 #Make a function days_in_month to return the number of days in a specific month of a year year=int(input("enter the year:")) month=[january,february,march,april,may,june,july,august,september,october,november, december] i...
b75b8364a23ad3f99cf3f2abdbc9bc6270dc00a1
Phantomn/Python
/study/ch1/op.py
136
3.734375
4
print("%d + %d = %d\n"%(3,5,3+5)) print("%i + %i = %i\n"%(3,5,3+5)) print("%d - %d = %d\n"%(3,5,3-5)) print("%i + %i = %i\n"%(3,5,3-5))
157542e30340dda5432206c55442bf77d42fd259
mkzia/eas503
/old/spring2020/week3/set_syntax.py
305
3.53125
4
A = {0, 2, 4, 6, 8}; B = {1, 2, 3, 4, 5}; # 2 in A # # union -- all values A | B # # intersection -- shared values A & B # # difference -- order matters A - B B - A # # symmetric difference https://en.wikipedia.org/wiki/Symmetric_difference A ^ B my_list = [1, 1, 2, 3] my_list = list(set(my_list))
372591cc6a5b5a39a9d16de0a5107f997fdec497
ryandavis3/leetcode
/two_sum/two_sum.py
575
3.8125
4
from typing import List # https://leetcode.com/problems/two-sum/ def twoSum(nums: List[int], target: int) -> List[int]: """ Given an array of integers, return indices of the two numbers such that they add to a specific target. Use single O(n) pass with hash table (dictionary). """ D = {} ...
f27605dd9d226815a6b8b7f67837415de6b94b78
Somesh1501/Codes
/greatest_no._finder_program_by_MAX-OPERATOR.py
243
3.875
4
#max operator is built in operator which gives us greatrest no. def greatest(a,b,c): return max(a,b,c) print('hello') x=(input("enter 1st number")) y=(input("enter 2nd number")) z=(input("enter 3rd number")) print(greatest(x,y,z))
01dd3aabd83d54a1007fac48787059d2990cf196
daniel-reich/ubiquitous-fiesta
/oCe79PHB7yoqkbNYb_14.py
182
3.5
4
def break_point(num): num = str(num) lst = [[[int(x) for x in num[i:]],[int(x) for x in num[:i]]] for i in range(1,len(num))] return max([sum(x[0])==sum(x[1]) for x in lst])
47203faeffa9a3afeaf2bf1a0a20c2a7cfc4b182
Abhay-Vashishtha/Python_basics_exercise
/pandas_multiple_excels_workbook.py
752
3.65625
4
#Given a csv file for class data #Seperate the data on basis of class #Output the separated data in an excel workbook in different sheets import pandas as pd import os #Fetching file name csv_file=os.path.join('C:/Users/lic/.spyder-py3','class_data.csv') #Creating source dataframe df=pd.read_csv(csv_file)...
696fc2dcfb3db55107c495a7ba8aff565d82c114
potiii/Thema-a-game
/force/Explanation.py
2,694
4.03125
4
import os class Explanation: def explanation(self): print('****************************************') print("* *") print("* Welcome to Stinkin' Dungeon *") print("* *") print("* A simple...
c8ab267b2a2aa07725c50f09c7d74b7ceb855e34
fuanruisu/Py
/listas.py
544
4.1875
4
# Nombre: listas.py # Objetivo: muestra la funciòn de las listas en python # Autor: alumnos de Mecatrònica # Fecha: 27 de agosto de 2019 #crear lista vacía lista = [] # agregamos elementos a la lista lista.append("hola") lista.append(False) lista.append(23.13) lista.append('c') lista.append(23) lista.append(-12) ...
10b8657546807976a930354590785989ed11bca6
oscarliz/Ejercicios-esencia-de-la-logica
/Programa que acepte un correo electronico, determine si el mismo es un correo valido, (a nivel de formato).Programa que acepte un correo electronico, determine si el mismo es un correo valido, (a nivel de formato).py
187
4.03125
4
n1 = input("ingrese su correo electronico: ") if n1.find("@") == -1 or n1.find(".") == -1: print("no es valido este formato") else: print("es valido el formato") pass input()
ca62122ca9390d6fb244ffa33553612a137955d3
joaovicentefs/cursopymundo2
/exercicios/ex0041.py
592
4.03125
4
from datetime import date hoje = date.today().year nasc = int(input('Informe seu ano de nascimento: ')) idade = hoje - nasc txt_padrao = 'Sua Categoria:' print('O atleta tem {} anos.'.format(idade)) '''Não preciso usar o 9 < no primeiro elif porque se ele chegou nesta condição é que ele passou pela outra, com isso pod...
5702e995d5e39be551a82d3138f154c889b92f39
RRichellFA/Projeto-RPG
/IntroRPG.py
5,239
3.90625
4
from time import sleep print("\033[31mEste é um projeto didático, serve para aprimoramento e fixação de conhecimentos na linguagem " "Python!\033[m") sleep(5) print('='*5, 'Criação do personagem', '='*5) print(""" Todas as informações podem ser alteradas para melhor se adequar a sua própria aventura. ...
761c5d6a362dc0c0105946d0add865af2ac9ca7c
amritavarshi/guvi
/hunter89.py
135
3.875
4
s=input() s=list(s) arr=[] for i in s: if i not in arr: arr.append(i) arr.reverse() str1="" print(str1.join(arr))
79847dcbbaff2b3a4542ead2fdc72e86c82b011d
dipanbhusal/Python_practice_programs
/ques44.py
158
3.984375
4
# 44. Write a Python program to slice a tuple. sample_tuple = (1,2,3,4,5,6,8,5,43,6,5,10) from_first_to_fifth = sample_tuple[:5] print(from_first_to_fifth)
85b54cf956e2b68d84ef086509a8b83fbde88725
Shubhranshu-Malhotra/Learning-Python
/Oops_Polymorphism.py
1,474
4.1875
4
class User: # Parent Class def __init__(self, name, power): print('init in User Class') self.name = name self.power = power def sign_in(self): print('Logged In.') def abilities(self): print('User has no abilities') class Wizard (User): # Sub Class / Derive...
95b0906e833832928015912bf462a6788c3e9d9f
A01375932/ProyectoFinal
/Proyecto final.py
8,373
3.828125
4
#Autor: Guadalupe Iveth Serrano Hernández #Poyecto final: programa que recomienda aplicaciones para facilitar el trabajo en areas como el diseño de arte y la edicion. from PIL import Image def menu(): #Menú de la página principal print('''Bienvenido. Te ayudaremos a encontrar una herramie...
86bee9e029e848c867c0819c0dd0378d761c66f0
dunmanhigh/y3math
/math2/if_x-k_is_factor_of_polynomial.py
447
3.75
4
# Determine if x-k is a factor of a polynomial by Factor Theorem p = int(input("Highest power of x: ")) a = [] for i in range(p+1): if i > 1: a.append(int(input("coefficient of x^" + str(i) + ": "))) if i == 1: a.append(int(input("Coefficient of x: "))) if i == 0: a.append(int(input("Constant: "))) k = int(i...
61ec1436c38772e50319199458c7ba4a1dbaeff3
ChrystianPatriota/Zero-of-functions
/interval.py
1,217
4.125
4
# Declaração de função para encontrar intervalos que contenham zero de função def interval(function, initial, final, step): # Primeiro valor a ser verificado x1 = initial # Segundo valor com o passo x2 = initial + step # Laço para verificar todos os valores dentro do intervalo informado while x...
6589164ccf72c64dcbec12ef047323e16862afe4
pgThiago/first-code
/aprendendo.py
130
3.640625
4
day = input ('day=') month = input ('month=') year = input ('year=') print ('você nasceu no dia', day, 'de', month, 'de', year)
1cc6bad12cf3f2fa8b94a189f71a2ac5331777d6
afhernani/tk-gui-templates
/WIDGETS/tkinter-treeview/treeherencia.py
1,047
3.78125
4
import tkinter as tk from tkinter import ttk from tkinter.messagebox import showinfo # create root window root = tk.Tk() root.title('Treeview Demo - Hierarchical Data') root.geometry('400x200') # configure the grid layout root.rowconfigure(0, weight=1) root.columnconfigure(0, weight=1) # create a tre...
07d977fb91ebc2aa73da5768ef668fba2d212cdc
chengshifan/LeetCode
/59-spiral-matrix-ii/Solution.py
782
3.53125
4
from typing import List class Solution: def generateMatrix(self, n: int) -> List[List[int]]: paths = [[0, 1], [1, 0], [0, -1], [-1, 0]] res = [[0] * n for _ in range(n)] visited = [[False] * n for _ in range(n)] i = j = 0 cur = 1 def helper(x, y, cur, res, visited,...
60a5ed0b173daa2a4fe532afb874c8f9e8f17799
CollinErickson/LeetCode
/Python/76_MinWindowSubstring.py
1,846
3.640625
4
class Solution(object): def minWindow(self, s, t): """ :type s: str :type t: str :rtype: str """ if t == "": return True if s == "": return False L = 0 R = 0 d = {} for tt in s: d[tt] = 0 td...
083e9cd188fec05605e88de71a646cadbf67de83
shreya-madhwal/uplift-python-resources-shreya-madhwal
/tuple_function.py/misc_tup.py
1,813
3.78125
4
def read_list(newlist,n): s=n for i in range(s): e=int(input()) newlist.append(e) print(newlist) return newlist def read_list2(newlist,n): s=n for i in range(s): e=int(input()) newlist.append(e) newtuple=tuple(newlist) print(newtuple) return newlist ...
f388e4c38f2e05be4981110b12714b7fdd98dd60
kevin-reaves/LeetCode
/345 - Reverse Vowels in a String.py
496
3.578125
4
class Solution: def reverseVowels(self, s): s = list(s) vowels = {"a","e","i","o","u","A","E","I","O","U"} index = [] word = [] for i in range(len(s)): if s[i] in vowels: index.append(i) word.append(s[i]) for i in ...
38f3d819b4f9e56f6213405014f1b3c243366dca
zc256/PythonCalculator
/Calculator/calculator.py
1,190
3.53125
4
from Calculator.addition import add from Calculator.subtraction import sub from Calculator.multiplication import mult from Calculator.division import divide from Calculator.squared import squared from Calculator.squareRoot import squareRoot from Calculator.addSub import addSub from Calculator.sqrtSquared import sqrtSqu...
b68b7159b30215dcefa76356d646eb55104bad62
dickinsm/change.py
/change.py
417
3.578125
4
i = input("Please enter an amount in cents less than a dollar") quarter = 25 dime = 10 nickel = 5 penny = 1 i = int(i) print("Your change will be:") if i>=25: q = int(i/quarter) i = i % quarter print("Q: ", q) if i>=10: d = int(i/dime) i = i % dime print("D: ", d) if i>=5: n = int(i/nickel) ...
edf13516835b6f70d50e390f40f5f344623e1099
ryandevos/Practice
/Les 8/Exercise.py
632
3.53125
4
import random def game(): bomx = random.randrange(0, 5) bomy = random.randrange(0, 5) bomfound = 0 while bomfound == 0: pos = input('Enter next position (format: x y): ') positionsplit = pos.split() positionnum = [] positionnum.append(int(positionsplit[0])) po...
a71da164ce0351d4a1582d813a1c0f5c2f0ff79e
appleleir/simulation
/mergesort.py
520
4.125
4
#coding=utf-8 #/usr/bin/env python "mergesort" N =[1,2,3,4,2,3,4,3,5,23] def mergesort(seq): mid = len(seq) // 2 left,right = seq[:mid],seq[mid:] if len(left)>1: left= mergesort(left) if len(right)>1:right=mergesort(right) res =[] while left and right: if left[-1] >= right[-...
3d4e288bb1dd7307d80fac672abce60574c8c1fd
VenkatramanTR/PythonLearning
/learning/basic_concepts/Decorator.py
674
4.53125
5
#Decorators are used to modify code of a function without directly editing a function. Lets say you have a # remote function which you dont have access and you want to slightly modify the functionality of the # function then we use decorator functionality in those cases def div(a,b): # remote function which you dont h...
9e3eb4312b3cf5b973a798f00e465efcda67ef60
himanshux101/algorithm
/arrays/quick.py
562
3.6875
4
# a = [5,1,1,2,0,0] a = [10, 80, 30, 90, 40, 50, 70] def quickSort(arr, low, high): if low < high: p = partition(arr, low, high) # partition it print(arr) # to the left quickSort(arr, low, p) # to the right quickSort(arr, p+1, high) def partition(a, low, high): ...
bbaeb6316b79c4bd6a2123eee2f9a95fd6f2f187
tiravata/cracking-the-coding-interview-python
/4_Trees_and_Graphs/3_list_of_depths.py
1,210
3.890625
4
class Node: def __init__(self, value): self.value = value self.left = None self.right = None def __repr__(self): return str(self.value) def helper(node, lists, depth): if node is None: return if len(lists) == depth: list = [] lists.append(lis...
562a32d4cc666dfb8ae85c68d468d9a5f8e019c7
MarloDelatorre/leetcode
/0236_Lowest_Common_Ancestor_Of_A_Binary_Tree.py
928
3.53125
4
from unittest import TestCase, main from datastructures.binarytree import TreeNode, binarytree def lowestCommonAncestor(root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode: lca = None def find_lca(node: TreeNode): nonlocal lca, p, q if not node: return (False, False) ...
5cbf49eec690297377e3083a3cd0d267cd7ae521
corcra/feabhsa-here
/pipeline/remove_duplicate_isoforms.py
963
3.578125
4
#!/usr/bin/python import sys def overlap(line1,line2): start1=line1.split()[1] start2=line2.split()[1] end1=line1.split()[2] end2=line2.split()[2] chro1=line1.split()[0] chro2=line2.split()[0] strand1=line1.split()[5] strand2=line2.split()[5] if not start1 == start2: # print...
69ff48072167935438b941863e4ea0a323273aa3
pavanpandya/Python
/Python Basic/16_Password_Checker.py
237
3.875
4
username = input('Enter Your Username: ') password = input('Enter Your Password: ') password_lenth = len(password) hidden_password = '*' * password_lenth print( f'Hello, {username}, Your Password {hidden_password} is {password_lenth} letters long')
5d435cbfefb9dfe8ac03a39e22bf93cd7eec12d6
amaurirg/testes
/Hackerrank/Inheritance.py
3,611
3.765625
4
""" Objetivo Hoje, estamos investigando a herança. Tarefa Você recebe duas classes, Person e Student, em que Person é a classe base e Student é a classe derivada. Código preenchido para Pessoa e uma declaração para Estudante são fornecidas para você no editor. Observe que o aluno herda todas as propriedades da pessoa....
38645b1737afde3b1a83a04a2ca26c3ba2bb5340
CarlVs96/Curso-Python
/Curso Python/3 Bucles/Video 17 - Bucles - WHILE/Bucle_while.py
943
3.78125
4
i=1 while i<=10: print("Ejecución: " + str(i)) i=i+1 print("Terminó la Ejecución") print("---------------------") edad=int(input("Introduce edad: ")) while (100<edad or edad<0): if (edad < 0): print("Has introducido una edad negativa. Prueba de nuevo") else: print("Has introducido una edad mayor que 100. Pru...
647aecd053bf67d5d537ff836d3aadbc8e2d1568
cyan-blue/python_code
/input.py
190
4.21875
4
again = "" while again == "": name = raw_input("Hello, please enter your name?: ") if name: print "Hello %s I am soandso" % name again = raw_input("Do you want again ?")
2374f90e71d8b3fb82a6a9ac40acdb15a8d75a67
IlfatGub/Coursera-Phyton
/week3/Дробная часть.py
75
3.53125
4
# Дробная часть x = float(input()) print(round(x - int(x), 5))
350df0283736042b2fc44ee9aeb7d0dc0a8f7e99
CVHS-TYM/Marpaung_Story
/Learning/Starting Tutorials/mathfunctions.py
426
3.96875
4
#Exponent #Random Variables for usage a = 3 b = -6 c = 4 #Addition and Subtraction print("add+sub") print(a + b) print(a - b) #Multiplication and Division print("mult+div") print(a*b) print(a/b) #Exponents print("exponents") print(a**b) print(b**a) #Square Root print("Sqrts") print(a**.5) print(b**.5) #Cube Roots pri...
38ade06d51c118602bada044597807f2f4351762
alvinooo/advpython
/py3/solns/Books/deletebooks.py
1,344
4.09375
4
#!/usr/bin/env python3 # deletebooks.py - delete books from database import sqlite3 def deletebook(title): cursor = conn.execute(""" SELECT copies FROM BookCatalog WHERE title = ?""", (title,)) row = cursor.fetchone() if row == None: print(title, "not found") return ...
90999e3eab4a6a009fcca1b6194c1c9814b78859
drtoful/pyvault
/pyvault/string.py
801
3.640625
4
#-*- coding: utf-8 -*- import SecureString class PyVaultString(object): def __init__(self, string): self._s = string def clear(self): """ Clears memory held by the string object. Memory region will be filled with zeroes. If string was a static string, all further uses...
86e4403b2834146e9121ca960dc8f169288603af
stasi815/Captain-Rainbow
/checklist.py
4,244
3.53125
4
"""Checklist.""" # Created Checklist # Jessica Trinh helped me make int(index), mark_completed, # and uppercase variable checklist = list() # From https://www.geeksforgeeks.org/print-colors-python-terminal/ # Python program to print colored text and background def prRed(skk): """Red.""" return("\033[91m {}\03...
52bde5bbc3ee4c394305526d40dadc6af5e5cb86
ivan-yosifov88/python_advanced
/multidimensional_lists/symbol_in_matrix.py
679
4
4
def read_matrix(is_test= False): if is_test: return [ ["A", "B", "C"], ["D", "E", "F"], ["X", "!", "@"], ] else: row_count = int(input()) matrix = [] for r in range(row_count): row = [element for element in input()] ...
487e169a377d1e61927c1e8c2b60733fd33bb712
ioef/PPE-100
/Level1/q18.py
232
4.5
4
#!/usr/bin/env python ''' Write a program to read an ASCII string and to convert it to a unicode string encoded by utf-8. Hints: Use unicode() function to convert. ''' s = raw_input("Give text:") u = unicode(s, "utf-8") print u
ba19efd116d70e53ab79ee792f33fe6c731dd57d
lydiahecker/exercises
/chapter-2/ex-2-1.py
642
4.21875
4
# Programming Exercise 2-1 # # Program to display one person's contact information. # This program needs no input # and performs no computations. # It will display the name and contact information for a teacher. # display the full name name = "Blue Sargent" # display the address address = "300 Fox Way" ...
e69607c0379cbfc7e0cb763112574cc874eab4fe
5kip/Pynt
/file.py
588
4
4
import sort class Student: def __init__(self, name, klas, average_grade): self.name = name self.klas = klas self.average_grade = average_grade vosmoy_v = [ Student("Feodosiy", "2", 3.8), Student("Feodosia", "2", 1.2), Student("Vova", "4", 4.3) , Student("Peta", "8", 12 )...
0ae174fc718d7f2037a035caf1835cca5ee6b867
tbs1-bo/flipflapflop
/drawing.py
6,141
3.859375
4
"""Helper for drawing on pixel display. Taken from `drawing.py <https://github.com/sprintingkiwi/pycraft_mod/blob/master/mcpipy/drawing.py>`_ and adjusted to the needs of a 2d display. """ # # Code under the MIT license by Alexander Pruss # from math import sqrt, floor, ceil, pi from numbers import Number class V3(t...
c90eb53b0e4b5cbce415a8ad0bb9160b63b78cd2
TheStranger1/Introduction-to-Programming-Course-Assignments
/String Operations/question5.py
473
4.375
4
#Write a program, that queries the user for two strings, and proceeds to replace all occurrences of the #second string in the first string with their uppercase versions; this modified string is finally output. firstString = raw_input ("Give the fisrt string: ") secondString = raw_input ("Give the second string: " ) ...
2562b0150f60e1aa01e016f0f126051aad499bdc
pvbolotov/rosalind_l1
/rosalind_counting_dna_nucleotides
781
3.546875
4
#!/usr/bin/env python import sys if len(sys.argv) != 2: print "only the parameter of input file name should be passed." sys.exit(0) try: inputfile = open(sys.argv[1], 'r') except IOError as e: print "Cannot open input file. Error message : {0}".format(e.strerror) exit(0) try: line = inputfile.readline() except ...
4cf4a4f7373354976a8dcaf07ed2fe16418d93b5
kevinraj127/Bikeshare_Python_Project
/bikeshare_kraj.py
10,086
4.25
4
import time import calendar import pandas as pd import numpy as np CITY_DATA = { 'chicago': 'chicago.csv', 'new york city': 'new_york_city.csv', 'washington': 'washington.csv' } def get_filters(): cities = ['chicago', 'new york city', 'washington'] months = ['all','january', 'fe...
f03ed52993e2cd94c50e13300493c88d0fbb70e5
martincxx/PythonPlay
/PythonforAstronomers/exercise7.py
1,070
4.4375
4
""" 7. Write a program able to play the "Guess the number"-game, where the number to be guessed is randomly chosen between 1 and 20. (Source: http://inventwithpython.com) This is how it should work when run in a terminal: Output of the program (example): Hello! What is your name? Oak Well, Oak, I am thinking of a numbe...
64d3df0e9550e9f1d1c424ef215675a3251b05b1
LachezarStoev/Programming-101
/contains_digits/solution.py
417
3.828125
4
def contains_digits(number, digits): digitsOfNumber=[] while number!=0: digitsOfNumber.append(number%10) number//=10 for digit in digits: if(not digit in digitsOfNumber): return False return True def main(): print(contains_digits(402123, [0, 3, 4])) print(contains_digits(666, [6,4])) print(contains_di...
4eef2ccba9e1e244eeb0dfcd403c84be70a33534
sumukh-aradhya/DAA-lab
/Insertion_sort.py
361
3.671875
4
import time print("Enter the array") a=[int(x) for x in input().split()] n=time.clock() for i in range(1,len(a)): r=a[i] j=i-1 while j>=0 and a[j]>r: a[j+1]=a[j] j-=1 a[j+1]=r m=time.clock() print("The sorted array is:") for i in a: print(i,end=" "...
4b5b27fba1ed3afc9250ed7182585ca7315b11dc
Wefutures/PythonLearning
/Demo02-数据容器/05 集合.py
328
3.890625
4
# -*- coding: utf-8 -*- # 集合创建 set1 = {1, 2, 2, 3, 5, 6, 4, 4} print(set1) # 集合对列表进行去重 li = [1, 2, 2, 3, 5, 6, 4, 4] li = list(set(li)) print(li) """集合运算(了解)""" set2 = {2, 3, 4} set3 = {3, 4, 5} # 交 and print(set2 & set3) # 并 or print(set2 | set3) # 差 相减 print(set2 ^ set3)
88a83f9989ed14ee2210da51f1a8566f5dc0cfd0
ygzheng9/easypy
/notebooks/self/python/src/02.opOffice/raw/read.py
292
3.6875
4
from docx import Document document = Document('./demo.docx') # 将word文档的内容一行一行的读取 for paragraph in document.paragraphs: print(paragraph.text) for table in document.tables: for row in table.rows: for cell in row.cells: print(cell.text)
ba01b1dd624b6c6a624853a10c57eadd77b23085
anitasusan/Semi-automatic-robotic-car-using-EEG-signals
/GUI_SSVEP.py
3,476
3.5625
4
import tkinter as tk from tkinter import LEFT, RIGHT, TOP, BOTTOM,RAISED,CENTER class MainGUI(): def __init__(self, master): self.master = master self.backgroundColor = "pink" master.title("A simple GUI.") self.leftbutton = tk.Button(master, text="LEFT", width=10, height=1...
8c16c5c940f39fb50fd2802aa3600f29082fef80
gouh/queues-stacks
/main.py
445
3.796875
4
from structure import Queue from structure import Stack # Inverse queue if __name__ == '__main__': input_queue = Queue() input_queue.add("example") input_queue.add("with") input_queue.add("Queue") stack = Stack(maxsize = 3) while not stack.is_full(): stack.push(input_queue.remove()) ...
a5dff2555d5279d3a04a1814008b45b7c30bc67d
rahulnoronha/Cryptography-Mini-Project
/Scripts/playfair_cipher.py
9,348
3.734375
4
# -*- coding: utf-8 -*- """ Created on Sat Oct 2 @author: Rahul Noronha """ #The Playfair cipher or Playfair square or Wheatstone–Playfair cipher is a manual symmetric encryption technique and was # the first literal digram substitution cipher. The scheme was invented in 1854 by Charles Wheatstone, # but bears the...
1ae89d35fc9de47fca3d890b423029aac15fbb13
U-ting/geographic-points-clustering
/kmeans.py
3,086
3.625
4
import random from pprint import pprint from math import radians, cos, sin, asin, sqrt def haversine(lon1, lat1, lon2, lat2): """ Calculate the great circle distance between two points on the earth (specified in decimal degrees) """ # convert decimal degrees to radians lon1, lat1, lon2, lat2 ...
e7cab53529d265c5e1e1d57bec7e5583ef169074
vatsala/pythonthehardway
/ex4.py
887
3.78125
4
cars = 100 space_in_a_car = 4 drivers = 30 passengers = 90 cars_not_driven = cars - drivers cars_driven = drivers carpool_capacity = cars_driven * space_in_a_car average_passengers_per_car = passengers / cars_driven print "There are", cars, "cars available" print "There are only",drivers,"drivers available" print "The...
68c90ddb4f1e0ea7bde698bcc929a52e3243d2b8
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/222/users/4077/codes/1668_1396.py
151
3.8125
4
valor= float(input("valor: ")) valortotal1 = valor valortotal2 = valor * 6/100 if (valor <= 300): print(valortotal1) else: print(valortotal2)
9c4a604301f623c0984fba9d3bd6db52417d6825
fruitfly/Muneebs_Portfolio
/Python_projects/programs/Assignment_3_B_2.py
1,283
3.515625
4
from Tkinter import * root = Tk() screen = Canvas(root, width=1200, height=1200, background = "white" ) screen.pack() denominator = int(input("please input a number")) spacing =800 / denominator for rowNumber in range(1,denominator+1): widthofboxes= 800/float(rowNumber) heightofboxes= 800/denominator ...
bef5776b529fe11b68dcc79af97a5301290de79e
stoneyangxu/python-kata
/datastructure/recursion/binary_search.py
594
3.765625
4
import unittest def binary_search(data, target, low, high): if low > high: return -1 mid = (high + low) // 2 if data[mid] == target: return mid elif data[mid] < target: return binary_search(data, target, mid + 1, high) else: return binary_search(data, target, low, ...
6740affd88bc0c8df8b2edce849e6964bdec2101
AntonJansen96/Crash_and_Compile
/CC2021/03_a_lot_of_missing_lots.py
1,382
4.21875
4
#!/bin/python3 # There is nothing like having to wait for the other players during a game of # monopoly, to find ways of passing time. One way is to play out all possible # games of tic-tac-toe on graph paper, but after having contemplated this, we # will save you the trouble. Graph paper can be used for other thin...
108458cd97bc62c48fafa0767ad9f7c500a4b5ce
nitin03ece/P3-Work-Log
/src/write.py
738
3.734375
4
import csv import read fieldnames = ["Date", "Title", "Time Spent", "Notes"] def csvwriteReload(entry): with open("output/out.csv", 'a', encoding='utf-8') as writefile: fieldnames = ["Date", "Title", "Time Spent", "Notes"] file = csv.DictWriter(writefile, fieldnames=fieldnames) # Check ...
ec99bcc6bd9f77f22298a7619e87c624ff57abbf
VakinduPhilliam/Python_Argparse_Interfaces
/Python_Argparse_Type.py
2,382
3.953125
4
# Python argparse # argparse Parser for command-line options, arguments and sub-commands. # The argparse module makes it easy to write user-friendly command-line interfaces. # The program defines what arguments it requires, and argparse will figure out how to parse those out of sys.argv. # The argparse module also...
cb631c0caaebefdf3ea70fcbcc6f99968da792b9
fanliugen/multiprocessing
/multithreading1.py
491
3.796875
4
import threading import time def coding(): for x in range(3): print("%s正在写代码" %threading.current_thread()) time.sleep(1) def drawing(): for x in range(3): print("%s正在画图" %threading.current_thread()) time.sleep(1) def multi_thread(): t1 = threading.Thread(target=coding) ...
b0eda5716b23ae11c33390feee2171b5fe9e8bd8
usmanchaudhri/azeeri
/min_moves/min_moves_to_reach_target.py
1,586
4.28125
4
""" Find minimum moves to reach target on an infinite line Suppose we have a number position in infinite number line. (-inf to +inf). Starting from 0, we have to reach to the target by moving as described. In ith move, we can go i steps either left or right. We have to find minimum number of moves that are required. Su...
b300cab71ddf658ddfb7f461122320cb4879d64d
TheMacte/python_base
/hw_02/task_01.py
603
3.921875
4
# 1. Создать список и заполнить его элементами различных типов данных. # Реализовать скрипт проверки типа данных каждого элемента. # Использовать функцию type() для проверки типа. # Элементы списка можно не запрашивать у пользователя, а указать явно, в программе. my_list = ['oleg', 22, 3.14159, True, [1, 2, 3], ('o', ...
9989e90e6e78e5a19d2986433b885ec7bec02a00
Lupis98/PCS2-Hw4
/Utils.py
4,506
3.5
4
#This file is a little repository of fundamental functions that I used in some exercises from collections import OrderedDict def read_fasta(filen): d = OrderedDict() d2 = OrderedDict() with open(filen) as file: lst = file.readlines() i = 0 ID = '' while i < len(l...
9fb20bf5618595488793b0e45420405120ad0c04
Husseinbeygi/My-Research-on-Opencv-With-Python
/Object Detection/Corner detection - Harris corner detection.py
1,105
3.890625
4
### Imports import cv2 import matplotlib.pyplot as plt import numpy as np ### load Images img = cv2.imread('DATA/chess.jpg') # Make the picture gray scale _img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) # Make the picture float _img = np.float32(_img) # Use the Harris Corner Detection Algoritm # for More Information ...
a89e63ec7b456c9e8ff86510d348deb914e8d356
jaycoskey/IntroToPythonCourse
/PythonSrc/Unit1_HW_src/anagrams.py
525
3.65625
4
#!/usr/bin/env python3 from collections import Counter FILEPATH = 'wordlist.txt' word2counter = dict() # Create an empty dictionary for word in open(FILEPATH).readlines(): word = word.rstrip() # Remove extra space from end of string word2counter[word] = Counter(word) for w1 in word2counte...
76625caad0399fb1cd864b64be33706c2212275d
RahatIbnRafiq/leetcodeProblems
/Tree/257. Binary Tree Paths.py
742
3.84375
4
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): result = None def helper(self,root,path): if root.left is None and root.right is None: self....
ca0888753296481a6d9efdde04582bdf358edd85
mochapup/Python-Programming-2nd-edition-John-Zelle
/Ch3/3.7.10.py
495
4.4375
4
# 3.7.10.py # This program determines the length of a ladder required given the height of house and angle of ladder. import math def main(): print("This program determines the length of a ladder required given height of house and angle of ladder") height = float(input("Enter the height of the house: ")) an...
c1a32b8eff00c9b548e58c4440402b2ea216e362
zhousc88/Script
/Th_choice.py
680
3.5
4
#author: zhousc #E-mail:zhousc88@gmail.com import os import random import sys import tkinter import xlrd import xlwt #公司年会上的抽奖 def goodman(): if people_list : goodman=random.choice(people_list) people_list.remove(goodman) else: goodman="请输入人员名单" l['text']=goodman ...
eb7c333adef7e69cae7df4f893aba9e23b7477e1
Brunaldo2911/pruebas_aprendizaje_python
/ej_02_tablas_de_multiplicar.py
376
4.0625
4
# ejercicio que permite obtener las tablas de multiplicar solo por multiplos de 2 # Uso de la funcion print("Bienvenidos a la tabla de multiplicar") n_usuario = int(input("Ingresa el numero que quieras y te dare una tabla de multiplicar del 0 al 12 : ")) rango = range(0,13,2) for multiplo in rango: print("{} * {...
5fa65b5942eebacca7a0916db1c933ff0c3d0bc9
gopar/ctci
/chapter9.py
1,648
4.1875
4
def prob9_1(steps, possible_ways=0, cache={}): """ A child is running up a staircase with n steps, and can hop either 1, 2 or 3 steps at a time. Implement a method to count how many possible ways the child ca run up the stairs """ if steps < 0: return 0 if steps == 0: return ...
1813399a8de2048191b8fdc1c83b1253e2d70621
Dinesh1121/set2
/POWER OF N.py
80
3.703125
4
a=int(input()) c=a b=int(input()) for i in range(b-1): a=a*c print(a)
1936d41a1d9e2a6d3c6e2c46db2c2d569d992650
flyseddy/StockMarketChallenge
/writecsv.py
1,085
3.5
4
""" Author: Sedrick Thomas Created at: May 7th 2020 This is basically the file that writes all the information that we calculated in the other modules to a CSV file to be read and interpreted. There may be a few values that don't return a value due to the inaccessibilty of those items from scraping those websites """...
ab7c87915bcdc619a85f844fa8fb74ef8b9de425
wellisonxd/desafios-python
/desafio065.py
576
4
4
confirma = 'S' media = cont = maior = menor = soma = 0 while confirma in 'Ss': num = int(input('Informe um número: ')) soma += num cont += 1 if cont == 1: maior = menor = num else: if num > maior: maior = num elif num < menor: menor = num ...
1fab1ddf31b1949e9baaeec45dfe16bfa3db2248
ImtiazMalek/PythonCodesForURIProblems
/uri1038.py
241
3.65625
4
X,Y = input().split() Y = int(Y) result=0.00 if X=="1": result=4.00 if X=="2": result=4.50 if X=="3": result=5.00 if X=="4": result=2.00 if X=="5": result=1.50 result=result*Y print('Total: R$ %.2f' %result)
e9d97db1ab057927dde06d558fd306c1bdf658a7
andredosreis/Python-resolucao-exercicio
/Exercicios Curso em Video/Exercio for/soma_dos_pares.py
437
4.0625
4
# Desenvolva um programa que leia SEIS NUMOROS INTERIOS e mostre a soma apenas daquelas que forem # PARES. Se o valor ditado for IMPAR, desconsidere-o. soma = 0 cont = 0 # ele serve como aculmulador for i in range (1, 3): num = int(input(f'Digite um numero o {i} ')) if num % 2 == 0: soma += num # soma ...
d54cf6564cfdc853511d942ebaf15f80817a59d4
johnmee/codility
/L3_PermMissingElem.py
2,265
4.125
4
""" # PermMissingElem Find the missing element in a given permutation. An array A consisting of N different integers is given. The array contains integers in the range [1..(N + 1)], which means that exactly one element is missing. Your goal is to find that missing element. Write a function: def solution(A) th...
930390c1cbd347d13418f689128a962833b4bb8c
peterprout/CS3505_team_1
/form.py
2,215
3.859375
4
from tkinter import * class Form: def __init__(self, rules_file): self.root = Tk() self.root.title("Ludo") self.frame1 = Frame(self.root) self.label1 = Label(self.frame1, text="Player Name", fg="black") self.name = Entry(self.frame1, width=20) self.label2 = Labe...
07ccf48c21c3f4361279a7b5306628e0334b621f
wu-zero/python_learn
/daily_work/chapter15/practice11.py
686
4.28125
4
# 11. 不运行程序看代码说出代码运行结果并解释 class Parent(object): x = 1 class Child1(Parent): pass class Child2(Parent): pass print(Parent.x, Child1.x, Child2.x) # 1 1 1 # Parent 的类属性x本来就是1 # Child1 和 Child2 找类属性没找到,就去自己的父类里找,也是1 Child1.x = 2 print(Parent.x, Child1.x, Child2.x) # 1 2 1 # Parent 的类属性x本来就是1 # Child1 的类属性x改为2 #...
a035407c75ba551495732532c6f3cadf40557738
Anthima/Hack-CP-DSA
/Hackerrank/Sales by Match/solution.py
486
3.953125
4
# The function is expected to return an INTEGER. # The function accepts following parameters: # 1. INTEGER n # 2. INTEGER_ARRAY ar def sockMerchant(n, ar): # Write your code here # variable to store the pair a = 0 # Dictionary to store the count dic = {i: ar.count(i) for i in ar} for v in dic...
09011c736a72be9ca5f78ff50efc35528e19c770
courses-learning/python-crash-course
/5-4_alien_colours2.py
213
3.9375
4
# Same as 5-3 with if else chain score = 0 alien1 = "yellow" if alien1 == "green": score += 5 print('You scored 5 points') else: score += 10 print('You scored 10 points') print(f'Score: {score}')
5dddf872f9759676917ae28f5940cbc4193d26ca
Aguilera4/AA
/Practicas/P0/parte3.py
766
3.875
4
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt random_array = np.linspace(0,2*np.pi,100) #generamos el array con 100 elementos aleatorios entre 0 y 2*PI array_sin = np.sin(random_array) #generamos el seno de todos los elementos anteriores array_cos = np.cos(random_array) #generamos el cos...
6cd92f7e417f1a83d31c5f27e412db8f8ae50638
rkyadav/Python
/studentDatabase.py
2,535
4
4
# This file will contain a class, StudentDatabase. This class will contain a dictionary containing all student objects. # studentDatabase Class # Attributes: # 1. allStudents: This a is dictionary that contains key/value pairs. Each key is a student id and the corresponding # value is a student object. # M...
4e2cf71d648a1d714ba3d84d78157e5e21e45926
leejongcheal/algorithm_python
/파이썬 알고리즘 인터뷰/ch17 정렬/60.삽입 정렬 리스트.py
777
4.09375
4
class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def insertionSortList(self, head: [ListNode]) ->[ListNode]: if not head: return None # cur 정렬을 끝난 대상으로 , head를 정렬해야할 대상으로 cur = parent = ListNode() wh...
82ffd23f9798e5970c03386894136e168f20777d
KanishkaSinghh/pythons
/practice p2.py
340
3.953125
4
n=int(input("enter no of apples: ")) mn = int(input("enter the min no of range of apples: ")) mx = int(input("enter the max no of range of apples: ")) def apples(): for i in range(mn,mx+1): if n%i==0: print(f"{i} is a divisor of {n}") else: print(f"{i} is not a divisor of {n...
daad84394fffcc6adb0769cf716789cc0dd48786
uthmaanb/Python-Conditional-Statements-Task
/Driver-Demerit-System.py
321
4.09375
4
avg_speed = int(input("What was your Average speed?: ")) allowed_speed = int(input("what is the allowed speed?: ")) points = (avg_speed - allowed_speed)/5 print("\n") print("Average speed: ", avg_speed) print("Allowed speed: ", allowed_speed) print("Points: ", points) if points > 12: print("TIME TO GO TO JAIL!")...
4d0ce251971b7f2f3b0d1018d0df0094c08cd15a
imuradevelopment/pythonLearn
/example/if.py
477
4
4
a = 1 if a == 1: print("a is 1") a = 1 if a == 1: print("a is 1") else: print("a is not 1") a = 1 if a == 1: print("a is 1") elif a == 2: print("a is 2") elif a == 3: print("a is 3") else: print("a is not 1,2,3") a = 1 b = ['a', 'b', 'c'] if not (a == 1 and '...
11ee00957dc288b104f6ab2d85ad64bf56b359c5
bright1993ff66/Leetcode_Series
/DataStructures_Algos/Tree/104_Maximum_Tree_Depth.py
1,678
3.75
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 class Solution: def maxDepth(self, root: TreeNode) -> int: # DFS with recursion if not root: return 0 return 1 + max(...
9dfd896b4657e0126ff86457ba389df49aa151d8
jkeane889/ThinkLikeACS
/towershanoi.py
730
4.09375
4
# Towers of Hanoi ''' You have three disks of varying sizes (large, medium, small) - these disks are stacked on top of one another on a single tower/rod. Problem Rules: 1. Only one disk can be moved at a time 2. Each move consists of taking the upper disk from one of the stacks and placing it atop another stacks 3. No...
e88a788f03276b230e5f04504c0c542a718a2b36
maximus-sallam/Project
/dice.py
590
3.859375
4
from random import randint class Die(): def __init__(self, sides): self.sides = sides def roll_die(self): x = randint(1, self.sides) print("You rolled a " + str(self.sides) + " sided die and rolled a " + str(x)) twenty = Die(20) nineteen = Die(19) eighteen = Die(18) seve...
0f6aa0f5999d5f997b7c8f80109c7cfe2643ed27
jeannieyeliu/leetcode
/1694.py
794
3.78125
4
# [easy] https://leetcode.com/problems/reformat-phone-number/ class Solution: def reformatNumber(self, number: str) -> str: def split3(num): return '-'.join([ num[i:i+3] for i in range(0, len(num),3) ]) number = number.replace('-', '').replace(' ', '') n,m = divmod(len(number),3...
41e7042a180d018e2e0f6f447e7078a84295518b
wangqian1992511/LeetCode
/133 Clone Graph/001.py
617
3.578125
4
# Definition for a undirected graph node # class UndirectedGraphNode: # def __init__(self, x): # self.label = x # self.neighbors = [] class Solution: # @param node, a undirected graph node # @return a undirected graph node def cloneGraph(self, node): d = {} return self.d...