blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
109107bcb725f8d9f683055f03d141db5b0c8a7a
zangfans/pythonstack
/modle/module.py
957
3.515625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # author:zangfans time:2019/10/12 import math import random import statistics import keyword import hello # import sys # for i in sys.modules: # print(i) # print(i) #将大型程序分割成多个包含Python代码的文件,也被成为模块.模块中支持使用另一个模块的代码。Python解释器自带内置模块 # import sys # def sqlparse(): # ...
7b615cbad7321223bb13b2468c8de1e6e073c9dc
WebSofter/lessnor
/python/1. objects and data types/list.py
562
4.1875
4
""" Basic list """ players = [45, 25, 12, '445'] print(players) for player in players: print(player) """ + - Summ two and more lists """ players = players + [99, 88, 44] print(players) """ .append() - Append new item to list end """ players.append(25) print(players) """ :n, n:, m:n - Cut from and to element w...
65b40303fd2dff4c4190b94544a53ef2b7aac8f9
bnkent/my_100days-of-code-with-python
/day37-39/weather_csv_demo/research.py
1,288
3.578125
4
import os import csv import collections import pprint from typing import List data = [] Record = collections.namedtuple('Record', 'date, actual_min_temp, actual_max_temp, actual_precipitation') def init(): filename = os.path.join(os.path.dirname(__file__), 'data', 'seattle.csv') if not data: with op...
f086870f62715b05dcb1e5a2507362947336ca50
Leeyp/DHS-work
/practical 1/q1_farenheit_to_celsius.py
110
3.859375
4
Farenheit = input("Input the Farenheit in double!") celsius = (5/9) * (float(Farenheit) - 32) print(celsius)
a0ada53e426ebcbd9353b65f152baa12ff02a6b2
rafaelperazzo/programacao-web
/moodledata/vpl_data/79/usersdata/231/43198/submittedfiles/serie1.py
190
3.765625
4
# -*- coding: utf-8 -*- import math n=int(input('digite n: ')) soma=0 for i in range(1,n+1,1): if i%2==1: soma=soma+i/i**2 else: soma=soma-i/i**2 print('%.5f'%soma)
d31259205cc3b59d55e1ae0230818dbcb650975d
yatish1606/gitExampleSE
/example.py
106
3.5
4
characters = ['Jonas', 'Martha', 'Ulrich', 'Charlotte'] for character in characters: print(character)
7bf480859260ad319277073245abdf136da8f53b
shaziakaleem/Datastructure_Algo
/binary_heap.py
1,870
3.890625
4
''' BINARY HEAP A binary heap is a binary tree with below properties: 1. elements are arranged in level order, first level element from left to right followed by second level 2. value of parent is always smaller than children 3. an additional element 0 is added in binary heap for formula : left_child = 2*parent ...
3177eaee95fb5e2684f4763ef39565e517b20553
ibahbah/NLP-Sentiment-analysis-using-logistic-regression
/build_freqs.py
1,246
3.65625
4
# ```python def build_freqs(tweets, ys): # """Build frequencies. # Input: # tweets: a list of tweets # ys: an m x 1 array with the sentiment label of each tweet # (either 0 or 1) # Output: # freqs: a dictionary mapping each (word, sentiment) pair to its # freque...
7fa86dd7a2ca7e75dcaccc72605c058e729a7d80
basseld21-meet/meet2019y1lab3
/Echo.py
134
3.640625
4
user=input ("Say something! ") print("UPPER: " + user.upper()) print ("lower: " + user.lower()) print ("swapcase:" + user.swapcase())
2f88ae1165787d1fd4e690cb42a9b687e0ecbb01
ZhengLiangliang1996/Leetcode_ML_Daily
/DP/62_UniquePath.py
575
3.609375
4
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2023 liangliang <liangliang@Liangliangs-MacBook-Air.local> # # Distributed under terms of the MIT license. class Solution: def uniquePaths(self, m: int, n: int) -> int: # dp[i][j] means number of possible unique paths reach to ...
d987c3e748e548342ddf5f40cb362b60454c19a6
AkaashLessons/Homeworks
/hw2.py
1,706
4.3125
4
##here are the 2 functions we wrote in class## ##we didn't go over this, but instead of writing print at the end of the function ##write return which accomplishes the same thing but will be more useful later def three(number): return number + 3 def a_to_b(a_word): b_word = a_word.replace('a','b') return b_...
2d9ee59fe1172f12f0d959f98e9514d6c20b79c6
Vedant-S/AIMechanics
/DeepLearningLibrary/trainMeDeep.py
1,340
3.984375
4
import DeepLearningLibrary.isthara_versatile as ist import matplotlib.pyplot as plt def model(X, Y, layers_dims,activation_tuple, learning_rate = 0.01, num_iterations = 15000, print_cost = True): grads = {} costs = [] # to keep track of the loss m = X.shape[1] # number of examples # Initialize par...
3a9fdd9a8f5e2ec71be53abe42c605c94b87a7f5
edu-athensoft/ceit4101python
/stem1400_modules/module_6_datatype/m6_5_set/set_opertation_symetric_difference.py
305
3.71875
4
# set operation # symmetric difference A = {1, 2, 3, 4, 5} B = {4, 5, 6, 7, 8} # A ^ B C = A ^ B print(C) # C = A.difference(B) # print(C) # use symmetric_difference function on A d = A.symmetric_difference(B) print(d) # use symmetric_difference function on B d = B.symmetric_difference(A) print(d)
0f61d31ef31c6660cf1894518095df9a3db027ac
Amit902/python_assignment02.py
/assignment23.py
166
3.546875
4
x=""" python class is going on...""" y="""there is no doubt in first class.""" z=x+y print(z) print(type(z)) x=10 y=1.2 z='a'
00d3ecbfd140ea657c41b074ceaeaecebcb11817
lishuchen/Algorithms
/lintcode/136_Palindrome_Partitioning.py
858
3.65625
4
#!/usr/bin/env python # -*- coding: UTF-8 -*- class Solution: # @param s, a string # @return a list of lists of string def partition(self, s): # write your code here if not s: return [] rsl = list() self.find(s, 0, [], rsl) return rsl def find(self...
6a1edc4f0ed198e33e28f57db1207f91d443e882
Omar-Velez/MinTIC2022
/Perfeccionamiento/reto4.py
185
3.796875
4
cantidadMonedas, memoria = 5,3 #[int(valor) for valor in input().split()] monedas=[int(valor) for valor in input().split()] monedas.reverse() print(monedas) # 11 4 # 1 2 3 4 5 6 7 8 9
f362581209fee4fffd595936f4cd336b276a32fa
emilyusa/coda-kids
/project-solutions/level-4/restarter2.py
1,015
3.546875
4
"""General information on your module and what it does.""" import coda_kids as coda # load sprites IMAGE_BUTTON = coda.Image("assets/button.png") # modifiable data class Data: """place changable state variables here.""" restart_button = coda.Object(IMAGE_BUTTON) display_text = coda.TextObject(coda.color.W...
1fac29da9de3f4988e401d1e868afe4ee0645f2a
bitpit/CS112-Spring2012
/classcode/day06--code_formating/broken2.py
741
4
4
#!/usr/bin/env python from random import randint user_input=int(raw_input()) list=[] #initiliazing variables for _ in range(user_input): #appends input quantity list.append(randint(0,20))#of random vars between #1 and 20 to list based on #the nu...
05f85d5e2a79d9b905c1ab8b6068858b3b190797
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_96/1859.py
1,158
3.609375
4
from sys import stdin def get_judge_points(total): if not isinstance(total, int): total = int(total) i = int(total/3) remainder = total % 3 points = [i, i, i] while remainder > 0: points[remainder] += 1 remainder -= 1 return points def do_surprise(points): diff = max(points) - min(points) ...
c627de0808839f41a6c6b9b5c6138ea4c227c2aa
pedroheck/uri-online-judge-training
/Iniciante/1060.py
181
3.6875
4
lista = [] contador = 0 for i in range(0, 6): lista.append(float(input())) for i in lista: if i > 0: contador += 1 print("{} valores positivos".format(contador))
b49d8c10ae83f4f18d0ebed68964bc27f261230a
JoaoXavierDEV/ParadgimasPython
/20201116/trabalhoExtraAv2-num3-6.py
1,069
3.953125
4
x = lambda: 2+2 y = lambda valor1: valor1 # print(x()) # ------------------------------------- class TV(): def __init__(self, ligada , canal, volume): self.ligada = ligada self.canal = canal self.volume = volume def mudarVolume(self): volume = input("VOLUME 0 - 10\n") ...
a78a73c0df6a1230466ae22b314dc6c95fad838e
berkercaner/pythonTraining
/Chap03/types.py
1,049
3.8125
4
#!/usr/bin/env python3 # Copyright 2009-2017 BHG http://bw.org/ x = 7 y = """berker caner {}""".upper().format(9) print('x is {} {}'.format(x,y)) print(type(x),type(y)) z = 'berker "{1:<09}" "{0:>010}"'.format(8,1232) print(z) a = 8 w = f"it's {a} not {3}" print(w) b = 7 * 3.1415 #numeric type c = 7 / 3 d = 7 // 3 ...
2696f7d0d95a089df6134d6a80f24bec74bfad90
atul-maverick/weather_analysis_hadoop
/mapper1.py
1,096
3.859375
4
#!/usr/bin/env python """A more advanced Mapper, using Python iterators and generators.""" import sys import operator #http://www.michael-noll.com/tutorials/writing-an-hadoop-mapreduce-program-in-python/#reduce-step-reducerpy def read_input(file): for line in file: line=line.split('\t') month=int(line[0][4:]) i...
5b91156821c6891006549b56a1eaa19892d2cc60
AbelRapha/Python-Exercicios-CeV
/Mundo 3/ex097 Um print especial.py
223
3.578125
4
def Escreva(palavra): tamanho = len(palavra)+4 print("-"*(tamanho)) print(f' {palavra.center(tamanho)}') print("-"*(tamanho)) palavra = input("Digite qualquer palavra: ") print(Escreva(palavra=palavra))
89d8504815c5f725802d8ef9136b3454b611d4b2
Merovizian/Aula19
/Desafio091 - Dados aleatórios em um dicionario.py
1,013
3.734375
4
from random import randint import time print(f"\033[;1m{'Desafio 091 - Jogando com numeros aleatorios eu um dicionario':*^70}\033[m") # cria um dicionario e uma lista dicionario = dict() lista = list() # cria as keys e coloca os valores delas no dicionario e o dicionario dentro da lista. for a in range (0,4): dici...
340b1481b39b4ed272b3bd09ad648f933570e7de
scarletgrant/python-programming1
/p8p3_multiplication_table_simple.py
415
4.3125
4
''' PROGRAM p8p3 Write a program that uses a while loop to generate a simple multiplication table from 0 to 20. PSEUDO-CODE initialize i to zero prompt user for number j that set the table size while i <= 20: print(i, " ", i*j) increment i+=1 print a new line with print() ''' i = 0 j = int(input("Please...
bba283662a32f7e065a92be45060bdf4662bacdf
Vasilic-Maxim/LeetCode-Problems
/problems/1038. Binary Search Tree to Greater Sum Tree/1 - DFS In-order Traverse.py
550
3.640625
4
class TreeNode: def __init__(self, x, left=None, right=None): self.val = x self.left = left self.right = right class Solution: """ Time: O(n) Space: O(n) """ def bstToGst(self, root: TreeNode) -> TreeNode: self.recalculate(root) return root def reca...
4d39d20e155d7871100f9d6a8bc3e8629050cea9
britel-chaimaa20/mundiapolis-math
/math/0x01-plotting/1-scatter.py
331
3.546875
4
#!/usr/bin/env python3 import numpy as np import matplotlib.pyplot as plt mean = [69, 0] cov = [[15, 8], [8, 15]] np.random.seed(5) x, y = np.random.multivariate_normal(mean, cov, 2000).T y += 180 plt.title("Men's Height vs Weight") plt.ylabel("Weight (lbs)") plt.xlabel("Height (in)") plt.scatter(x,y) ...
4e58ea9fdead7751620e06a6e2c2ae71def5c0d0
eloydrummerboy/Udemy
/Deep_Learning_PreReq_Numpy/Exercise4.py
1,111
3.53125
4
# -*- coding: utf-8 -*- """ Created on Sat Sep 30 18:29:35 2017 @author: eloy """ # Write a function that flips an image 90 degrees clockwise import os os.chdir("/home/eloy/Data_Science/Kaggle/MNIST/") import numpy as np import pandas as pd import matplotlib.pyplot as plt df = pd.read_csv("train.csv") test = df.l...
3c77c40fa12aa27666c7f112fb1b2c9a65886638
mn113/adventofcode2019
/python/04.py
958
3.859375
4
def is_increasing(n): s = str(n) return s[1] >= s[0] and s[2] >= s[1] and s[3] >= s[2] and s[4] >= s[3] and s[5] >= s[4] def has_double(n): s = str(n) return s[1] == s[0] or s[2] == s[1] or s[3] == s[2] or s[4] == s[3] or s[5] == s[4] def has_isolated_double(n): s = str(n) return (s[0] == s[1]...
3c955f5304190eab182b21ba76973de5367a187d
alisen39/algorithm
/algorithms/spiralMatrix2.py
1,254
3.96875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/1/19 15:22 # @Author : Alisen # @File : spiralMatrix2.py class Solution: def generateMatrix(self, n: int): matrix = [[0 for _ in range(n)] for _ in range(n)] # print(matrix) left = 0 right = len(matrix[0]) - 1 ...
f96c1fb70cbdecbd8e694e8312b8c57d3688871a
netzak75/test_3-11
/Shelve test.py
413
3.640625
4
import shelve with shelve.open('ShelveTest') as fruit: fruit['orange'] = "a sweet, orange, citrus fruit" fruit['apple'] = "a sweet fruit for making cider" fruit['grape'] = "a small, sweet fruit that grows in bunches" fruit['banana'] = "a long yellow fruit covered in a peel" fruit['cherry'] = "a smal...
9210e707e0a54cfd284538508ac5c834bb036e9b
plutmercury/OpenEduProject
/w03/task_w03e09.py
610
4.125
4
# Дана строка, состоящая из слов, разделенных пробелами. Определите, сколько в # ней слов. # Гарантируется, что в строке не встречается несколько пробелов подряд. # # Подсказка: у строк есть полезный метод count, а количество слов напрямую # связано с количеством пробелов, их разделяющих # # Sample Input: # # Hello wor...
f25487365f8e4052f95d28203a5844eac7c60206
adityamangal1/DSA-questions
/gfg/PeakElement.py
208
3.765625
4
N = 3 arr = [1, 2, 3] a = [] for i in range(len(arr)): try: print(arr[i]) if(arr[i] > arr[i+1]): print('ji') a.append(arr[i]) except: pass print(a)
a2fae60cf2162d171db406831cad6d1c35af14b4
KirillK-16/Z63-TMS
/students/shloma/001_homework_01/task_1_5.py
336
4.25
4
# Катеты прямоугольного треугольника a, b = 6, 8 # Гипотенуза треугольника c = (a ** 2 + b ** 2) ** 0.5 # Площадь треугольника s = a * b / 2 print("Гипотенуза прямоугольника:", c) print("Площадь прямоугольника:", s)
f200cabf6c91de536459558f9820668157c32549
Toetoise/python_test
/设计模式(单例).py
992
3.984375
4
''' 工厂模式:创建出的产品都有相同的特点 首先写一些基类(父类),具有相同的特点,创造出很多具有这些特点的产品,然后独有的特点 继承相同的特点的基础上再拓展就可以用工厂模式 单例模式:有些对象需要具有唯一性,可以用单例模式来实现 ''' class Zhuxi: """ 1.不管创建多少对象,内存地址是唯一 __new__魔法方法 给待创建的对象分配内存空间 返回内存地址的引用 """ instance = None init_flag = False def __new__(cls): if not cls.instance: prin...
b03282cb9349e6bbad73609dcfe369287d6fa6e6
surajbarailee/PythonExercise
/python_topics/strings.py
973
4.375
4
""" Strings in python """ string = "Hello*World!" """ H e l l o * W o r l d ! 0 1 2 3 4 5 6 7 8 9 10 11 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 """ print(string[2:]) # get every element from second index print(string[-2:]) # get every element from -2 print(stri...
d6e5a9b34c22b434c194fccdc7820ba69a3cb2d4
chengchaoyang/my-leetcode-record
/array/0075-sort-colors.py
2,868
4.1875
4
""" 给定一个包含红色、白色和蓝色,一共 n 个元素的数组,原地对它们进行排序,使得相同颜色的元素相邻,并按照红色、白色、蓝色顺序排列。 此题中,我们使用整数 0、 1 和 2 分别表示红色、白色和蓝色。 注意: 不能使用代码库中的排序函数来解决这道题。 示例: 输入: [2,0,2,1,1,0] 输出: [0,0,1,1,2,2] 进阶: 一个直观的解决方案是使用计数排序的两趟扫描算法。 首先,迭代计算出0、1 和 2 元素的个数,然后按照0、1、2的排序,重写当前数组。 你能想出一个仅使用常数空间的一趟扫描算法吗? 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/...
5a479e7ea6faba9464fbfd5d901f8dec12637f2e
Anteste/Pentesting-Notes
/Courses/TCM Security/Practical Ethical Hacking/Ressources/Python/math.py
263
3.671875
4
#!/bin/python3 # Math print(50 + 50) # add print(50 - 50) # subtract print(50 + 50) # multiply print(50 / 50) # divide print(50 + 50 - 50 * 50 / 50) # PEMDAS print(50** 2) # exponents print(50 % 6) # modulo print(50 / 6) # leftovers print(50 // 6) # no leftovers
f4b6d2bb900a1e4038a0eb838bf056af4a1a4d8f
CodingDojoDallas/python_july_2017
/david_conley/Python/checkerbox.py
122
3.75
4
row = '-'.join('+' * 8) row2 = '|'.join('#' * 8); for i in range (8,0,-1): print (row) print (row2) print(row)
6a9d022a1ed11ae3670b87ec300ab71549a9bb26
ticotheps/practice_problems
/code_signal/arcade/journey_begins/add/add.py
103
3.578125
4
def add(param1, param2): sum = param1 + param2 return(sum) print(add(1, 4)) # should print "5"
d069eac410bc45e07b9c09960f78e292ca074fac
fabianobasso/Python_Projects
/person registration - V2.0/appCadastro.py
8,125
3.5625
4
""" Programa para fazer cadastro de pessoas usando MySQL em python modulo usado para conectar no banco mysql.connector """ # Modulos importados import mysql.connector from mysql.connector import errorcode import sys ########################### # Variáveis Globais # ########################### cleanColo...
d8e3541a38b285ff4f12e793ca2f2f77e9d92717
DevByAthi/cuttingSequence
/eigenvectors.py
2,722
4.0625
4
''' eigenvectors.py Takes a given matrix, checks that it is hyperbolic, and returns the expanding eigenvector and its slope ''' import numpy as np import math from random import * #=== Function Definitions ===# ''' tests if a given matrix has a determinant of 1 ''' def detTest(matrix): print round(np.linalg.det(m...
b0c7f317561aca9d01a9905da4aafe3f2de7bfdd
alfielytorres/algorithms-data-structures
/capstones/assignment/plotting.py
1,432
3.671875
4
from matplotlib import pyplot as plt from matplotlib.pyplot import plot from regression import line, slope def label(a, b): if a!=0 and b!=0: return r'$y={a}x + {b}$' elif a!=0: return r'$y={a}x$' else: return r'$y={b}$' def linear(a, b, x_min=-1, x_max=1, points=1000, **kwargs): ...
5abea467a1e4ace5ade20daa498ed7efa59ad1ef
xiaohuanlin/Algorithms
/Leetcode/2807. Insert Greatest Common Divisors in Linked List.py
1,887
4.3125
4
''' Given the head of a linked list head, in which each node contains an integer value. Between every pair of adjacent nodes, insert a new node with a value equal to the greatest common divisor of them. Return the linked list after insertion. The greatest common divisor of two numbers is the largest positive integer...
e1e4fabf7eea714778a29496d0d5848533611ea0
saregos/ssw567
/hw1/triangle.py
1,794
3.859375
4
# -*- coding: utf-8 -*- """ Created on Wed Feb 10 19:54:28 2021 @author: weige """ import unittest def classifyTriangle(a,b,c): try: a = float(a) except: print("Input A is not a number") return "Error" try: b = float(b) except: print("Input B is not a number") ...
7865ee46fcf3671cea7bda25497adf4c8f9c53f4
A01252512/EjerciciosPrepWhile
/assignments/SumaNConsecutivos/src/exercise.py
473
4.125
4
#Escribe un método que reciba un número entero positivo n, después debe calcular la suma 1+2+3+...+n. Finalmente regrese el resultado de la suma y sea impreso en pantalla. #Entrada: Un número entero positivo n #Salida: El resultado de la suma 1+2+3...+n def main(): #escribe tu código abajo de esta línea n = in...
d26dcb3c967a74ee869bcd764e723008be7374c8
A-khateeb/Full-Stack-Development-Path
/Python/PCC/Chapter6/Glossary.py
684
4.03125
4
glossary = {"Dictionary":"Is a key-value pair structure", "del":"is a method used to delete the list or Dictionary without having any way to retrive data", "Lists":"Is an array based structure", "Tuple":"Is a list, however, the values cannot change", "pop":"is a method us...
0c8f7bccb0f59791cf7133b833d0012c69dea615
lom360/python-programming
/2) DataStructures/Week1-Strings/find.py
290
3.578125
4
text = "X-DSPAM-Confidence: 0.8475" # When accessing index. We can also use methods of the same string/array to access the index. # Line 5 is an example. 1 was added to avoid including the colon. string_num = text[(text.find(':') + 1) : ] float_num = float(string_num) print(float_num)
4b57d7961e74d8e8455cbc4c833bb106273ef51d
upputuriyamini/yamini
/76.py
141
3.640625
4
n=int(raw_input()) f=0 for i in range (1,n): if n%i==0: f=i if f>1: print 'yes' else: print 'no'
d36e92b74dbad8e42d63515b41e2a79c56937c1b
ryanvade/CS456
/Proj3/src/PriorityQueue/PriorityQueue.py
838
3.5
4
#!/usr/bin/env python3 from heapq import heappush, heappop import queue class PriorityQueue(queue.PriorityQueue): def _init(self, maxsize): self.queue = [] def _qsize(self): return len(self.queue) def _put(self, item): heappush(self.queue, item) def _get(self): return...
f95906ad0f5fd2615e5018a04dfd8418f99ae34b
qmnguyenw/python_py4e
/geeksforgeeks/python/python_all/125_2.py
2,482
4.34375
4
Python | Mean of tuple list Sometimes, while working with Python tuple list, we can have a problem in which we need to find the average of tuple values in the list. This problem has the possible application in many domains including mathematics. Let’s discuss certain ways in which this task can be performed. ...
fa97637bcf945171195fc7960e9cf1d5403055fd
torjusti/tdt4110
/assignments/2/klassifisering.py
829
4.03125
4
def wholeNumber(num): if num == int(num): return 1 return 0 def evenNumber(num): return not (num % 2) def isPositive(num): return num > 0 def compareNr(a, b): return not bool(a - b) def main(): num = float(input("Number: ")) if wholeNumber(num): print("Dette er et heltal...
778ffeb74ddaae6e0d01d15ddb73219948b30722
Team-Tomato/Learn
/Juniors - 1st Year/Suvetha Devi/day4/string_rev.py
164
4.3125
4
def reverse(word): i= -1 while i>=-(len(word)): print (word[i] ,end =" ") i-=1 str = input("Enter a string to reverse") reverse(str)
b7ac006a135cd006f47d30b1120d59f1a390cad5
RadkaValkova/SoftUni-Web-Developer
/Programming Basics Python/02 Simple_Conditions_Exam Problems/Scholarship.py
1,305
3.59375
4
import math income = float(input()) success_aver = float(input()) minimal_selary = float(input()) scholarship = 0 social_scholarship = math.floor(minimal_selary * 0.35) susccess_scholarship = math.floor(success_aver * 25) sotial_scholarship_aprooved = income < minimal_selary and success_aver > 4.50 and success_aver ...
b9d150f16ff77823ad3e651ddbb0819d94c49645
mbryant1997/mbryant1997
/atmProject4.py
5,270
3.984375
4
from datetime import datetime import random import validation import database from getpass import getpass #register # username, password, and email address #generate user account # login #username or email and password #bank operations #initialize the System def init(): now = datetime.now() print (now) print("W...
50f92fd24e6caa16e7a16187a3d06c65193f4980
enextus/python_learnstuff
/fibonacci_yield_rev.2.py
517
3.59375
4
# Eduard # die yield funktion def my_fibonacci_range(): # anfangsparameter for fib liste fibbonacci_folge = [] sequence_number = [] i = 1 # recursive fibonacci function def recur_fibo(n): if n <= 1: return n else: return(recur_fibo(n-1) + recur_fibo(n-2)) # endlose Schleife while True: fibbonacci...
34796cb1db063fcc8268f21cfa0788fbd7751b6f
inon19-meet/YL1-201718
/agario_proj.py
4,771
3.578125
4
import turtle import math import time import random from ball import Ball turtle.tracer(delay=0) turtle.hideturtle() RUNNING = True SLEEP = 0.0077 SCREEN_WIDTH = turtle.getcanvas().winfo_width()/2 SCREEN_HEIGHT = turtle.getcanvas().winfo_height()/2 MY_BALL=Ball(10,10,10,10,5,"red") NUMBER_OF_BALLS = 5 MINIMUM_BALL_RA...
6e6bbe49dc05d4acc53c00f7f371962666ea92ff
coco-in-bluemoon/baekjoon-online-judge
/CLASS 1/1157: 단어 공부/solution.py
727
3.71875
4
from collections import defaultdict def solution(word): frequency_dictionary = defaultdict(int) word = word.upper() for character in word: frequency_dictionary[character] += 1 frequency_dictionary = sorted( frequency_dictionary.items(), key=lambda x: x[1], reverse=True ) if le...
fd8bed7c139716eb8d1f6543167f8001afec4814
hjs90911/1804_Learning_MachineLearning
/Day_2/regression_basic.py
875
3.8125
4
# -*- coding: ms949 -*- from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split import mglearn import matplotlib.pyplot as plt X, y = mglearn.datasets.make_wave(n_samples=60) print(X.shape, y.shape) plt.plot(X, y,'o') # 'o' make scatter plot plt.ylim(-3, 3) plt.xlabel("f...
37750f264e542bcc75eadc01ffa81049b07b5c9b
Lancasterwu/gatorgrouper
/gatorgrouper/tests/test_absent.py
2,212
3.90625
4
"""Testing if absent.py correctly handles being absent""" from utils import remove_absent_students def test_remove_absent_students(): """Testing the remove_absent_students() function with an input that includes one absent student""" list_of_students = [ ["student1", 0, 1, 0], ["student...
08a7fffde54b101b159043394358ec0a222fd2ce
vinitjfaria/Python
/HackerEarth/Factorial.py
456
4.0625
4
'''Using the Python language, have the function FirstFactorial(num) take the num parameter being passed and return the factorial of it (e.g. if num = 4, return (4 * 3 * 2 * 1)). For the test cases, the range will be between 1 and 18 and the input will always be an integer.''' def FirstFactorial(num): fact=1 ...
12cc871475127be492e9c10aa49cc7087b4e2c51
standardgalactic/graph
/graph/graph_visualizer.py
1,165
3.765625
4
from .graph import Graph from PIL import Image import pydot import tempfile def display_graph(graph, graph_name=None): """ Generate graph image by using pydot and Graphviz Display graph image by using PIL (Python Image Library) """ graph_type = "digraph" if graph.is_directed() else "graph" pyd...
91526c2632a1b08553c35eda93279327addf79fc
KyrillosL/AlgorithmeGenetique
/classes.py
5,573
3.71875
4
''' 5 Flips puis 3 Flips puis 1 flip -> Utiliser la roulette -> Mettre à jour à chaque fois la moyenne. Au départ la même probabilité. Calculer la meilleure amélioration à chaque tout. Pour l'instant on enlève le croisement Sous forme de tableau ecart type voir photo Faire des courbes lisses en faisant la moyenne des ...
406c780d5063ef5cc85b6dda7ffb3a63ee1c8305
Immortalits/Python-fuggvenyek
/4-feladat.py
336
3.6875
4
import math sugar = input('Add meg a kör sugarát: ') def convert_to_number(sugar): r = int(sugar) return r def kerulet(r): kerulet = 2 * math.pi * convert_to_number(r) return kerulet def terulet(r): terulet = math.pi * convert_to_number(r)**2 return terulet print(kerulet(sugar)) print(t...
74b29454497d520cccec4b5b1682615a0e120be7
darrencheng0817/AlgorithmLearning
/Python/leetcode/BasicCalculatorIi.py
576
3.765625
4
''' Created on 1.12.2016 @author: Darren '''''' Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer division should truncate toward zero. You may assume that the given express...
13589da6c473552ff79b04c44dff0f9bce710caa
jnkg9five/Python_Crash_Course_Work
/Loop_Lists.py
7,853
4.5
4
#Python_List_Exercise #PYTHON CRASH COURSE Chapter#4 LISTS #What is a List? #List is a collection of elementss in a particular order. #You can put any data you want in a list. #elementss in a list don't have to be categorically related. ex. Integers, Strings, Floatpoints #In Python, a list is contains in square brack...
8f6f65e1d48ee45e1d3e7e1389a304ad2e135a95
macavas/PythonRainCode
/PyGameRain.py
1,042
3.71875
4
import pygame import random width = 1080 height = 720 class Drop: x = 0 y = 0 dropWidth = 3 dropHeight = 15 vel = 3 def fall(self): self.y += self.vel if self.y > (height): self.y = random.randint(0,height)-height pygame.draw.rect(win, (55,55,255), (self.x, self.y, self.dropWidth, self....
978cfd8fbcbb72c68846e58fc077abd904ddd72d
itsvinayak/algorithms
/algorithms/arrays/random_array.py
661
4.34375
4
""" Given a array/list , return a randomly shuffle array/list this is implementation of "Fisher–Yates shuffle Algorithm",time complexity of this algorithm is O(n) assumption here is, function rand() that generates random number in O(1) time. Examples: Given [1,2,3,4,5,6,7], [5, 2, 3, 4, 1] Given [1,2,3,4,5,6,7], [1,2,...
789f5173020de042a83dba98db2768ed37e13baf
FlamesSpirit/FlamesSpirit
/SYRACUSE PROBLEM.py
485
4.09375
4
def even(num): reamainder = num % 2 if reamainder == 0: even = True elif reamainder == 1: even = False return even # 3 * x + 1 y = int(input("num: ")) x = y print(even(x)) while x > 2: if x < 2: break while even(x) == True: if x < 2: ...
6843d17548fff08011f0aff5733325cd0b0233f3
Kunal2700/Tic-Tac-Toe
/tictactoe.py
3,803
4.0625
4
""" Tic Tac Toe Player """ import math, copy X = "X" O = "O" EMPTY = None def initial_state(): """ Returns starting state of the board. """ return [[EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY]] def player(board): """ Returns player who has the...
2d6f6f6d0c01b057c6dad67a94ce9bad6817971a
Narendrasinghks2020/python
/multiplication.py
101
3.984375
4
a=input("enter number a:") b=input("enter number b:") c=a*b print "multiplication of two numbers:",c
076caa5b6f0b933c21e83202488d01201b0c2e8b
khushboomehla33/Facebook-Text-Based-Captcha
/what.py
1,069
4.0625
4
from tkinter import * def what1(): root=Tk() head=Frame(root,width=1366,height=45,bg='#3b5998') head.place(x=0,y=0) heading=Label(head,text="What is Captcha?",bg='#3b5998',fg='white',font=('Segoe UI',20,'bold'),justify="center") heading.place(x=5,y=5) text = Label(root, text='\nCAPTCHA is...
823d8f79d90a4b3224c279c9e3c458abc8fbd1c2
Audarya07/Daily-Flash-Codes
/Week5/Day2/Solutions/Python/prog2.py
153
4.125
4
num = int(input("Enter octal number:")) base = 1 rem = 0 while num: rem += (num%10)*base num//=10 base *= 8 print("Decimal number:",rem)
b290ea5c8aa63592924f54a999eaa451267256f3
yu-11-22/python_training
/set-dictionary.py
835
4.03125
4
# 集合的運算 s1 = {3, 4, 5} print(3 in s1) print(10 not in s1) s2 = {4, 5, 6, 7} s3 = s1 & s2 # 交集,兩個集合中,相同的資料 print(s3) s4 = s1 | s2 # 聯集,取兩個集合中的所有資料,但不重複取 print(s4) s5 = s1-s2 # 差集,從s1中減去s2重疊的部分 print(s5) s6 = s1 ^ s2 # 反交集,取兩個集合中,不重疊的部分 print(s6) s = set("Hello") # set(字串),把字串中的字母拆解成集合 print(s) print("H" in s) # 字典的...
0552e6d3292512ce43b913ca0ad45f8554c16a74
guilhermebaos/Curso-em-Video-Python
/1_Python/Desafios/093_Informação_jogador_futbol.py
860
3.703125
4
info = dict() total = 0 info['nome'] = str(input('Nome do jogador: ')).strip() while True: jogos = str(input('Número de jogos jogados: ')).strip() if jogos.isnumeric(): jogos = int(jogos) break else: print('Escreve só o número!\n') info['golos'] = [] for c1 in range(0, jogos): wh...
dbcdf1a6f3c7fd1f48817cce89a059cc329a6357
gabrielaraujo3/exercicios-python
/exercicios/ex16.py
137
3.734375
4
import math n1 = float(input('Digite um valor: ')) ni = math.trunc(n1) print('A porção inteira do número digitado é {}.'.format(ni))
43dc2a11a1dc6558bd95ab0a942fb9d33707e7e5
schappidi0526/IntroToPython
/4_1_loops.py
1,156
4.09375
4
#forloop numbers = range(0,11) for number in numbers: print (number) #while loop Numbers=[1,2,3,4,5,6,7] print (len(Numbers)) indexid=0 while indexid<len(Numbers): print (Numbers[indexid]) indexid=indexid+1 # Find all the odd numbers between 1 and 20. Append them to a string with spac...
04cba82e9f81dc9e5b7ec8b544cba43fa059e93e
joenco/simredop
/funtion.py
1,870
3.515625
4
#! /usr/bin/env python # -*- coding: utf-8 -*- # funciones para el simulador experimental de redes completamente opticas # Autor: Marielb Marquez - Jorge Ortega # Cotutor: Andrés Arcia-Moret # # -*- coding: utf-8 -*- def crearmalla(n): n = n a = [] l = 0 t=k = 0 nodos = 2*n-1 for j in range(nodos): l...
0a92c53b9165af7dc226c42fc40b7f901907d464
vardhan-duvvuri/Challange
/ch22.py
231
3.84375
4
def countLetters(word): letters = [] for i in word: letters.append(i) letters = set(letters) output = {} for i in letters: output[i] = word.count(i) return output if __name__ == "__main__": print countLetters('google')
722732060e57294fc203928595b526a8da3c338a
ansh-arora/assignments
/assignment-18.py
1,178
3.953125
4
#Q1 from tkinter import * # main= Tk() # Label(main, text='Hello World!').pack() # Button(main, text='Exit',command= sys.exit, activeforeground='red' ).pack() # mainloop() #Q2 # def press(): # print('hiii') # Label(main, text='Hello Again !!').pack() # main= Tk() # Label(main, text='Hello World!').pack() # But...
fd7e7ecc4634ada5cd7cd539d9845a532e9cb368
mobai-du/DPJ-1
/Demo/Demo/while循环.py
157
3.515625
4
count = 0 while count <= 100: if count == 50: pass else: print(count) if 60 < count < 80: print(count*count) count+=1
1fb76083eeef473b8afaa9f791f06f40c49a4782
SONGjiaxiu/CS-111
/binary search.py
1,428
4.0625
4
# Binary Search ["bob","joe","alice"] def linearSearch(list,target): for index in range(len(list)): return index return -1 """ say you have to guess a number between 1-100 and the number is 60: 1st guess: 50 2nd guess: 75 3rd guess: 63 4th guess: 56 5th guess: 60 take the middle of either the ...
c12333009fa3f30e9cd75c6c257a38562b7d3ad1
GenryEden/kpolyakovName
/3689.py
424
3.921875
4
from math import isqrt def isPrime(x): if x == 1: return False if x == 2: return True if x % 2 == 0: return False for i in range(3, isqrt(x)+1, 2): if x % i == 0: return False return True def toCountSystem(x, y): ans = '' while x: ans += hex(x % y)[2:] x //= y return ans[::-1] s = 0 for x in ...
1333386f0e9952be02aa6bf30ac4560c290a6955
rayga/Python-Script
/linkto.py
357
3.53125
4
# Script for grabbing link in a website __author__ = 'n4rut0' import urllib from bs4 import BeautifulSoup url = raw_input("Enter hostname target : ") u = "http://" uri = u + url read_page = uri.read() parser = BeautifulSoup(read_page, "html.parser") print parser.title print parser.title.text for link in parser.find_a...
44026365aa9b148f102a065915ae7dd48c0442bd
ravisjoshi/python_snippets
/DataStructure/StackAndQueue/stack_balancedParentheses.py
1,087
3.84375
4
""" Given an expression string exp , write a program to examine whether the pairs and the orders of “{“,”}”,”(“,”)”,”[“,”]” are correct in exp. {[]{()}} - Balanced [{}{})(] - Unbalanced ((() - Unbalanced """ class checkParentheseseBalance(): def __init__(self): self.items = [] def push(self, item): ...
4f606534d8e41729e6ea3572240319cd4df374c2
wbreen/PythonWork
/quiz2/Quiz2.py
838
3.875
4
# -*- coding: utf-8 -*- """ William Breen Programming languages quiz 2 """ testOne = {'x':1, 'y':2, 'z':3} testTwo = {'x':1, 'y':2, 'z':2} def invertDictionary(oldDict): invertedDic = {} for key in oldDict: newKey = oldDict[key] newVals = key if newKey in invertedDic: inDic...
e2adf9f0e9e1ac235b73515f28228de82dc9948e
sequix/8digits
/astar.py
854
3.875
4
#!/usr/bin/env python3 # -*- coding: utf8 -*- from board import Board from reader import Reader from utils import first_board from priority_queue import PriorityQueue reader = Reader() used = set() board_goal = Board(first_board) que = PriorityQueue(key=lambda board: board.priority) initial_board = reader.read_board...
aabef8e3365bbb3f70ffb08103b118f1ffd69d1e
rahul-krupani/foobar
/Level 3/fuel-injection-perfection.py
247
3.53125
4
def solution(n): i = 0; n = int(n) while n != 1: if n%2==0: n = n//2 elif n==3 or n%4==1: n -= 1 else: n += 1 i += 1 return i print(solution('15'))
6f80e95b19b781b1c6438745882a164833d05320
asiftandel96/Object-Oriented-Programming
/Annotations/Basic Annotation.py
5,120
4.40625
4
"""Annotations Annotations were introduced in Python 3.0, originally without any specific purpose. They were simply a way to associate arbitrary expressions to function arguments and return values. Years later, PEP 484 defined how to add type hints to your Python code, based off work that Jukka Lehtosalo had done on h...
0dc02b1ec77d41420414a605050252cfaab720d2
0212Infinity/PythonExercises
/day08/property.py
322
3.59375
4
class Student: # 类属性 name = 'liming' def __init__(self, age): # 实例对象 self.age = age pass obj = Student(17) print(obj.name) print(obj.age) print(Student.name) # 类属性可以 被类对象和实例对象共同访问使用 # 实例属性只能 由实例对象所访问
f12e3d106ac87cc9996e5e948280aee77d2a3ed7
ARWA-ALraddadi/python-tutorial-for-beginners
/12-How to do more than one thing Demos/I_savings_account.py
2,013
4.59375
5
###################################################################### ## ## Demonstration - Using superclass methods ## ## This demonstration shows how a subclass can use methods from ## the superclass to define its own methods ## ###################################################################### # # As an ...
b4418e366e43cae36a12b15128abbfd6335ebefa
skinder/Algos
/PythonAlgos/Done/dict_test.py
121
3.546875
4
a = {'A':[], 'B':0, 'C':''} lst = ['o','b'] for i in lst: a['A'].append(i) a['B'] += 1 a['C'] += i print(a)
cf0e0e53dc6e318c8bf3597bd126d447d63d3d0a
wafasa/soal-kerja
/kmklabs/kmk2.py
380
3.734375
4
# menghitung Leveinsthein Distance def measure(str1, str2): if len(str1) != len(str2): return -1 else: dif = 0 for i in range(len(str1)): if str1[i] == str2[i]: dif = dif + 0 else: dif = dif + 1 return dif print ...
95e7809cf0fc88977e1891bdf040df2b0aae258f
green-fox-academy/nandormatyas
/week-04/day-01/fleet_of_things.py
431
3.59375
4
from fleet import Fleet from thing import Thing fleet = Fleet() todo = ["Get milk", "Remove the obstacles"] completed=["Stand up", "Eat lunch"] for i in todo: x = Thing(i) fleet.add(x) for j in completed: y = Thing(j) y.complete() fleet.add(y) #Thing(fleet) # Create a fleet of things to have ...
d7ac335d94f57dd3f92889784bed1c06ce052bf3
Ganesh2611/guvi_python
/natural.py
76
3.578125
4
v=int(input()) sum2 = 0 while(v > 0): sum2=sum2+v v=v-1 print(sum2)
d16699215ccbb2fea8f45821b9f5b7632efaa4ad
franklingu/leetcode-solutions
/questions/word-break-ii/Solution.py
1,711
3.96875
4
""" Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences. Note: The same word in the dictionary may be reused multiple times in the segmentation. You may assume ...
8e3ea927b7ef763d7bb96c7e9dcee22bf6299dd3
abhishek-coding-pandey/pycode
/full calculator.py
393
4.0625
4
print("this is my cal") print("enter your first number") n1=int(input()) print("enter you oprehend ") op=input() print("enter your second number") n2=int(input()) if op=="+": print("your answer is ,",int(n1)+int(n2)) if op== '-': print("your answer is",int(n1)-int(n2)) if op=="*": print ("your answer is ",i...
f76aeafd3053d1ca776a6cb1600f5aa7383f1702
jungmkitLez/algorithm_study
/프로그래머스/이분탐색/징검다리/stones.py
699
3.5
4
from collections import defaultdict def solution(distance, rocks, n): answer = 0 sorted_rocks = [0] sorted_rocks.extend(sorted(rocks)) sorted_rocks.append(distance) diffs = [] for i in range(len(sorted_rocks)-1): diffs.append(sorted_rocks[i+1] - sorted_rocks[i]) value_indexes = ...
8238662ee69f4abc9a0973bcebf673153df9f3fb
zeddinarief/progjar2018
/kelasc/coba.py
143
3.78125
4
jumlah = input("Masukkan jumlahnya : ") for i in range(1,int(jumlah)+1): for j in range(1,i+1): print("* ", end='') print(" ")