blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
3.06M
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
3.06M
1d8a5cca19a4d956624e0c0a479fea9d1f5ce0dc
jacobiand/crud
/checkout/cliente.py
3,603
3.53125
4
from banco import Banco class Usuarios(object): def __init__(self, idusuario=0, nome="", telefone="", email="", usuario="", senha=""): self.info = {} self.idusuario = idusuario self.nome = nome self.telefone = telefone self.email = email self.usuario = usuario ...
5eb47e99757132c9439bb56f513b07885f43f6f7
Salehzz/Information-Retrieval-Project
/heap-zipf-law/heap's_law.py
687
3.515625
4
#Heaps' law import matplotlib.pyplot import math file = open("myfile.txt",'r') wordkinds = 0 words = 0 # har 50 kalame tedadkalamatmotefavet = {} kalamat = [] for line in file: for word in line.split(): words = words + 1 if(word not in kalamat): kalamat.append(word) ...
efaa4394956df2168d4911b51c35b05446557baf
ailihong/program
/python/tool_linux/batch_rename.py
1,344
3.5625
4
#!/usr/bin/python3 #coding:utf8 ''' 批量重命名,会删除原来的文件!!!,使用前注意备份,命名会自动补零 ''' import os import argparse def parse_args(): """Parse input arguments.""" parser = argparse.ArgumentParser(description='batch rename') parser.add_argument('--dir', dest='dir', help='file directory',default='None') parser.add_argum...
abb90aee0832b21144bdfe2a1bb095e4e63f3f3a
yoshi-d-24/nlp100
/ch01/09.py
461
3.703125
4
# coding: utf-8 import random def sort_word(word): head = word[0] tail = word[len(word) - 1] l = list(word)[1:len(word)-1] random.shuffle(l) return head + "".join(l) + tail str1 = "I couldn't believe that I could actually understand what I was reading : the phenomenal power of the human mind ." ...
6ebffaee162c491cc4f2289845a1bf7bbcd33604
flub78/python-tutorial
/examples/conditions.py
374
4.1875
4
#!/usr/bin/python # -*- coding:utf8 -* print ("Basic conditional instructions\n") def even(a): if ((a % 2) == 0): print (a, "is even") if (a == 0): print (a, " == 0") return True else: print (a, "is odd") return False even(5) even(6) even(0) bln = even(6) ...
0b035de8980eedcb6535cb20cff82207df5b3bd3
flub78/python-tutorial
/examples/using_leap_year_module.py
241
3.984375
4
#!/usr/bin/python # -*- coding:utf8 -* import os from package.leap import * year = input("type a year: ") print "year=" + str(year) if leap_year(year): print ("leap year") else: print ("non leap year") print "bye" os.system("pause")
0e531d7c0b4da023818f02265ab9e009420eaec6
flub78/python-tutorial
/examples/test_random.py
1,395
4.1875
4
#!/usr/bin/python # -*- coding:utf8 -* """ How to use unittest execution: python test_random.py or python -m unittest discover """ import random import unittest class RandomTest(unittest.TestCase): """ Test case for random """ def test_choice(self): """ given: a list ...
fafd460a0cf1f0f38a9cd9055915a26067019c45
flub78/python-tutorial
/examples/whiteboard.py
627
3.859375
4
#!/usr/bin/python # -*- coding:utf8 -* print ("Object management") class Whiteboard: """ A whiteboard simulator""" def __init__(self): self._surface = "" def write(self, str): if self._surface != "": self._surface += "\n" self._surface += str ...
972ee98f17d2e3ce810881019e74ab6e838ca505
mrmaxformax/sw_transpose
/main.py
6,340
4.21875
4
# !/usr/bin/env python3 """ This is a script designed to find the longest word in the text file, transpose the letters and show the result. """ import argparse import concurrent.futures import logging import logging.handlers import os import re import sys from glob import glob logger = logging.getLogger(os.path.splite...
09fb8df1f7ffab63510f4ad80879fa70b387bcc0
leskeylevy/Passlock
/user_test.py
1,989
3.796875
4
import unittest from user import User class TestUser(unittest.TestCase): def setUp(self): self.new_user = User('leskey', 'levy', 'leskeylevy@gmail.com', 'Nairobi') def test_init(self): ''' test to see if object isproperly initialised ''' self.assertEqual(self.new_user...
ffeaf6b8e04e6d5fdf793008cad6d8a76588665e
WyattBlair77/barnsley_fern
/barnsley_fern/barnsley_fern.py
2,346
3.75
4
''' This is a script to construct the Barnsley fern, a fractal discovered by mathematician Michael Barnsley. Due to its 'flexible' nature, in that by changing the hyper-parameters you can construct different ferns, the structure is classified as a super-fractal! The script works by iteratively applying one of four lin...
9caae8fc3ec860ba78469871567a7f1f02338a35
craymontnicholls/Booklet-7
/Python (booklet 7)/Automatic-feeder/main.py
374
3.84375
4
#tells the user what hopper and how many times it needs to be dispensed def feeder(meal, amount): if meal == "Breakfast": print ("Hopper1," * amount) elif meal == "Lunch": print ("Hopper2," * amount) elif meal == "Dinner": print ("Hopper1 ,Hopper2 ," * amount) #the '* amount' makes the string rep...
897c6e06ef61bbd7899e46cfeedbd5e20108efe4
L30n4rd0/Lista1_FPA
/Questao4/Matrix.py
1,983
3.921875
4
# -*- coding: utf-8 -*- ''' Created on 22/03/2017 @author: leonardo ''' from random import randint def initMatrix(): i = 0 global biggertElement global smallerElement while (i < len(matrix)): j = 0 while (j < len(matrix[i])): # new random element of 0 to 9...
8598c34ff9028f4ec30d01522ca051c7272dd6d6
bipika/DataStructureAlgo
/dsa/Stack.py
512
3.90625
4
class Stack: def __init__(self): self.stack=list() def push(self,value): self.stack.append(value) def pop(self): if len(self.stack)<1: print ("Stack is empty") else: self.stack.pop() def printStack(self): print(self.stack) stack=Stack...
21b5a5dd2a92917e3585c0bba2fcb77ea6e66376
Sgt-Forge/Coursera-ML-Python
/machine-learning-ex2/main.py
7,672
4.09375
4
""" Programming exercise two for Coursera's machine learning course. Run main.py to see output for Week 3's programming exercise #2 """ import os import numpy as np from matplotlib import pyplot from mpl_toolkits.mplot3d import Axes3D from typing import List from scipy import optimize from sigmoid import s...
880604c0b72a37eb34c70d898692537357296f7b
shivamach/DIPLearn
/Learn/pandas/methods_loading.py
1,007
3.984375
4
#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import pandas as pd # In[2]: x = pd.DataFrame({'a':[1,2,3,4,5],'b':[20,20,30,40,50]}) # In[3]: x # In[7]: a = x.columns print(a) # In[5]: x.index #returns the info that is shown here right now # In[8]: x['b'].sum() #add bitches in ...
f42e9b9dcb39bd8ab75956f1d0f1387d977cad14
mihirapatel/gwc-sip-projects
/logicoperators.py
345
3.921875
4
my_number = 52 def guessnumber(): user_number = input ("Guess my number: ") if int(user_number) == my_number: print("Good job! You guess the right number") print("Game over") elif int(user_number) > my_number: print("You number is too high") guessnumber() else: print("Your number is too low") guessn...
a10b9cbaa8dbe1cd916c0743b2c74672b2f79652
EBAX1/DATA533_Lab2
/graphsTrees/trees/tree.py
1,067
3.75
4
from graphsTrees.trees.node import Node class Tree: def create_node(self,key): return Node(key) def insert(self, node, key): if node is None: return self.create_node(key) else: node.left = self.insert(node.left, key) return node def sear...
9ab0c6501b45b53d1c6f66a1944e685c471ef1b7
brkreddy06/GitDemo
/PythonTesting/pythonSelenium/demoBrowser.py
998
3.578125
4
from selenium import webdriver #browser exposes an executable file #Through Selenium test we need to invoke the executable file which will then invoke the actual browser # quit() method - it will close all the browsers both parent and child windows # close() method - it will close only the current window # back() metho...
8307e6362f2cd80c59d3859a9f384b3d53926b4a
jtorbett23/python_tdd_fizz_buzz
/test_fizz_buzz.py
2,010
3.734375
4
import unittest import fizz_buzz class Test_fizz_buzz(unittest.TestCase): #returns a number def test_number(self): self.assertEqual(fizz_buzz.fizz_buzz(1),1) #returns Fizz on multiples of 3 def test_fizz(self): self.assertEqual(fizz_buzz.fizz_buzz(3),'Fizz') self.assertEqual(fiz...
c31fb13e21683a899a332c89eb06c7157517038c
YW-Pan/gwr
/gwr_inversion.py
8,535
3.859375
4
""" ``GWR(fn , time, M, precin)`` gives the inverse of the Laplace transform function named ``fn`` for a given array of ``time``. The method involves the calculation of ``M`` terms of the Gaver-functional. The obtained series is accelerated using the Wynn-Rho convergence acceleration scheme. The precision of internal c...
95c9ebf4dd644bd965dc6ac40c453e319289ead3
amyyang17/mywork
/上課內容/eggs/ham.py
488
3.6875
4
import numpy as np n=np.random.randint(1,101) guess,small,big=(0,1,100) while n!=guess: guess=int(input(f"從{small}到{big}猜個數字吧")) if guess > big or guess <small: print(f"超出範圍啦,從{small}到{big}猜個數字吧") else: if guess > n: print("太大囉!") big=guess elif guess < n : ...
0f1d803c4737da4a1a1f6b312c0db88ab52e07ef
SarahYuHanCheng/Flask_microblog
/gameserver/1/1/1/1_1.py
403
3.90625
4
#!/usr/bin/python def run(): global paddle_vel,ball_pos,move_unit if (ball_pos[-1][0]-ball_pos[-2][0]) <0: print("ball moves left") if (ball_pos[-1][1]-ball_pos[-2][1]) >0: print("ball moves down") paddle_vel=move_unit elif (ball_pos[-1][1]-ball_pos[-2][1])<0: print("ball moves up") paddle_vel=-mov...
ec22ae5b47366eccdb336c2b3f2de8c8ab376291
juanjosegdoj/Ejercicios-b-sicos-en-Python
/Básicos/dias,min, seg.py12.py
115
3.546875
4
for h in range(1,25): for m in range(1,60): for s in range(1,60): print(h,":",m,":",s)
b82b22249bd59acadf2e97c10b68924cbc3371a5
juanjosegdoj/Ejercicios-b-sicos-en-Python
/39Thai 21.py
713
3.796875
4
rocas_en_pila=int(input("ingrese numero de rocas en pila")) Nro_de_jugadores=int(input("ingrese numero de jugadores")) cont=1 while rocas_en_pila!=0: while True: if cont>Nro_de_jugadores: cont=1 print("Turno jugador",cont) rocas=int(input("Rocas a extraer ")) if ...
ba51eba7ff0b4069d44110ecdac44bb48a58239f
juanjosegdoj/Ejercicios-b-sicos-en-Python
/57Reproductor_fib.py
682
3.90625
4
""" Por Juan José Giraldo Jimenez Objetivo: La explicación del ejercicio se encuentra en el punto 1 de: http://ingeniero.wahio.com/ejercicios-con-while/ """ x=input(":: ") if len(x)==1: x+="0" v=[int(x[-2]),int(x[-1])] while v[len(v)-1]<int(x): v.append(v[-2]+v[-1]) if v[-2]==int(x): ####### ...
90bf8bba2f77ff42668772fa637aaba006e2c930
juanjosegdoj/Ejercicios-b-sicos-en-Python
/47.Astucia Naval.py
2,530
3.703125
4
def suma_de_matriz(matriz): suma=0 for i in matriz: suma+=sum(i) return(suma) def tablero(): matriz=[] for i in range(10): matriz.append([0]*10) return(matriz) def posbarcos(jugador1): for k in range(4): while True: fila=int(input("Ing...
4df78d64dfdeb4e003d85f2d3d7e8acbe57deb8e
juanjosegdoj/Ejercicios-b-sicos-en-Python
/Básicos/sucesion de fibonaci.py14.py
190
4.09375
4
def fibonacci(n): if n<2: return n else: return (fibonacci(n-1) + fibonacci(n-2)) n=int(input("puesto en la sucesion de fibonacci ")) print(fibonacci(n))
448fedde7f5555d3666a4491d1c13465c479a878
juanjosegdoj/Ejercicios-b-sicos-en-Python
/Básicos/positivo, negativo o Neutro.py2.py
336
3.859375
4
contP=0 contNeg=0 ContN=0 print("USTED VA INGRESAR 4 NUMEROS") for i in range(1,5): n=int(input("ingrese numero ")) if n>0: contP=contP+1 elif n<0: contNeg=contNeg+1 else: ContN=ContN+1 print("usted ingresó: ",contP," positivos,",contNeg," negativos,",ContN," neutros"...
788bcba0f15b5a40ddc1d861a3633da784a5bc38
nodira/streamlit_docs
/tutorial/first_report_part2.py
8,405
4.0625
4
#FIRST_REPORT_LINK_PART2 import streamlit as st st.title("Tutorial: caching, mapping, and more!") st.write(""" *If you hit any issues going through this tutorial, check out our [Help](HELP_LINK) page.* At this point, you have probably [already set up Streamlit](INSTALLATION_LINK), and even created [your first Strea...
86eb3487607bf0b1cd76215e54ff8188b7471a25
Azakahul/InterviewProblems
/Python/Arrays/duplicatenumber.py
452
3.9375
4
# How do you find the duplicate number on a given integer array? def duplicatenumber(n, m, duplList): for num in range(n,m): currentnum = num count = 0 for x in duplList: if currentnum == x: count += 1 if count == 2: return currentnum dupList...
0838f1661aca1a4708782e5e1930e3c9b9a98eaa
zephyr-c/shopping-site
/customers.py
1,048
3.765625
4
"""Customers at Hackbright.""" class Customer(object): """Ubermelon customer.""" # TODO: need to implement this def __init__(self, first, last, email, password): self.first_name = first self.last_name = last self.email = email self.password = password def __repr__(se...
ab7145c79eb6bd339ac84c807f709bb1bc3f0423
Santexnik77/cursera_py4e
/w4ex.py
121
3.578125
4
hrs = input("Enter Hours:") rt = input("Enter rate:") hrsf = float(hrs) rtf = float(rt) pay = hrsf*rtf print("Pay:",pay)
1513bb7fdd3e2a396e715ea9a66ee51cd9fc6532
pl366/Tic--Tac--Toe
/TTT.py
3,319
3.859375
4
# -*- coding: utf-8 -*- """ Created on Tue May 16 12:48:37 2017 @author: PULKIT LUTHRA """ #Tic Tac Toe Game import random board=[] for i in range(9): board.append(-1) def drawBoard(): print(' | |') print(' ' + str(board[0]) + ' | ' + str(board[1]) + ' | ' + str(board[2])) ...
b801a4581c35f8fef9b0c62c10aac0578fc9ae04
Mstoned/Python
/Pattern/py/num_pattern2.py
515
3.984375
4
''' Print the following pattern for the given N number of rows. Pattern for N = 4 1 11 202 3003 Input format :Integer N (Total no. of rows) Output format :Pattern in N lines Sample Input :5 Sample Output : 1 11 202 3003 40004 ''' num=int(input('Enter the num for pattern : ')) for i in range(1,num+1): for j ...
ceca7f4c880b369b8849d82e1fe35e4d1f6e07d2
andremmfaria/exercises-coronapython
/chapter_07/chapter_7_7_6.py
752
3.90625
4
# 7-6. Three Exits: Write different versions of either Exercise 7-4 or Exercise 7-5 that do each of the following at least once: # # • Use a conditional test in the while statement to stop the loop. # # • Use an active variable to control how long the loop runs. # # • Use a break statement to exit the loop when the ...
38081fd73316e20f6361d835d710dd379e8c78ea
andremmfaria/exercises-coronapython
/chapter_06/chapter_6_6_4.py
823
4.375
4
# 6-4. Glossary 2: Now that you know how to loop through a dictionary, clean up the code from Exercise 6-3 (page 102) by replacing your series of print statements with ía loop that runs through the dictionary’s keys and values. When you’re sure that your loop works, add five more Python terms to your glossary. When you...
9634250371f02daea5f2200e7ef401237a660e6f
andremmfaria/exercises-coronapython
/chapter_08/chapter_8_8_10.py
765
4.40625
4
# 8-10. Great Magicians: Start with a copy of your program from Exercise 8-9. Write a function called make_great() that modifies the list of magicians by adding the phrase the Great to each magician’s name. Call show_magicians() to see that the list has actually been modified. def show_magicians(great_magicians): ...
8c5498b935164c457447729c6de1553b390664e5
andremmfaria/exercises-coronapython
/chapter_06/chapter_6_6_8.py
522
4.34375
4
# 6-8. Pets: Make several dictionaries, where the name of each dictionary is the name of a pet. In each dictionary, include the kind of animal and the owner’s name. Store these dictionaries in a list called pets. Next, loop through your list and as you do print everything you know about each pet. pet_0 = { 'kind' ...
7bc98b1c9a50acb1e7ff7fe3ce2781ace3a56eb8
andremmfaria/exercises-coronapython
/chapter_07/chapter_7_7_1.py
257
4.21875
4
# 7-1. Rental Car: Write a program that asks the user what kind of rental car they would like. Print a message about that car, such as “Let me see if I can find you a Subaru.” message = input("Let me see whether I can find you a Subaru") print(message)
728475dad2bf31558ebc1280f527777e60362ee8
jerry8812/PR301Repo
/Assignment2/TIGrExTurtleDrawer.py
2,434
3.546875
4
""" Turtle Drawer By Sean Ryan """ from TIGr import AbstractDrawer import turtle class TurtleDrawer(AbstractDrawer): """Turtle Drawer Inherits: select_pen(pen_num), pen_down(), pen_up(), go_along(along), go_down(down), draw_line(direction, distance) Preset Pens: 1 - colour black, size 10 2...
15dd5f611510783c941a9473bd55d448fd05ce84
tahamazari/HackerRank
/sorting/counting_sort_2/counting_sort_2.py
877
3.671875
4
#!/bin/python3 import math import os import random import re import sys # Complete the countingSort function below. def countingSort(arr): sorted_array = [] count_array = [0]*(len(arr)) for i in range(0, len(arr)): count_array[arr[i]] += 1 for i in range(0, len(arr)): if(count_array[...
4fffdf8bfd105ee735595dc4cece8d19cabb3c78
tahamazari/HackerRank
/Hacker_rank/repeated_string.py
964
3.515625
4
#!/bin/python3 import math import os import random import re import sys # Complete the repeatedString function below. def repeatedString(s, n): x = 0 # for i in s: # s += str(i) # x += 1 # if( x < n): # for j in s: # s += str(j) # # total_a = 0 #...
7afe22606dcfcce5d705c3e412b3c33c4ccf8bf8
sahilchanglani/Turtle-crossing-game
/scoreboard.py
1,116
3.84375
4
from turtle import Turtle FONT = ("Courier", 24, "normal") class Scoreboard(Turtle): def __init__(self): super().__init__() self.level = 1 self.color("black") self.penup() with open("highscore.txt") as data: self.high_score = int(data.read()) self.hide...
d60aba690a4cf3dd04eb4f8d074a170fac1a3504
Nadeesha9090/SME---Python-Project
/Python Basic/Test - 04.py
236
3.90625
4
# -*- coding: utf-8 -*- """ Created on Thu Jun 28 23:02:21 2018 @author: hp """ #For Loop numberList = [1,23,67,56,654,77,33,778,1,222,2345] for eachNumber in numberList: print(eachNumber) for x in range(1,12): print(x)
0113a118a572d8a111a06f4e87653a8f3f448014
pawelff/AdventOfCode2020
/day_02/4.py
316
3.59375
4
valid_passwords = 0 with open("3.txt", "r") as f: for line in f: words = line.split() positions = list(map(int, words[0].split('-'))) letter = words[1][0] password = words [2] if (password[positions[0]-1] == letter) != (password[positions[1]-1] == letter): valid_passwords += 1 print(valid_passwords)
9fd0b5a0a82a108e9f5b3c56135ae18bec2a3bd1
srikanthpragada/PYTHON_25_MAY_2020
/demo/oop/time.py
425
3.796875
4
class Time: def __init__(self, h, m, s): self.h = h self.m = m self.s = s @property def hours(self): return self.h @hours.setter def hours(self, value): if value >= 0 and value <= 23: self.h = value else: raise ValueError("Inv...
a1f9f339424711a8493e89eb801ca0e845d08daa
srikanthpragada/PYTHON_25_MAY_2020
/demo/table.py
340
4
4
import sys if len(sys.argv) < 2: print("Usage : python table.py <number> [length]") exit(1) if len(sys.argv) == 2: length = 10 # Default length else: length = int(sys.argv[2]) num = int(sys.argv[1]) # Number for which table is to be displayed for i in range(1, length + 1): print(f"{num:3} * {i...
d1d34cd7626fb813412063e8f0e7748e0bc2f97b
Korasi/COSC-1336
/Lab4/lab4.py
3,239
3.859375
4
# This program computes statistics from a list of test scores # Nigel Myers # Fundamentals of Programming # ACC FALL 2018 # lab4.py # Prof Onabajo def output(string, outfile): #print output to console and data file print(string) outfile.write('%s\n' % string) def floatToString(input_): #convert flo...
96a2564c2b098a9befed20ab03268ca58451d292
Korasi/COSC-1336
/Lab2/lab2.py
2,964
4.03125
4
# This program computes the cost of a house over five years given initial, fuel, and tax costs. # Nigel Myers # Fundamentals of Programming # ACC FALL 2018 # lab2.py # Prof Onabajo def validateData(displayText, *args): #prompt user for input, and validate if it's int or float # Usage: validateData(displayT...
963028e915a2b26601ee2dd3773175c5b50d0209
gelu100/power_exponent
/test_exponent.py
1,510
3.5625
4
import power_of_a_number import unittest class Powbase(unittest.TestCase): def test_is_natural_number_correctly_power(self): self.assertEqual(power_of_a_number.returning_power_base_of_a_number(2, 2), 4) def test_for_a_big_number(self): self.assertEqual(power_of_a_number.returning_power_base_of...
064f99bb33abef151e3dc319d6e02ce18a8d7237
Khusniyarovmr/Python
/Lesson_2/1.py
1,860
3.921875
4
""" 1. Написать программу, которая будет складывать, вычитать, умножать или делить два числа. Числа и знак операции вводятся пользователем. После выполнения вычисления программа не должна завершаться, а должна запрашивать новые данные для вычислений. Завершение программы должно выполняться при вводе символа '0' в качес...
5e3d898b7992d9d2915045298ad4a676a18ba2f6
Khusniyarovmr/Python
/Lesson_1/5.py
638
4.03125
4
#5. Пользователь вводит две буквы. Определить, на каких местах # алфавита они стоят, и сколько между ними находится букв. print('Введите две буквы: ') a, b = input(), input() a1 = ord(a); b1 = ord(b) print('Первая буква находится на ', a1 - ord('a')+1, ' месте в алфавите') print('Вторая буква находится на ', b1 - ord('...
1647b333db7c0d04a16dc37f794146cb9843561b
Khusniyarovmr/Python
/Lesson_1/4.py
991
4.3125
4
""" 4. Написать программу, которая генерирует в указанных пользователем границах ● случайное целое число, ● случайное вещественное число, ● случайный символ. Для каждого из трех случаев пользователь задает свои границы диапазона. Например, если надо получить случайный символ от 'a' до 'f', то вводятся эти символы. Прог...
b6ed21a41ebf8993427eb5fe54474350e525d621
nathanleiby/algorithms-on-graphs
/week1_decomposition1/1_reachability/reachability.py
932
3.796875
4
# Uses python3 import sys def reach(adj, x, y): # do depth first search on an adjacency list visited = {} to_visit = [x] while len(to_visit) > 0: cur = to_visit.pop() visited[cur] = True if cur == y: # found return 1 neighbors = adj[cur] unvisited_...
f763244810ef4e71e0a87af12f09107f1a8333cd
rams1996/Daily-coding-assignments
/lru-cache/lru-cache.py
1,275
3.640625
4
   def addToFront(self,node):        temp=self.head.nxt        temp.prev=node        self.head.nxt=node        node.nxt=temp        node.prev=self.head ​    def get(self, key: int) -> int:        if key in self.link:            node=self.removeNode(self.link[key])            self.addToFront(node)            ...
ada45843b6e4b1208b304ac1d44874ae585c2123
Antonio985/SeminarioDeProgramacion
/Modulos/Modulo_Persona.py
240
3.625
4
#Creacion de la clase class Persona: def __init__(self, nombre, edad): self.__nombre = nombre self.__edad = edad def __str__(self): return "Nombre: "+self.__nombre+" y edad : "+str(self.__edad)
64dbc3fb5e9c6a20abee22a435f0a5f701a7bd35
mckilem/python1_hw
/lesson1/normal.py
1,917
3.71875
4
# Задача-1: Дано произвольное целое число, вывести самую большую цифру этого числа a = 1789876521 maxValue = -1 for x in str(a): b = int(x) if maxValue < b: maxValue = b print(maxValue) # Задача-2: Исходные значения двух переменных запросить у пользователя. # Поменять значения переменных местами. Выв...
b679d7831d5b98945e737a19deadcecfbf5f2463
rob-giuliano/Human.Number.Name
/lib/tkinter.py
2,143
3.9375
4
import tkinter as info import tkinter as tk class Application(info.Frame): def __init__(self, master=None): super().__init__(master) self.master = master self.pack() self.create_widgets() def create_widgets(self): self.hi_there = info.Button(self) self.hi_there[...
0578668b3eae5440e08535d5c1f0e52c0e2d2b24
Selasi3/tlc4_python
/tutorials/hello.py
81
3.671875
4
print("Hello,world") name = input("Enter your name: \n") print("Hello, ", name)
f1796363ad5afd125fd217c8eb8a78744b147542
zikoc15/ziko
/cazorla.py
2,790
3.921875
4
class Usuario: def __init__(self): self.nombre="a" self.apellido="s" self.correo="x" self.clave="c" usu=Usuario() listausu=list() correo="zikocazorla@gmail.com" clave="daniel1999" salir="salir" for i in range (10): print("_______________________________") print(" INICIO ") ...
a9791e4d76a4eb55c00a6ceb6a13f424c6828b56
rajeevbrahma/Smart-Traffic-Management-System-for-Emergency-Services
/server/traffic_calc/bearing.py
1,076
3.828125
4
#!/usr/bin/python ''' /*************************************************************************************** Name : bearng Description : calculates the bearing(angle) between given two lattitude and longitude points Parameters : l_lat1 and l_lng1 are point one lattitude and longitude r...
e616746e8b962a7bb3fdd4f52d363961caa0ed10
thonyeh/Numerical-analysis-1
/Sistema lineal/house.py
1,627
3.65625
4
from math import * from Tkinter import * m = int(raw_input("ingrese el numero de filas de la matriz ")) n = int(raw_input("ingrese el numero de columnas de la matriz ")) M = [] for i in range (m): M.append([0]*(n+1)) for i in range(m): print'ingrese los %d elementos de la fila %d:'%(n,i+1) for j in range(n)...
e7e0e9a1443e557161e725c82f4ba2b98a779eb3
thonyeh/Numerical-analysis-1
/Sistema no lineal/Oferta-Demanda.py
3,127
3.71875
4
from math import * from numpy import * from numpy import log as ln import sympy as sy import matplotlib.pyplot as plt def datos(a,b,w): print 'Ingrese la cantidad de datos conocidos:' m=input ('') print '' print 'Ingrese los puntos conocidos y sus respectivos f(xk)' n=m-1 M=[0]*(n+1) N=[0]*(...
7fdd9eb08f57841e63f64018e6a54b0141740200
whjr2021/G11-C4-V1-TA1-Template
/C4_TA1_Template.py
242
4.03125
4
# TA 1a: Code to print the numbers 0 to 4 using a for loop with range() function in the format range(start, stop) # TA 1b: Code to print x-coordinates of the bricks using a for loop with range() function in the format range(stop)
bda4ab6244f4b4e8a4dec085483296fac1138e64
athuras/Projects
/Euler/e9.py
1,380
3.609375
4
#!/usr/bin/env python # For whatever reason, I actually had a really hard time with this one. # The triplet algorithm below returns a list of triplets, so to answer the # problem, simply find the product of the singleton e9.triplet(1000) from aux import fermat_sum_of_squares as fss def triplet(n): '''Find 0 < a ...
67c68f61b7656ab9661ddea2bb118a8359393723
baubrun/test-cases-and-debugging-PY
/problem7.py
1,348
4.09375
4
""" The function input is an array as input. The first element of the array is a string. The second is a number. Make this function return the string repeated as many times as specified by the second element of the array. If a negative number or zero is specified, return an empty string. If any invalid parameters are...
bd35c095c678ee5b7003c2b1440f974105e9aaf3
conor-mcnally/sensehat
/animations/ect.py
3,089
3.609375
4
''' Sense HAT graphic animations: circle, triangle, line, and square functions. By Ethan Tamasar, 5/15/2017 ''' from sense_hat import SenseHat import time import numpy as np import time from random import randint def circle(image, position, radius, color, timer): sense = SenseHat() width, height = 8, ...
7d3d8c430b0eadbc1f57797a657dd84dfa7e9b69
Madhiyarasan/Ancit_practice
/tsk3_sum of odd & even num.py
278
4.0625
4
X = int(input(" A= ")) Y = int(input(" B= ")) even = 0 odd = 0 for number in range(X,Y + 1): if(number % 2 == 0): even = even + number else: odd = odd + number print("The Sum of Even Numbers " ,even) print("The Sum of Odd Numbers ",odd)
5cb4a583ec8a49434d41500e142cb79879070d1a
mkccyro-7/Monday_test
/IF.py
226
4.15625
4
bis = int(input("enter number of biscuits ")) if bis == 3: print("Not eaten") elif 0 < bis < 3: print("partly eaten") elif bis == 0: print("fully eaten") else: print("Enter 3 or any other number less than 3")
0a2070678b36f8668454968e997251b273fb404e
Zaja91/python-exercises
/If_Statements/making_pizza.py
435
4
4
toppings = [] available_toppings = ('pomodoro', 'mozarella', 'funghi', 'salsiccia', 'alici', 'wurstel') print(f"Questa e la lista delle possibili scelte per creare la tua pizza: {available_toppings}") still_choosing = True while still_choosing: name = input("\n What ingredient do you want:") toppings.append...
f029326ea49aaa4f1157fd6da18d6847144c5e26
Fran0616/beetles
/beatles.py
821
4.1875
4
#The beatles line up #empty list name beetles beatles = [] beatles.append("John Lennon") beatles.append("Paul McCartney") beatles.append("George Harrison") print("The beatles consist of ", beatles) print("Both name must be enter as written below\n") for i in beatles: i = input("Enter the name \"Stu Sutcliffe\": "...
5e55a27ef3a9fc45e5665c3b927c27c434525f6a
umaimagit/CodilitySolutions
/10. Prime n Composite Number/MinPerimeterRectangle.py
615
3.859375
4
# -*- coding: utf-8 -*- """ Created on Sun Oct 14 17:58:25 2018 @author: Umaima """ # MinPerimeterRectangle # Find the minimal perimeter of any rectangle whose area equals N. def solution(N): # write your code in Python 3.6 if N <=0 : return 0 elif N == 1: return 4 perimeter = [...
b37908cd9113aba08a87187cfc713c652be818a8
umaimagit/CodilitySolutions
/12. Euclidean algorithm/ChoclatesByNumbers.py
889
3.71875
4
# -*- coding: utf-8 -*- """ Created on Mon Oct 15 16:59:07 2018 @author: Umaima """ # ChocolatesByNumbers # There are N chocolates in a circle. Count the number of chocolates you will eat. # Below solution 50 % #def solution(N, M): # # if N == 0 : # return 0 # # if M == 0: # return N # ...
4bff77a7850c72e6a9217ad9a28c446759c80184
umaimagit/CodilitySolutions
/extra/test3.py
571
3.53125
4
# -*- coding: utf-8 -*- """ Created on Fri Nov 2 15:58:51 2018 @author: Umaima """ # test 3 correct code def solution(S): N = len(S) if N == 0: return 0 res = [0] start = "" end = "" ecount = N-1 for i in range(0, N): start = start + S[i] ...
a97e646cd9f7350f7f0e5294aa7e9abde183178d
umaimagit/CodilitySolutions
/15. Caterpiller Method/CountTriangles.py
914
3.796875
4
# -*- coding: utf-8 -*- """ Created on Tue Oct 16 16:36:01 2018 @author: Umaima """ #CountTriangles #Count the number of triangles that can be built from a given set of edges. def solution(A): N = len(A) if(N < 3): return 0 A.sort() count = 0 # Below code 66 % result ...
68e976659800b4f9c281e5186a741dc89fe4dbb2
AselK/Python
/for/Task1.py
270
3.90625
4
#Task1 Даны два целых числа A и B (при этом A ≤ B). Выведите все числа от A до B включительно a = int(input("Enter a: ")) b = int(input("Enter b: ")) if a <= b: for q in range(a, b + 1): print(q)
590a88d5eda6d642b44204a2d4435ea2b6c6b192
nguyenngochuy91/programming
/interview/ARRAYS/constructSquare.py
1,593
3.71875
4
# -*- coding: utf-8 -*- """ Created on Mon Sep 23 14:00:30 2019 @author: huyn """ #Given a string consisting of lowercase English letters, find the largest square number which #can be obtained by reordering the string's characters and replacing them with any digits you need #(leading zeros are not allowed) where sa...
0fd8177dcfaad841921329dc785e3fead49abff7
nguyenngochuy91/programming
/google code jam/2018/qualification/Go_Gopher.py
1,596
3.921875
4
""" Problem The Code Jam team has just purchased an orchard that is a two-dimensional matrix of cells of unprepared soil, with 1000 rows and 1000 columns. We plan to use this orchard to grow a variety of trees — AVL, binary, red-black, splay, and so on — so we need to prepare some of the cells by digging holes: In o...
c37472030cb3d72b60c0d5ccea081943992cc6d3
nguyenngochuy91/programming
/interview/ARRAYS/sort012Right.py
462
3.703125
4
# -*- coding: utf-8 -*- """ Created on Mon Sep 23 13:54:19 2019 @author: huyn """ def sort012Left(array): zero = 0 one = 0 two = len(array)-1 while one <=two: if array[one]==0: array[zero],array[one] = array[one],array[zero] zero+=1 one+=1 elif arr...
dac7f02c8ac52601fac15dc17f051338f96f8d44
nguyenngochuy91/programming
/interview/BST/minEatingSpeed.py
1,141
3.515625
4
# -*- coding: utf-8 -*- """ Created on Mon Sep 23 14:08:25 2019 @author: huyn """ #875. Koko Eating Bananas #Koko loves to eat bananas. There are N piles of bananas, the i-th pile has piles[i] bananas. #The guards have gone and will come back in H hours. # #Koko can decide her bananas-per-hour eating speed of K. E...
b2d24ba64d36887d86851907621bcab0f4a00964
nguyenngochuy91/programming
/interview/BFS/BFS.py
2,979
3.984375
4
# -*- coding: utf-8 -*- """ Created on Sun Jul 14 15:00:25 2019 @author: huyn """ import heapq,typing from collections import deque class TreeNode(object): def __init__(self, x,left=None,right=None): self.val = x self.left = left self.right = right # given a graph where vertices are cities,...
b4c7a7fe4fe66fff18c0ffe10218c1719fa451d9
nguyenngochuy91/programming
/interview/DP/5216_CountVowelsPermutation.py
636
3.609375
4
# -*- coding: utf-8 -*- """ Created on Sat Oct 5 23:03:33 2019 @author: huyn """ #5216. Count Vowels Permutation def countVowelPermutation(n: int) -> int: d= {"a":"e","e":"ai","i":"aeou","o":"iu","u":"a"} if n==1: return 5 count = {"a":1,"e":1,"i":1,"o":1,"u":1} for i in range(n-1): ne...
1acd61984c36759fb5112c1ffb57842832627430
nguyenngochuy91/programming
/google code jam/2008/qualification/Fly_Swatter.py
2,131
3.828125
4
# -*- coding: utf-8 -*- """ What are your chances of hitting a fly with a tennis racquet? To start with, ignore the racquet's handle. Assume the racquet is a perfect ring, of outer radius R and thickness t (so the inner radius of the ring is R−t). The ring is covered with horizontal and vertical strings. Each strin...
b50da8420a1585d387e5995f9e04eb3f72e336b8
nguyenngochuy91/programming
/google kick start/2019/round c/Wiggle_Walk.py
2,691
3.5625
4
# -*- coding: utf-8 -*- """ """ import sys T = int(input().strip()) def solve(instructions,R,C,SR,SC): d = {"R":{},"C":{}} d["R"][SC]=[[SR,SR]] d["C"][SR] = [[SC,SC]] visited = set() visited.add((SR,SC)) for instruction in instructions: if instruction=="N": SR-=1 ...
b35560cf7a36722b4b1e6f265ca31d1468cffb03
nguyenngochuy91/programming
/interview/GRAPH/graph.py
16,876
3.515625
4
# -*- coding: utf-8 -*- """ Created on Mon Sep 2 21:46:44 2019 @author: huyn """ import heapq from collections import deque # generate matrix given edges def generate(arr,n): d= {} for x,y in arr: if x not in d: d[x]=[] if y not in d: d[y]=[] d[x].append(y) ...
1836cc0e8889275fc16de885c28ad53e53fa4190
sabrina04/python-practice
/hackerrank/zip.py
433
3.921875
4
"""The first line contains and separated by a space. The next lines contains the space separated marks obtained by students in a particular subject. Print the averages of all students on separate lines.Print the averages of all students on separate lines.""" #!/usr/bin/python n,x = map(int, raw_input().split()) l = [...
c4013a6320521c1f9ff26e95de8e0c91d70b38d0
Biarys/bt_plat
/Backtest/Templates.py
1,170
3.765625
4
import abc class DataReader: def __init__(self): self.data = {} def csvFile(self, path): #read one _file pass def readFiles(self, path): #read many files pass class Indicator(metaclass=abc.ABCMeta): """Abstract class for an indicator. Requires cols (of data)...
53a552b5666e4d95f73f8143d66daabb04f96b0e
jrparadis/eecummingsbot
/eecummings.py
1,409
4.0625
4
## ## formats everything into the style of an e.e. cummings poem. ## ## import random and text to speech from random import randrange import pyttsx ## text to turn into a poem text = ''' The Dodge Custom Royal is an automobile which was produced by Dodge in the United States for the 1955 through 1959 mode...
d7e667067c4be8c691a512db9c6b4b32c96a07d2
ncerne00/Introduction_to_Python
/sets_and_dictionaries.py
1,961
4.03125
4
skills = {"Python", "Java", "Skateboarding", "Origami", "Woodworking"} print(skills) print("The number of skills in the set is", len(skills)) for skill in skills: print(skill) print() if "origami" in skills: print("Paper folding is my life.") skills.add("Problem-Solving") #adds one element skills.update(...
0a29f5e6e2a53f839757c3f4ad0a438a8c90be30
ncerne00/Introduction_to_Python
/Virginia_Census_Example.py
1,022
3.875
4
file = open("Virginia_Census_2010.csv", "r", encoding="UTF-8-sig") vmap = {} for line in file: line = line.rstrip("\n") line = line.split(",") city = line[0].strip() population = int(line[1]) vmap[city] = population print("The dictionary contains", len(vmap), "entries.") print(vmap) prin...
93642ed09a8bf109c903cd3dd2d3a5f5c910418c
ncerne00/Introduction_to_Python
/more_decisions.py
1,639
3.984375
4
size = 344 weight = 170 if size < 120: if weight < 100: print("It fits") else: print("Too heavy") else: print("Too big") if size < 120 and weight < 100: print("It fits") else: print("Too big or too heavy") project_duration = 10 if project_duration > 30: project_duration += 1...
a81b7557ab5e822663c1e5a3f25b2e3ea75419df
Hack-Light/Python-Projects
/cube.py
127
3.734375
4
def cube(base, pow): result = 1 for index in range(pow): result *= base return result cub = cube(2,3) print(cub)
529f0b663b0610bca8278098d01cd5a26d43bb91
xmpf/aoc-2020
/DAY-3/part1.py
420
3.625
4
#!/usr/bin/env python3 if __name__ == "__main__": # parse input data = [ line.rstrip() for line in open("input", "r").readlines() ] # initial values x = 1 y = 3 total = 0 # corners width = len(data[0]) height = len(data) # processing while x < height: total +=...
10727e7ae0ea9e908ca4e19b36dc75138b021eea
kesarwaniprakhar/Algorithms-codes
/insertionsort.py
735
3.875
4
# -*- coding: utf-8 -*- """ Created on Fri Mar 15 20:29:29 2019 @author: prakhar prakash """ list1 = list() size = int(input('Enter the size of the list')) for r in range(size): list1.append(r) list1[r] = int(input('Enter the value at location ' + str(r) + ':')) print(list1) def insertionso...
b4e0cfd09d1739e6dbe9d6b4397680eafbb110d7
kesarwaniprakhar/Algorithms-codes
/bubblesort.py
800
4
4
# -*- coding: utf-8 -*- """ Created on Fri Mar 15 18:05:04 2019 @author: prakhar prakash """ list1 = list() size = int(input('Enter the size of the list')) for r in range(size): list1.append(r) list1[r] = int(input('Enter the value at location ' + str(r) + ':')) print(list1) def bubbl...
ff3740adceb513f189834d4e2066a94c7a6c1f14
kesarwaniprakhar/Algorithms-codes
/mincostpathdynpro.py
916
3.765625
4
# -*- coding: utf-8 -*- """ Created on Thu Apr 11 08:10:49 2019 @author: prakhar prakash """ mat1 = [[1,2,3],[4,8,2],[1,5,3]] m = int(input('Enter the value of m')) n = int(input('Enter the value of n')) def mincostpath(mat1,m,n): dp = [[0 for x in range(len(mat1[0]))] for x in range(len(mat1...
a828b7b203e02b29f033f82d0cca98d083d781be
Sneha-Santhosh/MachineLearning
/day10/test5.py
354
3.84375
4
''' . Write a program to obtain the negative of a grayscale image (hint:subtract 255 from all pixels values) ''' import cv2 as cv import numpy as np #Read image img1 = cv.imread('apple.jpg') img1 = 255-img1 print img1 cv.imshow("apple2", img1) # Hold image till anyt key pressed cv.waitKey(0) #ora...
b43a14fea94c4d13ea22c637c674a94fb1209622
Sneha-Santhosh/MachineLearning
/day12/qa5.py
771
3.65625
4
''' Write a program to do face detection and eyes detection using haarclassifiers. ''' import numpy as np import cv2 as cv face_cascade=cv.CascadeClassifier('haarcascade_face.xml') eye_cascade=cv.CascadeClassifier('haarcascade_eye.xml') img=cv.imread('people.jpg') gray=cv.cvtColor(img,cv.COLOR_BGR2GRAY) fac...
108183b937e830187b011e294794b6fd63235420
Sneha-Santhosh/MachineLearning
/day10/test2.py
424
3.921875
4
''' Write a program apply scaling on the image of the apple with scaling factor 2 on both x and y axes. ''' import cv2 as cv import numpy as np #Read image img = cv.imread('apple.jpg',0) rows,cols = img.shape dst = cv.resize( img,None, fx = 3, fy = 1, interpolation = cv.INTER_CUBIC )...