blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
1184871d1e2bf1abe936750ab254bfb973f8b26e | DeepLenin/phns | /phns/utils/contractions.py | 6,413 | 3.703125 | 4 | """
Сочетания модификаторов:
- "to be" + not
- "to have" + not
- "to do" + not
- can + not
- will + not
- shall + not
- modal verbs + [have, not, not + have]
"""
MODAL_VERBS = ["could", "should", "would", "ought", "might", "must", "need"]
MODIFIERS = {
"am",
"is",
"are",
"wa... |
db35a91cd01659407280f8a094d7733289be5721 | karendi/python | /excercise36.py | 1,090 | 3.765625 | 4 | from sys import exit
from sys import argv
script, username = argv
def red_ball() :
print("you have chosen a red ball")
pick_bat()
hit_ball()
def blue_ball() :
print("you have chosen a blue ball")
pick_bat()
hit_ball()
def green_ball() :
print("you have chosen a green ball")
pick_bat(... |
d02324dd69efea0b56139bc7b049f103e3b7f171 | peleduri/baby-steps | /baby steps/Learn_py/ex5.py | 522 | 3.765625 | 4 | my_name = 'Uri Peled'
my_age = 27
my_height = 165 # cn
my_weight = 65 # kg
my_eyes = 'brown'
my_teeth = 'White'
my_hair = 'Blonde'
print (f"Let's talk about {my_name}.")
print (f"He's {my_height} cn tall")
print (f"He's {my_weight} kg heavy")
print (f"Actually that's not too heavy.")
print (f"He's got {my_eyes} eyes a... |
dea484075682bce5707bc3cb61eef2c2d6bcfb72 | varun3108/Agent-Selector-based-on-issue | /AgentSelect.py | 5,430 | 3.65625 | 4 | import datetime
import random
agent_list= [1001, True, datetime.time(8, 0), 'Support', 1002, True, datetime.time(10, 0), 'Sales', 1003, True, datetime.time(11, 0), 'Spanish speaker', 1004, True, datetime.time(12, 0), 'Sales', 1005, True, datetime.time(11, 0), 'Support', 1006, True, datetime.time(12, 0), 'Spanish sp... |
b70203f198a4c07f9d567ff9397b9c485014da78 | Twest19/prg105 | /Final Project/YT_final_project.py | 19,150 | 4.4375 | 4 | """
Tim West, Programming Logic 105 - Final Project
What does it do?
Uses a tkinter GUI to get a users preferences on the random YouTube videos they want to see. It then uses those
preferences to pull the correct videos from the YouTube API. The videos are then opened in the users default
... |
83be6851ae93b99c875827bb0b197d07787ec039 | DeirdreHegarty/Augmented-Reality | /camera.py | 7,021 | 3.546875 | 4 | """ Example of using OpenCV API to detect and draw checkerboard pattern"""
import numpy as np
import cv2
# These two imports are for the signal handler
import signal
import sys
import calibcam # calibrate the camera
#### Some helper functions #####
def reallyDestroyWindow(windowName) :
''' Bug in OpenCV's destroy... |
5fed049c370d944d2f964c19fc2da9cf8eb9f11c | adfisher4/tic_tac_toe | /tic_tac_toe.py | 3,662 | 4.25 | 4 |
print("\n TIC TAC TOE \n")
print ("Choose players X and O. Whoever's turn it is, type the number that corresponds with the spot you want your mark. First to get 3 in a row, column or diagonal wins.")
# 3x3 Grid with numbers 1-9
def grid():
print("""
1|2|3
-----
4|5|6
-----
7|8|9
""".forma... |
60c8150cba99f347ae0d568adbc77036a996a52f | SoniaB78/supportSG | /class/compteBanque.py | 1,499 | 3.828125 | 4 | #-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Administrateur
#
# Created: 08/01/2020
# Copyright: (c) Administrateur 2020
# Licence: <your licence>
#---------------------------------------------------------------------------... |
c87412be0e62789a0c4370ec61872e2170f55b80 | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/223/users/4171/codes/1807_2569.py | 171 | 3.84375 | 4 | from numpy import *
x = array(eval(input("valores de x: ")))
m = sum(x)/size(x)
a = 0
for g in x:
a += (g - m)**2
h = a / (size(x) - 1)
v = sqrt(h)
print(round(v,3)) |
15dd288c69a46b9ba30c36b726276d5deb48b7fd | abhijithshankar93/coding_practise | /CodeChef/coins.py | 528 | 3.65625 | 4 |
def recursive(num, max_dict):
if num==1:
max_dict['1']=1
return 1
if num ==0:
max_dict['0']=0
return 0
try:
return max_dict[str(num)]
except KeyError:
pass
max_value = max(num, (recursive(int(num/2), max_dict)+
recursive(int(num/3), max_dict)+
recursive(int(num/4), max_dict))
)
... |
754c77ba200dd7a37653d3218a48c11d7db6a52d | aleexnl/aws-python | /UF2/Practica 24/Ejercicio 1/modules/functions.py | 437 | 3.640625 | 4 | def recursive_div(divend, divsor): # creeamos la funcion y le añadimos dos valores.
if divend == 0: # si el dividendo es = 0 nos devolvera 0.
return 0
elif divend < divsor: # cuando el dividendo sea mas pequeño que el divisor nos devolvera como valor 1.
return 1
else: # En caso de que las ot... |
41db70c6c03e6c60f478ab071b2d51856cb52ee5 | andreiolegovichru/pandas1 | /from_csv_5rows.py | 785 | 3.578125 | 4 | import pandas as pd
import os
CSV_PATH = os.path.join(".", "collection-master", "artwork_data.csv")
print(CSV_PATH)
# pandas will create its own index column - Index
df = pd.read_csv(CSV_PATH, nrows=5)
# pandas will use existing column "id" as an index column
df = pd.read_csv(CSV_PATH, nrows=5, index_col="id")
# see... |
b589dcd9fb7ca93269d4cafdaa8472d65e9fcc12 | craigdub/SiteScrapper | /link_diff.py | 1,136 | 3.640625 | 4 | import sys
def find_dff_between_files(file_name1, file_name2):
matching_url = set()
unmatched_url = set()
with open(file_name1, "r") as file1:
for line1 in file1:
match_found = False
with open(file_name2, "r") as file2:
for line2 in file2:
... |
17190581bf7d963a127c3ed1b105a8fce2c19d7a | daniel-reich/ubiquitous-fiesta | /v2k5hKnb4d5srYFvE_5.py | 489 | 3.53125 | 4 |
def letters_combinations(digits):
if len(digits) == 0:
return set()
d = { "2": "abc", "3": "def", "4": "ghi", "5": "jkl", "6": "mno", "7": "pqrs", "8": "tuv", "9": "wxyz" }
start_list = lambda digit: [d[digit][n] for n in range(len(d[digit]))]
advance_list = lambda list, digit: [l8r + d[digit][n... |
9cda10f7e64fcafbc4590e6297a17b7f97946f00 | mishra-anubhav/Competitive-Programming | /Network-marketing.py | 341 | 3.53125 | 4 | parent = input()
ques = input()
if ques=='Y':
list = input()
list = list.split(',')
n = len(list)
print("TOTAL MEMBERS :",n)
print("COMMISSION DETAILS")
print(parent,":",(n*500))
for i in list:
print(i,": 250")
else:
print("TOTAL MEMBERS : 1")
print("COMMISSION DETAILS")
... |
a304e5575cad06863f6bd07764c3c17ade16e8d5 | jayala-29/Project-Euler | /Problem1.py | 422 | 4.21875 | 4 | # If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9.
# The sum of these multiples is 23.
# Find the sum of all the multiples of 3 or 5 below 1000.
def Problem1 (n) :
total = 0
n -= 1
while (n > 0) :
if (n % 3 == 0 or n % 5 == 0) :
... |
b38f577a3e9d003f926e63957745dfd8adc8cdee | J4Mary/homework | /6.1.py | 371 | 3.671875 | 4 | students=dict([('Mary',[9,9,10,9]),('Alex',[10,10,9,10]),('Max',[9,8,10,8]),('Lera',[10,9,10,9])])
print(students)
for key,val in students.items():
students[key]=sum(val)/len(val)
print(students)
for key,val in students.items():
if val==max(students.values()):
print(key, 'is the best')
if val==min(s... |
90d3c82cbfff35e6e01bbaa17adf543be0bf57e5 | StarwipeNet/Adops-repo | /Simplilearn/Predict House Price.py | 1,713 | 3.53125 | 4 | # coding=utf-8
# !/usr/bin/env python
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.impute import SimpleImputer
class PredictHousePrice(object):
def __init__(self, input_file):
self.input_file = input_file
self.house_price = None
self.X_one = None
... |
448cbf51bd0214ec5f19d66871aa340b3d67ba1c | littlelilyjiang/two_leetcode_daybyday | /easy/num263.py | 511 | 3.921875 | 4 | '''
编写一个程序判断给定的数是否为丑数。
丑数就是只包含质因数 2, 3, 5 的正整数。
'''
def isUgly(num):
if num == 0:
return False
while(num != 1):
if num%2 == 0:
num = num/2
continue
if num%3 == 0:
num = num/3
continue
if num%5 == 0:
num = num/5
... |
b8f9defc0f30fb6538ac094956725492639394ac | AkshayMokalwar/python_programs.github.io | /my_python_programs/basic/nonlocal.py | 3,966 | 4.65625 | 5 | #global and local variable with different name
# x="global"
# #global variable can be accessed from anywhere
# def funct1():
# global x
# y="local"
# x=x*2
# print(x)
# print(y)
#
# print("Global x= ",x)
# funct1()
# print("Global x= ",x)
# ------------------------------------... |
880a8d56cf3b938cc52409084403e2cdf18fda13 | LiuY-ang/leetCode | /climbStairs4.py | 904 | 3.625 | 4 | class Solution(object):
def climbStairs(self, n):
"""
:type n: int
:rtype: int
"""
base=[[1,1],[1,0]]
s=self.power(base,n)
return s[0][0]
def power(self,matrix,n):
li=[[1,0],[0,1]] #2价单位矩阵,应该是叫这个名,相当于整数的1,任何整数和此举证相乘,都为原矩阵
while n >0 :
... |
d6cf531d983c974414e7e2bd016dd7a875dac13e | DoosanJung/neural-networks-for-time-series | /miscellaneous/keras/convnets_image_generator.py | 6,738 | 3.921875 | 4 | '''
* Francois Chollet, 2017, "Deep Learning with Python"
* Francois Chollet's example code([GitHub](https://github.com/fchollet/deep-learning-with-python-notebooks))
* I bought this book. I modified the example code a bit to confirm my understanding.
'''
import keras
import os
from keras import backend as K
from keras... |
9321b5d3d480ee12c396f0c03b93f43df60bf5f0 | Harishsowmy/python_learning | /introduction/test9.py | 251 | 4.09375 | 4 | age=input("how old are you?")
print("my age is :{age}".format(age=age))
height=input("how tall are you?")
print("myheight is :{height}".format(height=height))
weight=input("how much do you weigh?")
print("my weight is :{weight}".format(weight=weight)) |
0ac88aa07cd79fd9663ae48f43d4d2ba0fbf46e5 | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/225/users/4469/codes/1590_1016.py | 227 | 3.859375 | 4 | import math
a = float(input("lado 1 do triangulo: "))
b = float(input("lado 2 do triangulo: "))
c = float(input("lado 3 do triangulo: "))
s = (a + b + c) / 2
A = math.sqrt(s * (s - a) * (s - b) * (s - c))
print(round(A, 5)) |
375fd1fa69ef4c09c13ccf587ee88812b8a5d98d | fenglihanxiao/Python | /Module01_CZ/day4_oop/04-代码/day4/77_手机.py | 1,220 | 4 | 4 | """
演示手机案例
要求:
手机电量默认是100
打游戏每次消耗电量10
听歌每次消耗电量5
打电话每次消耗电量4
接电话每次消耗电量3
充电可以为手机补充电量
"""
# 分析
# 1. 定义类Phone
# 2. 定义变量用于描述电量值
# 3. 定义4个方法用于描述耗电操作
# 4. 定义1个方法用于描述充电操作
# 5. 运行程序,执行上述操作,观察结果
class Phone:
def __init__(self):
self.power = 100
def game(self):
"""打游戏操作,耗电10"""
print("正在打游... |
1bc670de4018c510a2b18ed7dc84dc6951a6c31f | isemona/codingchallenges | /1-FirstReverse.py | 432 | 3.59375 | 4 | # https://www.coderbyte.com/editor/First%20Reverse:Python#
# Difficulty - Easy
def FirstReverse(str):
# no built in reverse functions for strings
# using extended slice syntax (begins and ends at 0)
# src - https://www.geeksforgeeks.org/reverse-string-python-5-different-ways/
return str[::-1]
#You can also... |
a1760731e66a15305ebf346996fd5b72bff14c84 | aseemchopra25/Integer-Sequences | /Farey Sequence Numerators/Farey_Sequence_Numerator.py | 703 | 4.0625 | 4 | #This is one of the solution, I will come up with more optimal solution soon
def farey_sequence(n):
l=[]
for i in range(1,n+1):
(a, b, c, d) = (0, 1, 1, i) #here a/b is first term and c/d is consecutive term
l.append(0) #first farey seq. numerator will always be 0
#following is the log... |
45d8e5896a9952db1e9e7c049fa57059ab0587ec | Kristin0/ASUE-P4E-Homeworks | /Homework4/problem1.py | 1,636 | 4.09375 | 4 | import random
iterations = int(input("Iterations quantity: "))
win_when_switching = 0
win_when_not_switching = 0
for x in range(iterations):
host_choice = random.randint(1,3)
prize_door = random.randint(1,3)
cont_num = random.randint(1,3)
switched_door = random.randint(1,3)
while (host_choice ==... |
a75bf416b81f4062f707b126e3b07ba51123f9bf | marianafcruz17/Learn-to-Code-in-Python | /Conditionals, Loops, Functiond and a bit more/error_handling.py | 1,760 | 4.1875 | 4 | data_valid = False
while data_valid == False:
grade1 = input("Type the grade of the first test: ")
try:
grade1 = float(grade1)
except:
print("Invalid input. Only numbers are accepted. Decimals should be separated with a dot.")
continue
if grade1<0 or grade1>... |
2c2dcde7dcee2679d8de376b9c188eabd8794313 | Panda3D-public-projects-archive/pandacamp | /Handouts 2012/src/3-1 Coordinates and Projectiles/03-paths.py | 500 | 3.71875 | 4 | from Panda import *
# A function which takes a parameter t and returns a position defines a path.
# This path goes up and down.
def path(t):
return P3(t-2, 0, sin(t*2))
# Place a bunch of pandas on this path:
for x in range(5):
panda(position = path(time-x))
# Challenges:
# Make the pandas follows this pat... |
eddb309d1e37ad65083117071f06d7286c7081d9 | Justion1234/KOSPI_index | /KOSPI_index_colered.py | 543 | 3.609375 | 4 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from datetime import datetime
from pandas_datareader import data
start = datetime(2020, 1, 1)
end = datetime(2021, 2, 9)
plt.title('KOSPI index')
df = data.get_data_yahoo('^KS11', start, end) #pandas_datareader를 통해서 주식 데이터 가져옴 df = data frame
plt... |
6da7b42d45874b8c3705bcbd94851a6d37ab8a36 | zpyao1996/leetcode | /copyrandomlist.py | 1,835 | 3.65625 | 4 | # Definition for singly-linked list with a random pointer.
class RandomListNode(object):
def __init__(self, x):
self.label = x
self.next = None
self.random = None
class Solution(object):
def copyRandomList(self, head):
"""
:type head: RandomListNode
... |
b59a04e18cf4bbb51928ea7b428a280ee0cdbd0f | kadirovgm/shifr_zameny | /shifr_zameny.py | 5,597 | 3.546875 | 4 | import random
import math
from collections import Counter
alphabet = 'абвгдежзийклмнопрстуфхцчшщъыьэюяАБВГДЕЖЗИЙКЛМНПРСТУФЧЦЧШЩЪЫЬЭЮЯ '
def keygen(alphabet):
with open('key.txt', mode='w', encoding="utf-8") as file:
key = ''.join(random.sample(alphabet, len(alphabet)))
file.write(key)
return ... |
fa231835aeea287255f15dc6c26c53f2edf369fb | Sheep-coder/practice2 | /Python00/chap03list0314.py | 255 | 3.828125 | 4 | # aはbで割り切れるか
a=int(input('整数a:'))
b=int(input('整数b:'))
c=b!=0 and a%b
print(c,end='・・・')
if c:
print('aはbでは割り切れません。')
else:
print('bが0またはaがbで割り切れます。')
|
d7f660f06298f0f8e2ca305f3c4db02d773878ff | thomasbtatum/adventofcode2019 | /bolwingTest.py | 799 | 3.5 | 4 | import bowling
import unittest
class BowlingGameTest(unittest.TestCase):
g = bowling.Game()
def setUp(self):
self.g = bowling.Game()
def RollMany(self, num, pins):
for x in range(1,num+1):
self.g.Roll(pins)
def testGutterGame(self):
self.RollMany(20,0)
self... |
12e9e2d2b5e810a542ef23e0bd5a7c839edf1fb6 | sunnywalden/double_color_lottery | /unit_test/lottery_test.py | 654 | 3.703125 | 4 | #!/bin/python
# -*- coding:utf-8 -*-
import unittest
from main.double_color_lottery_generator import random_shuangse
class Tests(unittest.TestCase):
def test(self):
lottery = random_shuangse(1)[0]
red_nums = lottery[:5]
#print(red_nums)
for num in red_nums:
#print(num)... |
d9cd6331415c28be62bf7bfd646571077e9082a7 | mnauman-tamu/ENGR-102 | /chemEq.py | 953 | 4.09375 | 4 | # chemEq
#
# Write a program to find the number of atoms of a specific element in a molecule
#
# Muhammad Nauman
# UIN: 927008027
# September 19, 2018
# ENGR 102-213
#
# Lab 4B - 5
# Pre-processor
A = input("Enter the chemical formula for the molecule (Type subscripts as normal numbers): ")
sym = input("E... |
644ef988436e69c91a9929c554ef8cf38cecfeb3 | juselius/python-tutorials | /Basics/lists.py | 543 | 3.703125 | 4 | a = ['spam', 'eggs', 100, 1234]
print a
print a[0]
print a[2:4]
print a[-2]
print a[1:-1]
print 3*a[:3] + ['Boo!']
a[2] = a[2] + 23 # Lists are mutable!
a[0:2] = [1, 12] # Replace items
a[0:2] = [] # Remove items (also try del a[0:2])
a[1:1] = ['urk', 'purk'] # Insert items
a.append('t... |
b947a443c61a6015f047d5860e73f99a021ca0ef | nkuraeva/python-exercises | /week5/row_2.py | 314 | 4.1875 | 4 | # Given two integers A and B.
# Print all numbers from A to B inclusive,
# in ascending order if A <B,
# or in decreasing order otherwise.
A = int(input())
B = int(input())
if A < B:
for i in range(A, B + 1):
print(i, end=' ')
if A >= B:
for i in range(A, B - 1, -1):
print(i, end=' ')
|
388fecdd279ca42ec47661810317f3ff270c1bc4 | Urscha/SpaceX | /Problem_c/Alleen kilo's/Heaviest_First_C.py | 3,352 | 3.78125 | 4 | '''
This is the constructive algorithm 'Heaviest First' to solve problem C of the Space Freight case
By team SpaceX: Rico, Ellen, Urscha
'''
import math
import sys
from operator import itemgetter
# cargo and ships indices
NAME, KG, M3, CARGO = 0, 1, 2, 3
# _____FUNCTIONS_____
# read cargolists
def read_data(... |
b4786a3cb0de98081ab051229351c7f35cb16e86 | andydevs/tketris | /tketris/game/tileset.py | 2,336 | 3.84375 | 4 | """
Tketris
Tetris using tkinter
Author: Anshul Kharbanda
Created: 10 - 11 - 2018
"""
import numpy as np
from .bounds import TileSetBound
class BoardTileSet:
"""
Represents all tiles currently on the board.
Handles boundaries for tiles and row completion detection.
"""
def __init__(self, tile_co... |
0262ddf0ee1d67a5cba32d5f04ed215eda63f8ae | dlefcoe/daily-questions | /URLshortener.py | 1,790 | 4.125 | 4 | '''
This problem was asked by Microsoft.
Implement a URL shortener with the following methods:
shorten(url), which shortens the url into a six-character alphanumeric string, such as zLg6wl.
restore(short), which expands the shortened string into the original url. If no such shortened string exists, return nul... |
4b5602e32e8d46d2a7220f3ee18fa305ee4128b7 | benjaminleon/EulerProject | /23_non-abundant_sums.py | 2,315 | 3.609375 | 4 | import numpy as np
import ast
from number_helper import is_abundant # My own module
from datetime import datetime
start_time = datetime.now()
# Find if number can be written as a sum of abundant numbers by subtracting by an abundant number and see if the difference is in the list of abundant numbers
# Used to find th... |
bae63f0072606c7c66a3e9460c28989aa09c5fdf | CallmeTorre/Analisis_De_Algoritmos | /Practica 2/CubeSum.py | 884 | 4.25 | 4 | # -*- coding: utf-8 -*-
"""
INSTITUTO POLITÉCNICO NACIONAL
ESCUELA SUPERIOR DE CÓMPUTO
Análisis de Algoritmos
GRUPO: 3CV1
ALUMNOS:
Reyes Fragoso Roberto
Torreblanca Faces Jesús Alexis
PROFESOR: Luna Benoso Benjamín
FECHA: 5/Septiembre/2017
"""
def recursiveS(n):
"""Funcion que regresa la suna de los pri... |
1dc92d958960c7dabc21956b5cff0fcf99fa4fb4 | LinaShanghaitech/JobSeeking | /algorithms/leetcode/2-dim-array-search.py | 842 | 3.625 | 4 | #coding=utf-8
#=========================================================
# Copyright (C) 2019 Shanghaitech SVIP Lab. All rights reserved.
#
# ScriptName: 2-dim-array-search.py
# Author: Lina Hu
# CreatedDate: Wed 22 May 2019 11:19:43 AM CST
#
#==================================================... |
9afb36f0acdfeba72d9ac2cd6268c6292b9be096 | joncucci/SSW567 | /Week 1/Code Assignment/script.py | 1,759 | 3.578125 | 4 |
'''
Author: Jon Cucci
SSW-567 HW#1 Testing Classify Triangle
9/10/21
'''
import math
import pytest
# Triangle classification
def classify_triangle(a, b, c):
result = []
a, b, c = sorted([a,b,c])
# Filter invalid cases
if (a<=0 or b<=0 or c<=0) or not ((a + b > c) and (a + c > b) and (b + c > a)):... |
00b045d3cca18473122917b98c6f4d6b405cdbdb | kosemMG/gb-python-basics | /1/3.py | 159 | 3.96875 | 4 | n = input('Please, enter a number: ')
result = int(n) + int(n + n) + int(n + n + n)
print(f'The result of {n} + {n + n} + {n + n + n} is equal to {result}')
|
e95d5e860679def8ad47b3ad48fa1d686cf79f13 | martinegeli/TDT4110 | /øving2/øving2-3.py | 417 | 3.8125 | 4 | a=int(input('Skriv inn et tall: '))
b=int(input('Skriv inn et tall til: '))
c=int(input('Skriv inn et siste tall: '))
d=b**2-(4*a*c)
if d<0:
print('Andregradslikningen', a,'*x^2 +', b,'*x +', c, 'har to imaginære løsninger')
elif d>0:
print('Andregradslikningen', a,'*x^2 +', b,'*x +', c, 'har to reelle løsning... |
eac202b7b94609212e41db2377243a49449e09cf | h3xadron/Python | /Divisors/Divisors.py | 126 | 3.75 | 4 | #!/bin/python
import sys
userinput = int(input("Please give me a number! "))
for i in range(2,11):
print (userinput // i )
|
31537c21b133950386cfa09e648ed911c5430453 | brettjbush/adventofcode | /2016/day03/day03_1.py | 1,554 | 4.28125 | 4 | #!/usr/bin/python
"""
--- Day 3: Squares With Three Sides ---
Now that you can think clearly, you move deeper into the labyrinth of hallways and office furniture that makes up this part of Easter Bunny HQ. This must be a graphic design department; the walls are covered in specifications for triangles.
Or are they?
T... |
c7a8a3a40df6f8f06c1eaf002b2113e1db6cf59f | minsuhan1/programmers_algorithm_practice | /42839_find_primenum.py | 783 | 3.578125 | 4 | from itertools import permutations
# 소수판별함수
def isprime(num):
if num <= 1: return False
if num == 2: return True
for i in range(2, int(num ** (1/2))+1):
if num % i == 0:
return False
return True
def solution(numbers):
# input 문자열 분할
numbers = [numbers[i] for i in range(len(... |
d8f532524728822c4cd8aacf90940393608c5b9a | ahmcpsc/Python- | /Lessons/Functions.py | 6,417 | 4.5625 | 5 | # A function is a block of code which only runs when it is called.
# You can pass data, known as parameters, into a function.
# A function can return data as a result.
# Creating a Function:
# In Python a function is defined using the def keyword:
def my_function():
print("Hello, world")
# Calling a Fu... |
62ddcea02b4baa0344f6ec9646bf71cfa602abc3 | FinnMoolenaar/UnicPongGame | /PongGame007.py | 20,947 | 3.71875 | 4 | import arcade
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
SCREEN_TITLE = "Pong Game"
class TextButton:
#hier geef je variabelen mee voor de buttons, zoals de grootte en de tekst die er in moet komen.
def __init__(self, center_x, center_y, width, height, text, font_size=18, font_face="Arial", face_color=arc... |
188e22cb39af42f37d332240cd356ebde785dbae | gabby-cervantes-projects/RPGModFileProcesser-Creator | /modmakers.py | 5,062 | 4.0625 | 4 | import pandas as pd
import numpy as np
import random
def run_complaint():
number_complaint = random.randint(0,10)
complain = ['Yo, you good fam?', 'You\'re pretty indesisive huh?', 'It\'s two letters?', 'Dude, choose a letter.', 'Okay, you got this fam. Choose a letter.', 'Low key impressed you haven\'... |
d61b211c8f01b256c6f3c328c7b6bb36b67e56c1 | picardcharlie/python101 | /projects/file_search.py | 1,441 | 4.25 | 4 | # Write a script that searches a folder you specify (as well as its subfolders, up to two levels deep)
# and compiles a list of all .jpg files contained in there.
# The list should include the complete path of each .jpg file.
# If you are feeling bold, create a list containing each type of file extension you find in t... |
6b426850c09b492d98660de659b599d73a10ec3c | subha9/Assignment-3 | /Assignment_3.py | 1,727 | 3.875 | 4 |
# coding: utf-8
# In[72]:
#1.1 Write a Python Program to implement your own myreduce() function which works exactly
#like Python's built-in function reduce()
def app(lst1):
app=lst1[0]
for i in range(1,len(lst1)):
app*=lst1[i]
return app
print(app([4,3,2,1]))
#from functools import reduce
#n=[... |
9be222e4f82bf785084d7a3630e46c07ac14b4dd | jlardy/Python-Scripts | /pdf_writer.py | 1,465 | 3.90625 | 4 | """
This program writes pictures to a pdf.
Running the program will launch tkinter file dialogs to get a path to images you want converted to a pdf.
- Images must be vertically oriented
- Images must be stored in the order you want written
- Only works with png, jpg, and jpeg currently
This was just ... |
c2850b6e3666fdf9f95977683c67934eae3cfd8b | andreasdjokic/piratize | /piratize_translate.py | 3,482 | 3.609375 | 4 | #Contains methods that are to be used in the piratize file, and the various classes
from fractions import Fraction
"""General method that takes a string, s1, and returns the string after being
translated to pirish. Couldn't find a great equivalent to Ruby's
talk_like_a_pirate gem, so I just covered som... |
07d106d4d2141bf05aa4d98458c3525e5e352108 | rainishadass/127 | /code/misc_hw/ch7_9.py | 1,660 | 4.0625 | 4 |
def isEven(number):
if number % 2 == 0:
return True
else:
return False
def isEvenTerse(number):
return number % 2 == 0
def isOdd(number):
return not isEven(number)
longString ="""
Street bands have been picking up the slack for the last year in NYC, performing for outside diners and ... |
4ead8fa459f65bd69ff7378f0569accbdae55f6f | KevinF42/Python | /print_sfi_functions.py | 233 | 3.53125 | 4 | def intcalc():
A = int(5)
B = int(9)
print (A+B)
def floatcalc():
C = float(12)
D = float(25)
print (C+D)
def stringcat():
E = str("Abra")
F = str("Kadabra")
print (E+F)
def main():
intcalc(),floatcalc(),stringcat()
main()
|
a52650ba8ea7978a4a82a17910ca38629c2337b4 | elenatheresa/CSCI-160 | /lab9b.py | 1,316 | 3.890625 | 4 | '''
elena corpus
csci 160
tuesday 5 -7 pm
program to ask for data file, and then finding data from it
'''
fileName = open('testscores.txt','r')
def largestScore():
fileName.readlines()
num = int(fileName)
for num in range(0,101):
if num <= 99:
num = largestScore
elif num <= 80:... |
3a4914d12865a893b0738d43c40a953a75d89827 | jonathandieu/pythonjumpstart | /learning_classes.py | 802 | 4.21875 | 4 | # Welcome to Python in Visual Studio Code!
# Click the green Run button in the top right corner
# of this editor to run your first Python program.
print("Hello world!")
class Test(object):
"""
This must be for documentation: it's a docstring
it works in multiple lines too
"""
weight = 0
difficu... |
f7db06b6806abbe9de98d82ceb3c376cdc865fdf | phuonghtruong/python | /Checkio/find_message.py | 381 | 4 | 4 | #!/usr/bin/env python3
def find_message(text: str) -> str:
result= []
s = ""
for letter in text:
if letter.isupper() == True:
result.append(letter)
return s.join(result)
def find_message_2(text):
return ''.join(i for i in text if i.isupper())
if __name__=='__main__':
pri... |
41e6890ed52a1e627685ad97d4ba589f6d1dab22 | kjqmiller/recursive-binary-search | /binary_search.py | 1,507 | 4.25 | 4 | # Binary search function using recursion
def binary_search(arr, low, high, x):
# Base case when we are left with only the high and low indices. When we calculate mid and try to run the function
# again, the low and high indices will cross with the addition of 1 to low, or subtraction of 1 from high.
if low ... |
23375c51450ea15417be6d5282c0b6265b8ffd29 | CodeAltus/Python-tutorials-for-beginners | /Lesson 13 - List Comprehension and Slice Operator/slice operator.py | 130 | 3.515625 | 4 | my_list = [x for x in range(0, 10, 2)]
fruits = ["apple", "pears", "strawberries", "blueberries", "bananas"]
print(fruits[0:5:2]) |
adada8b999f483092c5fbe3fa2d6987c4812593e | AdamZhouSE/pythonHomework | /Code/CodeRecords/2730/60580/316630.py | 338 | 3.75 | 4 | def summary(number):
string = str(number)
total = 0
for i in range(len(string)):
total = total + int(string[i])
return total
T = int(input())
for i in range(T):
number = input()
temp = input().split()
num = str(''.join(temp))
if summary(num) % 3 == 0:
print(1)
else:... |
1a3ed228016a64a1e027be6ba5829eaf7f7f38c2 | jtbarker/codinginterviews | /linkedlistcycle.py | 1,738 | 3.90625 | 4 |
class LinkedList:
def __init__(self, head):
self.head = head
self.next = None
#O(n) time O(n) space
def detectcycle(self,head):
if not self.head or not self.head.next:
return False
else:
visited = set()
curr = self.head
whi... |
0a9156d0bdef2e5452129d46013897c1eaf9362f | Hayden-Bailey/Practicals | /prac_06/guitar_test.py | 724 | 3.5 | 4 | """
Testing Guitar Class
"""
from prac_06.guitar import Guitar
def main():
gibson_guitar = Guitar("Gibson L-5 CES", 1922, 16035.40)
test_guitar = Guitar("Test Guitar", 2009, 1500)
gibson_age = gibson_guitar.get_age()
test_age = test_guitar.get_age()
print("{} get_age(): Expected 97 Got {}".form... |
5f49dee3a176d3045f23bbe5dc33113633545b84 | Amarildop1/Python | /ExibeDiagonalDeUmaMatrizQuadrada.py | 737 | 4.03125 | 4 | matriz = []
N = int(input("\nDigite a ordem 'N' da matriz: "))
#Preenchendo com zeros
for i in range(N):
matriz.append(N*[0])
#Preenchendo com a entrada
for i in range(N):
for j in range(N):
matriz[i][j] = int(input(f'Matriz ({i},{j}): '))
#Exibindo a matriz completa
print("\nMatriz Quadrada: ")
for ... |
a4f87162ceddc7d1f4d9c31767543abed7a6935f | jfvergara/python-course-nana | /time-till-deadline.py | 400 | 4.125 | 4 | from datetime import datetime
user_input = input("Enter your goal with a deadline separated by colon\n")
input_list = user_input.split(":")
goal = input_list[0]
deadline = input_list[1]
deadline_date = datetime.strptime(deadline, "%d.%m.%Y")
today_date = datetime.today()
time_till = deadline_date - today_date
pr... |
5848fa1b94b232311ce3586891345e3da2a1e300 | Hwesta/advent-of-code | /aoc2015/day10.py | 2,100 | 4.4375 | 4 | #!/usr/bin/env python3
# -*- coding: <encoding name> -*-
"""
--- Day 10: Elves Look, Elves Say ---
Today, the Elves are playing a game called look-and-say. They take turns making sequences by reading aloud the previous sequence and using that reading as the next sequence. For example, 211 is read as "one two, two ones... |
db79046c71626f4157f9928870b7721351b78541 | muskanmahajan37/Python-Code-Bits | /gui2.py | 417 | 3.65625 | 4 | from tkinter import *
parent = Tk()
redbutton = Button(parent, text = "Red", fg = "red")
redbutton.pack( side = LEFT)
greenbutton = Button(parent, text = "Black", fg = "black")
greenbutton.pack( side = RIGHT )
bluebutton = Button(parent, text = "Blue", fg = "blue")
bluebutton.pack( side = TOP )
blackbutton = Bu... |
768cd16776bbcfcf7bc176dd2ee1836e76e207c0 | enesaygur/python | /asal_sayi.py | 264 | 3.78125 | 4 | sayi=int(input("Sayı giriniz:"))
asalmi=True
if sayi==1:
asalmi=False
for i in range(2,sayi):
if sayi%i==0:
asalmi=False
break
if asalmi:
print(f"{sayi} Sayısı asaldır.")
else:
print(f'{sayi} asal DEĞİLDİR!') |
cbd0448d389851f68dc8b4925e3ae67502c4f036 | thoftheocean/exploration | /homework/case6.1.py | 2,024 | 3.828125 | 4 | #coding:utf-8
#python2.7环境
#描述
'''
题目1:打印出所有的“水仙花数”,所谓“水仙花数”是指一个三位数,其各位数字立方和等于该数本身。例如:153是一个“水仙花数”,因为153=1的三次方+5的三次方+3的三次方。
题目2:有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?
题目3:一个整数,它加上100后是一个完全平方数,再加上168又是一个完全平方数,请问该数是多少?(流程图课堂上已画)
'''
#题目1
def function1():
for num in range(100, 999):
bai = num // 100
... |
023627f094e987438401428f6547aa2314bebfae | Astralknight532/RevatureStagingProjects | /AirPol/Data Processing Code/customfunctions.py | 1,234 | 3.859375 | 4 | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 17 10:39:32 2020
@author: hanan
"""
import pandas as pd
from math import sin, cos, sqrt, atan2, radians, pi
# Defining functions to organize repetitive tasks
# Converts date column to datetime
def dt_convert(data:pd.Series) -> pd.Series:
data = pd.to_datetime(data... |
1dc9505f3bce41c2b9490769970424917145175c | nafasamuth/SG-Basic-Gen.03 | /Tree/tree.py | 1,917 | 3.90625 | 4 | class Node:
def __init__(self,val):
self.info = val
self.left = None
self.right = None
def insert(self, val):
if val < self.info:
if self.left is None:
self.left = Node(val)
else:
self.left.insert(val)
elif val > se... |
cd14d701bfcfabe4d6ba2743deeb06c85917e055 | chords-app/chords-app.github.io | /Python/שבוע 7/מעבדה/LAB6Q2.py | 189 | 3.6875 | 4 | import math
def func1(a):
if(a>0):
b = math.floor(a)
if (a<0):
b = math.ceil(a)
return b
a = float(input("Enter some number "))
print(a)
d = func1(a)
print(d) |
f5d8188e6bfd53a19e2e2f61a8468051773ca8c7 | tuhiniris/Python-ShortCodes-Applications | /patterns1/alphabet pattern_33.py | 524 | 4.09375 | 4 | """
Pattern
Enter number: 5
A
A B
A B C
A B C D
A B C D E
B C D E
C D E
D E
E
"""
print('Alphabet pattern:')
number_rows = int(input("Enter number of rows: "))
for row in range(1,number_rows+1):
print(" "*(number_rows-row),end="")
for column in range(1,row+1):
prin... |
386afa5782fe884c7eb04b5c809ea4fcfeaeb6dc | BoKlassen/ColorFillSolver | /Block.py | 733 | 3.65625 | 4 | class Block:
def __init__(self, x, y, color, board_size):
self.board_size = board_size
self.x = x
self.y = y
self.color = color
self.captured = False
def to_string(self):
print("(" + str(self.x) + ", " + str(self.y) + ") - " + str(self.color))
def set_captur... |
b39649027b767b25a32616973fdaa2abb0c036d2 | darkvictor13/Coisas-Python | /Desafios-Guanabara/006.py | 200 | 3.828125 | 4 | num = int(input('Informe um numero '))
print('O dobro dele eh = {}' .format(num * 2))
print('O triplo dele eh = {}' .format(num * 3))
print('O raiz quadrada dele eh = {:.5f}' .format(num ** (1 / 2)))
|
80880a9f96572d8a3db7fb66e2baa1ae19b91350 | mathphysmx/teaching-ml | /evaluation/Exercises/francisco_clustering_silhouette.py | 207 | 3.6875 | 4 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
x = pd.DataFrame({'x': [1,1,2,3,4,5], 'y':[4,6,6,8,3,2]})
i = 0
x.iloc[i, ]
np.sqrt(3)
def dist(x1,x2):
return((x1.x - x2.x)^2)
|
6585beb4335170778cd5856e7cace0d5c45bc921 | tomemming2/Bulkbuddy | /BMI_BMR_Calculator.py | 3,486 | 3.875 | 4 | from tkinter import Tk, Label, Radiobutton, Entry, IntVar, StringVar, Button
def get_sum(event):
# Reset values so we can restart our calculations
BMI_sumEntry.delete(0, "end")
BMR_sumEntry.delete(0, "end")
TDEE_sumEntry.delete(0, "end")
# Get information from table
Height = float(Height_Entry.get().replace(","... |
0658ada126cc1b37a35d79ca7d70c7293a665506 | fanxc1234/fanxc | /2020-05-26_14-04-50/algorithm_interface.py | 2,409 | 3.546875 | 4 | import json
from json import JSONEncoder
import make_json_serializable # 用于自定义对象的JSON
import algorithm_test
# 关于楼层编号:从地下3到地上18编号 0-20 一楼编号:3
max_person = 12 # 电梯载客量
elevator_speed = 0.5 # 电梯速度,每秒0.5层
NUMBER_OF_FLOOR_LEVELS = 21 #总楼层数
class person: # 人
come_time = 0 # 出现的时间
from_floor = 0 # 出发楼层
... |
6f6f34c0704c7bd34eae14687f487bbef8bffb47 | KhrystynaPetrushchak/devOps | /Lab2a/modules/common.py | 365 | 3.59375 | 4 | import datetime
import sys
def get_current_date():
"""
:return: DateTime object
"""
return datetime.datetime
def get_current_platform():
"""
:return: current platform
"""
return sys.platform
def funct(x):
if x:
a=[i for i in range (0,101) if i%2==0 ]
print(a)
else:
a=[i ... |
2fe9470f04f8ec3d1f93a68cc6eafb04b4c5963c | ss910034/Python | /practice1.py | 603 | 3.890625 | 4 | #!python3
'''spam = 1
if spam == 1:
print("Hello")
elif spam == 2:
print("Howdy")
else:
print("Greeting")
for i in range(1,11):
print(i)
i=1
while(i<11):
print(i)
i = i + 1'''
import random
secretnumber = random.randint(1,20)
print("I am thinking of a number between 1 and 20")
for i in range(1... |
3dbef52096048078e29007a524fa3c288a6ce7fc | bayoishola20/Python-All | /Data Structure Algorithms (DSA)/binarysearch.py | 509 | 3.984375 | 4 | # array refers to all items and val is the value being searched for
def binary_search(arr, val):
if len(arr) == 0 or (len(arr) == 1 and arr[0] != val):
return False
mid = arr[len(arr)/2]
if val == mid: return True
if val < mid: return binary_search(arr[:len(arr)/2], val)
if val > mi... |
c411e7f2f47335702a0a62a56e4515cb975a2839 | Mario-szk/Tensorflow-1 | /test/test.py | 658 | 3.5625 | 4 | import numpy as np;
import tensorflow as tf;
"""
基础tensorflow的使用
"""
x_data=np.random.rand(100).astype(np.float32)
y_data=x_data*0.1+0.3
Weights=tf.Variable(tf.random_uniform([1],-1.0,1.0))
biase=tf.Variable(tf.zeros([1]))
y=Weights*x_data+biase
loss=tf.reduce_mean(tf.square(y-y_data))#定义损失函数
optimizer=tf.train.Gra... |
d0356a30bfa68d747aa11020e46b1f2d0edf4e3d | soneykaa/infa_2021_bogakovskaya | /lab67/main.py | 5,356 | 3.546875 | 4 | import pygame
from pygame.draw import *
from random import randint
import math
pygame.init()
FPS = 20
dt1 = 2
dt2 = 4
scr_x = 1200
scr_y = 600
r_max = 100
screen = pygame.display.set_mode((scr_x, scr_y))
k = 0
#Цвет фона
BLACK = (0, 0, 0)
def new_ball():
'''
Создает новый шарик:
color - цвет, задается р... |
fe1a8bf02dd907fda249448c4a6975beafbf8a3a | leetcode-notebook/wonz | /solutions/0053-Maximum-Subarray/0053.py | 510 | 3.609375 | 4 | class Solution(object):
def maxSubArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return 0
dp = 0
sum = -0xFFFFFFFF
for i in range(len(nums)):
dp = nums[i] + (dp if dp > 0 else 0) # if dp > 0: dp = num... |
46166e2eec6338d57506ac2ae920186b2378cf9a | houhailun/leetcode | /demo/demo_20120220.py | 60,167 | 3.828125 | 4 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Time: 2021/2/20 17:02
# Author: Hou hailun
class Node:
def __init__(self, data):
self.data = data
self.next = None
# 标题1: 股票买入卖出
# 先找到迄今为止最小价格,然后在以后找最大利润 = 卖出价格 - 最小价格
def getMaxProfit(prices):
if not prices:
return None
max_profit = ... |
e2892101bda7d3ad5f73612d819b689ae14423c8 | Dowfree/Data-Structures | /2014200222_DoubleLinkedList.py | 5,888 | 3.921875 | 4 | # -*- coding utf-8 -*-
import sys
"""双向链表及链表的反转"""
class LiuDataStructure:
def print(self,prefix='',postfix=''):
print(prefix+self.__repr__()+postfix)
class Node(LiuDataStructure):
def __init__(self, data=None):
self.data = data
self.next = None
self.prev = None
... |
990402348006fb79ebbbf2ea6cd0ac178f0b9a2e | ricklixo/cursoemvideo | /ex044.py | 1,577 | 3.953125 | 4 | # DESAFIO 044 - Crie um programa que calcule o valor a ser pago por um produto, considerando seu preço normal e a condição de pagamento:
# - à vista dinheiro/cheque: 10% de desconto
# - à vista no cartão: 5% de desconto
# - em até 2x no cartão: preço normal
# - 3x ou mais no cartão: 20% de juros
preco = int(input('Dig... |
448afeb01b08d3d280347aec176a32ab5844e108 | lucasnnobrega/APA-Repo | /Atvd 5/Dijkstra Path.py | 3,312 | 3.78125 | 4 | # -*- coding: utf-8 -*-
"""
Created on "Mon Feb 26 11:29:23 2018"
@author: Lucas NN
"""
# Programa em Python para o algorítimo de Dijkstra
# para o caminho mais curto. O programa recebe a
# matriz de adjacência como representação do grafo
# e retorna o caminho
import open_file as op
#Class to represent a graph... |
4c09e602827e8e2bb80225bc313d03e4e1de45e1 | liambolling/Python-Scraping-Coursework | /Homework/i211-HW-3.py | 1,685 | 4.34375 | 4 | # Liam Bolling
# Feb 3, 2016
# 1. (40 points)
# Use a list comprehension to load the data from a file named “race.txt”.
# There’s a sample file on Oncourse with the data shown above.
fileContents = [line.strip().split(" ") for line in open("i211-assets/race.txt", "r")]
vowelList = ["a", "e", "i", "o", "u"]
# 2. (20 p... |
a242041cc80b354c9d73e3018c8236fb9ecc8e95 | tanvi1706/practiceLeetCode | /306.py | 694 | 3.59375 | 4 | class Solution:
def AdditiveNumber(self,num: str) -> bool:
def backtrack(self, num1: str, num2: str, rem: str) -> bool:
if not rem:
return True
target = str(int(num1) + int(num2))
if rem.startswith(target) and all(str(int(x)) == x for x in (num1, num2)):
... |
71990cca17051663ed35f00b26f0688afa05b98a | Sergey-Mirzoyan/6-semester | /Моделирование/4+/lab4.py | 4,309 | 3.515625 | 4 | from numpy import arange
import matplotlib.pyplot as plt
class Data:
x0 = -5
l = 10 # Длина стержня (cm)
R = 0.5 # Радиус стержня (cm)
Tenv = 0 # Температура окружающей среды (K)
F0 = 50 # Плотность теплового потока (W / (cm^2 * K))
k0 = 0.1 # Ко... |
34ad8d42b21f82165571b7a0c3b9a37ecb722ee5 | JuanMacias07x/30abril | /ejercicio 45.py | 463 | 3.921875 | 4 | #Progama que imprima los números naturales contenidos entre dos números n y m (verificar que m>n).
number1 = int(input("Ingrese el primer número = "))
number2 = int(input("Ingrese el segundo número = "))
if number2 > number1:
for i in range(number1,number2):
print("Los números naturales que hay entre l... |
15da8670836b5f92e88e34df9e8f80985518c1ee | prajwalmore5/python-mini-challenges | /code.py | 1,866 | 3.90625 | 4 | # --------------
#Code starts here
def palindrome(num):
while True:
num+=1
if str(num) == str(num)[::-1]:
return num
break
print(palindrome(123))
# --------------
#Code starts here
#Function to find anagram of one word in another
def a_scramble(str_1,str_2):
r... |
af4c3af947c07768259483e97c0ec173c278c1af | syurskyi/Algorithms_and_Data_Structure | /_algorithms_challenges/codewar/_Codewars-Solu-Python-master/src/kyu3_Make_a_Spiral.py | 9,455 | 3.546875 | 4 | class Solution():
"""
https://www.codewars.com/kata/make-a-spiral
Your task, is to create a NxN spiral with a given size.
For example, spiral with size 5 should look like this:
00000
....0
000.0
0...0
00000
and with the size 10:
0000000000
.........0
00000000.0
... |
94b097c44d52bdc80a32e151c2b5fe92f5c32a69 | yuu1127/projects | /UniDocuments/Algorithm_Python/maze.py | 26,158 | 3.609375 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 9 12:34:23 2018
@author: yuta
"""
import sys
from copy import deepcopy
from collections import defaultdict
import os
class MazeError(Exception):
def __init__(self,message):
self.message = message
class Maze:
def __init__(self,fi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.