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 |
|---|---|---|---|---|---|---|
49ad18995747be8e7dfc9ee1030475f7a1faace7 | kunalJa/leetcodeforces-etc | /LeetCode/easy/1190_reverse_substrings_between_each_pair_of_parentheses.py | 3,020 | 3.890625 | 4 | """
https://leetcode.com/problems/reverse-substrings-between-each-pair-of-parentheses/
Given a string s that consists of lower case English letters and brackets.
Reverse the strings in each pair of matching parentheses, starting from the innermost one.
Your result should not contain any bracket.
Parantheses will alw... |
f1999f70965a6c3fcc4e999c03a8c0a4ceed286c | kunalJa/leetcodeforces-etc | /LeetCode/challenge/may2020/8_check_if_it_is_a_straight_line.py | 1,036 | 3.75 | 4 | """
https://leetcode.com/explore/challenge/card/may-leetcoding-challenge/535/week-2-may-8th-may-14th/3323/
You are given an array coordinates [x,y].
Check if these points make a straight line in R2.
"""
"""
Accepted
Time complextiy: O(n)
Space complexity: O(1)
Solution:
A set of collinear points have the same slo... |
9e8b6b92aa26b57f7df713d33cf14827c7e7aa56 | kunalJa/leetcodeforces-etc | /LeetCode/challenge/may2020/2_jewels_and_stones.py | 597 | 3.796875 | 4 | """
https://leetcode.com/explore/challenge/card/may-leetcoding-challenge/534/week-1-may-1st-may-7th/3317/
You're given strings J representing the types of stones that are jewels, and S representing the
stones you have. Each character in S is a type of stone you have.
You want to know how many of the stones you have ar... |
96a65685b1faa262ba9ac99d2ef64fbc62568aec | sagocious/snippets | /python/find_factorial.py | 139 | 3.921875 | 4 | def Factorial(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return Factorial(n-1)+Factorial(n-2)
Factorial(3):
|
e9b83840e24cf275f7f132126b33fc91159737a5 | ModernHermeticist/Internet-Chess | /pieces.py | 343 | 3.703125 | 4 | #piece needs a name, available moves
#board will generate the pieces...and keep track of them?
#piece placement will occur when the board calls the pieces
class whitePawn:
hasMoved = False
def __init__(self):
self.symbol = 'P'
def move(self):
if not self.hasMoved:
pass
def main():
p = whitePawn()
pri... |
5ece602bfdf668d811e78330ce3a32ba3c19ac74 | kbrill25/lotka-volterra | /plottingData.py | 1,027 | 3.890625 | 4 | # -*- coding: utf-8 -*-
"""
Kathryn Brill
Capstone Project
Evaluation of Lotka-Volterra Equations using Euler's Method
"""
import numpy as np
import matplotlib.pyplot as plt
# load data from the text file and create variables
x,y,z= np.loadtxt('predatorprey.txt', delimiter=',',unpack=True)
# first graph
... |
db3c82df0d5d5c4257d9078d6009bfbf6825034a | JackCampi/ProyectoPOO-v2.0 | /module_files/Format.py | 3,985 | 3.984375 | 4 | """En este módulo se encuentran las clases de los formatos multimedia que se
manejan en la aplicación: Música, Fotos o Videos."""
class Format:
"""En esta clase se encuentran los métodos y propiedades comúes de los tres
formatos, tales como el nombre, el autor, el álbum, el año, el archivo, el género
y los... |
0f9944079b744b6d2074ca765b018fa61a3866e6 | olives8109/CTI-110-1001 | /M2_HourstoMinutes.py | 522 | 4.28125 | 4 | # Hours to Minutes
# with formatting
# CTI-110
# Sigrid Olive
# 6/7/2017
#convert minutes to hh:mm format
#input number of minutes
totalMinutes = int(input("Number of minutes: "))
print ("You entered " + str(totalMinutes) + " minutes." )
#calculate hours
hours = totalMinutes // 60
#print ("That is ",... |
746c38a5c2b1fb42fbe0b33d078487fda2e93ba6 | olives8109/CTI-110-1001 | /M2T1_SalesPrediction_SigridOlive.py | 270 | 3.921875 | 4 | # Sales Prediction
# CTI-110
# Sigrid Olive
# 6/6/2017
#input total sales
sales = int(input ('Enter the projected sales: '))
#calculate the profit as 23 percent of total sales
profit = sales*0.23
#output annual profit
print('The annual profit is: ', profit)
|
236fea5f69e56f8667eec6d07c6f68a29ab6204f | olives8109/CTI-110-1001 | /M3LAB_Debugging_SigridOlive.py | 569 | 3.5625 | 4 | # Debugging - Rewrite #4 on page 115 with proper alignment and indentation.
# CTI-110
# Sigrid Olive
# 6/13/2017
#input test score
score = int(input("What is the test score? "))
#classify the letter grade based on score input
if score >= 90:
letterGrade = "A"
elif score >= 80:
letterGrade = "B"
e... |
6f3db28210ead31da475367df0416c569b69ab04 | olives8109/CTI-110-1001 | /M5T2_FeetToInches_SigridOlive.py | 539 | 4.46875 | 4 | # Feet to Inches - Converts an input of feet into inches.
# CTI-110
# Sigrid Olive
# 6/26/2017
# explains what program does
print("This program takes a number of feet and gives out the number of inches in that many feet.")
# defines the variable "feet_to_inches" which will take an input of feet and convert it... |
b592b9312988620ece34ed4c33ce7bbcc7e046e5 | TiagoLimaRocha/FEUP--MNUM-Pharma-Kinetics | /src/numerical_methods/bissection.py | 366 | 3.859375 | 4 | """
REAl Zeros
"""
"""
Example:
def f(x):
return x - 2*m.log(x)-5;
"""
def bissection(a, b, fn):
for i in range(20):
mid = (a + b) / 2
if fn(a) * fn(mid) < 0:
b = mid
else:
a = mid
print('f(a): {0:.10f}\t f(b): {1:.10f}\t mid: {2:.10f}\t '.format(f... |
f8d91e9093fadffd345eb0d7670b95ee57323edc | oze4/pylas | /pylas/pylasClasses.py | 922 | 3.65625 | 4 | from enum import Enum
class PylasDict(dict):
"""
dot.notation access to dictionary attributes.
Instead of having to access attributes in a dict like `obj["attribute"]`, this
class allows you to access attributes like `obj.attribute`.
"""
__getattr__ = dict.get
__setattr__ = dict.__setitem... |
21b4fabed0aac6c24bdb431732646f608a5f1706 | Dhruv3vedi/max | /Dhruv/pattern.py | 370 | 3.890625 | 4 | def pattern(n):
for i in range(0, n):
if (i + 1) % 2 == 0:
k = i + 1
else:
k = i + 2
for j in range(0, n - k):
print(end=" ")
for j in range(0, k):
print("* ", end="")
# ending line after each row
print("\r")
m = in... |
72b6bd8d68581774bc2e898d24b0e04ca2a02398 | Si-ja/FizzBuzz-Co. | /src/fizzbuzz_co/FizzBuzz.py | 4,674 | 4.21875 | 4 | class FizzBuzz:
"""
FizzBuzz is a class that allows to not only complete the FizzBuzz challenge with one line of
code. But also allows to test the answers of the individual user.
"""
def __init__(self,
fizz=3,
buzz=5,
failure_msg = "The candidate h... |
f8d9938ec16caa12a6b5c1d242b7764106a4c219 | zippyjake/python-1 | /review/madforms | 1,428 | 3.78125 | 4 | #!/usr/bin/env python3
import colors as c
import random
from ask import ask
text = '''..
One day I walked to {Noun1} and got a {Noun2} and it looked very {Adjective1}.
I then walked into {Person1} and then I began to {Verb1}. {Person1} began to
{Verb2} me. I then found a {Noun3} that sold {Noun4}. I Bought a {Noun4... |
b4b6e730ae130f48ad0acdeb0db283d3b8eb092a | zippyjake/python-1 | /badgers | 1,063 | 3.546875 | 4 | #!/usr/bin/env python3
import time
import colors as c
print(c.clear)
while True:
print('''
____ _
| _ \ /\ | |
| |_) | / \ __| | __ _ ___ _ __ ___
| _ < / /\ \ / _` |/ _` |/ _ \ __/ __|
... |
db2cb82ee453feb6a1d6114d110fda3e0c1bd942 | iningwei/Python-DDU | /Day1-15/Code/Day5/Chick.py | 534 | 3.6875 | 4 | """
百钱百鸡问题(穷举法、暴力搜索法)
百钱百鸡是我国古代数学家张丘建在《算经》一书中提出的数学问题:
鸡翁一值钱五,鸡母一值钱三,鸡雏三值钱一。百钱买百鸡,问鸡翁、鸡母、鸡雏各几何?
"""
cock = 0
hen = 0
chick = 0
for x in range(0, 21):
for y in range(0, 34):
cock = x
hen = y
chick = 100-x-y
if chick % 3 == 0 and cock*5+hen*3+(chick//3) == 100:
print("cock:... |
c62349bda41b1aece1ef08098f3f51b2811ff5ea | iningwei/Python-DDU | /Day1-15/Code/Day2/LeapYear.py | 186 | 3.578125 | 4 | """
判断年份是否是闰年
规则:四年一闰,百年不闰,四百年再闰
"""
y = int(input("输入年份:"))
b = (y % 4 == 0 and (y % 100 != 0 or y % 400 == 0))
print(b)
|
4495cdb9c827dc801b1f8324ba4ca7e86af473d4 | iningwei/Python-DDU | /Day1-15/Code/Day4/While.py | 401 | 3.75 | 4 | """
猜数字游戏
break跳出循环
"""
import random
target = random.randint(0, 100)
print("目标数字为%d" % target)
count = 0
while True:
count = count+1
value = int(input("输入数字:"))
if value < target:
print("小了")
elif value > target:
print("大了")
else:
break
print("恭喜你猜对了,你一共猜了%d次" % count) ... |
df98a74cfae7877799433515a91b3529ed8b59fe | OpenPyMind/20201212_softuni_exam | /exam_testing/tests/test_spaceship.py | 2,081 | 3.734375 | 4 | from exam_testing.project.spaceship.spaceship import Spaceship
import unittest
class SpaceshipTests(unittest.TestCase):
def setUp(self):
self.ss = Spaceship("space", 2)
def test_initialization_attributes(self):
self.assertEqual(self.ss.name, "space")
self.assertEqual(self.ss.capacity,... |
1d2f4f9dbb19ff1193c7a890cd93f6d7281b2227 | Emily-Garcia/python_exercises | /promedio.py | 411 | 3.859375 | 4 | nombre = input('Ingresa tu nombre: ')
calif_1 = float(input('Ingresa tu primera calificacion: '))
calif_2 = float(input('Ingresa tu segunda calificacion: '))
calif_3 = float(input('Ingresa tu tercera calificacion: '))
prom = (calif_1 + calif_2 + calif_3) / 3
if prom > 7:
print(nombre,', podras pasar de año! :)')
... |
35a2cefe8a3848096676f2b573d290c22c154fd3 | krupadhruva/CIS41A | /home/unit_f.py | 4,373 | 4.375 | 4 | """
Krupa Dhruva
CIS 41A Fall 2020
Unit F take-home assignment
"""
"""
Part One - Keyword Arguments and Default Values
Write an invoice function.
The function will generate a simple invoice and will have two required arguments and two keyword arguments.
The two required arguments are unitPrice and quantity.
The ... |
4449c62ed5396bfabc962db2de1b504d1e400124 | krupadhruva/CIS41A | /home/unit_h_2.py | 6,008 | 4.40625 | 4 | """
Krupa Dhruva
CIS 41A Fall 2020
Unit H take-home assignment
"""
"""
We will be building a BritCoins class that allows you to work with British money as it was denominated
up to 1971 - see: Old English Money. While there were a variety of types of coins, we will only be concerned
with pounds, shillings, and pennie... |
d284f26b04c9f8f44f73bf67150132d79262912a | krupadhruva/CIS41A | /home/unit_c_1.py | 2,722 | 4.46875 | 4 | """
Krupa Dhruva
CIS 41A Fall 2020
Unit C take-home assignment
"""
"""
First Script - Working with Lists
All print output should include descriptions as shown in the example output below.
Create an empty list called list1
Populate list1 with the values 1,3,5
Create list2 and populate it with the values 1,2,3,4
Cre... |
8d15a19b4aaef3df62150bc53b1ada988570612a | uchicago-CAPP30121-aut-2021/pa2-initial-code | /utility.py | 4,390 | 4.125 | 4 | """
CS 121: Language shifts
Utility functions for working with grids.
"""
import os
import sys
ALLOWED_VALUES = (0, 1, 2)
def read_grid(filename, allowed=ALLOWED_VALUES):
"""
Read a grid from a text file.
Input:
filename (string): the name of the grid file
Returns (tuple):
(list of li... |
a234a096d77b7be2878a5dfb3f46b019385a4cdb | KirillDaX/CW_small_tasks | /persistence_cw.py | 278 | 3.921875 | 4 | """
Example:
persistence(39) => 3 # Because 3*9 = 27, 2*7 = 14, 1*4=4
"""
n = 39
count = 0
def product(n):
res = 1
while n != 0:
res = res * (n % 10)
n = n // 10
return res
while len(str(n)) > 1:
n = product(n)
count += 1
print(count)
|
f1772899268fdf0f0f318ba6b353eb740be028ee | GaoZWei/Python_Study | /code/enum/enum1.py | 534 | 3.71875 | 4 | # 枚举
from enum import Enum
class VIP(Enum):
YELLOW = 1
GREEN = 2
BLACK = 3
RED = 4
class Common():
YELLOW = 1
print(VIP.BLACK) # 打印VIP.BLACK 枚举类型
print(VIP.BLACK.name) # 打印BLACK 枚举名字
print(type(VIP.BLACK)) # VIP类型
print(type(VIP.BLACK.name)) # str类型
print(VIP.BLACK.value) # 打印BLACK的值... |
f23fda30b03576111857c29be56a65013f0d2ee7 | GaoZWei/Python_Study | /code/high_level/fun6.py | 247 | 3.71875 | 4 | # map+lanbda
list_x = [1, 2, 3, 4, 5, 6, 7, 8]
list_y = [1, 2, 3, 4, 5, 6, 7, 8]
# def squre(x):
# return x*x
# for x in list_x:
# squre(x)
r = map(lambda x,y: x*x+y, list_x,list_y)
print(list(r)) #元素个数取决于最小的个数
|
16ae34d6efb00a2f8dad114ae9991890121dc573 | MauriceMorrey/python_stackIntermediate | /flask_MySQL/hashing.py | 477 | 3.5625 | 4 | import md5 # imports the md5 module to generate a hash
#import os, binascii # include this at the top of your file
#salt = binascii.b2a_hex(os.urandom(15))
password = 'password'
# encrypt the password we provided as 32 character string
#salt = '123' #where the value 123 changes randomly
#hashed_password = md5(password ... |
6aa087db76713d64ec9c98fd3b1941286f589cc4 | MauriceMorrey/python_stackIntermediate | /flask_fundamentals/routes/app.py | 473 | 3.578125 | 4 | '''
URL Routing makes URLs in your Web app easy to remember. We will now create some URL routes:
/hello
/members/
/members/name/
'''
from flask import Flask
app = Flask(__name__)
@app.route("/")
def index():
return "Index!"
@app.route("/hello")
def hello():
return "Hello World!"
@app.route("/members")
de... |
87d2c60d71dcb9b2ee047ca5c3080d6ca6a05c31 | Sniper970119/leetCode | /剑指Offer/T12.py | 1,776 | 3.609375 | 4 | # -*- coding:utf-8 -*-
"""
┏┛ ┻━━━━━┛ ┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━━━┛
┃ ┃ 神兽保佑
┃ ┃ 代码无BUG!
┃ ┗━━━━━━━━━┓
┃ ┣┓
┃ ┏┛
┗━┓ ┓ ┏━━━┳ ┓ ┏━┛
┃ ┫... |
52b8b69155c668ec4a6db20852354f64bd2921c3 | Sniper970119/leetCode | /L0251~L0300/L0299.py | 1,250 | 3.5 | 4 | # -*- coding:utf-8 -*-
"""
┏┛ ┻━━━━━┛ ┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━━━┛
┃ ┃ 神兽保佑
┃ ┃ 代码无BUG!
┃ ┗━━━━━━━━━┓
┃ ┣┓
┃ ┏┛
┗━┓ ┓ ┏━━━┳ ┓ ┏━┛
┃ ┫... |
e1d4608fc2ccf8894810205be3673bc96f704b86 | Sniper970119/leetCode | /L0001~L0050/L0022.py | 1,985 | 3.828125 | 4 | # -*- coding:utf-8 -*-
"""
┏┛ ┻━━━━━┛ ┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━━━┛
┃ ┃ 神兽保佑
┃ ┃ 代码无BUG!
┃ ┗━━━━━━━━━┓
┃ ┣┓
┃ ┏┛
┗━┓ ┓ ┏━━━┳ ┓ ┏━┛
┃ ┫... |
9cd6c354ef7d2b6abf9650ec7f09ba6da35646da | Sniper970119/leetCode | /L0001~L0050/L0024.py | 1,373 | 3.9375 | 4 | # -*- coding:utf-8 -*-
"""
┏┛ ┻━━━━━┛ ┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━━━┛
┃ ┃ 神兽保佑
┃ ┃ 代码无BUG!
┃ ┗━━━━━━━━━┓
┃ ┣┓
┃ ┏┛
┗━┓ ┓ ┏━━━┳ ┓ ┏━┛
┃ ┫... |
ad6f7f823772e9c538d39e953488ba95b6c6589b | Sniper970119/leetCode | /L0051~L0100/L0073.py | 1,472 | 3.875 | 4 | # -*- coding:utf-8 -*-
"""
┏┛ ┻━━━━━┛ ┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━━━┛
┃ ┃ 神兽保佑
┃ ┃ 代码无BUG!
┃ ┗━━━━━━━━━┓
┃ ┣┓
┃ ┏┛
┗━┓ ┓ ┏━━━┳ ┓ ┏━┛
┃ ┫... |
ff88a5b568b515a819b6e40c51f68dd028a2df49 | Sniper970119/leetCode | /L0201~L0250/L0206.py | 1,470 | 4.03125 | 4 | # -*- coding:utf-8 -*-
"""
┏┛ ┻━━━━━┛ ┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━━━┛
┃ ┃ 神兽保佑
┃ ┃ 代码无BUG!
┃ ┗━━━━━━━━━┓
┃ ┣┓
┃ ┏┛
┗━┓ ┓ ┏━━━┳ ┓ ┏━┛
┃ ┫... |
7406a8835ccbbc5b4455d4ce974f5d14d130c6eb | Sniper970119/leetCode | /L0051~L0100/L0056.py | 1,775 | 3.890625 | 4 | # -*- coding:utf-8 -*-
"""
┏┛ ┻━━━━━┛ ┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━━━┛
┃ ┃ 神兽保佑
┃ ┃ 代码无BUG!
┃ ┗━━━━━━━━━┓
┃ ┣┓
┃ ┏┛
┗━┓ ┓ ┏━━━┳ ┓ ┏━┛
┃ ┫... |
ca98ff06dc8fdf6049a27de17dc49bdec39c775b | Sniper970119/leetCode | /L0101~L0150/L0146.py | 2,306 | 3.921875 | 4 | # -*- coding:utf-8 -*-
"""
┏┛ ┻━━━━━┛ ┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━━━┛
┃ ┃ 神兽保佑
┃ ┃ 代码无BUG!
┃ ┗━━━━━━━━━┓
┃ ┣┓
┃ ┏┛
┗━┓ ┓ ┏━━━┳ ┓ ┏━┛
┃ ┫... |
3be00c360b859912ed5ff05fcc01c2d5a73900e6 | Sniper970119/leetCode | /L0201~L0250/L0241.py | 1,373 | 3.59375 | 4 | # -*- coding:utf-8 -*-
"""
┏┛ ┻━━━━━┛ ┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━━━┛
┃ ┃ 神兽保佑
┃ ┃ 代码无BUG!
┃ ┗━━━━━━━━━┓
┃ ┣┓
┃ ┏┛
┗━┓ ┓ ┏━━━┳ ┓ ┏━┛
┃ ┫... |
9df043325f551725a62e45940bfdb5a11901e591 | Sniper970119/leetCode | /L0051~L0100/L0061.py | 1,331 | 3.921875 | 4 | # -*- coding:utf-8 -*-
"""
┏┛ ┻━━━━━┛ ┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━━━┛
┃ ┃ 神兽保佑
┃ ┃ 代码无BUG!
┃ ┗━━━━━━━━━┓
┃ ┣┓
┃ ┏┛
┗━┓ ┓ ┏━━━┳ ┓ ┏━┛
┃ ┫... |
11edb1dee2945e32e9f3e88edc5344282566e8b9 | Sniper970119/leetCode | /L0201~L0250/L0215(1).py | 1,043 | 3.796875 | 4 | # -*- coding:utf-8 -*-
"""
┏┛ ┻━━━━━┛ ┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━━━┛
┃ ┃ 神兽保佑
┃ ┃ 代码无BUG!
┃ ┗━━━━━━━━━┓
┃CREATE BY SNIPER┣┓
┃ ┏┛
┗━┓ ┓ ┏━━━┳ ┓ ┏━┛
... |
4cf3c3babef7e17a6c5e699fd0019b7623425e30 | Sniper970119/leetCode | /L0201~L0250/L0210.py | 2,199 | 3.546875 | 4 | # -*- coding:utf-8 -*-
"""
┏┛ ┻━━━━━┛ ┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━━━┛
┃ ┃ 神兽保佑
┃ ┃ 代码无BUG!
┃ ┗━━━━━━━━━┓
┃ ┣┓
┃ ┏┛
┗━┓ ┓ ┏━━━┳ ┓ ┏━┛
┃ ┫... |
dac81cecb60765cb01618e64c6c55f65b7489f3d | Sniper970119/leetCode | /L0001~L0050/L0035.py | 1,388 | 3.953125 | 4 | # -*- coding:utf-8 -*-
"""
┏┛ ┻━━━━━┛ ┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━━━┛
┃ ┃ 神兽保佑
┃ ┃ 代码无BUG!
┃ ┗━━━━━━━━━┓
┃ ┣┓
┃ ┏┛
┗━┓ ┓ ┏━━━┳ ┓ ┏━┛
┃ ┫... |
3c2ec441b27d6349627c268b57ebe9ed730f2421 | Sniper970119/leetCode | /L0101~L0150/L0128.py | 1,180 | 3.609375 | 4 | # -*- coding:utf-8 -*-
"""
┏┛ ┻━━━━━┛ ┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━━━┛
┃ ┃ 神兽保佑
┃ ┃ 代码无BUG!
┃ ┗━━━━━━━━━┓
┃ ┣┓
┃ ┏┛
┗━┓ ┓ ┏━━━┳ ┓ ┏━┛
┃ ┫... |
bc2345e4159f00c151bbb7b6d43ae7889c0e9460 | Sniper970119/leetCode | /L0051~L0100/L0053.py | 1,249 | 3.5625 | 4 | # -*- coding:utf-8 -*-
"""
┏┛ ┻━━━━━┛ ┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━━━┛
┃ ┃ 神兽保佑
┃ ┃ 代码无BUG!
┃ ┗━━━━━━━━━┓
┃ ┣┓
┃ ┏┛
┗━┓ ┓ ┏━━━┳ ┓ ┏━┛
┃ ┫... |
7424b23e582a2020fcad9d86128f7148ff358da9 | Sniper970119/leetCode | /L0001~L0050/L0038.py | 1,449 | 3.5 | 4 | # -*- coding:utf-8 -*-
"""
┏┛ ┻━━━━━┛ ┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━━━┛
┃ ┃ 神兽保佑
┃ ┃ 代码无BUG!
┃ ┗━━━━━━━━━┓
┃ ┣┓
┃ ┏┛
┗━┓ ┓ ┏━━━┳ ┓ ┏━┛
┃ ┫... |
836ae69de9e2f3762770e46bffa08fcc33012fd3 | 1qqd/Literature_review_helper | /LRH.py | 3,911 | 3.6875 | 4 | import itertools, csv, os
from datetime import datetime
def group_separator(line):
return line=='\n'
def line_counter(file): #file need to be the list of files and \n inside each type of data has been removed.
global num
num = [] # after the following 5 lines, the list will contain all numbers to se... |
69da234b5be3cc3269b8237574bdafe2d66a97b1 | vinitvijal/Object_Oriented_Python | /Program to illustrate the use of __del__() method.py | 411 | 3.796875 | 4 | class ABC():
class_var = 0
def __init__(self, var):
ABC.class_var += 1
self.var = var
print("The Object value is : ", var)
print("The Value of class variable is : ", ABC.class_var)
def __del__(self):
ABC.class_var -= 1
print("Object with value %d is going out ... |
c4f2d72cdcd8bfd42c1049668bbfdcac31267053 | ZhaoLizz/NumericalAnalysis | /base_iterative_method.py | 1,017 | 3.578125 | 4 | import sympy
import numpy as np
def base_iterative_method(f_iter,epsilon,x_0):
"""
利用不动迭代法逼近方程的根
:param f_iter: 迭代公式
:param epsilon: 误差范围
:param x_0: x*附近的根
:return: 每次迭代计算获取的x值
"""
# 首先判断迭代函数的收敛性,即 一阶导数在x_0处的值的绝对值<1
f_diff = sympy.diff(f_iter,sympy.Symbol('x'))
if abs(f_diff.ev... |
dad8256f39a3457447851ad0909580611603b8c8 | martiinmuriuki/python_projects | /tempconverter.py | 2,529 | 4.28125 | 4 | import math
import time
# Function
def again():
try_again = print()
User_Temp = input("your temperature,'C' for celsius, 'F' for fahrenheit 'K' for kelvin: ").upper()
convert_Temp = input("The temperature you want to convert to, 'C' for celsius, 'F' for fahrenheit 'K' for kelvin: ").upper()
# conve... |
9170e0e7cc5cbe586dcc25093e7f4455d011f303 | absoluteabutaj/Guvi | /PalindromeOrNot.py | 146 | 4.25 | 4 | # Created on 04-Sep-2016
# @author: AbuTaj
s = input('Number')
s1 = s[::-1]
if s == s1:
print('Palindrome')
else:
print('Not palindrome')
|
eb32183705e2602cb894735a15ccc31356063e46 | absoluteabutaj/Guvi | /PatternPrint.py | 195 | 3.640625 | 4 | '''
Created on Jan 3, 2017
@author: Abu Taj
'''
n = int(input())
for k in range(n):
for i in range(2):
for j in range(n):
print('*', end='')
print(' ', end='')
print()
n -= 1
|
47c88cffef03647b9e53011481b721a8f723924c | JoshuaFerreiraFaraco/-infosatc-lp-avaliativo-02 | /exer7.py | 1,184 | 3.984375 | 4 | #Definiçao da lista e inputs para valores
Filmes = []
Jogos = []
Livros = []
Esportes = []
a1 = input("Digite um valor a ser inserido na lista filmes: ")
a2 = input("Digite um valor a ser inserido na lista filmes: ")
a3 = input("Digite um valor a ser inserido na lista jogos: ")
a4 = input("Digite um valor a ser inseri... |
faa9965e7ee1c50a568601a51eaa919e7f8eb1bf | akromibn37/python_code | /12_p2.py | 904 | 3.640625 | 4 | def gcd(x,y):
if x%y == 0: return y
return gcd(y,x%y)
class Fraction:
def __init__(self,a,b):
self.numerator = a
self.denominator = b
def __str__(self):
return str(self.numerator) + "/" + str(self.denominator)
def simplify(self):
g = gcd(self.numerator,self.denominator)
return Fraction(self.... |
e845dc4f59eefd1ef514760ee1b7ddccea170453 | akromibn37/python_code | /03_p10.py | 147 | 3.765625 | 4 | n = int(input())
out = ""
for i in range(n-1,1,-1):
if n%i==0:
out+= str(i)+ " "
if out == "":
print("Prime Number")
else:
print(out) |
9b202e1e2174f21d2796cbdb2d83f97a7f99f982 | akromibn37/python_code | /12_v4.py | 1,826 | 3.78125 | 4 | import math
class Circle:
def __init__(self,sid,x,y,r,color):
self.x = x
self.y = y
self.r = r
self.color = color
self.sid = sid
def contain_point(self,px,py):
# ทดสอบว่าจุดอยู่ในวงกลมหรือไม่ ถ้าอยู่จะคืน True ถ้าไม่อยู่ จะคืน False
if distance(self.x,self.y,px,py) <= self.r:
return True
... |
5daa958d2908f2d2f28577524d17fa1d2de00512 | akromibn37/python_code | /04_p12.py | 220 | 3.546875 | 4 | w = input().strip()
x = ""
if w.find(" ")!=-1:
for i in w:
if i!=" ":
x+=i.lower()
else:
x = w.lower()
x1 = ""
for i in range(len(x)-1,-1,-1):
x1+=x[i]
if x==x1:
print("yes")
else:
print("no") |
8d02c758f9a5a4313e90185c7a14df0556bb7abe | akromibn37/python_code | /01_v2.py | 156 | 3.796875 | 4 | import math
a = float(input())
b = float(input())
d = float(input())
c = math.radians(d)
area = (a*b*math.sin(c))/2
print("area =",area,"(sq cm)")
|
51d0e4bfd912e80ccd0def05703a827dcae5809b | akromibn37/python_code | /04_p7.py | 443 | 3.78125 | 4 | n = input()
out = ""
if n.find("0") == -1:
out+= "0 "
if n.find("1") == -1:
out+= "1 "
if n.find("2") == -1:
out+= "2 "
if n.find("3") == -1:
out+= "3 "
if n.find("4") == -1:
out+= "4 "
if n.find("5") == -1:
out+= "5 "
if n.find("6") == -1:
out+= "6 "
if n.find("7") == -1:
out+= "7 "
if n.find... |
de4ff107b7ed71ffd2c168fc4d1e6c4b92d4ec96 | akromibn37/python_code | /02_L3.py | 536 | 3.703125 | 4 | n = int(input())
if n < 0 or n > 80 :
print("Error : Out of range")
else:
out = ""
if n % 3 == 1 :
out = "1" + out
elif n%3 == 2 :
out = "2" + out
else:
out = "0" + out
n //= 3
if n % 3 == 1 :
out = "1" + out
elif n%3 == 2 :
out = "2" + out
else:
out = "0" + out
n //= 3
if n % ... |
dac4333eee636ce7f0d0a28067254f258ed698fe | mohamedLazyBob/learning-python | /calculator.py | 5,212 | 3.921875 | 4 | """
a simple calculator that i did to learn tkinter and graphic interfaces
"""
from tkinter import *
from tkinter import font
from tkinter.ttk import Separator, Style
# we create the main window
win = Tk()
# win.configure(background="light blue")
win.configure(background="#191b28")
win.title("lazyBob calculator")... |
d335a97bb432efcda79d5693368a3bcf039136ad | tnaftali/determinant-solver | /Output.py | 530 | 3.546875 | 4 | import decimal
def print_matrix(matrix):
print("------------")
for i in range(len(matrix)):
print(matrix[i])
print("------------")
def round_number(num):
arr = str(num).split('.')
integer = int(arr[0])
decimals = int((arr[1])[0])
if decimals > 0:
if decimals > 5:
... |
24ce0e7aafccbce1db9c61f86e74b66b8be950e5 | ameykusurkar/project-euler | /3.py | 371 | 3.734375 | 4 | from math import sqrt
def largest_prime_factor(n):
sqrt_n = int(sqrt(n))
for i in reversed(range(sqrt_n)):
if prime_factor(n, i):
return i
def prime_factor(n, i):
return n % i == 0 and is_prime(i)
def is_prime(i):
return not any(i % attempt == 0 for attempt in range(2, int(sqrt(i)... |
9f73207381b02cd90648d7dfa36bc54c1f0f96bd | antonioml97/DAI-Desarrollo-de-Aplicaciones-para-Internet | /ejercicios/ejercicio1.py | 615 | 3.84375 | 4 | import random
numero_a_adivinar=random.randint(1, 100)
print(numero_a_adivinar)
print("Estoy pensado un numero... Adivinalo esta entre 1 y 100")
numero_usuario=int(input());
for i in range(0,10):
if numero_a_adivinar == numero_usuario :
print("Lo has adivinado! Es " + str(numero_usuario) )
brea... |
38beede12c1c01e4982fa7b546adb74867012aa5 | jangseongwoo/jump_to_python | /chapter 4/q2.py | 245 | 3.90625 | 4 | def main():
average = 0
sum = 0
count = 0
while True:
number = input("number : ")
count += 1
sum += number
average = sum / count
print(average)
if __name__ == '__main__':
main()
|
01c7d5f44e6c34c2709a51ee3aa2395617ddba57 | jangseongwoo/jump_to_python | /chapter 1~3/student_average_score.py | 296 | 3.515625 | 4 | def main():
student_score_list = [70, 60, 55, 75, 95, 90, 80, 80, 85, 100]
student_score_sum = 0
for student_score in student_score_list:
student_score_sum += student_score
print(student_score_sum/len(student_score_list))
if __name__ == '__main__':
main()
|
f61d984c6d1ce1b3f47b9b04dff7386684ceee2c | andredif/adr-repr | /adr_repr.py | 2,658 | 3.890625 | 4 | """
Module which imitates behaviour of built-in function repr().
The x_repr function has to be invoked for any-case scenario,
it starts by recognizing the object type passed as an argument
of the function, and recursively transforming it and all the nested
objects type contained inside in huma... |
402a7675e6d370162786b105dc024dfe95c891f7 | harsht24/linear_regression | /linear_regression.py | 1,284 | 3.890625 | 4 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
dataset = pd.read_csv("content/linear_dataset.csv", header=None).to_numpy()
# print(dataset.shape)
# print(dataset.head())
x = dataset[..., 0:1]
# print(x)
y = dataset[..., 1:2]
# print(y)
mean_x = np.mean(x)
mean_y = np.mean(y)
# print(mean_x, m... |
a38ab1d518bec64f5611eeb757405d9e3f38fe6f | chrisvaughn/tictactoe | /main.py | 2,219 | 4 | 4 | #!/usr/bin/env python3
class Board:
def __init__(self):
self.board = []
self.rows = 3
self.columns = 3
for _ in range(self.rows * self.columns):
self.board.append(Square())
def render(self, show_square_num=False):
for i, s in enumerate(self.board):
... |
37f314030f60659029c22fecc1aa04424dc03066 | lemmaandrew/cardioid-table | /cardioid.py | 2,552 | 3.78125 | 4 | """Visualizes the cardioid times table
factor increases as the minutes go by
largest number increases as the seconds go by
"""
import math
from datetime import datetime
import numpy as np
import scene
import scene_drawing
screen_width, screen_height = scene.get_screen_size()
centerx, centery = scene.get_screen_size(... |
8f601e8e585be11628482d956fde16f57026e2bc | TSkinne4/Heat-Map | /Heat.py | 623 | 3.5625 | 4 | import matplotlib.pyplot as plt
import numpy as np
import numpy.random as random
S = 100
def element(x,y,T,m):
mc = 1
value = 0
while mc <= m:
value += (2*T*(1-(-1)**mc)/(mc*np.pi*np.sinh(mc*np.pi)))*np.sin(np.pi*mc*x/S)*np.sinh(np.pi*mc*y/S)
mc += 1
return value
test_array = np.zero... |
bf1dc96b3b8328ceb7e533947fadc7480eb3c0ee | LeeXyan/lxgzhw006 | /hw_002_LargeData/hw_002_numpy/hw_011_创建对角线为1的数组.py | 1,207 | 3.875 | 4 | import numpy as np
"""
def eye(N, M=None, k=0, dtype=float, order='C'):
Return a 2-D array with ones on the diagonal and zeros elsewhere.
Parameters
----------
N : int
Number of rows in the output.
M : int, optional
Number of columns in the output. If None, defaults to `N`.
k : int... |
336abf818cce5850240eb44bc5c58086a741c435 | LeeXyan/lxgzhw006 | /hw_002_LargeData/hw_003_pandas/hw_001_pandas的基本使用.py | 593 | 3.71875 | 4 | import pandas as pd
# 创建数组
t = pd.Series([1, 2, 22, 33, 44, 123, 111])
print(t, type(t))
"""
带标签的数组
0 1
1 2
2 22
3 33
4 44
5 123
6 111
dtype: int64 <class 'pandas.core.series.Series'>
"""
# 创建pandas病设置索引
t1 = pd.Series([22, 33, 44, 123, 111], index=list('abcde'))
print(t1)
"""
a 22
b ... |
f84a99f25e34f522b9f0aa4c67555c56f03a804b | Vidhyarenuga/tic-tac-toe-game | /tic.py | 3,286 | 3.65625 | 4 | from tkinter import*
import tkinter.messagebox
tk=Tk()
tk.title("Tic Tac Toe")
click=True
def checker(buttons):
global click
if buttons["text"]=="" and click==True:
buttons["text"]="X"
click=False
elif buttons["text"]=="" and click==False:
buttons["text"]="O"
clic... |
4e242ef61ef1e313d044124641185ab839c7e91c | beethree/pp4e | /ex13b.py | 305 | 3.921875 | 4 | # learn python the hard way : exercise 13
from sys import argv
script, first = argv
print "The script is called:", script
print "You like:", first
likes = raw_input("Is there anything else you like? ")
print "So, this script is called %r, you like %r, and you also like %r ." % (script, first, likes)
|
1fa0b7695db7b74da2b7fc845e8f4dd2325ccde4 | mec07/nback | /evaluation.py | 682 | 3.5625 | 4 | #!/usr/bin/python
from Verbosity import *
def evaluate_response(verbose,stimulus_store,response):
# Check to make sure that the response doesn't take you outside bounds
if response == 0:
return True
# Catch the mistake of inserting an empty stimulus_store into this function
if len(stimulus_stor... |
4d5d955120c936824e7fadc436f4adc10ca098f1 | DecBayComp/Stochastic_Integrals_Diffusivity | /ito-to-tramway/stopwatch.py | 815 | 3.96875 | 4 |
import time
class stopwatch:
"""A class for measuring execution time."""
def __init__(self, name='Calculation', verbose=True):
self.name = name
self.verbose = verbose
def __enter__(self):
self.start = time.time()
def __exit__(self, exc_type, exc_val, exc_tb):
self.e... |
557ed01bb08fe0580e63165ca049d5b214d5afec | baghirov/python-slides | /Lecture8/code_examples/magic.py | 249 | 3.828125 | 4 | class Person():
def __init__(self, name = "NoInfo", age = 0):
self.name = name
self.age = age
def __lt__(self,other):
return self.age < other.age
p1 = Person(age = 22)
p2 = Person(age = 25)
print(p1 < p2) # => True |
077d1b0c3517e9ebc6beedb4618eafb21ed0e493 | trem2ry/lab4 | /2.py | 247 | 3.640625 | 4 | '''Найти сумму квадратов всех целых чисел от a до b
(значения a и b вводятся с клавиатуры).'''
a=int(input())
b=int(input())
sum=0
for i in range(a,b+1,1):
sum=sum+i*i
print(sum) |
a30120757d4d0f19e0b03b31ae7eec2eef7034f7 | N-tronics/hangman | /hangman/Hint.py | 3,440 | 4.0625 | 4 | """
Creates a random hint according to a given difficulty.
"""
from random import choice, randint
from os import path
class HintGenerator(object):
def __init__(self, diff):
self.diff = diff
self.get_random_word()
# self.create_hint()
self.classify_lttrs()
def get_random_word... |
f02986bf7436ab79bcf852b2b5877a42ad3d4bce | dnmca/wheels | /src/algo/linked_list.py | 16,168 | 4 | 4 |
import math
from typing import List
from random import randint
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def get_length(head: ListNode) -> int:
"""Get length of LinkedList"""
count = 0
while head:
count += 1
head = head.nex... |
8f0704a8ba5a00d7c118f04ecb153eb3fb5d813d | kongzichixiangjiao/GAFile | /开发相关/Python/Basic/Charts/test_chart_xlsx1.py | 894 | 3.53125 | 4 | import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import matplotlib as mpl
mpl.rcParams['font.sans-serif'] = ['SimHei']
# read_excel API
# pd.read_excel(io, sheet_name=0, header="指定列名字的行", names=None, index_col=None, usecols=“指定读取的列, eg:[0, 1]”)
df = pd.read_excel(
"/Users/houjianan/Documents/... |
4e617b5706d1775f21ed74db1f81b18ddcde0497 | kongzichixiangjiao/GAFile | /开发相关/Python/Basic/basic/20.lambda、map、reduce、filter.py | 746 | 3.78125 | 4 | from functools import reduce
# 三元运算
x = 2
y = 3
# z = x > y ? x: y
z = x if x > y else y
print(z) # 3
# map
# 配合lambda
list_x = [1, 2, 3, 4]
def square(x):
return x * x
for x in list_x:
square(x)
r = map(square, list_x)
print(list(r)) # [1, 4, 9, 16]
r = map(lambda x: x*x, list_x)
print(list(r)) ... |
92ba24c295b527cf81f20460380dc3531443e2fc | robertnidem/clase | /fp/proyecto/testSqlite.py | 8,363 | 4.0625 | 4 | import sqlite3
from sqlite3 import Error
def create_connection(db_file):
""" create a database connection to the SQLite database
specified by the db_file
:param db_file: database file
:return: Connection object or None
"""
try:
conn = sqlite3.connect(db_file)
return conn
... |
15c74a2d53b367d05ce7d312da3222d7e88c836a | justgolyw/my-python-scripts | /Interview/code/Merger_sort.py | 2,371 | 3.859375 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
@Author : yangwei.li
@Create date : 2019/4/21
@FileName : Merger_sort.py
"""
# 归并排序
class Merger_sort:
# 归并
def merger(arr,left,mid,right):
temp = []
i,j = left,mid+1
while i<=mid and j<=right:
if arr[i]<=arr[j]:
... |
e206a46f537f4c71479fa063703bef27646c7efc | justgolyw/my-python-scripts | /Interview/code/select_sort.py | 560 | 4.15625 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
@Author : yangwei.li
@Create date : 2019/4/20
@FileName : select_sort.py
"""
# 选择排序
def select_sort(arr):
n = len(arr)
if n<=1:
return arr
for i in range(0,n-1):
min_index= i
for j in range(i+1,n):
if arr[j]<arr[min_index]... |
2df1d2733ad6e9eaee7fef25f216358ae2939cea | OscarPalominoC/persona | /persona.py | 2,177 | 3.65625 | 4 | from validaciones import Validaciones
class Persona(Validaciones):
def __init__(self, nombre, apellido, correo):
# Invocando al método constructor de Validaciones
Validaciones.__init__(self, nombre, apellido, correo)
# Definiendo las propiedades de persona
self._nombre = nombre
... |
5533c114ac1c3bdf63934da5d5c345d73c92ef4b | JNickBaughan/python_blockchain | /basics/lists.py | 226 | 3.828125 | 4 | dogs = ['Oliver', 'Gibson']
dogs.append("Finn")
print(dogs)
# accessing is by value, not reference
print(dogs[0] + " the French Bulldog")
dogs[2] = "Finnegan"
print(dogs)
puppy = [dogs.pop()]
print(dogs)
print(puppy)
|
382be9db811b8a824a796111e0691aea58b3c4a8 | JayT25/30-days-of-code | /arrays.py | 757 | 4.1875 | 4 | """
Task:
Given an array, A, of N integers, print A's elements in reverse order
as a single line of space-separated numbers.
Input Format:
The first line contains an integer, N (the size of our array).
The second line contains N space-separated integers describing
array A's elements.
Sample input:
4
1 4 3 2... |
96ea47c02375e6ec964b9cb198dfcaf87b8f3cd8 | danielreedcombs/zoo-python | /zoo.py | 703 | 4.53125 | 5 | #Create a tuple named zoo that contains your favorite animals.
zoo = tuple(["Dog","Chicken","Lama","Otter"])
#Find one of your animals using the .index(value) method on the tuple.
num_of_chicken = zoo.index("Chicken")
print(num_of_chicken)
#Determine if an animal is in your tuple by using value in tuple.
print("Chick... |
b503b8dc57d348df953bdb4e8e41008cdcf1029d | tuvetula/CodeSignal | /Intro/Intro04_adjacentElementsProduct.py | 484 | 3.765625 | 4 | def adjacentElementsProduct(inputArray):
j=0
n=inputArray[j]*inputArray[j+1]
for j in range (len(inputArray)-1):
if inputArray[j]*inputArray[j+1]>n:
n=inputArray[j]*inputArray[j+1]
return n
print (adjacentElementsProduct([3, 6, -2, -5, 7, 3]))
#def adjacentElementsProduct(inputArray):
... |
1de4a9b9fafb7586fdae30b5a9864d30fbc3170e | Vihelisa/Python_Para_Iniciantes | /Estrutura de dados/Filas/fila_low_level.py | 1,056 | 4 | 4 |
from typing import Any
from typing import Any
EMPTY_NODE_VALUE = 'EMPTY_NODE_VALUE'
class Node: #nó da fila, ele quem manda EQUIVALE A CADA ELEMENTO DE UMA LISTA
def __init__(self, value: Any) -> None:
self.value = value
self.next: Node
def __repr__(self) -> str: #Quando printar o valor... |
8b28479862e1aacf4c7bbee10eeb1ea53271f2ca | EliasRoberts/Lab-7 | /stuff.py | 307 | 3.5625 | 4 | totalolol = (0)
teInput = int(raw_input())
for ala in range (teInput):
print "Whatcha want, man!?"
tetotal = totalolol + teInput
print tetotal
total = []
for x in range (teInput):
print "it's okay if it's in a _ way"
teInput = int (raw_input())
total.append (teInput)
print sum(total)
|
e7046d2d91660b33c572a1fc0ac625991ab77666 | semg101/25-Microsoft-Artificial-Intelligence-image-analysis | /4_lab_Creating_a_CNN_Image_CLassifier/Image_Classification_with_a_CNN_PyTorch.py | 20,984 | 3.953125 | 4 | '''
Simulating Feature Extraction
The use of convolutional and pooling layers to extract features can seem a little abstract. It can be helpful to visualize
the outputs of these layers to better understand how they help identify visual features in the images, reducing the size of
the feature matrices that are passed... |
07bc83cdd9ee0dbfa40377970a35bf2a617713fb | aurzenligl/tdd_training | /dojos/design/9_implementation.py | 3,294 | 3.84375 | 4 | def countWord(filename, word):
line_count = 0
word_count = 0
with open(filename) as f:
content = f.read()
for line in content.splitlines():
found = line.count(word)
if found:
line_count += 1
word_count += found
return (line_count, word_... |
33e7b989da0c1d19e053808cbafb3aa7a6ae0124 | zm-git-dev/Bioinfo-pipelines | /bioinfo_training/exercises_lecture1-7/day03/test001/test002.py | 287 | 3.65625 | 4 | # total word count
f = open('01-The_Philosophers_Stone.txt')
info = f.read()
alist = info.split(' ') # 将文章按照空格划分开
word = len(alist) # 总的单词数
blankspace = alist.count('') # 空格的数量
print("total word count is ", word - blankspace)
f.close()
|
333fa8a3f187b429ad159e5f45a15f0943b9b939 | zm-git-dev/Bioinfo-pipelines | /bioinfo_training/exercises_lecture1-7/day03/test002/test004.py | 464 | 3.53125 | 4 | # each character file
import os
files = os.listdir()
letter_numbers = {}
letter_count = {}
letters = [chr(i) for i in range(97, 123)]
upper = [chr(j) for j in range(65, 91)]
letters.extend(upper)
for file in files:
if os.path.splitext(file)[1] == ".txt":
f = open(file)
content = f.read()
... |
88f717f075c26e466db4b76999a6d32681e9aa84 | zm-git-dev/Bioinfo-pipelines | /bioinfo_training/exercises_lecture1-7/day03/test001/test005.py | 244 | 3.9375 | 4 | # how many empty lines
f = open('01-The_Philosophers_Stone.txt')
readline = f.readlines()
empty_line = 0
for line in readline:
line = line.strip()
if line == '':
empty_line +=1
print("numbers of empty lines is ", empty_line)
|
e3cde4d393e90d7b5e7ca24f2417eeccc5a3294a | zm-git-dev/Bioinfo-pipelines | /bioinfo_training/exercises_lecture1-7/day04/test001.py | 221 | 3.90625 | 4 | import re
while True:
email = input('Enter email like abc@cde.com :')
if email == 'stop': break
result = re.match('(.+)@(.+)', email)
print("first is ",result.group(1))
print("last is ", result.group(2))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.