blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
45aa835d982d8814d211574aed193eb98dc7960f
yuhaoboris/LearnPythonTheHardWay
/ex_15_sample.txt
613
4.0625
4
# coding=utf8 # 习题1:第一个程序 A Good First Program # 中文问题: # # 如果注释中存在中文,python 解释时会出现ASCII报错 # 解决这一问题,需要在文件第一行加上以下内容(双引号内的所有内容): # "# -- coding: utf-8 --" 或 # "# -- coding: utf8 --" 或 # "# coding=utf-8" 或 # "# coding=utf8" # # 注意: # 1. "utf-8" 或 "utf8" 一样可行 # 2. 当 "# coding=utf8" 时,符号 "=" 两边不能有空格,否则报错。 print "Hello Wor...
6307243682b72ebc76618a091e0cafe90d876e5a
Tushar515/hackerrank_python_problems
/if_else.py
503
4.25
4
'''Task Given an integer, , perform the following conditional actions: If is odd, print Weird If is even and in the inclusive range of to , print Not Weird If is even and in the inclusive range of to , print Weird If is even and greater than , print Not Weird ''' #!/bin/python3 N = int(input()) if...
cd0d44a847da5e16f35c116e7a10869c5ef6ffdb
TIRSA30/UG9_A_71210700
/3_A_71210700.py
831
3.8125
4
#Menambah catatan di program Doni #defenisi data test case 1 Daftar1 = input("Masukan daftar belanja 1: ") Daftar2 = input("Masukan daftar belanja 2: ") Daftartambahan1 = input("Tambahan data ke daftar belanja 1: ") Daftartambahan2 = input("Tambahan data ke daftar belanja 2: ") #penyelesaian print("Daftar be...
9de5cbf4f8d3f323b051f7b81cd0630397657a67
shrikantnarvekar/Algorithims-and-Data-Structures
/binary tree.py
1,664
3.796875
4
class Treenode: def __init__(self,d): self.data=d self.lchild=None self.rchild=None class Mytree: def __init__(self,t): self.root=t def preorder(self,t): if t is not None: print(t.data) self.preorder(t.lchild) ...
17584ae43615a1b023d7e4f538f137fd3c6c9fc0
matheuszei/Python_DesafiosCursoemvideo
/0037_desafio.py
696
4.125
4
#Escreva um programa em Python que leia um número inteiro qualquer # e peça para o usuário escolher qual será a base de conversão: # 1 para binário, 2 para octal e 3 para hexadecimal. n = int(input('Digite um número inteiro: ')) print('=' * 35) print('Escolha qual será a base de conversão') print('=' * 35) pri...
893973d39a27df317f99382fd37f42b617ac842f
dmigrishin/lesson1
/dicts.py
634
4.125
4
cities = {"city": "Москва", "temperature": "20"} print(cities["city"]) cities['temperature'] = int(cities['temperature'])-5 print(cities) # if cities.get('country') == None:#Данный вариант Добавляет элемент в словарь # cities['country'] = "Россия" # print(cities['country']) cities.get("country" , "Россия") # ...
3ef62aae3291b8c159ed761c9abc46dae6a8776e
sassyst/leetcode-python
/leetcode/LinkedList/ReverseNodeInKGroup.py
1,196
3.609375
4
from leetcode.LinkedList.ListNode import ListNode class Solution(object): """ HEAD -->n1-->n2-->n3-->n4-->...-->nk-->nk+1 ==> HEAD -->nk-->nk-1-->nk-2-->...-->n1-->nk+1 """ def reverseNextKNodes(self, head, k): curt = head n1 = curt.next # if less k nodes, return null ...
8892dec1b9f7deb2dc086c8129da0099f1b6be73
AmberJing88/algorithm-datastructure
/backtracking/Hannouta.py
306
4
4
# datastructure and algorithmm in python #chapter 4 4-14 solution def move(x, y): print("move from " + x + " to "+ y) def Hanot(x, y, z, n): if n==1: move(x, z) else: Hanot(x, z, y, n-1) move(x, z) Hanot(y, x, z, n-1) Hanot('a', 'b', 'c', 3)
db2525fd275ad68c5964efefd44cfd5258ef20b8
inJAJA/Study
/keras/keras56_mnist_dnn.py
2,414
3.5625
4
import numpy as np #1. 데이터 from keras.datasets import mnist mnist.load_data() (x_train, y_train), (x_test, y_test) = mnist.load_data() print(x_train.shape) # (60000, 28, 28) print(x_test.shape) # (10000, ) print(y_train.shape) #...
f729fee8e5ea40a479369b1d66a38ac8b8ab921f
he1016180540/Python-data-analysis
/Experiment-2/Untitled-6.py
347
3.78125
4
def CalculationOfInterest(principal, rate, year): """计算利息 Args: principal (int): 本金 rate (float): 年利率 year (int): 存款年限 Returns: float: 利息 """ return principal*rate*year print(CalculationOfInterest(10000, 0.055, 5)) print(CalculationOfInterest(10000, 0.035, 3))
0ac863f6711f40f1302b7f125f03bba71217b231
Reza-Salim/Training
/28.py
301
3.75
4
def w(v,t): if t <= 10: return (33-(10* sqr(v)-v +10.5)*(33-t)/(23.1)) else: print("Invalid Temperature!") def sqr(x): return pow(x,0.5) v = float(input("Enter Velocity : ")) t = float(input("Enter Temperature : ")) print (w(v,t))
03a6cc76b2b51e5360390025ccc56d2505a018d5
Grissie/EDA-I
/PRACTICA_10/Programa_01.py
1,092
3.828125
4
def menu(opciones): while(True): for opcion in (opciones): print(opcion) op = int(input("Ingrese una opcion: ")) if op in [1,2,3,4]: break return op def agregar(x): y=int(input("Cuantos numeros quiere guardar ?: ")) k=0 while k<y: z=int(input(...
98901a03c877724bfd954c0ba2a5f5ec60df1410
mohit-10/assignments
/python-assignment3.py
1,486
3.96875
4
#1.1 Write a Python Program to implement your own myreduce() function which works exactly like Python's built-in function reduce() def do_sum(x1, x2): return x1 + x2 def my_reduce(operation,sequence): first_element = sequence[0] for i in sequence[1:]: first_element=operation(first_element,i) return first...
cd3daca33b80992f09cec59a3f687f1a5f5609aa
sandervw/Fall17Classes
/Com S 444/Homework/homework9/stDev.py
542
3.75
4
""" This function calculates standard deviation Created by David E. Hufnagel on Nov 1, 2017 note: borrowed from code online """ #Calculates mean def Mean(data): n = len(data) return sum(data)/float(n) #Return the sum of square deviations of the data def SS(data): c = Mean(data) ss = sum((x-c)**2 for ...
4d8fd64e21911d7fa336207fa9a18dcce4f66e29
Trogers32/Python_Stack
/flask/flask_fundamentals/Hello_Flask.py
1,711
3.546875
4
from flask import Flask, render_template # Import Flask to allow us to create our app app = Flask(__name__, template_folder='templates') # Create a new instance of the Flask class called "app" @app.route('/') # The "@" decorator associates this route with the function immediately following def hello_world...
05e67fc58c2f8893ef89d0bf9559f8833ee9ba48
xuychen/Leetcode
/LCOF/11-20/12/12.py
1,092
3.796875
4
class Solution(object): def dfs(self, board, n_rows, n_cols, i, j, word, depth): if not depth: return True if i < 0 or i >= n_rows or j < 0 or j >= n_cols or word[-depth] != board[i][j]: return False board[i][j] = '' result = self.dfs(board, n_rows, n_cols, i...
ec5ae64c4767e72aa31e3e7b86d0966b079bc9bd
ivanpolyakov99/PolyakovPython
/hm2_2.py
289
3.5
4
# 2_Amount_and_composition try: n = int(input("Input numb : ")) except ValueError: print("Not numb, try again") else: s = 0 c = 1 while n > 0: s = s + n % 10 c = c * (n % 10) n = n // 10 print("Amount :", int(s), "\nComposition :", int(c))
4f73d33fc3207253b8ef8aa69ab320ebcdbf30a4
smartguy-coder/HillelOnline_HW1
/work_module.py
2,400
3.8125
4
""" work module for writing in file the sum of numbers (from 1 to 100), that can be divided on given number from the file 'denom.txt' """ import os def current_directory() -> None: """to be sure that current working directory is located where *.py file is located""" os.chdir(os.path.dirname(os.path...
b55fe2382c52806c7c3af0319fcc2ff1718bc9ab
JSAbrahams/mamba
/tests/resource/valid/definition/long_f_string_check.py
191
3.5625
4
name: str = "My name" some_brackets: str = "\{\}" some_more_brackets: str = "empty expressions are ignored: {}" age: int = 30 a: str = f"My name is {name} and my age is {age - 10}." print(a)
8464b19ab3950fc5f75c847153583368f9e57a4d
abhi6689-develop/Codes
/Basic_Concepts.py
392
3.53125
4
# word = "Asma" # print(list(enumerate(word,100))) # lyst = ['Eat', 'Drink', 'Sleep'] # for index,item in enumerate(lyst): # print(index) x = lambda a: a+10 print(x(5)) x = lambda a,b : a**b print(x(2,3)) x = lambda a,b,c : a+b+c print(x(5,6,7)) def myfunction(n): return lambda a: a * n doubler = myfunct...
4e26506e47f756f2b105fb58f2970ca7b82d5a7e
maayan20-meet/meet2018y1lab5
/caught_speeding.py
377
3.546875
4
speed = 50 is_birthday = True if (is_birthday = False and speed < 31) or (is_birthday = True and speed < 36): print('no ticket') if (is_birthday = False and speed > 31 and speed < 51) or (is_birthday = True and speed < 36 and speed < 56): print('small ticket') if (is_birthday = False and speed < 50) or (is_b...
d9c5037c021ca3ec8d43e82298fe1548025d4b18
aranyasteve/python-
/Other/hw.py
563
3.78125
4
# def nperson(name, age=0, address=None): # print("name is {} age is {} address is {}".format(name, age, address)) # return name, age, address # # a = input("enter name : ") # b = input("enter age : ") # c = input("Enter address : ") # # name,age, address = nperson(a, address=c, age=b) # print(age) def genral_...
fb80b00039c091e168f30e57fd4e30e7578faf09
DillonHayes18/GraphTheoryProjectV2
/Project.py
1,036
4.21875
4
import argparse # Graph Theory Project # Dillon Hayes - G00373320 # April 2021 # Program to take a regular expression and the name or path of the file # as command line arguments and output the lines of the file matching the regular expression. # User prompt for adding inputing Regular Expression & File Path # St...
7b2f37b83036df7d2fee1e8258309b66cdaaff6b
meighanv/05-Python-Programming
/lab-set-lecture.py
1,577
4.375
4
#Set contains a collection of unique values #and works like a mathematical set #All the elements in a set must be unique, no two elements can have the same value #Sets are unordered #Elements stored in a set can be of different data types mySet= set(['a','b','c']) print(mySet) mySet2 = set('abc') print(mySet2) myS...
f174dddf83353e139c2b58d001bf3ea0e5d0c10f
rorschachwhy/mystuff
/learn-python-the-hard-way/ex1_6.py
3,339
4.65625
5
#ϰ1һ print "Hello World!" print "Hello Again" print "I like typing this." print "This is fun." print "Yay! Printing." print "I'd much rather you 'not'." print 'I "said" do not touch this.' #ϰ2עͺ; #A comment, this is so you can read your program later. #Anything after the # is ignored by python. print "I could ha...
4dee885190dd68ae95d609ded5adca24f7552d50
UncleBob2/MyPythonCookBook
/datetime module timedelta timezones.py
1,613
3.53125
4
import datetime import pytz # naive datetime vs aware assigned_d = datetime.date(2012, 12, 12) today = datetime.date.today() print('Assigned date = {}, Today Date = {},'.format(assigned_d, today)) print('Year = {}, Month = {}, day = {}'.format( today.year, today.month, today.day)) # Monday 0 and Sunday 6 date....
3ed02b1de12304585cb89c527a4bc8f684499c1b
wrosko/EXDS
/Week 5/Rosko_Terwiesch_timestable.py
1,218
4
4
""" File: Rosko_Terwiesch_timestable.py Authors: Wade Rosko and Mats Terwiesch Description: User inputs some number and a starting point, program prints a multiplication table """ user_number = raw_input("Please enter a number: ") last_multiple = raw_input("Enter the maximum value of the times table: ") print "" # ...
0bbd2964144d737477893da9358cd16606708497
KhvostenkoIhor/khvostenko
/Lesson_28/dz_28_2.py
2,996
4.1875
4
class Stack(): def __init__(self): self.stack = ['a', 'rtyy'] self.lenght = 3 def try_method(method): def wrapper(self, *string): try: method(self, *string) except Exception as e: print(f"You can't do that because {e}") r...
a44137e9c6acb321f97ffc295eebc7a26e7ac804
Sakartu/kmltoolkit
/convert_coords.py
1,975
3.546875
4
#!/usr/bin/env python # -*- coding: utf8 -*- """ Usage: convert_coords.py [COORD]... Options: COORD A set of lat/lon coordinates in any one of the most used formats. If left out, you will be asked for coords """ from __future__ import unicode_literals import re from docopt import docopt from decimal import Deci...
429ff7130f7a111a201dde7580a38a183ce8b170
maximalism000/guess_name
/guess_name.py
1,909
3.75
4
print('名前を入力してください') true_name = list(input()) print('試行回数を入力してください') N = int(input()) game_continue = True LEN_NAME = '=====名前は%d文字です=====' % len(true_name) user_change = ''' ======================回答者に渡してください========================= ''' print(user_change) rule = '''名前当てゲームのルールを説明します。 最初に、出題者が名前と試行回数を...
20165158a1c02b20f9f48dcea7d879074cd7e49c
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4161/codes/1800_2573.py
548
3.59375
4
from numpy import* p = array(eval(input("peso: "))) a = array(eval(input("altura: "))) n = size(p) t = zeros(n) y = 0 for x in p: t[y] = round(x/(a[y]**2) , 2) y = y + 1 print(t) print("O MAIOR IMC DA TURMA EH:", max(t)) if max(t) < 17: print("MUITO ABAIXO DO PESO") elif 17<max(t)<=18.49: print("ABAIXO DO PESO") el...
ff75e73bc877ebbbe8cff0833b93d51361ff1bc1
erjan/coding_exercises
/count_all_valid_pickup_and_delivery_options.py
658
3.71875
4
''' Given n orders, each order consist in pickup and delivery services. Count all valid pickup/delivery possible sequences such that delivery(i) is always after of pickup(i). Since the answer may be too large, return it modulo 10^9 + 7. ''' def countOrders(self, n: int) -> int: a = 1 for i in range(2, n+1)...
e34ac9775f0d33c5740330b02997749da951be61
hellcodeX/first_python
/list_comprehension.py
988
4.0625
4
if __name__ == '__main__': a = range(5) b = [] for num in a: b.append(num * 2) print(b) # аналогичное с помощю генераторов списка c = [num * 2 for num in a] print(c) range1 = [num * 3 for num in range(1, 6)] print(range1) a = [1, 10, 12, 4, 3, 20, 55] a_filtered ...
e0bb980636408dfbbe5798a07001fa37291814e9
brennanharrison/Kattis
/lineup.py
332
3.875
4
#!/usr/bin/env python # coding: utf-8 # In[11]: n= int(input()) x = 0 oL = [] while x < n: u = input() oL.append(u) x+=1 oLSort = oL[:] oLSort.sort() oLReverse = oLSort[:] oLReverse.reverse() if oL == oLSort: print('INCREASING') elif oL == oLReverse: print('DECREASING') else: print(...
7751dd10e0dd20589f44264609871785dfb60dd9
zlr20/running-robot-simulation
/running_robot_v2.0/controllers/double_barrier/double_barrier.py
1,059
3.625
4
from controller import Robot,Motor robot = Robot() #仿真步长 timestep = int(robot.getBasicTimeStep()) wheel1 = robot.getDevice("wheel1") wheel2 = robot.getDevice("wheel2") TouchSensor1 = robot.getDevice("t_sensor1") TouchSensor1.enable(timestep) TouchSensor2 = robot.getDevice("t_sensor2") TouchSensor2.enable(timestep) robo...
b9d2cd848160c59c54cad4fc0acafb450808bfee
kamilczerwinski22/Statistics
/statistics/classes_1/exG/exG_pt2.py
2,807
4.0625
4
# A script for showing number of wins trajectory for player A. # Part 1: Player A's capital depending on number of the game # Author: Kamil Czerwiński, Jagiellonian University, CS 2020/2021 import matplotlib.pyplot as plt import random def play_game(a_capital: int, b_capital: int, p: float) -> list: """ Func...
de822c48507a3128d0920d89d1590bc64ab2405e
geraldthedev/IS211_Assignment8
/despat.py
2,371
3.75
4
import random import argparse def roll_die(): """Roll a 6 face die""" return random.randint(1, 6) class Die: def __init__(self, faces=6): self.faces = faces def roll(self): return random.randint(1, self.faces) class Player: def __init__(self, name): self.name = name ...
0e654d8c170bdab02ee13d7228204243c61e06cf
whitefly/leetcode_python
/有限状态机/65_valid_number.py
2,063
3.515625
4
""" 思入: 方法1: 高级版->比较多条件,利用有限状态机 方法2: 初级版->写个re正则 方法3: 无脑版->利用python的float() 状态机中实现中的一些坑 1.'-.1','3.e3'可以过 2.'.'过不了 """ class Solution: Digit = 0 Signal = 1 Blank = 2 Dot = 3 E = 4 Other = 5 End = 6 T = 98 F = 99 statusTable = [ [2, 1, 0, 9, F, F, F], # 开始态0 ...
8298b0514566fb67460fe4685f29c8f02fdd70e9
tskiranmayee/Python
/4.Strings&Lists/listMethods.py
1,227
4.21875
4
# -*- coding: utf-8 -*- """ Created on Mon May 10 18:08:35 2021 @author: tskir """ """List as an Array""" x1 = ['a', 'b', 'c'] x1.append('d') print("x1 after append()=",x1) #Adds an element at the end of the list""" x2=['w','x'] x1.clear() #Removes all the elements from the list print("x1 after clear()=",x1) x3=[...
4fe25cbf26295bc0d647ab8d288c50d262003072
rohitdandona/NRooks-NQueens-Problem
/nrooks_queens.py
5,864
4.0625
4
# nrooks_queens.py : Solve the N-Rooks/N-Queens problem! # # The N-rooks/N-Queens problem is: Given an empty NxN chessboard, place N rooks/Queens on the # board so that no rooks/queen can take any other. # This is N, the size of the board. import time import sys N=375 # Count # of pieces in given row def count_on_r...
66f824c3dc59aeec03ef118278b7183c5af458ae
koundinyagoparaju/leetcode
/src/python/addTwoNumber2.py
1,128
3.671875
4
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, val=0, next=None): # self.val = val # self.next = next import math class Solution(object): def addTwoNumbers(self, l1, l2): finalList = ListNode(0) head = finalList carry = 0 while...
5cee14c6682a74102420c1b493dc1b6f8760cbe7
hcrocks007/Algorithms-Explanation
/Basic Math/mean.py
482
4.1875
4
def mean_calculator(): # First we take the list of numbers list_of_numbers = input('Enter numbers').split(' ') # Calculating sum sum_of_numbers = 0 for i in range(0,len(list_of_numbers)): sum_of_numbers = sum_of_numbers + int(list_of_numbers[i]) # Counting the numbers in ...
bf92913149ee2727c99e3d18ea47964b8dece9f5
miblazej/pie
/uniform.py
675
3.65625
4
import numpy as np def coin(): a = np.random.randint(2) return a def random_generator(a, b): # gauusian distribution przedzial = b - a przedzial_t = przedzial bits = 0 # calculation of numbers of bit required to represent przedzial while przedzial: przedzial >>= 1 ...
1199bbd1a14a040380347a5ad61fabfd4d6121ca
jvrs95/Python
/Exercício1opcional.py
283
3.875
4
a = input ("Digite o nome do cliente:") b = input ("Digite o dia de vencimento:") c = input ("Digite o mês de vencimento:") d = input ("Digite o valor da fatura:") print("Olá,", a) print("A sua fatura com vencimento em", b, "de", c, "no valor de R$", d, "está fechada.")
879177675de35ee006412b4e3fd8e522ed281047
Genyu-Song/LeetCode
/Algorithm/Searching/Backtracking/N-Queens.py
5,569
3.875
4
# -*- coding: UTF-8 -*- ''' The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to the n-queens puzzle. Each solution contains a distinct board configuration of the n-queens' placement, where 'Q' and ...
d3ee4cb98d68b6704424eddd527e87f34afa3fa3
Thorqueor/L3_project_IA
/IA_FINAL_DJ_OL/ProjetIA/IA/ProjetFinal.py
24,874
3.59375
4
''' Created on 03 mar. 2017 @author: Denou Julien python version 2.7.13 ''' #!/usr/bin/python # -*- coding: latin-1 -*- import os, sys import random from random import randint import copy import time from Tkinter import * class Solution: """ La classe Solution est defini par : - L...
f635a9222bbc1d03ace657bca71fb237984cab49
smrsassa/Studying-python
/curso/PY1/condicao/ex8.py
226
3.796875
4
salario = int(input('seu salario')) if salario<=1250: aumento = salario*1.15 print ('salario com aumento {:.2f}'.format(aumento)) else: aumento = salario*1.1 print ('salario com almento {:.2f}'.format(aumento))
7b1e7eb73ef32188e8427139bea0272b4504096e
wangaqiang/python-
/2.linux系统编程/2.多线程/线程代码/5.mutual_lock.py
888
3.578125
4
from threading import Thread,Lock g_num = 0 def task1(): global g_num for i in range(100000): mutax.acquire() #与另一个子线程抢着上锁 加锁加在越少的地方越好 g_num+=1 mutax.release() #成功上锁后解锁 print("子线程1的结果为%d"%g_num) def task2(): global g_num for i in range(100000): mutax.acquire() #返回...
804d3a67d2014264bbf8c21ccbf5d7f7501d2a0c
loganyu/leetcode
/problems/2496_maximum_value_of_a_string_in_an_array.py
1,317
4.4375
4
''' The value of an alphanumeric string can be defined as: The numeric representation of the string in base 10, if it comprises of digits only. The length of the string, otherwise. Given an array strs of alphanumeric strings, return the maximum value of any string in strs. Example 1: Input: strs = ["alic3","bob",...
776e2aef5a7b3181c3eba48e327565c9441826ad
KylePreston/Tools_and_GUI
/Seattle_Tip_Calculator.py
506
4.03125
4
# Seattle Tip Calculator # Kyle Preston 2013 bill = input ('\nWhat is the total before tax? ') # Sales tax in Seattle, WA (2013) tax = 0.095 bill = bill + bill*tax print ("\nWith Seattle tax, that makes the total $%.2f." % bill) tip = input('Enter the percentage of tip you want to leave: ') if (tip > 40): print (...
8d6e4a038c977f833e0bf87612f910110058d082
arozcoder16/My-Codes
/Variables - Username and Password.py
226
3.546875
4
user = "rockets" password = "raptors" c_user = input("Enter username: ") c_password = input("Enter password: ") if c_user == user and c_password == password: print("Welcome") else: print("Login Failed")
e9cd7ea95a5df1d7107b6a1a1726e21ba0b84b68
eliangcs/projecteuler
/p76.py
1,144
3.78125
4
""" https://projecteuler.net/problem=76 It is possible to write five as a sum in exactly six different ways: 4 + 1 3 + 2 3 + 1 + 1 2 + 2 + 1 2 + 1 + 1 + 1 1 + 1 + 1 + 1 + 1 How many different ways can one hundred be written as a sum of at least two positive integers? """ p_cache = {} def p(n, k): """ Ret...
fa2e83d91f23e2fef9fe2e9bb00aa0d2ee10dc6c
juliocpmelo/so_examples
/python_examples/threads/thread_sync.py
867
3.578125
4
import threading import time import os var = 10 lock = threading.Lock() def thread_func(): global var global lock self_t = threading.currentThread() while True : print ("Sou o processo " + str(os.getpid()) + " na thread " + str(self_t.ident)) #regiao crítica, precisa ler e escrever o valor de val lock.acqu...
ad355011e8f50846f0c92390bf53172f6a9c7500
MaksimDzhangirov/tango_with_django_2
/manuscript/link_checker.py
1,905
3.703125
4
# Checks for broken links in the book chapters, printing the status of each link found to stdout. # The Python package 'requests' must be installed and available for this simple module to work. # Author: David Maxwell # Date: 2017-02-14 import re import requests def main(chapters_list_filename, hide_success=True): ""...
9c04a617261bc393e02d642c98688bca2e23171e
abhinavprasad47/KTU-S1-S2-CS-IT-Python_C-programs
/Python Programmes/5_Celcius_2_Fahren_.py
171
4.09375
4
#Celcius To Fahrenheit c=input("Enter the Temperature Celcius Degrees:") #Applying The Equation faren=(((9/5)*c)+32) print("The Farenheit Temperature is "+str(faren))
075bd6674e0588a8add8e3096ae46888f051d513
graceyqlin/Python
/GraceLinREPO/SUBMISSIONS/week_02/averages.py
692
4.03125
4
def averages(): try: import math a = int(input("Enter the first number" )) b = int(input("Enter the second number" )) method = int(input("Enter the method for the average (1 for arithmetic mean, 2 for geometric mean, or 3 for root-mean-square)")) if method == 1: p...
806879b280c9f523a8dd3152c38597b78932dbb1
thongchaiSH/practice-python
/phase3/ep1.py
810
3.96875
4
# EP1 Exception # number1=10 # number2=0 # print(number1/number2) ''' try: คำสั่งรันโปรแกรมปกติ except: ที่ทำงานตอนโปรแกรมผิดพลาด ''' ''' Ex1 try: number1=10 number2=0 print(number1/number2) except: print("Error") finally: print("Finally.") ''' try: number1 = 10 number2 = 2 p...
d8a9a6b2028fd6eef624c65aaf58497757f61879
ShivaniLJoshi/Banking_Project
/Term Depostie.py
24,500
3.890625
4
#!/usr/bin/env python # coding: utf-8 # ## Importing the libraries # In[2]: import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt get_ipython().run_line_magic('matplotlib', 'inline') import warnings warnings.filterwarnings('ignore') # ## Loading and cleaning the data # In[...
b5412234c660c3cae5674ce5e763239d3e87cbb0
stumash/AlgorithmChallenges
/edu/stanford/2019_cs97si/lec04_dynamic_programming/one-dimensional-example.py
1,354
3.640625
4
from typing import List def sol(xs: List[int], n: int, top_down_NOT_bottom_up=True): """ How manys combos of numbers in xs sum to n? E.g. n=5, xs=[1,3,4]: 5 = = 1 + 1 + 1 + 1 + 1 | 1 = 1 + 1 + 3 | + 1 = 1 + 3 + 1 | + 1 = 3 + 1 + 1 ...
bcca4ef6b304b67d7cdaa522fb8b8169c9bee41b
Cooops/Coding-Challenges
/CodeWars/unique_number.py
733
4.25
4
# http://www.codewars.com/kata/find-the-unique-number-1/train/python """ There is an array with some numbers. All numbers are equal except for one. Try to find it! findUniq([ 1, 1, 1, 2, 1, 1 ]) === 2 findUniq([ 0, 0, 0.55, 0, 0 ]) === 0.55 It’s guaranteed that array contains more than 3 numbers. The tests contain s...
c106bd4f036d7506fe1fd53d56bba9f0a4f522dd
msaid1996/pythonIntro
/PycharmProjects/python_intro/function_scrabble.py
692
3.859375
4
def scrabble(word): point = ["a", "e", "i", "o", "u", "L", "n", "r", "s", "t"] dgpoint = ["d", "g"] bcpoint = ["b", "c", "m", "p"] fhpoint = ["f", "h", "v", "w", "y"] kpoint = ["k"] jpoint = ["j", "x"] qpoint = ["q", "z"] count = 0 for i in word: if i in point: c...
04c131651d3eef286f5b87e4db388c0bad89ffa2
jonny21099/DataBase-Email-Search
/prepDF.py
3,645
3.640625
4
import re #This function writes to terms.txt file def prepTerms(inFile): termsFile = open("terms.txt", "w+") #Creates terms.txt with w+ (writing and reading) rights with open(inFile, 'r') as file: #Opens inFile (xml file passed as argument) for line in file: #for loop for each line if line.startswith("<m...
409ca415e1f91e94bbd1328112062488bb267f1f
Loai17/Y--Project
/agario.py
1,341
3.640625
4
import turtle, time, random from turtle import * from ball import Ball turtle.colormode(255) # qturtle.speed(100) RUNNING=True SLEEP=0.0077 SCREEN_WIDTH=turtle.getcanvas().winfo_width()/2 SCREEN_HEIGHT=turtle.getcanvas().winfo_height()/2 my_ball=Ball(0,0,5,5,20,"green") NUMBER_OF_BALLS = 5 MINIMUM_BALL_RADIUS = 10 M...
ac25290b5e5922b2a48bea505449675878534c2d
RonaldTheodoro/ExemploTK
/tk01/main5.py
251
3.734375
4
from tkinter import * from tkinter import messagebox root = Tk() answer = messagebox.askquestion('Question 1', 'yes or no') if answer == 'yes': messagebox.showinfo('teste', 'yes') else: messagebox.showinfo('teste', 'no') root.mainloop()
39f1bf1e53447f37e307f27f3375b978c144f245
gauravdhama/project_euler_solutions
/Problem3.py
631
3.859375
4
# -*- coding: utf-8 -*- """ Created on Tue Aug 09 19:55:07 2016 @author: e065689 """ import math #Prime Factors def isprime(n): i=2 while True: if n%i==0 and not(i==n): return False break if i>=n: break i=i+1 return True n = ...
de96445f919a6ec26e76e38c3735868f28481a4e
Kamakepar2029/linux-testing
/GEN.py
271
3.59375
4
print ('Starting...') a = int(input('How many MB> ')) end = a*10*10*10*10*10 f = open('testfile.try.txt', 'w') start = 0 while (start < end): f.write('testfile \n') start = start + 1 print ('(Till End missing ',end / start, '% from ' ,end, ' till ', start) f.close()
007434bbb33fbac3c0c3053d67af99c022c79b97
1877762890/python_all-liuyingyign
/day06/demon6.py
4,600
3.65625
4
# string="this is a dog,that is a monkey!" # #将字符串转换成列表 # li = list(string) # # for i in range(0,len(li)): # count=0 #计数器 # #排重 # flag=True #开关置为开 # for k in range(0,i): # if li[k] == li[i]: # flag=False #一旦发现相同字符,开关置位关闭 # break # # if flag == False:#判断开关...
3509e6c9ee2d6fa2806cb80575da7f2d752c26b5
oJacker/_python
/numpy_code/04/eigenvalues.py
746
3.65625
4
import numpy as np A = np.mat("3 -2;1 0") print ("A\n", A) # (2) 调用eigvals函数求解特征值: print ("Eigenvalues", np.linalg.eigvals(A)) # (3) 使用eig函数求解特征值和特征向量。该函数将返回一个元组,按列排放着特征值和对应的特征向量,其中第一列为特征值,第二列为特征向量。 eigenvalues, eigenvectors = np.linalg.eig(A) print ("First tuple of eig", eigenvalues) print ("Second tuple of eig\n", ei...
b1c63dcfb71aaf0cd0e28cc252fa737cefad36fc
patience111/PY-CS-algo
/Using_bisection_search_to_approximate_square_root.py
407
3.765625
4
x=-25 epsilon=0.01 numGuesses=0 low=0.0 high=max(1.0,abs(x)) ans=(high+low)/2.0 while abs(ans**2-abs(x))>=epsilon: print('low=', low,'high=',high,'ans=',ans) numGuesses+=1 if ans**2<abs(x): low=ans else: high=ans ans=(high+low)/2.0 print('numGuesses=',numGuesses) if x>0: print(an...
6641e5431625b62e02287442acdf78a2f2030231
FlankL/DeepLearning
/jicheng/Student.py
740
4.15625
4
# 创建一个类 class Student(): # 特殊方法都是以__开头,__结尾的方法 # 特殊方法不需要我们自己调用 def __init__(self, name): self.__name = name def __run(self): print(self.__name, "run") def say(self): self.__run() print(self.__name, 'say') # def getName(self): # return self.__name # ...
83162de4c60717aef57145b8a503dce19466310f
vsdrun/lc_public
/co_amazon/725_Split_Linked_List_in_Parts.py
2,817
4.0625
4
#!/usr/bin/env python """ https://leetcode.com/problems/split-linked-list-in-parts/description/ Given a (singly) linked list with head node root, write a function to split the linked list into k consecutive linked list "parts". The length of each part should be as equal as possible: no two parts should have a size ...
cc769df1892c353e1d8c1c37dff88da0aa6ee2c7
Shikkic/exercism.io.python
/clock/clock.py
2,172
3.796875
4
class Clock(): # Set initial Clock state def __init__(self, hours, minutes): timeDic = self.calculateMinutes(minutes) self.minutes = timeDic['minutes'] self.hours = self.calculateHour(hours + timeDic['hours']) self.time = self.generateTimeString() # Add minutes to the cl...
ed9ad957887a9554453df41fd0fdb5f8148c30bc
pavelchavdarov/LoganStones
/src/LS_stone/__init__.py
2,700
3.765625
4
class StoneSide: __sides__ = {'Камень', 'Ножницы', 'Бумага'} class CellCoordinates: directions = [(0,1,-1), (1,0,-1), (1,-1,0), (0,-1,1), (-1,0,1), (-1,1,0)] def cell_direction(self, dir): return self.directions[dir] def __init__(self, p_x, p_y, p_z): if p_x + p_y + p...
1d529a3ee47d4aea9a744c1ae0b7e15936537baa
akhiln007/python-repo
/hello_you.py
146
4.15625
4
person=input("Enter your name:-") print("Your name is:-",person,'!') print("Your name is:-",person+'!') print("Your name is:-",person,'!',sep='')
8e05bcbf3aaceec3ea04c2f8f0febb77371970c0
addtheletters/laddersnakes
/linkedlists/singlylinkedlist.py
668
3.5
4
class ListNode: def __init__(self, val, next=None): self.val = val self.next = next def __str__(self): return str(self.val) + ( (", " + str(self.next)) if self.next else "") def __repr__(self): return self.__str__() # follows the links 'index' times # returns a...
ce8cdba0cc1037514e391f65750865c7b1fbc43a
majauhar/SimpleBankingSystem-JetBrains
/banking.py
5,092
3.5625
4
# Author: Mohd Ali Jauhar # IDE: PyCharm Edu # Task: Jetbrains Academy project on Hyperskill import random import sqlite3 conn = None conn = sqlite3.connect('card.s3db') cur = conn.cursor() def drop_table(): cur.execute("DROP TABLE card;") conn.commit() def create_table(): cur.execute('CREATE TABLE IF ...
6f3f54b13c86c54d5bdb9c8972d938fc79a17ea1
LukeSlev/Database_Info_Retrieval
/src/Dev/Phase 3/yearGreater.py
1,221
3.53125
4
from bsddb3 import db def yearSearch(Starting_Year): DB_File = "ye.idx" database = db.DB() database.set_flags(db.DB_DUP) #declare duplicates allowed before you create the database database.open(DB_File,None, db.DB_BTREE, db.DB_CREATE) curs = database.cursor() # while Starting_Year[0] == '0': ...
b58080ee644ee1d446de4fd30974fa9783c50f58
aaronkopplin/agar.io
/agario.py
2,630
3.671875
4
import pygame import sys import random import time import math pygame.init() class game(): def __init__(self): self.colors = [(255, 0, 0), (0, 255, 0), (0, 0, 255)] self.width = 1000 self.height = 1000 self.screen = pygame.display.set_mode((self.width, self.height)) self.num_points = 50 # game objects ...
291ac8f23997788d948150cd1eb1a35e9e692f7b
iskislamov/kyapr
/linq/linq.py
1,697
3.734375
4
def generateFibonacci(): first = 1 second = 1 while True: second += first first = second - first yield second class Range: def __init__(self, provider): self.provider = provider def Select(self, foo): return Range([foo(x) for x in self.provider()]) def ...
acc5707766dcefcde3630e6ca7de8e421081baa9
JneWalter25/-Generating-Randomness
/test5.py
2,966
3.65625
4
class GenerateRandomness: def __init__(self): self.number = '' self.profile = {"000": [0, 0], "001": [0, 0], "010": [0, 0], "011": [0, 0], "100": [0, 0], "101": [0, 0], "110": [0, 0], "111": [0, 0]} self.money = 1000 def get_number(self): print(f"...
8f4f4fee4dbda17e5f75c4c741067bb99cb9cfbe
kmark1625/Project-Euler
/p30.py
786
3.90625
4
def main(): return sum_of_nth_sum(5) def sum_of_nth_sum(n): sum = 0 for i in range(1, 1000000): if is_valid_nth_sum(i, n): sum += i return sum def is_valid_nth_sum(num, n): string_num = str(num) if len(string_num) == 1: return False sum = 0 for d in string_num: sum += int(d)**n if ...
efd693c13e784427880f1388038716d7da8474c6
algharrash/saudidevorg
/day007.py
855
3.625
4
#python string my_name = 'Ali AlGharrash' long_text = """Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as fo...
79f1fa60dcc97e3ec1cab1f936aff537da20f3b2
morbrian/carnd-alf
/binary_thresholds.py
5,902
3.890625
4
import numpy as np import cv2 def abs_sobel_threshold(image, orient='x', sobel_kernel=3, thresh=(0, 255)): """ Apply sobel threshhold to image. Reference: Udacity Advanced Lane Finding - (21) Applying Sobel :param image: input image :param orient: orientation axis (x or y) :param sobel_kernel...
f53e8f184ba51b32db58af68e7423b7b41bef3b7
shuchangFrances/machinelearning
/normalization.py
859
3.5
4
"""标准化normalization数据""" from sklearn import preprocessing import numpy as np from sklearn.cross_validation import train_test_split from sklearn.datasets.samples_generator import make_classification from sklearn.svm import SVC import matplotlib.pyplot as plt '''a=np.array([[10,2.7,3.6], [-100,5,-2], ...
7cf8b42e0181c646c797ea2dc5b9749aba02f7db
slottwo/rpg-dpc
/gui/__init__.py
558
3.75
4
from reader import dice_reader, sum_reader from calculator import probability, probability_range def one_sum_probability(): n, f, m = dice_reader() s = sum_reader() print(f"The probability of the sum {s} occurring in rolling of {n}d{f}{'+' if m > 0 else ''}{m if m != 0 else ''} " f"is around {ro...
26a3a546e2a8edfb85854cf0a5ac88babf666f54
mnkhann/PythonBasic
/basic.py
2,919
4.28125
4
#3 types string a = 'Hello python' print(a) b = "Hello python" print(b) c = """ Hello student's, "how are you"? """ print(c) #Numbers in python e = 345 print(e) print(type(e)) f = 3.55 print(f) print(type(f)) g = 555555555666666 #long datatype for python v2 not v3 print(g) print(type(g)) h = 8 + 7j print(h) p...
1e42d50d994919f7c52d1693b7a626ab199f1f98
qdonnellan/projecteuler
/python/problems/problems_01_25/problem_02.py
1,116
3.921875
4
class Problem02: """ find the sum of all even terms in the Fibonacci series where the largest term is less than some limit """ limit = 3 fibonacci_series = [] even_terms = [] solution = None def solve_problem(self): self.construct_fibonacci_series_less_than_limit() ...
530a867ac6149e50cb42e0183660311abf58b58d
happyquokkka/TIL_Python
/common_education/06. While/while_ex3.py
1,232
3.859375
4
# while_ex3.py # 사용자에게 숫자(정수)를 입력받아 # 홀수이면 '숫자는 홀 수 입니다.' 출력 # 짝수이면 출력 없이 다음 입력을 받는 프로그램을 작성. # 종료는 입력에 x 문자가 들어오면 종료하되 break문 활용 # 짝수일 경우 출력 건너뜀은 continue 문 활용 num = input('숫자(정수)만 입력하세요. 종료를 원하면 x를 입력하세요 : ') while int(num) % 2 != 0 : print('%d는 홀 수 입니다.' % int(num)) break if int(num) % 2 == 0 : ...
3da982c7fe1f65e36061824bf594ce2b491a9da8
Jrice170/Chaos-Simulation
/Chaos_pi.py
3,907
4.1875
4
## Joseph Rice 10/23/2017 ## Cs 177 """This code it going to randamly generate dots on to a graphics window. The code below will do a calulation for random dots. This code will allso show the calculation for the percentage that hit the circle. first import the random modual 'from random import *' next import t...
2d03be0cf0bca0f04fc2398404ad2c336473eb9b
antillgrp/Maryville-University-Online-Master-s-in-Software-Development
/SWDV-600-Intro-to-Programming/Week-6-Using-Classes,-Objects,-and-Collections/unique_list.py
693
4
4
class ListUniqueClassifier: def __init__(self): self.list = [] def isUnique(self): # set --> Builds an unordered collection of unique elements. return len(set(self.list)) == len(self.list) if __name__ == '__main__': listUniqueClassifier = ListUniqueClassifier() print("This pr...
3ef296cd38f33d62c7f4a21c4b629129ceeeb1cf
sachindusahan/Tic_tac_toe
/result.py
573
3.671875
4
lines = [ [0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6] ] def result(user, computer, checks): for line in lines: count1 = 0 count2 = 0 for i in range(3): if checks[line[i]] == user: count1 ...
ef895f0144f0be711180aad36569cfbbcbf2b446
madelinepet/data-structures-and-algorithms
/challenges/find_max_value/find_max_value.py
6,814
4.1875
4
class Node(object): def __init__(self, value, data=None, left=None, right=None): """ Instantiates the first Node """ self.value = value self.data = data self.left = left self.right = right def __str__(self): """ Returns a string """ return...
36804adc7ad61c4413ee0e55b2cdf7d5c0a5d57f
swapnilbabladkar/python_sourceCode
/PythonSourceCodes/Day3/FrequencyOfVowels.py
258
4.09375
4
# Take a string from user. # Count the occurrences of each vowel in the string. # A : 1 # E : 3 & so on vsent = raw_input('Enter a string:') vwls = ['a','e','i','o','u'] cnt=[] for item in vwls: print item, ' : ', vsent.lower().count(item)
6fe0e8d77f3667323eb5dc7170d0ac8373efb32b
Suspious/-forever-young-
/lancering.py
144
3.5625
4
import time print("we gaan opstijgen over ") x = range(31,0,-1) for n in x: time.sleep(1) print(n) print("en we gaan opstijgen!!!!!")
3a3c97b20a52d00b4d62dbba28e39cfb6234351b
olga3n/adventofcode
/2018/01-chronal-calibration-1.py
838
3.640625
4
#!/usr/bin/env python3 import sys import re import functools import unittest def calc(data): lst = re.compile(r'[\s\n,]+').split(data) result = functools.reduce( lambda x, y: x + (int(y[1:]) if y[0] == '+' else - int(y[1:])), lst, 0) return result class TestMethods(unitt...
b7697dc4d444b4c12a2b9e5eac0acd6a88b95770
sidneyalex/Desafios-do-Curso
/Desafio058.py
897
4.09375
4
#Melhore o jogo do Desafio028 onde o computador vai "pensar" em um numero entre 0 e 10. Só que agr o jogador vai tentar advinhar até acertar, mostrando no final quantos palpites foram necessarios para vencer. from emoji import emojize from random import randrange tentativas = 1 ale = randrange(0,11) print('{}\n|| Jogo ...
fce28e0802d5312604c87b7911157eef121586ef
Victorletzelter/pattern_detection
/Python_project/Hand_labeling.py
13,846
3.546875
4
#This file allows to perform hand-labeling of the ZF intervals, in order to adjust hyperparameters of the Event_labeling.py file. #Provided that the variable zi was created or initialized, the user can execute the function learning(), to label by hand the ZF intervals. #If not, the file exec(open("/Users/victorletzelte...
f505c35af870e9a796b92833a05d3a8784c896a2
rathnakarsp/GSoC
/data_preparation/classes.py
2,861
3.859375
4
import os import numpy as np ''' Class person has two variables: the one that is composed of activities and the second are the label to each entry of the activity variable We have five environments: bathroom, bedroom, kitchen, living room and office which are composed of the following activities: bathroom - rins...
9b6e8b0fec2d86f258cb444cfe969eda4ad9ad95
lanhhv84/multithreading_crawler
/threads.py
1,465
4.0625
4
from __future__ import print_function import threading import time class Threads: """ How to use: Create Threads object th = Threads(num_threads, data_pool) Create a function f that take two argument The first one is data in pool The second one is a tuple o...
d1cb48d421ad5e5e751610e4e415128e525eb26f
HenintsoaHARINORO/Youtube-Video-Downloader2
/Download.py
801
3.578125
4
import tkinter as tk from pytube import YouTube window = tk.Tk() window.geometry('500x300') window.resizable(0,0) window.title("Youtube Video Downloader") tk.Label(window, text ="Youtube Video Downloader", font ="arial 20 bold").pack() link = tk.StringVar() tk.Label(window, text ="Paste Link Here:", font ="arial 15 ...