blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
8ca179e9dbd1210a0190cf7a8e8b1610b893efdb
JarryShaw/PyNTLib
/Homework Codes/2017:02:23/SKT_1-8-2 Eratosthenes_Sieve.py
895
3.578125
4
# -*- coding: utf-8 -*- #厄拉托塞師篩法 #返回10,000以內正整數的所有素數(默認情況) ''' print (lambda n: filter(lambda x: all(map(lambda p: x%p!=0, xrange(2,int(__import__('math').sqrt(x)+1)))), xrange(2, n)))(10000) ''' import math def eratosthenesSieve(N=10000): set = [1]*(N+1) #用於存儲N(默认为10000)個正整數的表格/狀態;其中,0表示篩去,1表示保...
815c64de916e4f72c8fdc9c80a648c9562f23ee7
EvilBorsch/Sort_Vstavkami
/solution.py
1,130
3.953125
4
import random # чтобы можно было рандомит arr = [] # объявил массив def index_min(i, arr): # функция которая находит индекс минимального элемента index = i for i in range(i, arr.__len__()): # веду поиск от i-того элемента, до конца массива if arr[i] < arr[index]: index = i return ...
1c49d4857174643f4ec34dfb9326c05779a10881
david-wm-sanders/uswacs-1-iy1d402-a1-zipcrack
/zipcrack.py
972
3.578125
4
import sys import zipfile from pathlib import Path def read_word_list(wrd_fp): pws = [] with wrd_fp.open("rb") as f: for pw in f.read().split(b"\n"): pws.append(pw) return pws def crack_zip(zip_fp, word_list): with zipfile.ZipFile(zip_fp) as z: for pw in pws: ...
a026c856fe7d80f9f4247507459439872a622cdd
nanovisor/python
/salary_per_hour.py
346
3.734375
4
# just comment print "**************************************************" print "This program counts salary per hour [rate is 2.75$]" hours = raw_input("Please enter hours:") rate = 2.75 gross = float(hours) * rate print "Your earn " + str(gross) + "$ per " + hours + " hour(s)" print "***************************...
8f2cb0e64311b79480aee72bf34c3827e388c2fc
jiajiabin/python_study
/day01-10/day06/05_闭包函数2.py
1,090
4.0625
4
import datetime import time # 闭包函数往往通过返回值,返回一些附加的功能 def print_num(): for i in range(1, 101): time.sleep(0.1) # 线程休眠,程序等待0.1秒,什么都不做 print(i) # 计算这个函数执行需要多久的耗时 # 写一个闭包函数完成这个功能 def count_time(): def do_count_time(f): # f = print_num # 获取函数f执行之前的时间 time = datetime.dateti...
9285343185b25208eaeb2e0815797e53f63b0152
ATLS1300/pc04-generative-section11-ella-lagomarsino
/pc04_generativeart Lagomarsino, Ella peace sign
2,884
4.09375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Sep 17 09:42:51 2021 @author: ellalagomarsino """ """ Created on Thu Sep 15 11:39:56 2020 PC04 start code @author: Ella Lagomarsino ********* HEY, READ THIS FIRST ********** My code uses three turtles to create red, white, and blue horizontal stripes as...
18926f094327f2ef0f091367975f810da811b42b
deekshasowcar/python
/copystring.py
108
3.984375
4
def string(str,n): result=" " for i in range(n): result=result+str return result print(string("abc",3)
f697502698767d63d35ef175cb38b1307a1c714f
pbarton666/learninglab
/data_sci_mini/py_pandas_series_1.py
910
3.78125
4
#py_pandas_series_1.py """a first look at pandas""" #creating a series import pandas as pd data=[10, 20, 30, 40] ser=pd.Series(data=data) print(ser) print() #addressing elements ser[0]='some string' ser[1]=(1,2,3) print(ser) print() #managing elements value_3=ser.pop(3) print(value_3) print() print(ser.get(666,...
4f06eee4ea1e56e952cabd995649f1d5649d484c
IanBuceta/Programacion2
/tareas/Clase 4/ejercicio_5.py
1,641
3.75
4
from os import system productosCosmeticos = list() preciosUnitarios = list() ventas = dict() def cargarproductos(): while(True): system("cls") productosCosmeticos.append(input("Ingrese nombre del producto: ").lower()) preciosUnitarios.append(float(input("Ingrese costo unitario: "))) ...
9b6ef646912c34bd73fe2c228c3a52a745e1a1b3
geodimitrov/Python-Fundamentals-SoftUni
/Lists/Advanced/05. еlectron_distribution.py
385
3.765625
4
n_electrons = int(input()) distr_electrons = [] cell_position = 1 while n_electrons > 0: electrons_in_cell = 2 * cell_position ** 2 if n_electrons >= electrons_in_cell: distr_electrons.append(electrons_in_cell) else: distr_electrons.append(n_electrons) n_electrons -=...
623876deb66b1f9697a05188e5522e6df08588ad
Shayan3008/Numerical_Computing_Project
/newtonDD.py
3,116
4
4
# Python library for symbolic mathematics it gives function as sub symbols which make working with formulas ike 2x or sinx much more easier. import sympy as sp mainCount = 1 list1 = [] # values of x list2 = [] # values of fx list3 = [] # value of a0,a1,a2 list4 = [] x = sp.symbols('x') def addItemToTable(l...
5e7fbb80ccaa940024ad1506d6c8fe82859c7fe7
mtrentz/Misc-Projects
/challenges/4squares.py
484
3.5
4
from itertools import permutations """ My take on the challenge from: https://rosettacode.org/wiki/4-rings_or_4-squares_puzzle """ def test_equal(list): if sq1 == sq2 == sq3 == sq4: possibs.append(list) possibs = [] vals = [i for i in range(1,8)] # All permutations of these values perms = permutation...
d08cf37c2481189498f85263c922ad4d0e73e6b5
kellymhli/code-challenges
/string-shift.py
538
3.734375
4
def shift_string(s, shifts): if not shifts: return s move = 0 for shift in shifts: if shift[0] == 0: #left move -= shift[1] else: move += shift[1] move %= len(s) if move < 0: s = s[move:] + s[:-move + 1] elif move > 0: s = s[-mov...
81ad7e2825d07bfbbab14140092b725a7cf1a2a3
MANOJPATRA1991/Data-Structures-and-Algorithms-in-Python
/Searching and Sorting/Sorting/Shell Sort/main.py
883
4.1875
4
def gap_insertion_sort(alist, start, gap): """ Perform insertion sort on sub lists of alist created with a gap Args: alist: List to sort start: Start index gap: """ for i in range(start+gap, len(alist), gap): current_val = alist[i] position = i wh...
10e0d07e8b69064d81a17d0c71e631aa6646e592
nandansn/pythonlab
/learnings/codingbat/warmup2/array_count9.py
172
3.515625
4
def array_count9(nums): countnine = 0; for num in nums: if num == 9: countnine = countnine + 1 return countnine print(array_count9([1,2,3,9,2,9,9]))
287239c934b584adf32ff3bec7fb190305e8aa1e
JoshuaGutie/python_basics
/chapter3/practice.py
208
3.71875
4
places = ['austin', 'georgetown', 'paris', 'london', 'new york'] print(places) places.sort() print(places) places.sort(reverse = True) print(places) places.reverse() print(places) places.sort() print(places)
52fcf7bf2443d764458d477f7e1d8308f6fcf558
LeBertrand/XRPS
/RockPaperScissors.py
3,875
3.828125
4
# Include some code that knows how to choose randomly. import random # define list of options handBeats = {'r':'s', 'p':'r', 's':'p'} hands = list(handBeats.keys()) # Variables determine whether cheats are accepted or treated as invalid input by chooseWinner. cheats_unlocked = {'shoot':False, 'clint':False} ...
0ed11ba2f7f1cf483ee68f67d6a7ef354663fcf9
FEIYANGDEXIE/rui_learnmore
/面试笔试经验/4.py
408
3.625
4
#牛客校招真题安置路灯。注意字符的大小写问题 def fun1(a, b): lukuang = list(b) idx2 = 0 total = 0 while (idx2 < a): if lukuang[idx2] == 'X': idx2 = idx2 + 1 # print(idx2) continue elif lukuang[idx2] == '.': total = total + 1 idx2 = idx2 +...
c5ed7ea322678749d4aa17c0ef7421bfa3bff6de
kveola13/python_exercies
/exercises/exercise_15.py
363
4.1875
4
def return_reverse_words(long_string): split_string_with_space = long_string.split(" ") split_string_with_space = split_string_with_space[len(split_string_with_space) - 1::-1] return ' '.join(split_string_with_space) def main(): string_test = "this is a test" print(return_reverse_words(string_test...
ce5012b4abc1e78f8463860148d87ffdbfb0ef3c
shas-hank7/python
/practice.py
96
3.5
4
mydict={ "Fast": "Quick", "list": [1,3,4], } mydict["list"]=[1,2] print(mydict["list"])
d45e665de813d0a9d0d5a2a8a75e8c63148a8106
craignicholson/pythontraining
/iterables/take.py
1,329
3.9375
4
"""Module for demonstrating generaator execution.""" def take(count, iterable): """Take items from te front of iterable. Args: count: The maximum number of items to retrieve. iterable: The source series. Yields: At most 'count' items from 'iterable'. """ counter = 0 f...
0ac67f25fddc2c3de46383689715204cee63f175
devLorran/Python
/ex0082.py
750
4.125
4
'''Crie um programa que vai ler vários números e colocar em uma lista. Depois disso, crie duas listas extras que vão conter apenas os valores pares e os valores impares digitados, respectivamente. Ao final, mostre o conteúdo das três listas geradas.''' lista = [] listaPar = [] listaImpar = [] n =-1 print('O pro...
5b9a060032033d38a45c7058be13e8ef6b373e06
ramsharma-prog/State_game
/main.py
1,915
3.734375
4
import turtle import pandas as pd turtle.Screen() screen = turtle.Screen() image = "blank_states_img.gif" screen.addshape(image) turtle.shape(image) with open("50_states.csv") as states_file: data = pd.read_csv(states_file) states_data = data['state'].to_list() score = 0 guessed_answers = [] user_guess_count...
70c4af138bf9e4569566bcc5d293818390876a2d
khygu0919/codefight
/Core/countBlackCells.py
547
3.859375
4
''' Imagine a white rectangular grid of n rows and m columns divided into two parts by a diagonal line running from the upper left to the lower right corner. Now let's paint the grid in two colors according to the following rules: A cell is painted black if it has at least one point in common with the diagonal; Otherw...
436674b0993596731108455f5050bc0196dda38f
markpseda/Cell-Autonoma-Python
/main.py
1,798
3.546875
4
# Import a library of functions called 'pygame' import pygame import copy from cell import * from music import * from world import * # Define the colors we will use in RGB format - only BLACK is used. BLACK = ( 0, 0, 0) WHITE = (255, 255, 255) BLUE = ( 0, 0, 255) GREEN = ( 0, 255, 0) RED = (255, 0, ...
4c3077af90fd91f376d0390633bed55c229a9bbb
JhonveraDev/python_test
/pruebas_estudio/ejercicios_bucles03.py
2,685
4.09375
4
# #Escribir un programa que pida al usuario una palabra y la muestre por pantalla 10 veces. # palabra=input("Escribe una palabra") # i=0 # while i<10: # i=i+1 # print(palabra) # Escribir un programa que pregunte al usuario su edad y muestre por pantalla todos los años que ha cumplido (desde 1 hasta su edad). ...
ac59ac3b047553e523f944b6e870c851123335c5
zhangda7/leetcode
/solution/_119_pascal_triangle_2.py
1,010
3.984375
4
# -*- coding:utf-8 -*- ''' Created on 2015/7/27 @author: dazhang Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [1,3,3,1]. Note: Could you optimize your algorithm to use only O(k) extra space? Solution(): a[i][j] = a[i-1][j-1] + a[i-1][j] use O(2k) is OK. This is ...
7d8e675e90f20c96366cd6c6ab2f3c9f9caf6c72
smorenburg/python
/src/old/acloudguru/lambdas-and-collections/collection_funcs.py
563
3.734375
4
from functools import reduce domain = [1, 2, 3, 4, 5] # f(x) = x * 2 our_range = map(lambda num: num * 2, domain) print(list(our_range)) evens = filter(lambda num: num % 2 == 0, domain) print(list(evens)) the_sum = reduce(lambda acc, num: acc + num, domain, 0) print(the_sum) words = ['Boss', 'a', 'Alfred', 'fig', ...
51886241f2764755e85820c78010b3e871f61af3
padmajalanka/tutorials
/homework/day2revisionhw.py
6,351
4
4
name = "Today's Home work Python Data types" print(name.center(20,"*")) """ Built in Data types Text type -- string (str) Numeric type ---int,float,complex Sequence type---- list,tuple,range Mapping type-----dict set type -----set, frozenset Boolean type -----bool Binary types -----bytes,bytearray,memoryview """ # w...
6e9dc37209ac3dae6af189a28dc63be8bb271aa7
mizhi/project-euler
/python/problem-51.py
2,087
3.828125
4
#!/usr/bin/env python # By replacing the 1^(st) digit of *3, it turns out that six of the # nine possible values: 13, 23, 43, 53, 73, and 83, are all prime. # # By replacing the 3^(rd) and 4^(th) digits of 56**3 with the same # digit, this 5-digit number is the first example having seven primes # among the ten genera...
c30889795daf2ed19456d7d25f0f76db0ff64070
Adityasingh63git/pythonprogram
/RADIUS_NUMBER.py
125
4
4
print("area of a circle ") r = input("123") area = (3.14 * (r*r )) print("area of a circle is :" + area) print("area")
224184e9feeb130f4c96c5deef268c799291d9c8
MisterNSA/Calculator
/calculator.py
3,302
4.25
4
# For now, just a simple Calculator # Creator: MisterNSA aka Tobias Dominik Weber # Date: 18.11.2020 Version 1.0 # Update Plans: Adding more functionality like powers, square roots etc. import tkinter as tk import tkinter.ttk as ttk win = tk.Tk() win.title("Calculator") """ Variables: string - Expressio...
a15c2439e12a6058e1a0b4716c37940d2a0baf03
NickKletnoi/Python
/03_Algorithms/03_Misc/13_GraphCycle.py
3,412
3.625
4
#Copyright (C) 2017 Interview Druid, Parineeth M. R. #This program is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. from __future__ import print_function import sys WHITE = 0 GRAY = 1 BLACK = 2...
ecf5ee05417bc4b500cc8196b9ced9dfc13b7ae5
jainendrak/python-training
/Examples/1Intro/DataTypes/3List/second.py
506
3.5
4
l=['a','b','c','d','e','f'] print(len(l)) sum(l) max(l) min(l) l.append('g') l2=['h','i','j','k'] l.extend(l2) l.insert(2,'z') l.pop(2) l.pop() l.remove('a') l.reverse() l.sort(reverse=True) l.count('a') #stack operations-> stack=[] stack.append('a') stack.append('b') stack.append(...
bed918852ed9c37d70b01e4199908ca019e998a4
ChristopherStaib/Truck-Solver
/src/main.py
6,406
3.84375
4
# Name: Christopher Staib | Student ID: #001174711 import Utils import PackageSorter import Truck import TrackTime """ Whole program Space Complexity: O(N) Time Complexity: O(N^3) """ def main(): # create hashtable for packages pkg_hash = Utils.generate_package_hash() # create distance list dist_val...
2adf0431932bef2175e9f06215ec70c248f45ca2
AbdulMoiz22/PROGRAMMING-EXERCISES-3.1-3.44-
/3.31.py
313
4
4
print('Abdul Moiz') print('18b-011-CS-A') print('Program # 3.31') radius = 8 x = float(input("Please enter the x-coordinate: ")) y = float(input("Please enter the y-coordinate: ")) import math check= math.sqrt((x**2)+(y**2)) < radius if check==True: print("Yes It Is In!") else: print('Not In')
a3c9b6f95e59620b027a28848740e95799a6b1a3
bmonroe44/python-challenge
/PyBank/main.py
2,126
3.78125
4
import os import csv # Set path to collect data from the resource folder financial_data = os.path.join('Resources', 'budget_data.csv') # Create lists to store data and variables AvgChg = [] greatest_inc = ["", 0] greatest_dec = ["", 9999999999999] total_months = 0 net_profit = 0 prev_net = 0 # Read the csv file wit...
37a49451179851d351a5dabc0fe63e858128bc48
lincolnp23/python
/exercicio2.py
260
4
4
# -*- coding: utf -8 -*- nome = input('Digite seu nome:') idade = int(input('Digite sua idade:')) if idade >=18: print('Pode entrar' + nome) if idade <=11: print('Menor de idade, você ainda é criança') elif idade <18: print('Menor de idade')
1e03eea047404dafc7adf507b7227dc7a8abcd62
AnitaShirur/Placement
/menu2.py
226
3.515625
4
class menu: def __init__(self,items,price): self.items=items self.price=price def show (self): print(self.items,self.price) menu1=menu("dosa",50) menu2=menu("idli",40) menu1.show() menu2.show()
b8a956425019c55bde1e8f01df9f806614423204
alimoreno/TIC-2-BACH
/PYTHON/nombrador.py
173
3.5
4
def nombrador(): nombre=raw_input("Como te llamas? ") print "Tu nombre empieza por la letra ", nombre[0] print "Tiene ", len(nombre), " letras" nombrador()
55d49ce7240c7af9c27430d134507103cc6739c7
JayAgrawalgit/LearnPython
/1. Learn the Basics/1.11 Dictionaries/1. Basics.py
688
4.15625
4
# A dictionary is a data type similar to arrays, but works with keys and values instead of indexes. # Each value stored in a dictionary can be accessed using a key, # which is any type of object (a string, a number, a list, etc.) instead of using its index to address it. # For example, a database of phone numbers could...
edb93611dbfad095ed5b0db200e72993a0428ac6
Jesussilverioe/Python-Adventures
/Funtions.py
4,637
4.375
4
# Pratice creating functions # Functions make a program easier to write, read, and fix code. # importing other functions can be helpful in order to use methods from other people's code import sys as sy #useful modules from standard library import datetime #date and time module import math #mathematics opera...
3de036a023385176536053684eb33ec0716a2f54
Zach41/LeetCode
/357_count_number_with_unique_digits/solve.py
677
3.90625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- class Solution(object): def countNumbersWithUniqueDigits(self, n): def count(n): if n == 1: return 10 else: sum , cur = 9, 9 n = n-1 while n>0: sum *= cu...
5b83d4f2f44988bb69b9d1d26a71e22cf968c82c
Lonitch/hackerRank
/leetcode/205.isomorphic-strings.py
1,457
3.84375
4
# # @lc app=leetcode id=205 lang=python3 # # [205] Isomorphic Strings # # https://leetcode.com/problems/isomorphic-strings/description/ # # algorithms # Easy (38.59%) # Likes: 985 # Dislikes: 286 # Total Accepted: 247.1K # Total Submissions: 639K # Testcase Example: '"egg"\n"add"' # # Given two strings s and t, ...
d1251fd82b4a9b761c08ce1403ab7a16c1a71b41
sbrohl3/projects
/week_04-05_test_cases_assignment/classes/phonebook.py
2,627
4.34375
4
class Phonebook(): """A class representing a phonebook""" def __init__(self, first_name=" ", last_name=" ", phone_number=0, phone_number_type=" ", contact_list=[]): """A constructor for the Phonebook Class""" self.first_name = first_name self.last_name = last_name self.phone_num...
ed1b1d0ad6d626977675b46b6dced9b43f6dc217
TheWiiz/CTI110
/P4HW2_RunningTotal_SmithStephon.py
394
4.03125
4
#CTI-110 #P4HW2_RUNNING TOTAL #Stephon Smith #June 28, 2018 # num = float(input("Please enter first number or a negative " + \ "number to quit: ")) total = 0 while num > -1: total = total + num num = float(input("Enter the next number or " + \ "negative num...
d4db4fc4ddd34ceafe7254f5cbbd2d6205078b63
tuobulatuo/Leetcode
/src/lnumbers/divideTwoIntegers.py
806
3.953125
4
__author__ = 'hanxuan' """ Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. """ def divide(dividend, divisor): """ :param dividend: int :param divisor: int :return: int """ if (dividend == -2147483648 and divisor == -1) or divis...
c933027dfca9b5a37fff8cc6fb81ecb16abe464a
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_199/2796.py
1,717
3.796875
4
def is_flip_worthy(s): s_length = len(s) count = 0 for i in range(s_length): if s[i] == '-': count += 1 if count > int(s_length/2): return True return False def get_flipped(s): s_length = len(s) count = 0 ret_str = '' for i in range(s_length): if s[i] == '-': ret_str += '+' else: ret_str +=...
cac99b1310c23dd5594ed0ac5e7e8e740b1144cd
KelvinChi/LeetcodeBank
/367_valid_perfect_square.py
376
3.859375
4
#!/usr/bin/env python # -*- coding:utf8 -*- # Created by CK 2019-04-28 08:53:16 def check(num): temp = 1 squr = 0 while True: if squr < num: temp += 1 squr = temp ** 2 elif squr > num: print('False') break else: print('Tru...
df9c64541e46b393821ee9468f3671a530c0a059
ishantk/ENC2020PYAI1
/Session11B.py
2,961
4.5625
5
# Standardization of Objects with Constructor # i.e. we have the same attributes and same default data for all Objects, Initially :) # but data can be updated later as per user's preferences class OneWayFlightBooking: """ # __init__ is known as constructor, executed automatically whenever object ic constructe...
822bffeaf81c302626886c9e12bc4ef666023773
jeffsouza01/PycharmProjects
/Ex003 - SomaDeDoisNumeros.py
258
3.796875
4
primeiroNumero = int(input("Digite o primeiro número: ")) segundoNumero = int(input("Digite o segundo número: ")) print(f"Você digitou os números {primeiroNumero} e {segundoNumero}, " f"sendo a soma entre eles {primeiroNumero + segundoNumero}.")
b828ac55954cebe28b0f4f75f51c926a9b10c344
nickzuck/Advanced-Python
/group_emails_after_sorting_by_domain.py
870
3.703125
4
import random import string from itertools import groupby domains = [ "hotmail.com", "gmail.com", "aol.com", "mail.com" , "mail.kz", "yahoo.com"] letters = string.ascii_lowercase[:12] MAX_EMAILS = 100 def get_one_random_domain(domains): return random.choice(domains) def get_one_random_name(letters): return ...
c4ac81f2ad3729430ee488e572e843dd780a98fc
SimmonsChen/LeetCode
/牛客Top200/89验证IP地址.py
1,327
3.609375
4
# # 验证IP地址 # @param IP string字符串 一个IP地址字符串 # @return string字符串 # class Solution: def isIpv4(self, chs): ans = 0 for ch in chs: if not ch.isdigit(): return False ans = ans * 10 + int(ch) if ans > 255: return False else: return True ...
6b17be2651e104163f593c5d79e7f60f139f5b5b
saforem2/lattice_gauge_theory
/lattice_gauge_theory/cluster.py
3,339
3.9375
4
class Cluster(object): """ Object for grouping sets of sites. """ def __init__(self, sites): """ Initialize a cluster instance. Args: sites (list(Site)): The list of sites that make up the cluster. Returns: None """ self.sites = set(site...
d0330e0fbad196f449691f3795eda5931c261f80
jin1101/myhomework
/BMI計算.py
381
3.765625
4
a=input('請輸入身高,單位為公分:') b=input('請輸入體重,單位為公斤:') c=float(b)/(float(a)/100)**2 if c<18.5: print('your BMI is', c, '您的體重過輕') elif c>=18.5 and c<25: print('your BMI is', c, '您的體重正常') elif c>=25 and c<30: print('your BMI is', c, '您的體重過重') else: print('your BMI is', c, '您的體重肥胖')
a79dc042860790d163ac2cb1947b54aa0c09572a
timohouben/python_scripts
/white_noise/james_generator.py
2,891
3.59375
4
cdef int WET = 0 cdef int DRY = 1 cdef class RainfallSimulator: """ Simple two state Markov Chain based rainfall simulator. The simulator is based on that described by Richardson (1980). The retains an internal state of either wet or dry the transition probabilities are given for wet days based on a p...
34bc8e9cb689a0ede0371941d1f9e25872f0c996
nayanemaia/tcc
/main.py
1,910
3.671875
4
#lasse que descreve o objeto import point import matplotlib.pyplot as plt #classe de interpolador, que contem os metodos de interpolacao linear e polinomial (metodo de Lagrange) from interpolator import * #conjunto de pontos iniciais p3 = point.Point(3.0,4.0) p2 = point.Point(2.0,3.0) p1 = point.Point(1.0,2.0) #veto...
92b5c2a72f3286086835aa4589b6c50612847bb7
13424010187/python
/源码/【33】疯狂的兔子-课程资料/【33】疯狂的兔子-工程包.py
239
3.53125
4
'''疯狂的兔子-工程包''' # 迭代法自定义函数 def rabbit1(number): # 第一个月、第二个月兔子总数 m1 = 1 m2 = 1 # 递归法自定义函数 def rabbit2(number): print(rabbit1(12)) print(rabbit2(12))
a9f41e6fe5bd723d2a357e97acd5db67cb9fd4bc
lucasdvieira/pythonprojects
/simpleCircuit.py
806
3.84375
4
# import randint from random import randint #andGate def andGate(a,b): if a == 1 and b == 1: return True else: return False #orGate def orGate(a,b): if a == 1 or b == 1: return True else: return False #norGate def norGate(a,b): c = b if a == 1 or c == ...
e8695a656bd98990297b8b55dfaba690e52c7f41
frewsxcv/lets-encrypt-preview
/attic/server-ca/redis_lock.py
3,501
3.796875
4
#!/usr/bin/env python # This is an attempt at implementing the locking algorithm described at # http://redis.io/commands/setnx # as a Python lock object that can be used with the Python "with" # statement. To use: # # lock = redis_lock(redis_instance, "name") # with lock: # # do stuff guarded by t...
bc2e95f42ae02477343ec0dc945ec78bb0a19700
kevlab/RealPython2
/sql/sql_hw2_2.py
250
3.796875
4
import sqlite3 with sqlite3.connect('cars.db') as connection: c = connection.cursor() print "DATA:\n" c.execute("SELECT * FROM inventory WHERE make = 'Ford'") data = c.fetchall() for _ in data: print _[0], _[1], _[2]
ddc02dcf1c84fdd9b5bc4e824daaf4847c053876
sakew/Learning-from-Python-Crash-Course-Book
/city_functions.py
274
3.96875
4
"""Function that stores information about City""" def city_info(city_name, country_name, population = 0): output = city_name.title() + ', ' + country_name.title() if population: output = output + ' - population ' + str(population) return(output)
b4121ce642add0f4c748fa37f21fbb5e74c87ecd
slavaprotogor/python_base
/homeworks/lesson1/task3.py
373
4.09375
4
""" Узнайте у пользователя число n. Найдите сумму чисел n + nn + nnn. Например, пользователь ввёл число 3. Считаем 3 + 33 + 333 = 369. """ number = input('Введите число: ') number_sum = int(number) + int(number * 2) + int(number * 3) print('Сумма чисел = ', number_sum)
095298af3012e5a55d0372c76d92f2cf30a163e2
makahoshi/CSC-546-HTTP
/PROXY/proxy.py
6,340
3.703125
4
#first import some libraries import socket import sys import argparse import path import os import urllib import urllib2 import mimetypes #first get arguments from the user print '\nNumber of arguments:', len(sys.argv), 'arguments.' print 'Argument List:', str(sys.argv), '\n' def socket_function(args): HOST = '' ...
496961710ca3b9d804ed14fff4054b9c57a3497e
SpeCialmark/mini
/store-server/store/utils/helper.py
262
3.59375
4
def move(a, i, j): if i == j: return a b = [] for index, x in enumerate(a): if len(b) == j: b.append(a[i]) if index != i: b.append(x) if len(b) == j: b.append(a[i]) return b
94e29fbd748f1ab2053c73d207ec25aeaa772f19
Thommo27/BinomialExpansion
/Factorial.py
188
3.75
4
def fact(num): if (num == 0): value = 1 else: i = 1 value = 1 while (i <= num): value *= i i += 1 return(value)
2c0ec6a6a08de6bea218f93f056d65c7d534c7e0
Shivani161992/Leetcode_Practise
/BinaryTree/InorderSuccessorinBST.py
1,121
3.859375
4
class TreeNode: def __init__(self, x): self.val=x self.left=None self.right=None root=TreeNode(2) p=root class Solution: def inorderSuccessor(self, root: 'TreeNode', p: 'TreeNode') -> 'TreeNode': if root is None: return None else: found = False ...
36234bc944fb11a699034b5d0c42f864a7f36f83
fnwiya/atCoder
/abc/abc014/a.py
137
3.640625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- a = int(input()) b = int(input()) if a % b == 0: print(0) else: print(b - (a % b))
9c5f76e202e4facff2d0dd6c3b8d0073bfc003cf
anjaligopi/leetcode
/daily_coding_challenge/october_2020/valid_square_593.py
1,406
3.875
4
""" Question: Given the coordinates of four points in 2D space, return whether the four points could construct a square. The coordinate (x,y) of a point is represented by an integer array with two integers. Example: Input: p1 = [0,0], p2 = [1,1], p3 = [1,0], p4 = [0,1] Output: True """ from typing import List im...
3a20254abcd84124edb2c9eba05b39acaf91e2c0
PRAWINM/beginner
/set10 92.py
82
3.5
4
N=int(input("")) n=[] for i in range(0,N): n.append(int(input())) print(sum(n))
b8a4b1384cad9ce860113f3543f16822b088da0b
ahalaru/udacity_ml_enron_final
/final_project/trainer.py
3,314
3.515625
4
#!/usr/bin/python from sklearn.model_selection import StratifiedShuffleSplit """ Perform training with a given classifer, label and features We use the Stratified Shuffle Split to perform the training over n-folds of training, test and cross-validation We also calculate the effectiveness of our classfier. The followi...
70237f04cf8954cddacc7c048e8a31127432d717
clhking/lpthw
/ex6.py
1,244
4.40625
4
#!/usb/bin/python # Set a variable named x that contains a sentence with an integer variable in it. x = "There are %d types of people." % 10 # Set a variable named binary that is a string: "binary" binary = "binary" # Set a variable named do_not that is a string "don't" do_not = "don't" # Set a variable y that is a...
b64bfaf09a79551ff50403c3d406eda93dc897ad
igor-baiborodine/coding-challenges
/hackerrank/python/built-ins_ginorts-solution.py
393
4
4
string = list(input().strip()) lower = [s for s in string if s.islower()] upper = [s for s in string if s.isupper()] odd_digits = [int(s) for s in string if s.isnumeric() and int(s) % 2 == 1] even_digits = [int(s) for s in string if s.isnumeric() and int(s) % 2 == 0] print(''.join(sorted(lower) + sorted(upper) + [str(d...
40602ba37fc203d75700a5bfa615490112227208
sanjkm/ProjectEuler
/p103/optimum_subset_sums.py
8,544
3.53125
4
# optimal_subset_sums.py # Set Conditions: # 1) Any two distinct subsets have different sums across all of their elements # 2) If set A is larger than set B, then S(A) > S(B), S = sum across elts # We are given a set of size 7 satisfying (1) and (2) with sum equal to 255 # Problem is to find satisfying 7 element sets...
ffec48e954c4481350d9e606316c99d99194e7ac
FelipeMQ/CS1100
/week6/2encriptar.py
630
3.53125
4
frase = input() alfabeto = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','Y','X','Z'] cripto = ['#','$','%','&','/','(',')','=','?','.',',','!','°','|','¬','\\','^','~','*','+','-','_','<','>',':',';'] salida = [] for c in frase: if c == " ": salida.append(" ...
4fc183e46028afaaa379f9e8a0fff4dd844a09e5
novayo/LeetCode
/0222_Count_Complete_Tree_Nodes/try_2.py
1,016
3.703125
4
# 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 class Solution: def countNodes(self, root: Optional[TreeNode]) -> int: ''' 先找最左邊 => 得知深度 在找右邊 => 第一個...
17dfea1505e068f0da857b6a41ee00b91cd58c04
14Praveen08/Python
/odd_in_number.py
256
3.671875
4
number = int(input()) list1=[] while number > 0: mod = number % 10 if mod%2 != 0: list1.append(mod) number = number // 10 list1.sort() for i in range(0,len(list1)): if i == (len(list1))-1: print(list1[i],end="") else: print(list1[i],end=" ")
a39d75982c1c47ba227caf3f19935b68370fd6f6
rmessina1010/python_fundamentals_ww4
/workshop4.py
3,904
4.03125
4
class User: def __init__(self, name, pin, password): self.name = name self.pin = pin self.password = password def change_name(self, new_name): #new_name = input("New name: ") self.name = new_name def change_pin(self, new_pin): #new_pin = input("New PIN: ") ...
cdad157a06b2de64bc6158cded769ed9a4e3e5d6
zhoufengzd/python
/_exercise/hackerrank/certified/basic/swap_word_and_case.py
238
4.125
4
def swap_word_and_case(input_str): words = input_str.split() words_rev = " ".join([w.swapcase() for w in reversed(words)]) print(words_rev) if __name__ == "__main__": input_str = input() swap_word_and_case(input_str)
319fbb93152a7b18f7467cf510f2aa2cc57cfddb
khyati16050/practice
/special.py
1,266
3.890625
4
# In a list of number, check if the list is special ( always increasing and has 2 primes or always decreasing and has 1 prime) def increasing(a): if len(a) < 2: return True else: for i in range(1, len(a)): if a[i] < a[i - 1]: return False return True def decrea...
cb7260a8dce6f61dac0ea6ec8bdd890d98acfaf9
ashishjsharda/PythonSamples
/iteratorsexample.py
129
3.828125
4
''' Using Iterators in Python @author: asharda ''' fruits=["apple","banana","grape"] for fruit in fruits: print(fruit)
7802e87ce6cd55ee3395d91253baa33258431398
HimavarshiniKeshoju/AI-Track-ML
/17K41A05F8-ANN-P10-3.py
5,559
3.578125
4
import pandas as pd import numpy as np data=pd.read_csv("D:\LoadDatainkW.csv") data.head() data.shape #x=data[0:-1, 2] #y=data[1:,2] x = data.iloc[0:-1, 2] y = data.iloc[1:, 2] normalized_datax=(x-x.mean())/x.std() normalized_datax normalized_datay=(y-y.mean())/y.std() normalized_datay from sklea...
0c2d41d6dc48e596102ec0fe376a3fd4a9407063
naveenbe66/guvi
/pro33.py
148
3.515625
4
a2=input() c=0 for i in range(1,len(a2)): if a2[i]>a2[0]: r=a[i:] c=c+1 break if c>0: print(r) else: print(a2)
0230f4e1db2d305533a2dacdbb47d2b0eba32564
karthik0037/lab2-test-01-09-20
/count the number of nodes.py
1,215
4.3125
4
# Python3 program to remove first node of # linked list. import sys # Link list node class Node: def _init_(self, data): self.data = data self.next = None # Function to remove the first node # of the linked list def removeFirstNode(head): if n...
1343488219e8ca08e6512d53b4bfd8c1c8ac5f04
IwoStaykov/Hania-kolos
/League.py
865
3.5625
4
req_list = input().split() #wprowadzenie N, M i T req_list = [int(req_list[i]) for i in range(3)] #req_dict = {'N': req_list[0], 'M': req_list[1], 'T': req_list[2]} teams = {} for i in range(req_list[0]): name = input() # teams[name] = [0,0] # pierwszy element listy to liczba wygranych , drugi element...
16188a91fda6981b7491ad5e35d397876db5b892
sthakare11/English_python
/English.py
562
3.6875
4
#! /usr/bin/python3 print ("Welcome!\n Ready to Learn English ??\n ##################################################") a=input("what Do you want to revise?\n 1.Tenses\n 2.Articles\n Please enter your choice\n") a=int(a) #def case(a): # switcher = { # 1:'This works', # 2:'This also', # ...
977dc9b06df79af833bf14c9ee147a90424a165a
vinceparis95/garage
/machineLearning/instruments/classifiers/data_classifiers/binary_classifier_b.py
1,821
3.859375
4
import numpy as np import pandas as pd import tensorflow as tf import keras from tensorflow import feature_column from tensorflow.python.keras import layers from sklearn.model_selection import train_test_split csv = "/home/vince/Desktop/youthy.csv" df = pd.read_csv(csv) print(df.head()) train, test = train_test_split...
9536afe317b11ca9fe262fe3b06f5ffdd1a2b391
poorvijajodiya/Tkinter
/Radio_Button.py
784
3.765625
4
from tkinter import * root = Tk() #r=IntVar() #r.set("2") Modes = [("Pepperoni","Pepperoni"),("Onion","Onion"),("Cheese","Cheese"),("mashroom","mashroom")] pizza = StringVar() pizza.set("Pepperoni") for text,mode in Modes: Radiobutton(root,text=text,variable=pizza, value=mode).pack(anchor=W) def clicked(va...
7f16b608fc86c5910f86a0d422c7434b780bf332
ArdelAlegre1/SoundMapping
/Analysis/Util/Tools.py
2,096
3.75
4
import datetime import time """ computes unix time from time string @param string start - start time in string @param string end - end time in string @return float unixtime_start @return float unixtime_end """ def strTime_to_unixTime(start, end): try: FORMAT_TIMESTRING = '%b %d %Y %I:%M%p' dt_sta...
5d92a1ca5b6a6171bb92dd22cc159063c6ed289c
DrRenuwa/MIT-Course
/Lessons/Unit 2 Iterative Exponent.py
591
3.796875
4
def iterPower(base, exp): ans = base while exp > 1: if base < 0 and exp%2 == 0: ans *= base exp -= 1 base = -base else: ans *= base exp -= 1 if exp == 0: ans = 1 return ans print(iterPow...
05fee2f8277c43f0d435880424da04469ed7dce9
Sxlly/Hangman-PyGame
/main.py
3,630
3.71875
4
import pygame import random import os import numpy as np import math # Setting display variables pygame.init() pygame.font.init() WIDTH, HEIGHT = 800, 500 win = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("HANGMAN!") # defining button variables RADIUS = 20 GAP = 15 letters = [] start_x = r...
1ae01a247c8c04fcf1461f10962ab533c804f7fa
roachj33/CSE-163-Final-Project---Movie-Analysis
/Project_functions.py
13,760
3.65625
4
""" Name: Joey Roach Date: June 10th 2020 Implements the functions required for project analysis, including cleaning the data, calculating profits, analyzing profit trends over a variety of differing circumstances and performing machine learning algorithms to predict a film's IMDB score based on other factors. """ im...
e86825bdea2e1d2f60f7c8e4671d6e904240b805
Msubasi1/Hurap
/src/Mission00.py
2,264
3.734375
4
def encrypted(file, hex_result, encrypt_result): for line in hex_result: split_two = [] for index in range(0, len(line), 2): split_two.append(line[index: index + 2]) # print(split_two) line_result = "" # print("line_result = " + line_result) for ke...
85660ce6bf794d7ba0ed87b63ff9a2f934f30c90
pr4nshul/CFC-Python-DSA-March
/Alinpreet-Assign-1/A1-Q7-h.py
414
3.703125
4
n = 5 row=1 row_mirror = 1 while(row_mirror<=2*n-1): col=1 col_mirror = 1 while(col_mirror<=2*n-1): if(col<=(n-row)+1): print(' *',end="") else: print(' ',end="") if(col_mirror < n): col+=1 else: col-=1 col_mirror+=1...
cc069bb61b6a434fef33828184cd3878533ce2d2
dunderzutt/diablo3test
/diablo3.py
1,048
3.875
4
print(" Only enter numbers no prefix after as m,b or tr") print(" as sfp is included in gph you will need to check urself how many keys used per hour for exact") side1 = float(input(' T13 GPH: ')) side2 = float(input(' xp/hr getting keys in billions ex 55: ')) side3 = float(input(' input xp/hr with stacked in billi...
d1c6dd7b2d80edb1db31b1ae2ed6619e5a39e30a
pnoga190401/projekt
/python_inf/tabliczka.py
345
3.71875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # # tabliczka.py # def tabliczka(): for k in range(1, 11): for w in range(1, 11): print("{:>3} ".format(k * w), end='') print() def main(args): tabliczka() return 0 if __name__ == '__main__': import sys ...
3bbf935b509ec8609be3108aad3cb202a54d4a4b
robbyvan/-
/バックトラッキング/10_Regular Expression Matching.py
720
3.515625
4
# 10_Regular Expression Matching # 1) dp, 参见字符串10 # 2) 回溯. # class Solution: # def isMatch(self, s, p): # m, n = len(s), len(p) # dp = [[False] * (n + 2) for _ in range(m + 1)] # dp[0][0] = True # dp[0][1] = True # for j in range(n): # if p[j] == "*": # dp[0][j + 2] = dp[0][j] #...
22a68384b6e6281b9b1ef94511b9b0abc4b9acdd
geooff/ProjectEulerSolutions
/PE_Q36.py
1,448
3.765625
4
""" The decimal number, 585 = 1001001001(2) (binary), is palindromic in both bases. Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2. (Please note that the palindromic number, in either base, may not include leading zeros.) Thoughts: - Due to the increased number of cha...
7cd785dd12712783da86821cc0d5abc420a38469
mailtoatanu/Python-Learning-Projects
/01. Dice Rolling Simulator.py
1,364
4.375
4
#This is Dice Rolling Simulator #Asks user minimum and maximum value of the dice #Throws up a random number within the minimum and the maximum number import random gameon = 'yes' #The game repeat controller print("Hello There! Welcome to an all new Dice Rolling Simulator!\n") #Welcome statement. Does not...
4f6bc3069e7fbfed1fc5d6dfc6decaf52d8c4474
kluke6175/FinalProject.py
/2_2/Shapes.py
1,551
4.09375
4
import math class Shape: def __init__(self, x, y): self.x = x self.y = y def __repr__(self): return'<'+'Shape x='+str(self.x)+' y='+str(self.y)+'>' def area(self): print(self.x * self.y) class Circle(Shape): def __init__(self, x, y, radius): super().__init__...