blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
fc088d54119dc09d11442c5ead6f39c98a41fc7f
asharali95/AI-ML-Algorithms
/Un-informed search techniques/dfs.py
913
3.546875
4
dictree={'A':['B','C','D'],'B':['A','F'],'C':['A'],'D':['A','F'],'E':['B','F'],'F':['D','F']} roottree=list(dictree.keys()) openlist=[] closelist=[] traversalturn=1 print("Graph:\n",dictree) openlist.append(input("Select initial State: ")) goalstate = input("Select Final State:") print(f"openlist:{openlist}\t\t\t\t\t c...
3fe7c04025b24a38142e59b59f6817c2cf20a66b
schleppington/HackerRank
/Stacks: Balanced Brackets/balancedbrackets.py
809
3.9375
4
def is_matched(expression): expression = list(expression) openlist = ['[', '{', '('] closelist = [']','}', ')'] closedict = {'[':']','{':'}','(':')'} balance = [] if(expression[0] in closelist): return False while(len(expression) != 0): cur = expression.pop(0) if(cur ...
00c9ddc718cb8f014658527646c11398976c5398
osmanatam/covid19
/corona-train-test-split.py
1,126
3.609375
4
''' * Zaman Serisi Tahmini Uygulamaları * Corona Virüs Günlük Onaylı Vaka sayısını 3 kademeli eğitim ve test setine ayrıştırma * Tarih: 04 Nisan 2020 * Hazırlayan: Bilishim Siber Güvenlik ve Yapay Zeka * Bu çalışmalar yalnızca ARGE ve bilgiyi geliştirmek maksadıyla hazırlanmış olup, herhangi bir resmi temsil ya da...
0cf691f1f1eecfa0bfef95058451938e4032e9f4
robotbanker/PersonalAssistant
/venv/Dates.py
1,212
3.6875
4
from datetime import datetime from dateutil.relativedelta import relativedelta td= datetime.today().weekday() days_in_gym = ['Monday','Wednesday','Friday','Tuesday','Saturday'] days_of_week_code = { 'Monday': 0 , 'Tuesday': 1, 'Wednesday': 2, 'Thursday': 3, ...
8686eac5d44278f6c2cb72db51d4d6ea1ac41470
vipul02/py-assign
/p5.py
600
4.09375
4
def binarySearch(arr, first, last, ele): if last>=first: mid = int(first + (last - first)/2) if arr[mid] == ele: return mid elif arr[mid] > ele: return binarySearch(arr, first, mid-1, ele) else: return binarySearch(arr, mid + 1, last, ele) ...
89e597017be7580b0a9dce2b24d26a91bbd1bb07
illmatictime/python-mini-project
/Assignment5_.py
2,502
3.578125
4
def setZero(aList): for x in range(len(aList)): aList[x] = 0 def inputArray(alpha): print("Enter 20 integers:") for x in range(20): alpha[x] = int(input()) def doubleArray(alpha, beta): for x in range(len(alpha)): beta[x] = 2 * alpha[x] def copyGamma(gamma, inStock): # ...
3d89a471d32de0ad8be7f33d47e1126bc5d0e1e1
gromang/lesson1
/lists.py
172
3.671875
4
num_list=[3,5,7,9,10.5] print(num_list) num_list.append('Python') print(len(num_list)) print(num_list[0]) print(num_list[-1]) print(num_list[1:4]) num_list.remove('Python')
170ef074648cc3677e4c8fe636cba9f41d801325
SoutrikPal/PongGame
/pong.py
2,877
4.03125
4
import turtle win=turtle.Screen() win.title("Pong game by Soutrik Pal") win.bgcolor("black") win.setup(width=800,height=600) win.tracer(0) #stops window from updating score_a=0 score_b=0 #Creating shapes and the objects of the game #Paddle A paddle_a=turtle.Turtle() ...
285322d0d277d85bb763fc361cb328bb0a03b6c0
girijads/girija
/python_programs/M/mean.py
459
3.65625
4
meanings={'print':'print_to_console','for':'iterate','while':'flow_control','break':'interrupt','not':'negates'} print("The meaning of Print is:" +meanings['print'].title()+'.' +"\n") print("The meaning of for is:" +meanings['for'].title()+'.' +"\n") print("The meaning of while is:" +meanings['while'].title()+'.' +"\n"...
50ce156854675f471877a7cf31fe82342e12c2a8
varshilgandhi/How-to-use-Random-Forest-in-Python
/How to use Random Forest in Python.py
4,667
3.953125
4
# -*- coding: utf-8 -*- """ Created on Tue May 11 08:45:31 2021 @author: abc """ import pandas as pd from matplotlib import pyplot as plt import numpy as np #read our data df = pd.read_csv('images_analyzed_productivity1.csv') print(df.head()) # Let's see how many values are divided into good or bad ...
ff96f36001b724d315b48634848ed966e743c769
jc5121/TargetOffer
/Array/ReorderArray.py
690
3.9375
4
# -*- coding:utf-8 -*- # 基于交换无法保证原相对顺序不变 # 改变原数组中数的顺序,奇数在前,偶数在后 # 从两边向中间找 def reOrderArray(array): i = 0 j = len(array) - 1 while i < j: if (array[i] % 2 == 1) and (array[j] % 2 == 1): i += 1 elif (array[i] % 2 == 0) and (array[j] % 2 == 1): # 只有这种情况需要交换 array[i], ...
27ec6572ed6586080e8eb9d7b6b077d3fafb1506
d36choi/python-codingtest
/graph/10-2.py
687
3.578125
4
from sys import stdin def find_parent(parent,n): if parent[n] != n: return find_parent(parent,parent[n]) else: return n def check_team(parent,a,b): a = find_parent(parent,a) b = find_parent(parent,b) if a==b: print("YES") else: print("NO") def union_team(parent,a,b): a = find_parent(p...
d90d3733eae411921f1d37e837d24716e6a5cd27
usrfrann/hackingtools
/transpositionDecryption.py
1,333
3.921875
4
#Transposition Cipher Decryption import math, pyperclip def main(): myMessage = 'Cenoonommstmme oo snnio. s s c' myKey = 8 plaintext = decryptMessage(myKey, myMessage) print(plaintext + '|') def decryptMessage(key, message): #The number of columns in our transposition grid #Must form a rotated gr...
ae968f7561fab037f39dba5e47eb745058a1ba24
UchihaSean/ReinforcementLearningForDialogue
/bleu.py
1,534
3.703125
4
# -*- coding: UTF-8 -*- import csv import numpy as np def evaluation_bleu(eval_sentence, base_sentence, n_gram=2): """ BLEU evaluation with n-gram """ def generate_n_gram_set(sentence, n): """ Generate word set based on n gram """ n_gram_set = set() for i in ran...
3fe55ac046133bafda4fa83e479b9cd0e6137639
yyellin/tacred-enrichment
/tacred_enrichment/extra/json_to_lines_of_json.py
678
3.515625
4
"""json to lines of json Usage: json_to_lines_of_json.py [--input=<input-file>] [--output=<output-file>] Options: -h --help Show this screen. """ import sys import json import ijson from docopt import docopt if __name__ == "__main__": args = docopt(__doc__) input_stream = open(args['--input'], enc...
fa16d5bec0d26388eeb52610633fd3fe1eb8d6da
evab19/forritun
/numbers.py
615
4.15625
4
#Finds and prints all positive two digit numbers whose square of the sum of its digits is equal to the number. for double_digit in range(10,100): first_digit = double_digit // 10 second_digit = double_digit % 10 if (first_digit + second_digit)**2 == double_digit: print(double_digit) #Fi...
20eb595e619c25ec1addbe33c2ca4095be0f879e
dat-adi/image-processing
/basics_of_computer_vision/flipping.py
886
3.53125
4
# importing argument parsers import argparse # importing the OpenCV module import cv2 # initializing an argument parser object ap = argparse.ArgumentParser() # adding the argument, providing the user an option # to input the path of the image ap.add_argument("-i", "--image", required=True, help="Path to the image") ...
b46cb54daefb528505ad3597e1e7b19b401a4833
parthpm/Python-Basics
/forloop4.py
183
3.875
4
for l in range(1,101): if l%3==0 and l%5==0: print("FIZZBUZZ") elif l%3==0: print("FIZZ") elif l%5==0: print("BUZZ") else: print(l)
a12aac0fc282bfc7d9f327c7db2860f25d7eeb4c
popcorn-ceiling/cpsc462
/hw3/hw3.py
36,936
3.84375
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """hw3.py: Data mining assignment #3: Data classification and evaluation. Reads in two data sets, auto-mpg and titanic. Classifies them using up to four different classification algorithms. Computes predictive accuracy, standard error, a...
bbe7ae258cfdee4ecca2cbf75a7a1c6100750ca1
ezequielln87/python
/introducao_python/sp7 - BubbleSort.py
338
3.984375
4
def bubbleSort(list): n = len(lista) for j in range(n - 1): for i in range(n - 1): if list[i]>list[i+1]: temp = list[i] list[i] = list[i+1] list[i+1] = temp print(list) lista = [54, 26, 93, 17, 77, 31, 44, 55, 20] bubbleSort(l...
fc9ce2ef1011568fc1fda03ed21e21196be8f7ee
Stevenzzz1996/MLLCV
/Leetcode/链表/23. 合并K个排序链表.py
1,469
3.53125
4
#!usr/bin/env python # -*- coding:utf-8 -*- # author: sfhong2020 time:2020/5/8 15:24 class Solution: def mergeKLists(self, lists: List[ListNode]) -> ListNode: if not lists: return n = len(lists) return self.merge(lists, 0, n - 1) def merge(self, lists, left, right): if left ==...
29f5419b1794de879c240f8766ba0a4d10d0d7aa
jaraco/jaraco.mongodb
/jaraco/mongodb/cli.py
622
3.671875
4
import argparse def extract_param(param, args, type=None): """ From a list of args, extract the one param if supplied, returning the value and unused args. >>> extract_param('port', ['foo', '--port=999', 'bar'], type=int) (999, ['foo', 'bar']) >>> extract_param('port', ['foo', '--port', '999'...
5573bf45782baf7bb3170e9a44e36e60817610fb
JinkProject/Overlapping-Rectangles
/overlapping.py
372
3.5
4
#Overlapping Rectangles Code import sys with open(sys.argv[1]) as f: for line in f: line=line.strip().split(',') b=[] for num in range(4): b.append(line.pop()) a=line intersect=list(set(a).intersection(b)) if intersect!=[]: print "Fal...
f925f01593fc2c957ffdef46d99f750452301af3
ChangxingJiang/LeetCode
/1701-1800/1739/1739_Python_2.py
1,434
3.640625
4
class Solution: def minimumBoxes(self, n: int) -> int: # ---------- 二分计算可以堆放的最大层数 ---------- left, right = 1, n while left < right: mid = (left + right) // 2 if mid * (mid + 1) * (mid + 2) // 6 < n: left = mid + 1 else: righ...
9bf9d2ca7dda0326419c616aaac36aa7b16f352f
anna-marina/python
/Easter.py
341
3.65625
4
year = int(input()) a = (19 * (year % 19) + 15) % 30 b = (2 * (year % 4) + 4 * (year % 7) + 6 * a + 6) % 7 if a + b > 9: t = a + b - 9 if (t + 13 < 31): print ( "the", t + 13, "of" , "April") else: print ( "the", t + 13 - 30, "of" , "May") else: t = 22 + a + b + 13 - 31 print ( "the"...
c0f4f1ee35cbc3ce3b462aa9681a897c21d244fc
Caseca93/Programas-Python
/ProjetoBanco/models/cliente.py
1,597
3.515625
4
from datetime import date from datetime import datetime from time import time from utils.helper import data_para_str, str_para_data, hora_para_str class Cliente: contador: int = 101 def __init__(self: object, nome: str, email: str, cpf: str, data_nascimento: str) -> None: self.__codigo: int = Client...
8ecd48489390246f6ee8aeb1c962e80d7779ab2a
karunesh95/karunesh
/Karunesh/Python_day2/Q10.py
199
4.15625
4
m=int(raw_input("Row?")) n=int(raw_input("Column?")) if m>=3 and n>=3: for i in range(m): if i<m-1: print "*" elif i==m-1: print "*"*(n) else: print "Cant Print L for This size"
1205e1a77eb7f08f9d46f5555b8b19ccd848fc07
joilsonlira/python_exercice
/estrutura_sequencial/ex_7_quadrado_area_dobro.py
472
4.25
4
#Faça um Programa que calcule a área de um quadrado, em seguida mostre o dobro desta área para o usuário. #--variaveis-- lado_y = float lado_x = float area = float dobro = float #--solicitando lados X e Y-- lado_y = float(input("Informe o lado y:")) lado_x = float(input("Informe o lado x:")) #--calculando area e o d...
47a262ae915ad1ed282ef858bae0f9b9c85d96d2
samuele-mattiuzzo/project-euler
/004.py
548
4.0625
4
#!/usr/bin/python import os, sys def solve(): print ''' Problem 4 A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 * 99. Find the largest palindrome made from the product of two 3-digit numbers. ''' res = -1 for c in range(999...
ac76e78761b4bcdd8ae964afc3dc467c1f322abd
eserebry/holbertonschool-higher_level_programming
/0x00-python-hello_world/5-print_string.py
89
3.546875
4
#!/usr/bin/python3 str = "Holberton School" print("%s%s%s\nHolberton" % (str, str, str))
cbfdaf755821e36e6865703617d8f5e19bbebf7d
padmanabh007/PYTHON
/Gpython/pattern.py
183
3.734375
4
n=int(input('Enter the number of rows of * required ')) for i in range(1,n+1): if i%2==0: s=int((n-i)/2) for j in range(2): print(" "*s,"*"*i)
3ef9ccba368b2fae45417d0418c453b9317ca1f4
FarhadiRad-ahmad/coffee-machine
/coffee.py
4,610
4.28125
4
class CoffeeMachine: # Machine Initial Quantity machine_water = 400 machine_milk = 540 machine_coffee = 120 machine_cups = 9 machine_money = 550 #1 espresso espresso_water = 250 espresso_coffee = 16 espresso_cost = 4 #2 latte latte_water = 350 latte_milk = 75 ...
575194168756c3d237e89d79418c8821fa872d6f
richardarchbold/eamm
/eamm/testing/date_iteration.py
390
4.0625
4
#!/usr/bin/python def is_weekday(date): pass start_date = 16 #(wed) end_date = 30 # recur daily date = start_date while date <= end_date: if is_weekday(date): print(date) date += 1 # recur weekly date = start_date while date <= end_date: print(date) date += 7 # recur monthly (re...
25e9f78de0047b19be58719715658646f9f83377
cswales/CheeseCave
/watchdog/datetest.py
126
3.578125
4
#!/usr/bin/env python import datetime now = datetime.datetime.today() print "the date is: {:%Y:%m:%d-%H:%M:%S-%z}".format(now)
59a4bf91dd157197379f3fc6d309f1014206ac86
Daniel-code666/Programas
/ejerciciosFunc.py
1,336
4.03125
4
# Escriba una función que dado un número n calcule sus factores primos. # La función debe retornar una lista con los números primos que descomponen el numero n. # Ejemplo si n = 100, la descomposición en factores primos es [2,2,5,5] # (Numeros primos: 1 2 3 5 7 11 13 17 19 23...) # Instrucciones # ...
1c84f2f1859a56a91a53a5a53924db1a53807c38
swang2000/CdataS
/Bits/flipbittowin.py
637
3.75
4
''' Flip Bit to Win: You have an integer and you can flip exactly one bit from a 0 to a 1. Write code to find the length of the longest sequence of 1 s you could create. EXAMPLE Input: 1775 (11011101111) Output: 8 ''' def longestones(a): n = len(bin(a)[2:]) zeros = [] for i in range(0, n): if (a...
61f5f43da99ef638a85280b6612d922663e659f9
singaramsingu/guvi
/sort.py
127
3.640625
4
size=int(input()) l=raw_input().split() list1=[] for i in l: list1.append(int(i)) list1.sort() for i in list1: print(i),
92320d4ef305ea15edc847c1892a0c2f22f759af
isabella232/Bike_Rental
/bikeRental.py
1,289
4.03125
4
import datetime class BikeRental: def __init__(self,stock=0): """ Our constructor class that instantiates bike rental shop. """ self.stock = stock class Customer: def __init__(self): """ Our constructor method which instantiates various customer objects. ...
eb81ab65f28e37a04a9e1c6fc7eebfdacdb853fa
tyagow/google-python-exercises
/URI/uri1002.py
75
3.6875
4
r = float(input()) n = 3.14159 area = n * (r * r) print("A=%0.4f" %area)
f781c10ac29ed20c7ae172969496c4f1b47e9c7d
ManuFoscarini/INE5609
/Recursão/exercicio3.py.py
151
3.8125
4
def recursao(n): if n <= 0: return 0 else: return str(n) + str(recursao(n-1)) + str(n) print(recursao(int(input())))
90684599589174422d9e63d3798ac69bee96af93
NathanNCN/Text-based-game
/text_game_fixed.py
5,234
3.765625
4
import random default_attack=["Punched","Slashed","Stabbed","shot"] class person: def __init__(self,hp): self.type_of_attack=random.choice(default_attack) self.hp = hp self.attack_damage=random.randint(5,12) def attack(self,monster): monster.hp -= self.attack_damage prin...
a66513096b0e5732509f15d03831cf37219e226f
vishnudk/algorithms
/bothList.py
778
3.5
4
#!/bin/python3 import math import os import random import re import sys import itertools # # Complete the 'getTotalX' function below. # # The function is expected to return an INTEGER. # The function accepts following parameters: # 1. INTEGER_ARRAY a # 2. INTEGER_ARRAY b # def getTotalX(a, b): fun = lambda x,y:...
1621fb2db3764a635c3374da7fa67dbdb2867cb6
HuFlungDu/libretro-cython
/retro/video/scaling.py
2,263
3.921875
4
""" Calculate the on-screen dimensions of the SNES frame. """ # Numbers stolen from bsnes. NTSC_ASPECT = 54.0 / 47.0 PAL_ASPECT = 32.0 / 23.0 # The SNES also has a 512px hi-res mode, but it does not change the width of # the image on-screen, so we can do all our calculations for the 256px image. SNES_WIDTH = 256 SNES...
b00a15839886bbf8b7b0264813e30e7fd8e2c670
ZhengLiangliang1996/Leetcode_ML_Daily
/contest/biweekcontest40/mergeinbetweenlinkedlist.py
1,045
4.03125
4
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2022 liangliang <liangliang@Liangliangs-MacBook-Air.local> # # Distributed under terms of the MIT license. # Definition for singly-linked list. # class ListNode(object): # def __init__(self, val=0, next=None): # self.val = val ...
c7492125857f4684fff9d27809a106869633c35f
cristianrcv/pycompss-autoparallel
/pycompss/util/translators/py2scop/tests/test1_ast_generation.py
2,419
4.1875
4
# Without loops def empty(a, b, c): print("HEADER") print("FOOTER") # Single loop with different header / footer options def simple1(a, b, c): print("HEADER") for i in range(1, 10, 1): c[i] = c[i] + a[i] * b[i] print("FOOTER") def simple2(a, b, c): for i in range(1, 10, 1): c...
f5a69bcb5b53eb6bbb7fb6bd2dbba4db61d1d62c
gayu2723/python
/ntimes.py
141
3.734375
4
def ntimes(): n=int(input()) sum=0 for n in range(0,n,1): hello=sum+n print("hello") ntimes()
9f4d4c934f041295ed01df6992d30d9d2179dc5c
vinamrathakv/pythonCodesMS
/RowsColumnsHighest1s11_10.py
1,761
3.6875
4
import random def getRandomMatrix(r,c): matrix = [] noOfRows = r noOfColums = c for i in range(r): row = [] for j in range(c): value = random.randint(0,1) row.append(value) matrix.append(row) for i in matrix: print(i) ...
930b5c73148a5736372d7ca9293eef5a4f424acf
aldotele/the_python_workbook
/repetition/ex83.py
738
4.09375
4
# exercise 83: Maximum Integer import random # if using randrange() the second argument would be excluded random_value = random.randint(1, 100) # first number that is extracted will start as maximum value maximum = random_value print(maximum) # number of times I get a new maximum number updates = 0 # start looping ...
9cd826f8ada3dddd694f6f61ce88a21d3f2128b9
DrNogNog/Octocat
/GitHub Octocat Terminator.py
4,768
4.1875
4
# -*- coding: utf-8 -*- """ Created on Sat Nov 14 22:11:24 2020 @author: Gordo """ import turtle import math def talloval(r): # Verticle Oval turtle.left(45) for loop in range(2): # Draws 2 halves of ellipse turtle.circle(r,90) # Long curved part turtle.cir...
49c03b29825481cf3c7d2306574d90bf2ee44562
metalaarif/python-basic-apps
/londonacademy_intermediate/Classwork.py
444
3.828125
4
# # # Question 1 # # x = "aarif" # # print(type(x)) # # a = set(x) # # print(type(a)) # # # Question 2 # # # Question 3 # class foo: # def __init__(self, x): # self.x = x # def __lt__(self, other): # if self.x < other.x: # return True # else: # ret...
f1d64d7c62b184e96acfb6def9f76ad0bfa8fe46
MaximSinyaev/CodeWars
/c6kyu/Multiples of 3 or 5.py
260
3.6875
4
def solution(number): sum = 0 max_3 = (number - 1) // 3 max_5 = (number - 1) // 5 for i in range(1, max_3 + 1): sum += i * 3 for i in range(1, max_5 + 1): if i % 3 != 0: sum += i * 5 return sum print(solution(10))
ef8cf2646dd82c9f89887a639d4103802e19ac04
Terrrenceliu/hercules.python.pro
/Thread/thread.py
1,438
3.828125
4
#-*- coding: utf-8 -*- import threading,time #print help(threading.Thread) class Producer(threading.Thread): def __init__(self, t_name): threading.Thread.__init__(self) self.name=t_name def run(self): global x con.acquire() if...
2476c1ade70021e5da3b8a1c203eea950613af3c
nguyen06/Codes
/Python/thinkpython/url.py
345
3.640625
4
import urllib zipcode = raw_input("what is the zip code?") url = 'http://uszip.com/zip/' + zipcode conn = urllib.urlopen(url) for line in conn.fp: line = line.strip() if 'Total population' in line: print line if 'Asian' in line: print line if 'White' in line: p...
9b075579c0bb43082262b7d5709f7d051e34ff4d
aniketshelke123/hello-world.io
/unknown.py
459
3.9375
4
def reverseDisplay(number): # base case if len(str(number)) < 2: return (number) else: # get the last number lastNumber = str(number)[-1:] print(lastNumber) # get everything else print("*****") everythingElse = int(str(number)[:-1]) ...
00b3ef6f3814a6819150da830fe8e5a6f48bbe05
damifi/AlgorithmsAndDataStructures
/SortingAlgorithms/insertion_sort.py
693
4.34375
4
"""Insertion sort: Takes a single element and places it in the correct location. Complexity: Time: Worst case: O(n^2), Best case: O(n) Space: Worst case: O(n^2), O(1)""" def insertion_sort(list): i = 1 while i < len(list): j = i while j > 0 and list[j-1] >list[j]: temp = li...
a82be00f38de1eab6d53356e9d4be20b7ef7ae70
meghoshpritam/univ-sem2
/cg/assignment2/mid_point_circle_drawing.py
880
3.703125
4
from base import put_pixel, Window def mid_point_circle_drawing(canvas, x0, y0, radius): x = radius y = 0 err = 0 while x >= y: put_pixel(canvas, x0 + x, y0 + y) put_pixel(canvas, x0 + y, y0 + x) put_pixel(canvas, x0 - y, y0 + x) put_pixel(canvas, x0 - x, y0 + y) ...
379673392b0b06490c1e6bf173da4b1441d8242f
litvinovserge/WebAcademy
/HomeWork_03/HomeTask_3.py
971
4.09375
4
''' Написать функцию is_prime(a), которая принимает число и возвращает True или False в зависимости от того, простое это число или нет ''' def is_prime(a): a = abs(int(a)) checker = 0 if a == 2: print('Число', a, 'является простым') return True elif a % 2 == 0: print('Число', a,...
65c00355d2eded1f12971a6681aa7fb44e24fe8a
renowncoder/hello-interview
/Arrays and Strings/StringCompression.py
817
3.84375
4
""" Given an array of characters, compress it in-place. https://leetcode.com/problems/string-compression/ """ class Solution: def compress(self, chars) -> int: start = i = 0 while i < len(chars): char, length = chars[i], 1 while i + 1 < len(chars) and char == chars[i+...
cece27bc41788bbaa18b47e69c62af67f08ed7f3
jackrmiller/Software-Development
/linecount.py
216
3.703125
4
#Jack Miller #lab 1 userInput = input("Enter file name: ") File = open(userInput,"r") count=0 read = File.readline() while(read!=""): count+=1 read = File.readline() print("Number of lines =", count) File.close()
b05aa296654075e0ec27c5bdd636a5691a9200d5
reshma-jahir/GUVI
/setla56.py
118
3.578125
4
rrt=input() for i in range(0,len(rrt)): if(rrt[i].isalpha() and rrt[i].isdigit()): print("No") else: print("Yes")
46372a3683abb2446978c0f23f9e11d93200b656
Kimsunghee3/pythontest
/python/criminal.py
414
3.84375
4
import random score = 0 while True: room = random.randint(1, 3) n = int(input("방번호를 입력하세요:")) if n == room: print("범인체포!") score += 100 break elif n > 3: print(n, "번방은 없습니다.") else: print("범인이 없습니다.") score -= 10 print("게임종료") ...
3266d3841b279cd38780eec55ed506f205e98728
jf1130/Programas
/Ejercicio1.py
448
3.640625
4
nA = float(input('Nota del primer parcial')) nB = float(input('Nota del segundo parcial')) nC = float(input('Nota del tercer parcial')) IN = float(input('Poner el numero de insistencias')) A = nA * 0.35 B = nB * 0.35 C = nC * 0.30 R = A + B + C if (R >= 3.0): if (IN < 12): print("felicidades su nota ...
d3e03fca8fe1610f01e0495a74be2d992e4f0258
aliKatlabi/Python_tut
/tutorial/modules/server/connection.py
203
3.578125
4
ports = 443,445,1031 def check(port): """ checking """ if port in ports: return True def connect(port): """ connecting """ if(check(port)): print("connected") else: print("bad port")
331279d18654419c37afc0b5c8ae8a56bbea7699
ZXCRoMiTos/LabaShariya
/Task_5.py
668
4.15625
4
# Введите с клавиатуры текст. Программно найдите в нем и выведите отдельно все слова, которые начинаются с большого # латинского символа (от A до Z) и заканчиваются 2 или 4 цифрами, например «Petr93», «Johnny70», «Service2002». # Используйте регулярные выражения. import re def find_words(text): return ...
c68db87587783c144bb15614a9082691ddeaa855
natdelgado/JugandoConPython
/convertidorTempt.py
168
4.09375
4
#Convertidor de temperatura de Celsius a Fahrenheit celsius = int(input()) def conv(c): f = 9/5 * c + 32 return f fahrenheit = conv(celsius) print(fahrenheit)
8e98864eada8ce811eff9da46b2eeb81bbfb71c2
ammiranda/CS325
/week3/palindrome/palindrome.py
507
3.6875
4
#!/usr/bin/python3 def panlindrome(seq): n = len(seq) L = [[0 for x in range(n)] for x in range(n)] for i in range(n): L[i][i] = 1 for cl in range(2, n + 1): for i in range(n - cl + 1): j = i + cl - 1 if seq[i] == seq[j] and cl == 2: L[i][j] = 2 elif seq[i] == seq[j]: ...
125c0cd77281b4225956560f50e4fcba27a9877b
Zhas1ke/codility
/lesson 7/2. Brackets.py
394
3.71875
4
S = '{[()()]}' def pair(bracket): if bracket == '(': return ')' if bracket == '{': return '}' if bracket == '[': return ']' def solution(S): stack = list() for i in range(0, len(S)): if S[i] in ['(','[','{']: stack.append(S[i]) elif len(stack) > 0 and S[i] == pair(stack[-1]): del stack[-1] else:...
ff3290e40142224cd40b0eccaa45f50e267ce130
gervanna/100daysofcode
/w3resources/Basic_pt.1/33.py
456
4.28125
4
#Write a Python program to get the sum of three given integers. #However, if two values are equal sum will be zero. #02_13_21 def total_or_zero(num1, num2, num3): sum = num1 + num2 + num3 if num1 == num2 or num1 == num3 or num2 == num3: sum = 0 return sum print(total_or_zero(5, 8, 7)) #all nums ...
c59faacc6c48a3e21074484c23a46927e1839d5b
mtran2011/MLMC
/mlmc/stock.py
5,166
3.65625
4
import abc import itertools import math class Stock(object): ''' Abstract base class for a stock object Attributes: spot (float): the current spot price post_walk_price (float): the price at T after walking one full path ''' __metaclass__ = abc.ABCMeta def __init__(self, spot)...
50c2f0232a3725b0c1d8f38e6f1aad43f1250546
aditparekh/git
/python/lPTHW/ex24.py
883
3.75
4
print "Let's practice everything" print ' You\'d need to know \'about escapes with \\ that do \n newlines and \t tabs' poem=""" \t The lovely world with logice so firmly planted cannot discern \n the needs of love nor comprehend passion from intution and requires an explanation \n\t\t where there is none. """ print"...
ff71f7789dc80b7a18ed94cca753ffa010b7ca48
sivakrishnar/pythonplay
/insertion_sort.py
347
3.84375
4
def insertion_sort(ls): for index in range(1, len(ls)): for sub_index in range(0, index): if ls[index] < ls[sub_index]: ls[index], ls[sub_index] = ls[sub_index], ls[index] return ls if __name__ == "__main__": import random print(insertion_sort([random.randint(-1000, ...
da4fbc2755f662a60550e3f980bd46b1be0d7bf4
BootXXX/Develop-ENV
/FabricioMoreno-TrabajoAutonomo2/ex1.py
348
3.890625
4
estatura = float(input("Ingrese la estatura en metros: ")) peso = float(input("Ingrese el peso en kilogramos: ")) imc = peso/(estatura**2) tieneBajoPeso = imc < 18.5 tieneMedioPeso = 18.5 <= imc < 24.99 tieneSobrePeso = imc >= 25.00 print("Bajo peso: ", tieneBajoPeso) print("Peso Normal: ", tieneMedioPeso) print("So...
36f269e82ca860eed918d3a44512cb71df779331
Evaldo-comp/Python_Teoria-e-Pratica
/Livros_Cursos/Nilo_3ed/cap11/Exercicios/Exercicio_11-4.py
852
4.03125
4
""" Modifique o programa do Exercicio 11.3 de forma a perguntar dosi valores e listar os produtos com preços entre esses dois valores """ import sqlite3 from contextlib import closing valor1 = input("Informe o primeiro valor: ") valor2 = input("Informe o segundo valor: ") with sqlite3.connect("precos.db") as ...
d5e17d1522ae8e913794a526551d808a47909254
juancho1007234717/EJERCICIOS-PROGRAM
/Ejercicio26
1,516
3.546875
4
# -*- coding: utf-8 -*- """ Created on Thu May 13 19:09:38 2021 @author: juanj """ #Ejercicio que almacena en listas - procesa en funciones # Declarar las librerias a usar para la solucion import matplotlib.pyplot as plt #Generar las listas con los datos incializados nombreProducto=['Ron','Aguardiente','...
4681f53c20237503bd4ca8d6c7af71306e8566e2
unabl4/HR
/cavity_map/cavity_map.py
887
3.9375
4
# https://www.hackerrank.com/challenges/cavity-map/problem #!/bin/python3 # Complete the cavityMap function below. def cavityMap(grid): h = len(grid) w = len(grid[0]) d = [(-1,0),(0,1),(1,0),(0,-1)] # top, right, bottom, left z = set() # change set for y in range(1,h-1): for x in range(1,w...
2f5280df2f995401690f355b90d20353f90792b1
SheikhFahimFayasalSowrav/100days
/days031-040/day034/lectures/lec.py
314
4.125
4
age: int name: str height: float is_human: bool def police_check(a_age: int) -> bool: return a_age >= 18 age = 24 name = "Paula" height = 1.62 is_human = True print(age, name, height, is_human) age = int(input("Your age: ")) if police_check(age): print("You may pass") else: print("Pay a fine")
68e24a7a2ad20cf5b684e03f6fb5e2adf5e67fb4
Cosmic-rare/trash
/commandline.py
449
3.640625
4
import sys if __name__ == '__main__': args = sys.argv if 3 <= len(args): if args[2].isdigit(): if args[2] == "1": print("1") elif args[2] == "2": print("2") elif args[2] == "3": print("3") else: ...
3e5ce5c45ebe92b82440ca6eeaf8231a43b4e4df
Aasthaengg/IBMdataset
/Python_codes/p03657/s129334160.py
115
3.796875
4
x,y=map(int,input().split()) if x%3==0 or y%3==0 or (x+y)%3==0: print('Possible') else: print('Impossible')
36be59836b540903ff8c7a56ff2a24155e33a107
kiboook/Programmers
/Programmers/Stock.py
357
3.578125
4
from collections import deque def solution(prices): answer = list() prices = deque(prices) while prices: check = prices.popleft() sec = 0 for val in prices: sec += 1 if check <= val: continue else: break answer.append(sec) return answer prices = [1, 2, 3, 2, 3] # prices = [4, 4, 3, 5...
8405ef5637643515d0874ded4fa1659292778dba
jemd321/LeetCode
/35_search_insert_position.py
1,001
3.671875
4
class SearchInsertPosition: def search_insert(self, nums, target): if not nums: return 0 high = len(nums) - 1 low = 0 mid = None while low <= high: mid = low + (high - low) // 2 if nums[mid] == target: return mid ...
dd8bb929ee0bb253e911a63012bd096db452488a
JuneHerren/LeetCode-1
/simple/整数反转.py
938
3.71875
4
# !/usr/bin/python3 # -*- coding: utf-8 -*- # @Author: 花菜 # @File: 整数反转.py # @Time : 2020/12/7 22:18 # @Email: lihuacai168@gmail.com class Solution(object): """ >>> s = Solution() >>> s.reverse(1534236469) 0 >>> s.reverse(123) 321 >>> s.reverse(120) 21 >>> s.reverse(-123) -321 ...
e4d67e9b750b97cd4e8e79738f790a579377e67e
jungwongarden/python202002
/test03/mega/리스트05.py
636
4
4
# 점수 입력: 80 # 점수 입력: 90 # 점수 입력: 70 # ----------- # 점수의 합계: 240 # 점수의 평균: 80 jumsu = [] #빈 리스트 i = 0 sum = 0 while i < 3: data = input('점수 입력>> ') jumsu.append(int(data)) sum = sum + jumsu[i] i = i + 1 print(jumsu) print('합계: ', sum) print('평균: ', sum / i) # print(jumsu.count(70...
24f1269b713e3bd5220c5cc6b5b581acf23005cf
Wangi-C/PythonAlgorithm
/BinarySearch/BinarySearch_기출/1.py
359
3.546875
4
#정렬된 배열에서 특정 수의 개수 구하기 from bisect import bisect_left,bisect_right n,x = map(int,input().split()) data = list(map(int,input().split())) def count(data,x): left = bisect_left(data,x) right = bisect_right(data,x) return right - left if count(data,x) == 0: print(-1) else: print(count(d...
e8068b70abdeba2fdbbec98c661a5b654515610a
Abdilaziz/Self-Driving-NanoDegree
/Term 1/2. Introduction to Neural Networks/gradientDescentExample.py
1,635
3.90625
4
import numpy as np def sigmoid(x): """ Calculate sigmoid """ return 1/(1+np.exp(-x)) # Derivative of the sigmoid function def sigmoid_prime(x): return sigmoid(x) * (1 - sigmoid(x)) learnrate = 0.5 x = np.array([1, 2]) y = np.array(0.5) # Initial weights w = np.array([0.5, -0.5]) # Calculate...
5ad8757f39c5fb4de3b2d6c0f98149e8e99e118c
19133/Te-Reo-Maaori-Python
/difficulty.py
822
4.125
4
while True: # asks user if they would like to play the quiz on easy, medium, or hard user_difficulty = input("Would you like to play the quiz om easy, normal, or hard\n").lower() # if easy, the program will print easy difficulty questions (Haven't made the questions and answer component yet) if user_difficult...
6aebd6643432f6c9905a4e4c3c0c8593703ccee0
DVG-Group1/optimus-time
/SA.py
5,158
3.84375
4
#!/usr/bin/env python from Tkinter import * import random import time import math """ This version will visualize the annealing process in a window on the screen WARNING: This may run very slowly if you increase parameters beyond the defaults""" #config options for the screen frame canvasH = 600 canvasW = 600 psych...
ad700f2b42982027e101e59891a2d9a3adf4897a
BorisAbramovich/hc2
/hashcode/order.py
1,071
3.515625
4
from hashcode.location import Location class Order(object): def __init__(self, id, destination: Location, product_quantities): """order_list is a list of (product, num_items) tuples""" self.destination = destination self.list_of_missing_products = product_quantities self.id = id ...
9f6ad639dc5fa9ef3cb0f05e2a1cb87871bb8f7c
burakunuvar/introToML
/Python3/04assignment.py
602
3.78125
4
names = (input('Enter names separated by comas: ')).split(',') #print(names) assignments = (input('Enter assignment counts separated by comas: ')).split(',') #print(assignments) grades = (input('Enter grades separated by comas: ')).split(',') #print(grades) for i in range(0,4): message = "Hi {},\n\nThis is a remin...
d4e2c17a91d1f1b2b51c07e6d1abd75b604c2a08
AhmedAl-Doori/Engineering4_Notebook
/Python/02_Calculator.py
312
4.03125
4
while True: a = float(input("Enter first number ")) b = float(input("Enter second number ")) print("a + b = {s}".format(s=a+b)) print("a - b = {d}".format(d=a-b)) print("a * b = {p}".format(p=a*b)) print("a / b = {q}".format(q=a/b)) print("a % b = {m}".format(m=a%b)) print(" ")
eee517e924f83a9c412470471f335b5778e34e57
tylera277/barcodeReader
/positionOfBlackBars.py
6,541
3.703125
4
class PositionOfBlackBars: """ +Input an array of a picture, and get out the position of the pixels black marks of the barcode stripes """ def __init__(self, pic): self.pic = pic def position(self): """ Takes in the raw picture and outputs, at a certain height, the ...
ca16e9f3820da52a37748c1484672df75f4bcd3c
Dharma359/flames
/flames.py
1,384
3.890625
4
# function for remaining letters count def remaining_letters(f11,f12): count = 0 for x in f11: for y in f12: if x == y: f12.remove(y) count = count + 1 break print(f11,f12) return f11,f12,count def flames(total_length, flames_char)...
c94117a432720f386802a64e2bcc729d30cc13ab
RonnieGurr/Scraper
/scraper.py
816
3.5
4
import sys import scraperEngine def menu(): print 30 * "-" , "MENU" , 30 * "-" print "1. Get links" print "2. Get images" print "3. Define save location" print "4. Exit" print 67 * "-" loop = True while loop: menu() choice = input("Enter your choice [1-4]: ") ...
cc607e34d933fb6bc95eb62af4677f889b338c04
Sboncio/QAC-Challenges
/vowel.py
323
3.78125
4
def vowel_swapper(str_input): swap = {'a': '4', 'e':'3','i':'!','u':'|_|','O':'000'} str_input = str_input.replace('o', 'ooo') for i in range(len(str_input)): if str_input[i].lower() in swap: str_input = str_input[:i] + swap.get(str_input[i].lower()) + str_input[i+1:] return str_inpu...
db7b1c0863991b9bf9d813e621d16da7398ca389
igormorgado/nlp
/pca.py
1,221
3.546875
4
#!/usr/bin/env python #%% import numpy as np import matplotlib.pyplot as plt #%% def compute_pca(X, n_components=2): """ Input: X: of dimension (m,n) where each row corresponds to a word vector n_components: Number of components you want to keep. Output: X_reduced: data transformed ...
faba62b2d1aba08236687c5409a2ace6b4594d87
klimmerst/py111-efimovDA
/Tasks/e2_dijkstra.py
1,005
3.578125
4
from typing import Hashable, Mapping, Union import networkx as nx def dijkstra_algo(g: nx.DiGraph, starting_node: Hashable) -> Mapping[Hashable, Union[int, float]]: """ Count shortest paths from starting node to all nodes of graph g :param g: Graph from NetworkX :param starting_node: starting node fro...
2728eea15c01f060c01dece7fcd09e09de350c4b
quasarbright/quasarbright.github.io
/python/mylib/dataStructures.py
1,649
3.765625
4
class StackUnderFlowError(Exception): pass class Stack(list): def isEmpty(self): return len(self) == 0 def push(self,e): self.append(e) def pop(self): if len(self) == 0: raise StackUnderFlowError() else: return super().pop(len(self)-1) ...
380e8fb341559fa3c671f7f9adef1ba54869d630
ArtemDud10K/Homework
/TMSHomeWork-3/z7.py
503
3.90625
4
import turtle step = int(input('Введите размер шага черепахи: ')) angle = int(input('Введите угол поворота черепахи при рисовке фигуры: ')) ite = int(input('Введите количество повторений: ')) angle1 = int(input('Введите угол поворота черепахи: ')) t = turtle.Turtle() for i in range(ite + 1): for i in range(4): ...
5695a4489f036b71accf9badf3d29787e977b65b
jcgallegorpracticas/patrones-decorator-flyweight-interprete-null_object
/patron decorador.py
2,028
4.4375
4
""" Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality. """ import abc import math class Component(metaclass=abc.ABCMeta): """ Define the interface for objects that can have responsibilities added ...
b629e760fb333fc07e2ebd00cfd90e72c1135fb5
3JohnJL/Intro-to-ComSci
/pi.py
200
3.921875
4
print('Approximation of pi: 3.121') r=eval(input('Enter the radius:\n')) import math deno=math.sqrt(2) a=deno b=math.sqrt(2+deno) c=math.sqrt(2+b) print('Area:',round((2*2/a*2/b*2/c)*(r**2),3))
b31887e102c902cd1553475f2f413e5664a76ef2
danheeks/HeeksCAM
/PyCAD/geom/Circle.py
1,279
3.640625
4
import geom class Circle: def __init__(self, p, r): self.p = p self.r = r def Intof(self, c1): # intersection with another circle # returns a list of intersections v = geom.Point(self.p, c1.p) d = v.Normalize() if d < geom.tolerance: ...