blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
545k
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
545k
49c8e85e8e4733d5f58844d8b55ffd64200b15ca
robert456456456/my_code
/jenkinsPython/tests/FirstPythonTest.py
221
3.5
4
''' Created on Sep 10, 2013 @author: Shimon ''' print("Hello python"); def add (a, b): return a + b def addFixedValue(a): y = 5 return y + a; print("Text"); print (add('1', '2')) print (addFixedValue(1))
d9b5ac13f38754635055d7e3eedbc6c62d1491ee
TheStryker26789/CSE2
/Basic Python Notes.py
285
3.984375
4
print("Hello World!") # print("Welcome to class!") # This is a comment # This does not run, but allows me to # write notes to myself (or a teacher) """ This is a multi-line comment """ # Variables a = -5 b = -4 c = "hello!" d = "Jeffery" # print(-5 - (-1)) # print(a - b) print(c)
2315a19392e069c7f124d941f1cfef11146e4a0e
Pranay144/subset-sum
/subset-sum.py
1,315
3.53125
4
import random L = random.sample(range(1,10001),1000) # generate random list in the given range L.sort(reverse=True) # sort in descending order print(L) S = sum(L) # sum of the given set T = int(input()) # Target sum L_final = ...
4c4febfaa516f812ef63cdd10874b36098b4ed27
tharindupr/Algorithms
/Extreme 8.0/K val_IEEE Electronic Devices Society.py
3,777
4.03125
4
import bisect case= list(map(int,input().split())) # create a list of Integer from a list of String N=case[0] #5 M=case[1] #3 k=case[2] #2 k value numbers=list(map(int,input().split())) '''Consider the given numbers 6 5 3 4 2 When M is 3, circularly arranged numbers of above integers will look like 6 5 3 4 2 6 5 ...
a5caaef3e42f57faa67161c25958965eff4263ac
marireynoso00/Tp-3trim-Reynoso-Rivarola
/Menu.py
4,990
3.5
4
from conexion import DB from claseCliente import Cliente from claseMenu import MenuComida from claseEmpleado import Empleado from claseSucursal import Sucursal DB().SetConection('127.0.0.1', 'root', 'alumno', 'mydb') conexion=DB() menu=MenuComida() unEmpleado=Empleado() UnitaSucursal=Sucursal() class Menuu(object): ...
8e295f0551fbcd172eb3cc5ab750d9452f1f985c
samtaplin/Azul
/azul/azul.py
19,461
3.75
4
# -*- coding: utf-8 -*- """ Created on Mon Dec 23 19:59:57 2019 @author: Sam Taplin """ import random import decision """Takes in manual input and returns the move chosen by the player""" def decidemove(playerboard, oppboard, factories, floor, game, midtake): chfact = input("Which factory do you want to ...
eb2088f52f68354dd556ee5951221ca64af87663
skotagiri95/Election_Analysis
/PyPoll.py
3,736
4.1875
4
# The data we need to retrieve #1. THe total number of votes cast #2 A complete list of candidates who received votes #3 The percentage of votes each candidate won #4 The total number of votes each candidate won #5 The winner of the election based on popular vote import csv import os from os import path #path to loa...
5e5eb7061a9599bc40b7fc787c165cec42118f47
navoday-91/CMPE273-Spring18
/Lab-2/With 3D Visuals/Test.py
531
3.53125
4
import keyboard while True: try: keyboard.read_key() print(keyboard._key_table) if keyboard.is_pressed(keyboard.KEY_UP): req = [0,1,0] if keyboard.is_pressed(keyboard.KEY_DOWN): req = [0,-1,0] if keyboard.is_pressed(keyboard._key_table): r...
f45f83060e9f1cd72969ea19e2fcbd392ee8b5df
ibeckermayer/PowerSupplyInterface
/PowerSupplies/Errors.py
772
3.75
4
class Error(Exception): """Base class for exceptions in this module.""" pass class ChannelError(Error): """Error is raised when user gives a channel other than 1 or 2""" def __init__(self, chan): self.chan = chan def __str__(self): return "Invalid channel number " + repr(self.cha...
670b06b64632c3a6ba43ae08be6f3345e6fd9aae
zlsh80826/Algorithm
/UVa/UVa12289.py
390
3.671875
4
if __name__ == '__main__': r = int(input()) for i in range(r): word = input() if len(word) == 5: print(3) else: one = 'one' cnt = 0 for w, o in zip(word, one): if w == o: cnt += 1 if cnt >=2...
0777d2b569aa145a54a760e2b9c7d7047b8b5e76
jasmeetkr/Python-Tkinter-FrameWork
/Scramble_Words.py
4,389
3.625
4
from tkinter import * from tkinter import messagebox import nltk from nltk.corpus import words from time import gmtime, strftime import time from collections import Counter nltk.download('words') word_list = words.words() Matrix_list=['a','r','b','z','t','n','d','h','m','v','s','x','l','u','g','y','p','k','c','o'] scor...
44950099060c52e6a7774e3ce69f13dd6828d25a
egajavier/simpletamagochi
/tamagochi.py
692
3.6875
4
pemilik = input('Siapa Nama Kamu ? \n') print('Halo '+ pemilik +' Selamat Bermain, Silahkan Masukkan Nama Pet Kamu') name = input('Siapa Nama Pet Kamu ? \n') pet = {"nama" : name, "health" : 100} def startGame(): menu = input('\nApa Yang Ingin Kamu Lakukan ? \n 1. Makan \n 2. Periksa \n 3. Keluar \n') if menu...
7f6ef7f060c714da6ef253f289391917e555c742
comesanha/pyclass
/scriptpy/CursoemVídeo/Tipos Primitivos.py
3,750
4.4375
4
''' Programa: Tipos Primitivos Autor:Raphael Comesanha Período de Elaboração: 19/01/2020 Finalidade: Mostar o tipo da variável; converter uma variavel de um tipo para outro; Revisão de variavel formatada; concatenção de strings; mostrar variaveis interligadas e de tipos diferentes na tela. (máscara); ...
ff7cfc3effd90c4d984314840b8a1aa55b165606
sagarkukreja/Python-and-Data-Structures
/Lab1/myname.py
4,650
3.84375
4
__author__ = 'sk' """ CSCI-603 : Assignment 1 Author: Sagar Kukreja (sk3126@rit.edu) This is a program that draws person's last name using turtle. It demonstrates the importance of using a hierarchy of functions that can be re-used. """ import turtle # global constants for window dimensions WINDOW_...
8c5cad2a50aa35a7f873cf7af2d67e146e4911b0
NelsonarevaloF/holberton-system_engineering-devops
/0x16-api_advanced/2-recurse.py
1,092
3.546875
4
#!/usr/bin/python3 """Function that queries the Reddit API and returns a list containing the titles of all hot articles for a given subreddit. If no results are found for the given subreddit, the function should return None.""" import requests def recurse(subreddit, hot_list=[], after=""): """Returns a list conta...
621303df5985006547bfd3f5523ee542fdab74af
objoyful/our-code
/MachineLearning/ml15.py
161
3.578125
4
from math import sqrt q = [1, 3, 10] p = [2, 5, 13] def find_distance(q, p): n = len(q) return sqrt(sum([(q[i] - p[i]) ** 2 for i in range(n)]))
78f98fc8b095877a273b958697e8662ffc787818
objoyful/our-code
/LPTHW/list.py
170
3.734375
4
grocery_list = ['Pop-Tarts', 'Milk', 'Bananas', 'Apples', 'Spoons', 'Plates'] print("Here's the things on the list.") for thing in grocery_list: print(thing)
483a125be89d940ca1a50eca961099b4a0066d44
objoyful/our-code
/SentdexBasics/iterable.py
234
3.703125
4
import itertools x = [1, 2, 3, 4] for i in x: print(i) print("=====") n = itertools.cycle(x) print(next(n)) print(next(n)) print(next(n)) print(next(n)) print("======") y = iter(x) for i in y: print(i)
40bbbaa900fa528e53569ea377a2083c1cddc834
zacharybarbanell/zahlen
/ds/tree/order_statistics_tree.py
4,184
3.5
4
# -*- coding: utf-8 -*- """ zahlen.ds.tree.order_statistics_tree ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module implements the Order Statistics Tree data structure. :copyright: (c) 2014 by Subhajit Ghosh. :license: MIT, see LICENSE for more details. """ import avl_tree class Node(avl_tree.No...
a2d7ce4a1baf480c77565905282a226fefbeacf7
jd1224/security-test
/MissingFixed.py
2,491
3.640625
4
from user import User import time def program_login(): print('Welcome to the Missile Console') user = input('Please enter your username: ') password = input('Please enter your password: ') print('Authenticating....') try: client = User(user, password) client.authenticate_user() ...
8f6c93ab10cdf77c7d6d78df3e8c3a1decec54be
lmz2932/learnpython
/concurrency/threading/3.py
696
3.734375
4
# -*- encoding:utf-8 -*- import threading import time counter = 0 class MyThread(threading.Thread): def __init__(self, lock): super(MyThread, self).__init__() self.lock = lock def run(self): global counter self.lock.acquire() counter += 1 self.lock.release() ...
d36b45133774ce0342731d677d89d2f69969d7b0
lmz2932/learnpython
/concurrency/threading/6.py
1,664
3.671875
4
# -*- encoding: utf-8 -*- import threading products = 0 c = threading.Condition() class Producer(threading.Thread): def __init__(self): super(Producer, self).__init__() def run(self): global products, c while True: # 获取条件对象锁 c.acquire() if product...
085ae27571966596ddade3d13f302743d0d1347a
Murmele/qgis-igc-importer
/datatype_definition.py
4,475
3.65625
4
from datetime import * import re class DataTypeDefinition: """ Datatype definition class """ def __init__(self, attribute_key, datatype, selected, example_value): self.attribute_key = attribute_key self.attribute_key_modified = attribute_key self.datatype = datatype self.selec...
4ec80df05190eb0ee85e3262749bd8c5f2f2aa81
muyurainy/interview
/python/Data_Structure_Algorithm/bfs_dfs.py
1,073
3.984375
4
# -*- coding: utf-8 -*- from collections import deque class TreeNode: def __init__(self, val): self.val = val self.left = None self.right = None def BFS(g): '''BFS Parameter --------- g: 二叉树 Return ------ BFS遍历序列 ''' queue = deque() queue.append(g) ...
e31e7c322a1f717016657cc540ce4a238b114f4a
zymm21/research-product-dictionary
/finalproject.py
8,603
3.546875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Apr 20 11:51:55 2020 @author: qingji """ import math def split(txt): s = '' lst = [] for i in txt: if i not in '.?!': s += i else: lst += [str(s)] s = '' new_lst = [] ...
e18d438fa54132e00179ab3f199043965d885cd7
Lucas-Probst/jogoDaForca
/jogoForca.py
9,743
3.53125
4
import PySimpleGUI as sg import random # OBS: E PRECISO INSTALAR NO WINDOWS A FONTE "LED Calculator" def gerar_palavra(): global palavraAuxiliar arquivo = open("palavras.txt", "r", encoding="utf8") # abre o arquivo palavras.txt que está localizado na mesma pasta do jogo palavrasArquivo = [] for linha...
ca79442d1ee7376a26e6faacd739cf7535585d86
user-ZJ/deep-learning
/VGG16/TensorFlow/VGG16.py
6,069
3.5
4
import tensorflow as tf '''Convolution op wrapper, use RELU activation after convolution Args: layer_name: e.g. conv1, pool1... x: input tensor, [batch_size, height, width, channels] out_channels: number of output channels (or comvolutional kernels) kernel_size: the size of convoluti...
5e970de06d604ca34cd9ef205cf2f83d20e20d17
gabgerson/first-markov
/markov.py
2,602
4.0625
4
"""Generate Markov text from text files.""" from random import choice import sys def open_and_read_file(file_path): """Take file path as string; return text as string. Takes a string that is a file path, opens the file, and turns the file's contents as one string of text. """ with open(file_pat...
0c4e278407196e774965b8714518c6e3ec74235b
gaga201702/backend
/code/class2.py
539
3.671875
4
class Foo(): def __init__(self): self.id = 8 self.value = self.get_value() def get_value(self): pass def should_destroy_earth(self): return self.id == 42 class Baz(Foo): def __init__(self): print("init foo") def get_value(self, some_new_parameter): "...
f07c07c5212beba719e0afa7938890008ef6dfe6
Fladmark/wInterpreter
/main.py
3,046
3.859375
4
# Learning how to make a basic programming languages # Much of this code is not made by me, much credit to # https://github.com/davidcallanan # Characters DIGITS = '0123456789' # Errors class Error: def __init__(self, error_name, details): self.error_name = error_name self.details = details ...
616b3de3004fd482e855283d3caed5bdf0889db6
chong-brian/bitesofpy
/16/gendates.py
1,281
3.703125
4
from datetime import datetime PYBITES_BORN = datetime(year=2016, month=12, day=19) def gen_special_pybites_dates(): dates = [] working_date = PYBITES_BORN while working_date.year < 2019: for x in range(1, 101): try: working_date = datetime(year=working_date....
5ef61d947c51a4f5793a005629f22e6ca44e4cbf
iamdeepakram/CsRoadmap
/python/regularexpressions.py
1,106
4.1875
4
# find the patterns without RegEx # some global variable holding function information test = "362-789-7584" # write isphonenumber function with arguments text def isPhoneNumber(text): global test test = text # check length of string if len(text) != 12 : return False # check area code fro...
1ea5cd29cb011c603914dbe6ff34d06a80771d80
AkylaiD/test_repo
/lesson_2.py
1,319
4.09375
4
books = {'Financial': 'Theodor Draiser', 'Rich dad, poor dad': 'Robert Kiyosaki', 'Think and get rich': 'Napoleon Hill'} readers = {} def get_info(): print(f'На данный момент список читателей такой:\n{readers}') print(f'Список книг такой:\n{books}') # def manager(): def give_book(): book = input(f'Какую...
cf86cf776724b08ccfb048972fee4461b7251450
pykili/py-204-hw1-EkaterinaVoit
/task_7/solution_7.py
153
3.953125
4
# your code here string = input() is_palindrom = False a = '' for i in string: a = i + a if string == a: is_palindrom = True print(is_palindrom)
a9a3886f4ac5565948fe95547968be47f7e1d7b4
KanikaParikh/Daily_Coding_Problems
/Solutions/Que035.py
678
3.90625
4
def helper(array, start, end, letter): i = start j = end last_index = -1 while i < j: if array[i] == letter: last_index = i i += 1 elif array[j] != letter: j -= 1 else: last_index = i temp = array[i] ...
a9f1ada90a5dcf50f947f41cd5fb39af72213ec9
KanikaParikh/Daily_Coding_Problems
/Solutions/Que040.py
462
3.921875
4
# SIZE = 32 def non_duplicate(array): non_dup = 0 for i in range(0, 32): i_bits = 0 # '<<'- left shift operator -- multiplies number with 2 in decimal x = 1 << i for j in range(len(array)): if array[j] & x: i_bits += 1 if i_...
524292a33b3cc0aa48bbdb935dfd82de9fe5634b
SinclairPythonAkoto/SafeStreets
/safe_streets-test2.py
1,673
3.671875
4
# Safe Streets - find 2020 crime stats with postcode from Police Data API import requests import datetime from geopy.geocoders import Nominatim import time # instantiate a new Nominatim client app = Nominatim(user_agent="tutorial") # make the user input a function def user_address(): """ Function to promp...
f474519751e3e3345d362ad72165a4297b74995b
denniszl/maths
/ackermann/ackermann.py
776
3.984375
4
import sys sys.setrecursionlimit(300000) def ackermann(m, n): """ The Ackermann function can be defined using this recurrence: A(m,n) = { n+1 if m = 0 A(m-1,1) if m > 0 and n=0 A(m-1, A(m,n-1)) if m > 0 and n > 0 } where m and n a...
cbe5c727b88d2036eae9242198dd0085f397d99a
ramoncelestino/python-exercises
/HackerRank/removeVowelsString.py
238
3.671875
4
import unittest def removeVowels(s): s = list(filter(lambda x: not is_vowel(x), list(s))) return ''.join(s) def is_vowel(s): if s == 'a' or s =='e' or s == 'i' or s == 'o' or s == 'u': return True return False
7d6afa254d67d1ef7f52b916c37bcf699afff11a
ramoncelestino/python-exercises
/Strings.py
160
3.921875
4
import re def remove_vowels(str): s = re.findall(r'[^aeiou]*', str) print(''.join(s)) remove_vowels("Hoje e aqui na festa tentar encontrar cachorro")
2aa3df6874ac6fad6fe7570aca96b411ec7d0994
exskandr/my_education_for_book_study_e.matiz
/e_matiz_exercise/json_ex.py
1,853
3.859375
4
import json def get_stored_username(): """Get stored username if available.""" filename = 'username.json' try: with open(filename) as f_obj: username = json.load(f_obj) except FileNotFoundError: return None else: answer = input(f'Are your name {username}? YES/NO ...
12e44bb0071028e78a7c56f318036919e5700cc1
exskandr/my_education_for_book_study_e.matiz
/e_matiz_exercise/main.py
1,988
3.671875
4
# alien_color = ['green', 'yellow', 'red'] # color = 'yellow' # if color != 'green': # print('you get 10') # else: # print('you get 5') # if color == 'green': # print('5') # elif color == 'yellow': # print('10') # elif color == 'red': # print('15') # favorite_fruits = ['banane', 'apple', 'ananas']...
5099a85656f7103b8ca6a1ff91e8a4d5443bb881
Mapoleto/COH-PIAH
/coh_piah.py
6,520
3.9375
4
import re def __main__(): ass = le_assinatura() textos = le_textos() print("O autor do texto ",avalia_textos(textos,ass)," está infectado com COH-PIAH") def le_assinatura(): '''A funcao le os valores dos tracos linguisticos do modelo e devolve uma assinatura a ser comparada com os textos fornecidos'''...
bbec994658e29853ce3980f80e912aa19c1085b0
cp-helsinge/base1
/game_objects/story.py
3,810
3.84375
4
'''============================================================================ Story board for 1200 x 800 screen resolution Each level board consist of a list of objects, that occur on the level. Including background, player and all other objects that occur in the game, but also a next_level object, that plays, wh...
8d9b4873c643e06fd464ef9641252d22cd83a016
niturobert/RandomArtGenerator
/RandomArtGenerator/pixels.py
491
3.59375
4
""" Semplice algoritmo di scrittura. """ from PIL import Image, ImageDraw from random import randint from config import * SQUARE_SIZE = 8 with Image.new('RGB', (IMAGE_WIDTH, IMAGE_HEIGHT)) as image: draw = ImageDraw.Draw(image) for y in range(0, IMAGE_HEIGHT, SQUARE_SIZE): for x in range(0, IMAG...
3a3f60634d7592f8f12a6b6f8f7cdc8b9d03479a
lalit-code/Voice-Assistant-FRIDAY-
/Friday.py
4,824
3.546875
4
import pyttsx3 import speech_recognition as sr import pyaudio import datetime import os import wikipedia import random import pyjokes import webbrowser # Function for taking voice input def take_command(): me = sr.Recognizer() with sr.Microphone() as micvar: print("Listning...") audio = me.list...
8c41b4912a0968cf293afab7daeec9428bc3dac7
Faheemzaman/python-scripts
/master.py
17,488
4.25
4
''' to make script executable''' #executable #mode $ chmod +x test.py # This is to make file executable $./test.py #variables A variable is created the moment you first assign a value to it. Python allows you to assign values to multiple variables in one line x, y, z = "Orange", "Banana", "Cherry" print(x) p...
3e8349bcd049fde26b3ad8a4c7789d0b8b1682da
better331132/hello
/trythis_mixed_input_class.py
1,147
3.796875
4
class 평행사변형: def area(self, C1, C2): return(C1 * C2) class 직사각형(평행사변형): def area(self, B1, B2): return(B1 * B2) class 정사각형(직사각형): def area(self, A): return(A ** 2) 사각형A = 정사각형() 사각형B = 직사각형() 사각형C = 평행사변형() while (True): print() opt = input("사각형의 종류를 번호로 입력하세요.\n 1)정사각형\n...
15ae6a354fb6c59306d294cec4a3db8656e3f790
better331132/hello
/study.py
534
3.75
4
#lst1 = [*"Camus"] #for i in lst1: # print(i) #dic1 = { "키" : 200 } # me = { # "height": "6", # "fav_color": "red", # "fav_author": "Orwell" # } # answer = input("Type height, fav_color or fav_author >> ") # if answer in me: # result = me[answer] # print(result) # print(me[height]) frui...
b91733a9e8050ec851b412a322c4ca86224f462e
better331132/hello
/review2.py
548
4.125
4
#변수 Variables (문자열) 'hello'"world" print('hello'"world") print('hello',"world") #문자열 변수 사이의 ,는 결과에서 공백으로 나타남 message = "hello world" print(message) print(message[0:5]) print(message[:6]) #공백 또한 하나의 문자로 취급 print(message[:-4]) print(len(message)) print(len(mes...
1c25a2582bedaca93d5de2fb4e07253e5c03ec28
better331132/hello
/exam/students_profile.py
1,754
3.59375
4
import sqlite3 grade = ['F', 'D', 'C', 'B', 'A'] class Students: def __init__(self, line): name, gender, age, score, addr = line.strip().split(',') self.name = name self.score = int(score) self.addr = addr self.kgender = gender self.age = int(age) def __str__(se...
24779eaa9cf7b2641b99f986c9e60aafe365f3d1
xav99/Smartbot
/regex_search.py
3,023
4.15625
4
import re noNumbers = lambda x: re.findall("[^0-9 ]", x) # excludes whitespace char noLetters = lambda x : re.findall("[^A-Za-z ]", x) # excludes whitespace char #numberRange = lambda x: re.findall("[0-5][0-9]", x) def searchText(searchterm, text, maxoccurence=1, suppress=False): """ Searches the te...
90eb3e60c68490548484e774585daa87c2c72fe8
xav99/Smartbot
/WordsAfterCom.py
587
3.828125
4
def checkCommandArgs(string, command, addwhitespace=False): ''' Returns any words after the command we use ''' string = string.split() for i in range(len(string)): if string[i] == command: try: x = "" string = string[i+1:] ...
a9ddf1447d703413b61db107ac28f0eccce5af58
scottstanie/apertools
/apertools/log.py
3,509
3.609375
4
""" This module exports a Log class that wraps the logging python package Uses the standard python logging utilities, just provides nice formatting out of the box. Usage: from apertools.log import get_log logger = get_log() logger.info("Something happened") logger.warning("Something concerning happe...
c13314d0c4f2a869b4787f4965724f4ca7482864
RustyDanya/programming-on-python
/lab_03/03_Защита_уточнение_корней.py
2,483
3.59375
4
from math import * def func(x): return sin(x) def proizv(x): return cos(x) def method(a, b, eps, maxim): x0 = a x1 = b f0 = func(x0) f1 = func(x1) n = 0 if f0*f1 > 0: return 'no', 0 while n < maxim: x1 = x0 - (func(x0) / proizv(x0)) if abs...
ae4f2a504a659d5b5d1ca6b52ed187c72735d9df
aklgupta/pythonPractice
/Q1 - balanced paranthese/balanced_paranthese.py
1,000
4.03125
4
"""Team Practice Q1. Given a string expression s, write a program to test whether the pairs and the orders of “{“,”}”,”(“,”)”,”[“,”]” are correct in s. Sample Input: s = “[()]{}{[()(){}[]]()}” Output: True Sample Input: s = “[(])” Output: False Assume that the user input string is not allowed to contain...
b3a1e3ab177fac333bc9ee0a5a0b379751807f58
aklgupta/pythonPractice
/Q4 - color maze/color_maze.py
2,950
4.375
4
"""Team Python Practice Question 4. Write a function that traverse a color maze by following a sequence of colors. For example this maze can be solved by the sequence 'orange -> green'. Then you would have something like this For the mazes you always pick a spot on the bottom, in the starting color and try to get to...
227e6f3db9fed1df2df0c1042e77b31a6288a7f6
pavit939/A-December-of-Algorithms
/December-27/vowels.py
402
3.5
4
def vowels(l1): listone=len(l1) flag=0 for i in range(listone - 1): listtwo=len(l1[i]) for l in range(listtwo - 1): if l1[i][l] in 'aeiou' and l1[i][l+1] in 'aeiou' and l1[i+1][l] in 'aeiou' and l1[i+1][l+1] in 'aeiou': print(i,'==',l) flag=1 i...
2e2040449bac85c3dcabef42f995a2bef7c00966
pavit939/A-December-of-Algorithms
/December-09/url.py
444
4.1875
4
def https(s): if(s[0:8]=="https://"): return '1' else: return '0' def url(s): if (".com" in s or ".net" in s or ".org" in s or ".in" in s): return "1" else : return '0' s = input("Enter the string to check if it is an URL") c = https(s) if c =='1': u = url(s) if u...
c9cca5aaed637fbd44f3d355095a2348f7b3e1ba
pavit939/A-December-of-Algorithms
/December-04/fibo.py
145
4.03125
4
n = int(input("Enter a no:")) a = 0 b = 1 print("The fibonacci series is:") for i in range (n): print(a) c = a + b a = b b = c
27203d4e52b47dc3b0663754bec02d2406515ddb
dwinurhadia/python-beginner
/MathMethod.py
297
3.90625
4
# print(10/3) # +-*/% // << operator matematika biasa # x = (10 + 3) * 2 ** 4 # print(x) # exponential 2 ** 2 << pangkat # multiplication or division # addition or substraction import math # math.asin(x) x = 2.9 print(round(x)) print(abs(-2.1)) # https://docs.python.org/3/library/math.html
1d2235c7d4d143501a9a194c100ded229d021865
dwinurhadia/python-beginner
/ClassExcersise.py
229
3.578125
4
class Person: def __init__(self,name) -> None: self.name = name def talk(self): print(f"Hi, I'am {self.name}") john = Person("John Smith") print(john.name) john.talk() bob = Person("Bob Some") bob.talk()
3d26a9d71d43275417057ccc2d97b23536af3de5
dwinurhadia/python-beginner
/Class.py
199
3.609375
4
class Point: def __init__(self,x,y): self.x = x self.y = y def move(self): print("move") def draw(self): print("self") point = Point(20,30) print(point.x)
63488064897109f0ba3806912b1fcf38e759a97f
Krishna-Mohan-V/SkillSanta
/Assignment101-2.py
964
4.40625
4
# Python program to find the second largest number in a list # Method 1 lst = [] num = int(input("Enter the Number of elements for the List: ")) for i in range(num): elem = int(input("Enter the list element: ")) lst.append(elem) print("List Elements are: ",lst) lst.sort() print("Second largest...
463ed11f32afc35707d506f2cebb344fd2b3d1ac
fj0lverkr/AdventOfCode2020
/day_2.py
1,641
3.953125
4
""" Puzzle 1 and 2: How many passwords are valid according to their policies? Policy 1: password needs to contain min and max occurrences of a given character. Policy 2: password needs to have a given character at either position 1 or position 2. """ DATA_SET = "datasets/day_2_puzzle_1.txt" def puzzle_1(): with ...
61a698a286ca6bc2b66865d38fac5f6c34a0db01
Ernjivi/bedu_python01
/Curso-de-Python/Clase-02/Soluciones/genera-claves.py
2,880
4.03125
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ El script deberá de crear e imprimir una lista de n claves de longitud m incluyendo cuando menos una minúscula, una mayúscula y un dígito. Los valores de n y m serán solicitados al usuario y m deberá tener el valor de 8 en caso de que el usuario no proporcione ninguno...
ec46f2657b2d0cc36963169d7016ee7c17f1fd07
Ernjivi/bedu_python01
/Curso-de-Python/Clase-03/12-lista-de-personas.py
1,948
3.921875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Crear e imprimir una lista de tres personas donde cada persona incluya nombre, apellido paterno y edad, además cada persona deberá de ser una instancia de la clase Persona(). Se debe hacer uso de las funciones obtener_personas() e imprimir_personas(). """ # Se defina ...
48c8aea2be56507a047102f4505d612514145707
Ernjivi/bedu_python01
/Curso-de-Python/Clase-03/soluciones/44-proyecto-final/notas/producto.py
869
3.765625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Define la clase Producto así como las funciones y constantes auxilares para este objeto. """ # Se define la clase Producto() con atributos: nombre, cantidad y precio class Producto: """ Se define el objeto Producto """ def __init__(self, nombre, cantidad, prec...
3b007e9ed267ca8ad1c22e0e34284734daf84d90
Ernjivi/bedu_python01
/Curso-de-Python/Clase-02/listas-de-enteros-funciones.py
1,734
4.21875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ El script deberá de crear e imprimir la lista de números enteros con N elementos, el valor de N será proporcionado por el usuario, por lo que se sugiere hacer uso de dos funciones. """ # No inicies a escribir el script desde aquí, ve al final del script e # inicia ...
71d75a47755ce040d254ff39bf2821e6f8e03e35
Ernjivi/bedu_python01
/Curso-de-Python/Clase-02/Soluciones/productos-subtotales.py
1,840
3.546875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Modifica el script productos-con-listas-de-diccionarios.py para que imprima una columna adicional con título Subtotal y los valores se obtienen al aplicar el descuento al precio del producto Sugerencia: El valor del descuento está expresando en porciento, así qu...
11bf76d66b129f28d0822e78575ea0069758cc49
Ernjivi/bedu_python01
/Curso-de-Python/Clase-02/productos-ordenados.py
1,352
4.03125
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Usar script productos-con-listas-de-listas.py como base e imprime la lista de productos ordenadas en base al precio. """ # Se crea una lista de listas con todos los productos en la variable # llamada productos productos = [ ["Automóvil", 150000.00], ["Bicic...
40d92d8d26105c813762bbaaf0ca6165692e5266
Sens3ii/ICT2020
/labs1/24.py
149
3.71875
4
Days = int(input()) Hours = int(input()) Minutes = int(input()) Seconds =int(input()) print(Seconds+Minutes*60+Hours*60*60+Days+60*60*24,"sec")
1f751e489db13c93942bd01a49b447cc182dacd0
Sens3ii/ICT2020
/labs1/30.py
174
3.5
4
a = int(input()) print('millimeters of mercury ', a / 133, 132 * 1000) print('pounds per square inch ', a * 1000 / 6894, 75729) print('atmosphere ', (a * 1000 / 101325))
51935da791f63fc549027dba15b05d2864bfe0c4
cemac/LIFD_ENV_ML_NOTEBOOKS
/ToyNeuralNetwork/neural_network_from_scratch.py
2,282
4.0625
4
"""NeuralNetwork Example This is a simple example of a 2 layer neural network written in python based off of James Loy (Georgia Tech) work """ import numpy as np def sigmoid(x): """sigmoid activation function """ return 1.0/(1 + np.exp(-x)) def sigmoid_derivative(x): """sigmoid_derivative ...
d601f29d023c280d55cdaa97666da1686b5b0652
peterwilliams97/utils
/fibonacci.py
3,454
3.921875
4
from __future__ import division """ http://bit.ly/ooOVLN says Cutting-edge communities, like Node.js and Ruby, encourage fast-paced innovation (though sometimes at the cost of application breakage). Conservative communities, like Java, favor a more responsible and predictable appro...
a7c65fa293a3a142c4314e2fc3d37a07ea0f8d68
aproddut/qontract-reconcile
/utils/aws/route53/__init__.py
7,452
3.5
4
import re octal_re = re.compile(r'\\(\d\d\d)') def _octal_replace(s): """ Replace octal characters with the actual ASCII character See http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ :param s: source string :type s: str :return updated string :rtype str """ return oct...
40a41306e2c141791ec4b7f8def15b0c2031b8c3
gmcapra/Python-Machine-Learning
/Support Vector Machines/practice_svm_python.py
5,072
4.1875
4
""" Intro to Support Vector Machines with Python Gianluca Capraro Created: May 2019 PRACTICE EXAMPLE DESCRIPTION --------------------------------------------------------------------- Use a Support Vector Machines Classification Model with sample data to predict whether a tumor is malignant or benign. -----------------...
5525f67df7d4661eb146924740aa5c6aeb32847c
nophora/Snake-Game
/snake-game/snake.py
1,634
3.921875
4
from turtle import Turtle INITIAL_COORDINATE = [(0, 0), (-20, 0), (-40, 0)] MOVE_DISTANCE = 20 UP = 90 DOWN = 270 LEFT = 180 RIGHT = 0 class Snake: def __init__(self): self.snake = [] self.create_snake() self.head = self.snake[0] def create_snake(self): for position in INITI...
40c7c53c964d5424258d691ad3c735010129cfb8
experimental-informatics/beatnik
/beatnik/preprocess_text.py
546
3.734375
4
#Preprocessing text #input a String as text, than output a list of words as corpus #This function is suited for standard German and English. #For more language, change the character for exchangement. import re def preprocess(text): text=text.replace("ä","ae").replace("Ä","Ae").replace("ö","oe").replace("Ö","oe")....
b5def8987a66311b131d0dabc986d2ce2f444258
Snadman/SE126
/Lab3/Lab3B.py
2,262
3.96875
4
#Name: Ethan Carrera #Date: 8/17/2021 #Lab 3B #this lab is about the voting process and who can and cannot be a voter aka invalid or not #-------------NOTES-------------- #ID number #age #if the person is registered to vote # if the person voted. #--------VARIABLE DICTIONARY-------------- #idNum = the ID number ...
2c97e09ce4a6e7781155ca54d749470382fdb2dc
Snadman/SE126
/Lab6/LabB.py
5,014
3.828125
4
#Name: Ethan Carrera #Date: 9/6/2021 #Lab B #--------------------------------------- #Variable Dictionary # # # # # # #--------------------------------------- import csv #Clearing and sleeping----------------- from os import system, name from time import sleep def clear(): # for windows if name =...
c2fd628eb90d4378b450cdb13488f5c5d46282bb
erkkke/Python2020
/informatics/Integer arithmetics/R.py
290
3.78125
4
a = int(input()) time = (45 * a) even = 0 odd = 0 for i in range (1, a, 2): if(i < a): odd = odd + 1 for i in range (2, a, 2): if(i < a): even = even + 1 time = time + (odd * 5) + (even * 15) hour = (time // 60) + 9 min = time % 60 print (hour, min)
0cda690284d1866a0591f129144d80bb4841cbfc
erkkke/Python2020
/informatics/For/2.py
227
3.875
4
def isPrime(n): if n == 2: return True for i in range(2,int(n**0.5)): if n%i==0: return False return True a = int(input()) if isPrime(a): print("Yes") else: print("No")
7863c417c772a2d5e305692a2b74a66475fb385d
zhoucrawl/leetcode
/4-Unique Paths.py
2,270
3.625
4
#分治法 class Solution(object): def uniquePaths(self,m, n): """ :type m: int :type n: int :rtype: int """ if m < 1 and n < 1: return 0 if m==1 and n==1: return 1 return self.uniquePaths(m-1,n)+self.uniquePaths(m,n-1) #动态规划 ...
800b26a1063d3d422e77151bd15fb239bd596798
elcaminoreal/caparg
/src/caparg/test/test_subcommands.py
5,906
3.546875
4
""" Testing for Captain Arguments' sub-commmands! """ from typing import List import unittest import caparg class SubcommandTester(unittest.TestCase): """ Subcommand parsing tests """ def test_simple(self): """ Parsing a subcommand with one positional returns subcommand and position...
c40f7bcb7a0476fa9426a9f67b57d75b3ced3540
partridgems/advent2018
/day1/day1.py
234
3.546875
4
import sys freq = 0 for line in sys.stdin.readlines(): if line[0] == '+': freq += int(line[1:]) elif line[0] == '-': freq -= int(line[1:]) else: print("Error. Invalid input") print("Final frequency is", freq)
fc41f905b125126a25049018b4f9dca568ca53be
eLtronicsVilla/Machine-Learning-Tutorial
/Regression/RandomForestRegression/random_forest_regression.py
1,675
3.625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Apr 13 17:36:15 2019 @author: brgupta """ # Randome tree forest regression method # Step 1: Pick a K random data point from the Training set # step 2: Build the decision tree associated to these data point # step 3: Choose a number Ntree of tree you w...
e2cbf43cca8f1506577548678806af6991574920
eLtronicsVilla/Machine-Learning-Tutorial
/DimensionalityReduction/LinearDiscriminantAnalysis(LDA)/lda.py
3,577
3.640625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 1 21:52:19 2019 @author: brgupta """ # LDA used as a dimensionality reduction technique # Used in the pre-processing step of pattern classification # LDA differs because in addition to find the componenet axes with LDA. # The goal of LDA is to p...
38ae28513d88a0c968203dc4f33631d531a12b39
eLtronicsVilla/Machine-Learning-Tutorial
/ModelSelection&Boosting/ModelSelection/k_fold_cross_validation.py
4,376
3.65625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 3 08:35:21 2019 @author: brgupta """ # K-fold cross validation # In this we will evaluate the model performance and improving our model performance # we split the data in training set and test set , because of this we have variance problem. # a...
2c5a33b745b519e8d8575802fb0f14ae8004d30a
Harshad141/Computer-Network-Lab-assignments
/CRC/reciever.py
1,195
3.78125
4
def xor(a, b): #function for defining xor operation result = [] for i in range(1, len(b)): if a[i] == b[i]: result.append('0') else: result.append('1') return ''.join(result) def div(divident, divisor): #modulo-2 divison K = len(divisor) temp = divident...
c4db7791dcac87d51b3563b4d9c0a31b6836dd22
vijaykjangid/swapping
/swap.py
142
3.875
4
a=input('Enter first no') b=input('Enter second no') print('before swaping a=',a,'b=',b) a=a+b b=a-b a=a-b print('after swaping a=',a,'b=',b)
bcdb0ba2f610f8255debb95c4603e5dc75a76df4
tobarg/python
/3.11 regex.py
848
3.859375
4
#regular expresions > regex # ^ beginning of line # $ end of line # . matches any character # * repeats character 0 or more times # + repeats character 1 or more times # \s matches white space # \S matches non-white space # [] range. example: [0-9] # findall() look for all instances # when between () start/stop extract...
d3b5c109de3553f5be89b67fc7c43924db5c2fed
ChrisCummins/cstp
/06-linked-list.py
3,927
4.25
4
#!/usr/bin/env python # ## Linked Lists: # # A linked list is a data structure in which the objects are arranged # in a linear order. The order in a linked list is determined by a # pointer in each object. # ## Performance: # Singly-linked | Doubly-linked # Unsorted Sorted | Unsorte...
2d8aa7df868afd18a3516fa8bef47656829cfdef
jucio/python-condicoes
/maior_menor_valores.py
329
3.75
4
#Autor: Jucio Gabriel #Versao: 1.0 #Formas de Contato: Gmail: juciogabriel@gmail.com #Whats app: 085985427699 #Gmail secundario: juciogabriel01@gmail.com #Tentei melhorar ao maximo cada script. #coding: utf-8 a1 = int(input("Valor:")) a2 = int(input("Valor:")) a3 = int(input("Valor:")) print("o maior valor e",max(a1,...
e15850165397b66795497cfa10d2495139998de0
Davenport70/python-basics-
/practice strings.py
1,351
4.5625
5
# practice string # welcome to Sparta - excercise # Version 1 specs # define a variable name, and assign a string with a name welcome = 'Hello and welcome!' print(welcome) # prompt the user for input and ask the user for his/her name user_input = input('What is your name?') print(user_input) # use concatenation to...
6e9136452d86c9f72be1d4692ee45d5aadb149ad
yasminlucero/pythonToys
/python/blackjack.py
4,090
3.65625
4
#!/usr/bin/env python # blackjack import random # global variables for blackjack module Suits = ('Club', 'Spade', 'Heart', 'Diamond') Ranks = ('Ace', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Jack', 'Queen', 'King') Values = range(1, 11) + [10, 10, 10] rank2Values = {r:v for (r,v) in zi...
4889fb412315f43afdb6c76b1a050e5d4c08932e
aribis369/FTP-Server-Client-system
/client.py
2,513
3.5
4
from ftplib import FTP import glob import os import sys import tnsorflow import numpy as np import pandas as pd b=[1,2,3,4,5] print b ftp=FTP() # setting connection with the server taking username and password as input from the user def conn(): # connecting to server ip address ftp.connect("localhost",8000) ...
d31909e4ad015c2c96b54c7c0fa18005b720f764
JeonghoonWon/Eclipse_Pydev
/HELLOPYTHON/day01/mytest06.py
612
3.765625
4
# 홀 짝 참고해서 가위바위보 만들기 import random com = "" mine = input("주먹/바위/보 선택하세요") result = "" rnd = random.random() if rnd < 0.33: com = "주먹" elif rnd < 0.66: com = "가위" else : com = "보" if com == mine: result = "비김" elif(com=="주먹" and mine=="가위" or com=="가위" and mine=="보" or com=="보" and mine=="주먹"): res...
aedd2f7d3b5b4101aaade2567a07e101673201fa
manasi1401/cryptography
/basictest.py
3,399
3.9375
4
################################################# # Author: Manasi Paste # Course: Cryptography # Professor: Dr. Karlsson # # Description: This program lets user test and # interact with all the functions in the cryptomath library # # Run instructions: python basictest.py ###############################################...
8985181ac5d5e8c11d6b93f521e5ce773165371f
U-k-t/Academic-Projects
/Algorithms/Project 1 - Tower of Hanoi, Matrix Multiplication, and Sorting Algorithms/Quicksort.py
2,046
3.59375
4
import random, time, sys, matplotlib.pyplot as pp sys.setrecursionlimit(15000) def populateList(size): ## Generate a List of Size N with Random Values Ranging from 0-N list = [] for x in range(1,size+1): list.append(x) for y in range (0,7): ##Shuffle List Seven Times Based on Principles of R...