blob_id
stringlengths
40
40
repo_name
stringlengths
5
119
path
stringlengths
2
424
length_bytes
int64
36
888k
score
float64
3.5
5.22
int_score
int64
4
5
text
stringlengths
27
888k
10949ce8f3308b139f862b3b1a82f93eed48d400
ivanfretes/hackerrank
/Interview Preparation Kit/Warm-up Challenges/sock_merchant/sock_merchant.py
692
3.796875
4
#!/usr/bin/python3 def sockMerchant(n, arr): # Ordenar Medias arr.sort() # Otra caja con las etiquetas, vacia array_contador = {arr[i] : 0 for i in range(n - 1) if arr[i] != arr[i+1]} array_contador[arr[n - 1]] = 0 # Contando y asignado la cantidad a la etiqueta for i in range(n): ...
54ac2294c2ba5da6e6266ccbe48288efc6a87676
julianmichael/qasrl-modeling
/qasrl/common/span.py
4,027
3.671875
4
from typing import List from functools import total_ordering @total_ordering class Span: def __init__(self, start : int, end : int) -> None: assert start <= end, "The end index of a span must be >= the start index (got start=%d, end=%d)"%(start, end) self._start = start self._end = end ...
bf667540ba625a303d368e36926cd0935c79e542
mkhoin/analyticstool
/part1/python/Week3/04_sort.py
567
3.6875
4
from collections import Counter brands = ["cosrx","klairs","skinmiso","klairs","c21.5","klairs","skinmiso"] brands_count = Counter(brands) # {"cosrx":1, "klairs":3} sorted_brand = sorted(brands_count.items(), key=lambda (brand,count):count, reverse=True) for brand,count in s...
5584fe77b43a55a33a884c79b4675b97b043e4f2
bc2009/eli5
/eli5/sklearn/utils.py
5,616
3.625
4
# -*- coding: utf-8 -*- from __future__ import absolute_import from typing import Any import numpy as np from sklearn.multiclass import OneVsRestClassifier from eli5._feature_names import FeatureNames def is_multiclass_classifier(clf): # type: (Any) -> bool """ Return True if a classifier is multiclass ...
783694eb48ae5f6999f4c256150baa79d92b46dd
rahulraikwar00/DSA
/Python/tree.py
2,188
3.78125
4
class Tree(): def __init__(self, root, children = None): self.root = root if children: self.children = [child for child in children] else: self.children = [] def AddChild(self, child): self.children.append(child) def GetRoot(self)...
4613873af3d6f39760d1bc575be417ff7a51dadb
rizkyanugrahp/Belajar_Python
/00 -Template/tipeData.py
1,033
3.625
4
## tipe data # tipe data: angka satuan/tidak berkoma(integer) data_integer = 10 print("data :", data_integer) print("- bertipe : ", type(data_integer)) # disini diketahui bahwa di python tipe data integer akan # otomatis atau tidak perlu di deklarasikan. #tipe data: angka dengan koma (float) data_float = 1...
c9c01a9fb5ab456a653f77dcd61d63dccf39c1f1
dephrase/CodeClanCaraoke
/tests/bar_tests.py
4,695
3.53125
4
import unittest from classes.bars import Bar from classes.drinks import Drink from classes.guests import Guest from classes.rooms import Room class TestBar(unittest.TestCase): def setUp(self): self.bar = Bar("Main Bar") def test_bar_has_name(self): self.assertEqual("Main Bar", self.bar.name) ...
f59448c1f3c5dabcacaa8d85f9eefe90c8bdc490
Computer-engineering-FICT/Computer-engineering-FICT
/I семестр/Програмування (Python)/Лабораторні/Братун 6305/Labs/LABA1(ASD).py
607
3.875
4
import math a = float(input("input a=")) b = float(input("input b=")) c = float(input("input c=")) if a==0: if b==0: print("x=",(-c/b)) else: if c==0: print("infinite number of roots") else: print("no roots") else: d=b*b-4*a*c if d >= 0: ...
4c8c76c636a63c0e416c317d402b30aaa86339d8
cornu-ammonis/programming_puzzles
/big_small/small.py
177
3.640625
4
def bigSmall(nums): m = 10 r = min(nums) for x in nums: t = len(str(abs(x))) if t <= m: m = t if x > r: r = x return r nums = [1, 2, 3] print(bigSmall(nums))
0682217f144d33885bd7df2568b000bfb08115f7
Hasibur-R/Python_class
/prac_9.py
505
3.984375
4
a = int(input()) b = int(input()) if a > 0 and b > 0: print("The coordinate point (", a, b, ") lies in the First quadrant") elif a < 0 and b > 0: print("The coordinate point (", a, b, ") lies in the Second quadrant") elif a < 0 and b < 0: print("The coordinate point (", a, b, ") lies in the Third q...
603f205e67e6261681d05eb5afd0ebdf54325469
SakshamSinha/Flappy-Bird-AI
/q-net/qNet.py
1,719
3.5625
4
""" Neural network using Keras (called by q_net_keras) .. Author: Vincent Francois-Lavet """ import numpy as np from keras.models import Model from keras.layers import Input, Layer, Dense, Flatten, merge, Activation, Conv2D, MaxPooling2D, Reshape, Permute class NN(): """ Deep Q-learning network using Keras ...
7f63be582c6636c5abb2f776ac6e019102a7585e
lukenew2/nfl-draft
/web_scraping.py
2,945
3.625
4
import lxml as lxml from bs4 import BeautifulSoup from requests import get import os import pandas as pd # The base url where the data we desire is located BASE_URL = "https://www.fantasypros.com/nfl/adp/ppr-overall.php" # Header which allows our webscraper to appear more human headers = ({"user-agent": "Mozilla/5.0 (...
3e200e40518855cc2a0243edb25e14ca95bceaed
gondsuryaprakash/Python-Tutorial
/Python /List.py
200
3.953125
4
# Insert in List List=[1,2,3,4] List.insert(3,14) print(List) List.insert(0,"Geeks") print(List) # Append # Append at last List.append("s") print(List) # Deleting the list a=List.pop() print(List,a)
6facef8182b28c282bef012207970eccf00da527
wkwjsrj88/DSSG2017
/dataProcessor.py
11,805
3.640625
4
import csv import re dateList = [] # This reads finished tweet data to readable csv for R program # The the key for the aggregation is date where the tweet happened # Parameter - filname : list of string, # - writename : string, # Return - None, saves the processed data as outputname in csv def Proces...
413922061b4b4d39bceb47cebaf82bcd880b000d
uponup/MyPython
/python爬虫/15、MySql数据库.py
847
3.8125
4
import pymysql # 1、连接数据库 db = pymysql.connect("localhost","root","gaojinpeng","TESTDB") # 2、获取cursor来操作数据库 cursor = db.cursor() # 3、创建数据表 # sql = """create table if not exists beautyGirls ( # name char(20) not null, # age int)""" # cursor.execute(sql) # 4、插入数据 sql = """INSERT INTO beautyGirls( name...
dd29c1c651b4f2ff45addb52bb0060d3d0ed640b
xCrypt0r/Baekjoon
/src/17/17362.py
421
3.921875
4
""" 17362. 수학은 체육과목 입니다 2 작성자: xCrypt0r 언어: Python 3 사용 메모리: 29,380 KB 소요 시간: 68 ms 해결 날짜: 2020년 9월 13일 """ def main(): x = int(input()) % 8 if x == 1: answer = 1 elif x in [2, 0]: answer = 2 elif x in [3, 7]: answer = 3 elif x in [4, 6]: answer = 4 elif x == 5: answer = 5 print(answer) ...
6724d61cc018556e22ea88f0617f66c72697aa35
phoomct/Comprohomework
/combineString.py
268
3.609375
4
""" combineString """ def main(): """ Write a Python program to get a single string from two given strings, s eparated by a space and swap the first two characters of each string. """ data = input() data2 = input() print(data2 +" " + data) main()
77ed70eaacd6d64fe88edcd43b3e316045505d72
serenastater/learningPython
/firstFileParser.py
764
4.0625
4
# Write a program that prompts for a file name, then # opens that file and reads through the file, looking # for lines of the form: # X-DSPAM-Confidence: 0.8475 # Count these lines and extract the floating point # values from each of the lines and compute the average # of those values and produce an output as shown ...
941460dd81035e374ac1d06239581648fda0c3c1
lzw98/leetcode_exercise
/leetcode算法/string_decode_394.py
1,741
3.90625
4
#!/usr/bin/env python # -*- coding:UTF-8 -*- # AUTHOR: Zhenwei Lin # DATE: 2020/05/28 Thu # TIME: 09:52:51 # DESCRIPTION: ''' 自己的这种写法应该只能解循环套用的[] ''' # class Solution(object): # def decodeString(self, s): # """ # :type s: str # :rtype: str # """ # def get_string(s): # ...
42e7dcab43d231600d6aa201e315c9eeb291c01a
dskeshav/python_practise
/python_programming_exercise/5_sample_project/DicerollingSimulator.py
422
3.953125
4
import random def roll(sides): dice_roll=random.randint(1,sides) return dice_roll def main(): sides=6 rolling=True while rolling: roll_again=input("Ready to ROLL? Roll=Enter, Q=Quit. ") if roll_again.lower()!='q': num_rolled=roll(sides) print("You rolled a "...
36e09b4f8d9bd3fe42960b2a8dd1eeadd6e68ecb
EarthChen/LeetCode_Record
/newcoder_offer/verify_squence_of_BST.py
990
3.765625
4
# 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果。 # 如果是则输出Yes,否则输出No。假设输入的数组的任意两个数字都互不相同 class Solution: def VerifySquenceOfBST(self, sequence): length = len(sequence) if length == 0: return False if length == 1: return True # 数组的最后元素是该树的根节点 root = sequence[-1] ...
c081bee0c7ec2139300de5d2547b69ebabb7e30a
Roberto-Mota/CursoemVideo
/exercicios/ex076.py
1,046
3.84375
4
# Desafio 076 -> C. um programa que tenha uma tupla única com nomes de produtos e seus respectivos preços, na sequência. # No final mostre uma listagem de preços, organizando os dados em forma tabular # ----------------- # Lista de preços # _________________------ # Produto1......R$ 1.90 # prod2...........
9ed79d7c7e3ee7ce9f7f05f0ac4f900b499edd1e
vnikhila/PythonClass
/sample.py
2,507
3.5625
4
def CheckCondition(tt,gameover): #------Checking if game is won--------- for i in range(3): #--------Condition for rows--------- if str(tt[i][0]) == str(tt[i][1]) and str(tt[i][0]) == str(tt[i][2]): if tt[i][0] == '*': print('Player1 won the game') gameover = 1 break else: print('Player2 won...
d0dc11bd47e830a2571b4bf702d66af99fdb4b8f
aastha-2014/codeforces-1
/round-70/A.py
271
3.5
4
l1 = raw_input() l2 = raw_input() l3 = raw_input() lines = [l1, l2, l3] vowels = ['a', 'e', 'i', 'o', 'u'] c = [0, 0, 0] for i in range(0, 3): for ch in lines[i]: if ch in vowels: c[i]+=1 if c == [5, 7, 5]: print "YES" else: print "NO"
7f0696fb47220564f36ada8fec3b2a15ed82b563
Omar7102/Ejercicicos-clase-15-abril-de-2020
/GradoscentigradosaFahrenheit.py
220
3.8125
4
#Programa que convierte los grados centigrados ingresados por un usuario en fahrenheit. c=int(input('Digite los grados centigrados\n')) f=(c*1.8)+32 print( c,'grados centigrados','son:', round (f), 'gradosfahrenheit')
5c7887de29a7b6a6f1b07d2c98900e4f8be1f482
Enio199/Python1
/Exercicos de trinamentos/ex079.py
373
3.9375
4
lista = [] while True: n = (int(input('digite um número '))) if n not in lista: lista.append(n) print(f'valor {n} adicionado a lista com sucesso') else: print(f'valor {n} já foi adicionado.') r = str(input('deseja coontinuar? [S/N]: ')).lower() if r == 'n': break list...
81c496fafeda0ac70f159491b64b2d224ad4e79f
DentiQ/CodeTest
/week12/day2/11034.py
1,040
3.515625
4
""" https://www.acmicpc.net/problem/11034 캥거루 세마리2 문제 캥거루 세 마리가 사막에서 놀고 있다. 사막에는 수직선이 하나 있고, 캥거루는 서로 다른 한 좌표 위에 있다. 한 번 움직일 때, 바깥쪽의 두 캥거루 중 한 마리가 다른 두 캥거루 사이의 정수 좌표로 점프한다. 한 좌표 위에 있는 캥거루가 두 마리 이상일 수는 없다. 캥거루는 최대 몇 번 움직일 수 있을까? 입력 여러개의 테스트 케이스로 이루어져 있으며, 세 캥거루의 초기 위치 A, B, C가 주어진다. (0 < A < B < C < 100) 출력 각 테스트에 대해 캥...
bd905856cb778fa779449db8826a966a5ea43616
averycordle/csce204
/exercises/jan14/turtle_intro.py
290
3.828125
4
#Author: Avery Cordle import turtle turtle.bgcolor("skyblue") pen = turtle.Turtle() pen.pensize(5) #draw a circle pen.circle(30) pen.up() pen.setpos(100,200) pen.down() pen.circle(40) #draw a square pen.up() pen.setpos(-100,100) pen.down() pen.forward(100) turtle.done()
efb6c408dde4008f9ae13be10ba83e25e8f20097
Rohitp/algorithms
/path.py
939
3.625
4
import numpy as np import time start = time.time() BOARD_SIZE = 6 def canKnightBePlaced(board, x, y, knight, moves): return not ( x < 0 or x >= BOARD_SIZE or y < 0 or y >= BOARD_SIZE or (board[x][y] > 0) ) def tour(board, knight, moves, x, y): if(knight >= BOARD_SIZE * BOARD_SIZE): return Tru...
2f73dc172ad2614d81a3ead9deff5a2ea8bfb944
masci/playground
/cstutoring/040.py
1,302
3.90625
4
""" By the famous binomial theorem, we can develop Pascal's Triangle. Here is the first 5 rows of the famous triangle: 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 ...... A few things to observe; the first and last numbers of each row is 1. To calculate the other numbers, it is simply the sum of the a...
6c0ccf9787c9778492edb5cd4b9a4fa4643033da
PratikshaPP/Leetcode-Problem-Solving-
/houserobber.py
818
3.53125
4
# Time Complexity : O(N) # Space Complexity : O(1) # Did this code successfully run on Leetcode : Yes # Any problem you faced while coding this : No # Your code here along with comments explaining your approach Used two temporary variables to calculate the repeated subroblems and finally reused them to form the solut...
de2ca9481a4ed43a2268f6309ffa4dbb27bc205b
CamiloBallen24/Python-PildorasInformaticas
/Script's/16 - Decoradores/Decoradores 02.py
1,401
3.953125
4
#TEMA: Decoradores #Funciones que a su vez añaden funcionalidades a otras funciones ###################################################################### def funcionDecoradora(funcionParametro): def funcionInterior(*args, **kwargs): #Aciones adicionales que decoran print("Vamos a realizar un calculo") #Fu...
4f4a7a2e4db9ed6c307a1978dc1d1f55b9744eec
thaisps/AprendendoPython
/Ex_06.py
262
4.15625
4
# -*- coding: utf-8 -*- # Exercício 06 # Faça um programa que imprima na tela os números de 1 a 20, um abaixo do outro. # Depois modifique o programa para que ele mostre os números um ao lado do outro. x= list(range(1,21)) for i in x: print(i) print(x)
4d2ed39ff0e1b8944000d6aa3f08242ec2c11bf3
MikhailChernetsov/python_basics_task_1
/Hometask8/ex1/main.py
2,025
3.828125
4
''' 1. Реализовать класс «Дата», функция-конструктор которого должна принимать дату в виде строки формата «день-месяц-год». В рамках класса реализовать два метода. Первый, с декоратором @classmethod, должен извлекать число, месяц, год и преобразовывать их тип к типу «Число». Второй, с декоратором @staticmethod, должен ...
dde5331e5538e7c5a19879395cd7c5ea2543c8f5
robmlong/git_lesson
/src/my_square.py
245
3.9375
4
def my_square(y): """takes a value and returns the square value uses the *** operator""" return(y ** 2) def my_square2(x): """uses the * operator square """ return(x * x) print(my_square(42)) print(my_square2(24))
cbd4ab0b94c1c98e6931498a5ae5f721b901adc1
taehee-kim-dev/Problem-solving
/Programmers/Kakao/Level3/2020_KAKAO_INTERNSHIP/Gems_shopping.py
4,255
3.578125
4
""" 보석 쇼핑 """ def insert_gem_of_end_number(gems, gems_dict, end_number): # 현재 끝 진열대 번호에 해당하는 보석을 # gems_dict에 추가한다. if gems[end_number] in gems_dict: # 기존에 해당 보석의 종류가 존재했으면 갯수만 1 증가시키고, gems_dict[gems[end_number]] += 1 else: # 아예 없었으면 새로 추가한다. gems_dict[gems[end_number]...
b23e6304b34cccc05d7293fa54f525027a6880a9
Abdelrahman44/facially-edge
/src/facially/lib.py
225
3.765625
4
def generate(message: str) -> str: """Generate a string with 'Hello message' format. Args: message: A string to be added. Returns: Generated String. """ return 'Hello {}'.format(message)
10857274804d3421caec556f7fba2af091f1d95e
nikhil-nividata/python-practise
/matrix_problems/add_matrix.py
489
3.78125
4
X = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ] Y = [ [9, 8, 7], [6, 5, 4], [3, 2, 1] ] def add_matrix(a, b): result = [] for i in range(len(a)): n = [] for j in range(len(a[i])): n.append(a[i][j] + b[i][j]) result.append(n) return r...
580f9cbf26bf279ea4e82536f3fc2189cc627ed1
edumaximo2007/python_remembe
/Desafio007.py
571
3.75
4
import emoji print('=-='*10) print('''\033[7m DESAFIO 007 \033[m''') print('=-='*10) print(emoji.emojize(''':bulb: \033[1mDesenvolva um programa que leia as duas notas de um aluno, calcule e mostre a sua média.\033[m''', use_aliases=True)) print('') print('\033[7mMÉDIA ARITMEETICA\033[m') print('') n...
9daf7f27aa6f5bab3b71361f0d9e1fa0abe27d6e
rojaboina/Python
/python_basics/if_exists.py
590
4.125
4
#passing the values through a list to check if they exist in a dictionary favourite_languages={ 'Roja':'Python', 'Arun':'sales force', 'Kyathi':'RPA', 'Aadhya':'Arts' } for names,languages in favourite_languages.items(): print(names.title() + " 's favourite language is " + languages.title()) print("\n") coders=...
c8d76d6b60e96019435628104d7c6a51600fe24f
MisaelAugusto/computer-science
/programming-laboratory-I/7p5n/trauma.py
1,125
3.734375
4
# coding: utf-8 # Aluno: Misael Augusto # Matrícula: 117110525 # Problema: Hospital de Trauma def cadastra(fila, nome, prioridade): nomes.append(nome) for i in range(len(prioridade)): for i in range(len(prioridade) - 1): if prioridade[i] < prioridade[i + 1]: prioridade[i], prioridade[i + 1] = prioridade[i +...
ebceb50c95496297234e044262e308ffe8c4d65f
muhammadbahrul532/LINIER-REGRESI-PREDIKSI-HARGA-RUMAH-AREA-SURAKARTA-JULI-2020
/Prediksi Harga Rumah.py
5,018
3.859375
4
#PREDIKSI HARGA RUMAH DI AREA SURAKARTA """ PERHATIAN!! 1. Karena jumlah independent variable (x) lebih dari 1 maka menggunakan Multiple Linear Regression 2. Rumusnya Y = b + e + m1*x1 + m2*x2 + … + mn*xn 3. Install terlebih dahulu semua library yang dibutuhkan, caranya buka cmd>pip instal ........ """ import pa...
200539392f4ffa10eaf17cd7da8dece0f17541ea
teamtechsupport/techsupport
/ALLINONE/annealing_decryption.py
3,782
3.75
4
# http://katrinaeg.com/simulated-annealing.html # http://www.theprojectspot.com/tutorial-post/simulated-annealing-algorithm-for-beginners/6 import decrypt import requests import string import random import math import re class ngram_obj(object): def __init__(self, ngrampaste): # runs on object creation s...
72a3bf550bd17c7d07a4ff741c32d3dec3d353d2
duskybomb/PyQt-tutorial
/FirstProgram/simple.py
567
3.5
4
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ ZetCode PyQt5 tutorial In this example, we create a simple window in PyQt5. Original Author: Jan Bodnar Author: Harshit Joshi Website: harshitjoshi.in """ import sys from PyQt5.QtWidgets import QApplication, QWidget if __name__ == '__main__': # application objec...
517a10061ad327b48087f0507b2f2d5bf8b7eb29
lyonbach/Dynamic-Programming
/count_construct.py
1,870
3.953125
4
""" Python implementation of the seventh and the fifteenth chapters' code. Original videos can be viewed from the following link: https://www.youtube.com/watch?v=oBt53YbR9Kk """ # Seventh Chapter def count_construct(target: str, word_bank: list): """ Returns number of ways that target string can be constructe...
284bfa991da3ff87c6f4d141c1a7b313b3b57f63
sulei1324/Algorithm
/bubble.py
741
3.875
4
__author__ = 'Su Lei' def swap1(n, l): t1 = l[n] t2 = l[n+1] t3 = t1 t1 = t2 t2 = t3 l[n] = t1 l[n+1] =t2 pass def swap2(n, l): t1 = l[n] t2 = l[n+1] t1 = t2 - t1 t2 = t2 - t1 t1 = t2 + t1 l[n] = t1 l[n+1] = t2 def swap3(n,l): t1 = l[n] t2 = l[n+1]...
1c095f2b2c42ce0bd3800f53c07c769898e26924
MMVonnSeek/Hacktoberfest-2021
/Python-Programs/Move_all_negative_numbers_to_beginning_and_positive_to_end_withconstant_extra_space.py
351
3.828125
4
def rearrange(a): negative = 0 positive = 0 while positive < len(a): if a[positive] < 0: a[positive], a[negative] = a[negative], a[positive] positive += 1 negative += 1 else: positive += 1 return a arr = [-2, -3, 4, 5, 6, -7,...
220f10b5f7ffe24278fe29b9e9e0163a0afc1052
vlad4400/diff_code
/fan_python_2/litle_part_of_code [2016]/frequent_6.py
1,097
3.71875
4
def find_most_frequent(text): text = text.lower() err = ',.:;!?- ' FlagNoSpace = True newtext = '' d = {} for singl in err: text = text.replace(singl, ' ') if text == '': return [] while text[len(text) - 1] == ' ': text = text[:len(text...
a9ae2b23379844d39af484f45cd9054b0f8235aa
dodecatheon/sudoku-password-card
/simple_grid.py
778
3.90625
4
#!/usr/bin/env python """ Just print a 9 x 9 grid of strong passwords """ from string import ascii_uppercase, ascii_lowercase, digits, punctuation from random import choice, shuffle def strong_password(): # Return an 8 character string with # two upper case ascii, # three lower case ascii, # for a sum of 5 asc...
bd5e2a3a83db2eb721526494fbfd0243a980516f
FronTexas/Fron-Algo-practice
/code_fight_climb_staircase_backtrack.py
1,025
3.859375
4
''' n steps k steps jump n k 1 step or 2 step or 3 step .... k step [ , , , , , , , , , , x, , , ...... , , , answers = [[....],[....]] ''' ''' n = 4 k = 2 1 1 2 ''' def climbingStaircaseRecursive(n,k,current_answer,level,answers): if level == n: ...
e9b54f275517b9fd7ea333b561841340275477a2
snpushpi/P_solving
/994.py
2,130
3.640625
4
''' In a given grid, each cell can have one of three values: the value 0 representing an empty cell; the value 1 representing a fresh orange; the value 2 representing a rotten orange. Every minute, any fresh orange that is adjacent (4-directionally) to a rotten orange becomes rotten. Return the minimum number of minute...
5034ee15ca2c3875a589e65d56def00f85aa38bf
HTY2003/CEP-Stuff
/CEP Y2/Unit 1.1 Python Turtles/Problem Set 1 (Python Turtles)/ps1_template-1.py
4,535
4.28125
4
# PS1 Turtle Graphics # Name: Heng Teng Yi # Class: 2J from turtle import * # Tests are at the bottom in the run function. # Provided helper function # You can, but don't need to, change anything in this function def intializeTurtle(): ''' Initialize turtle on canvas before drawing ''' setup(800,600) # Crea...
bd048f1c4389cbf389ddf7b04773b82fed3b23fc
Windspar/PyGizmo
/example.py
1,598
3.546875
4
import pygame import pygizmo as gizmo class Scene: def __init__(self): # basic pygame setup pygame.display.set_caption('PyGizmo Example') self.rect = pygame.Rect(0, 0, 800, 600) self.surface = pygame.display.set_mode(self.rect.size) self.clock = pygame.time.Clock() ...
85f1a7ae3054aba62358a6af10c6ed6661b2a408
Dpinkney001/Homework-assignment-in-python
/hw program 39.py
963
4.0625
4
#Duvall pinkney #4/19/2015 #hw program number 39 ##Due Date: 21 April Reading: Chapter 7 ##Define a Python function named calculate_tax() which accepts one parameter, ##income, and returns the income tax. Income is taxed according to the following ##rule: the first $250,000 is taxed at 40% and any remaining inc...
773da396f7792e5b9bfed3cd08d52b2f31c5ffc5
joaoo-vittor/estudo-python
/OrientacaoObjeto/aula13Contas/conta.py
1,019
3.921875
4
from abc import ABC, abstractmethod class Conta(ABC): def __init__(self, agencia, conta, saldo): self._agencia = agencia self._conta = conta self._saldo = saldo @property def getSaldo(self): return self._saldo @property def getAgencia(self): return self._a...
5fe96dbaa5425aa0fe0118412b34301ad2f0ae3d
PrimeshShamilka/CS4372_machine_vision_assignment
/linear_filter/linear_filter.py
2,041
3.546875
4
""" Linear filter implementation in python from scrath Author: Primesh Pathirana Date: 31/08/2021 """ import cv2 # read filter mask filter_mask_arr = [] print ("Enter filter mask matrix row-wise (seperate by space): ") for i in range(3): row = list(map(int, input().split())) # assert row size is 3 assert...
aeccdc3087ab5240d0f7be4cb7d405e90dafe6cb
henrypj/codefights
/Intro/06-RainsOfReason/arrayReplace.py
1,100
4.3125
4
#!/bin/python3 import sys """ # Description # # Given an array of integers, replace all the occurrences of elemToReplace # with substitutionElem. # # Example: # # For inputArray = [1, 2, 1], elemToReplace = 1 and substitutionElem = 3, the # output should be # arrayReplace(inputArray, elemToReplace, substitutionElem...
d9d48dad2a9073b9b0ea12e81d45c64115368aca
jedzej/tietopythontraining-basic
/students/myszko_pawel/lesson_02_flow_control/03Minimum of three numbers.py
157
4.09375
4
# Given three integers, print the smallest value. # Read an integer: a = int(input()) b = int(input()) c = int(input()) # Print a value: print(min(a, b, c))
7f8e9192bdfd70b5f59a43d4729802aebcd7dd13
Mbicha/Math
/QuantaticEquation.py
532
3.8125
4
import math #x = [-b+sqrt(b^2 -4ac)]/2a...[-b-sqrt(b^2 -4ac)]/2a """This example solves quantratic equation Round of the answer to 4dp """ def quantratic(): a = int(input("Enter coefficient a: ")) b = int(input("Enter coefficient b: ")) c = int(input("Enter coefficient c: ")) squareRoot = math.sq...
66f9d5c55d92ccd4f4e5cccd4c28bc214d020466
Shruthi007/Pieinfocomm_internship
/const.py
261
3.59375
4
#constructors #>>Special kind of method used to initialise user defines variables. #>>Used to instantiate the classes #>>types:-default and parameterised class Comp: def config(self): print("New phone") c = Comp()#object created c.config()
3a9a738725d30fecccf81ed29ab32170134ddef7
ashishkchaturvedi/Python-Practice-Solutions
/Chapter07_whileLoops_userInput/counting_2.py
152
3.59375
4
''' Created on Sep 11, 2019 @author: achaturvedi ''' i = 0 while i < 10: i += 1 if i % 2 == 0: continue print(i)
c953e2597061043e7bd29a844558b296a6e0c27d
ismailsinansahin/PythonAssignments
/Assignment_08/Question_01.py
225
4.09375
4
def plus(): num1 = int(input("Enter first number : ")) num2 = int(input("Enter second number : ")) return num1+num2 print("result = ", plus()) # Enter first number : 5 # Enter second number : 8 # result = 13
6f6ec81e101bb516e69bf7e1d87e83200e92019c
vashiig/Air-India-project--Data-Handling-Using-Python
/output.py
3,373
3.609375
4
import pandas as pd import datetime import csv # enter the name of file that is clean final file nof = input("enter the name of file ", ) df = pd.read_csv(nof+'_finalfile.csv') group_data = df.groupby(['Flight Number', 'Aircraft Registration Number', 'Departure Airport Code', 'Arrival Airport Code', 'Dom Intl Flag'])....
986cdb5289d5b781aa484b916b802f08ba8065db
renxudong94/git_lianxi
/hm_10_分割线模块.py
5,489
3.640625
4
# def print_line2(char,times): # print(char * times) # # print_line2("$",23) # # def print_line3(char,times): # col = 1 # while col <= 2: # print_line2(char,times) # col += 1 # name = "黑马程序员" # # print("&" * 56) # a = 7 # b = 2 # c = a**b # print(c) # import keyword # print(keyword.kwlist) #...
5e38817947436d8038565fcb2de1086c250bf4ae
jm199504/Python-Cheetsheet
/typefile/csv_method.py
1,439
3.6875
4
import os import csv # 打开or创建一个csv文件 csv_file = open('student.csv','w',newline='')# 设置newline,否则两行之间会空一行 try: # 获取csv写入对象 writer = csv.writer(csv_file) # 写入行数据 writer.writerow(('姓名','学号','年龄','性别')) for i in range(0,10): writer.writerow((i,i+3,i*2,i+5)) except Exception as e: print(e) f...
a7db87431bcea0b2c2c08affe187bbd3bc23430e
stanleysh/assignment7.1
/assignment7-2.py
1,062
4.21875
4
documentary = "Chernobyl" drama = "Dunkirk" comedy = "Disaster Artist" dramedy = "Lala Land" print("How would you rate documentaries? (input 1-5)") likes_documentary = int(input()) print("How would you rate dramas? (input 1-5)") likes_drama = int(input()) print("How would you rate comedies? (input 1-5)") likes_comed...
58d2ec0cbd6bff562ec458b5579067b544b9b1c5
dma-neves/ProjectEuler
/P1_Multiple_3_5/app.py
151
3.71875
4
sum = 0 upBound = 1000 n = 3 while n < upBound: sum += n n += 3 n = 5 while n < upBound: if n%3 != 0: sum += n n += 5 print(sum)
6fb555f138ff2f6627693f886b1fb8008d5592ae
takukawasaki/algorithm
/ch-02-03-sort/merge_sort.py
463
3.828125
4
#!ipython3 def merge (L,R): new_L = [] while L != [] and R != []: if L [0] < R [0]: new_L.append (L.pop (0)) else: new_L.append (R.pop (0)) new_L.extend (L) new_L.extend (R) return new_L def merge_sort (L): size = len (L) if size == 1: ...
8fdce78b79c4bbad3eb119dd9616a758da21ab0b
abhikot1996/Python-Python-All-In-One-Mastery-From-Beginner-to-AdvanceEasy-Way-
/Python-Python-All-In-One-Mastery-From-Beginner-to-AdvanceEasy-Way-/BuiltInMethodForDictionary.py
3,128
4.0625
4
""" Builtin method in dictionary """ car = { 'model':'suzuki', 'year' :[2006,2003,2006], 'color':('black','red'), 'docs' :{'original':'yes','duplicate':'no'} } # E.g 1), # print(car) # print(car['model']) # print(car['year'][1]) # print(car['color'][1]) # print(car['docs']['original']) ...
5276137873f9f016540272a431b44f109bbe0aff
LigianeBasques/atividades
/while1.py
233
4.21875
4
#Com o loop while podemos executar um conjunto de declarações, desde que uma condição seja verdadeira. #i = 1 #while i < 6: #print(i) #i = i + 1 i = 1 while i < 6: print(i) if i == 3: break i = i + 1
f8d5f1233294fe8e7e21441f6afea029069dc169
ragavendranps/Python
/PyTrain-master/session1/exec-9.py
228
3.53125
4
list_1 = [10, 11, 12, 13] list_2 = [1, 2, 3, 4] # result = [11, 13, 2, 4] result = [] for i in list_1: if i % 2 != 0: result.append(i) for i in list_2: if i % 2 == 0: result.append(i) print(result)
7a61ba4a1ba0a66db0066fe286c168866ddd6c85
Sahidul01/HackerRank_python
/introductionToSets.py
766
4.21875
4
""" Task Now, let's use our knowledge of sets and help Mickey. Ms. Gabriel Williams is a botany professor at District College. One day, she asked her student Mickey to compute the average of all the plants with distinct heights in her greenhouse. Formula used: Input Format The first line contains the integer, , th...
278f907903acdc2da28770d5916ccabdf8ce1dea
Burdeinick/Tasks
/Tasks_completed/1.4_Spases_names/my_functions.py
1,286
4.15625
4
import global_var as g_v def call_fun(ar_1, ar_2, ar_3): """This is a function for call other functions. Value of the first argument (ar_1) determines that function will be called. Are arguments: ar_1 can make value only 'add', 'create' or 'get', ar_2, ar_3 can make value name namespase or n...
943e2646963e39b8c57e783d8585aa1bc6d34d55
akcauser/Python
/education_07032020/016_example_calculator.py
593
4.03125
4
try: a = int(input()) b = int(input()) oprType = input("toplama: + \nçıkarma: - \nçarpma: * \nbölme: / \n") if oprType == "+": print(a + b) elif oprType == "-": print(a - b) elif oprType == "*": print(a * b) elif oprType == "/": print(a / b) el...
839e29632714010f1ac7c830fcab85cdf748697b
thomastu/lemon2k17
/lemon2k17/vendor.py
1,337
3.5625
4
# -*- coding: utf-8 -*- import Queue from threading import Thread from . import recipes from . import customers class Vendor(object): def __init__(self, name): self.name = name self.money = 0. self.customers = Queue.Queue() self.is_open = False self.inventory = {"lemons" ...
37e0f0c22fe9c50f30981ce55cb95992dc531c59
Mike1604/MIPS
/Proyecto_D13E02/Decodificador.py
11,709
3.625
4
#Decodificador import os, sys, subprocess from io import open def inicio(): os.system("cls") print("Bienvenido") print("Equipo 02") print("Fʟᴏʀᴇs Esᴛʀᴀᴅᴀ Aʙʀᴀʜᴀᴍ Mɪɢᴜᴇʟ Aɴɢᴇʟ") print("Guerra Lopez Paulina Estefania") print("Pᴇʀᴇᴢ ᴅᴇ ʟᴀ Tᴏʀʀᴇ Lᴇᴏɴᴀʀᴅᴏ Oᴄᴛᴀᴠɪᴏ\n") print("Este algoritmo resuelv...
645c096e5042f86e23e610e3d7e09af24c2181d4
SB1996/PythonExtention
/ExtraLibraries/ExternalLibraries/Numpy/Array/Array.py
516
3.71875
4
import numpy as npArray # Creating array object array = npArray.array([[1, 2, 3], [4, 2, 5]]) # Printing type of array object print("Array is of type: ", type(array)) # Printing array dimensions (axes) print("No. of dimensions: ", array.ndim) # Printing shape of array print("Shape of array: "...
1457848ea76636d773aea52697ce0e71a2676378
gymgle/leetcode
/course-schedule-ii/main.py
1,083
3.515625
4
# coding: utf-8 class Solution(object): def findOrder(self, numCourses, prerequisites): """ :type numCourses: int :type prerequisites: List[List[int]] :rtype: List[int] """ if len(prerequisites) == 0: # 无依赖关系 return [i for i in range(numCourses)] ...
f1d4a0f8be9eb4f56d958335c36f870c4217ba6c
chao1981/Tensorflow-Tutorials
/1_linear_regression.py
710
3.53125
4
from commons import plot_regression import tensorflow as tf import numpy as np x_train = np.linspace(-1, 1, 101) y_train = 2 * x_train + np.random.randn(len(x_train)) * 0.33 x_input = tf.placeholder(tf.float32) y_input = tf.placeholder(tf.float32) a = tf.Variable(0.0) b = tf.Variable(0.0) y = x_input * a + b cost =...
c05036c7cd498d4d24ba588cff831b903946b2a6
Caoimhinv/-pands-problem-sheet
/es.py
2,133
4.1875
4
# Problem Task 06 (07/03/21) # This program reads in a text file in the command line # and outputs the number of 'e's contained in it. # Author: Caoimhin Vallely # The user types in the programme name and filename or filepath # directly into the command line # i.e. >>python es.py phadThai.txt<< # N.B. text file nee...
41d943b4ef228b3fbff2efbc1acd8f04bea2880f
kanhaichun/ICS4U
/hhh/Mike/assignment3.py
1,908
4.15625
4
# -*- coding: utf-8 -*- """ Name: Xu, Yingjie (Mike) Date: 2018-01-12 Program Title: assignment3 Purpose: (a) Let the user input two numbers. (b) Convert the numbers to integers (c) Use six comparison operators in six different if statements to compare the two numbers. Print different outputs for true and false in ea...
4fd0a0ab42cbbb17c8edf2a17f54fe30ed7a43ec
airberlin1/schiffe_versenken
/ship.py
31,874
3.671875
4
# ------ # neccessary imports import random as rd # used to set colors and ships' locations randomly import pygame # used to display ships import save # used to save ships import chat # used to display error messages import math # used to round numbers import copy # idk why but it has to stay from playfie...
98fade3a53bf3ef394675c8ee93d4705931a59fa
paaqwazi/algorithms
/interview_training/leetcode/easy/merge_trees.py
804
3.8125
4
''' https://leetcode.com/problems/merge-two-binary-trees/description/ Input: Tree 1 Tree 2 1 2 / \ / \ 3 2 1 3 / \ \ 5 4 7 Output...
f4651505c6b2986edaeccf9a7811d071567add33
daniellaah/Data-Structure-and-Algorithms
/sorting/selection_sort.py
551
3.8125
4
from random import randint # time complexity: O(n^2) # 循环遍历数组, 每次记录最大的数的索引, 与未排序的最后一个数交换 def selection_sort(nums): nums_len = len(nums) for i in range(nums_len - 1): max_idx = 0 for j in range(1, nums_len - i): if nums[max_idx] < nums[j]: max_idx = j nums[max_...
4c10f583a195b1c41d6c578009a741a520a0233e
Zehuayu/Python-fundamentals-question-sheet
/question6.py
582
4
4
##compare list number which is biggest and which is smallest def getList(x): list = [] for i in range(0,x): list.extend([int(input())]) return list def compare(list): max = list[0]# let first number compare to others for x in list: if (max < x): max = x min = list...
5f18a7a9e1e8969881a8d0e0d793fa2098c7b6fd
PythonOleg/python2020
/DZ4_5.py
221
4.15625
4
str1 = input('Input string: ').strip() for i in range(0,len(str1)): if str1[i].islower() == True: print(str1[i].upper(),end='') elif str1[i].isupper() == True: print(str1[i].lower(),end='')
832899e00f0c01d0d8dd0d504394cc836bcadb6d
thecamo1509/holbertonschool-higher_level_programming
/0x10-python-network_0/6-peak.py
244
3.96875
4
#!/usr/bin/python3 def find_peak(list_of_integers): """This function will get the peak""" if len(list_of_integers) > 0: list_of_integers.sort() peak = list_of_integers[-1] else: peak = None return (peak)
089addc0bc36ef8c530bf598769b5a90bd46fe85
rafaelperazzo/programacao-web
/moodledata/vpl_data/303/usersdata/289/106222/submittedfiles/testes.py
271
3.640625
4
from minha_bib import * # COLOQUE SEU PROGRAMA A PARTIR DAQUI cont=0 print("Bem vindo ao JogoDaVelha do grupo E") nome = str(input("Qual o seu nome (ou apelido)? ")) if s=='X': X='humano' O='computador' sorteio = sorteio (nome)
d80e044bf354a41bee8d88e7838a2a6fd4c1be42
melbinmathew425/Core_Python
/flowcontrolls/loopping/f_evodsum.py
192
3.703125
4
lwr=int(input("Enter the lower limit")) upr=int(input("Enter the uper limit")) es=0 os=0 for i in range(lwr,upr+1): if i%2==0: es=es+i else: os=os+i print(es) print(os)
a2b88215ded1e950d2779301d22d06afb50dce17
caitstew/class-work
/threes.py
77
3.90625
4
threes = list(range(3,31,3)) print(threes) for three in threes: print(three)
2411683b2b1855056d977a53e9233f81c2d622a5
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/224/users/4357/codes/1692_1079.py
516
3.9375
4
# Ao testar sua solução, não se limite ao caso de exemplo. from math import * # Leitura dos lados do triangulo a, b, and c a = float(input ("Lado 1: ")) b = float(input ("Lado 2: ")) c = float(input ("Lado 3: ")) s = (a + b + c) / 2.0 area = sqrt(s * (s-a) * (s-b) * (s-c)) area = round(area, 3) mensagem="invalida" i...
f5912e2123f410a7612cf682035db02dc8bc18e9
floflogreco/Python
/cours_2/devoir2-1.py
446
4.28125
4
def conversion(grade): try: grade = float(grade) if grade >= 18 and grade <= 20: print "A" elif grade >= 16 and grade < 18: print "B" elif grade >= 14 and grade < 16: print "C" elif grade >= 12 and grade < 14: print "D" elif grade >= 0 and grade < 12: print "F" else: print "Note doit e...
0a7e731d87903a6699d65b3444acec4bd939d1ec
slnrao/learn_proj1
/prac2/tuple_prac2.py
1,121
3.765625
4
''' Created on 8 Apr 2018 @author: laxminarayan rao ''' #Tuples are smiler to list and elements are immutable , tuple elements are write protector !! t=('unix','linux','perl','unix','risjika','harshika','python','java','aws','devops','odds','matters','blessings','rishika','harshia','gamagamaa','aws','java','h...
fbb11a8325c2703856cb9e1bb337a045880e15d4
haroonrasheed333/CareerTrajectory
/OLD/ParseXML.py
586
3.671875
4
from lxml import etree import re xml = etree.parse("Resume1.txt") current_employer = xml.xpath('//job[@end = "present"]/employer/text()') print current_employer current_job_title = xml.xpath('//job[@end = "present"]/title/text()') print current_job_title def stripxml(data): pattern = re.compile(r'<.*?>') re...
885fb683ba08d9d33897c021b94694edd8ac899a
314H/competitive-programming
/marathon-codes/Maratonas/U_._R_._I/3. string/string-1287.py
1,770
3.8125
4
# Computadores estão presentes em uma porcentagem significante de casas pelo mundo e, # como programadores, somos responsáveis por criar interfaces que todos possam usar. # Interfaces de usuário precisam ser flexíveis de forma que se um usuário comete um # erro não fatal, a interface ainda pode deduzir o que o usuár...
a43af2ea5bca9ef65a261e0f2e58a91bc61b4421
assassint2017/leetcode-algorithm
/Design Linked List/Design_Linked_List.py
3,366
4.3125
4
# Runtime: 180 ms, faster than 71.68% of Python3 online submissions for Design Linked List. # Memory Usage: 13.5 MB, less than 10.17% of Python3 online submissions for Design Linked List. class LinkNode: def __init__(self, num): self.val = num self.next = None class MyLinkedList: de...
810cc469bf02e787c1fdda5ceba3592af7a1132e
gui199/blockchain_exercicio
/BlockChain.py
2,102
3.765625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 20 13:59:17 2020 @author: gui """ from BlockClass import Block class BlockChain(object): def __init__(self): self.chain = [self.createGenesisBlock() ] self.difficulty = 5 def createGenesisBlock(self): genesisD...
7baa10457ab8a0539d30488ad6b090ee18c8d110
lindongyuan/study2020
/project/Chapter_09/car.py
1,171
3.96875
4
class Car(): def __init__(self,make,model,year): '''初始化描述汽车的属性''' self.make = make self.model = model self.year = year self.odometer_reading = 0 def get_descriptive_name(self): '''返回整洁描述''' long_name = str(self.year) + ' ' + self.make + ' ' + self.model ...
f2f67058dfb3373ceae5ad2d73bec155869e1d59
borgstrom/playground
/python/action/action.py
2,615
3.5625
4
import six from collections import deque class Action(object): """Represents an action in a graph. Each action can specify ordering requirements by expressing which other action(s) it should run before or after. All actions created get stored in a singleton instance dict on the main Action class meanin...
4ccfeb483f2e8fac3dda9fa5c5aa80f0b995457b
nasrutdinov/alg-course
/sort_array.py
689
3.96875
4
def insert_sort(A): N=len(A) for top in range(1,N): k=top while k>0 and A[k-1]>A[k]: A[k],A[k-1]= A[k-1], A[k] k=k-1 def test_sort(sort_algorithm): print("test # 1") A=[5,4,3,2,1] A_sorted=[1,2,3,4,5] sort_algorithm(A) print("Ok" if A==A_sorted else ...