blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
545k
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
545k
b221cc43903624cb0b15862f90a475fa55dc79a8
rezaprogrammer/python-tutorial
/rlib/threading/rlist.py
1,706
3.9375
4
''' Created on Apr 20, 2014 @author: vsa ''' from threading import Lock from threading import Thread class RList: '''This class implements a thread safe list.''' def __init__(self): self.lock = Lock() self.list = [] def append(self, v): '''Appends elemen...
4112a0b93233606579b48ade6c086cf9dcaee76f
rezaprogrammer/python-tutorial
/basics/filepractice.py
988
3.5625
4
''' Created on Apr 10, 2014 @author: vsa ''' import json def read_some_file(filename): print('Reading file: {0}'.format(filename)) f = file(filename, 'r') for l in list(f): print(json.dumps(l)) pass def read_some_file_differently(filename): with open(filename, 'r') as f: ...
8eb02fb1189d3e819edf2e55450d01ba6a41da82
LRBeaver/Eduonix
/Number_guess.py
394
3.640625
4
__author__ = 'lyndsay.beaver' import random chosen_number = random.randint(1,100) while True: guess = int(input("What is your guess? (number): ")) if guess > chosen_number: print("You're too high. Try again") elif guess < chosen_number: print("You're low. Try again") els...
ab2e61131902c620006af15ddc2f0e7aeb2df495
montyrider/RomeoAndJulietGame
/Act1n2rnj.py
12,582
4.15625
4
# Romeo and Juliet by William Shakespere game # Montana from time import sleep import sys import time import Act3rnj def print_slow(paragraph): """ Cool function that makes text look like its being typed out """ for letter in paragraph: sys.stdout.write(letter) sys.stdo...
dec5ec698cc7d469dfbb97cebdc485e9603fc16e
luandeomartins/Script-s-Python
/ex028.py
810
4.28125
4
from math import radians,cos,sin,tan angulo = float(input('Digite um ângulo qualquer: ')) seno = sin(radians(angulo)) cosseno = cos(radians(angulo)) tangente = tan(radians(angulo)) print('O ângulo de {} tem o seno de {:.2f}.'.format(angulo, seno)) print('O ângulo de {} tem o cosseno de {:.2f}.'.format(angulo, cosseno))...
e4058867e676d1e1868608d53b80b06f95dee9a4
luandeomartins/Script-s-Python
/ex031.py
581
3.828125
4
import random n1 = str(input('Primeiro nome: ')) n2 = str(input('Segundo nome: ')) n3 = str(input('Terceiro nome: ')) n4 = str(input('Quarto nome: ')) lista = [n1, n2, n3, n4] random.shuffle(lista) print('A ordem de apresentação será {}.'.format(lista)) # Sorteio de quatro nomes e uso do método shuffle para enbaralhar...
c2d6354a5b8657f872f569bf21836fa87fb04f0a
luandeomartins/Script-s-Python
/ex006.py
277
4.09375
4
numero1 = int(input('Digite um número: ')) numero2 = int(input('Digite outro número: ')) soma = numero1 + numero2 print('A soma entre {} e {} vale {}!'.format(numero1, numero2, soma)) #Programa que você digite dois números inteiros e ele faz a soma entre os dois números.
9503d309ccd9b71263368df94308f9837c4885aa
luandeomartins/Script-s-Python
/ex001.py
229
3.671875
4
mensagem = 'Olá mundo!' print(mensagem) # Programa que ele mostra a tela a mensagem olá mundo!. # Como eu coloquei a mensagem olá mundo! dentro da variável, com o print(mensagem), ele vai mostrar o que tem dentro da variável
8a035382871ac1824e6062d7bc952a8bdaa91ec4
dhylands/micropython-lib
/itertools/itertools.py
655
3.625
4
def count(start, step=1): while True: yield start start += step def cycle(p): while True: yield from p def repeat(el, n=None): if n is None: while True: yield el else: for i in range(n): yield el def chain(*p): for i in p: yi...
b05d71b173fb400edf9a9eadc5746bfe17e6185d
ljnath/PySnakeAndLadder
/py_snake_and_ladder/models/dice.py
1,668
3.8125
4
""" Python module for dice model """ import os import random import sys from py_snake_and_ladder.handlers.exceptions import UnsupportedDiceTypeException from py_snake_and_ladder.models.dice_type import DiceType sys.path.append(os.path.realpath('..')) class Dice: """ Dice model class Holds dice informatio...
7d1d855b975fa79d179c9c76b00ee396a35ce056
shashikant231/100-Days-of-Code-
/Encapsulation .py
638
3.921875
4
class Person: def __init__(self, name, age=0): self.name = name self.__age = age self.__color() def display(self): print(self.name) print(self.__age) print(self.__color()) #getter method to get age def getage(self): print(self.__age) #setter ...
0619e306f08ebcf025dbea8eacc76c43c360b11a
shashikant231/100-Days-of-Code-
/reverse words in string.py
394
4.09375
4
''' Given a string s, reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. Example 1: Input: s = "Let's take LeetCode contest" Output: "s'teL ekat edoCteeL tsetnoc" ''' #solution class Solution: def reverseWords(self, s: str) -> str: s...
5afb03eae042cc84d9c770e3153fa07d12884906
shashikant231/100-Days-of-Code-
/Pascal Traingle.py
938
4.1875
4
'''Given an integer numRows, return the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly above it as shown: Example 1: Input: numRows = 5 Output: [[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]] solution We are first creating an 2D array .our array after creatio...
aac79bfd1c14c99ad718a383a00c5ab2b154b9b2
ManuelSerna/uark-honors-thesis
/test/classifiers/nearest_centrid.py
1,477
3.65625
4
#************************************************ # Nearest centroid demo # Purpose: Given several (x, y) points, classify as either red (R) or blue (B). # TODO: can generalize to account for any number of classes #************************************************ #================================================ # Cal...
9f79207a553d241115b68f9a5e8ef08921402d3b
AntonDyacenko/Tic-Tac-Toe
/крестики-нолики.py
10,573
3.6875
4
import pygame import random pygame.init() size0 = width, height = 601, 601 screen = pygame.display.set_mode(size0) running = True move = 0 coordinate = {(0, 0): 'N', (1, 0): 'N', (2, 0): 'N', (0, 1): 'N', (1, 1): 'N', (2, 1): 'N', (0, 2): 'N', (1, 2): 'N', (2, 2): 'N'} def append_in_matri...
0b972d6e62e0cf0d6f8d89eb25c6eb469d307267
guigui03262/intro-python-guilherme-simoes
/desafio-104.py
278
3.640625
4
#!/usr/bin/python3 #111 print("01") x = 1 y = 2 print(x) print(y) q = y y = x x = q print("invertido") print(x) print(y) print("\n") #222 print("02") w = 1 e = 2 print(w) print(e) def trocar(w, e): return e, w w, e = trocar(w, e) print("invertido") print(w) print(e)
15bcf0aba07866d11495b40aff3daf56c64d948d
Ayush35/Lab-Assignment-3
/Source_code_Lab_ass_3.py
395
3.78125
4
list = ['abc','xyz','aba','1221'] #sample list num=0 #counter for i in list: # i will point in every element at a time in the list if len(i)>1 and i[0] == i[-1] : #condition num= num+1 #counter incremented if condition is true ...
c3a580ce56a76ef1cf826a33f9706190598cb246
matzhananar/python-course
/Азамат/chess.py
191
3.546875
4
a = int(input()) b = int(input()) c = int(input()) d = int(input()) k = a-c l = b-d if k<0: k=-k if (l<0): l=-l if(k==l) and (a==c or b==d): print("YES") else: print("NO")
767bee2df39d698c9aacafc9b0a89b176dcad605
matzhananar/python-course
/Асем/24-07.py
379
3.78125
4
class Rectangle: def __init__(self, width, height): self.width = width self. height = height def getWidth(self): return self.width def getHeight(self): return self.height def getArea(self): return self.height * self.width rect1 = Rectangle(10,5) pr...
273bb44e1be4214b2d6d3b3a3cc306753e49eeae
matzhananar/python-course
/Асем/03-07l4.py
130
3.765625
4
n = int(input()) x = 1 while x < n: if n==0: print(0) x = 2*x if x == n: print("yes") else: print("no")
954aae5eefe9f8744289826b1b46eebf3f343a99
matzhananar/python-course
/Оркенбек/examples.py
75
3.515625
4
a = int(input()) b = int(input()) c = int(input()) if a+b > c: print()
abc01fa796e8ee0d2ac121a2fd8964d60521a4b3
matzhananar/python-course
/Талгат/28-07t1.py
186
3.828125
4
a = int(input()) n = int(input()) def power(a,n): p = 1 for x in range(abs(n)): p = a*p if n<0: return 1/p else: return p print(power(a,n))
f7254db77a898a78d958247820044f57b5c66cbf
matzhananar/python-course
/Азамат/27-07.py
356
3.6875
4
class Rectangle: def __init__(self, width, length): self.width = width self.length = length def getWidth(self): return self.width def getLength(self): return self.length def getArea(self): return self.width *self.length rec1 = Rectangle(5, 15) print(re...
a68a0e814f7ba36b122a5fc8210d2796de13372e
matzhananar/python-course
/Оркенбек/12-07t1.py
153
3.703125
4
n = int(input()) length = 0 while n > 0: n //= 10 length += 1 print(length) i = 1 while i < 6: print(i) if i == 3: break i += 1
65a129c0b307bb7dd896c9840f65fd6f5125ee99
matzhananar/python-course
/Дэни/19-07.py
155
3.875
4
a = int(input()) n = int(input()) def xor(a,n): if (a == 1 and n ==0) or (a==0 and n==1): return 1 else: return 0 print(xor(a,n))
78efb1c4814c713b751a82624622e0996ae28c5f
matzhananar/python-course
/Оркенбек/12-07.py
73
3.71875
4
x = int(input()) y = int(input()) while x<=y: print(x) x += 1
3ebf4427c536b42afda9c1ff0e765f3ade5481af
matzhananar/python-course
/Александр/29-07t1.py
113
3.515625
4
x = int(input("Введите число: ")) # 31 45 67 98 23 12 print("последняя цифра", x%10)
409997795b47ce2e74c1072431c2b48c59859340
matzhananar/python-course
/Асем/08-07.py
271
3.734375
4
thislist = list(input().split()) print(len(thislist)) print(type(thislist)) my_list = [123,"Monday", "tueasday","Wednesday", "Thursday", "a"] print(my_list[0]) print(my_list[-1]) odd =[1,3,5] odd.append(7) print(odd) odd.extend([9,11,13]) print(odd) del odd print(odd)
37327e682386e29e5f4c3481eb1fe8d725dbfec7
matzhananar/python-course
/Махамбет/04-08.py
284
3.859375
4
#вывести элементы под четным индексом n = list(input().split()) print(n[-1]) #последний элемент print(len(n)) #длина массива i = 0 while i<len(n): print(n[i], end=" ") i=i+2 # 0 1 2 #0 2 4 6 8
3d2d0b9b7f80af44abf08bd4de643262d223e8c6
matzhananar/python-course
/Сержан/24-06.py
130
3.75
4
x = 5 y = "qwert" z = x+8+8 print(z+x) a = type(x) print(a) print("the type of y",type(y)) x = 2**3 print(x) t = 8**2 print(t)
52be51d6991414eb6e0e76d276e82fd19886eb18
matzhananar/python-course
/Асем/slon.py
475
3.828125
4
a = int(input("координаты слона по строке "))#5 b = int(input("координаты слона по столбцу "))#4 c = int(input("координаты фигуры по строке "))#6 d = int(input("координаты фигуры по столбцу "))#3 k = a-c l = b-d if k < 0: k = -k if l<0: l = -l if k == l: print("Слон бьет фигуру") else: ...
122b916a5705270f487ae2fb703ced9c7468dfbe
matzhananar/python-course
/Азамат/17-07t1.py
175
3.5
4
a = int(input()) b = int(input()) c = int(input()) d = int(input()) def minn(a,b,c,d): mass = [a,b,c,d] mass.sort() print(mass) print(mass[0]) minn(a,b,c,d)
53d8a70b701db62eb6474e7b9d49af4beebc2311
matzhananar/python-course
/Дэни/sum.py
94
3.53125
4
n = int(input()) k = 0 cnt =0 for i in range(n+1): k = i**2 cnt = k+cnt print(cnt)
31a1396a8d7b59a2a96c32bcbcafbd142fededce
Harshil783/Hex_To_Binary_To_Decimal_
/Main_Struct.py
2,738
3.59375
4
import time def IsNumericBase(s, base): try: int(s, base) return True except ValueError: return False def isDeci(s): return IsNumericBase(s, 10) # Returns True if <s> is binary number string def IsBinaryString(s): return IsNumericBase(s, 2) # Returns True if <s> is octal number string def I...
b31f61718b12e669acacadee3cf168bbfc2446a5
surayabee/practice
/python/learn_object_oriented_programming/human.py
2,498
3.890625
4
from __future__ import division import time, datetime, decimal class Human(): # Human simulates a person for Kai's example, # or one of God's jokes. def __init__(self, birthdate, firstname, middlename, lastname, ethnicity, height): self.birthdate = birthdate self.firstname = firstname ...
299ce5ed46abeed87588906ee1e716ffde43eeae
jmmontenegro2/CS2302
/Lab4_JacobMontenegro.py
9,507
3.875
4
""" Course: CS 2302 Author: Jacob Montenegro Lab: 4 Instructor: Dr. Olac Fuentes T.A.: Anindita Nath, Maliheh Zargaran Date of Last Modification: 3/15/2019 Program's Purpose: Understand the process of traversing and manipulating a B-tree. """ # Code to implement a B-tree # Programmed by Olac Fuentes # Las...
6763a48aa0e4c976e75b68ae74f18394512b1e85
DrN3RD/PythonProgramming
/Chapter 3/c03e01.py
378
4.34375
4
#Volume calculator from math import * def main(): r = float(input("Enter the radius of the shpere to be calculated: ")) volume = (4/3)*pi*(r**3) area = 4*pi * r**2 print("The area of the Shpere is {0:0.1f} square meters ".format(area)) print("\n The Volume of the sphere is {0:0.1f} cubic m...
515c4c0da32d69199abe249664f978737f9836e5
DrN3RD/PythonProgramming
/Chapter 4/Fiveclick_house.pyw
1,358
3.71875
4
# Five Click House from graphics import * def main(): #Window related metric win = GraphWin(" Five Click House", 800,800) win.setCoords(0.0,0.0,100,100) message = Text(Point(20,2), "Build a house with 5 clicks") message.draw(win) # House base message.setText("Click to define first poin...
dc27581a4b10da96ade4b05f6b0fa579f7673465
Jyldyzbek/P2Task15
/task-15.py
200
3.609375
4
a = int(input('Vedite vash vozrast: ')) b = [] c = [] for s in range(0, a+1): if s % 2 == 0: b.append(s) elif s % 2 != 0: c.append(s) else: None print(b) print(c)
8747d3ca9ad408fc95a74af7662c1b33955bf70b
sexettin78/snake01
/main.py
1,040
3.765625
4
import turtle import time delay = 0.1 wn = turtle.Screen() wn.title("Yılan oyunu yapımcı Sexettin") wn.bgcolor("green") wn.setup(width=600,height=600) wn.tracer(0) head = turtle.Turtle() head.speed(0) head.shape("square") head.color("red") head.penup() head.goto(0,0) head.direction = "stop" def go_up(): head....
ee971e9c62069cd4720f2941d4dc5af297bda1f6
benaoualia/pyNastran
/pyNastran/gui/utils/version.py
5,313
3.640625
4
""" defines: - version_latest, version_current, is_newer = check_for_newer_version(version_current=None) """ import urllib.request import urllib.error from typing import List, Tuple, Optional import pyNastran def get_data_from_website(target_url: str) -> Tuple[Optional[List[str]], bool]: """downloads the byte d...
70ebdafd0a2cc7dfdcb3eae2294cbc35f724c509
cadizm/csci570
/var/sby.py
803
3.71875
4
#!/usr/bin/env python import random def byx(a, b): """Sort by x component for params of the form: a = (x, y), b = (x, y)""" if a[0] < b[0]: return -1 elif a[0] > b[0]: return 1 else: return 0 def byy(a, b): """Sort by y component for params of the form: ...
e5df11f0cc3a0de5da43f64ce786c7bd42e6e4a7
cadizm/csci570
/dynamic_programming/problem6.py
1,332
3.734375
4
#!/usr/bin/env python # # Assume that you have a list of n numbers, both positive and negative. # Give an efficient algorithm to find the value of the maximum contiguous # sum. For example, the maximum contiguous sum in the sequence (-2, -2, 5, # 7, -3, 4, -4) will be 13. # import unittest def OPT(i, j, L): "Non...
94959446d2c7cacc6dcae82ade274d69d95e0242
suryajasper/Visualization-of-Machine-Learning-Optimal-School-Placement-
/schoolGen.py
6,175
3.6875
4
from graphics import * import random import math import locale locale.setlocale(locale.LC_ALL, 'en_US') ################Globals##################### maxX = 750 maxY = 750 win = GraphWin("SchoolGenerator", maxX,maxY, autoflush = False) houses = [] #schoolColors = [] schools = [] global lines lines = [] global texts tex...
a9d0e75b6879c2f421e40e82b40abbf8a1aca013
we-dont-know-algorithm/baekjoon
/June/10817.py
99
3.5
4
#!/bin/python3 arr = list(map(int,input().strip().split(" "))) arr = sorted(arr) print(arr[1])
c7002ccfa0bc63c6832d09cec0d10f5b2360005a
we-dont-know-algorithm/baekjoon
/June/1152.py
122
3.71875
4
#!/bin/python3 line = input().strip().split(" ") if line[-1] != "": print(len(line)) else: print(len(line) - 1)
be425cdd3e05ea2062fa4989a1bd0cc114b77537
shreshta2000/loop_questions
/print_no_till_user_input.py
75
3.921875
4
number=int(input("enter any number")) i=1 while i<=number: print(i) i=i+1
7e5de8b3f43aacdb526ab4b08bd176f428da9fa2
shreshta2000/loop_questions
/table_1_to_10.py
85
3.703125
4
i=1 while i<=10: j=1 while j<=10: print(i ,"*",j,"=",i*j) j=j+1 print() i=i+1
387fd76a70e5f8787c3aea6ec6c5ccf86aa873a2
shreshta2000/loop_questions
/pattern4.py
78
3.828125
4
i=5 while i>=1: j=1 while j<=i: print(j,end = " ") j=j+1 print() i=i-1
565fafd9b8587626601ae4ddb56e502b1c30a122
shreshta2000/loop_questions
/harshad_number.py
200
3.828125
4
number=int(input("enter any nuber")) sum=0 while number>0: rem=number%10 sum=sum+rem number=number//10 if number%sum==0: print("it is a harshad number") else: print("it is not a harshad number")
d44045e2304b7a749cda7f5de23257da1d0d200f
KeYang89/IntroToMachineLearning
/outliers/outlier_cleaner.py
822
3.734375
4
#!/usr/bin/python def outlierCleaner(predictions, ages, net_worths): """ Clean away the 10% of points that have the largest residual errors (difference between the prediction and the actual net worth). Return a list of tuples named cleaned_data where each tuple is of the ...
3865bded618b79c0254b5f998ffd94fcd3b47cde
mamatha20/ifelse_py
/IF ELSE_PY/if else18.py
160
4.21875
4
# write a program check it is even or odd number num=int(input("enter the number")) if num%2==0 : print(num,"even number") else: print(num,"odd number")
1ae36388c286daad1d37d101d9ca05db4bd7384a
mamatha20/ifelse_py
/IF ELSE_PY/if else4.py
276
4.34375
4
#write a program to check whethernit is alphabet digit or special character ch=input("enter any character=") if ch>="a" and ch<="z" or ch>="A" and ch<="Z": print("it is alphabet") elif ch>="0" and ch<="9": print("it is digit") else: print("it is special charcter")
75c9868ff8d055492da5bb749b20d5a919a440e8
mamatha20/ifelse_py
/IF ELSE_PY/if else25.py
658
4.125
4
day=input('enter any day') size=input('enter any size') if day=='sunday': if size=='large': print('piza with free brounick') elif size=='medium': print('piza with free garlick stick') else: print('free coca') elif day=='monday' or day=='tuesday': if size=='large': print('pizza with 10%discount') elif size=...
66bc9c9421663e8197f8e8f7411d420fff86293f
rohit-kh/machine-learning
/Part 2 - Regression/Section 6 - Polynomial Regression/polynomial_regression.py
1,300
3.984375
4
# Polynomial Regression # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the datset dataset = pd.read_csv("Position_Salaries.csv") X = dataset.iloc[:, 1:2] y = dataset.iloc[:, 2] # Fitting linear regression to the dataset from sklearn.linear_model import...
997c3dd4954fd811b38ed097ec5d5306b9900f81
yameenjavaid/bigdata2019
/01. Jump to python/Chap05/177.py
633
3.53125
4
class Service : secret = "영구는 배꼽이 두 개 다." name = "" # 가독성을 위해 중복 코드 생성 -> self. 에 추가되었으면 바로 쌔리넣으 def setname (self, name) : self.name = name def sum (self, a, b) : result = a + b print("%s님 %s + %s = %s입니다." % (self.name, a, b, result)) pey = Service() pey.setname("홍길동") # ...
a566f238d1a9cc97699986160a108e3c9e88cbd5
yameenjavaid/bigdata2019
/01. Jump to python/Chap07/3_Python_Exercise/21.py
281
4.21875
4
import re # Write a Python program to find the substrings within a string. while True : original_setence = input("입력하세요 : ") if original_setence == "ㅈㄹ" : exit() m = re.findall("exercises", original_setence) for i in m : print(i)
2d336879f6a06fd09b6e8cdd26e9b4b3d61925e0
yameenjavaid/bigdata2019
/01. Jump to python/Chap05/5_6/calculator.py
492
3.765625
4
class Calculator : def __init__(self, list): self.parameter = list total = 0; def sum (self) : for i in self.parameter : self.total += int(i) print(str(self.total)) avg = 0 def avg(self): self.avg = self.total / self.parameter.__len__() print(str...
9d6ea6b45c26fccabafd08a13e39d54ce906f918
yameenjavaid/bigdata2019
/01. Jump to python/Chap07/3_Python_Exercise/18.py
342
4.40625
4
import re # Write a Python program to search the numbers (0-9) of length between 1 to 3 in a given string. p = re.compile(r"([0-9]{1,3})") while True : original_setence = input("입력하세요 : ") if original_setence == "ㅈㄹ" : exit() m = p.finditer(original_setence) for i in m : print(i.gr...
78931a91d8a8de2dba204738c130399b60aaf958
yameenjavaid/bigdata2019
/01. Jump to python/Chap06/292_Q2.py
208
3.71875
4
while True : num = input("수를 입력하세요. : ") if len(num)!= 10 or len(num) > len(set(num)) : print ("false") else : print("true") if num == "종료" : exit()
c479780fc3e5163f7253abf999c84d86f24d0ed1
yameenjavaid/bigdata2019
/01. Jump to python/Chap04/d02.py
1,035
3.609375
4
def input_ingredient() : while True : user = input("안녕하세요. 원하시는 재료를 입력하세요: ") if user == "종료" : break ingredient_list.append(user) # 종료가 입력 될 때까지 ingredient_list에 추가저장 return ingredient_list # 종료가 입력 되면 리턴한다. def make_sandwiches(ingredient_list) : print("샌드위치를 만들겠습니다.") ...
b799a5a8b454ba521e8b0d88ff376f6bf1ff05d8
yameenjavaid/bigdata2019
/01. Jump to python/Chap07/3_Python_Exercise/04.py
372
4.09375
4
import re # write a Python program that matches a string that has an a followed by zero or one 'b' p = re.compile("ab?") while True : original_setence = input("입력하세요 : ") if original_setence == 0 : exit() m = p.search(original_setence) print(m) if m : print ('Found a match!\n') ...
c74ec8b9bd215f82b6ce4cb5c4734e3649667b01
yameenjavaid/bigdata2019
/01. Jump to python/Chap07/1_Regular_Expression/324.py
298
3.609375
4
import re p = re.compile('(blue|white|red)') m = p.sub('colour', 'blue socks and red shoes') print (m) m = p.sub('colour', 'blue socks and red shoes', count=1) print(m) m = p.subn('colour', 'blue socks and red shoes') # 변경되는 것과 몇번 매치가 되었는지 튜플로 리턴 print(m)
d6b0581d6e4c08ea7ed5e0fe578090e598dabfd3
apokrif333/Parallelism
/test.py
1,463
3.515625
4
from concurrent.futures import ThreadPoolExecutor from multiprocessing import Pool import numpy as np import multiprocessing import time def writer(filename, n): start = time.time() print("Let's run: ", time.time()) with open(filename, 'w') as file: for i in range(n): file.write('1') ...
9da3ae3978b7fc27adce926f051ac645eaf83133
Jahidul2543/DevOpsB2101
/control_flow.py
513
3.953125
4
def if_demo(): character = False if character: print('Jahiudl is a good boy') elif character == False: print('We dont know') else: print('Jahiudl Is a bad boy') def while_demo(): count = 6 while count < 5: print('Iteration {}'.format(count)) count = cou...
1319c29c48b548b4aa198f8201e799abf292a410
thitiwat-buatip/204101-Introduction-to-Computer-
/570610565/P02_3_570610565.py
287
4.0625
4
# 570610565 Thitiwat buatip Lab 02 ข้อ 3 #BMIProgram weight = float(input("Input weight in kg: ")) height = float(input("Input height in cm: ")) bmi = weight/((height/100)**2) print("Weight = ", "%.2f"%weight, "Kg., Height = ", "%.2f"%height ,"cm., BMI = ", "%.2f"%bmi )
f68a901c85815381f8b065448964a559709f31b5
thitiwat-buatip/204101-Introduction-to-Computer-
/570610565/แบบฝึกหัดข้อ2.py
259
3.828125
4
name = input("Input name: ") surname = input("Input surname: ") age = int(input("input age: ")) print("My name is ", name) print("And surname ", surname) print("Now I'm " , age , "year old") print("I'll finish udergraduate in ", age+4, "year old")
f3d89d192f18e76a3703efadfb6b7dab6ebba7b8
Jackweb199229/python_alphabetical_pattern
/Star Q pattern.py
214
3.96875
4
for i in range(7): for j in range(7): if ((j==0 or j==5) and (i!=0 and i!=5 and i!=6)) or ((i==0 or i==5) and (j>0 and j<5)) or (i==j and j>3 and j<=6): print("*",end=" ") else: print(end=" ") print()
e2a61a53120dbf448bd1b84a7b698765a7180349
Jackweb199229/python_alphabetical_pattern
/NO STAR PRINT.py
304
4.03125
4
for i in range (6): for j in range (6): if j==0 or j==5 or i==j : print("*" , end=" ") else: print(end=" ") print(end=" ") for j in range(6): if ((i==0 or i==5) and (j!=0 and j!=5)) or ((j==0 or j==5 ) and ( i!=0 and i!= 5)): print("*" , end=" ") else: print(end=" ") print()
6ec69b5fcddb45f1c98cc240b87eeffaacd828f2
Veronicka/PythonPO
/metodo_classe/pessoa.py
635
3.546875
4
from random import randint class Pessoa: ano_atual = 2020 def __init__(self, nome, idade): self.nome = nome self.idade = idade def get_ano_nascimento(self): return self.ano_atual - self.idade @classmethod def por_ano_nascimento(cls, nome, ano_nascimento): idad...
19bf8f4adcf8a9073bd2fcc3ff516f50b4ec8335
cxlcym/COVID-19Simulation
/基础版.py
2,847
3.609375
4
# 相关类库的导入 import math import random import turtle import time import datetime # 有关参数的定义 TOTAL_W = 500 #模拟场地总宽度 TOTAL_H = 400 #模拟场地总高度 DANGER_DIS = 50 #传染距离 RATE = 0.5 #传染率 class person(object): def __init__(self,status): self.turt = turtle.Turtle() self.turt.shape('circle') # 健康状态,1 为确诊 ...
62c8c0147a5256ba5c853651b17b984310cb81e1
naseeihity/leetcode-daily
/search/102.binary-tree-level-order-traversal.py
1,298
3.71875
4
import collections # # @lc app=leetcode id=102 lang=python3 # # [102] Binary Tree Level Order Traversal # # @lc code=start # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # class Solution: # def leve...
32488d0c96f28a39b192896f4e6cd39db6e05db0
naseeihity/leetcode-daily
/search/101.symmetric-tree.py
1,371
3.9375
4
# # @lc app=leetcode id=101 lang=python3 # # [101] Symmetric Tree # # @lc code=start # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right # DFS class Solution: def isSymmetr...
baa8ba03b21c59290471881798db2d5b7d46137b
naseeihity/leetcode-daily
/two-pointers/845.longest-mountain-in-array.py
595
3.671875
4
# # @lc app=leetcode id=845 lang=python3 # # [845] Longest Mountain in Array # # @lc code=start class Solution: def longestMountain(self, A: List[int]) -> int: if len(A) < 3: return 0 ans = 0 for i in range(1, len(A)-1): l, r = i, i if A[i] <= A[i-1]...
eb297f7cd520ae3da84b93e15cd6ac2b1fc39f80
naseeihity/leetcode-daily
/search/74.search-a-2-d-matrix.py
1,127
3.6875
4
# # @lc app=leetcode id=74 lang=python3 # # [74] Search a 2D Matrix # # @lc code=start class Solution: def findRow(self, matrix, target): top, bottom = 0, len(matrix) - 1 col = len(matrix[0]) - 1 while top <= bottom: mid = top + (bottom-top) // 2 if matrix[mid][0]...
456fdd27ea7dcad5dd3b60ad69200ac36aa31c6d
naseeihity/leetcode-daily
/heap/23.merge-k-sorted-lists.py
1,574
3.828125
4
# # @lc app=leetcode id=23 lang=python3 # # [23] Merge k Sorted Lists # # @lc code=start # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next from queue import PriorityQueue class Solution: def mergeKLists(self, lis...
02898efcc4e4e6c6223df03145b0a4932fe0eb45
KevinAS28/Python-Fun-With-Dictionary-Generator
/bruter.py
11,990
3.890625
4
#!/usr/bin/python3 #my english is bad. i hope you understand what i say :) #create dictionary with word you type #using python 3.5 #just type any word and separated by space.example: this is a word #to edit leet mode go to line 346. and you need to edit that #dont forget to like and leave comments #inspired from CUPP...
060fd44e10cf9fc86c55e1a825abaa31bfb06271
gb-0001/scripts
/exercice3_jsemaine.py
775
3.59375
4
#!/usr/bin/python semaine = ['lundi','mardi','mercredi','jeudi','vendredi','samedi','dimanche'] print() print("Retour Q1: les 5 premiers jours\n") print("{}, {}, {}, {}, {}".format(semaine[0], semaine[1], semaine[2], semaine[3], semaine[4])) print() print("Retour Q1: Jour du week-end\n") print("{}, {}".format(semain...
a0930cf3d5959ee4e13b4ad1b6d02a4479557a26
JohnnyIITU/CodeForcesPython
/282A.py
187
3.9375
4
n = int(input()) sum = int('0') for i in range(0 , n) : operation = input() if(operation == "++X" or operation == "X++") : sum += 1 else : sum -= 1 print(sum)
db562f55c9ae47d5de1579e8ab40f83e0c1c9ca9
JohnnyIITU/CodeForcesPython
/231A.py
247
3.53125
4
count = int(input()) accepted = int('0') for i in range(0,count) : summary = int('0') numbers = list(map(int,input().split(" "))) for j in numbers : summary += int(j) if(summary > 1) : accepted += 1 print(accepted)
7644c754513682b9a565474b7a4e46446eb469d6
arccoza/fsnd_p0_movie_trailer_website
/server.py
1,159
3.578125
4
''' Refs: https://gist.github.com/bradmontgomery/2219997 ''' from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer as Server import os class Handler(BaseHTTPRequestHandler): '''Handles incoming http requests.''' def send_200(self): self.send_response(200) # self.send_header('Content-type', 'text...
fdbd0cf573828cc229f10b30444785274817155e
Walid3543/1st-prg.-python
/1st programme.py
260
3.96875
4
while True: print('who are you?') name = input() if name != 'Batman': continue print('hello there '+name+'. What is this passcode?') password = input() if password == 'icecreamtruck': break print('Enter batcave')
92e0835c8ca8abb7e5717ad03ffd31eb6e30e15d
marceloroberto/Sistema_Mercadinho_2.0
/backend/Conexao.py
769
3.734375
4
import sqlite3 import os # função responsável por conectar ao banco e criar tabela class Conexao: def conectarBanco(self): try: self.conect = sqlite3.connect(os.path.dirname(__file__) + '\cadastroDeProdutos.db') except sqlite3.Error as e: print(e) return self.conect...
fedf9bdc468917be32b4ae6608ca22d82b8f3e83
404Not-found/CMPUT-175-Winter-2016
/Assignments/Assignment 3/Assignment 3.py
9,716
3.515625
4
# Yunshu Zhao # 2016 Winter Term # University of Alberta import random class OceanTreasure: #----------------------------------------------------------------------------- def __init__(self): self.__board = [] self.__chests = [] self.__dupChests = [] ...
29e8979d532b3060ed5a15ab0fd7971108987ce5
SKO7OPENDRA/python_start
/Урок 2. Переменные, ветвления/hw_02_01.py
830
4.15625
4
def lesson2(): print("Great Python Program!") print("Привет, программист!") name = input("Ваше имя: ") print(name, ", добро пожаловать в мир Python!") answer = input("Давайте поработаем? (Y/N)") # PEP-8 рекомендует делать отступ, равный 4 пробелам if answer == 'y' or answer == 'Y': ...
b398922fa4ab4b95feeeadffcb31f8806b2c5084
thisirs/code
/create_log_file.py
501
3.828125
4
""" This file contain the method to create log file of a programm """ import logging def createLogFile(file_name): """ Method to create a log file :param file_name: name of log file :type file_name: str""" logger = logging.getLogger() logger.setLevel(logging.DEBUG) formatter = logging.Formatt...
5b6dffe54fc1edd17a6597b99472b3b94d7599dc
Shanmukha1217/All
/amstr_num_ser.py
314
4
4
import amstrong_number def main() : num = int(input('Enter the number of amstrong numbers: ')) count = 0 n = 1 while count < num : if amstrong_number.is_amstrong(n): print(f'{n} is amstrong number') count += 1 n += 1 if __name__ == "__main__": main()
cb4b8d4dc89ab878199625048599710b43f3c084
Shanmukha1217/All
/reversenum.py
353
4.03125
4
import common as c def main(): num =c.read('enter the num: ') print(f'Reverse of {num} is {reverse(num)}.') def reverse(num: int)-> int: res = int() while num: last_digit = c.digit_retriever(num) res = c.add((res*10) , last_digit) num = c.num_truncate(num) return res if _...
7b7b03fe9ad65fb19de85717b32300de00cfef2c
frank-quoc/tic-tac-toe
/tic_tac_toe.py
4,913
4.375
4
import time from random import randint from board import new_board, print_board def instructions(): """Displays how to to play the game and the rules.""" print('''WELCOME TO TIC-TAC-TOE! You will be playing the game against a computer. Moves can be made by inputting the numbers 1-9 and are representing each ...
aa55a77a6c27abcde23178f846ae55f3eba97d24
DHedgecock/radical-vscode
/examples/python.py
244
3.5
4
def complex(real=0.0, imag=0.0): """Form a complex number. Keyword arguments: real -- the real part (default 0.0) imag -- the imaginary part (default 0.0) """ if imag == 0.0 and real == 0.0: return complex_zero
9a2b0b83946e47e48b0a2d42b0ed94fe06e94f9c
ssempax1/Statistical-Calculator
/Statistics/StandardDeviation.py
368
3.5625
4
from Calculator.SquareRoot import square_root from Statistics.Variance import variance def stddev(num): try: variance_float = variance(num) return round(square_root(variance_float), 5) except ZeroDivisionError: print("Error: Enter number greater than 0") except ValueError: ...
10552bd2264e58f6892902bbdc28719755425dd6
minhyeong-joe/coding-interview
/String/isAnagram.py
1,133
3.90625
4
''' An anagram is a word, phrase, or name formed by rearranging the letters of another, such as cinema, formed from iceman. Write a program to detect if a string is an anagram of another input string. This solution is implementation of naive approach O(N^2) ''' def isAnagram(str1, str2): marked = [] for s1 in...
9fd6660f87410acf075ff28b2f988de66f5dcae7
minhyeong-joe/coding-interview
/Graph/EulerianPath.py
1,498
3.8125
4
from Graph import ListGraph def isEulerianPath(graph): numOddDegree = 0 # for each connected vertex, check if degree is odd for vertex in graph.BFS(): if len(graph.neighbors(vertex)) % 2 == 1: numOddDegree += 1 if numOddDegree > 2: return False if numOddDegree =...
3eed0b02d2575a7ed38d612431d096e10d5f82eb
minhyeong-joe/coding-interview
/LinkedList/LinkedListTest.py
726
3.984375
4
from LinkedList import LinkedList # list constructor test arr = [0, 1, 2, 3, 4] linkedList = LinkedList(arr) print(linkedList) # get value test try: print(linkedList.getVal(3)) except IndexError as err: print(err) # remove test try: linkedList.remove(0) print(linkedList) linkedList.remove(4) ...
315e89cdf31a264dd97cf3cc7cc8792fcfeaf64d
ViktorCVS/Monitoring-Temperature-and-Humidity
/plotting_tu.py
2,435
3.8125
4
import matplotlib.pyplot as plt #Importing library to plot our graph from drawnow import * #Importing library to draw the graph in real time import serial #Importing library to get data from serial port temp = [] #Temperature array umi = [] #Humidity array cnt = 0 #Counter to av...
d47b49874aa04e82b049b9a1e9118f04ed761eb5
devArsNikolaev/LABS
/lab8z2.py
410
3.8125
4
numbers = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0} inp = input('Введите строку') for i in inp: if int(i) in numbers.keys(): numbers[int(i)] += 1 result_value = numbers[0] result_char = 0 for j in range(9): if result_value < numbers[j]: result_char = j result...
659b7aa0b4fc110abb4a6d420a856ac44a50215a
devArsNikolaev/LABS
/lab6z2.py
642
3.8125
4
import random cols = int(input('Введите количество столбцов')) rows = int(input('Введите количество строк')) matrix = [[random.randint(0, 10) for i in range(cols)] for j in range(rows)] print('Старая матрица') for i in range(rows): for j in range(cols): print(matrix[i][j], ' ', end='') p...
a88f86649f592f4ffab75f30603bc07d44f60322
shanjiaxiang/railway
/AStar/AStar.py
8,192
3.765625
4
# -*- coding:utf-8 -*- from Point import * import Array2D from obstacle import SquareObstacle class AStar: """ AStar算法的Python3.x实现 """ class Node: # 描述AStar算法中的节点数据 def __init__(self, point, endPoint, g=0): self.point = point # 自己的坐标 self.father = None # 父节点 ...
cbd26b2acac84451af4c462959ec26ebac2db93c
shanjiaxiang/railway
/turtle_util.py
1,995
3.75
4
# -*- coding:utf-8 -*- import turtle import random from point_model import * from bazier import * def initCanvas(x, y, color=None): turtle.screensize(x, y, color) # turtle.setup(x, y, 100, 100) # turtle.setup(0.9,0.9) def initPen(size, speed=1, color="black", show=True): if show: turtle.showt...
5887cbfd7931ee4577f56b030d5b0e43f2b46915
tanchao/algo
/interviews/indeed/ball1.py
466
3.828125
4
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'tanchao' def ball(balls_, data_): for a, b in data_: balls_[a - 1], balls_[b - 1] = balls_[b - 1], balls_[a - 1] return balls_ n = int(raw_input()) balls = ['1','2','3','4','5','6','7','8'] data = [(1,3),(6,8),(3,5),(2,6),(3,7),(3,4),(4,7)...