blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
6445380909a60fc723f342307d1d21591b2c6fc9
eboladev/Study
/ProgrammingLanguage/Python/Expert Python Programming/Chapter 2/Evens_C.py
105
3.703125
4
#! /usr/bin/env python # *-* coding: utf-8 -*- evens = [i for i in range(10) if i % 2 == 0] print evens
662bf3c65d4499730ac6097e7e9c48f128e79e90
eboladev/Study
/ProgrammingLanguage/Python/Source/Conditional.py
145
3.65625
4
#!/usr/bin/python3 def main(): a, b = 1, 2 s = "less than" if a < b else "not less than" print(s) if __name__ == "__main__": main()
45a50b2b7fcab7bc7e5faa47ed27a824b738f40d
eboladev/Study
/ProgrammingLanguage/Python/Source/Dict.py
607
4.21875
4
#!/usr/bin/python def main(): d = dict( one = 1, two = 2, three = 3) for k in sorted(d.keys()): print(k, d[k]) d1 = {"one" : 1, "two" : 2, "three" : 3} print("--------------------------------------------") print(d1) for k in d1: print(k, d[k]) print("...
6cee539a47a184df5a16f688301a8c2ecff39395
eboladev/Study
/ProgrammingLanguage/Python/Code/Example/Example 1.py
282
3.75
4
#!/bin/python def main(): principal = 1000 rate = 0.05 numyears = 5 year = 1 while year <= numyears: principal = principal*(1+rate) print "%3d %.3f" %(year, principal) year += 1 raw_input("please input Enter to quit!") if __name__ == "__main__" : main()
f0d84a9d991e4e3f0b9ebfaf75a073f6f1bc9078
a5vh/AdPro
/Chapter 2/Rectangle2.py
2,232
3.515625
4
''' Created on Jan 17, 2017 @author: 19augusthummert ''' import pygame, sys, random from pygame.locals import * pygame.init() screen = pygame.display.set_mode((600,500)) pygame.display.set_caption("Drawing Shapes") r1 = 0 g1 = 0 b1 = 0 r2 = 0 g2 = 0 b2 = 0 r3 = 0 g3 = 0 b3 = 0 pos_x = random.randint(0,500) pos_...
d8854b46235c510fef76de80757f9044771b8269
cubism1/python-practice
/00_start.py
502
3.796875
4
''' students = ['고상호', '양서연', '이승훈', '이원희'] print(students) print(students[0]) print(studnets[1:4]) print(studnets[:]) print(studnets[:2]) print(studnets[1:]) # print(dir(list)) a = ['eat', 'more', 'SPAM'] a.append('please') print(a) # print(dir(tuple)) tuple_ex = (1, 2) tuple_ex = 1, 2 a = (1,) print(type(a)) ...
d81514aeb5c50ac997dd6425b909c16b8b2eec0a
anin-4/crappy-python-game
/sudoku_solver.py
1,723
3.53125
4
# making a sudoku solver board = [ [7,8,0,4,0,0,1,2,0], [6,0,0,0,7,5,0,0,9], [0,0,0,6,0,1,0,7,8], [0,0,7,0,4,0,2,6,0], [0,0,1,0,5,0,9,3,0], [9,0,4,0,6,0,0,0,5], [0,7,0,3,0,0,0,1,2], [1,2,0,0,0,7,4,0,0], [0,4,9,2,0,6,0,0,7] ] def solve( bo ): find = get_positions(bo...
00a892ee75fd78c8cd2b8fb6ed7ec056cc2c2881
crashbit/2017-1
/LMPOO/proyecto/Usuario.py
985
3.765625
4
class Usuario(): def __init__(self, id, nombre): self.id = id self.nombre = nombre def __str__(self): return self.nombre class Cliente(Usuario): def __str__(self): return "Soy un cliente" def ligaCarrito(self, carrito): self.carrito = carrito def agregarProducto(self, producto, cantidad): self.carr...
793da2c8b52bdf1d18c1452bb63f8e06db960b90
NareTorosyan/Python_Introduction_to_Data_Science
/src/first_month/Homeworks/task_1_3_4 functions.py
2,697
4.25
4
from task_1_3_1_functions import gcd #1 Write a Python function, which Implements the Euler function. #Euler function is return a count of numbers not great than N, which are mutually simple with N. #Example φ(6)=2, as only 1 and 5 from 1,2,3,4,5 are mutually simple with 6. Write a function which returns a count of n...
773eb7591857d7bc134c4f0a50ec75167cb0765e
NareTorosyan/Python_Introduction_to_Data_Science
/src/first_month/Homeworks/task_1_3_1_functions.py
1,658
4
4
# 1 Write a Python function, which gets 2 numbers, and return True if the second number is first number divider, otherwise False. def divider(a, b): if b % a == 0: return True else: return False # 2 Write a Python function, which gets a number, and return True if that number is palindrome, oth...
52f727e88d97625e3d2f3e02d93ffe65a861de14
NareTorosyan/Python_Introduction_to_Data_Science
/src/first_month/.idea/task_1_3_3.py
397
4.25
4
#1 Write a Python function which returns factorial value of given number n. def fact(n): if n == 1: return 1 return n*fact(n-1) #2 Write a Python function which returns the n-th element of the fibonacci series. def fib(n): if n == 1: return 0 elif n== 2: return 1 return f...
68313f39136cfc0e421b69942763ad8de8c57f81
nikisano/CodeForFun
/coinFlip.py
1,527
3.984375
4
#!/usr/bin/python import math import random #Nicholas Cipriano 8/14 #Mastemind Game written in Python #function that randomly flips a coin and prints the percentage of heads and tails flips def flipCoin(flips): heads = 0 tails = 0 totalflips = flips #loop untill the user input number of flips is hit while (flips ...
f369631d63c295bd45ad116d527361cf495e5559
wangzimeng/weekends
/day4/readCsv2.py
2,363
3.609375
4
# 1.之前的csv文件不能被其他testcase调用,所以应该给这段代码封装到一个方法里 # 2.每个testcase路径不同,所以path应该作为参数传到这个方法中 # # 4.打开了一个文件,但是并没有关闭,造成内存泄露 import csv import os def read(file_name): # 所有重复代码的出现都是程序设计的不合理 # 重复的代码应该封装到一个方法里 current_file_path = os.path.dirname(__file__) path = current_file_path.replace("day4", "data/" + file_name)...
1ca530013b4df13829d7190fec9a4350e725a698
LucasAMiranda/TkinterSistemaLogin
/button_event.py
547
3.59375
4
from tkinter import * count = 0 def click(): global count count+=1 print(count) window = Tk() photo = PhotoImage(file="logo.png") button = Button(window, text="Clique em mim", command=click, font=("Comic Sans", 30), fg="#00FF00", ...
93b8843904cc2e32d0a4a2f0d9548981364ba6ff
AbhishekKumar102K/Domain-Specific-IR
/tokn.py
1,443
3.640625
4
import json import nltk from nltk.tokenize import word_tokenize from nltk.stem.porter import * """ DESCRIPTION: Used for Tokenizing and Stemming the cleaned data Inputs: data.json : json file containing the cleaned data Methods: stem(): Calling the PorterStemmer function which implements the stemming operat...
5b672e08860a3d4a9f1caa3ec596e04b82e66a76
RyanMatthewJacobs/Personal-Projects
/PythonPrograms/Black Jack/Dice.py
390
4.09375
4
import random def is_not_int(input): try: input = int(input) except ValueError: print("That is not an int") return True else: return False play_again = 0 dice = 0 while play_again == 0: dice = int(random.random() * 6) print("You rolled a ", dice) play_again = input("Press 0 to roll again: ") while i...
297a91b1435dd038cc7f74600465ffc16c21c2b3
Sledis/Elementary-Finance
/DataCollector.py
3,760
3.609375
4
#!/usr/bin/env python # coding: utf-8 # In[1]: from lxml import html import requests import numpy as np import pandas as pd from bs4 import BeautifulSoup import re #This is a collection of functions that can take a Yahoo finance page and return finance information took from the website. def CurrentPrice(url,Curr):...
acbdf3379c0378eaef59b00aaa44fe9d7dbcc340
JayavelSM/Python-2021.github.io
/Analysis.py
4,048
4.53125
5
def swap_func(cond, a, b): """Swap Function Call is defined to swap the function without additional variables used. Arguments are (Condition, data 1,data 2)""" # Specify the dataType as a Integer for Arguments 1 a, b = int(a), int(b) # If Condition arguments is 0(Zero) it will run as a module, #...
dc028bde4297eb4357207104cab4461401426233
my9143434/Cryptography_system
/rsa.py
736
3.9375
4
def rsa_encrypt(plaintext): e = 69 n = 781 aes_key = str(plaintext) # Convert each letter in the plaintext to numbers based on the character using a^b mod m cipher = [(ord(char) ** e) % n for char in aes_key] print(cipher) # Return the array of bytes return cipher def rsa_decrypt(...
bd33349a069ed072b074d66b5c68e7ef5a035e22
cmottac/taxi_challenge
/engineer_features.py
4,218
3.734375
4
# Function to run the feature engineering import datetime as dt import numpy as np import matplotlib.path as mplPath def engineer_features(adf): """ This function create new variables based on present variables in the dataset adf. It creates: . Week: int {1,2,3,4,5}, Week a transaction was done . Week_d...
da39aba3c88fead20a01fbeadd68e1b3f69a68c9
leomonu/ZScore
/code.py
2,857
3.703125
4
from os import name import pandas as pd import plotly.graph_objects as go import plotly.figure_factory as ff import statistics import random df = pd.read_csv("studentMarks.csv") data = df["Math_score"].tolist() mean_population = statistics.mean(data) stddv_population = statistics.mean(data) print("...
c85f8b772994941f6ceb768e09571ffb71dcb8b0
lzx20172016/justplay
/python/re/findall.py
410
3.75
4
#!/usr/bin/python # _*_ coding:utf-8 _*_ import re #pattern=re.compile(r"\d+") #pattern=re.compile(r"\d?") #pattern=re.compile(r"\d*") pattern=re.compile(r"\d+") #m=pattern.findall("hello 123456 789") m=pattern.findall("hello123bbb456",1,12) for i in m: print i print "-----------------------------------" #patt...
1c3c2a5a326aef2d09edfa07bf76532a8168e37e
lzx20172016/justplay
/python/re/searchetest.py
293
3.5625
4
#!/usr/bin/python # _*_ coding:utf-8 _*_ import re pattern=re.compile(r"\d+") #m=pattern.search(r"aaa123bb546") #m=pattern.search(r"aaa123bb546",2,5) m=pattern.search("aaa 123 546") #m=pattern.match("aaa123bbb456",3,5) #m=pattern.match("aaa123bbb456",3,6) print m.group() print m.span()
0bcfc6c418db51aaa56258998b995ca07745102d
1AvneetKaur/technovatives-hackathon
/Technovatives_hackathon.py
3,261
3.59375
4
# Hackathon Technovatives # DATA PREPROCESSING # Importing Libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('hackathon_dataset.csv') # Creating the matrix of the Dataset X = dataset.iloc[:, ].values Y = dataset.iloc[:, 4].v...
f5de6ae9a81ef04aa15009b3e36e0964b24a2e7d
abhiishere/code_box_repo1
/pallistring.py
137
3.984375
4
X=input("enter the string") Order=X[0::] rev=X[::-1] if Order==rev: print("pallindrome") else: print("not a Pallindrome")
d5680217ea57a112fd89b61bd1a643a8e6749f79
Andrewah1/comp110-21f-workspace
/exercises/ex06/dictionaries.py
1,397
4.03125
4
"""Practice with dictionaries.""" __author__ = "730389123" def main() -> None: """Test statement.""" print(favorite_color({"Marc": "yellow", "Ezri": "blue", "Kris": "blue"})) def invert(original: dict[str, str]) -> dict[str, str]: """Invert a dictionary.""" invert: dict[str, str] = dict() x: st...
de871a1458fb6ce3078de9e3d76b288b6f931295
Andrewah1/comp110-21f-workspace
/exercises/ex05/utils_test.py
1,652
3.609375
4
"""Unit tests for list utility functions.""" # TODO: Uncomment the below line when ready to write unit tests from exercises.ex05.utils import only_evens, sub, concat __author__ = "730389123" def test_only_evens_empty() -> None: """Edge case test.""" xs: list[int] = [] assert only_evens(xs) == [] def t...
ddc5cb528c093111520728970da7628b76032ba8
ding4it/leetcode
/Reverse_Words_in_a_String.py
255
3.625
4
class Solution: # @param s, a string # @return a string def reverseWords(self, s): import re p = re.compile('[a-zA-z]+') l = p.findall(s) l.reverse() l = " ".join(l) return l s = Solution() ans = s.reverseWords("the sky is blue") print(ans)
bc5e5e16fcb2d60508c5bbc6b819a60c0b87b175
ding4it/leetcode
/ReverseBits.py
504
3.609375
4
#!/usr/bin/env python # encoding: utf-8 """ @version: 1.0 @author: Ding4it @license: Apache Licence @contact: ding4it@gmail.com @file: ReverseBits.py @time: 2016/1/6 10:24 """ class Solution(object): def reverseBits(self, n): """ :type n: int :rtype: int """ rs = 0 ...
5296a5015aab7414af2213ab860826fc5d8de946
ding4it/leetcode
/AdditiveNumber.py
991
3.765625
4
#!/usr/bin/env python # encoding: utf-8 """ @version: 1.0 @author: Ding4it @license: Apache Licence @contact: ding4it@gmail.com @file: AdditiveNumber.py @time: 2015/11/29 19:30 """ class Solution(object): def check(self,num,i,j,k): print(i,j,k) a = num[i:j] b = num[j:k] if len(a)>1 ...
aee663473223191d02a39bf9399316fc69abdf6c
ding4it/leetcode
/PalindromeLinkedList.py
1,281
3.65625
4
#!/usr/bin/env python # encoding: utf-8 """ @version: 1.0 @author: Ding4it @license: Apache Licence @contact: ding4it@gmail.com @file: PalindromeLinkedList.py @time: 2015/12/25 11:08 """ # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self....
92425301010c20178251b4491b338bbc739d92d6
koglin/psdata
/psparameters.py
1,175
3.59375
4
class Parameters(object): """Class for storing parameters """ _parameters = {} def show_info(self): for det, ddict in self._parameters.items(): print '--- {:} ---'.format(det) for attr, val in ddict.items(): print '{:16} {:10}'.format(attr,val) def w...
f0d2fbaa359245254e9f40ac02b6c1c36ee76256
xWALGXRifle/koolitus
/muud mängud/turtlegame.py
915
3.796875
4
import turtle import random player1 = turtle.Turtle() player2 = turtle.Turtle() turtle.bgcolor("yellow") player1.color("green") player2.color("red") player1.penup() player2.penup() player1.goto(300, 60) player1.pendown() player1.circle(40) player2.goto(300, -140) player2.pendown() player2.circle(40) player1.penup(...
1c661cd4d3301788ee7e9bcaedfc854fc5d7eb3b
jonavery/PythonQuickies
/dayofweek.py
370
3.90625
4
day = str(raw_input("Enter 'day' as MMDDYYYY to get its day of the week: ")) m = int(day[0:2]) q = int(day[2:4]) Y = int(day[4:8]) if m < 3: m += 12 Y -= 1 h = (q + ((13* (m+1))/5) + Y + (Y/4) - (Y/100) + (Y/400)) % 7 print("On %s/%s/%s it was the %d day of the week." % (day[0:2], day[2:4], day[4:8], h)) print("0=Sat...
c7aa9e69166f88d31dae28e0d6bd93a88f284435
KavinKKuppusamy/CNN-for-Fashion-MNIST-Clothing-Classification-using-Tensorflow
/proj2.py
1,926
3.515625
4
# based on code from https://www.tensorflow.org/tutorials import tensorflow as tf import numpy as np # set the random seeds to make sure your results are reproducible from numpy.random import seed seed(1) tf.random.set_seed(1) # specify path to training data and testing data folderbig = "big" foldersmall = "small...
dd1b5bfd56147a18c0899ba3f1d768ef4d0b0236
Iamlegend20/Blackjack
/Blackjack.py
2,812
3.828125
4
import random suits = ('Hearts', 'Spades', 'Clubs', 'Diamonds') ranks = ('Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Jack', 'Queen', 'King', 'Ace') values = {'Two':2, 'Three':3, 'Four':4, 'Five':5, 'Six':6, 'Seven':7, 'Eight':8, 'Nine':9, 'Ten':10, 'Jack':10, 'Queen':10, 'King':10, 'Ace':1...
b2c0f58a3182a20c15a6c6b9a805ffe9f7474e46
jamsea/ProjectEuler
/4_Palindrome.py
312
3.9375
4
def is_palindrome(num): num_str = str(num) if(num_str == num_str[::-1]): return True return False largest_palindrome = 0 num = 0 for i in range(999, 1, -1): for j in range(999, 1, -1): num = i*j if(is_palindrome(num) and num > largest_palindrome): largest_palindrome= num print(largest_palindrome)
c41095371ef60c5f4c3e7831f2724af5de7ab608
MuneshPatel/Assignments
/list.py
239
3.875
4
x=int(input("Enter the number of elements of list :")) i=0 j=0 list=[] print("Enter the elements of the list :") while i<x : list.append(input()) i+=1 while j<x : if int(list[j])>0 : print(list[j],",",end=" ") j+=1
28b3da1b26b169113e6c4bf333d119c35563f68a
PacktPublishing/Practical-Machine-Learning
/python-sckit-learn/chapter10/logisticregressionexample/logistic-regression.py
4,389
3.859375
4
# Practical Machine learning # Regression Analysis - Logistic Regression example # Chapter 10 import pandas as pd import matplotlib.pyplot as plt import numpy as np from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.linear_model.logistic import LogisticRegression from sklearn.cross_validation im...
eb84b058da93e038d5c400ffe078c89d9ff524e4
Mohit-15/firstripository
/prog1.py
348
3.828125
4
from array import * arr1=array('i',[5,28,9,8,7]) arr2=array('i',[2,3,4,5,6]) sum=array('i',[]) leng=len(arr1) for i in range(leng): sum.append(arr1[i]+arr2[i]) print(sum) sum_of_array_element = 0 for i in range(leng): sum_of_array_element+=sum[i] print("Sum of elements of the sum array: {}".format(...
dec5a3c6a81738e13670aa6b82b482ad6c382185
tuantvk/python-cheatsheet
/src/python-example/tuple.py
707
4.03125
4
#!/usr/bin/python # tuple tuple1 = ("html", "css", "javascript") print(tuple1) # output: # ('html', 'css', 'javascript') # access items tuple2 = ("html", "css", "javascript") print(tuple2[1]) # output: # css # for loop tuple3 = ("html", "css", "javascript") for x in tuple3: print(x) # output: # html # css ...
5f3d52c1072588241db2fd388926403ea5c661ff
xiongchi/ALL
/pythonDemo/grammer/装饰器.py
1,731
3.765625
4
# coding:utf-8 """ 装饰器 """ def my_deco(func): def in_deco(x,y): print "in_deco" return func(x,y) return in_deco #my_deco(my_sum) -> in_deco(x,y) -> my_sum(x,y) @my_deco def my_sum(x, y): return x+y #my_sum(x, y)相当于调用in_deco(x, y) my_sum(1, 2) print my_sum(3, 4) class WhatFor(object): ...
c897ed73de93055eeffddfc403c499acd74bbe75
LeowWB/lemma-rnn
/test1/cuda_check.py
433
3.59375
4
import torch # torch.cuda.is_available() checks and returns a Boolean True if a GPU is available, else it'll return False is_cuda = torch.cuda.is_available() # If we have a GPU available, we'll set our device to GPU. We'll use this device variable later in our code. if is_cuda: device = torch.device("cuda") p...
18feb24e4e70c9fef651cfd89dc869dee845b575
tarantool/tarantool-python
/tarantool/space.py
2,143
3.703125
4
""" Space type definition. It is an object-oriented wrapper for requests to a Tarantool server space. """ class Space(): """ Object-oriented wrapper for accessing a particular space. Encapsulates the identifier of the space and provides a more convenient syntax for database operations. """ de...
47d9f0f765dea4ba395583a67d9ba69059e8da59
michaelgobz/AirQo-api
/src/device-monitoring/helpers/convert_dates.py
893
3.921875
4
from datetime import datetime, timedelta def str_to_date(st): """ Converts a string to datetime """ return datetime.strptime(st, '%Y-%m-%dT%H:%M:%S.%fZ') def date_to_str(date): """ Converts datetime to a string """ return datetime.strftime(date, '%Y-%m-%dT%H:%M:%S.%fZ')...
1985b7d4157339dc36a4f0edae195e6252f3a663
michaelgobz/AirQo-api
/pipeline/cloud-functions/python/helpers.py
2,897
3.609375
4
from datetime import datetime import pandas as pd def convert_date_to_formatted_str(date, frequency): """ Converts datetime to a string basing on the frequency passed. """ if frequency == 'monthly': return datetime.strftime(date, '%B %Y') elif frequency == 'daily': return datetime....
7c4d08e4b13b2b126afba00dbe1fa3464c43245a
baejinsoo/algorithm_study
/algorithm_study/BOJ/10775.py
600
3.53125
4
import sys input = sys.stdin.readline def find(parent, x): if parent[x] != x: parent[x] = find(parent, parent[x]) return parent[x] def union(parent, a, b): a = find(parent, a) b = find(parent, b) if a < b: parent[b] = a else: parent[a] = b G = int(input()) P = int(inp...
e988d42eca210d1519549b4c1e340e0299a5b084
baejinsoo/algorithm_study
/algorithm_study/Implement/문자열 재정렬.py
300
3.609375
4
s = input() a = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'] num = [] cha = [] for i in s: if i in a: num.append(i) else: cha.append(i) num_sum = 0 for n in num: num_sum += int(n) cha_sort = ''.join(sorted(cha)) cha_sort = cha_sort + str(num_sum) print(cha_sort)
98443136732a9d56fb3457724f8fa3ed871b8501
tridibbasak21/HacktoberFest
/string compare.py
467
4.34375
4
# Python program to check if # two strings are identical # Get the strings which # is to be checked string1 = input("Enter the first string: ") print(string1, end = "\n") # Get the strings which # is to be checked string2 = input("Enter the second string: ") print(string2, end ="\n") # Check ...
1f6b85ddc12792c8fb47a043a15ceb380de42573
SeverusYK/Be-Master
/문자열 2번.py
100
3.84375
4
s = input("문자열을 입력하세요:") k = "" for ch in reversed(s): k += ch print(k)
16938b2d0fe33f689461de605926fd31093be8c3
AishwaryaVelumani/Hacktober2020-1
/Rotate_Matrix_Python.py
571
4.03125
4
def rotate_square_matrix(sq_matrix): for i in range(length): for j in range(i): temp=sq_matrix[i][j] sq_matrix[i][j]=sq_matrix[j][i] sq_matrix[j][i]=temp for i in range(length): for j in range(length // 2): temp=sq_matrix[i][j] sq_matrix[i][j]=sq_matrix[i][length-j-1] sq_matrix[i][length-j-1]=te...
72051282da2c59112430cad53af421255dfaa3d6
AishwaryaVelumani/Hacktober2020-1
/Search.py
833
3.71875
4
class Solution(object): def exist(self, board, word): n =len(board) m = len(board[0]) for i in range(n): for j in range(m): if word[0] == board[i][j]: if self.find(board,word,i,j): return True return False def find(self, board,word,row,...
9354ef8474fbdc5361eebb1590e7a8bf77857039
artificially-ai/pandas_tutorial
/src/code/merge_operations.py
2,865
3.609375
4
""" Organisation: ekholabs Author: wilder.rodrigues@ekholabs.ai """ from utils import dataset as ds person = ds.load_survey('survey_person.csv') site = ds.load_survey('survey_site.csv') survey = ds.load_survey('survey_survey.csv') visited = ds.load_survey('survey_visited.csv') def merge_o2o(): visited_s...
c8b66bd65c17ac0c363087eaecf1c110ca6ae984
mikedriessen/ApplicatieLaag
/PasswordChecker/Main.py
515
3.875
4
import re WW= input("Put in your Password:") x = True while x: if (len(WW)<6 or len(WW)>20): break elif not re.search("[a-z]",WW): break elif not re.search("[0-9]",WW): break elif not re.search("[A-Z]",WW): break elif not re.search("[#$%&'()*+,/:;<=>?@^_...
8ca7cb0795553020545e882c87d338507d95226d
jboycoded/bank-atm-system
/main.py
29,605
3.921875
4
""" Three-Way Modelling Of A Bank System Between A User,An Admin,and an ATM""" __author__ = "Johnson Onoja <johnsononoja60@yahoo.com" #importing standard modules import os import time import random #importing tkinter-related modules and packages from tkinter import * from tkinter import messagebox from t...
cf5e2fc25593111ab7b473f13cbce75397e8b3aa
tanujveera/Codeforces_Solved
/Pythonn/Beautiful year 271A.py
181
3.578125
4
year=int(input()) while(year>0): year+=1 y=str(year) if((y[0]!=y[1]) and (y[0]!=y[2]) and (y[0]!=y[3]) and (y[3]!=y[2]) and (y[3]!=y[1]) and (y[2]!=y[1])): break print(y)
685bcaf284e3096f92fab9173c046cbde243d329
Soleviso/pythonProject1
/liste.py
431
3.546875
4
import csv with open('teilnehmer.csv') as csvdatei: csv_reader_object = csv.reader(csvdatei) zeilennummer = 0 for row in csv_reader_object: if zeilennummer == 0: print(f'Spaltennamen sind: {", ".join(row)}') else: print(f'{row[0]} ist {row[1]} Jahre, {row[...
b0802fb76c3be2e53e5ba71e50e4101678e63966
VoidC-minor/CS61A
/lab01/1.py
334
3.515625
4
def repeated(f, n, x): if n == 0: return x return f(repeated(f, n-1, x)) def sum_digits(n): if n == 0: return 0 return sum_digits(n // 10) + n % 10 def double_eights(n): if n % 100 == 88: return True elif n < 100: return False else: return double_eig...
7725b1407774be695e523b7251160963832a3e5b
jccc2002/StructuredProgramming2A
/unit2/listComp.py
295
3.640625
4
import sys if __name__ == "__main__": print("List Comprhension") lista = [] for iterador in range(0,101): if iterador%2 == 0: lista.append(iterador) print(lista) listaComp = [iterador for iterador in range(1,100) if iterador%2==0] print(listaComp)
49580811756ddfd01fa525185c12f2279fbda47b
Homerade/DA-520
/week7/dataset.py
393
3.703125
4
import csv from pprint import pprint file = open("immigration.csv") data = csv.DictReader(file) for row in data: print(row['Year'], row['Annual immigration into the United States: thousands. 1820 ? 1962']) # import csv # >>> with open('names.csv') as csvfile: # ... reader = csv.DictReader(csvfile) # ... fo...
c27860fa6ee1fd2c9d33879f52ee68ffeb3a1275
Homerade/DA-520
/week4/bot_draft1point1.py
551
3.546875
4
# -- coding: utf-8 -- from PyDictionary import PyDictionary import random dictionary=PyDictionary() frost = ['Two', 'roads', 'diverged', 'in', 'a', 'wood', ',', 'and', 'I', ',', 'I', 'took', 'the', 'one', 'less', 'traveled', 'by', 'and', 'that', 'has', 'made', 'all', 'the', 'difference'] print random.choice((dic...
355b87be053fec628e891fd3a5e3108359d27aba
systragroup/quetzal
/syspy/pycube/dijkstra.py
3,309
3.5625
4
__author__ = 'qchasserieau' import networkx as nx class DijkstraMonkey: """ nx.DiGraph based object. Runs Dijkstra algorithm to infer the extensive sequence of nodes from a partial sequence. Add intermediate nodes to a .LIN to fit a detailed network. example: :: df_edges =links[['a', 'b'...
c0c62f61eb3d60c36422c8f751be1642c6f42ce1
naistangz/codewars_challenges
/8kyu/speedCodeArrayMadness.py
579
4.03125
4
""" Task Objective Given two integer arrays a, b, both of length >= 1, create a program that returns true if the sum of the squares of each element in a is strictly greater than the sum of the cubes of each element in b. E.g. array_madness([4, 5, 6], [1, 2, 3]) ==> True # because 4 ** 2 + 5 ** 2 + 6 ** 2 > 1 ** 3 + ...
575409b5a1aa69c6666d9b5c72c96e5f6c24ca97
naistangz/codewars_challenges
/6kyu/leaderboardClimbers.py
1,092
4.40625
4
""" Task Leaderboard climbers In this kata you will be given a leaderboard for example: ['John', 'Brian', 'Jim', 'Dave', 'Fred'] Then you will be given a list of strings for example: ['Dave +1', 'Fred +4', 'Brian -1'] Then you sort the leaderboard. The steps for our example would be: # Dave up 1 ['John', 'Bria...
45691c0307aed10aa88b377bb7e3d98f4886ee0d
naistangz/codewars_challenges
/6kyu/parseHTMLCSSColours.py
2,420
4.15625
4
""" Instructions In this kata you parse RGB colors represented by strings. The formats are primarily used in HTML and CSS. Your task is to implement a function which takes a color as a string and returns the parsed color as a map (see Examples). Input: The input string represents one of the following: 6-digit hexadec...
fe5cf83774f334c57f0512b4406536bb2829f2b0
naistangz/codewars_challenges
/6kyu/duplicateEncoder.py
646
4.21875
4
""" The goal of this exercise is to convert a string to a new string where each character in the new string is "(" if that character appears only once in the original string, or ")" if that character appears more than once in the original string. Ignore capitalization when determining if a character is a duplicate. Ex...
3573e1ac2da1ff9920ed1cbafff41e9cf2e31f7b
liusida/CS228
/lib/pickle_database.py
2,303
3.609375
4
import pickle class Database: def __init__(self, load_from_file=True): if load_from_file: with open('mainData/database.p','rb') as f: self.database = pickle.load(f) else: self.database = {} self.username = "" def save(self): with open('ma...
eb2efd8c92ea031f716fd4d822f2ebf2e8fd83ff
nb117/python-1
/eightball
326
3.703125
4
#!/usr/bin/env python3 print(""" welcome to the magic eightball enter you question below bru: """ + c.reset) answers = ["yes.", "no.", "maybe.", "not really.", "totaly."] import random try: while True: question = input('> ') answer = random.choice(answers) print(answer) except KeyboardInterrupt: e...
3c4f2e518e8ce8ba8fb28b16509ad1182ef9fbe4
LeHuyenn/LabWeb---Lab-2
/PythonApplication1/Exe7.py
1,873
3.546875
4
import datetime import random #Class save data on cache class MyCache: def __init__(self): #constructor self.cache={} self.max_cache_size=10 def update(self, key, value): """ Update the cache dictionary and optionally remove the oldest item """ if key...
8569258baf8e247842e4ee1411e59f007cbeba3d
hamiltoz9192/CTI-110
/P4HW3_Hamilton.py
401
4.34375
4
#CTI-110 #P4HW3 - Factorial #Zachary Hamilton #July 6, 2018 #Factorial program. userInteger = int( input("Enter a nonnegative number:")) while userInteger < 1: userInteger = int(input("Enter a nonnegative number:")) factorial = 1 for currentNumber in range(1, userInteger + 1): factorial = fact...
054908b7124944ac99ff3127ac48ce3a8724c591
AShuayto/python_codewars
/twice_as_old.py
701
3.9375
4
''' Your function takes two arguments: current father's age (years) current age of his son (years) Сalculate how many years ago the father was twice as old as his son (or in how many years he will be twice as old). ''' #SAMPLE TEST Test.describe("Basic Tests") Test.assert_equals(twice_as_old(36,7) , 22) Test.asser...
439a0f39bf0f01ea087302bfa0dfa845de017141
AShuayto/python_codewars
/string_clean.py
383
3.96875
4
def string_clean(s): """ Function will return the cleaned string """ final_list = [] for item in s: if item.isdigit(): pass else: final_list.append(item) return ''.join(final_list) print(string_clean("This looks5 grea8t!")) # BEST PRACTICE def string...
f8f37fb3998bb6e6f762aedf4318c2eeabe3c9ce
boy0501/2DGP
/3-1스언어과제/2번과제.py
8,335
3.984375
4
print("#1번") def distance(x1,y1,x2,y2): return ((x2-x1)**2+(y2-y1)**2)**0.5 x1,y1,x2,y2,x3,y3 = eval(input("삼각형의 세 꼭짓점을 입력하세요:")) l1 = distance(x1,y1,x2,y2) l2 = distance(x1,y1,x3,y3) l3 = distance(x2,y2,x3,y3) s = (l1+l2+l3)/2 area = (s*(s-l1)*(s-l2)*(s-l3))**0.5 print("삼각형의 넓이:{0:0.1f}".format(area)) print("#2번"...
1246f757b9d6eef24f0cda24e6da809de9f05185
boy0501/2DGP
/3번과제/py_03_03_2017182030_1.py
3,803
4.125
4
import turtle #turtle.shape('turtle') turtle.penup() ########## ## l 를 그리는 #함수 인자 : ㅣ가 그려질 x,y # ㅣ의 두께,높이 def makel(x,y,width,height): turtle.goto(x,y) turtle.pendown() turtle.setheading(0) for i in range(4): if i % 2 == 0: turtle.forward(width) else: ...
5a4d43246a8c6076999ed765c4f80a6a2974796a
michaelmccoll/W2_D2_testing
/src/calculator.py
328
3.6875
4
def add(first_number, second_number): return first_number + second_number def subtract(first_number, second_number): return first_number - second_number def divide(first_number, second_number): return first_number / second_number def multiply(first_number, second_number): return first_number * second...
a9d28f9009e9db3ceaee46739d0ee73baf71ea50
AdarshKaradi9/APS2020
/StackQ.py
638
3.921875
4
class Stack(object): def __init__(self): self.queue1 = [] self.queue2 = [] self.curr_top = 0 def push(self, x): self.queue2.append(x) self.curr_top = x while len(self.queue1): self.queue2.append(self.queue1.pop(0)) temp = self.queue2 s...
9abe4408cd54749325976e899c95a95887fc7985
sy850811/Python_DSA
/Count_Zeros.py
321
3.84375
4
## Read input as specified in the question. ## Print output as specified in the question. def countZero(n): if n == 0: return 0 if (n%10 == 0): return 1 + countZero(n//10) else: return countZero(n//10) n = int(input()) if n == 0: print("1") else: print(countZero(n))...
a0e1fb7e1b126c5f0f1a5bddbcfefe0331355949
sy850811/Python_DSA
/Reverse_the_First_K_Elements_in_the_Queue .py
1,260
3.703125
4
from sys import stdin, setrecursionlimit import queue setrecursionlimit(10 ** 6) def reverseQueue(inputQueue) : if inputQueue.empty(): return data = inputQueue.get() reverseQueue(inputQueue) inputQueue.put(data) def reverseKElements(inputQueue, k) : outputQueue = queue.Queue() for i ...
76d985a16acb042ac6fdf67c4aa69465fd2e7e7e
sy850811/Python_DSA
/KLargestElements.py
471
3.78125
4
import heapq def kLargest(lst, k): ############################# # PLEASE ADD YOUR CODE HERE # ############################# heap=lst[:k] heapq.heapify(heap) n1=len(lst) for i in range(k,n1,1): if heap[0]<lst[i]: heapq.heapreplace(heap,lst[i]) return heap # Main ...
1f6e1b6f5b5702b96b5c77d52b872c63ff2c920c
sy850811/Python_DSA
/Remove_Duplicates_Recursively.py
263
3.5
4
# Problem ID 91, removeConsecutiveDuplicates def rcd(s): if(len(s) == 0 or len(s) == 1): return s sub = rcd(s[1:]) if(s[0] == sub[0]): return sub else: return s[0] + sub # Main string = input().strip() print(rcd(string))
e6eacf2285770d7e95f0fd9b0429dc400bf865bd
sy850811/Python_DSA
/Merge_Sort.py
2,151
3.5
4
from sys import stdin, setrecursionlimit setrecursionlimit(10 ** 6) #Following is the Node class already written for the Linked List class Node : def __init__(self, data) : self.data = data self.next = None def midPoint(head) : slow, fast = head, head if head == None: return None ...
6295f3cb8d5397b48901b4dbacf9b02c9b26c109
sy850811/Python_DSA
/Merge_two_sortedLL.py
1,654
3.65625
4
from sys import stdin class Node : def __init__(self, data) : self.data = data self.next = None def add (new,old,head): if new == None: new = old head = old old = old.next else: new.next = old new = new.next old = old.next return new,old...
3f192354596639206694eaf5cce4559eeca0f9b7
JericoPablo/Inf3Gruppe4
/python/BeeTree/src/BST.py
6,010
3.9375
4
''' Created on 05.05.2015 @author: Tugrul ''' class Node: def __init__(self, value): ''' Constructor ''' self.value = value self.leftChild = None self.rightChild = None def insert(self, data): if self.value == data: 'if there is a N...
569983351f388559154b4816a84fe27debf09baf
JustineAyroor/MachineLearning
/Practice/practiceProg4.py
1,206
4.25
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 24 06:14:00 2018 @author: justineayroor """ # Write​ ​a​ ​Python​ ​program​ ​to​ ​sort​ ​a​ ​list​ ​of​ ​numbers​ ​using​ ​the​ ​bubblesort​ ​algorithm Bubblesort​ ​algorithm​ ​to​ ​sort​ ​a​ ​list​ ​of​ ​numbers​ ​called​ ​l: # for​ ​i​ ​=​ ​0​ ​to...
f58e8f73524fd7d9f29d02ed21cba8afd0762ea0
JustineAyroor/MachineLearning
/Practice/practiceProg1.py
2,151
4
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Sep 18 19:07:32 2018 @author: justineayroor """ # Problem Statement # 1. Suppose​ ​we​ ​have​ ​a​ ​list​ ​l​ ​=​ ​[1,​ ​20,​ ​40,​ ​30,​ ​2,​ ​5,​ ​4].​ ​Write​ ​a​ ​for​ ​loop​ ​to​ ​determine​ ​if​ ​this​ ​list contains​ ​the​ ​number​ ​30. # 2. Calcu...
420a34b1b9ded231a538ca1b0d43b91f758ca8de
Kadzup/neironetwork
/function.py
1,573
3.546875
4
#%% import numpy as np def sigmoid(value): """Обчислення ф-ції активації""" return 1 / (1 + np.exp(-value)) def softmax(value): """обчислення""" return np.exp(value)/np.sum(np.exp(value)) def learning(array_vector, nw): """Навчання""" epoch = 0 while epoch < 200: num = np.r...
17543377c1d160c1b6671401a4aa0ece1b831c38
roddyofchina/python-dev
/python-class-inherit/Python-Son.py
592
3.515625
4
#!/usr/bin/env python #coding:utf8 __author__ = 'LUODI' class CLASSInherit(object): '''Hello i am father''' def __init__(self): self.name = 'LUODI' self.age = 25 def RUN(self): print "我是父类的方法" class CLASSON(CLASSInherit): '''Hello i am son''' def ECHO(self): print...
9f0b5a60ee3100d449f7f57f75b9f8b42051ed6e
tmajest/project-euler
/python/p59/p59.py
580
3.625
4
# http://projecteuler.net/problem=59 import itertools import string def apply_xor(ciphertext, key): return [c ^ key[i % len(key)] for i, c in enumerate(ciphertext)] def is_probably_english(letters): return 'the' in {word.lower() for word in letters.split()} ciphertext = map(int, open('cipher1.txt').read().sp...
a89ca91bf1c2f32b9894d45a8f4bf5a5b988236c
Harsonica/normal-distribution
/one.py
180
3.546875
4
import plotly.express as px import csv with open("data1.csv") as csv_file: df=csv.DictReader(csv_file) fig=px.bar(x="Height(Inches)", y="Weight(Pounds)") fig.show()
034b744e66f75eb74e7beefd947e5ef36e21c774
davidwinters/deadhack
/dh/game/Level.py
2,598
3.65625
4
from dh.game import Monster, Map, Doodad, Container import random class Level(object): """ takes all of our components and creates a level """ def __init__(self, level): self.level = level self.map = self.generate_map() self.mobs = self.generate_mobs() self.doodads = self.gene...
a79b39308d2f84602c15e98d970fce8761ea34e2
james-woo/microsoft-competition-feb2015
/one.py
1,765
3.796875
4
''' Example input 55 5 1 5 0 0 5 1 5 56 2 5 56 3 57 55 4 56 57 Example output STOPPED: 3 4 TIME: 13 PATH: 0 1 4 3 ''' class escalator: def __init__(self, ID, start, end, escalator_time): self.ID = ID; self.start = start; self.end = end; self.escalator_time = escalator_time ...
c0b93b3a58e5115503c1f380cb30361be6340786
Akim-Delli/Algo
/Coursera/Python/QuickSort.py
726
4.125
4
count = 0 def quick_sort(arr): """ Quick sort sorting Algorithm """ global count if len(arr) == 1 or len(arr) == 0: return arr # TODO choose pivot pivot = arr[0] left = [] right = [] for val in arr[1:]: if pivot < val: left.append(val) else: ...
b2b4781244bc26b15e340bba9d3de81f21e1ca08
Poetickz/color_vision_deficiency
/experimental/make_colors.py
793
3.59375
4
def get_data_from_file(file): """ This function gets the data set from a file. INPUTS file -> the path of the file (string) OUTPUT data -> a hash/dictonary with all data (wave & intensity) """ f = open(file, "r") lines = f.readlines() data = {'r':[],'g':[],'b':[]} for line ...
cd53ff74e82c026adb2da383f73405d868ce288c
jwaldrep/mystery-word
/mystery_word.py
5,972
3.984375
4
import random class MysteryWord(object): """MysteryWord object""" default_word_list = ["bird", "calf", "river", "stream", "kneecap", "cookbook", "language", "sneaker", "algorithm", "integration", "brain"] def __init__(self, word_list=default_word_list, allowed_guesses=8, difficul...
9632fd2d5f591a350802e79012186a7794974fe4
BicVu/python-challenge
/PyBank/main.py
1,644
3.875
4
import os import csv highest = 0 highest_change = 0 highest_month = 0 lowest = 0 lowest_change = 0 lowest_month = 0 profit = 0 net_list = [] change = 0 change_list = [] # Navigate to the file csvpath = os.path.join('Resources', 'budget_data.csv') # Read in the CSV file with open(csvpath, newline="") as csvfile: ...
b6e795e9b75f8e489a1e82068b03c3758814abc4
Mishraesha/PythonLearning
/Contructors.py
473
3.671875
4
class classA: def __init__(self): print("Class A constructor") def method1(self): print("Class A - Method 1") class classB(): def __init__(self): #super().__init__() print("Class B constructor") def method2(self): print("Class B - Method 2") c...
98a6d4fae6fa20fd295a114128cfdabb53e4e08a
tutss/MAC0460
/ep3/ep3.py
2,919
3.734375
4
######################################################### # Nome: Artur Magalhaes Rodrigues dos Santos # # NUSP: 10297734 # # # # Na versão do código com todas as funções, # # logistic_fit e logistic_pred...
f81f799e08acdb08cdaa89bc1a77a7bbf53397c3
arsenesefu/Repository-for-Data-science
/Beef Factory for Brussels.py
17,367
3.515625
4
#!/usr/bin/env python # coding: utf-8 # Introduction # Beef Factory is a company based in Paris for selling burgers and sandwiches, currently it works on a project to launch a shop in Brussels .The company has to do a research of the best neighbourhood to launch the new shop. The company is looking for interesting sp...
5ec2780c4ef7e605b4cee9d9bbba71849aca476a
kylenotfound/PythonPayrollProject4
/RestaurantPayroll.py
1,168
3.71875
4
""" CSC-226 Chapter 12/weeks 11-12 Topics OOP - Inheritance Language: Python Programmer: A. Wright Date: 4/19/2020 Description: RestaurantPayroll.py Inheritance/Polymorphism Programming Project MODIFIED BY: KYLE EVANGELISTO DATE: 4/22/2020 -> 4/23/2020 (it is very late at night) * """ from RestaurantWorker ...
4c54a5c66d998661e2c2be46ff6601c67865425c
tfausak/dailyprogrammer
/80/easy.py
2,681
3.625
4
"""http://redd.it/x0v3e As all of us who have read "Harry Potter and the Chamber of Secrets" knows, the reason He-Who-Must-Not-Be-Named chose his creepy moniker is that "I Am Lord Voldemort" is an anagram for his birthname, "Tom Marvolo Riddle". I've never been good at these kinds of word-games (like anagrams), I alw...