blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
135ac3aea0cd52d21d56a32ac540eaf38f73d110
zdimon/python-course-4
/doc/4-dj2exel-date-modularity/code/args/ex.py
665
3.796875
4
def empty_func(): pass def add(*args): # переменное число ПОЗИЗИОННЫХ агрументов print(args) resullt = 0 for v in args: resullt = resullt + v return resullt #print(add(2,2,3,4,5,6)) def multi(**kwargs): #переменное число ИМЕНОВАННЫХ агрументов res = 1 for key, value in kwargs.ite...
8c975d5c5b6d05aae226de9a604cb9c2d50593bb
ancuongnguyen07/TUNI_Prog1
/Week9/tvsarjat.py
2,177
4.40625
4
""" COMP.CS.100 Programming 1 Read genres and tv-series from a file into a dict. Print a list of the genres in alphabetical order and list tv-series by given genre on user's command. """ def read_file(filename): """ Reads and saves the series and their genres from the file. TODO: comment the parameter and...
8c45ba9b993591802807fa5c6a5a5e0598b89cfa
dan8919/python
/sort/simpleSearch/simpleSerch1.py
434
3.875
4
#단순탐색 #장점: 쉽다,정렬이 안되어도 된다 #단점:느리다. ->대안:2진탐색(Binary Search) arr =[1,2,3,4,5,6,7,8,11] #8은 몇번째에 있을까요? #입력받은 숫자가 몇번째 인덱스에 있는지 def search(arr,x): for index in range(0,len(arr)): if arr[index] == x: # print(arr[index]) return index return -1 print(search(arr,8)) print(search(a...
8b00423313cba874176ed1d13aada78a75abfc15
DangerousCode/DAM2Ev-Definitivo
/Python/Segunda Ev/Ficheros/Ejemplo seek.py
682
3.5625
4
__author__ = 'AlumnoT' '''Vamos a crear un objeto file llamado archivo que abre el a.txt en modo lectura, vamos a leer de golpe toda la info y la vamos a mostrar por pantalla''' archivo=open("C:/Users/AlumnoT/Desktop/a.txt","r") contenido=archivo.read() print contenido archivo.seek(6) contenido=archivo.read() print "...
529fcb4a149a6062c37a0401332978c156b7e3e4
pengzihe/python
/atm/login_v2.py
6,273
3.640625
4
#!/usr/bin/python import pickle,commands,tab ###bank_card = {'119':{'password':'119','limit':10000,'borrow':0,'cash':0},'400123456':{'password':'123456','limit':35000,'borrow':0,'cash':0},'120':{'password':'120','limit':8000,'borrow':0,'cash':0},'110':{'password':'110','limit':7000,'borrow':0,'cash':0}} def auth(numb...
5cb9bd53e71607e8529de943d11a7097d8db874a
LenKIM/implements
/archive-len/leetcode/ch06-string/p5-group-anagrams.py
1,138
3.71875
4
import collections from typing import List """ https://leetcode.com/problems/group-anagrams/ Input: strs = ["eat","tea","tan","ate","nat","bat"] Output: [["bat"],["nat","tan"],["ate","eat","tea"]] Input: strs = [""] Output: [[""]] Input: strs = ["a"] Output: [["a"]] """ input = ["eat", "tea", "tan", "ate", "nat", "...
75a1ec4e28674f747f31214c00dd4e0239e577f7
Aasthaengg/IBMdataset
/Python_codes/p02406/s613014578.py
162
3.640625
4
import re list = [] n = int(input()) for i in range(1, n + 1): if i % 3 == 0 or re.search('3', str(i)): list.append(str(i)) print('', ' '.join(list))
6f6eec8387085897f938178207b8924e7e79ab66
nju04zq/algorithm_code
/ccr/4_6_Binary_tree_common_ancestor/common_ancestor.py
3,992
3.734375
4
import collections class TreeNode(object): def __init__(self, x): self.val = x self.parent = None self.left = None self.right = None def create_node(s): if s == "#": return None node = TreeNode(int(s)) return node def dump_node(node): if node is None: ...
4f350205197231a555f69904056b65ee19036ccd
xamuel98/The-internship
/nSum_TI.py
199
4.09375
4
''' Program that prints 1 to n ''' # Prompt the user to enter a number n n = int(input("Enter a number n: ")) sum = (n * (n + 1)) / 2 print("The sum of numbers from 1 to ", n ,"is :", sum)
52ae403e84c19a7d3f1a5492ee8e9fe13a259fbf
remo-help/Restoring_the_Sister
/reduce.py
4,531
3.796875
4
# -*- encoding: utf-8 -*- def read_in(textfilename): #this gives us a master read-in function, this reads in the file file = 'data\\' + str(textfilename) + '.txt'# and then splits the file on newline, and then puts that into a list f = open(file, 'r',encoding='utf-8')# the list is returned string = f.read() listv...
f851c256b83123cc4f06732ec0c23daadf7ba960
betomansur123/EP2-Lior_Lerner_e_Alberto_Mansur
/Jogo_EP2.py
3,533
3.6875
4
print("Paciência Acordeão ") print("================== ") print("") print("Seja bem-vindo(a) ao jogo de Paciência Acordeão feito por Alberto Mansur e Lior Lerner. ") print("") print("O seu objetivo é empilhar todas as cartas até restar apenas uma ") print("") print("Os movimentos possíveis são: ") print("") print("1. E...
67236a5b6bb55e1c19d147982464bceb872906fc
lemiffe/nalu-net
/server/ascii.py
1,834
4.03125
4
# From https://www.hackerearth.com/practice/notes/beautiful-python-a-simple-ascii-art-generator-from-images/ from PIL import Image import os ASCII_CHARS = [ '#', '?', '%', '.', 'S', '+', '.', '*', ':', ',', '@'] def scale_image(image, new_width=100): """Resizes an image preserving the aspect ratio. """ (...
98a275215c0b94d630786b833141c443ecf86170
NathanKr/matplotlib-playground
/2d.py
198
3.640625
4
import matplotlib.pyplot as plt import numpy as np xpoints = np.arange(10) ypoints = xpoints ** 2 plt.plot(xpoints, ypoints,'o') plt.title('plt x vs y') plt.xlabel("x") plt.ylabel("y") plt.show()
2f38f1401e2bf55a9be2a545635849b4ed5648ac
AdamZhouSE/pythonHomework
/Code/CodeRecords/2412/60606/306778.py
170
3.921875
4
s1 = input() s2 = input() if s1=="2 0" and s2=="2 2": print(0) elif s1=="4 3" and s2=="2 1 4 3": print(-1) else: print(1) print(5) print("1 4 2 3 5 ")
273fd3c2ab00d368067a8c84ca337ed2201899f8
tianzhujiledadi/python
/排序算法比较/堆排序.py
1,263
3.984375
4
def MAX_Heapify(heap,HeapSize,root):#在堆中做结构调整使得父节点的值大于子节点 left = 2*root+1 right = left + 1 larger = root if left < HeapSize and heap[larger] < heap[left]: larger = left if right < HeapSize and heap[larger] < heap[right]: larger = right if larger != root:#如果做了堆调整则larger的值等于左节点或者右...
2d8abfd1ae2c7fd484c722612d367fab96077b33
Dagurf21/Forritun.1hluti
/Tímaverkefni2.py
1,039
3.578125
4
# Liður 1 cm = int(input("Sláðu inn lengd í sentimetrum: ")) print (cm//100,"metrar") cm = cm%100 print (cm//10,"desimetrar") cm = cm%10 print (cm,"sentimetrar") svar = input("Villtu keyra forrit aftur? Sláðu inn j ef já: ") while svar == "j": cm = int(input("Sláðu inn lengd í sentimetrum: ")) ...
2896c6946e38f71772f1252d9e23b8402702326f
CatonChen/algorithm023
/Week_10 毕业总结/[105]从前序与中序遍历序列构造二叉树.py
1,326
3.84375
4
# 根据一棵树的前序遍历与中序遍历构造二叉树。 # # 注意: # 你可以假设树中没有重复的元素。 # # 例如,给出 # # 前序遍历 preorder = [3,9,20,15,7] # 中序遍历 inorder = [9,3,15,20,7] # # 返回如下的二叉树: # # 3 # / \ # 9 20 # / \ # 15 7 # Related Topics 树 深度优先搜索 数组 # 👍 927 👎 0 # leetcode submit region begin(Prohibit modification and deletio...
3e4f649284d7366fed49ac5875fa62d5589394ef
lehmanwics/programming-interview-questions
/src/general/Python/1_most_frequent_Integer.py
912
4.46875
4
""" 1-Find the most frequent integer in an array """ def most_frequent_integer(array): #a dictionary to map out the unique values and its frequencies frequencies = dict() for i in array: if i not in frequencies: frequencies[i] = 1 else: frequencies[i] +=...
3bf9ee20bb92764d7eaacac6e91ee05da7069a9a
shaniavina/Leetcode_Python
/145_binary_tree_postorder_traversal.py
1,101
3.71875
4
# ####iteratively, use stacks class Solution(object): def postorderTraversal(self, root): """ :type root: TreeNode :rtype: List[int] """ res, stk, cur = [], [], root while stk or cur: if cur: stk.append((cur, False)) ####have to visit twi...
10000fa97bc0fff0eb888893b7db646798b5d6d7
AvikYadav/pythonRemoteCommand
/multiClient/server.py
3,120
3.59375
4
import socket import threading import sys import time from queue import Queue TOTAL_Threads = 2 NUMBER_OF_THREADS =[1,2] all_connections = [] all_addresses = [] queue = Queue() def create_socket(): try: global server global host global port host='' port=8888 server = ...
56b44629d36fefcec6c08299c47de12f07b4259e
ShaunaVayne/python_version01
/com/wk/test2/test/test4.py
111
4.125
4
dict1 = {"a" : 1, "b" : 2} print(dict1) # print(dict1.get("a")) for x in dict1.keys(): print(dict1.get(x))
7bcd47fed3ecf18a9465a3e8f89d6a2db1f83b35
fatpat314/SPD1.4
/HW6.py
2,032
4.1875
4
# Question 1 """Your task is to convert a number into a string that contains raindrop sounds corresponding to certain potential factors. A factor is a number that evenly divides into another number, leaving no remainder. The simplest way to test if a one number i s a factor of another is to use the modulo operation."""...
bcf1b355975a4c8669b0e9a786ba0d6e2390353a
daviddwlee84/LeetCode
/Python3/Array/WordSearchII/Naive212.py
1,952
3.546875
4
from typing import List from collections import defaultdict direction = [ (1, 0), # down (-1, 0), # up (0, 1), # right (0, -1) # left ] class Solution: def findWords(self, board: List[List[str]], words: List[str]) -> List[str]: """ backtracking and early stop with tire ...
14cde8a6172fb8a194c3766ff648951a80ce4c2c
Mangel880/Miguel-Angel-Rojas-Ramos-
/while.py
200
4.03125
4
#Miguel Angel Rojas Ramos #Calcular la factorial de un numero utilizando la estructura while a=int(input("ingrese el numero factorial\n")) b=1 c=1 while(a>0): c=c*b b=b+1 a=a-1 print ("El factorial es: ",c)
89efb9cc70e313be932a0adcfee91af9a65b0ff5
antares681/Python
/PythonOOP/L.02_Classes_and_Instances/Lab.04.Glass.py
1,522
4
4
class Glass: capacity = 250 def __init__(self): self.content = 0 def fill(self, ml): if self.capacity >= self.content + ml: self.content += ml return f"Glass filled with {ml} ml" return f'Cannot add {ml} ml' def empty(self): self.content = 0 ...
7f36f50c46fa33c39c93f5774ab541183d366d54
akshhat2/LMS
/Student.py
1,259
3.8125
4
# Stud_List =[] class Student: def __init__(self,name,year,branch,adm,i_d): # self.name=input('Enter Name\t\t: ').upper() # while True: # self.year=int(input("Enter Admission Year\t: ")) # if self.year<2020 and self.year>2000: # break # else: # ...
9d00b9cb1386f6acf51c792df950cbe542c7ae62
ivaylopetrov07/test
/test.py
99
3.71875
4
print("Are you hungry ?") if hungry=="yes": print ("eat pizza") else: print ("go to work")
0d7b2efba5ad0790e9252cbb2aca7b9c30a1d1b1
StephenWasntAvailable/CompSim18_19
/CS1HW2.py
5,590
3.84375
4
# -*- coding: utf-8 -*- """ @author: Stephen """ import matplotlib.pyplot as plt import math import numpy as np #Function to calculate the value x*exp(x) def xexpx(x): return (x * math.exp(x)) #Analytic value of the second derivative of x*exp(x) def ord2diffexact(x): return 2 * math.exp(x) + xexpx(x) #Func...
e093f669a453e7e1051814ae05f2fd520b5df5d3
Gustaft86/trybe-exercises
/modulo4_ciencia/bloco_35/dia_1/exercicio7.py
910
3.65625
4
# Exercício 7 : Agora iremos explorar o outro protocolo de transporte que # aprendemos. Crie um servidor UDP usando o mesmo módulo socketserver . Nosso # servidor UDP deverá: # 1. Imprimir no console toda mensagem recebida (não esqueça de converter # também para string). # 2 .Responder com os dados recebidos (como u...
3cfa2d1b4b873a1dcddfe0b6637f4ff854be60cc
celinesoeiro/URI
/1002.py
176
3.640625
4
# -*- coding: utf-8 -*- """ Created on Mon Sep 16 14:55:19 2019 @author: celin """ pi = 3.14159; R = float(input()); A = round(pi*R*R,4); print('A=%.4f'%A) print()
ddf50f9cfc2f6211f6702d4d7e936def4bd05397
garbagetimeisfine/RosalinFranklin
/Rosalind Bioinfomatics/shortestSuperString.py
1,197
3.890625
4
""" NOT CURRENTLY WORKING a program to assemble a genome, more or less a set of up to 50 strings are given, we know they are all from the same DNA strand. That they match another string by at least half their length. plan. read all strings into python. split all strings into tuples. one half in each tuple. .....
27a9bbbc57bac26c302af2700b619919e69ed191
mwumichael/code1161
/week2/exercise0.py
1,908
3.765625
4
# -*- coding: UTF-8 -*- """Modify each function until the tests pass.""" def add_5(a_number): x1 = (a_number+5) return float(x1) def adder(a_number, another_number): x2 = (a_number + another_number) return float(x2) def shout(a_string): loud = (a_string.upper()) return str(loud) ...
f04dc0c12e77ba9e99e6e654f8d85c792616c3f6
florencevandendorpe/Informatica5
/07 - While-lus/Kassa.py
168
3.640625
4
#invoer prijs = 1 som = 0 #bereking while prijs > 0: prijs = float(input('geef prijs: ')) som += prijs print('De totale prijs is €', '{:.2f}'.format(som ))
db34081655237708a347a56c6bf73a40ec4301f6
GuilhermePeyflo/loja-python
/Sistema/Menu.py
20,909
3.578125
4
from datetime import datetime from Categoria import Categoria from Cliente import Cliente from Produto import Produto from Cartao import Cartao from Venda import Venda class Menu: """ Classe para representar a função do menu de interação com o usuário do sistema de Loja. """ def __init__(self): ...
b30611280c63e866582857be875f9c532fe17457
joohy97/Jump-to-Python
/2장/Practice.py
734
3.546875
4
#1 print((80 + 75 + 55) / 3) #2 print("2로 나누어서 나머지가 0이면 짝수이고, 아니면 홀수이다!") print("즉, 13 % 2 의 값이 0이면 짝수이고, 아니면 홀수이다!") #3 a = "881120-1068234" print("홍길동 씨의 생년월일 : " + a[:6]) print("홍길동 씨의 그 뒤의 숫자 : " + a[7:]) #4 pin = "881120-1068234" print(pin[7]) #5 a = "a:b:c:d" print(a.replace(":", "#")) #6 listA = [1, 3, 5, 4...
ef2d01b07494362dd889658cf66c5ceec7153ff8
swathiprabhu3/PythonAutomationProject
/Project/excel_sqlite.py
5,253
3.71875
4
import openpyxl as op from openpyxl.styles import Font, Fill import sqlite3 ConStr="EmpExcelData.db" print('OPENING WORKBOOK Employee_Data......') try: #Exception Handling wb = op.load_workbook('Employee_Data.xlsx') # Open workbook Employee Data try: sheet = wb.get_sheet_by_name('Emplo...
4ad60113e70d9a2077b959eef08685aa7759223c
sivasamba/sivapython
/Tasks/Loops/task28.py
297
3.921875
4
numbers=[1,2,3,4,5,6,7,8,9,10] count1=0 count2=0 for x in numbers: if x==1: print("1 is not a prime number") elif (x%2) == 0: count1 += 1 else: count2 += 1 print("\n ") print("no of non prime numbers is=",count1) print("no of prime niumbers is=",count2)
0ab462558210e42cb0a8fa3e6b6c894c5f36ee6d
maclay13531/20170919-blackjack
/blackjack.py
10,143
3.984375
4
import random import os print "\n" print "---- Welcome! Let's play! ----" print "\n" print "What is your name?" player_name = str(raw_input("Insert your name.")) print "\n" print "%s, how many deck(s) do you want to play with?" % player_name deck_num = int(raw_input("A deck has 52 cards and you can choose a dec...
149dedafa32eac24e46908f55a0c8782ceba7b3f
aravindkoneru/Blackjack
/main.py
2,193
3.75
4
import dealer import deck import bank import playerCommands playingDeck = [] dealerHand = [] playerHand = [] totalAmount = 0 bet = 0 numDecks = 0 print "Welcome to blackjack. The ratio is 3:2" #Allows the user to choose the number of decks that they will play with while(numDecks == 0): print "How many decks woul...
050e7535e29d907efa8655cbb9a31b438f65df44
Eleveil/leetcode
/Python/number-of-1-bits.py
1,683
3.984375
4
''' Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight). Example 1: Input: 11 Output: 3 Explanation: Integer 11 has binary representation 00000000000000000000000000001011 Example 2: Input: 128 Output: 1 Explanation: Integer 128 has binary repre...
506bde285d6a6f26c80b53bdc109060c9c2f7c17
Princecodes4115/myalgorithms
/interview/recordingdata.py
2,400
3.65625
4
class Data: def __init__(self, val, preI, sufI): self.val = val self.preIndex = preI self.nextIndex = sufI def findWordInRecording(rData, word, context): #Get the word from the recording data list currentWordIndex = findWordIndex(rData, word) #Return empty string if word is not found if currentWo...
8bdc8da847c65404075f511a284275a850fa5b24
life-sync/Python
/ion05/calc.py
652
3.828125
4
import math a = float(input("Enter the first number")) b = float(input("Enter the second number (Only for basic 4)")) op = input("Enter the operation : ") def sum1(num1, num2): print(num1 + num2) def sub(num1, num2): print(num1 - num2) def mul(num1, num2): print(num1 * num2) def div(num1, num2): ...
c985137f25047a7c5acd77146e3e35b047b829cd
pohanwu/python
/daily python/DayFive/in.py
324
3.625
4
p=(4,"frog",9,-33,9,2) print(2 in p) print("dog" not in p) phrase="Wild Swans by Jung Chang" print("J" in phrase) print("han" in phrase) five=5 two=2 zero=0 print(five and two) print(two and five) print(five and zero) nought=0 print(five or two) print(two or five) print(zero or five) print(zero or nough...
55c441a2ecdd8bb992739a497a8c008d9ddfe34b
functorial/Cards
/Cards.py
7,030
3.546875
4
from random import shuffle class Card: ranks = [['A', 'ACE'], [2, 'TWO'], [3, 'THREE'], [4, 'FOUR'], [5, 'FIVE'], [6, 'SIX'], [7, 'SEVEN'], [8, 'EIGHT'], [9, 'NINE'], [10, 'TEN'], ['J', 'JACK'], ['Q', 'QUEEN'], ['K', 'KING']] # The weird spacing in `suits` is for art purposes. ...
a42f7e27eb1d82e7e5fa2671060489ae068bae43
c18gour/K_book
/chapter9/3-cv.py
996
3.734375
4
import threading import time from collections import deque lock = threading.Lock() cond = threading.Condition(lock) queue = deque(["1", "2", "3"]) def producer(): while True: cond.acquire() # produce here s = "something" queue.append(s) print "produced %s" % s cond.notify() # or notifyAll...
24d76ed10dd8aa59262188f8012ce2f917640d50
SensehacK/playgrounds
/python/PF/ABCBank_CreditCard_System_To_Trainee/iCard/Validation.py
582
3.796875
4
'''This function checks the availability of reward scheme of specified card_type, if available return True otherwise False. Input: Card type as string and as a dictionary which contains card type(string) as key, minimum transaction amount(string) and reward points(string) as values in form of a list ...
d665f1fbb3d3de083988ddd3deb2b1874d90d6d1
KartikKannapur/Algorithms
/00_Code/01_LeetCode/409_LongestPalindrome.py
1,164
4.09375
4
""" Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This is case sensitive, for example "Aa" is not considered a palindrome here. Note: Assume the length of given string will not exceed 1,010. Example: Input: "abccccdd...
a1861c4976902338435cfda628e055eb56df14c9
a97160/ATP2122--a97160
/Jogo dos 21 fósforos.py
1,116
3.984375
4
def joga_primeiro(): r = input('Quem joga primeiro, jogador ou CPU?') if r == 'CPU': CPU() else: Jogador() def Jogador(): total = 21 while total > 1: s = input('Escolha quantos fósforos quer tirar:') p = 5 - int(s) print('CPU tira', p) total = total -...
2afb34a8eaf4271a7479cd31cc0bababef55850d
bgoonz/UsefulResourceRepo2.0
/_Job-Search/InterviewPractice-master/InterviewPractice-master/Python/findNthElement.py
248
3.84375
4
def findNthElement(list, n): answer = list[n::] return answer def main(): MyList = [2, 1, 3, 5, 3, 2, 5, 6, 3, 2, 7, 5, 5, 5, 5, 5, 7, 8, 4] n = int(input("Enter a value for n: ")) print(findNthElement(MyList, n)) main()
cdb43a2898e6309a2e65030a2f40cb32c139d974
eGali/credit_card_validator
/Validation.py
1,784
3.828125
4
import sys def validate(numbers, com): big = [] length = len(numbers) total = 0 y = 2 total = 0 for t in range(0, length): if numbers[length - y] < 5: total += (numbers[length - y] * 2) elif numbers[length - y] >= 5: num = numbers[length - y] * 2 ...
2a380c24af60a8cdd2ae0f02085052f5b5d06951
arsa-dg/bingocihuy
/command-line ver/bingocihuy.py
10,272
3.78125
4
import random import os import time #todo #level bot hard #multiplayer #check turn perlu dipisah ta gak ? def Bingo_Create_Table(): Table = [[0 for Column in range(5)] for Row in range(5)] numList = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25] for Row in range (5): ...
5e3d7443f9507fff5560c0f01ba7348adfa2fecd
dylanlee101/leetcode
/code_week28_112_118/sort_integers_by_the_number_of_1_bits.py
1,312
3.875
4
''' 给你一个整数数组 arr 。请你将数组中的元素按照其二进制表示中数字 1 的数目升序排序。 如果存在多个数字二进制中 1 的数目相同,则必须将它们按照数值大小升序排列。 请你返回排序后的数组。   示例 1: 输入:arr = [0,1,2,3,4,5,6,7,8] 输出:[0,1,2,4,8,3,5,6,7] 解释:[0] 是唯一一个有 0 个 1 的数。 [1,2,4,8] 都有 1 个 1 。 [3,5,6] 有 2 个 1 。 [7] 有 3 个 1 。 按照 1 的个数排序得到的结果数组为 [0,1,2,4,8,3,5,6,7] 示例 2: 输入:arr = [1024,512,256,128,64,...
eced973e3a44f3c4ecd34d5a10e01c5e52a40aa8
shagun73/HackerrankSol
/sum of diagonal element of an array.py
201
3.765625
4
##calculate the sum of diagonal elementsof an aray/matrix def diagsum(arr): summ = 0 return sum([summ + arr[i][i] for i in range(len(arr))]) arr = [[2,5,1],[2,3,6],[8,5,4]] diagsum(arr)
8bc74dc4a376bb61c5ecaa9d433d2cc34609d599
ashutosh-narkar/LeetCode
/unique_word_abbreviation.py
2,427
4.21875
4
#!/usr/bin/env python """ An abbreviation of a word follows the form <first letter><number><last letter>. Below are some examples of word abbreviations: a) it --> it (no abbreviation) 1 b) d|o|g --> d1g 1 1 1 1---5----0----5--8 c) i|nternationaliz...
f578a809762a10dd8433118a77cd0392f22955d7
EricMGS/speed-kombat
/speed-kombat.py
4,063
3.609375
4
#Speed Kombat.py #This is a game #Author: EricMGS #Date: april 2018 #Imports from tkinter import * from tkinter import messagebox import time import sys from random import * #Variables p1_x = 683 p1_y = 384 p1_function = 0 speed = 1 square_x = 0 square_y = 0 q_times = 20 #Functions def square...
7fb870ca8766e5d4529fd93511222f2e3bc7e3e5
omides248/python_and_django_rest_api_and_reactjs_class_2020
/shop_django_restful_api_project/tutorials/dict_pop.py
275
3.5625
4
my_dict = { "phone_number": "09331114355", "first_name": "omid 1", "last_name": "omid 2", "password": "1234", "confirm_password": "1234" } print(my_dict) confirm_password = my_dict.pop("confirm_password") print(confirm_password) print(my_dict)
ed26052ed40fec46be8aaaab16f13b62ca73545b
TerenYeung/Road-To-BE
/PYTHON/lpthw/ex3.py
1,384
4.59375
5
print("I will now count my chicken:") print("Hens", 25 + 30 / 6) # 30.0py print("Roosters", 100 - 25 * 3 % 4) # 97 print("Now I will count the eggs:") print(3 + 2 + 1 - 5 + 4 % 2 -1 / 4 + 6) # 6.75 print("What is 3 + 2?", 3 + 2) print("What is 5 - 7?", 5 - 7) print("Oh, that's why it's False.") print("How about s...
49baffb7cc9ae3b6725f30a46e756397d253ef82
grigorevmp/Different-projects
/Numbers/Complex/Python/complex.py
2,462
4.34375
4
# Показать: # - Сумму # - Умножение # - Сопряжение # - Отрицание # - Разность # - Деление # (могут быть сделаны путем использования нескольких уже написанных функций) import math class Complex: # i = math.sqrt(-1) def __int__(self, _z): """ :param _z: - other complex value :return:...
71c97d21fba26256ec25711cffec6bb14ef1806c
meltopian/learningtocode
/earlysessions/session1-homeworkattempt1.py
689
3.703125
4
print ('Welcome to Mainframe.') def credentialcheck(username, password): username = user password = testpass input1 = input('Please enter your username: ') if input1 == 'user': Please enter your password credentialcheck input1 = input('username: ') input2 = input('password: ') if username = ...
42d3c6e8fe2484fe8c51759e88587a0b26eaac15
Rubenhilton312/Quiz-de-programaci-n-2
/assignments/02Ejercicio/tests/input_data.py
808
3.578125
4
# List of tuples # Each tuple contains a test: # - the first element are the inputs, # - the second are the output, # - and the third is the message in case the test fails # To test another case, add another tuple input_values = [ # Test case 1 ( ["640","751","954"], ["","","","...
8e4ccd9beaa8443d72c38d586b958042ba6b0da9
jcole35/SoftwareCarpentryWC3
/mundaneMath.py
1,112
4.40625
4
#This is the second part of Weekly Challenge 3 #This script is meant to add up all the even numbers between a lower #and upper bound (and this assumes that the lower and upper bounds #are not included in the summation as it only adds numbers "between" them) def Even_Number_Summation(lowerbound, upperbound): #...
22fb05fd6e15bb1c79422464f59492049002aaa1
cavmp/200DaysofCode
/Day36-RandomNumberGenerator.py
1,864
3.953125
4
import random from tkinter import * class RandomNumbers(object): def __init__(self): self.root = Tk() self.root.title('Random Numbers') self.root.geometry('825x550') self.mop_label = Label(self.root, font=('times new roman', 30), text='Random Numbers\n') self.mop_label.pac...
e8fd292b3a4bf54aa52a5b2133d1e152b5c0d9f8
MrWC/nseDL_GPU
/util.py
10,045
3.921875
4
""" Helper functions and data types. """ from itertools import tee, izip import math import pandas as pd from operator import eq import numpy as np from sklearn.cluster import DBSCAN # mean earth radius in kilometers # https://en.wikipedia.org/wiki/Earth_radius earth_radius = 6371.0 def great_circle_dist(a, b, unit=...
351bfd670d34cfddeea97cd8570c241ba862c060
jescobar806/minTic
/fundamentosProgramacion/clase3/ejerciciosPracticaCiclos/16loopWhileAsk.py
311
3.859375
4
while True: number1 = float(input("Favor ingrese el primer número: ")) number2 = float(input("Favor ingrese el primer número: ")) print (number1 + number2) continuar = input("Si desea continuar ingresando números ingrese c, si desea salir ingrese e: ") if continuar == "e": break
490a666203e6ac76a82bf84320a8d60ef08edeaa
atulrunwal/pizza
/exercise4.py
587
4.09375
4
# start stop car program while True: user_input = input('>').lower() if user_input == 'help': print(''' start car--->to start the car stop car---->to stop the car quit---->to exit''') elif user_input == 'start car': print('car started---->ready to go') elif user_input ...
a9b1bfe763bde82bf52932c9506300582019d49c
arensdj/data-structures-and-algorithms
/code-challenges-401/hashtable/hashtable.py
2,461
3.703125
4
class Hashtable: def __init__(self): self.array = [None] * 1024 def hash(self, key): # get the ascii code of each character in key and sum them sum = self.ascii(key) multiple_of_prime = sum * 599 safe_index = multiple_of_prime // 1024 # print(self.array) ...
f31dc5112fe15ea6e7bc16d15e3f00785183f4ff
Mehulagrawal710/learnings
/python/pythonbasics.py
17,000
4.40625
4
#variables """Unlike other programming languages, Python has no command for declaring a variable. A variable is created the moment you first assign a value to it. variable names are case sensetive. Variables do not need to be declared with any particular type and can even change type after they have been set.""" x ...
91aad4728cc81a46591e6c3e8585cc5988ce0d85
modmeister/codesignal
/isMAC48Address.py3
355
3.984375
4
def isMAC48Address(inputString): codes = inputString.split('-') if len(codes) != 6: return False for code in codes: if not isHexDigit(code): return False return True def isHexDigit(code): if len(code) != 2: return False hexvalues = "0123456789ABCDEFabcdef" return code[0] in ...
d14ad75de412e1f8179c109b84dc615f04fed0b0
astraltear/PythonProject
/battleship_demo.py
1,245
3.96875
4
from random import randint board=[] for i in range(5): board.append(["0"] * 5) def print_board(board): for i in board: print " ".join(i) def random_row(board): return randint(0,len(board)-1) def random_col(board): return randint(0,len(board[0])-1) print_board(board) s...
7746759f9000958adff664bc2215d1c9dca05e41
KenyuKurimoto/AI_Lecture
/floyd.py
7,355
3.796875
4
# -*- coding: utf-8 -*- #Python3 import random import math #ランダムなリストを作る def create_random_list(n): number_list = [] for i in range(n): number_list.append(random.randrange(1,11)) print(number_list) return number_list #フロイドのリストを作る def create_root_num_list(n): number_list = [] for i in rang...
8ec959e7cf5cdf72dddff02aaa47e870b56d8d39
kaifahmad/myPythonFiles
/LearnTuples.py
212
3.671875
4
# Few differences from a List #Lets create a Tuple #Tuples cannot be changed or modified cordinate=(4, 5) print(cordinate[1]) # cordinate[1]=10 # TypeError: 'tuple' object does not support item assignment
044376450a7c6720461d41126b6ef21e3371672c
cplyon/leetcode
/dynamic_programming/perfect_squares.py
1,616
3.59375
4
#! /usr/bin/env python3 class Solution: def numSquares(self, n: int) -> int: # Dynamic Programming approach # O(n*m) where m is the number of squares less than n MAX = 10000 if n < 1 or n > MAX: return 0 # store all perfect squares until min(n^2, MAX) sq...
4cbe25745bcfacbc26169a78cbb0dc143d40bfcc
rodrigosilvanew/pythonexercicios-guanabara
/ex073_tuplas_times_de_futebol.py
868
4.03125
4
times = ('Internacional', 'Flamengo', 'Atlético-MG', 'São Paulo', 'Santos', 'Fluminense', 'Fortaleza', 'Palmeiras', 'Atlético-GO', 'Corinthians', 'Grêmio', 'Sport Recife', 'Bahia', 'Ceará-SC', 'Botafogo', 'Vasco da Gama', 'Athletico-PR', 'Coritiba', 'Bragantino-SP', 'Goiás') print('*'*33) print(f'Os c...
d1dd1b5131cfe7adea89508f0d4bbb0cfd7eb622
skatenerd/Python-Euler
/problem49/problem49Refactor.py
5,029
3.65625
4
import sys sys.path.append("..") import prime as p class primeChecker: def __init__(self,val): self.max=2 self.primeSet=set([2]) self.updtCurPrimes(val) #initialize primeSet variable. #this will be the information the checker uses to check primality def updtCurPrimes(self,maxV...
b81e7ca06ce6f21d7d06e0118ce49622a0ef9200
Areum0921/Abox
/Programmers/number game.py
488
3.59375
4
# 이게 3레벨은 아닌듯 def solution(A, B): answer = 0 A.sort() B.sort() print(A,B) j=-1 for i in range(len(A)-1,-1,-1): # 큰 숫자부터 비교 if A[i]<B[j]: # 현재 A의 제일큰 숫자보다 B의 제일큰 숫자가 더 클때 이길 수 있음. answer+=1 j-=1 # 현재 A[i]보다 큰 숫자가 B에 없을땐 이길수 없는 숫자. print(answer) ret...
4b1c32f467aa1874cfbd4ace474c3cacb8dc8f31
luke-wriglesworth/code_wars_problems
/remove_smallest.py
381
3.765625
4
def remove_smallest(numbers): if not numbers: return [] else: removeList=numbers.copy() smallestNumber=numbers[0] removeIndex=0 for i in range(len(numbers)): if numbers[i]<smallestNumber: removeIndex=i smallestNumber=numbers[i] ...
3db7a86bd8d112a387fad9151b6e7c2b752ce30c
collinstechwrite/MULTI-PARADIGM-PROGRAMMING
/python/menu.py
3,245
4.09375
4
def display_menu(): #this funtion is used to display the menu print("Iris Data Set") print("--------") print("MENU") print("====") print("1 – Introduction To Iris Data Set") print("2 - View Image Of Iris Varieties") print("-----------------------------------") print("3 – View Averag...
252168f43af9472cae0aa5fa4d41cfec8f701d90
adamjford/CMPUT296
/2013-03-01/dijkstra-pseudo-code.py
1,628
4.09375
4
""" Pseudo code (ok, Python code) for Dijkstra's algorithm """ import pqueue def least_cost_path(G, start, dest, cost): """ path = least_cost_path(G, start, dest, cost) least_cost_path returns a least cost path in the digraph G from vertex start to vertex dest, where costs are defined by the cost fun...
cdc91e224ae1773023aa295ead50ee27581d69c6
OzYossarian/CellCyclePhases
/utils/paths.py
562
4.09375
4
def slugify(text, keep_characters=None): """Turn any text into a string that can be used in a filename Parameters __________ text - the string to slugify keep_characters - characters in this iterable will be kept in the final string. Defaults to ['_']. Any other non-alphanumeric characters ...
b134111c7fbcd2793073256d0c93eaa30e6b11ed
aallenchen2018/2019.02
/练习/2.21上课函数2.py
850
3.671875
4
# def report(): # x=int(input('enter x')) # y=int(input('enter y')) # re1=int((x+1)/y) # re2=int(x+y) # return re1,re2 # while True: # result=report() # print(result) # def ret(a,b): # a*=10 # b*=10 # return a,b # num=ret(5,7) # print(num) # print(type(num)) # num1,num2=ret(30...
1a7b307198b1bda7dbf6d4f6a5d006f2d1fcc643
caijinhai/leetcode
/array/153.寻找旋转排序数组中的最小值/153.寻找旋转排序数组中的最小值.py
520
3.6875
4
# # @lc app=leetcode.cn id=153 lang=python # # [153] 寻找旋转排序数组中的最小值 # # @lc code=start class Solution(object): def findMin(self, nums): """ :type nums: List[int] :rtype: int """ index = 0 for i in range(1, len(nums)): if nums[i] < nums[index]: ...
e43d59341a24491f2c20c13cd3179c99a98a177b
schmis12/PythonCrashCourse
/part1/06-ex01_person.py
339
4
4
# Stefan J. Schmidt, 13.03.2019 person = { 'first_name': 'stefan', 'last_name': 'schmidt', 'age': 51, 'city': 'basel', } # dictionary print(person) # values in a f-string print(f"My name is {person['first_name'].title()} {person['last_name'].title()}." + f" I'm {person['age']} years old and live ...
88c2ac5571886a982ab611a9d797b13185bf0664
django-group/python-itvdn
/домашка/essential/lesson 6/Marukhniak Denys/L_6_1.py
358
4.03125
4
# Задание 1 # Даны две строки. Выведите на экран символы, которые есть в обоих строках. str1 = input('Enter first string: ') str2 = input('Enter second string: ') # print(f'{str1}\n{str2}') s_chr = set(str1) & set(str2) print('Same chars in both strings: ', end='') print(*s_chr, sep=', ')
aff680c8d3365c55db4f84f249a961e6c434f4ca
head-256/MNA
/lab7/simpson.py
620
3.9375
4
#!/usr/bin/env python # -*- coding: utf-8 -*- def simpson(f, a, b, n): if n % 2: raise ValueError("n must be even") h = (b - a) / n s = f(a) + f(b) for i in range(1, n, 2): s += 4 * f(a + i * h) for i in range(2, n-1, 2): s += 2 * f(a + i * h) return s * h / 3 def f...
67b0edd435b4b6c6b514f5c797ebf2fa40efe86a
Crist0710/proyectoUdelosAndes
/ejercicio-estilo-program.py
592
3.84375
4
# -*- coding: utf-8 -*- """ Created on Wed Feb 17 16:40:11 2021 @author: user """ def valor_circulo(radio: float, area: float)-> float: """ Función pára calcular el valor de un circulo. Parametros: radio: float debe ser un número en decimales área: float debe ser u...
9680787fce90de60cf379189aa0ba9f701da378e
falsexin/pywork
/20190110/案例:腾讯招聘爬虫.py
1,823
3.59375
4
""" __title__ = '' __author__ = 'Thompson' __mtime__ = '2019/1/10' # code is far away from bugs with the god animal protecting I love animals. They taste delicious. ┏┓ ┏┓ ┏┛┻━━━┛┻┓ ┃ ☃ ┃ ┃ ┳┛ ┗┳ ┃ ┃ ┻ ┃ ┗━┓ ┏━...
63d45613e93d0209319993784224e934db8690d5
xyzhangaa/ltsolution
/SearchInsertPos.py
766
4.15625
4
###Given a sorted array and a target value, return the index if the target is found. ###If not, return the index where it would be if it were inserted in order. ###You may assume no duplicates in the array. #time O(logn) #space O(1) def searchinsertpos(A,target): begin,end = 0, len(A)-1 insertpos = 0 while begi...
96b924403b979fdb28c822ba95d6e11cb3fec72c
icest99/Codewar
/Python/7 kyu - Limit string length - 1.py
458
4.15625
4
# Description: # The function must return the truncated version of the given string up to the given limit followed by "..." if the result is shorter than the original. Return the same string if nothing was truncated. # Example: # solution('Testing String', 3) --> 'Tes...' # solution('Testing String', 8) --> 'Testing ...
8254099044a64b91154d691deb3ada2ec4fb56d1
lilsweetcaligula/sandbox-codewars
/solutions/python/387.py
344
3.625
4
def array(string, inputSeparator = ",", outputSeparator = " "): return outputSeparator.join(substring for substring in string.split(inputSeparator)[1:-1]) or Nonedef array(string, separator = " "): result = separator.join(substring for substring in string.split(',')[1:-1]) if len(result) == 0: retur...
47fac4721df07ed3a18956d32f1f159f2067e8c9
fkadeal/alx-higher_level_programming
/0x0B-python-input_output/5-save_to_json_file.py
396
3.875
4
#!/usr/bin/python3 """Module containing function to save python object in json format""" import json def save_to_json_file(my_obj, filename): """Convert `my_obj` to json string and save to `filename` Args: my_obj: serializable object to convert to json filename (str): file to save json string...
565a5056c6f2126b450ffb27411e4a3bf490a7d0
josecostamartins/pythonreges
/lista1/exercicio7.py
432
3.84375
4
from __future__ import unicode_literals # -*- coding: utf-8 -*- # Faça um Programa que pergunte quanto você ganha por hora e o número de horas trabalhadas no mês. Calcule e mostre o total do seu salário no referido mês. ganho = float(raw_input("Quanto você ganha por hora? \n")) horas = int(raw_input("Quantas horas vo...
5cde44ae5052353ddd684296c22da7b4897f9262
Matheusfrej/tic-tac-toe-in-cmd
/jogo da velha.py
3,117
3.875
4
from random import randint from time import sleep matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] rodada = 1 def MostrarJogo(): for l in range(0, 3): for c in range(0, 3): if matriz[l][c] == 0: print('[ ]', end='') elif matriz[l][c] =...
b3f2dd16ccaa1fdc452482d72832973c05ba1187
Frayn-code/Python-Algorithm
/DataStructure/array/intSqrtx.py
756
3.640625
4
def mySqrt(x): """ 暴力搜索 超时 :type x: int :rtype: int """ rt=0 pows=[i**2 for i in range(x+2)] for i in range(x+1): if pows[i]<=x and pows[i+1]>x: rt=i break return rt def mySqrt_1(x): left,right=1,x while(left<=right): mid=left+(right-l...
6b86714694be4e71330a3dfeb6b7bbbb8d0cfa06
ZY1N/pythontutorial
/python_sandbox_starter/dictionaries.py
788
3.890625
4
# A Dictionary is a collection which is unordered, changeable and indexed. No duplicate members. #create dict person = { 'first_name': 'John', 'last_name' : 'doe', 'age' : 30 } #use constrcutor #person2 = dict(firstname = 'sara', lastname = 'whocares') #get value print(person['first_name']) print(person...
e1168f7def39bee85c4fc6c0f1c74de419513896
Fabulinux/Project-Cognizant
/Challenges/Brian-09062017.py
1,200
3.953125
4
import sys # Power of Google #from collections import Counter # I have this here to show what it's like to google something very short and clean code using libraries """ def migratoryBirds(n, ar): return Counter(ar).most_common(1)[0][0] """ def migratoryBirds(n, ar): # Number of different types of birds ...
d1d58c99bdccb717de096ac0553b953ef114e8cb
Wuskysong/python01_-
/python_one_learn/day08/exercise04.py
975
3.9375
4
# 练习:定义 判断列表中是否存在相同元素的 函数 # list01 = [3, 81, 3, 5, 81, 5] # result = False # for r in range(0, len(list01) - 1): # for c in range(r + 1, len(list01)): # if list01[r] == list01[c]: # print("具有相同项") # result = True # break # 退出循环 # if result: # break # if resul...
c1cde0520bd2bb6213e5828e5548c95248cc8919
angel-robinson/validadores-en-python
/#vereficador9.py
309
3.796875
4
#encontrar la masa de un cuerpo #input fuerza=float(input("ingrese la fuerza:")) acceleracion=float(input("ingrese la acceleracion:")) #procesing masa=fuerza/acceleracion #vereficador masa_adecuada=(masa>=20) #output print("la masa del cuerpo es:",masa) print("la masa es adecuada?",masa_adecuada)
cdc5d1a9738eea573e30f83e35a7451144e27330
cmarchini19/python-challenge
/PyBank/test_files/main_CM_test_12-9-19.py
3,001
3.828125
4
#PyBank Financial Data Analysis #------------------------------- #Step 1: Import the modules I'll need import os import csv #Step 2: Define and Identify the budget_data.csv file we'll use for PyBank bankcsv = os.path.join("Resources","budget_data.csv") dates = [] total = 0 profitlossprevious = 0 totalrowchange = 0 g...
cc8cc07899448ef2bf62fe8aabe36ea73f0b59d7
lilitom/Leetcode-problems
/Hash/实现hash表.py
687
3.71875
4
# -*- coding:utf-8 -*- def find(arr,j): len1=len(arr) hasharr=[0]*(len1+5) arr2=[0]*(len1+5) i=0 while i<len1: a=arr[i]%17 while arr2[a]!=0: a=a+1 if i==len1: i=0 hasharr[a]=arr[i] arr2[a]=1 i+=1 print hasharr pr...
512ff427a09c01b4434bd4f1cc91b9d8b79b84ec
ledbagholberton/holbertonschool-machine_learning
/supervised_learning/0x09-transfer_learning/0-transfer.py
3,275
3.921875
4
#!/usr/bin/env python3 """FUnction transfer Write a python script that trains a convolutional neural network to classify the CIFAR 10 dataset: You must use one of the applications listed in Keras Applications Your script must save your trained model in the current working directory as cifar10.h5 Your saved model shoul...