blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
ef6204e0e14ba757cb5169207fb78f3190fe9539 | Loukis-13/FCC_analise_de_dados | /sea-level-predictor/sea_level_predictor.py | 939 | 3.828125 | 4 | import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import linregress
def draw_plot():
# Read data from file
df = pd.read_csv('epa-sea-level.csv')
# Create scatter plot
fig = df.plot.scatter(x='Year', y="CSIRO Adjusted Sea Level")
# Create first line of best fit
best1 = linre... |
308df93fd40ee6cf237af6b03d344e2316bb13bf | gchh/python | /code/8-1.py | 959 | 3.78125 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
class Student(object):
#__slots__ = ('name', 'age', 'set_age', 'score') #--@
__slots__ = ('name', 'age', 'set_age', 'set_score') #--$ 用tuple定义允许绑定的属性名称
s=Student()
s.name='Michael'
print(s.name)
def set_age(self,age):
self.age=age
from types import MethodTy... |
c8d5e7c57d17112fcc3c66882a73a46453999fae | frenchie16/lxscript | /model/system.py | 547 | 3.515625 | 4 | class OutputSystem:
"""A system which sends its level out on an output address"""
def __init__(self, address, output):
self._address = address
self._output = output
def set_level(self, level):
self._output.set_level(self._address, level)
class CompoundSystem:
"""A system made... |
696857ecef041d10aaa43fb883a2bbce736ef330 | pawarspeaks/python4beginners-Hacktoberfest21 | /Python Codes/Advance Python/how_python_calculates_squareroot.py | 973 | 4.09375 | 4 | """
Ever wondered how python is able to calculate squareroot of a non-perfect square number?
This code shows how is python able to calculate it !
Code contributed by: Hriday Agrawal
Github Name: HridayAg0102
#======SAMPLE OUTPUT:=========#
Number: 300143838031, its root: 547853.8473270038
Start approximation
65007... |
60ce0064bdd1bc16862421aeda08e76e6ef08390 | raymondmar61/pythonnumpy | /completepythonnumpytutorial.py | 6,774 | 4.40625 | 4 | #Complete Python NumPy Tutorial (Creating Arrays, Indexing, Math, Statistics, Reshaping) [720p]
#keithgalli
#NumPy is a multi-dimensional array library. One dimensional array shape(4,) four across or four columns. Two dimensional array shape(2,3) two down, three across or two rows, three columns. Three dimensional a... |
e181634de8d15820de1d2c5eafd36871ffa8cdd9 | ravindra-ut/data-structures-algorithms-coding-competition | /Number Theory/game_of_numbers.py | 963 | 3.828125 | 4 | '''
Alice and Bob are playing a game with the following rules:
Alice always plays first and they take alternating turns.
During each turn, a player can choose any number (regardless of whether or not it was chosen during a previous turn)
in the inclusive range between l and r.
The game ends when the running sum of ch... |
821772c69d9295bc9b3ae4dc0324cf8f6b6ef629 | rodrigoBergamin/DATA_SCIENCE | /chapter_two/conceitos.py | 432 | 3.734375 | 4 | def double(x):
#função que retorna o dobro de um valor
return x * 2
def apply_to_one(f):
#passando a função f como parâmetro para apply_to_one, que carrega dentro de si o parametro 1
return f(1)
my_double = double #instanciando a função double na variável my_double
x = apply_to_one(my_double) #passand... |
719bda616e1d415a242a5147af45fc22401fea53 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2785/61041/266169.py | 275 | 3.75 | 4 | n = eval(input())
ai = []
def trying(x,n,ai,degree):
if x==n:
return degree%360==0
return trying(x+1,n,ai,degree+ai[x])|trying(x+1,n,ai,degree-ai[x])
for i in range(0,n):
ai.append(eval(input()))
if trying(0,n,ai,0):
print('YES')
else:
print('NO') |
70dbf0ff8161bd9949f7aec4ba614dda45845016 | payola469/CP3-Paolo-CuriosoNaiaretti | /Lecture53_Paolo_C.py | 167 | 3.5625 | 4 | def vatcal(total):
result = total+(total*7/100)
return result
InputTotla = int(input("ใส่ราคาสินค้า : "))
print(vatcal(InputTotla)) |
b598ee9a6961e1353930794bd5f09f64faa71646 | syurskyi/Python_Topics | /125_algorithms/_exercises/templates/_algorithms_challenges/leetcode/LeetCode_with_solution/496 Next Greater Element I.py | 2,017 | 4.125 | 4 | #!/usr/bin/python3
"""
You are given two arrays (without duplicates) nums1 and nums2 where nums1’s
enclements are subset of nums2. Find all the next greater numbers for nums1's
elements in the corresponding places of nums2.
The Next Greater Number of a number x in nums1 is the first greater number to
its right in nums... |
8ab5d8b2677e1d60eac33a5c41e171897eee1323 | timg1234/beta | /slider.py | 496 | 3.765625 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import tkinter as tk
window = tk.Tk()
window.title('My Window')
window.geometry('500x300')
l = tk.Label(window, bg='white', fg='black', width=20, text='empty')
l.pack()
def print_selection(v):
l.config(text='you have selected ' + v)
s = tk.Scale... |
65c916f60898751a0470854374140cd6e3c55148 | jaketdk/ics215 | /python/factorial.py | 259 | 4.375 | 4 | def factorial(num):
temp = num - 1
retVal = num
while temp > 0:
retVal = retVal * temp
temp = temp - 1
return retVal
number = input('What number would you like to find the factorial of? ')
answer = factorial(number)
print "The factorial is", answer
|
dad17ef4d11c3cb8a4aac1d54a17d92c179d65a5 | wengkhong/TestAtom | /HelloWorld.py | 140 | 4.03125 | 4 | print("HelloWorld!")
for i in range(0,10):
print("Bla ", i)
print("Bla2 ", i)
print("Bla3 ", i)
print("This is a new line!!!!")
|
ea1030423c5899ebf2bc0c18e6bc54e16173d297 | legendtkl/pypractise | /yield1.py | 124 | 3.546875 | 4 | def take(seq, n):
for i in xrange(n):
yield seq.next()
L = (1,2,3,4,5,6,7,8)
while True:
x = list(take(L, 2))
print x
|
a4a1c6affaad885ffeea25e51c740c67a210afd0 | thomaslworley/python | /Customer.py | 1,341 | 3.9375 | 4 | Apples = ["Customer1", "Customer3"]
Grapes = ["Customer2","Customer5","Customer6"]
Watermelons = ["Cusomer4","Customer7"]
A = len(Apples)
G = len(Grapes)
W = len(Watermelons)
Customer1 = "15 Apples"
Customer2 = "20 Grapes"
Customer3 = "25 Apples"
Customer4 = "5 Watermelons"
Customer5 = "10 Grapes"
Customer6 = "40 Grape... |
ef62beceb974ff48e60ccaf8dbd2ba24d22830f1 | obDann/TEQApp | /src/graphs/histogram.py | 1,159 | 3.921875 | 4 | import numpy as np
import matplotlib.pyplot as plt
from graph import Graph
width = 0.8
class Histogram(Graph):
'''
A simple histogram to be outputted to the user
'''
def __init__(self, df, x, y, title=None):
''' (ReportAbstract, DataFrame, str, str, str) -> None
Given a DataFrame, a ... |
d92243c8be47226f64bb63572c9776367e144cd4 | AlliedLens/TkinterTutorials | /Tkinter/TkinterInputFields.py | 750 | 4.3125 | 4 | from tkinter import *
root = Tk()
# To create an entry widget, that would allow the user to input values, same parameters apply on this widget as on
# Button part, except it is now width, we can also change the border width, using the borderwidth param
e = Entry(root, fg="red", bg="yellow", width=50, borderwi... |
ca63dccc46056b931f14428b133c4470b58476e1 | tielushko/The-Modern-Python-3-Bootcamp | /Section 27 - Iterators and Generators/mem_test.py | 398 | 3.71875 | 4 | def fib_list(max):
final = []
a = 0
b = 1
while len(final) < max:
final.append(b)
a, b = b, a+b
return final
def fib_gen(max):
a, b = 0, 1
count = 0
while count < max:
yield a
a, b = b, a+b
count+=1
print(fib_list(10))
fib = fib_gen(10)
print(... |
d7644ba13eff64695d0c2717461301d043b5a169 | AnabelSalomone/python_coffee_machine | /main.py | 1,150 | 4.09375 | 4 | class Drink:
def __init__(self, code, name, price):
self.code = code
self.name = name
self.price = price
def get_price(acc, drink):
total_price = acc + drink.price
return total_price
drinks = []
drinks.append(Drink(1, "Capuccino", 2.50))
drinks.append(Drink(2, "Coffee with milk", 2... |
35250d9400134689de32a7c112fb166f8a4b5875 | pablovfds/alg_adv15.1 | /math/QuantosFibs.py | 538 | 3.859375 | 4 | # -*- coding: utf-8 -*-
# Universidade Federal de Campina Grande
# Aluno: Diego Adolfo Silva de Araújo
# Matricula: 113210090
# Disciplina: Algoritmos Avançados
# Problema: Quantos Fibs
# Nivel: 3
def fibonacci():
a, b = 1, 2
while 1:
yield a
a, b = b, a+b
while 1:
a, b = map... |
47f5f722d2cc49d0f93a45cb5ae81dc6ca640e05 | respectus/Euler-Problems | /problem41.py | 645 | 3.671875 | 4 | """
Pandigital Prime
Project Euler Problem #41
by Muaz Siddiqui
We shall say that an n-digit number is pandigital if it makes use of all the digits
1 to n exactly once. For example, 2143 is a 4-digit pandigital and is also prime.
What is the largest n-digit pandigital prime that exists?
"""
from euler_helpers import ... |
e221c7d8c573337e062df2537c6a655ecaf2c149 | Mshohid/Python-Misc | /Lockdown_dreaming.py | 475 | 3.890625 | 4 | responses = {}
poll = True
while poll:
name = input("Please enter your name ")
question = input("If you could travel anywhere, where would you want to go? ")
responses[name] = question
repeat = input("Would anyone else want to have a go? 'yes/no' ")
if repeat == "no":
poll =... |
66858b7c64747faf405074ccedc4b74c9f9fb4be | qingfengxia/python-projecteuler | /projecteuler/ProjectEuler31_coinsCombination.py | 2,429 | 3.671875 | 4 | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, absolute_import, division
def money_changes():
""" s: sum must be the multiple of token[i]
this method is very slow >1 hour, a curseive method may be prefered
"""
# method 1, slow >0.1 hr
# got incorrect resul... |
7ec4dfdf5fe9d88455b4b4eecd1c3a4aa2f93eff | swiddiws/pyBible | /students.py | 638 | 3.703125 | 4 | students = {
"Alice":["ID0001",26,"A"],
"Bob":["ID0002",27,"B"],
"Chris":["ID0003",19,"C"],
"David":["ID0004",23,"A"],
"Elle":["ID0005",25,"B"]
}
print(students["Chris"][0])
print(students["David"][1:])
students2 = {
"Alice":{"id":"ID0001","age":26,"grade":"A"}... |
57312187666b41b25ff7ca1cdcdbbada6194a93f | psatala/AntColonyOptimization | /bfs.py | 901 | 3.5 | 4 | from constants import INFINITY
def bfs(nodes, startNodeName):
#set up distance and visited dicts
distance = {}
visited = {}
for key in nodes:
distance[key] = INFINITY
visited[key] = False
#add starting node
nodesQueue = [startNodeName]
distance[startNodeName] = 0
visite... |
e36339c8d96b40d35aae84c541c308979e815192 | GitauHarrison/automate-the-boring-stuff | /validatInput.py | 794 | 4.125 | 4 | #the isX string methods
while True:
print('Enter your age: ')
age = input()
if age.isdecimal():
break
print('Please enter a number for your age.')
while True:
print('Select a new password (letters and numbers only): ')
password = input()
if password.isalnum():
break
pri... |
b6ab5623bed008ea63963a5ff2dfc163e3dda21c | sininni/skyscrapers | /skyscrapers.py | 6,147 | 4.125 | 4 | """
This module solves skyscrapers puzzle, checks if
given game board is right and all rules are abided.
"""
from typing import List
def read_input(path: str) -> List[str]:
"""
Reads game board file from path.
Returns list of str.
"""
with open(path) as file:
field = file.readlines()
... |
2ca34ab1f6ecf607cd79c2ba6aea6b375126e41c | shrilakshmishastry/VtuquestionPaperSolution | /sample_continue.py | 177 | 3.578125 | 4 | n = int(input("enter the limit of natural numbers"))
sum =0
for i in range(0,n):
if(i%2!=0):
continue
if(i == 100) :
break
sum= sum+i
print(sum)
|
3b05334d87578f06dbdae53128873bf77f512ef4 | ccbrantley/Python_3.30 | /Decision Structures and Boolean Logic/Brantley_U3_14.py | 645 | 4.21875 | 4 | weight = 0
height = 0
print('This progam will calculatey your BMI(Body Mass Index).')
weight = int(input('Please enter in your weight using a measurement of pounds.'))
height = int(input('Please enter in your height using a measurement of inches.'))
BMI = weight * 703/height**2
if 18.5 <= BMI <= 25:
print('Y... |
5e0a9dfd7e3864b0c03f9e817e697f5bbc6629a5 | jaqque/project-euler | /3/3.py | 291 | 3.71875 | 4 | #!/usr/bin/env python
from math import sqrt
target = 123
target = 600851475143
primes=[target]
n=2
while n<sqrt(primes[-1]):
i=primes[-1]
if i % n == 0:
primes.insert(-1,n)
primes.append(primes.pop()/n)
else:
n+=1
print(primes[-1])
print(primes)
|
eb2bfb62d30832f75b0f4ee738a134cd9ac4a0e7 | gahyunlee/DataCamp_pjt | /DataCamp_pjt2.py | 538 | 3.796875 | 4 | ### Now, I am creating a function
### that can do the same thing as the former python statemente can do.
master_df = pd.read_csv('master.csv')
def count_entries(df, col_name):
'''Return a dictionary with counts of
occurrences as value for each key.'''
langs_count = {}
col = df[col_name]
for entry ... |
95d2e6b39a552e73169d86d2e9b70e2e95277df3 | Andy0209/Test | /Abgabe 5.py | 1,663 | 3.640625 | 4 | # Ändern bzw. erweitern Sie das Wörterbuch-Beispiel aus der LÜ vom 03.05.2021 so,
# dass Sie wahlweise englische oder deutsche Begriffe eingeben können und das Programm selbtständig
# das jeweils korrespondierende Vokabel findet und, versehen mit einem Hinweis auf die Sprache, ausgibt.
woerterbuch_deutsch = {"Apfe... |
1bb702ceb8e4a2265c3f1f11ef4f381efac7b9c2 | wooyeon1212/wooyeon1212 | /hanoi(수정).py | 586 | 3.515625 | 4 | #-*- coding: utf-8 -*-
count=0
#count를 변수로 지정해서 시행 횟수를 나타내고자 하였으나 따로 구할수가 없네요...어떻게 짜야할지를 모르겠습니다.
def T(N, Beg, Aux, End):
count+=1
if N == 1:
print(Beg, '->', End)
else:
T(N-1, Beg, End, Aux)
T(1, Beg, Aux, End)
T(N-1, Aux, Beg, End)
#N=원판의수, BEG,AUX,END 기둥
#재귀 알고리즘을 활용
... |
5480a629b25438b06615cad6e4fa0bca620b7315 | noppakorn-11417/psit-2019 | /problem/Triangle_I.py | 329 | 3.578125 | 4 | """pair"""
def main(wood1, wood2, wood3):
"""triagle"""
if wood2 >= wood1:
wood1, wood2 = wood2, wood1
if wood3 >= wood1:
wood1, wood3 = wood3, wood1
print("Yes" if abs(((wood1**2)+(wood2**2)+(wood3**2)-wood1**2)-(wood1**2)) <= 0.01 else "No")
main(float(input()), float(input()), float(i... |
38497ae3648c139bac3130c6a9665945ac9a606b | Python87-com/PythonExercise | /day08_20191110/exercise010.py | 356 | 3.9375 | 4 | """
练习:记录一个函数 fun01的执行次数
画出内存图
"""
# 定义一个全局变量
count = 0
def fun01():
print("我被执行了。")
# 定义一个全局变量
global count
count += 1
# 调用函数
fun01()
fun01()
fun01()
fun01()
fun01()
fun01()
fun01()
fun01()
fun01()
print(count)
|
a2ff3db2993a22bce6ea948fc2e9047da42940af | akuchlous/leetcode | /binSearch.py | 587 | 3.8125 | 4 | import pdb
class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
l , r = 0, len(nums)-1
while (l<=r):
mid = (l+r)//2
print (l, r, mid)
if (nums[mid] == target):
... |
9b75858af5d4ea6cb8e026e0b8a87b5977163c55 | aabelkin/infa_2021_aabelkin | /lab6.py | 3,470 | 3.796875 | 4 | import pygame
from pygame.draw import *
from random import randint, random
import math
pygame.init()
FONT = pygame.font.Font(None, 50)
screen_width = 1200
screen_height = 800
FPS = 30
screen = pygame.display.set_mode((screen_width, screen_height))
RED = (255, 0, 0)
BLUE = (0, 0, 255)
YELLOW = (255, 255, 0)
GREEN = (0... |
ecf2a38bd687a501ffe1057bd77b55ee7bfc85ab | sidrockzz/Coding | /Python/AMPM.py | 263 | 3.78125 | 4 | #!/usr/bin/python3
string = input()
time = string.split(":")
if string[-2:] == "PM":
if time[0] != "12":
time[0] = str(int(time[0])+12)
else:
if time[0] == "12":
time[0] = "00"
ntime = ':'.join(time)
print(str(ntime[:-2])) |
5845ebf0b6bd0a99ec55b107484003db72876080 | siliconjesus/I-hate-python | /Learning Python/searching.py | 505 | 3.84375 | 4 | shopping_list = ["milk","pasta","eggs","spam","bread","rice"]
item_to_find = "albatross"
# item_to_find = "spam"
found_at = None
# I guess None ~= null from C/C++
# for index in range(len(shopping_list)):
# if shopping_list[index] == item_to_find:
# found_at = index
# break
if item_to_find in shop... |
d2087680d141bfe0a3638aa1dbd4ab558ef671f3 | Rhoyo/gitActivity | /calc.py | 87 | 3.765625 | 4 | def calcu(a, b):
sum= a+b
print(sum)
difference = a-b
multiply = a*b
divide = a/b
|
8a5b247bd972a42eaff3af2a5dd39fb307d42baf | ngohgia/transliteration | /phonology-augmented_transliterator/syl_splitter/approx_phone_alignment/shared_res/Word.py | 544 | 3.5 | 4 | from Syllable import Syllable
class Word:
def __init__(self):
self.syls = []
def add_new_syl(self, new_syl):
self.syls.append(new_syl)
def print_str(self):
print "Graphemes: " + " . ".join([syl.get_en_graphemes_str() for syl in self.syls])
print "Roles: " + " . ".join([syl.get_roles_str() for s... |
18332d786d44ba8350c70ec9bdb7259594c05068 | lindaspellman/CSE111 | /W11 Functional Programming/significant_python_program.py/test_my_program2.py | 2,070 | 3.640625 | 4 | # Significant Program Final Project Spring 2021
# Linda Spellman
"""IMPORTANT: THIS FILE TESTS THE FUNCTIONS IN my_program2.py, WHICH ARE DERIVED FROM my_program.py"""
import pytest
import collections
from my_program2 import main, print_counted_words, print_certain_words, list_keys
# tests the main function
def tes... |
643c1d19d05cba053895717d7d65c70b2ae5825d | ary5/primes-generator | /primes.py | 470 | 3.828125 | 4 | import time
primes = [2]
n = int(input("Enter the upper range for which to find primes for"))
tic = time.perf_counter()
counter=0
for x in range(3, n+1):
for y in range(0, len(primes)-1):
if(x%primes[y]==0):
counter=counter+1
if counter==0:
primes.append(x)
#print(x, end = " ... |
8012496046d204dc84947c5bd1e0423bee4790c9 | guangyw/leetcode_python | /shortestPathAllKeys.py | 1,511 | 3.65625 | 4 | import collections
class Solution:
def shortestPathAllKeys(self, grid):
"""
:type grid: List[str]
:rtype: int
"""
directions = [[0, 1], [1, 0], [0, -1], [-1, 0]]
numOfKeys = 0
for i in range(len(grid)):
for j in range(len(grid[0]... |
9ed7fabff99d24f017638fa9f606da7d583f0bbd | incous/ProjectEuler | /005.py | 187 | 3.875 | 4 | def gcd(x, y):
if 0 == y:
return x
else:
return gcd(y, x % y)
def lcm(x, y):
return x * y / gcd(x, y)
tmpLcm = 2
for ci in range(3,21):
tmpLcm = lcm(tmpLcm, ci)
print tmpLcm
|
795c8b03d10907f6291225d9793a8d388044d481 | wudong/gracepythonlessons | /if-then-else.py | 268 | 4.09375 | 4 | name = input("what's your name?")
print("hello,",name)
age = int(input("how old are you?"))
if age > 80:
print("you really are old!")
elif age > 40:
print("you still have quite some time to become grandparents.")
else:
print("you are really young") |
49a0a923b7e0d9f188b26cd3363339f598951ba6 | FisicaComputacionalOtono2018/20180829-tareapythoniintial-Danieliml | /Mayorde4.py | 360 | 3.578125 | 4 | #Daniel Lima Lopez
#30/08/2017
#Leer cuatro números y al final escribir el mayor de los cuatro.
import numpy as np
v = np.arange(4)
for i in range(0,4):
v[i] = float(input("Ingrese un numero:"))
print (v)
for i in range(0,4):
aux = 0
for j in range (0,4):
if v[j] > v[i]:
aux = 1
if aux == 0:... |
724a492dfaa9702e16525c3b84752e28526914fc | JyHu/PYStudy | /source/sublime/threads/td04-1.py | 636 | 3.5625 | 4 | #coding:utf-8
import threading
import time
class staticNum():
def __init__(self):
super(staticNum, self).__init__()
knum = 10
class myThread(threading.Thread):
def __init__(self, name):
threading.Thread.__init__(self)
self.name = name
def run(self):
while staticNum.knum > 1:
threadLock.acquire()
s... |
3c6ecc6be005d3bf7fc1f915a2092e26951c191f | bj730612/Bigdata | /01_Jump_to_Python/Chapter03/ParkFeeVer5.py | 3,426 | 3.6875 | 4 | #coding: cp949
rate_fee=' %s̸ %d Դϴ.'
free_ticket=3
discount_ticket=5
count=0
while True:
age=int(input('̸ Էϼ. : '))
if age >= 0 and age <= 3:
rate=''
fee=0
print(' %s Դϴ.'%rate)
continue
elif age >= 4 and age <= 13:
rate=''
fee=2000
print (rate_fee %(rate, fee))
elif age >= 14 and age <= 18:
... |
597670e9a70cb9600114d32cd48e28d1b869e7a7 | dmhashan/SheCoderessV1 | /fightclubmails.py | 1,130 | 3.75 | 4 | import re
n = input()
for i in range (int(n)):
email = input()
emailarr = email.split('@')
formatflag = 0
domainflag = 0
domain = ["fightclub.uk","fightclub.com","fightclub.lk","fightclub.sa","fightclub.cc","fightclub.jp","fightclub.se","fightclub.xy","fightclub.gi","fightclub.r... |
a46314ee22ffe28ef44feeadf8b9a5b1c88b52d7 | digitros/Python-Projects | /while.py | 704 | 4 | 4 | # -*- coding: utf-8 -*-
import random
import factorial
def run():
try:
number_found = False
numeronio = int(input("Entre cuantos numeros quieres adivinar? "))
random_number = random.randint(0,numeronio)
while not number_found:
number = int(input("intenta un número "))
if number == random... |
a984fccbb109c59224a8d8822b0e165f55d35e52 | tianshan/leetcode_py | /2.py | 1,238 | 3.71875 | 4 | # Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# @return a ListNode
def addTwoNumbers(self, l1, l2):
r = 0
head = ListNode(0)
tmphead = head
while l1!=None or l2!=None or r!=0:
... |
e328b50030a57047e83da491475b3a082fcbf5c0 | masiro97/Python | /week/6주차_선형재귀와 반복/6-4.1.py | 161 | 3.671875 | 4 | def power(b,n):
if n>0:
if n%2 ==0:
return power(b**2,n//2)
else:
return b * power(b,n-1)
else:
return 1
|
0a2aa6087494c54d5a17b8e09f3d0740a3ab4faa | alvarogomezmu/dam | /SistemasGestion/Python/1ev/Hoja6/Ejercicio05.py | 403 | 3.921875 | 4 | #_*_coding:utf-8_*_
# Declaramos un string con un valor que sera la contrasena
secreta = "cacahuete"
# Pedimos al usuario que introduzca una contrasena
# Si es correcta, imprimimos que esta bien, sino no, damos 3 intentos
for i in range(3) :
clave = raw_input("Introduce una clave: ")
if clave == secreta :
print("... |
d34544483400ef23594ee1c970e76e5a989d8f93 | dgquintero/holbertonschool-low_level_programming | /0x1C-makefiles/5-island_perimeter.py | 164 | 3.625 | 4 | #!/usr/bin/python3
def island_perimeter(grid):
for i in grid:
for j in i:
if j == 1:
perimeter = j * j
return perimeter
|
5d6bbc8dd4e511037d8ba0517953b1fd193d7b8a | briantaylorjohnson/python-practice | /squares.py | 851 | 4.53125 | 5 | # Chapter 4
# Use range() and list() functions to produce the first 10 squares
squares = [] # Squares list
for value in range(1,11): # For loop for numbers 1 through 10
square = value ** 2 # Calculates the square of the value
squares.append(square) # Appends the squared value to the squares list
print(squares) #... |
55753deebc43033fb8024d30bc0041c5d421c9ba | mishranaman/Pass_generator | /pass.py | 1,515 | 3.671875 | 4 | #importing Library
from tkinter import *
import random, string
import pyperclip
#Initializing Window
root = Tk()
root.geometry("400x400")
root.resizable(0,0)
root.title("Passwords by Naman")
#Creating Tittles
Label(root, text = 'Generate New Password' , font ='Helvetica 15 bold').pack()
Label(root, te... |
e9b568b8b60d8ea0745581fcb9fcc12a35ef6f09 | SuchiKhare/calc_example | /calculator/main.py | 860 | 4.25 | 4 | """ This is the increment function """
class Calculator:
""" This is the Calculator class """
output = 0
def get_output(self):
""" Get Output of Calculation """
return self.output
def add_number(self, value_a):
""" adds number to output """
self.output = self.output ... |
28d26c73737d0b37b294adef8bd9a25698401a1a | zukowski2012/InfoShare-Python | /homeworks/day3/zadanie_1.py | 338 | 3.5625 | 4 | gra = "xon" \
"oxo" \
"xox"
# sprawdzamy czy wygrane po przekatnych
if (gra[0] == gra[4] == gra[8]) or (gra[2] == gra[4] == gra[6]):
if not gra[4] == "n":
print("Wygrał {}".format(gra[4]))
# sprawdzmy kazdy rzad
elif (gra[0] == gra[4] == gra[8]):
if gra[0] == "n":
print("Wygrał {}"... |
49c3bbf527dcdcb5bcd7ad4af5517b2d79bb1888 | momentum-cohort-2019-02/w2d2-palindrome-juanpola | /palindrome.py | 566 | 4.3125 | 4 | def is_it_palindrome(text):
text = remove_non_letters(text.lower())
for idx in range(len(text) // 2):
print(text, text[idx], text[-(idx) + 1])
return text == text[::-1]
def remove_non_letters(text):
all_letters = "abcdefghijklmnopqrstuvwxyz"
all_letters += all_letters.upper()
new_text = ""
... |
80ff813d3be2b7399a6c5f78f327bb5ead4bb175 | tpt5cu/python-tutorial | /language/python_369/python_369/class_/super_.py | 1,258 | 4.03125 | 4 | # https://www.python.org/dev/peps/pep-3135/ - official documentation of new super() syntax
'''The new super() syntax is syntactic sugar, but it is useful because I don't have to hard-code the name of the class anymore'''
class Sphere:
def __init__(self, diameter):
self._diameter = diameter
def get... |
e8f4cfe2725d2ab7b131776518848bc8bc4968ec | janvi-palan/code-prep | /code-prep/SymmetricTree.py | 629 | 3.59375 | 4 | # Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
class Solution {
public boolean isMirror(Tr... |
42530e0fc2b8bad88ccaa36d29986fdbb3ed0978 | GotoCode/cmdparse | /main.py | 6,563 | 3.515625 | 4 | #
# cmdparse
#
# this utlity extracts the command name, positional
# arguments, and optional arguments (short & long form)
# from a given string representing a command-line input
#
# the format of the command line interface (command name,
# required arguments, options, short/long aliases, etc.)
# must be specified in ... |
2fd0342e9038a5a67fc2ed79e704e9fa3ebe5c7d | ben-spiller/pysys-sample | /test/correctness/MyApp_cor_001/Input/test.py | 78 | 3.625 | 4 | print('Hello world')
x = 1235
if 123 == x:
print ('Nay')
else:
print ('Yey') |
aed4b7fe1ac0241f39d2615fca2872866a52a026 | MichelleZ/leetcode | /algorithms/python/countBinarySubstrings/countBinarySubstrings.py | 506 | 3.546875 | 4 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Source: https://leetcode.com/problems/count-binary-substrings/
# Author: Miao Zhang
# Date: 2021-03-02
class Solution:
def countBinarySubstrings(self, s: str) -> int:
res = 0
prev = 0
cur = 1
for i in range(1, len(s)):
... |
9ca71f576108963ea8314e7d0e1faa15d747448b | matejpiro/piskvorky | /piskvorky_2.py | 5,912 | 3.796875 | 4 | # !!! udělat, aby šlo zadávat jen čísla od 1 do 9
# !!! umět hlásit remízu
values = [1,2,3,4,5,6,7,8,9] # hodnoty na která se vkládají znaky
USER_INPUT_CHECK = [1,2,3,4,5,6,7,8,9] # list kvůli kontrole vkládání správných hodnot
user_input_crosses = [] # list ukládající hodnoty k... |
5275b8ef1f20a6933c7a6b25f724f1fed4c0e939 | jaggureddy/ZTM | /ZeroToMastery/Part1/conditional.py | 958 | 3.953125 | 4 | is_old = True
is_license = False
a = 5
if is_old:
print("You are old")
elif is_license:
print("YOur licence")
else:
print("You are not old")
if is_license:
print("Your licence")
if a < 5:
print('a<5')
elif a == 5:
print('a=5')
else:
print("a>5")
if is_old and is_license:
print('old e... |
0386bc8136075b209de3a6486570dee57f358e76 | gaohj/turtle- | /day03/08画图.py | 920 | 3.78125 | 4 | from PIL import Image,ImageDraw
import random
#创建画布
image1 = Image.new('RGB',(800,800),(255,255,255))
# image1.show()
#创建一个画画的人
draw = ImageDraw.Draw(image1)
#画颜色 point((坐标),(颜色))
# draw.point((100,100),(255,0,0))
# draw.point((100,101),(0,255,0))
#画一条线
# for x in range(100,601): 由点汇成线
# draw.point((100, x),... |
8b1b6df83a10e673536f70ac0e157b349269e975 | yanitsa-m/udemy-ML-AZ | /reinforcement_learning/upper_confidence_bound.py | 1,374 | 3.609375 | 4 | # Upper Confidence Bound (UCB) in Python
# Reinforcement learning algorithm
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import math
# Importing the dataset
dataset = pd.read_csv('Ads_CTR_Optimisation.csv')
# Implementing UCB algorithm for advertisements data
N = 10000
d = 10
ads_selected ... |
c578fdf691f7b2b70175e88ea3e4479aa50bee32 | vivekpapnai/Python-DSA-Questions | /Array/Longest Consecutive Sequence.py | 1,302 | 4.15625 | 4 | """Problem Statement You are given an unsorted array/list 'ARR' of 'N' integers. Your task is to return the length of
the longest consecutive sequence. The consecutive sequence is in the form ['NUM', 'NUM' + 1, 'NUM' + 2, ...,
'NUM' + L] where 'NUM' is the starting integer of the sequence and 'L' + 1 is the length of t... |
0b6ed2f6ae00aa03eeace4774f48680377858353 | tdavidi10/FastReadingAssistant | /FastReading/FastReadingGUI.py | 2,999 | 3.84375 | 4 |
from tkinter import *
import time
root = Tk()
root.title("Fast Reading Assistant") # title
root.iconbitmap('C:/Users/Tamir/Python Projects/FastReading/book.ico') #icon
screen_width = root.winfo_screenwidth() ### centering the window
screen_height = root.winfo_screenheight(... |
023482a945ecb603343f5dc7c70e6c540a459145 | ceto2016/python | /assignment/2/while/while_assignment_3.py | 154 | 3.875 | 4 |
sum = 0
x = 1
while x <= 10:
sum += int(input("enter number " + str(x) + " : "))
x += 1
print("sum = " + str(sum))
print("avg = " + str(sum/10))
|
5314e98a98203c815a8d2c6068612f56fc90dd76 | SUREYAPRAGAASH09/Basic-Python-Programming | /Exercise/countEvenOdddogits/countevenodd.py | 473 | 4.25 | 4 | Problem Statement :
===================
to find count the number of odd and even number in a given integer
Input :
=======
Integer Number
Output :
========
Even Count and Odd Count - Integer
Code :
======
def countevenodd(number):
even = 0
odd = 0
while(number>0):
temp = number ... |
1d06e5d6fbc46308402c63568a43c5f74c29526e | PentesterGuruji/100-Days-Of-Python | /DAY 3/day-3-start.py | 2,987 | 4.25 | 4 | #conditional if/else
# if condition:
# do this
# else:
# do this
# >=
########### CODE 1 PLEASE UNCOMMENT IT
# print("Welcome to rollercoaster!")
# height = int(input("What is your height in cm? "))
# if height >= 120:
# print("You can ride the roolercoaster")
# age = int(input("... |
526ef37026d3f32aea6c893ad524fa9da8522e6e | lucasg13info/estudos-python | /mundo1/ex014.py | 78 | 3.71875 | 4 | c = float(input(('Informa a temperatura em C')))
f = ((9 * c)/5) +32
print(f) |
eaa4596f3b60189be380723ca0ba4ab3d1a27453 | YulanJS/Advanced_Programming_With_Python | /lecture26.py | 1,020 | 3.96875 | 4 | # ----------------------------------------------------------------------
# Name: lecture26
# Purpose: Demonstrate database access with SQLAlchemy
#
# Author: Rula Khayrallah
# ----------------------------------------------------------------------
"""
Module containing imports to be used in lecture 26
F... |
725f718bf0ea93bd85bff9c60733ec26cf37c643 | shahcompbio/scgenome | /scgenome/preprocessing/transform.py | 828 | 3.796875 | 4 | import numpy as np
from numpy import ndarray
def fill_missing(data: ndarray) -> ndarray:
""" Fill missing values with means of non-nan values across rows.
Deal with missing values by assigning the mean value
of each bin to missing values of that bin
Parameters
----------
data : ndarray
... |
fb68ee09e8e644667bc16a0dee8dab420ede3c0a | tharunsai241/python_ds | /sort.py | 2,021 | 4.4375 | 4 | #this is a inbuilt python sort method in which sort() will helps us to maintain and sort the data in ascending or descending order which has a two parameters likely reverse - If True, the sorted list is reversed (or sorted in Descending order)
#key - function that serves as a key for the sort comparison
#The simples... |
89be88d6c10d19bcdb23be086380e0f498781d00 | monicayyt/algorithm_super_hero | /Array_Set_Vector/check_dupe_ex1.py | 710 | 3.703125 | 4 | def check_dup(arr):
#create counting dictionary
count = {}
results = []
#loop through the string to fill in the dictionary
for num in arr:
# found dups, print it out
if num in count:
count[num] +=1
results.append(num)
# no dups found, push t... |
db19dc1c59907aeb000f2f8bf8472088da3abad5 | jeffersonsouza/computer-engineering-degree | /introducao-logica/AT/03-analise-renda-mensal.py | 2,243 | 3.515625 | 4 | # ENUNCIADO:
#
# Crie um programa contendo uma função que, dados um valor de renda mensal total,
# gastos totais com moradia, gastos totais com educação e gastos totais com
# transporte, faça um diagnóstico da saúde financeira do usuário, com base nos
# valores percentuais acima expostos, informando qual é o percentua... |
dfaac742f9ea683e75de95910afb0ea6093920a8 | MikelShifrin/Python1 | /Students/chase/homework2.py | 125 | 3.921875 | 4 | import area
def main():
radius=int(input("please enter the radius of the circle"))
print(area.circle(radius))
main()
|
909ea3e967bc5d966570c7951e841dca6c259b0c | breu95/Instagram-Bot | /Insta Tools v2.8.py | 41,227 | 3.546875 | 4 |
##### Instagram Login Credentials ########
username = ""
password = ""
##########################################
#################
# To decrease the chance of your account being shadowbanned, keep your unfollow limit to less than 60 per hour
# with a gap of 25-30 seconds and a maximum of 100 unfol... |
c2e262e56731ff46289d47e20145ee27eae9d307 | piladzis10/Hacks-Python | /args_kwargs.py | 507 | 4.34375 | 4 | # prints all values in string format with space
x = [1,5,7]
print(*x)
"""*args, **kwargs non keyword arguments and keyword arguments are used when it is not sure how many arguments are
will be needed for function """
def number_sum(*num):
sum = 0
for n in num:
sum += n
print(f"Sum = {sum}")
num... |
a3b6e4b784ebad34d821a475a72359e422d99691 | shin99921/software_basic | /bc/2.py | 116 | 3.59375 | 4 | def welcome(n):
for i in range(n):
print("환영합니다")
num = int(input("횟수:"))
welcome(num)
|
b414c3b9ada382e7a93678791c3e947da1621b3f | kaijones21/ICS235 | /Test.py | 4,913 | 3.734375 | 4 | import numpy as np
import matplotlib.pyplot as plt
import statistics as stats
from DataSetGenerator import DataSetGenerator
from Perceptron import Perceptron
N = [2, 5, 10, 20, 50, 100]
error_means = []
error_standard_deviations = []
margin_means = []
margin_standard_deviations = []
for number_of_data_points in N:
... |
40e2a3a1739bec28a753be4279ced4cd0bf225e7 | Joycewaithaka/my-backened-work | /my_name.py | 226 | 4.09375 | 4 | name = input("kindly put in your name:")
user_name = input("kindly put in your name")
welcome_message = input("congratulations Ms {}. You are a part of Akirachix class of 2017!")
print("welcome_message.format(user_name,name)") |
dce8cdeba00f8e1b2b6da03e48c7f047017c469a | hima-cmd/hello | /src/Chap7/exits.py | 348 | 3.875 | 4 | #using while , break , continue and flag
toppings =''
active = True
while active:
toppings = raw_input("\nEnter toppings of your choice : ")
if toppings != 'quit':
print('\n Adding '+toppings+' to your pizza.......')
else:
print("\nThank you for your order.")
active = False
... |
acf0eb38921cf3d0cf62bdb525357ac78a2034af | rlui94/gothello | /test_move.py | 467 | 3.53125 | 4 | import unittest
from move import Move
class MyTestCase(unittest.TestCase):
def test_constructor(self):
mv = Move.from_desc("a3")
self.assertEqual(mv.name(), "a3")
mv = Move(1, 1)
self.assertEqual(mv.name(), "b2")
def test_digits_letters(self):
mv = Move.from_desc("a3")... |
f8e1503fd120b1d24d370f929ca6b3cdab0d40e9 | windyIsMe/leetcode | /python/p94.py | 948 | 3.75 | 4 | from treenode import TreeNode
class Solution:
def inorderTraversal(self, root: TreeNode):
res = []
self.traverse(res, root)
return res
def inorderTraversalIterative(self, root: TreeNode):
stack = []
res = []
cur = root
while cur or stack:
whi... |
792015a17c9711f8011311883bbd276395f16e4d | ianujvarshney/Python-Programs | /Basic Level Programs/Maximum_Of _Two_Numbers.py | 165 | 4.0625 | 4 | def maxi(a,b):
if a>b:
return a
return b
a=int(input("Enter 1st Number: "))
b=int(input("Enter 2nd Number: "))
print(f"Maximum No. is: {maxi(a,b)}")
|
102364eb35441cdc310150ddc6df8cec01e4f3b4 | akloppenburg-pro/PyPlatformer | /Level.py | 12,229 | 3.53125 | 4 | # Sources
# https://www.pygame.org/docs/
# https://www.pygame.org/tags/sidescroller <-- used as inspiration, not for coding help
# http://programarcadegames.com/python_examples/f.php?file=platform_moving.py
# http://programarcadegames.com/python_examples/f.php?file=platform_scroller.py
# http://programarcadegames.... |
bfccfae8b3b685dac1b661a35db368a9ef7542bc | sigalnotovich/maxHEAP_GreadyALG_forBloomFilter | /greedy_algoritm/EthereumBloomFilter.py | 8,240 | 3.546875 | 4 | import numbers
import operator
from typing import (
Iterable,
Union,
TYPE_CHECKING,
)
#THIS NOTEBOOK IMPLEMENTS AN ETHEREUM BLOOM FILTER AS DESCRIBED IN THE ETHEREUM YELLOW PAPER
#THE MAIN CLASS IS BLOOM FILTER
#The Ethereum hashing function, keccak256, sometimes (erroneously) called sha3 fro... |
35cf34f9fee504a4f61e357fbd4c1c0635496083 | ryanhikmah/Ryan-Hikmah-Fadilla_I0320088_Wildan_Tugas7 | /I0320088_soal2_tugas7.py | 1,040 | 3.90625 | 4 | #fungsi abs
print("======Fungsi Abs======")
a = -34
b = -22
print("Nilai dari abs a = ",abs(a))
print("Nilai dari abs b = ",abs(b))
#fungsi max dan min
print("======Fungsi Max dan Min======")
a = 10
b = 30
c = 50
print("Nilai max dari ketiga bilangan tersebut adalah ", max(a, b, c))
print("Nilai min dari ... |
a71ad4aca8d48d109687141df1305a0cb8843473 | jiali0411/rosalind_problems | /codes/lgis2.py | 2,973 | 4 | 4 | def increasing_subsequence(d, n, increasing = True):
'Return one of the L.I.S. of list d'
if n == 0:
return None
if n == 1:
return d
# if d has more then 1 number:
l = []
for i in range(n):
# This is a slow algorithm
# if l == []:
# l.append([int(... |
8dd0816aad4f050e1ca7203b6d34b6fa0b62fdc2 | JosephKhajoo/class_python_2 | /hotel_system.py | 2,441 | 3.6875 | 4 | class Taxi:
def __init__(self, taxi_name, car_type):
self.taxi_name = taxi_name
self.car_type = car_type
self.taxi_price = 10000
def discount(self, prescent):
self.taxi_price -= (self.taxi_price * prescent / 100)
return self.taxi_price
def presentation(self):
return f"name: {self.name}\ntype of car: {s... |
88e519316de4447d39e47cfba0d3a0436bdc4194 | jingcheng5053/excel | /excel操作/win.py | 706 | 3.53125 | 4 | import tkinter as ttk
from tkinter import *
from tkinter.filedialog import askopenfilename # 文件打开对话框
from PIL import Image, ImageTk
path = StringVar()
path.set("eee")
print(path)
def choosepic():
# global path
path_ = askopenfilename()
print(path_)
path.set(path_)
img_open = Image.open(path_)
... |
f3d69b8d1f0d77f3fa69a93cdcdde789316d15f2 | czaloumi/ironman-2019 | /src/.ipynb_checkpoints/timecleaning-checkpoint.py | 1,188 | 3.578125 | 4 | import pandas as pd
import numpy as np
import datetime
import pdb
class TimeDateToMinutes(object):
'''
Converts timedate columns to timedelta to seconds to minutes.
'''
def __init__(self, df, col1):
self.df = df
self.col1 = col1
self._timedelt()
self._seconds()
... |
d0d3382df4b69557cd980ed732ec8e76a441492f | LeopardLuo/rlsbif | /utils/CommonTool.py | 2,443 | 3.5625 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import inspect
import ctypes
class ConstValue(object):
""" 封装出来的一个常量类。所有设置的属性都只能设置一次,多次设置会产生异常。属性名必须是大写字符串。
usage:
>>> ConstValue.PI = 3.1415926
>>> ConstValue.PI = 3.2
<ConstError>
>>> ConstValue.year = 2018
<ConstCastError... |
be23e2ba17c6d062d1c5cc1fa142bc5be2becf15 | durgacodez03/Hello_python | /loop_example.py | 434 | 3.59375 | 4 | languages = ['Python', 'Numpy', 'Pandas', 'Django', 'Flask']
for i in languages:
print(i)
j = 0
for i in range(0,101):
if (i%2 == 0):
j = i+j
print(j)
else:
j = i+j
print(j)
fruits = ['banana', 'orange', 'mango', 'lemon']
for i in reversed(fruits):
pr... |
591b88382be1747aed5891373df8af8dacd47e8a | jfrance00/di-exercises | /week7/day3/daily.py | 1,816 | 4.125 | 4 | matrix = [
[ '7' ,' ', '3' ],
['T','s','i'],
['h','%','x'],
['i',' ','#'],
['s', 'M'],
['$','a'],
['#','t','%'],
['i','r','!'],
]
hidden_message = " "
def longest_list(matrix):
longest = matrix[0]
for item in matrix:
if len(item) > len(longest):
longest = it... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.