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
d4b0b1015b096ac33b1fffb1ae7a500e9b14c2ec
matiash26/Sistema-CSV
/Sistema.py
2,942
3.640625
4
# -*- coding: utf-8 -*- # -*- coding: 1252 -*- import pandas as pd import csv import os import sys #____________________Listas de Produtos_________ def listas(Produto): if Produto == 0: Status = ['Pago','Devendo','Fazendo'] SalgadosList = '[ 0 ]Coxinha \n[ 1 ]Pastel \n[ 2 ]Espetinho' Salgados = ['Coxin...
99b95b69af56410a81e0e081e7a353e5f5199805
Roberto1078/Proyecto-Sistema-Bancario
/funciones.py
5,976
3.921875
4
def verificar_usuario(diccionario) : a=0 while a==0 : celular = input('Digite su numero de celular: ') nip = input('Digite su NIP: ') key = (celular,nip) if key in diccionario : a+=1 else : print('\n' + '> EL USUARIO NO EXISTE' + '\n') ...
311660f38d7add0bed8f4dc56a969e6973768689
dgs3/superSnake
/OroBot/chromosome.py
871
3.5625
4
import random import copy class Chromosome(object): def __init__(self, inChromosome = None): if inChromosome == None: self.chromosome = { 'theta_1' : 0, 'theta_2' : 0, } else: self.chromosome = copy.deepcopy(inChromosome) self.fitness = 0 se...
70363c127376538524ca0b68b538a2e7e066c800
sourcefrog/projecteuler
/006/sumsq.py
223
3.625
4
# Find the difference between the sum of the squares of the first one # hundred natural numbers and the square of the sum. # nums = range(1, 101) sumsq = sum(x**2 for x in nums) sqsum = sum(nums) ** 2 print sqsum - sumsq
546a065458a49f3d254bab1f42944853f9c78181
mariloca/cs50x_2020
/pset6/mario/less/mario.py
458
4.09375
4
from cs50 import get_int def main(): h = get_height() for i in range(1, h+1): print(" " * (h-i), end="") print("#" * i) ''' #another approach for m in range(h-i): print(" ", end="") for n in range(i): print("#", end="") print() ...
e5300d07bf66e7a40596e9db8568bb6f933b6783
nikrasiya/Hashing-3
/187_repeated_DNA_Sequences.py
680
3.703125
4
from typing import List class Solution: def findRepeatedDnaSequences(self, s: str) -> List[str]: """ https://leetcode.com/problems/repeated-dna-sequences/ Time Complexity - O(n) Space Complexity - O(n( """ seq = set() result = set() for i...
6e58c0b3731e68682023c759a605a3b7d755c8ef
EmptyBucket/StrongPalindrome
/palindrome.py
4,509
3.90625
4
from sys import path import string import os import itertools class Palindrome(object): """builder palindromes of the text specified in the console " "or in a text file and output together palindromes in the " "console or to a text file""" def __init__(self, text): super(Palindrome, self).__...
d5dde1216cb6e77f8b92a47de57268447c4189c3
V4p1d/Assignment-1
/Exercise_4.py
406
4.40625
4
# Write a program that receives three inputs from the terminal (using input()). # These inputs needs to be integers. The program will print on the screen the sum of these three inputs. # However, if two of the three inputs are equal, the program will print the product of these three inputs. # Example 1: n = 1, m = 2, l...
2350799e2cdf81c2367acfcbf4c0dc42570580f6
cunctat0r/pythonstudy
/oopconcepts.py
565
3.65625
4
class Classroom: def __init__(self): self._people = [] def add_person(self, person): self._people.append(person) def remove_person(self, person): self._people.remove(person) def greet(self): for person in self._people: person.say_hello() class Person: ...
23389a30b832c7518e4db59434016bbc9a8bc825
deredsonjr/testerepository
/lista1.5/lista1.5_questao04.py
125
3.890625
4
note1= float(input('primeira nota')) note2= float(input('segunda nota')) average= (note1*2 + note2*3) / 5 print(average)
7da9d50bd8ca72c428a2889335eeb5c649321fd4
ejaj/bongo-assignment
/task/task_1.py
292
4.09375
4
def print_depth(data, depth=1): """ Take a nested dictionary, print all keys with their depth. :param data: :param depth: :return: """ for key in data: print(key, depth) if isinstance(data[key], dict): print_depth(data[key], depth + 1)
da8bf44a9cf85ec79fcf8235cbc7929a08a0a370
Hritikraj8804/roy
/scientific-computing-python-freeCodeCamp-main/scientific-computing-python-freeCodeCamp-main/probability-calculator/prob_calculator.py
997
3.546875
4
import copy import random # Consider using the modules imported above. class Hat: def __init__(self, **kwargs): self.contents = [] for key, value in kwargs.items(): for _ in range(value): self.contents.append(key) def draw(self, number): if number > len(self.contents): return self...
c1a048add5c06c685ff191228e0386f6b2bcb3c2
el-iso/capstone-g11
/Python_Scripts/ComPortScan.py
1,277
3.5625
4
import sys import serial #Based on code by StackOverflow user Thomas #Thread at this link: #https://stackoverflow.com/questions/12090503/listing-available-com-ports-with-python def serial_ports(): if sys.platform.startswith('win'): ports = ['COM%s' % (i + 1) for i in range(256)] else: raise E...
47f0256ab339531ceef70e159100e48629484fae
AyushmaanSingh25/Assignment-Summitions
/Day-3 Assignment/Q2 .py
362
4
4
keys=[] values=[] l=int(input("Enter the dictonary length : ")) for i in range(l): keys.append(int(input("Enter the key : "))) values.append(input("Enter the Value : ")) dictonary=dict.fromkeys(keys,0) for i in range(l): dictonary[keys[i]]=values[i] print("key's : ",keys) print("value's : ",...
343660a0a84dd877a1b79a76a4daaa7473c9f21b
prakhar-nitian/HackerRank----Python---Prakhar
/Errors_and_Exceptions/Incorrect_Regex.py
554
4.03125
4
# Incorrect Regex # You are given a string S. # Your task is to find out whether S is a valid regex or not. # Input Format # The first line contains integer T, the number of test cases. # The next T lines contains the string S. # Constraints # 0 < T < 100 # Output Format # Print "True" or "False" for each test ca...
2af76dc77f4cebd7d13f517141f6ef633c073700
prakhar-nitian/HackerRank----Python---Prakhar
/Sets/Set_.intersection()_Operation.py
2,053
4.3125
4
# Set .intersection() Operation # .intersection() # The .intersection() operator returns the intersection of a set and the set of elements in an iterable. # Sometimes, the & operator is used in place of the .intersection() operator, but it only operates on the set of elements in set. # The set is immutable to the .int...
24c9e2d2858f4c668ce04b077648d30e6b5b0dd8
cameronleong3/Clustering
/single_linkage.py
3,455
3.796875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 14 14:22:10 2021 @author: cameronleong """ import numpy as np import math as m #user selects which dataset to use done = False while done == False: choice = input("Which dataset: Iris (I) or Wine(W)?") if (choice == "I"): from skl...
487bf96b7fc1192788f6b7444a2a2e2d0267c37a
yacih/education
/course/sort.py
1,230
3.734375
4
'''#通過字典實現 def foo(var): return { 'a': 1, 'b': 2, 'c': 3, }.get(var,'error') #'error'為預設返回值,可自設定 ''' import sqlite3 db = sqlite3.connect('sort.db') cursor = db.cursor() print('Connect ok') # Create table cursor.execute('CREATE TABLE info_computer(NAME TEXT PRIMARY KEY NOT NULL,LINK TEXT NOT NULL);') cursor.execute(...
531fca454f6e46ead75d4c43988c120be8435e12
yacih/education
/pon/condition.py
513
4
4
#判斷式 x=input("請輸入數字1:")#取得字串形式的使用者輸入 x=int(x)#將字串型態轉成數字型態 y=input("請輸入數字2:") y=int(y) op=input("請輸入運算:+,-,*,/:") if op=="+": ans=x+y elif op=="-": ans=x-y elif op=="*": ans=x*y elif op=="/": ans=x/y else: ans="不支援的運算" print(ans) ans=int(ans) if ans>100: print("大於100") elif ans>50: pri...
f84807857638a377779b0febde31a6f4d32fa133
yacih/education
/pon/usejson.py
516
3.65625
4
#coding=utf-8 # 讀取JSON: # import json # 讀去到的資料=json.load(檔案物件) # 寫入JSON: # import json # json.dump(要寫入的資料,檔案物件) import json #read with open("myjson.json",mode="r") as myjson: data=json.load(myjson) print(data) #data為字典資料 # print("name:",data["name"]) # print("id:",data["id"]) data["name"]="Ya-Cih"...
5b0436007c2e08a98bd8b254ff4816b694a5d0b0
KULDEEPMALIKM41/Practices
/Python/Python Basics/44.caseconversion.py
214
4.03125
4
#Case conversion s=input('Enter any type of charactor \t') if ord(s)>=65 and ord(s)<=90: c=ord(s) print('lower case is : ',chr(c+32)) if ord(s)>=97 and ord(s)<=122: c=ord(s) print('upper case is : ',chr(c-32))
843ddcb5a7fd997179c284d6c18074282a70ab0a
KULDEEPMALIKM41/Practices
/Python/Python Basics/67.bug.py
295
4.5625
5
print('before loop') for i in range(10,0,-1): # -1 is write perameter for reverse loop. print(i) print('after loop') print('before loop') for i in range(10,0): # if we are not give iteration in range function. it is by default work print(i) # on positive direction. print('after loop')
ad929f0d120653cf303cf7d59018eccdedae04c6
KULDEEPMALIKM41/Practices
/Python/Python Basics/114.multiple.py
2,399
4.3125
4
# 4. multiple inheritance => # (base for C)CLASS A CLASS B(base for C) # | | # | | # ______________________________________ # | # | # CLASS C(derived for A and B) # Drawback of other technology => # 1.if base class wi...
02f06c30ce10ff9975961f5aff42de32c7761537
KULDEEPMALIKM41/Practices
/Python/Python Basics/2.add.py
381
3.828125
4
#for addition in python a=10 b=20 c=a+b print("a=",a) print("b=",b) print("Add = ",c) # all variable are reference variable in python. # in this concept the value is firstly save in stack # area in ram then reference variable is take value's location reference. # thus we are use values in code. # variable => rese...
d4268e5317eedcca3d63c7ae04ecc21f5ee7a337
KULDEEPMALIKM41/Practices
/Python/Python Basics/51.fectorial.py
108
3.765625
4
#fectorial number. n=int(input('enter any number')) a=n i=1 while i<n: a=a*i i+=1 print('factprial is',a)
722f02a018763d5c18297e2977130e8be8c2093c
KULDEEPMALIKM41/Practices
/Python/Python Basics/36.control.py
536
4.1875
4
#Control Structure -> # 1.Conditional Statement 2.Control Statement 3.Jumping Procedure # a) if-statement a) while loop a) break # b) if-else statement b) for loop b) continue # c) if-elif-else(ladder if-else c) pass #Conditional Statement -> it is use to implement decision makin...
534146d46f8c71c9edec393105942add3bc01f5a
KULDEEPMALIKM41/Practices
/Python/Single Py Programms/statistics_module.py
1,459
4.15625
4
from statistics import * a = [1,10,3.5,4,6,7.3,4] b = [2,2,3,8,9] print("mean(a) - ",mean(a)) # The mean() method calculates the arithmetic mean of the numbers in a list. print("mean(b) - ",mean(b)) print("median(a) - ",median(a)) # The median() method returns the middle value of numeric data in a list. print("medi...
302d09455ea91820c27d2529516bbd55efcf6348
KULDEEPMALIKM41/Practices
/Python/Python Basics/40.if-else.py
263
4.125
4
#program for find divisiable number from 5 and10. #jo 10 se divisiable hogi vo 5 se almost divide hogi. n=int(input('Enter any number')) if n%10==0: print('divisible') else: #we will give different indentation in if and else part. print('not divisible')
9fab579474f1a0564c22c25b838a0c77058f4a68
KULDEEPMALIKM41/Practices
/Python/Single Py Programms/randommod.py
690
3.921875
4
import random for i in range(10): print(random.random()) #by default random.random() return value between 0 to 1. print() for i in range(10): print(random.random()*1000000) print() for i in range(10): print(int(random.random()*1000000)) print() for i in range(10): print(4*random.random()+3) #3 is starting num...
bb3f7a2ade0982a34c48aff1cb730cf2ffa06d5e
KULDEEPMALIKM41/Practices
/Python/Python Basics/105.poly.py
1,392
4
4
#polymorphism concept in function=> # polymorphism --> one name different forms. #polymorphism --> it is an object oriented feature with signify one thing having # different different implementation use to achieve code reusability. #overloading --> it is a king of polymorphism with signify one entity different...
9a10a6b8a563dc09a41541d54ec5a3a2162516d1
KULDEEPMALIKM41/Practices
/Python/Single Py Programms/count_substr_diffrent_maner.py
250
3.71875
4
a = 'bcacacacacac' def count_substring(string,substr): count1 = 0 for i in range(len(string)-len(substr)+1): if string[i:i+len(substr)] == substr: count1+=1 count2 = string.count(substr) return count1,count2 print(count_substring(a,'aca'))
e09eed3d9a276741101c3bee0ec9e73946b5e6c4
KULDEEPMALIKM41/Practices
/Python/Python Basics/115.hybrid.py
3,804
3.796875
4
# 5.Hybrid inheritance => # CLASS A(base class for B and C.) # | # _____________|________________ # 'is a'| | 'is a' # | | # (derived class for A)CLASS B CLASS C(derived class for A) # (base class for D) | | (base class for D) # | ...
44720b2bf4329e900adc8dc17a80d36dd0380268
KULDEEPMALIKM41/Practices
/Python/Animation With Python/animation_2.py
442
3.65625
4
import turtle amy = turtle.Turtle() amy.color("cyan") amy.speed(0) colors = ["green","black","orange","navy","lightblue","purple","#d3f122","darkblue"] def drow_square(color): for side in range(4): amy.forward(100) amy.right(90) for side in range(4): amy.forward(50) amy.right(90) amy.penup() amy.back(40) ...
f696506f9aef46d6a4a73040a6a1e58de8cd799b
KULDEEPMALIKM41/Practices
/Python/Animation With Python/animation_4.py
344
4.03125
4
import turtle def spiral(sides,turn,color,width): t = turtle.Turtle() t.color(color) t.width(width) t.speed(0) for n in range(sides): t.forward(n) t.right(turn) t.penup() t.left(60) t.forward(10) t.right(60) t.pendown() t.hideturtle() ...
647f6592b6e4d93502ab4b457bc334b8128819fb
KULDEEPMALIKM41/Practices
/Python/Python Basics/60.bug.py
298
4
4
i=1 while False: # False means loop is always False & False Key word first letter is capital letter. print(i,end='') i+=1 print('False') i=1 while True: # True means loop is always true & True Key word first letter is capital letter. print(i,end='') #infinite loop i+=1 print('False')
4e3be364e15ab0f5167648bc8a8d624baefe902c
S0rryMyBad/python-forensics
/indexing/indexing.py
330
4.0625
4
#!/usr/bin/python2 aList = [123, 'sample', 'zara', 'indexing']; print "index for sample :", aList.index('sample') print "index for indexing :", aList.index('indexing') str1 = "this is sample message for forensic investigation indexing"; str2 = "sample"; print "index of the character keyword found is " print str1.in...
0db8abbf561dbc49b3f05fce0a31e8ba1c7c69b2
adityavbhat/assignment7
/q4.py
177
4.03125
4
def power(a,b): if b == 1: return a else: return a*(power(a,b-1)) a = int(input('Enter a')) b = int(input('Enter b')) s=power(a,b) print(s)
c3eadd09c2aadcab589caa0f78b0fe552dfcf8df
minhnhoang/hoangngocminh-fundamental-c4e23
/session4/for_list.py
217
3.546875
4
items = ["chao", "mien", "pho"] number = ["I", "II", "III"] no = 1 for i in items: # print(items.index(i)+1,i, sep=". ") print(no, i) no += 1 for i in items: print(number[items.index(i)], i, sep=". ")
b81962ac8f8132117e776226c43d5d72f45a35cf
minhnhoang/hoangngocminh-fundamental-c4e23
/session4/for_list_index.py
99
3.53125
4
items = ["chao", "mien", "bun", "com"] for i in range(len(items)): print(i+1,items[i],sep=". ")
0702ece64a2e2eaffc7fa970ddf974ec2f244dbf
minhnhoang/hoangngocminh-fundamental-c4e23
/session3/password_validation.py
424
4.28125
4
pw = input("Enter password: ") while True: if len(pw) <= 8: print("Password length must be greater than 8") elif pw.isalpha(): print("Password must contain number") elif pw.isupper() or pw.islower(): print("Password must contain both lower and upper case") elif pw.isdigit(): ...
792811c1af4e47bcf56dce8874e7badb19b933e8
lathestudent/Numerical-IVP-Methods
/ODE_Approx_methods.py
7,073
3.671875
4
""" Several example functions appeared in Numerical Analysis II @instructor: Lucius, David Thau, Harry Nguyen, Numerical , Math & Stat, Georgia State University """ #import commonly used packages from __future__ import division import numpy as np # ============================== # Euler's method def euler(de...
06d6ea06c2c272f56de47b384080fef83507d687
EnthusiasticTeslim/Molecular-Dynamics
/MD_pre_calc.py
1,596
3.84375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jun 30 08:06:51 2019 @author: teslim """ def volume(L,B,H): ''' To compute the volume of a box Use the info from the gro file after creating the box from editconf L: length B: width H: Height ''' vol = L*B*H # volume in ...
89275b02004042c8468b01ceb6d806093d4774b2
neuodev/Searching-Algorithms
/Jump_Search.py
456
3.5
4
import math def jumb_search(array, target): block_size = math.sqrt(len(array)) start = 0 next_idx = int(block_size) while array[next_idx -1] < target: start= next_idx if(start >= len(array)): break next_idx = block_size if next_idx > len(array): next_idx = len(arra...
7f56dead10c634659f04435a4e797116c6a64c24
Lerjebo/Advent-of-Code-2019
/Day6.py
1,336
3.828125
4
#AAA)BBB, bbb är i omloppsbana runt aaa # c omloppar b som omloppar a, c indirekt omloppar a #com = center of mass omloppar inget allt annat gör #kanske kan leka med en rekursiv metod som kollar omlopp def orbiting(): file = open(r'C:\Users\lerjebo\Python\Advent_of_code\Day6.txt') text = file.read() ...
504a925f2cdfe716205f860362cf8a0c03d524a7
odellus/autolector
/2_using_post/using_post_client.py
660
3.625
4
import requests import json port = 5005 url = f'http://127.0.01:{port}/' def get_body(): return {'input': 'This Is The sTrInG we want in lowEr CAsE.'} def main(): body = get_body() print('This is the input to our API.') print(body) # We have to serialize the body of our post request before we ca...
f8e4c1ea660562bf6e09b9c93704401ef20a33e6
SanmatiM/mini_projects
/to_do_list/main.py
355
3.875
4
from to_do_list import ToDoList to_do=[] done=[] a=ToDoList(to_do,done) c=int(input("Enter choice\n 1:Enter task\n 2:Exit")) if c==1: n=int(input("Enter number of tasks to be added")) for i in range(n): item=input("Enter the task to be added") a.add(item) d=input("Enter the task to be marked as done") a.mark_do...
2273949ebc04b075d42217b80e297459a2312b48
Leoll1020/JPS
/src/puzzle_generator.py
1,310
4.09375
4
import MalmoPython import os import json import logging import math import sys import time import random class PuzzleGenerator: """" Class that generates mazes for our jumping agent to solve. Therefore the maps that are generated require the maze runner to jump in order to solve the puzzle...
46a86378ae9e24cf158907fb3351246135b9459a
sebastian-chang/gaming_practice
/graphics/graphics.py
2,143
3.875
4
import pygame, sys from pygame.locals import * # Set up pygame pygame.init() # Set up the window. window_surface = pygame.display.set_mode((500, 400), 0, 32) pygame.display.set_caption('Hello World!') # Set up the colors. BLACK = (0, 0, 0) WHITE = (255, 255, 255) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 2...
313e7c112b129d16ebc1d1ba9ad8a9a458f8dacc
Raoul1996/learn-python
/starter/if.py
303
4.0625
4
number = 23 guess = int(input('Enter a integer : ')) if guess == number: print('Congratulations, you guessed it') print('(but you do not win any prizes!)') elif guess < number: print('No, it\'s a little higher than that') else: print('No, it\'s a little lower than that') print('Done')
934ccf95b55cea8e473038dcd1efea39ecf2149f
CSCMC/cs.cmc-encontros
/2º Encontro/segundo.py
609
3.921875
4
def funcao(): a = 3 b = 2 print(a*b) var = "variavel sendo uma string" print(var) funcao() ###loops def first_function(): a = 10 while(a == 10): print("este eh um while loop") first_function() #else if = elif def second_function(): a = 10 if(a == 11): print("testando") elif(a...
097215209cbaf481521cdf6cd95dc2c207574c39
Zhizhizhi997/inf552
/final project/src/PolynomialRegression.py
2,221
3.875
4
import numpy as np import pandas as pd from sklearn.preprocessing import PolynomialFeatures from sklearn.linear_model import LinearRegression from sklearn.pipeline import Pipeline import matplotlib.pyplot as plt ''' using Polynomial regression to fit data. here we set an array of continuous 'offset' days as train tu...
c298d41657f00d72a8718da8741c9d0cf24acc3a
oreolu17/python-proFiles
/list game.py
1,284
4.1875
4
flag = True list = [ 10,20,30,40,50] def menu(): print("Enter 1: to insert \n Enter 2: to remove \n Enter 3: to sort \n Enter 4: to extend \n Enter 5 to reverse \n Enter 6: to transverse") def insertlist(item): list.append(item) def remove(item): list.remove(item) def sort(item): list.sort() def extend...
95e001f01c50ca3a90d13297ecd472ab9dc2c6dd
H-Graesberg/AI-methods
/BayesianNetwork/Exercise-1.py
15,998
3.734375
4
from collections import defaultdict import numpy as np class Variable: def __init__(self, name, no_states, table, parents=[], no_parent_states=[]): """ name (string): Name of the variable no_states (int): Number of states this variable can take table (list or Array of reals): Con...
056ee06398b42b0ae993d5046a2803f8f61feb9b
tylerjarvis/MathematicalElectionAnalysis
/HashClass.py
1,118
3.671875
4
from gerrychain import (GeographicPartition, Partition) class HashAssignment: def __init__(self, prime): """ Param: prime: prime number used in hashing function. It should minimize the chance of a collision. """ self.prime = prime self.value = 0 def __call__(self,partit...
76a260d82db9e7ee92e1b2039afa609647ae15b9
dimekai/LearningPython
/CursoPython/Scripts/segundo_script.py
839
3.734375
4
# -*- coding: utf-8 -*- """ Created on Tue Mar 19 18:50:33 2019 @author: kaimorts @curso : Curso Python de Udemy """ """ SI A ESTE SCRIPT NO SE LE PASAN LOS ARGUMENTOS QUE REQUIERE, EL PROGRAMA VA A FALLAR python segundo_script.py 'argumento' 5 Para evitar errores con respecto a los argumentos que se t...
6d953d280c28c4ad4317cd90c44caad768c273b7
ivankahnybediuk/python_18
/task1/task1.py
398
3.640625
4
""" Task 1 Imports practice Make a directory with 2 modules; make a function in one of them; then import this function in the other module and use that in your script of choice. """ # from addModule import addingNumb # # def adding(): # a = int(input("Enter number ")) # b = int(input("Enter number ")) # r...
eb76b24973c48ec13f24aa4545e1a829fab78a88
survivor-rommel/Tarea1_ALN
/ParedesEscobedoF/Eliminación de Gauss.py
1,043
4.0625
4
import numpy as np m=float(input("Introduce el valor de m: ")) n=float(input("Introduce el valor de n: ")) matrix=numpy.xeros((m,n)) vector =numpy.zeros((n)) x=numpy.zeros((m)) print('Introduce la matriz de coeficientes y el vector solucion') for r in range(0,m): for c in range(0,n): matrix[(r),(...
f8d696bd312f8b7e940bdf2e17fcb7d6bc89613e
GuillermoEchague/Python-Capacitacion-USACH
/inversion.py
699
4.03125
4
''' Escribir un programa que calcule el resultado de una inversión con interés compuesto preguntado al usuario el capital, el interés anual y la cantidad de periodos (en años), y muestre por pantalla el resultado obtenido. ''' print('Programa para determinar el resultado de una inversión agregando capital inicial, int...
a803b9d3f7763c6f769c1ec45f313e1d396e9a4b
aw0s/algorithms
/python/change_making_problem.py
421
3.609375
4
def get_change(change, nominals): nominals.sort(reverse=True) change_nominals = [] while change: for nominal in nominals: if change - nominal >= 0: change -= nominal change_nominals.append(nominal) break return change_nominals pr...
9dff17132ed2cf2d208d0c296d12a7fac3dc4c2d
Thomas-Muscarello/python_functions
/functionWithParams.py
226
3.5
4
#You can also give a fucntion a parameter adding the param in the function name and in the function itself: def sayhi(name): print("Hello "+ name) # To call a function enter a parameter into the function" sayhi("Thomas")
cf0ffad1f8470707cf05177287c5a085b8db0098
shubham3207/pythonlab
/main.py
284
4.34375
4
#write a program that takes three numbers and print their sum. every number is given on a separate line num1=int(input("enter the first num")) num2=int(input("enter the second num")) num3=int(input("enter the third num")) sum=num1+num2+num3 print("the sum of given number is",sum)
88156b611f678c03649097aeda43aa83ba23722d
zhuoranzhang-ryan/Python_Day_1
/iteration.py
161
3.8125
4
for i in range(5,10): print(i) word = 'data' for letter in word: print(letter) zoo = ['lion', 'elephant', 'zebra'] for animal in zoo: print(animal)
05e5e1eb30322942035b3f4102c42f4a78723865
LiamMacpherson/Game-of-Life
/view/Grid.py
1,103
3.5625
4
import tkinter as tk from model import Grid as mg class Grid: def __init__(self, grid_frame, c): self.c = c self.grid_frame = grid_frame for x in range(10): for y in range(15): live_cell = tk.Frame(self.grid_frame, bg="red", height=20, width=20) l...
40760d2a4847cbbd52930e74ba23f3846e80c5a1
cjmcv/hpc
/coroutine/asyncio/base_gather.py
546
3.703125
4
#!/usr/bin/python # -*- coding: utf-8 -*- """ brief: Use gather to execute tasks in parallel. """ import asyncio async def factorial(name, number): f = 1 for i in range(2, number+1): print("Task %s: Compute factorial(%s)..." % (name, i)) await asyncio.sleep(1) f *= i print("Task...
57c7332a0fb8b2b0547bb023ad80dae1c55fa964
TheTriangle/IAD_HW
/task1.py
338
3.75
4
def morecommon(a, b, n): firstdivs = 0 seconddivs = 0 for i in a: if i % n == 0: firstdivs += 1 for i in b: if i % n == 0: seconddivs += 1 if firstdivs > seconddivs: return True return False a = (3, 5, 6, 7, 8, 9) b = (4, 5, 7, 8, 20, 21) print(mo...
06a62bceb2499f48ec4224b168f87fca16162b3b
codesigned4/AdvancedPython
/Arithmetic-arranger(Essential)/arithmetic_arranger.py
2,056
3.734375
4
def arithmetic_arranger(problems,isCalculate=False): arranged_problems="" if len(problems)>5: return "Error: Too many problems." arranger_array = [] answers=[] for i in range(len(problems)): splittedNumbers=problems[i].split() numbers=[splittedNumbers[0],splittedNum...
b131963d87aa4b104ea9ff5c8e48a338a9c85cf8
codesigned4/AdvancedPython
/Pandas Uygulamaları/NBA oyuncu analizi/nba.py
1,134
3.734375
4
import pandas as pd data=pd.read_csv("nba.csv") #ilk 10 kayıt result=data.head(10) #Toplam kayıt sayısı result=len(data.index) #Tüm oyuncuların toplam maaş ortalaması result=data["Salary"].mean() #En yüksek maaş result=data["Salary"].max() #En yüksek maaşı alan oyuncu kimdir result=data[data["Salary"]==data["Salar...
e4921306335370f3002d533ead54d5d3fa5feb3e
Nikronic/Optimized-MDVRP
/utils/customer.py
898
3.96875
4
class Customer: """ Customer class represents each node to be serviced by the vehicles. These customers is going to fll `Depot` classes. """ def __init__(self, id, x, y, cost, null=False): """ :param id: ID assigned to node for tracking :param x: X coordinate of depot ...
b7992e8675e1f6defa2076e59298a4d29843a5ee
jfenc91/Token-Ring-Simulator
/input/Project_2_GenerateInput.py
1,271
3.796875
4
#!/usr/bin/python # # CSE/IT 353: Data and Computer Communications # Project 1: Token Ring Emulation # GenerateInput.py: Input file generator # # Written by: Juston Moore # September 28, 2009 # import sys import random # Check for command-line argument if len(sys.argv) != 2: nodes = 5 # print "Usage: GenerateInput....
d3a882a461e6f5b853ea7202592418618539c5e1
llmaze3/RollDice.py
/RollDice.py
679
4.375
4
import random import time #Bool variable roll_again = "yes" #roll dice until user doesn't want to play while roll_again == "yes" or roll_again == "y" or roll_again == "Yes" or roll_again == "Y" or roll_again == "YES": print("\nRolling the dice...") #pause the code so that it feels like dice is being rolled #sleep ...
996e0326f7bcf336928f9c0d5bd1e43f48dedbc5
marisaroude/algoritmos_2021
/pila.py
851
3.859375
4
class Pila(object): def __init__(self): self.__elementos = [] self.__nombre = '' def apilar(self, dato): self.__elementos.append(dato) def desapilar(self): return self.__elementos.pop() def pila_vacia(self): return len(self.__elementos) == 0 def ...
0decabb5e3d41ea9f1ac1f4415cd0512beda46ed
marisaroude/algoritmos_2021
/prueba_cola.py
2,772
3.65625
4
from cola import Cola from random import randint cola_datos = Cola() # cola_aux = Cola() # for i in range(0, 10): # num = randint(0, 100) # cola_datos.arribo(num) # print(num) # print() # cantidad_elemento = 0 # while(cantidad_elemento < cola_datos.tamanio()): # dato = cola_datos.mover_final() # ...
576939fe51d8a509d033cfbc5237471fad1ef469
Taninlerts/270702-Quiz-14-16
/270702 - Quiz 15 - Create a Matrix X4x3 - Tanin Lertsiriladakul - 630531012.py
436
3.671875
4
# -*- coding: utf-8 -*- """ Created on Wed Aug 4 15:34:22 2021 @author: Tanin Lertsiriladakul 630531012 """ #Quiz 15 : Creat a Matrix X4*3 import numpy as np m = np.array([[1,2,3], [4,5,6], [7,8,9], [10,11,12]]).reshape(4,3) print(m) m[2,:] #array([7, 8, 9]) m[2:] #array([[ 7, ...
037e31bb7eec1ab36547b15ab2a6c75387045094
joseph-galindo/necrobot
/necrobot/util/level.py
1,129
3.578125
4
LEVEL_UNKNOWN_DEATH = int(0) LEVEL_NOS = int(-1) LEVEL_FINISHED = int(-2) LEVEL_MAX = 21 # with level_str in the form x-y, returns the level as a number from 1 to 21, or -1 if invalid def from_str(level_str): args = level_str.split('-') if len(args) == 2: try: world = int(args[0]) ...
32d97bb2927ece6bd19de4df67e17ccba38e09bf
joseph-galindo/necrobot
/necrobot/command/clparse.py
2,096
3.84375
4
# "args" should be a list of strings like [-command1, arg1, arg2, -command2, -command3, arg3, ...]; # this command returns the list [command1, arg1, arg2] and pops those three elements from the front of the list. # if the list does not start with a -command, this returns an empty list and pops nothing # Notes: strips...
b5f5b608df48358f0c7f8e1484db01859f486fa5
DevMTech/Data-Structures-and-Algorithms
/airportgraph-prob.py
6,076
3.546875
4
## Q2 Ext H # Airport Connections # You are given a list of airports (three-letter codes like 'JFK'), a list of routes # (one-way flights from one airport to another like ['JFK', 'SFO']), and a starting airport. # Write a function that returns the minimum number of airport connections (one-way flights) # that ne...
38096a020e23bd87b6a423270c58577c750c084c
DevMTech/Data-Structures-and-Algorithms
/Question2-FileRecursion.py
1,106
4.03125
4
# coding: utf-8 # In[104]: def find_files(suffix, path): """ Find all files beneath path with file name suffix. Note that a path may contain further subdirectories and those subdirectories may also contain further subdirectories. There are no limit to the depth of the subdirectories can be. ...
a816397fbc4778e45e83f6f73ca72e41ff56e4c0
StevenLOL/kaggleScape
/data/script485.py
1,912
3.703125
4
# coding: utf-8 # # Introduction # This example shows that how you could use OpenCV to detect and count white areas in an image. # # 1. Pick a random image # In[ ]: import numpy as np import matplotlib.pyplot as plt import cv2 get_ipython().run_line_magic('matplotlib', 'inline') ID = '0a7d30b252359a10fd298b638b...
246d6138de3857dd8bf9a4488ebcce3d9f1c7144
StevenLOL/kaggleScape
/data/script87.py
1,355
4.34375
4
# coding: utf-8 # Read in our data, pick a variable and plot a histogram of it. # In[4]: # Import our libraries import matplotlib.pyplot as plt import pandas as pd # read in our data nutrition = pd.read_csv("../input/starbucks_drinkMenu_expanded.csv") # look at only the numeric columns nutrition.describe() # Thi...
c6580077a1370546ad862037a77f75ced9993546
StevenLOL/kaggleScape
/data/script761.py
9,538
3.546875
4
# coding: utf-8 # # Montecarlo Model Selection # # In this notebook we apply a montecarlo based feature selection method to identify a reduced number of features that can be used as a good predictor for this credit card fraud dataset. Using a reduced number of features is of crucial importance when overfitting need...
f46c59e0b2126cde513c0cc7638c1f47e243b453
StevenLOL/kaggleScape
/data/script476.py
4,711
3.578125
4
# coding: utf-8 # # Fast benchmark: Pillow vs OpenCV # # *Background: when we deal with images in image-based problems and deploy a deep learning solution, it is better to have a fast image reading and transforming library. Let's compare Pillow and OpenCV python libraries on image loading and some basic transformati...
7f9e46e2f9061404293d0bc4852c5d5f8c0dc6b1
StevenLOL/kaggleScape
/data/script333.py
3,828
3.546875
4
# coding: utf-8 # ## Duplicates of Duplicates # In this notebook, we will take a look at connected groups of questions that are marked as duplicates of each other. # What we will find is that, at least in the training set, duplicates tend to occur in clusters of related questions. # In[ ]: import numpy as np impor...
88811c4cbd4aa9a66505fc06d413ea94de9b95dd
StevenLOL/kaggleScape
/data/script116.py
14,908
3.890625
4
# coding: utf-8 # # Why are so many employees leaving? and Who exactly are these employees? # ** First let's do some exploratory analysis on our data! ** # In[ ]: import pandas as pd import matplotlib.pyplot as plt get_ipython().run_line_magic('matplotlib', 'inline') import seaborn as sns import numpy as np from ...
831e1ad938614c291f64a2bb6279531ee39495b4
StevenLOL/kaggleScape
/data/script1135.py
17,638
3.640625
4
# coding: utf-8 # # Exoplanet Data Exploration # # Here are some of my initial attempts to look at the exoplanet datasets from Kepler. The dataset is highly unbalanced, so a fully automated analysis will be quite difficult. We also have to be careful since there are other effects such as rotating spots that might fa...
d7fc35adf3b71654c666069eaac75ca8010936ef
StevenLOL/kaggleScape
/data/script123.py
3,757
4
4
# coding: utf-8 # # Introduction # Welcome to the **[Learn Pandas](https://www.kaggle.com/learn/pandas)** track. These hands-on exercises are targeted for someone who has worked with Pandas a little before. # Each page it's own list of `relevant resources` you can use if you get stumped. The top item in each list ha...
4fd348a481c1a5a9884e743abd0364b57151a5d7
StevenLOL/kaggleScape
/data/script5.py
10,718
3.546875
4
# coding: utf-8 # # Introduction # # Thanks to [Peter Giannakopoulos](https://www.kaggle.com/petrosgk) and [Heng CherKeng](https://www.kaggle.com/hengck23) for their starter kits. I collected their data augmentation methods and added a few based on the keras.preprocessing.image. # # Let me know if they help your le...
5e14595f39bc3acf8aafcc10cd7b905ee7d4de78
StevenLOL/kaggleScape
/data/rscript382.py
4,178
3.515625
4
# coding: utf-8 __author__ = 'ZFTurbo: https://kaggle.com/zfturbo' import pandas as pd import numpy as np import math INPUT_PATH = '../input/' def lcm(a, b): """Compute the lowest common multiple of a and b""" # in case of large numbers, using floor division return a * b // math.gcd(a, b) def avg_norm...
5e8d89671d82ef2e4bacba3e869c97df81cb0171
StevenLOL/kaggleScape
/data/script691.py
5,720
3.59375
4
# coding: utf-8 # In this notebook, we'll see if we can use some machine learning to classify whether a subject is relaxing, or doing math problems, using data from our dataset. # # Along the way, we'll learn how to get the subject data we want, and how to turn the raw EEG data into useable feature vectors. # # Rea...
c7aae11f88a927e129554434bed63bd30d1c7cb6
StevenLOL/kaggleScape
/data/script909.py
2,421
3.625
4
# coding: utf-8 # ## Which countries use a unit other than ppm to measure any type of pollution? # ___ # In[ ]: # import package with helper functions import bq_helper # create a helper object for this dataset open_aq = bq_helper.BigQueryHelper(active_project="bigquery-public-data", ...
a88734184d440e29c59e6df131b2d069ee5356ba
StevenLOL/kaggleScape
/data/script456.py
9,781
4.1875
4
# coding: utf-8 # # Let's perform analysis! # # Hello, I'm Dixhom. Here I talk about how to preform feature engineering, delete unwanted variables, build a model and make submission data! So this is a tutorial for data science beginners. So let's get the ball rolling. # # (This is for a kaggle competition 'Kobe Bry...
3039670a0bc3fda7024a1f0e9d7086c5e631df93
StevenLOL/kaggleScape
/data/script1058.py
8,340
3.765625
4
# coding: utf-8 # # Open Food Facts Visualization # In[ ]: import pandas as pd import numpy as np # In[ ]: from matplotlib import pyplot as plt get_ipython().run_line_magic('matplotlib', 'inline') import seaborn # In[ ]: food = pd.read_csv("../input/FoodFacts.csv") # There are a lot of NaNs in a dataset:...
7dd893f4b078c29fec32434d7ab641f867867da2
StevenLOL/kaggleScape
/data/script827.py
4,168
4.1875
4
# coding: utf-8 # ### Building a Convolutional Network on only 2 features: # Author - Alexandru Papiu # # Convolutional Nets can be thought of as feature extractors - they take in an image that is very high dimensional and return a learned representation of this image that consists of higher level features that help...
ce83df516d8e605e27b5356ecf86b437ff03695c
StevenLOL/kaggleScape
/data/script371.py
12,789
3.578125
4
# coding: utf-8 # Hi all, # # This is my first Kernel on Kaggle. # # I will try to build a rough model using Gaussian Distribution to detect Anamolous transactions. # # **Reason behind using Gaussian Distribution:-** <br> # If I can summarize what Andrew Ng has mentioned in his lecture on Anomaly detection is # ...
3d05157a82e0789f3f4af7db4b4a39e46534fb70
StevenLOL/kaggleScape
/data/script105.py
2,404
3.84375
4
# coding: utf-8 # # Intro # **This is Lesson 8 in the [Deep Learning](https://www.kaggle.com/learn/machine-learning) track** # # At the end of this lesson, you will understand and know how to use # - **Stride lengths** to make your model faster and reduce memory consumption # - **Dropout** to combat overfitting # ...
495eba93f5a4b0b938b6298cd7b11d6956af55b0
StevenLOL/kaggleScape
/data/script489.py
3,850
4.5
4
# coding: utf-8 # *This tutorial is part of the series [Learn Machine Learning](https://www.kaggle.com/learn/machine-learning). At the end of this step, you will be able to use your first sophisticated machine learning model, the Random Forest.* # # # Introduction # # Decision trees leave you with a difficult decis...
b6ed484b7aef0ca44283a8e5b887749c6a936345
StevenLOL/kaggleScape
/data/script886.py
6,820
3.609375
4
# coding: utf-8 # # Analysis of the MNIST dataset # # # # In this analysis we will apply the following methods to the MNIST classification problem: # # 1) Random forest classification # # 2) Principal component analysis (PCA) + k-nearest neighbours (kNN) # In[ ]: # load the modules import numpy as np import ...
c05fcb8a6ee4469ef37d18aa27623f5c6b570b5d
StevenLOL/kaggleScape
/data/script781.py
13,889
3.53125
4
# coding: utf-8 # ## Introduction ## # I previously wrote a "naive betting analysis" kernel (see [here][1]), wherein I explored if we'd make a profit by just betting on the favourite or the longshot outcome in each match. Turns out those strategies would only yield losses in the long run, so other smarter strategies ...
c126b49b8d622629f5116a496714e1a75342e21e
StevenLOL/kaggleScape
/data/script1259.py
3,943
3.5
4
# coding: utf-8 # In[ ]: import pandas as pd import seaborn as sns import numpy as np import matplotlib.pyplot as plt get_ipython().run_line_magic('matplotlib', 'inline') import warnings warnings.filterwarnings('ignore') # # Average temperature in each season # Let's look how the temperature was changing in ea...
4787a599e6d3363e87fc9500e67d8fb929eb96f6
thliang01/PythonBot
/ELIZA I: asking questions.py
1,393
3.875
4
import random bot_template = "BOT : {0}" user_template = "USER : {0}" # Define a function that sends a message to the bot: send_message def send_message(message): # Print user_template including the user_message print(user_template.format(message)) # Get the bot's response to the message response = r...
44b52cb92da7ef760eec45c95f91d75d7a4a6748
src8655/python_ch2.2
/comprehension.py
982
3.6875
4
results = [] for n in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]: result = n * n results.append(result) print(results) # 더 간결하게 할 수 있다 results = [n*n for n in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]] print(results) # 문자열 리스트에서 길이가 2 이하인 문자열 리스트 strings = [s for s in ['a', 'as', 'bar', 'car', 'dove', 'python'] if len(s) <= 2] ...