blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
7a617992719556abf958d1eedfba4d87ffca38c9
atiktanim/Python
/Project Quiz Test/Quiz.py
1,754
3.59375
4
import random Zilla = {'Chandpur': 'Ilish', 'Dhaka': 'Biriany', 'Rajshahi': 'Mango', 'Comilla': 'Roshmalai', 'ChapaiNababganz': 'pera', 'Bogura': 'Doi', 'Nator': 'kachagolla', 'Chittagong': 'Shutki', 'Khulna': 'Modhu', 'Barisal': 'Guazava' } # Generates 5 quiz files: for q...
afc8d6c466837c5ee1bc781bc6ca70ab55de5e6e
AIA2105/A_Practical_Introduction_to_Python_Programming_Heinold
/Python sheets/7.13.py
181
3.53125
4
x = [1, 1, 2, 3, 4, 3, 0, 0] new = [] index = 0 for i in range(len(x)): if not new.__contains__(x[i]): new.insert(index, x[i]) index += 1 print(new)
2f7dee5f68f1676e2195f33be0a47b82ad7528f1
basimsahaf-zz/Coding-Challenges
/anagram.py
1,140
4.15625
4
""" Q: Given two strings, check whether they are anagrams of each other. Example: "public relations" is an anagram of "crap built on lies." You are also given a testing client to check the correctness of your function.""" #Testing client for anagram class AnagramTesting(object): def Client(self,sol): ass...
15326c1a2c5e91b06fdab113e1981d27ceda7262
LRegan666/Athene_Leetcode
/Search_in_Rotated_Sorted_Array.py
1,262
3.671875
4
class Solution: def search(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ if not nums: return -1 start, end = 0, len(nums)-1 while start+1 < end: mid = int((start + end) / 2) if nums...
d4fee27a4dd7540de232c5206f211afaa28429ec
rjovelin/Rosalind
/Armory/ORFR/longest_ORF.py
1,631
3.796875
4
# -*- coding: utf-8 -*- """ Created on Mon Mar 30 22:02:52 2015 @author: Richard """ # use biopython to translate DNA sequences and manipulate sequences from Bio.Seq import Seq def find_longest_ORF(input_file): ''' (file) -> str Given a DNA string S in input file, return the longest protein string ...
baec9cdecfafca3eecd3689c6e0d847adff07cb7
Crazyinfo/Python-learn
/try/习题/twosum.py
337
3.765625
4
# 网摘 def twoSum(nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ dic = {} for i, num in enumerate(nums): if target - num in dic: return [dic[target - num], i] dic[num] = i m = twoSum([2, 7, 11, 15], 9) print(m) print(twoSum([2, 7, ...
ec6885140e83aee6daf8c713e8fd0687b9a1330c
hs634/algorithms
/python/arrays/move_zeros_to_end.py
328
3.53125
4
__author__ = 'hs634' arr = [1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0, 9] def move_zeros_to_end(arr): count = 0 for i, item in enumerate(arr): if item != 0: arr[count] = arr[i] count += 1 while count < len(arr): arr[count] = 0 count += 1 print arr move_zeros_to_...
054d28f6fbfa9cc5421bd77c78e361f46374c534
i-aditya-kaushik/geeksforgeeks_DSA
/Bitwise Magic/Codes/rightmost_diff_bit.py
1,343
4.25
4
""" Rightmost different bit Given two numbers M and N. The task is to find the position of rightmost different bit in binary representation of numbers. Input Format: The input line contains T, denoting the number of testcases. Each testcase follows. First line of each testcase contains two space separated integers M a...
be3112a86d8dab7211dd0a03ae4061509e64d2bb
lzjzx1122/FaaSFlow
/src/function_manager/port_controller.py
412
3.59375
4
# a really simple port controller allocating port in a range class PortController: def __init__(self, min_port, max_port): self.port_resource = list(range(min_port, max_port)) def get(self): if len(self.port_resource) == 0: raise Exception("no idle port") return self...
dc9ddd28d806e42f96838dd2995ee0fbbaf03fe5
Broozer29/Utrecht_HBO_ICT
/While-loop & numbers.py
345
3.765625
4
def main(): totaal = 0 aantalGetallen = 0 user_input = int(input("Enter number: ")) while user_input != 0: totaal += user_input aantalGetallen += 1 user_input = int(input("Enter number: ")) if user_input == 0: print("Er zijn ",aantalGetallen," getallen ingevoerd, de ...
dd2a94d2c5b58c0ae302cae772edbb9729b1b903
rajkn1212/Practice-Python
/Strings/q16.py
482
4.28125
4
# Write a Python program to remove the nth index character from a nonempty string. def removeChar(givenString, pos): newString = "" if givenString == "": print("empty string") else: list1 = list(givenString) for i in range(len(list1)): if pos == i: del l...
8cd7def10aa3dd1ba478f1eca091bd606943bc80
Code-Institute-Submissions/python-2
/run.py
2,117
4.125
4
from random import randint board = [] for x in range(5): board.append(["O"] * 5) def print_board(board): for row in board: print(" ".join(row)) """ starting the game and printing the board """ print ("The hunt in on!") print_board(board) """ generating random positions for the ships """ ships = 4 ...
cff144d4c6ae304b790ec511975dfe4bdcfbc035
RESHMA-KRISHNAN/PYTHON-PROGRAMMING
/CO4/comparison.py
784
4.09375
4
class distance: def __init__(self, x=5,y=5): self.ft=x self.inch=y def __eq__(self, other): if self.ft==other.ft and self.inch==other.inch: return "both objects are equal" else: return "both objects are not equal" def __lt__(self, other): in1=self.ft*12+self.inch in2=other.ft...
e4197b72b91ab68ab48d34a0a280254cef57ef51
EddyGharib/delta-robot-application
/delta_kinematics.py
4,005
3.6875
4
""" Python implementation of the direct (forward) and inverse kinematic equations of a delta robot with special dimensions. R, r, l and d. """ import numpy as np from math import * import time from matplotlib.pyplot import * # Some other constants sqrt3 = sqrt(3) sin120 = sqrt(3) / 2 cos120 = -0.5 tan60 = sqrt(3) s...
f4a57ebbddea08efd079691627117d318f60d7f2
Aliebs/GCTA
/custom_func.py
2,270
3.671875
4
import statistics, time, random def help(): print("\n\n") print(""" |---------------------------------------------------------| | GCTA - Help guide | | | | Commands: What does it do: | | ...
2580f3db9e3c7993f4c5d5f475852222d18c5a4a
ryancey1/python-data-science
/01-python-basics/05-working-with-web-data/jsondata_start.py
1,986
3.875
4
# # Example file for parsing and processing JSON # import urllib.request import json def printResults(data): # Use the json module to load the string data into a dictionary theJSON = json.loads(data) # now we can access the contents of the JSON like any other Python object if "title" in theJSON["meta...
154e4ac9846cf99c0b5b8ca4af4f1a77b5ec877f
gear/learn
/codeforfun/python/s-cs97si/linear_algebra.py
1,328
3.875
4
"""coding=utf-8 python=3.5.2 """ import numpy as np def solve(mat, y): """Solve a system of linear equations given by `mat` and y. The rows represent coefficients of each equation.""" reduced = gaussian_elim(mat) sol = np.zeros(shape=(mat.shape[0])) S = 0 for i in reversed(range(len(sol)...
5174b45a4744d830fe4e5d7938ef951208a06be2
Sulorg/Python
/Self-taught-programmer-Althoff/ООП2.py
1,112
4.03125
4
#Задание1 class Shape(): def what_am_i(self): print("Я - фигура.") class Square(Shape): square_list = [] def __init__(self, s1): self.s1 = s1 self.square_list.append(self) def calculate_perimeter(self): return self.s1 * 4 def what_am_i(self): super().what...
c59c99cf9a269e7bae4515bcca9104cf70fa7163
nsmedira/MIT-6_01
/python-tutorial/if-else-while/problems/perfectSquare.py
371
3.546875
4
import math def perfectSquare(n): if not isinstance(n, int) or n <= 0: return "argument must be a positive integer" if n == 1: return True # assuming that this problem wants a loop instead of the square root function i = math.floor(n/2) while i > 1: if i ** 2 == n: ...
484aae30f2f5d92daf20002f6133502314ade821
physics91si/sblankenAtStanford-lab5
/trig.py~
458
3.84375
4
#!/usr/bin/python #The following statements are used to import numpy and matplotlib. import numpy as np import matplotlib.pyplot as plt # TODO fill in this function def integrate(y, dx): return np.sum(y*dx) # TODO write code here to setup arrays x and y = sin(x) and then plot them. # After this is done implemen...
361aaf44f0078ce022ac48c0f6496f010c69d70e
CharmingCheol/python-algorithm
/백준/그래프/2668(숫자고르기).py
589
3.546875
4
import sys # 사이클 문제 def DFS(start, current): # 현재 위치가 1인 경우 if visited[current]: # 시작값과 현재값이 같은 경우(사이클인 경우) if start == current: result.append(start) else: visited[current] = 1 DFS(start, nums[current]) size = int(sys.stdin.readline()) nums = [0] + [int(sys.st...
15b7f3dd05e387ad3cf64a7941acd41a3b6fa52b
Tutu0027/Max_entropy
/100/24.py
700
4.125
4
# -*- coding: utf-8 -*- #!/usr/bin/env python # 题:Python有许多内置函数,如果您不知道如何使用它,您可以在线阅读文档或查找一些书籍。 但是Python为每个内置函数都有一个内置的文档函数。 #      请编写一个程序来打印一些Python内置函数文档,例如abs(),int(),raw_input() #      并为您自己的功能添加文档 #      # 提示:内置文档方法是__doc__ print(abs.__doc__) print(int.__doc__) print(input.__doc__) def square(num): '''Return ...
9e81e19d09330022f115c82de55d99ba72d474b7
santiagopemo/holbertonschool-higher_level_programming
/0x0C-python-almost_a_circle/models/base.py
5,231
3.5
4
#!/usr/bin/python3 """Base Module""" import json import csv from os import path import turtle import random class Base: """Base Class""" __nb_objects = 0 def __init__(self, id=None): """Initializtes a Base class instance""" if id is not None: self.id = id else: ...
bace5e222fbd54a2976a260f9481945a792f0171
MrHamdulay/csc3-capstone
/examples/data/Assignment_4/kngtho005/boxes.py
906
3.9375
4
# boxes.py # print_square() # prints 5x5 box on the screen # print_rectanle(width,height) # prints a box on screen with given width and height # get_rectangle(width,height) # returns a string containing box with given width and height # Thomas Konigkramer # 29 March 2014 def print_square():...
df29039e97adc18924893074cac7f743aa14cdf2
xenonyu/leetcode
/buildTree.py
840
3.984375
4
# Definition for a binary tree node. from typing import List class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def buildTree(self, preorder: List[int], inorder: List[int]) -> TreeNode: def preTraverse(preStart, preEnd, inSt...
410ee8bfa76491d0536823bb5d55b99c254d7c7c
noah-hixon/COS
/hixon_project1.py
9,493
4.15625
4
import random #checks to see if the user inputs a valid response def validatePlayers(numOfPlayers): while numOfPlayers != "y" and numOfPlayers != "n": print("INVALID INPUT") numOfPlayers = input("Do you want the computer to be one player?[y/n]") if numOfPlayers == "y": ...
5665e54089f010b48819e72dadddc890fb50820c
Alexander30/PythonTheHardWay
/ex11.py
291
3.8125
4
print "How old are you?", age = raw_input('-->' ) print "How tall are you?", height = raw_input() print "How much do you weight?", weight = raw_input() print "aky mas oblubene cislo?", x = eval(raw_input()) print x print 'So, you\'re %r old, %r tall and %r heavy.' %\ (age, height, weight)
9764e46fe07ac0954eca41e85297a8dfb4ba961f
nickrye/HEM4EPA
/com/sca/hem4/writer/Writer.py
863
3.609375
4
from abc import abstractmethod, ABC class Writer(ABC): def __init__(self): self.outputs = None self.filename = None self.headers = None self.data = None self.dataframe = None self.batchSize = 10000000 def write(self, generateOnly=False): if not generat...
1791957bdd295ad76b10a73065faae6342ccdb6c
nathanlo99/dmoj_archive
/done/a20.py
193
3.71875
4
for i in range(int(input())): value = int(input().strip(), 16) if (value >> 20) & 1 != 0: print("{:08X} ".format(value & ~(1 << 20)), end = "") print("{:08X}".format(value))
a921c14ea3cce56c08a14fb1c6a20fd54e100582
amdonatusprince/The-Classic-Snake-Game
/snake.py
1,652
3.921875
4
from turtle import Turtle STARTING_POSITION = [(0, 0), (-20, 0), (-40, 0)] MOVE_DISTANCE = 20 UP = 90 DOWN = 270 LEFT = 180 RIGHT = 0 class Snake: def __init__(self): self.snake_list = [] self.create_snake() self.head = self.snake_list[0] self.move_speed = 0.1 def create_snak...
17006504ef5dd7a5558297e7e7f741f66f605653
daimictse/skill-exercises
/reservation.py
5,927
4.1875
4
""" Reservation finder Along with this file, you'll find two files named units.csv and reservations.csv with fields in the following format units.csv location_id, unit_size reservations.csv location_id, reservation_start_date, reservation_end_date You will write a simple application that manages a reservation syste...
6a719ce777caa40e77569b84c5605e77429bb659
thinkerston/curso-em-video-python3
/mundo-03/exercicio-106.py
474
4.0625
4
'''Faça um mini-sistema que ultiliza interactive Help do python. o usuario vai digitaro comando e o manual vai aperecer. quando o usuário digitar a palavra "FIM", o programa se encerrará''' def ajudame(): funcao = str(input('Insira o nome da funcão: FIM PARA SAIR :')).lower() while True: if funcao == '...
3892fa36d365f997f01b5cf34c9b6415ebedf6f0
felipmarqs/exerciciospythonbrasil
/exercicios/EstruturaSequencial/Metros_para_centímetros.py
162
4.25
4
#Faça um Programa que converta metros para centímetros m = float(input("Digite a medida em metros:")) c = m * 100 print(f"{m} metros são {c} centímetros.")
62fe4aaf167b46b1ac83568e09be032d23599a20
Mike-droid/estadistica_descriptiva
/media.py
222
3.640625
4
import random def calculate_mean(numbers): return sum(numbers) / len(numbers) random_numbers = [random.randint(1, 100) for _ in range(100)] print(f'La media de {random_numbers} es {calculate_mean(random_numbers)}')
77c7a0d1a236c1f275465cc21e6cbe3087f71939
LucasLeone/tp2-algoritmos
/cf/cf54.py
334
3.609375
4
''' Se dispone de cien pares ordenados de números y se quiere imprimir el cociente de cada uno. ''' for i in range(0, 100): print('---- Nuevo par ordenado ----') x = int(input('Ingrese el primer valor: ')) y = int(input('Ingrese el segundo valor: ')) print(f'El cociente entre estos 2 numeros ...
38d06cb7358fcac4a9d59f9b57c43825b9549015
DanielPahor/data-structures
/Stack.py
992
3.65625
4
import unittest import collections class Stack: def __init__(self): self.data = []; #O(1) def push(self, item): self.data.append(item) #O(1) def pop(self): if not self.data: return None else: return self.data.pop() #O(1) def peek(se...
263fe657eb448df049642560368098ec9966f706
yordan-marinov/fundamentals_python
/regular_expression/softuni_bar_income.py
450
3.5625
4
import re regex = r"(^|(?<=%))([A-Z][a-z]+)(%)(<)([A-z][a-z]+)(>)(\|)(\d+)\7(\d+.\d+)((?=\$)|$)" total = 0 while True: data = input() if data == "end of shift": print(f"Total income: {total:.2f}") break matched = re.finditer(regex, data) for m in matched: result = float(m.gro...
9c06037e58e88be125ba73a406a8f61bd1f61366
cyruspythonprojects/Lab2_uppgifter
/uppg4.py
412
3.515625
4
# Skriv en funktion som returnerar alla heltal i en sträng som användaren matar in! Exempel på inmatning: ”hej32a1”.Exempel på vad funktionen skareturnera:[3,2,1]. def intFinder(s): lst = [] for c in s: try: if int(c): lst.append(c) except: conti...
bff83c1f6acb27d164a002e79144339558ea8971
arungahlot/numerology
/main.py
457
3.84375
4
from numerology import PythagoreanNumerology def start_app(): """Interactive version of the package.""" print("Starting...\n") first_name = input("Enter your first name: ") last_name = input("Enter your last name: ") birthdate = input("Enter your birthdate (yyyy-MM-dd, example 1994-11-30): ")...
5dd5cec67f0d827785489963736211f76bab4fd7
aklefebvere/Sprint-Challenge--Intro-Python
/src/cityreader/cityreader.py
4,886
4.28125
4
# Create a class to hold a city location. Call the class "City". It should have # fields for name, lat and lon (representing latitude and longitude). # We have a collection of US cities with population over 750,000 stored in the # file "cities.csv". (CSV stands for "comma-separated values".) # # In the body of the `c...
f67636e6231083a2ba38e466c79deab4f53e93de
dmeckley/FigureCanvas
/main.py
1,320
3.6875
4
from tkinter import * from figureCanvas import FigureCanvas def main(): # Creates a Tk Widget Object Instance as the main window of the application: window = Tk() window.title("Display Figures") '''Outline Objects''' # Line Outline Shape Object Creation: xOutline = FigureCanvas(window, "line", 100, 100) xOu...
06497822c9674420ce2d8344c4dc6d1d8a004db7
GJAI-School/GJAI-Algorithm
/queue.py
924
3.546875
4
# import sys # input = sys.stdin.readline def process_queue(queue_list, f_idx, r_idx, command): cmd = command[0] if cmd == "push": queue_list[r_idx] = command[1] r_idx += 1 elif cmd == "pop": if f_idx == r_idx: print(-1) else: print(queue_list[f_idx])...
9a9fe3c8bffc2eca97fe693c746af3ff976441f4
chengbo/leetcode
/leetcode/binary_tree/maximum_depth.py
546
3.671875
4
def maximum_depth(root): """ :type root: TreeNode :rtype: int """ if root is None: return 0 left_result = maximum_depth(root.left) right_result = maximum_depth(root.right) return max(left_result, right_result) + 1 def maximum_depth2(root, depth): """ :type root: TreeN...
0ad7289d6aee3f084334e5252b7ba6f9df7d6415
pratikshah1701/hackerrank
/xml-1-find-the-score.py
419
3.65625
4
#!/usr/bin/env python3 import xml.etree.ElementTree as etree def main(): line_num = int(input()) xml = '' for i in range(line_num): xml += input() + '\n' tree = etree.ElementTree(etree.fromstring(xml)) score = len(tree.getroot().attrib) for element in tree.findall('.//*'): ...
8fecea8a5edaf8197955a3e3ffdb507322316249
kalidindiravi1/sample-python-code
/pyglatin.py
329
3.984375
4
pyg = 'ay' original = raw_input('Enter a word:') if len(original) == 0: print "empty" elif len (original) > 0 and not original.isalpha(): print "not a string" else: word = original.lower() first = word[0] new_word = word+first+pyg new_word = new_word[1:len(new_word)] print...
fb598caac8ec1aea76022a3ebab5e3b032fc1829
alex-lenk/python_fast_start
/les02.py
701
4.09375
4
# coding : utf-8 answer = input("Кто сегодня хочет поработать? (Y/N)") if answer == 'Y' or answer == 'y': print ("Выберите цифру, которая подходит для работы сегодня") select = int(input("Изучать python: 1, изучать JAVA: 2 = ")) if select == 1: print ("Начинаем изучать питон") elif select == 2...
2b37a0897ec1da5b841578a19afd49532f6be25e
Qualia1789/Challenges
/HackerRank.py
1,027
3.734375
4
global_list = [] numbers = [] numbers2 = [] names = [] list = [] raw_input_string = '''5 Harry 37.21 Berry 37.21 Tina 37.2 Akriti 41 Harsh 39''' raw_input_list = raw_input_string.split('\n') def raw_input(): return raw_input_list.pop(0) for _ in range(int(raw_input())): name = raw_input() score = float(r...
e002c532d571b89a9d70740f880918bc9f8c7851
thormeier-fhnw-repos/ip619bb-i4ds02-audio-text-alignment
/lib/src/align/utils/get_none_part.py
254
3.625
4
from typing import List def get_none_part(l: List) -> float: """ Calculates the amount of gaps relative to the sentence length :param l: Sentence or sentence part :return: Percentage of gaps """ return (l.count("-")) / len(l)
cac1eb499e415d46b391896be5fdbd53f2f97e08
mindovermiles262/codecademy-python
/03 PygLatin/02_ahoy_or_should_i_say_ahoyay.py
172
3.6875
4
# -*- coding: utf-8 -*- """ Created on Wed Jan 11 08:43:27 2017 @author: mindovermiles262 Codecademy Python Please print the phrase "Pig Latin". """ print("Pig Latin")
2fe1294e339644b243fa12319d041238ee310341
hanbinq/own_stu
/Py/02_quick_sort.py
2,443
4.3125
4
""" 快速排序 1、从列表中挑出一个元素,作为基准值key 2、所有小于key的元素放左边,所有大于key的元素放右边 3、分别递归左侧列表,右侧列表 """ def quick_sort(lists, start, end): """快速排序""" # 递归过程中,发现start和end一致时,停止递归,直接返回列表(递归的退出条件) if start >= end: return lists # 设定起始元素为要寻找位置的基准元素 mid = lists[start] # low为序列左边的由左向右移动的游标 low = start #...
1130b669de80a4bd25ecf3e3e8f97c1dd4e961fa
ElonDormancy/solvepde
/fourier_transform.py
776
3.671875
4
import numpy as np import matplotlib.pyplot as pl #Consider function f(t)=1/(t^2+1) #We want to compute the Fourier transform g(w) #Discretize time t # t0=-100. dt=0.001 # t=np.arange(t0,-t0,dt) t0 = 0 t=np.arange(t0, 200, dt) #Define function f=np.cos(t*10) + np.cos(t*5) #Compute Fourier transform by numpy's FFT fu...
ce63fa4de0b4fa4cb4eb40e4de83880d5d2053fa
accolombini/python_completo
/lab91_lendo_arquivos_csv.py
4,448
4.375
4
""" Lendo arquivos CSV => Coma Separeted Values -> Valores Seprados por vírgula. Observações: 1- O primeiro ponto aqui é ter consciência de que podemos ter outros tipos de separadores que não apenas a vírgula e ainda estamos tratando de um arquivo CSV, o importante é que exista um ...
0b7f65062a0c952842363c913efb45b53dbcaf6c
NathanaelV/CeV-Python
/Exercicios Mundo 3/ex094_unindo_dicionarios_e_listas.py
3,416
3.96875
4
# Class Challenge 19 # Read Name, gender and age of several people. # Guardando esse valor em um dicionário # Mostrar: # Número de pessoa cadastradas: len() # A média da idade do grupo # Uma lista com todas as mulheres # Uma lista com as pessoas com idade acima da média person = dict() people = [] while ...
b1f8a595797a24f4391f673300230f39fc813842
flobabs/Linear-Regression
/Linear regression.py
1,496
3.578125
4
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd from pandas import DataFrame import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression import numpy as np # In[2]: Data = pd.read_csv('cost-revenue-dirty.csv') # In[3]: Data.describe() # In[4]: x = DataFrame(data, ...
fc94ccf4863669c344f1b3eb1239c212009fc13c
ascaniopy/python
/pythonexercicios/ex012.py
236
3.609375
4
print('=' * 100) preco = float(input('Qual é o preço do produto? ')) novo = preco - (preco * 5 / 100) print('O produto que custava R$ {:.2f}, na promoção com desconte de 5% vai custar R$ {:.2f}'.format(preco, novo)) print('=' * 100)
23b98747b79dbc09658a5caad8f46cfcbf8bdf7b
DaHuO/Supergraph
/codes/CodeJamCrawler/16_0_3_neat/16_0_3_emilmgeorge_coinjam.py
1,055
3.578125
4
#!/bin/python2 import itertools def isPrime(n,skip=True): if n == 2 or n == 3: return True if n < 2 or n%2 == 0: return 2 if n < 9: return True if n%3 == 0: return 3 r = int(n**0.5) f = 5 while f <= r: if n%f == 0: return f if n%(f+2) == 0: return f+2 if skip and f>100000: return -1 ...
138ab81e765175a98759e587ed4368d00dd09581
0x232/BOJ
/1929.py
288
3.671875
4
from math import sqrt def prime(n): if n == 1: return False else: for i in range(2, int(sqrt(n))+1): if n % i == 0: return False return True m, n = map(int, input().split()) for i in range(m, n+1): if prime(i): print(i)
791dc62f33a24fef19e22a7fe1fd7889d2765a0f
drwit/2015SummerPython
/7-22/function.py
350
3.796875
4
def add(a, b): y = a + b print '%d + %d = %d' % (a, b, y) def none(): print 'There is no arg in the function' def get_shit(): """You may get some shit""" str = 'shit' return str print 'Plz input two numbers:' a = int(raw_input('first one>')) b = int(raw_input('second one>')) add(a, b) none() print 'We are...
af27f48da8ace55ab443766248e81c48ac1bccfc
ivnxyz/practicas-programacion-inviertete
/Frida/dado.py
113
3.5625
4
import random dado= input("presiona enter para tirar el dado") for numero in dado: print(random.randrange(1,7,1))
7d76637576161d210b785cfe09817e36e2beac37
IntroProgramacion-P-Oct20-Feb21/trabajofinal-1bim-FabianMontoya9975
/Taller3/Ejercicio06.py
226
3.5
4
""" Genere y presente el resultado en pantalla de la siguiente expresión: ____ V 81 + 9 ( ----------- == 9 ) and (10 > 1) 3 """ resultado = (((81**(1.0/2)+9)/3)==9) and (10>1) print(resultado)
ad6d04547dd5c97b1cc93cdafb1356e0ba34adc8
denze11/gb_osnovi_python_vebinar
/lesson_1/4.py
232
3.90625
4
number = int(input('Введите число: ')) item = number % 10 number //= 10 while number > 0: if number % 10 > item: item = number % 10 number //= 10 print(f'Самое большое число - {item}')
be54cbbf7ef9004c428769207bd1a936b7c5ee2f
GSilva-N/Cursoemvideo_Python
/Mundo 03/Aula 21/Ex102.py
402
3.84375
4
def fatorial(num, show=False): fat = 1 if show == True: for i in range(num, 0, -1): fat *= i print(i, end=' ') if i > 1: print('x', end=' ') else: print('=', end=' ') return fat else: for i in range(num...
f9a841b92d4736a992b08fffafee5245b40a042d
SabithaSubair/pythonpgms
/flowcontrols/second largest no.py
347
4.1875
4
num1=int(input("number1")) num2=int(input("number2")) num3=int(input("number3")) if((num1>num2)^(num1>num3)): print(" 2nd greater number is:",num1) elif((num2>num1)^(num2>num3)): print("2nd greater number is:",num2) elif((num3>num2)^(num1<num3)): print(" 2nd greater number is:",num3) else: ...
cc0c7322ce17ab845f6b6eb23b8b549e2810d112
RF-Fahad-Islam/Python-Practice-Program
/jumble_funny_names.py
847
4.0625
4
''' Author : Fahad Practice Problem 9 Solution ''' import random def jumbleName(nameList): #* Jumbled the names lastnames = [] firstnames = [] jumbled = [] for name in nameList: name = name.split(" ") for i in range(1,len(name)): lastnames.append(name[1]) ...
fd645ecff92258000da58498e9f4288ab2c50143
oneandzeroteam/python
/rhino/1부터n까지합.py
196
3.765625
4
''' i = 0 sum = 0 n = int(input()) while i < n: i += 1 sum += i print(sum) ''' n = int(input()) total = 0 for x in range(1,n+1): total = total + x print(total)
b364bfa326f2d94207dbaff2d93bc72065ea3cdb
timmalstead-cfa/mssql_server_data
/data/parser_join_tables.py
1,233
3.546875
4
from typing import List from csv import reader final_csv: str = "" try: with open("./join/services_organizations.csv") as csv_data: csv_file: List = list(reader(csv_data, delimiter=",")) for index, page in enumerate(csv_file): if(index == 0): final_csv += f"{','.join(p...
36a8cc1d565bd5fc18f49feebf892fa2364e24c8
Phantom1911/leetcode
/algoexpert/mergeSort.py
654
4.03125
4
def mergeSort(array): # Write your code here. if len(array) == 1: return array mid = len(array) // 2 leftHalf = array[:mid] rightHalf = array[mid:] return merge(mergeSort(leftHalf), mergeSort(rightHalf)) def merge(array1, array2): i, j = 0, 0 ans = [] while i < len(array1) ...
682cf2b673796e09e0a31d2386005cbe04763b96
yaHaart/hometasks
/Module16/10_simmetrical_seq/main.py
902
3.515625
4
n = int(input('Кол-во чисел: ')) numbers = [] for _ in range(n): number = int(input('Число: ')) numbers.append(number) revers_numbers = numbers.copy() revers_numbers.reverse() flag = True for i in range(len(numbers)): length_revers = len(revers_numbers) counter = 0 for j in range(length_revers): ...
4a4f5b35cc8f613ce39c9df5c17f6fa71e64d60c
sreyaandalkovil/CS421
/assignment15.py
2,270
3.53125
4
class moviecollection: def __innit__(self, list_of_movies): self.list_of_movies=list_of_movies def __repr__(self): return 'SILC(list_of_movies=%s)' % (self.list_of_movies) def __str__(self): return 'SILC(list_of_movies=%s)' % (self.list_of_movies) def...
56ca674a990ccc7ec73580e10d8ff8209ea540bd
alsgh4098/workspace_python
/venv/pkg/1__/test_8_26.py
335
3.625
4
#format함수를 이용한 입출력. age = 27 name = "진민호" print("이름은{0}, 나이는 {1}".format(name,age)) age = 44 print('I’m {0} years old.'.format(age)) print("*"*100) zzz = {"uid":"kim" , "upw":"111", "gen":"f"} print(zzz) print("*"*100) del zzz["uid"] print(zzz) print("*"*100) zzz.clear() print(zzz) # ^복습
29958f10a9f5e8c5e4f48a2bc922e85062b0a37f
xiangcao/Leetcode
/python_leetcode_2020/Python_Leetcode_2020/752_open_the_lock.py
2,643
3.640625
4
""" You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'. The wheels can rotate freely and wrap around: for example we can turn '9' to be '0', or '0' to be '9'. Each move consists of turning one wheel one slot. The lock initially starts at '0...
4bd5c3cb848171b556d89f2605e82febe1de37a6
annaymj/LeetCode
/KthLargestElementInAStream.py
1,630
3.96875
4
# -*- coding: utf-8 -*- """ Created on Sun May 26 23:01:40 2019 @author: annayu 703. Kth Largest Element in a Stream Easy 299 132 Favorite Share Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element. Your KthLargest...
482638594d178078403b0b2bf266bf96bff05a54
VincentMatthys/OMEN
/buildings.py
1,212
3.578125
4
# -*- coding: utf-8 -*- import overpass def get_buildings(response): """ Returns the list of buildings of the overpass api response """ # List of buildings buildings = [] # For every element in the features of the reponse for element in response['features']: # when the feature is a building if 'building'...
3095b2b7892f864a256ee9e1bc7ebee7a3bf87c3
ArmandoRuiz2019/Python
/POO/POO04/pruebas.py
841
3.90625
4
''' Created on Agosto, 2019 @author: Armando Ruiz Este ejemplo muestra como se usa el __str__ 1. Teníamos para mostrar los detalles del objeto el metodo "mostrarDetalles" 2. Si queremos imprimir un objeto, saca una referencia a la memoria 3. entonces definimos el metodo __string__ que regresa una cadena 4. y ya podem...
456d40e841815bc55fff9a88f7ec803151a1a8d8
jackandrea54/C4T39-NDN
/Lesson9MiniHack/ex6.py
241
3.90625
4
numbs = ["2","5","92","84","-99"] choice = int(input("What number: ")) for i in range(0,len(numbs)): if choice == int(numbs[i]): print("Found,","Position:",i+1) break elif i == len(numbs)-1: print("Not found")
7a742a675954bb8abb5b17e4037809147bbc94d8
LukeMcCulloch/PyCFD
/src/Utilities.py
9,690
3.53125
4
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sun May 5 15:14:18 2019 @author: luke """ import numpy as np from math import pi # An alias for np.linal.norm, because typing that is ugly def norm(vec, *args, **kwargs): return np.linalg.norm(vec, *args, **kwargs) # A quicker cross method when ...
6140ff8968cf8a88f4c8d016a29835e57b33dc66
SolidDarrama/Python
/Hands On Quiz/Hands on Quiz for Lists.py
1,522
4.21875
4
# Jose Guadarrama #10/22/2014 #create the list list = ['eggs', 'bacon', 'homefries', 'jelly', 'coffee'] #printed statement print('Your items:') #print list for item in list: print(item) #print Statement + # of items in list print('\nbreakfast has', len(list), 'items') #add two more items to the...
e7be281863c45e24fbbb20520c8491eee75ec3b3
docjulz/averages
/simple-grade-average.py
1,598
4.1875
4
# This program gets five test scores from the student # then displays their average test score and grade def main(): # NEED TO ASK IN MAIN print("Enter your exam scores") test1 = float(input("Enter score 1: ")) test2 = float(input("Enter score 2: ")) test3 = float(input("Enter score 3: ...
2ff13d1cd2670001094bf9c58da214cf6527148f
chunweiliu/leetcode
/problems/repeated-dna-sequences/repeated_dna_sequences.py
602
3.625
4
class Solution(object): def findRepeatedDnaSequences(self, s): """ :type s: str :rtype: List[str] Find these string * 10 chars * repeated """ STRING_LENGTH = 10 seen = set() repeated = set() for i in range(len(s) - STRING_LENG...
6e0a49f8816f28724a33ffbeac800e9caa12233d
poojan124/Competitive
/black_jack/main_file.py
5,488
3.59375
4
from abc import ABCMeta, abstractmethod from enum import Enum from random import shuffle import sys class Suit(Enum): HEART = 0 DIAMOND = 1 CLUBS = 2 SPADE = 3 class Card(metaclass=ABCMeta): def __init__(self, value, suit): self.value = value self.suit = suit self.is_av...
b05ea9b1800183cd6629f8d767ec990ff7facc3c
DiegoHeer/sec_web_scraping
/index.py
1,274
3.546875
4
import requests import urllib from bs4 import BeautifulSoup # Function that makes building url's easy def make_url(base_url, comp): url = base_url # add each component to the base url for r in comp: url = '{}/{}'.format(url, r) return url # Base url for the daily index files base_url = r'h...
1ad6b9dba65e1ed6b8c4f50cde56950109039294
youngkiu/keras-cats-dogs-tutorial
/dogs_vs_cats/plot_curve.py
2,280
3.671875
4
# https://machinelearningmastery.com/roc-curves-and-precision-recall-curves-for-imbalanced-classification/ from matplotlib import pyplot # example of a roc curve for a predictive model from sklearn.datasets import make_classification from sklearn.linear_model import LogisticRegression from sklearn.metrics import preci...
a71c4c22fecefcec3cfae1e5f9bd552a83cc4edf
DucThanh1997/Data-Structures
/binary tree.py
2,045
4.21875
4
# 1 phần tử trong cây được gọi là node # 1 node chứa 3 thứ: data, left node, right node # nếu bé hơn thì là left node nếu lớn hơn là right node # cài đặt: class Node: def __init__(self, data): self.data = data self.right_node = None self.left_node = None def insert(self, d...
a63be4ac96dad2dc8ae7286c78174e110b0b1357
olacodes/algorithm
/python/testing.py
500
3.609375
4
def almostIncreasingSequence(sequence): sorted_sequence = sequence # sorted_sequence.sort() diff1 = sorted_sequence[1] - sorted_sequence[0] count = 0; for i in range(len(sorted_sequence)-1): diff = sorted_sequence[i + 1] <= sorted_sequence[i] if diff: count += 1 ...
3773a12a30a27e85de2785845b16544e0c086576
lvhanh270597/Information-Retrieval
/source/processor/preprocessing/Tree.py
1,197
3.6875
4
from math import sqrt class Node: def __init__(self): self.info = None self.child = {} class Trie: def __init__(self): self.root = Node() def insertWord(self, word, info): p = self.root for c in word: if c not in p.child: p.child[c] = No...
9375d2922f06e50eaf5f626b6b212cd7ccf89ac4
mariurzua/nivelaci-n-mcoc
/27082019/000059.py
1,066
4.09375
4
# 11 minutos y 41 segundos # Se aprendio a multiplicar, sumar, y ordenar los numeros de una matriz. Tambien a trasponerla. import numpy as np #importacion libreria numpy from skimage import io #importacion io para leer la foto import matplotlib.pyplot as plt #importacion para que salga la imagen a_array = np.a...
f827e50ff838cffca57cd2491b03b61fd819686b
brianhang/tritonscheduler
/tritonscheduler/algorithm.py
11,990
3.640625
4
#!/usr/bin/env python import itertools from random import uniform from random import randint from classtime import ClassTime # Restrictions on class times. TIME_EARLIEST = ClassTime.fromString("MTuWThFS 12:00a-8:00a") TIME_LATEST = ClassTime.fromString("MTuWThFS 4:30p-11:50p") TIME_LUNCH = ClassTime.fromString("MTuW...
a7f22bb2b4427ef1c30b92eded5c99b509cb2726
ValenokKib/lessons_python_base
/Yakovenko_Valentin_dz_5/dz_5.1.py
148
3.9375
4
def odd(num): for num in range(1, num + 1, 2): yield num n = int(input('Введите число: ')) for i in odd(n): print(i)
ad0ec00200704e3121627d681369d4a3a604619a
Just-CJ/PAT
/PAT (Basic Level) Practise/1028. 人口普查/popularity.py
859
3.734375
4
__author__ = 'Just_CJ' import re import datetime if __name__ == '__main__': num = int(raw_input()) today = datetime.date(2014, 9, 6) min_p = ['', 200*266] max_p = ['', -1] eff_num = 0 for i in range(num): name, birth = re.split(r'\s+(?!$)', raw_input()) birth = birth.split('/')...
a355def05be55a805a617ac0e5ad9442ffb9ffb2
felcygrace/guvi_beginner-py
/sum_of_arithmetic.py
103
3.578125
4
n=int(input()) a=int(input()) d=int(input()) sum1=0 for i in range(a,n+1,d): sum1=i+sum1 print(sum1)
75738704a97581fb560291b1430057b5914861a2
gabriellaec/desoft-analise-exercicios
/backup/user_105/ch36_2019_09_04_18_57_06_740316.py
513
4.09375
4
numero = int(input('diga um numero')) divisor=2 if numero==2: print('primo') elif numero==1: print('nao é primo') elif numero==0: print('nao é primo') else: if numero%2==0: print('nao é primo') elif numero%2!=0: while((divisor+2)<numero): ...
084d28fe2f41314978fc795c90ca6c2c32aa3b06
ngintaka/CS-learning
/python/scripts/iterPower.py
219
3.53125
4
def iterPower(base, exp): ans = base if exp == 0: ans = 1 elif exp == 1: ans = base else: while exp > 1: ans = ans * base exp -= 1 return ans
d3ff5c5d855b26d04851a403b2b4b2b0eb21b862
ggabriel96/mapnames
/mapnames/string.py
12,334
3.765625
4
import operator as op from collections import Counter from collections import defaultdict as ddict import numpy as np def diff_view(str1, str2): """ Calculate the lengths of the longest common prefix and suffix between str1 and str2. Let str1 = axb of length m and str2 = ayb of length n, then this f...
9dc9394bc7cc097a4ee298ea1383d6b4cfbe759b
ARN0LD-2019/Ejercicios_Python_2020
/unidad15/ejercicio3.py
275
3.6875
4
# FUNCIONES GENERADAS numero = [] for numero in [0, 1, 2, 3, 4, 5]: if numero % 2 == 0: print(numero) def pares(n): for numero in range(n + 1): if numero % 2 == 0: yield numero numero = [numero for numero in pares(10)] print(numero)
1022bd49507bcfbbfce65265115fdd2f1c217166
guzvladimir/epam_homeworks
/homework_11/task02/task02.py
1,692
4.375
4
""" You are given the following code: class Order: morning_discount = 0.25 def __init__(self, price): self.price = price def final_price(self): return self.price - self.price * self.morning_discount Make it possible to use different discount programs. Hint: use strategy behavioural OOP p...
8028bf38ea033edaf31d753a7e2e319ce931701c
leexiaosi/learnPython
/python-visual-quickstart-guide-3/chapter-03/s-33.py
689
4.125
4
# -*- coding: utf-8 -*- import unittest class S33Test(unittest.TestCase): # 输入文件 def test_input(self): name = input('What is your name?') print('hello ' + name.capitalize() + '!') self.assertEqual(name, 'ldh') # 过滤空白 def test_strip(self): name = input('What is your nam...
5e229dcbd2e292347706cfe106c7e5da95e715e7
FunsoAdetola/SCAMP-Assesment
/fibonacci.py
159
4.0625
4
fibonacci = int(input("How many Fibonacci numbers? ")) a = 0 b = 1 for i in range(fibonacci): print(a) first = a a = b b = first + a
93366aaa04027d1ede6de458123e4db79aab5e99
Vrushali-Kolhe/Assignments
/ass4/shapes.py
3,060
3.828125
4
from math import sqrt class Shape: #base class pass class Circle(Shape): #derived class def set_radius(self, radius): self.__radius = radius def get_radius(self): return self.__radius def area(self): return 3.14* self.get_radius() * self.get_radius() de...
f4506a41f21652bd250f6896810cd6fbdec72bfb
Aasthaengg/IBMdataset
/Python_codes/p03042/s013075072.py
186
3.84375
4
s=int(input()) a=s//100 b=s%100 if a>0 and a<=12: if b>0 and b<=12: print("AMBIGUOUS") else: print("MMYY") else: if b>0 and b<=12: print("YYMM") else: print("NA")
feba84a102d87b02caaf4a54f255ceb9a96fd2c5
LouiseJGibbs/Python-Exercises
/Python By Example - Exercises/Chapter 09 - Tuples, Lists and Dictionaries/069 Country Tuple select country.py
268
4.21875
4
#069 Country Tuple country_tuple = ("UK", "France", "Germany", "Holland", "Spain") print(country_tuple[0:5]) selection = input("Which country would you like: ") print("You have selected " + selection+ ". The index for this is " + str(country_tuple.index(selection)))